Skip to content

Commit

Permalink
Magento 2.4.5-p3 upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
chandan-PS committed Sep 29, 2023
1 parent 6e0df70 commit d2aeb64
Show file tree
Hide file tree
Showing 62 changed files with 2,030 additions and 1,034 deletions.
7 changes: 6 additions & 1 deletion Block/Adminhtml/System/Config/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ public function __construct(
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$element->setWysiwyg(true);
$element->setConfig($this->_wysiwygConfig->getConfig($element));
$confgiData = $this->_wysiwygConfig->getConfig($element);
$confgiData->setplugins([]);
$confgiData->setadd_variables(0);
$confgiData->setadd_widgets(0);

$element->setConfig($confgiData);
return parent::_getElementHtml($element);
}
}
4 changes: 2 additions & 2 deletions Block/Multishipping/Paybylink/Email/Addresses.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/**
* Worldpay Multishipping PayByLink Shipment address
*
* @author Magento Core Team <core@magentocommerce.com>
*/
namespace Sapient\Worldpay\Block\Multishipping\Paybylink\Email;

Expand Down Expand Up @@ -38,8 +37,9 @@ class Addresses extends \Magento\Framework\View\Element\Template
* constructor
*
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Customer\Model\Address\Config $addressConfig,
* @param \Magento\Customer\Model\Address\Config $addressConfig
* @param \Sapient\Worldpay\Logger\WorldpayLogger $wplogger
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
* @param array $data
*/
public function __construct(
Expand Down
52 changes: 52 additions & 0 deletions Block/MultishippingCheckoutLink.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Sapient\Worldpay\Block;

/**
* Multishipping cart link
*
* @api
* @since 100.0.2
*/
class MultishippingCheckoutLink extends \Magento\Multishipping\Block\Checkout\Link
{
/**
* @var \Sapient\Worldpay\Helper\Recurring
*/
protected $_sapientHelper;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Multishipping\Helper\Data $helper
* @param \Sapient\Worldpay\Helper\Recurring $sapientHelper
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Multishipping\Helper\Data $helper,
\Sapient\Worldpay\Helper\Recurring $sapientHelper,
array $data = []
) {
$this->_sapientHelper = $sapientHelper;
parent::__construct($context, $helper, $data);
}

/**
* Render Quote information and return result html
*
* @return string
*/

public function _toHtml ()
{
if (!$this->helper->isMultishippingCheckoutAvailable()) {
return '';
}
if ($this->_sapientHelper->quoteContainsSubscription($this->getQuote())) {
return '';
}
return parent::_toHtml();
}
}
5 changes: 0 additions & 5 deletions Block/SavedCardLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
use Sapient\Worldpay\Model\WorldpayConfigProvider;
use Sapient\Worldpay\Helper\Data;

