Skip to content

Commit

Permalink
Merge pull request #115 from Worldpay/release-v2.4.6-rc0523
Browse files Browse the repository at this point in the history
Magento 2.4.6 upgrades
  • Loading branch information
chandan-PS authored May 30, 2023
2 parents 28eda8b + 5efc2c8 commit 602dd1c
Show file tree
Hide file tree
Showing 253 changed files with 9,081 additions and 906 deletions.
33 changes: 33 additions & 0 deletions Block/Addnewcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,39 @@ class Addnewcard extends \Magento\Framework\View\Element\Template
* @var \Magento\Customer\Model\Session
*/
protected $_customerSession;
/**
* @var \Sapient\Worldpay\Helper\Data
*/
protected $worldpayHelper;

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

/**
* @var \Magento\Customer\Model\Address\Config
*/
protected $_addressConfig;
/**
* @var \Magento\Customer\Model\Address\Mapper
*/
protected $addressMapper;
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
protected $scopeConfig;

/**
* @var \Magento\Framework\Message\ManagerInterface
*/
protected $_messageManager;

/**
* @var \Magento\Integration\Model\Oauth\TokenFactory
*/
protected $_tokenModelFactory;

/**
* @var array
*/
Expand Down
5 changes: 4 additions & 1 deletion Block/Adminhtml/Form/Field/Paymentmethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

class Paymentmethod extends \Magento\Framework\View\Element\Html\Select
{

/**
* @var \Sapient\Worldpay\Model\Utilities\PaymentMethods
*/
public $paymentutils;
/**
* Paymentmethod constructor.
*
Expand Down
41 changes: 41 additions & 0 deletions Block/Adminhtml/Order/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,36 @@ class View extends \Magento\Backend\Block\Template
*/
protected $_worldpaymentFactory;

/**
* @var \Sapient\Worldpay\Helper\Multishipping
*/
protected $multishippingHelper;

/**
* @var \Sapient\Worldpay\Helper\Data
*/
protected $helper;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Sapient\Worldpay\Model\WorldpaymentFactory $worldpaymentFactory
* @param \Sapient\Worldpay\Helper\Multishipping $multishippingHelper
* @param \Sapient\Worldpay\Helper\Data $worldpayhelper
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
\Sapient\Worldpay\Model\WorldpaymentFactory $worldpaymentFactory,
\Sapient\Worldpay\Helper\Multishipping $multishippingHelper,
\Sapient\Worldpay\Helper\Data $worldpayhelper,
array $data = []
) {
$this->registry = $registry;
$this->_worldpaymentFactory= $worldpaymentFactory;
$this->multishippingHelper = $multishippingHelper;
$this->helper = $worldpayhelper;
parent::__construct($context, $data);
}
/**
Expand Down Expand Up @@ -105,4 +118,32 @@ public function getMultishippingOrderIds()
$multishipping_orders = substr($multishipping_orders, 1);
return $multishipping_orders;
}
/**
* Retrieve Worldpay Xml user name
*
* @param string $paymentType
* @param boolean $ismultishipping
* @return string
*/
public function getXmluserName($paymentType, $ismultishipping)
{
$xmlUsername = $this->helper->getXmlUsername($paymentType);
$paymentMethod= $this->getPaymentMethod();
if ($ismultishipping) {
$msMerchantUn = $this->helper->getMultishippingMerchantUsername();
$xmlUsername = !empty($msMerchantUn) ? $msMerchantUn : $xmlUsername;
}

if ($paymentMethod=='worldpay_moto') {
$xmlUsernameMoto = $this->helper->getMotoUsername();
$xmlUsername = !empty($xmlUsernameMoto) ? $xmlUsernameMoto : $xmlUsername;
}

if ($paymentMethod=='worldpay_paybylink') {
$pblMerchantUn = $this->helper->getPayByLinkMerchantUsername();
$xmlUsername = !empty($pblMerchantUn) ? $pblMerchantUn : $xmlUsername;
}

return $xmlUsername;
}
}
4 changes: 4 additions & 0 deletions Block/Adminhtml/System/Config/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