/**
* Description of SavedCardLink
*
* @author aatrai
*/
class SavedCardLink extends \Magento\Framework\View\Element\Html\Link\Current
{

Expand Down
5 changes: 0 additions & 5 deletions Block/SubscriptionsLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
use Sapient\Worldpay\Helper\Recurring;
use Sapient\Worldpay\Helper\Data;

/**
* Description of SubscriptionsLink
*
* @author aatrai
*/
class SubscriptionsLink extends \Magento\Framework\View\Element\Html\Link\Current
{

Expand Down
8 changes: 6 additions & 2 deletions Block/Wallets.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,12 @@ public function getJsLayout(): string
['gpaybutton_locale'] = $this->worldpayHelper->getGpayButtonLocale();

$this->jsLayout['components']['wp-wallet-pay']['config']['purchaseUrl'] = $purchaseUrl;
$this->jsLayout['components']['wp-wallet-pay']['config']['sessionId'] = $this->session->getSessionId();
$this->jsLayout['components']['wp-wallet-pay']['config']['store_code'] = $this->getCurrentStoreCode();
$this->jsLayout['components']['wp-wallet-pay']['config']
['sessionId'] = $this->session->getSessionId();
$this->jsLayout['components']['wp-wallet-pay']['config']
['store_code'] = $this->getCurrentStoreCode();
$this->jsLayout['components']['wp-wallet-pay']['config']
['default_country_code'] = $this->worldpayHelper->getStoreDefaultCountry();

$this->jsLayout['components']['wp-wallet-pay']['config']
['countriesHtml'] = $this->getCountriesHtml(null, 'country_id', 'country', 'Country');
Expand Down
39 changes: 38 additions & 1 deletion Block/Webpayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ class Webpayment extends Template
*/
protected $httpRequest;

/**
* @var \Magento\Customer\Helper\Session\CurrentCustomerAddress
*/
protected $currentCustomerAddress;

/**
* Webpayment constructor
*
Expand All @@ -110,6 +115,7 @@ class Webpayment extends Template
* @param SerializerInterface $serializer
* @param Magento\Framework\View\Asset\Repository $assetRepo
* @param Magento\Framework\App\Request\Http $httpRequest
* @param Magento\Customer\Helper\Session\CurrentCustomerAddress $currentCustomerAddress
* @param array $data
*/
public function __construct(
Expand All @@ -126,11 +132,13 @@ public function __construct(
SerializerInterface $serializer,
\Magento\Framework\View\Asset\Repository $assetRepo,
\Magento\Framework\App\Request\Http $httpRequest,
\Magento\Customer\Helper\Session\CurrentCustomerAddress $currentCustomerAddress,
array $data = []
) {

$this->_helper = $helper;
$this->_cart = $cart;
$this->currentCustomerAddress = $currentCustomerAddress;
parent::__construct(
$context,
$data
Expand Down Expand Up @@ -201,7 +209,6 @@ public function getShippingRate()
{
$quote = $this->_cart->getTotalsCache();
$getShippingRate = $quote['shipping']->getData('value');

return $getShippingRate;
}
/**
Expand Down Expand Up @@ -582,4 +589,34 @@ public function isCheckoutCartPage()
}
return false;
}
/**
* Array for Billing Address
*
* @param AddressInterface $address
* @return string
*/
public function getDefaultBillingAddress()
{
$response = [];
$response['status'] = false;
if (!$this->_customerSession->isLoggedIn()) {
$response['message'] = __('Please log in to continue.');
return json_encode($response);
}
$address = $this->currentCustomerAddress->getDefaultBillingAddress();
if ($address) {
$response['status'] = true;
$response['addressLine'] = $address->getStreet();
$response['city'] = $address->getCity();
$response['country'] = $address->getCountryId();
$response['phone'] = $address->getTelephone();
$response['postalCode'] = $address->getPostcode();
$response['recipient'] = $address->getFirstname().' '.$address->getLastname();
$response['region'] = $address->getRegion()->getRegion();
$response['region_id'] = $address->getRegionId();
} else {
$response['message'] = __('You have not set a default billing address.');
}
return json_encode($response);
}
}
5 changes: 0 additions & 5 deletions Controller/Adminhtml/Cancel/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
use Magento\Framework\Controller\Result\JsonFactory;
use Exception;

/**
* Description of Index
*
* @author aatrai
*/
class Index extends \Magento\Backend\App\Action
{
/**
Expand Down
3 changes: 3 additions & 0 deletions Controller/Paybylink/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ public function execute()
{
$this->wplogger->info('Pay by link Process controller executed.');
$orderCode = $this->request->getParam('orderkey');
if (empty($orderCode)) {
return $this->resultRedirectFactory->create()->setPath('checkout/cart', ['_current' => true]);
}
$orderIncrementId = current(explode('-', $orderCode));
$orderInfo = $this->orderItemsDetails->loadByIncrementId($orderIncrementId);
if ($orderInfo->getId()) {
Expand Down
2 changes: 1 addition & 1 deletion Controller/Payment/Pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function execute()

$this->jsonGenerator($paymentManifestJson, self::PAYMENT_MANIFEST_JSON);
$this->jsonGenerator($paymentAppManifestjson, self::MANIFEST_JSON);

$result->setContents('');
$result->setHeader('link', '<'.$mediPathPaymentManifest.'>; rel="payment-method-manifest"');
return $result;
}
Expand Down
36 changes: 21 additions & 15 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -2707,32 +2707,25 @@ public function getCurrentMagentoVersionDetails()
* Get Plugin Tracker Details
*
* @param string $username
* @param SimpleXMLElement $xmlQuote
* @param string $merchantCode
*/
public function getPluginTrackerdetails($username, $xmlQuote)
public function getPluginTrackerdetails()
{
$details=[];

$xmlquoteData = clone($xmlQuote);
$quoteData = new \SimpleXmlElement($xmlquoteData->saveXML());
$merchantCode = (string) $quoteData['merchantCode'];
$details['MERCHANT_ID'] = $merchantCode;
$details['API_USERNAME'] = $username;
$magento = $this->getCurrentMagentoVersionDetails();
$details['MAGENTO_EDITION'] = $magento['Edition'];
$details['MAGENTO_VERSION'] = $magento['Version'];
$details['PHP_VERSION'] = $this->getPhpVersionUsed();
$details['partner_edition'] = $magento['Edition'];
$details['partner_version'] = $magento['Version'];
$details['php_version'] = $this->getPhpVersionUsed();

if (($this->getCurrentWopayPluginVersion()!=null) && !empty($this->getCurrentWopayPluginVersion())) {
$details['CURRENT_WORLDPAY_PLUGIN_VERSION'] = $this->getCurrentWopayPluginVersion();
$details['plugin_version'] = $this->getCurrentWopayPluginVersion();
}

if (($this->getWopayPluginVersionHistory()!=null) && !empty($this->getWopayPluginVersionHistory())) {
$details['WORLDPAY_PLUGIN_VERSION_USED_TILL_DATE'] = $this->getWopayPluginVersionHistory();
$details['worldpay_plugin_version_used_till_date'] = $this->getWopayPluginVersionHistory();
}

if (($this->getUpgradeDates()!=null) && !empty($this->getUpgradeDates())) {
$details['UPGRADE_DATES'] = $this->getUpgradeDates();
$details['upgrade_dates'] = $this->getUpgradeDates();
}
return $details;
}
Expand Down Expand Up @@ -3189,4 +3182,17 @@ public function getOrderByOrderIncId($orderIncId)
{
return $this->orderFactory->create()->loadByIncrementId($orderIncId);
}
/**
* Get Default country code of Magento store
*
* @param int $storeId
* @return string
*/
public function getStoreDefaultCountry($storeId = null)
{
return $this->_scopeConfig->getValue(
'general/country/default',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
}
7 changes: 5 additions & 2 deletions Model/Authorisation/PayByLinkService.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,16 @@ public function authorizePayment(

/**
* Get PBL expiry time
*
*/
public function getPayByLinkExpiryTime()
{
$currentDate = date('Y-m-d H:i:s');
$pblExpiryConfiguration = $this->worldpayhelper->getPayByLinkExpiryTime();
$interval = date("Y-m-d H:i:s", $this->worldpayhelper->findPblOrderExpiryTime($currentDate, $pblExpiryConfiguration));
$interval = date("Y-m-d H:i:s", $this->worldpayhelper
->findPblOrderExpiryTime(
$currentDate,
$pblExpiryConfiguration
));
return $interval;
}

Expand Down
3 changes: 3 additions & 0 deletions Model/Authorisation/ThreeDSecureChallenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ public function continuePost3dSecure2AuthorizationProcess($directOrderParams, $t
if ($e->getMessage() === 'Asymmetric transaction rollback.') {
$errorMessage = $this->paymentservicerequest->getCreditCardSpecificException('CCAM16');
$this->_messageManager->addError(__($errorMessage));
} elseif ($e->getMessage()=== 'Unique constraint violation found') {
$errorMessage = $this->paymentservicerequest->getCreditCardSpecificException('CCAM22');
$this->_messageManager->addError(__($errorMessage));
} else {
$this->_messageManager->getMessages(true);
$this->_messageManager->
Expand Down
6 changes: 6 additions & 0 deletions Model/Authorisation/WalletService.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ public function authorizePayment(
</reasonCodes></FraudSight></payment></orderStatus></reply></paymentService>';
*/
$directResponse = $this->directResponse->setResponse($response);
if ($paymentDetails['additional_data']['cc_type'] == 'APPLEPAY-SSL') {
$responseXml=$directResponse->getXml();
$orderStatus = $responseXml->reply->orderStatus;
$paymentxml=$orderStatus->payment;
$paymentxml->paymentMethod[0] = 'APPLEPAY-SSL';
}
$this->updateWorldPayPayment->create()->updateWorldpayPayment($directResponse, $payment);
$this->_applyPaymentUpdate($directResponse, $payment);
}
Expand Down
5 changes: 3 additions & 2 deletions Model/Config/Source/DebitNetworks.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php

/**
* @copyright 2017 Sapient
*/
namespace Sapient\Worldpay\Model\Config\Source;

/**
* Description of DebitNetworks
*
* @author aatrai
*/
class DebitNetworks extends \Magento\Framework\App\Config\Value
{
Expand Down
6 changes: 3 additions & 3 deletions Model/Config/Source/RoutingPreference.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php


/**
* @copyright 2017 Sapient
*/
namespace Sapient\Worldpay\Model\Config\Source;

/**
* Description of RoutingPrefernce
*
* @author aatrai
*/
class RoutingPreference implements \Magento\Framework\Option\ArrayInterface
{
Expand Down
Loading

0 comments on commit d2aeb64

Please sign in to comment.