class Editor extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @var WysiwygConfig
*/
protected $_wysiwygConfig;
/**
* @var Registry
*/
Expand Down
12 changes: 11 additions & 1 deletion Block/ApplePay/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ class Button extends Template
*/
protected $session;

/**
* @var \Sapient\Worldpay\Logger\WorldpayLogger
*/
protected $wplogger;

/**
* @var \Sapient\Worldpay\Helper\Data
*/
protected $worldpayHelper;

/**
* Button constructor.
* @param Context $context
Expand All @@ -36,7 +46,7 @@ class Button extends Template
*/
public function __construct(
Context $context,
\Sapient\Worldpay\Logger\WorldpayLogger $wplogger,
WorldpayLogger $wplogger,
\Sapient\Worldpay\Helper\Data $helper,
array $data = []
) {
Expand Down
5 changes: 5 additions & 0 deletions Block/Catalog/Product/SubscriptionPlans.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class SubscriptionPlans extends \Magento\Catalog\Block\Product\AbstractProduct
*/
private $encoder;

/**
* @var Data
*/
private $worldpayHelper;

/**
* @param \Magento\Catalog\Block\Product\Context $context
* @param \Sapient\Worldpay\Helper\Recurring $recurringHelper
Expand Down
4 changes: 2 additions & 2 deletions Block/Challenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
class Challenge extends \Magento\Framework\View\Element\Template
{
/**
* @var Sapient\Worldpay\Helper\Data;
* @var \Sapient\Worldpay\Helper\Data;
*/

protected $helper;
protected $_helper;

/**
* @var \Magento\Checkout\Model\Session
Expand Down
4 changes: 4 additions & 0 deletions Block/Checkout/Hpp/ChallengeIframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

class ChallengeIframe extends \Magento\Framework\View\Element\Template
{
/**
* @var \Sapient\Worldpay\Model\Checkout\Hpp\Json\Config\Factory
*/
public $configfactory;
/**
* Constructor
*
Expand Down
9 changes: 8 additions & 1 deletion Block/Checkout/Hpp/Json/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@

class Config extends \Magento\Framework\View\Element\Template
{

/**
* @var \Sapient\Worldpay\Model\Checkout\Hpp\Json\Config\Factory
*/
public $configfactory;
/**
* @var \Sapient\Worldpay\Logger\WorldpayLogger
*/
public $wplogger;
/**
* Constructor
*
Expand Down
64 changes: 53 additions & 11 deletions Block/Checkout/Multishipping/Billing.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ class Billing extends \Magento\Multishipping\Block\Checkout\Billing
* @var \Sapient\Worldpay\Helper\Data
*/
protected $wpHelper;
/**
* @var CheckoutHelper
*/
protected $checkoutHelper;

/**
* Constructor
Expand All @@ -74,10 +78,10 @@ class Billing extends \Magento\Multishipping\Block\Checkout\Billing
* @param PriceCurrencyInterface $priceCurrency
* @param \Magento\Quote\Model\Quote\TotalsCollector $totalsCollector
* @param \Magento\Quote\Model\Quote\TotalsReader $totalsReader
* @param Sapient\Worldpay\Helper\Data $wpHelper
* @param CheckoutHelper $checkoutHelper
* @param \Sapient\Worldpay\Helper\Data $wpHelper
* @param array $data
* @param array $additionalChecks
* @param ?CheckoutHelper $checkoutHelper = null
*/

public function __construct(
Expand All @@ -91,15 +95,16 @@ public function __construct(
PriceCurrencyInterface $priceCurrency,
\Magento\Quote\Model\Quote\TotalsCollector $totalsCollector,
\Magento\Quote\Model\Quote\TotalsReader $totalsReader,
CheckoutHelper $checkoutHelper,
\Sapient\Worldpay\Helper\Data $wpHelper,
array $data = [],
array $additionalChecks = [],
?CheckoutHelper $checkoutHelper = null,
array $additionalChecks = []
) {
$this->_multishipping = $multishipping;
$this->_checkoutSession = $checkoutSession;
$this->paymentSpecification = $paymentSpecification;
$data['checkoutHelper'] = $checkoutHelper ?? ObjectManager::getInstance()->get(CheckoutHelper::class);
$this->checkoutHelper = $checkoutHelper;
$data['checkoutHelper'] = $this->checkoutHelper;
$this->_taxHelper = $taxHelper;
$data['taxHelper'] = $this->_taxHelper;
$this->wpHelper = $wpHelper;
Expand All @@ -124,12 +129,8 @@ public function __construct(
*/
protected function _prepareLayout()
{
if ($this->isWorldpayEnable()) {
$this->setTemplate('Sapient_Worldpay::multishipping/billing/billing.phtml');
$this->pageConfig->addBodyClass('worldpay-multishipping');
} else {
$this->setTemplate('Magento_Multishipping::checkout/billing.phtml');
}
$this->setTemplate('Sapient_Worldpay::multishipping/billing/billing.phtml');
$this->pageConfig->addBodyClass('worldpay-multishipping');
return parent::_prepareLayout();
}
/**
Expand Down Expand Up @@ -384,4 +385,45 @@ public function isWorldpayEnable()
{
return $this->wpHelper->isWorldPayEnable();
}
/**
* Get worldpay method code
*/
public function getWorldpayMethodsCode()
{
return [
'worldpay_cc',
'worldpay_apm',
'worldpay_wallets'
];
}
/**
* Get Worldpay Methods
*/
public function getWorldpayMethods()
{
$allMethods = $this->getMethods();
$wpMethods = $this->getWorldpayMethodsCode();
$wpPaymentMethods = [];
foreach ($allMethods as $method) {
if (in_array($method->getCode(), $wpMethods)) {
$wpPaymentMethods[] = $method;
}
}
return $wpPaymentMethods;
}
/**
* Get other Payment methods
*/
public function getOtherPaymentMethods()
{
$allMethods = $this->getMethods();
$wpMethods = $this->getWorldpayMethodsCode();
$otherPaymentMethods = [];
foreach ($allMethods as $method) {
if (!in_array($method->getCode(), $wpMethods)) {
$otherPaymentMethods[] = $method;
}
}
return $otherPaymentMethods;
}
}
5 changes: 5 additions & 0 deletions Block/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class Edit extends \Magento\Framework\View\Element\Template
* @var \Magento\Customer\Model\Session
*/
protected $_customerSession;

/**
* @var \Sapient\Worldpay\Helper\Data
*/
protected $worldpayHelper;
/**
* @var array
*/
Expand Down
40 changes: 40 additions & 0 deletions Block/Form/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,46 @@ class Card extends \Magento\Payment\Block\Form
* @var worldpayPaymentsMoto
*/
private $worldpayPaymentsMoto;

/**
* @var \Sapient\Worldpay\Model\WorldpayConfigProvider
*/
private $configProvider;

/**
* @var \Magento\Framework\Registry
*/
private $_coreRegistry;

/**
* @var \Magento\Backend\Model\Session\Quote
*/
private $adminquotesession;

/**
* @var \Sapient\Worldpay\Helper\Data
*/
private $worldpayhelper;

/**
* @var \Sapient\Worldpay\Model\Payment\LatAmInstalTypes
*/
private $latamtypes;

/**
* @var \Sapient\Worldpay\Logger\WorldpayLogger
*/
private $wplogger;

/**
* @var \Sapient\Worldpay\Model\Payment\PaymentTypes
*/
private $paymenttypes;

/**
* @var \Magento\Backend\Model\Session\Quote
*/
private $adminsessionquote;
/**
* Constructor
*
Expand Down
5 changes: 5 additions & 0 deletions Block/GooglePay/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class Button extends Template
* @var SessionManagerInterface
*/
protected $session;

/**
* @var \Sapient\Worldpay\Helper\Data
*/
protected $worldpayHelper;

/**
* Button constructor.
Expand Down
Loading

0 comments on commit 602dd1c

Please sign in to comment.