diff --git a/Block/Adminhtml/Order/View/View.php b/Block/Adminhtml/Order/View/View.php index 8751a50b..2a3b5382 100644 --- a/Block/Adminhtml/Order/View/View.php +++ b/Block/Adminhtml/Order/View/View.php @@ -144,6 +144,11 @@ public function getXmluserName($paymentType, $ismultishipping) $xmlUsername = !empty($pblMerchantUn) ? $pblMerchantUn : $xmlUsername; } + if ($paymentType == 'EFTPOS_AU-SSL') { + $eftposMerchantUn = $this->helper->getEFTPosXmlUsername(); + $xmlUsername = !empty($eftposMerchantUn) ? $eftposMerchantUn : $xmlUsername; + } + return $xmlUsername; } } diff --git a/Block/Checkout/Multishipping/Billing.php b/Block/Checkout/Multishipping/Billing.php index 72b89649..51e578c2 100644 --- a/Block/Checkout/Multishipping/Billing.php +++ b/Block/Checkout/Multishipping/Billing.php @@ -390,11 +390,18 @@ public function isWorldpayEnable() */ public function getWorldpayMethodsCode() { - return [ - 'worldpay_cc', - 'worldpay_apm', - 'worldpay_wallets' - ]; + if ($this->enabledEFTPOS()) { + return [ + 'worldpay_cc', + 'worldpay_wallets' + ]; + } else { + return [ + 'worldpay_cc', + 'worldpay_apm', + 'worldpay_wallets' + ]; + } } /** * Get Worldpay Methods @@ -426,4 +433,24 @@ public function getOtherPaymentMethods() } return $otherPaymentMethods; } + + /** + * Get EFTPos Enable + * + * @return bool + */ + public function enabledEFTPOS() + { + return $this->wpHelper->isEnabledEFTPOS(); + } + + /** + * Retrieve list of cc integration mode details + * + * @return string + */ + public function getCcIntegrationMode() + { + return $this->wpHelper->getCcIntegrationMode(); + } } diff --git a/Block/Savedcard.php b/Block/Savedcard.php index f68de54a..b6e1f4c8 100644 --- a/Block/Savedcard.php +++ b/Block/Savedcard.php @@ -39,6 +39,11 @@ class Savedcard extends \Magento\Framework\View\Element\Template * @var SerializerInterface */ private $serializer; + + /** + * @var $storeManager + */ + protected $storeManager; /** * constructor * @@ -50,6 +55,7 @@ class Savedcard extends \Magento\Framework\View\Element\Template * @param \Magento\Customer\Helper\Session\CurrentCustomerAddress $currentCustomerAddress * @param \Magento\Customer\Model\Address\Config $addressConfig * @param \Magento\Customer\Model\Address\Mapper $addressMapper + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data */ public function __construct( @@ -61,6 +67,7 @@ public function __construct( \Magento\Customer\Helper\Session\CurrentCustomerAddress $currentCustomerAddress, \Magento\Customer\Model\Address\Config $addressConfig, \Magento\Customer\Model\Address\Mapper $addressMapper, + \Magento\Store\Model\StoreManagerInterface $storeManager, array $data = [] ) { $this->_savecard = $savecard; @@ -70,6 +77,7 @@ public function __construct( $this->currentCustomerAddress = $currentCustomerAddress; $this->_addressConfig = $addressConfig; $this->addressMapper = $addressMapper; + $this->storeManager = $storeManager; parent::__construct($context, $data); } @@ -92,8 +100,9 @@ public function isIAVEnabled() public function getAddNewCardLabel() { - return $this->getUrl('worldpay/savedcard/addnewcard', ['_secure' => true]); + return $this->getUrl('worldpay/savedcard/addnewcard', ['_secure' => true]); } + /** * Check Billing address * @@ -137,22 +146,24 @@ public function getSavedCard() if (!($customerId = $this->_customerSession->getCustomerId())) { return false; } + $storeId = $this->getStoreId(); $merchantTokenEnabled = $this->worlpayhelper->getMerchantTokenization(); $tokenType = $merchantTokenEnabled ? 'merchant' : 'shopper'; return $savedCardCollection = $this->_savecard->create()->getCollection() - ->addFieldToSelect(['card_brand','card_number', + ->addFieldToSelect(['id','card_brand','card_number', 'cardholder_name','card_expiry_month','card_expiry_year', 'transaction_identifier', 'token_code']) ->addFieldToFilter('customer_id', ['eq' => $customerId]) - ->addFieldToFilter('token_type', ['eq' => $tokenType]); + ->addFieldToFilter('token_type', ['eq' => $tokenType]) + ->addFieldToFilter('store_id', ['eq' => $storeId]); } + /** * Check Account Label * * @param string $labelCode * @return string */ - public function getMyAccountLabels($labelCode) { $accdata = $this->serializer->unserialize($this->worlpayhelper->getMyAccountLabels()); @@ -165,13 +176,13 @@ public function getMyAccountLabels($labelCode) } } } + /** * Check checkout label * * @param string $labelCode * @return string */ - public function getCheckoutLabels($labelCode) { $accdata = $this->serializer->unserialize($this->worlpayhelper->getCheckoutLabels()); @@ -206,4 +217,15 @@ public function getEditUrl($saveCard) { return $this->getUrl('worldpay/savedcard/edit', ['id' => $saveCard->getId()]); } + + /** + * Get Current Store Id + * + * @return string + */ + + public function getStoreId() + { + return $this->storeManager->getStore()->getId(); + } } diff --git a/Controller/Button/PlaceOrder.php b/Controller/Button/PlaceOrder.php index fa711ebe..874ac4d0 100644 --- a/Controller/Button/PlaceOrder.php +++ b/Controller/Button/PlaceOrder.php @@ -142,6 +142,9 @@ public function execute() $billingAddressId = (int)$request->getParam('instant_purchase_billing_address'); $carrierCode = (string)$request->getParam('instant_purchase_carrier'); $shippingMethodCode = (string)$request->getParam('instant_purchase_shipping'); + $browserScreenHeight = (string)$request->getParam('browserScreenHeight'); + $browserScreenWidth = (string)$request->getParam('browserScreenWidth'); + $browserColorDepth = (string)$request->getParam('browserColorDepth'); $productId = (int)$request->getParam('product'); $productRequest = $this->getRequestUnknownParams($request); if (!($request->getParam('instant_purchase_dfreference') === null)) { @@ -149,6 +152,9 @@ public function execute() if ($dfReferenceId) { $this->checkoutSession->setDfReferenceId($dfReferenceId); $this->checkoutSession->setInstantPurchaseOrder(true); + $this->checkoutSession->setBrowserScreenHeight($browserScreenHeight); + $this->checkoutSession->setBrowserScreenWidth($browserScreenWidth); + $this->checkoutSession->setBrowserColorDepth($browserColorDepth); $this->checkoutSession->setInstantPurchaseRedirectUrl($this->redirect->getRefererUrl()); } } diff --git a/Controller/Cartdetails/Chromepay.php b/Controller/Cartdetails/Chromepay.php index 98524c12..7be490f5 100644 --- a/Controller/Cartdetails/Chromepay.php +++ b/Controller/Cartdetails/Chromepay.php @@ -66,6 +66,14 @@ public function execute() $paymentDetails = $reqData->details; $shippingAddress = $reqData->shippingAddress; $billingAddress = $paymentDetails->billingAddress; + $browserfields = [ + 'browserScreenHeight' => $paymentDetails['additional_data'] + ['browser_screenheight'], + 'browserScreenWidth' => $paymentDetails['additional_data'] + ['browser_screenwidth'], + 'browserColourDepth' => $paymentDetails['additional_data'] + ['browser_colordepth'] + ]; $chromeOrderParams = []; $chromeOrderParams['orderCode'] = $orderCode; $chromeOrderParams['merchantCode'] = $this->worldpayHelper->getMerchantCode(); @@ -78,6 +86,7 @@ public function execute() $chromeOrderParams['shippingAddress'] = $shippingAddress; $chromeOrderParams['billingAddress'] = $billingAddress; $chromeOrderParams['exponent'] = $exponent; + $chromeOrderParams['browserFields'] = $browserfields; if ($chromeOrderParams) { $response = $this->_paymentservicerequest->chromepayOrder($chromeOrderParams); } diff --git a/Controller/Redirectresult/Redirect.php b/Controller/Redirectresult/Redirect.php index 32608caf..244e9a1e 100644 --- a/Controller/Redirectresult/Redirect.php +++ b/Controller/Redirectresult/Redirect.php @@ -33,6 +33,18 @@ class Redirect extends \Magento\Framework\App\Action\Action * @var \Sapient\Worldpay\Helper\Data */ protected $worldpayHelper; + + /** + * @var \Magento\Sales\Model\Order\Email\Sender\OrderSender + */ + protected $emailsender; + + /** + * @var \Sapient\Worldpay\Model\Order\Service + */ + + protected $orderservice; + /** * Constructor * @@ -41,18 +53,24 @@ class Redirect extends \Magento\Framework\App\Action\Action * @param \Magento\Checkout\Model\Session $checkoutsession * @param \Magento\Sales\Model\Order $mageOrder * @param \Sapient\Worldpay\Helper\Data $worldpayHelper + * @param \Magento\Sales\Model\Order\Email\Sender\OrderSender $emailsender + * @param \Sapient\Worldpay\Model\Order\Service $orderservice */ public function __construct( Context $context, PageFactory $pageFactory, \Magento\Checkout\Model\Session $checkoutsession, \Magento\Sales\Model\Order $mageOrder, - \Sapient\Worldpay\Helper\Data $worldpayHelper + \Sapient\Worldpay\Helper\Data $worldpayHelper, + \Magento\Sales\Model\Order\Email\Sender\OrderSender $emailsender, + \Sapient\Worldpay\Model\Order\Service $orderservice ) { $this->pageFactory = $pageFactory; $this->checkoutsession = $checkoutsession; $this->mageOrder = $mageOrder; $this->worldpayHelper = $worldpayHelper; + $this->emailsender = $emailsender; + $this->orderservice = $orderservice; return parent::__construct($context); } /** @@ -67,10 +85,30 @@ public function execute() $resultRedirect->setPath('noroute'); return $resultRedirect; } + if ($this->worldpayHelper->getRedirectIntegrationMode() == 'full_page') { + $order = $this->getAuthorisedOrder(); + $magentoorder = $order->getOrder(); + $order = $this->getAuthorisedOrder(); + $magentoorder = $order->getOrder(); + $this->emailsender->fullPageRedirectOrderEmail($magentoorder); + } $redirecturl = $this->checkoutsession->getWpRedirecturl(); $this->checkoutsession->unsWpRedirecturl(); $this->checkoutsession->unsIframePay(); $this->checkoutsession->unsHppOrderCode(); return $resultRedirect->setUrl($redirecturl); } + + /** + * Get Authorised Order + * + * @return Increament Id + */ + public function getAuthorisedOrder() + { + if ($this->checkoutsession->getauthenticatedOrderId()) { + return $this->orderservice->getByIncrementId($this->checkoutsession->getauthenticatedOrderId()); + } + return false; + } } diff --git a/Controller/Samsungpay/CallBack.php b/Controller/Samsungpay/CallBack.php index 9e638241..8a09cff3 100644 --- a/Controller/Samsungpay/CallBack.php +++ b/Controller/Samsungpay/CallBack.php @@ -249,10 +249,17 @@ public function execute() if ($isMultishipping) { $grandTotal = $quote->getGrandTotal(); } + + $browserData = $this->_checkoutSession->getBrowserFields(); + $browserFields = [ + 'browser_colorDepth' => $browserData['browser_colordepth'], + 'browser_screenWidth' => $browserData['browser_screenwidth'], + 'browser_screenHeight' => $browserData['browser_screenheight'] + ]; + $samsungPayOrderParams = []; $samsungPayOrderParams['orderCode'] = $worldpayOrderId; - $samsungPayOrderParams['merchantCode'] = $merchantCode; $samsungPayOrderParams['orderDescription'] = $orderDescription; $samsungPayOrderParams['currencyCode'] = $currencyCode; @@ -261,6 +268,9 @@ public function execute() $samsungPayOrderParams['shopperEmail'] = $orderDetails['customer_email']; $samsungPayOrderParams['exponent'] = $exponent; $samsungPayOrderParams['data'] = $response['3DS']['data']; + $samsungPayOrderParams['browserFields'] = $browserFields; + $samsungPayOrderParams['shopperIpAddress'] = $this->_getClientIPAddress(); + $samsungPayOrderParams['sessionId'] = $refId; $response = $this->_paymentservicerequest->samsungPayOrder($samsungPayOrderParams); $paymentService = new \SimpleXmlElement($response); $lastEvent = $paymentService->xpath('//lastEvent'); @@ -313,4 +323,16 @@ public function checkForMultishippingOrder() return $order; } } + /** + * Get ClientIP Address + * + * @return string + */ + + private function _getClientIPAddress() + { + $REMOTE_ADDR = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); + $remoteAddresses = explode(',', $REMOTE_ADDR); + return trim($remoteAddresses[0]); + } } diff --git a/Controller/Samsungpay/Index.php b/Controller/Samsungpay/Index.php index e34536cf..973326f0 100644 --- a/Controller/Samsungpay/Index.php +++ b/Controller/Samsungpay/Index.php @@ -35,7 +35,10 @@ class Index extends \Magento\Framework\App\Action\Action * @var $customerSession */ public $customerSession; - + /** + * @var $_checkoutSession + */ + protected $_checkoutSession; /** * @var \Sapient\Worldpay\Logger\WorldpayLogger */ @@ -79,6 +82,7 @@ class Index extends \Magento\Framework\App\Action\Action * @param \Sapient\Worldpay\Helper\CurlHelper $curlHelper * @param QuoteIdMaskFactory $quoteIdMaskFactory * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Sapient\Worldpay\Helper\Data $worldpayHelper */ public function __construct( @@ -93,6 +97,7 @@ public function __construct( \Sapient\Worldpay\Helper\CurlHelper $curlHelper, QuoteIdMaskFactory $quoteIdMaskFactory, \Magento\Customer\Model\Session $customerSession, + \Magento\Checkout\Model\Session $checkoutSession, \Sapient\Worldpay\Helper\Data $worldpayHelper ) { parent::__construct($context); @@ -105,7 +110,8 @@ public function __construct( $this->_storeManager = $storeManager; $this->curlHelper = $curlHelper; $this->quoteIdMaskFactory = $quoteIdMaskFactory; - $this->customerSession=$customerSession; + $this->customerSession = $customerSession; + $this->_checkoutSession = $checkoutSession; $this->worldpayHelper = $worldpayHelper; } /** @@ -135,7 +141,13 @@ public function execute() getValue('worldpay/general_config/environment_mode', $storeScope); $quoteId = $this->request->getParam('quoteId'); - + $browser = [ + 'browser_screenheight' => $this->request->getParam('browserHeight'), + 'browser_screenwidth' => $this->request->getParam('browserWidth'), + 'browser_colordepth' => $this->request->getParam('browserColor') + ]; + $this->_checkoutSession->setBrowserFields($browser); + if ($environmentMode == 'Test Mode') { $serviceUrl = "https://api-ops.stg.mpay.samsung.com/ops/v1/transactions"; } else { diff --git a/Controller/Savedcard/AddnewcardPost.php b/Controller/Savedcard/AddnewcardPost.php index e68fa34b..1e5bc4de 100644 --- a/Controller/Savedcard/AddnewcardPost.php +++ b/Controller/Savedcard/AddnewcardPost.php @@ -371,9 +371,7 @@ public function execute() $exponent = $this->worldpayHelper->getCurrencyExponent($currencyCode); $billingadd = $this->getAddress($billingaddress); $fullRequest = json_decode($this->getRequest()->getContent()); - $merchantCode = $this->worldpayHelper->getMerchantCode($fullRequest->payment->paymentType); - $payment = [ 'cardNumber' => $fullRequest->payment->cardNumber, 'paymentType' => $fullRequest->payment->paymentType, @@ -382,6 +380,11 @@ public function execute() 'expiryYear' => $fullRequest->payment->expiryYear, 'cseEnabled' => $fullRequest->payment->cseEnabled ]; + $browserFields = [ + 'browser_colorDepth' => $fullRequest->payment->browser_colordepth, + 'browser_screenWidth' => $fullRequest->payment->browser_screenwidth, + 'browser_screenHeight' => $fullRequest->payment->browser_screenheight + ]; if (isset($fullRequest->payment->cvc) && !$fullRequest->payment->cvc == '' && !empty($fullRequest->payment->cvc)) { $payment['cvc'] = $fullRequest->payment->cvc; @@ -437,6 +440,8 @@ public function execute() $orderParams['shippingfee'] = 0; $orderParams['exponent'] = $exponent; $orderParams['primeRoutingData'] = $this->getPrimeRoutingDetails($billingadd['countryCode']); + $orderParams['browserFields'] = $browserFields; + $orderParams['telephoneNumber'] = $billingaddress->getTelephone(); $payment['additional_data'] = [ 'save_my_card' => 1, 'isRecurringOrder' => 0, diff --git a/Controller/Wallets/CancelCheckout.php b/Controller/Wallets/CancelCheckout.php index 6b94b4af..4f8dafd5 100644 --- a/Controller/Wallets/CancelCheckout.php +++ b/Controller/Wallets/CancelCheckout.php @@ -71,15 +71,13 @@ public function execute() // setting g-pay/apple-pay quote id to inactive $currentQuoteID = $this->getQuote()->getId(); if ($currentQuoteID) { - $this->wplogger->info("Current Active Cart ID:".$currentQuoteID); $activeQuote = $this->quoteRepository->get($currentQuoteID); $activeQuote->setIsActive(0); $this->quoteRepository->save($activeQuote); } - - // bring previous user cart to active state + // bring previous user cart to active state if ($this->customerSession->getActiveQuoteId()) { - $this->wplogger->info("Previous Active Cart ID:".$this->customerSession->getActiveQuoteId()); + $this->wplogger->info("Restore previous Cart"); $inActiveQuoteId = $this->customerSession->getActiveQuoteId(); $inActiveQuote = $this->quoteRepository->get($inActiveQuoteId); $inActiveQuote->setIsActive(1)->setReservedOrderId(null); @@ -89,17 +87,18 @@ public function execute() // unsetting session variable $this->customerSession->unsActiveQuoteId(); } - $resultData = [ - 'success' => true, - 'time' => time(), - ]; + $resultData = [ + 'success' => true, + 'time' => time(), + ]; } catch (\Exception $e) { $resultData = [ 'success' => false, 'time' => time(), 'error_msg'=> $e->getMessage() ]; - $this->wplogger->info("Cancel wp wallet checkout: Failed while unsetting quote Id ".$e->getMessage()); + $this->wplogger + ->info("Cancel wp wallet checkout: Failed while unsetting quote Id ".$e->getMessage()); } return $result->setData($resultData); } diff --git a/Cron/PendingOrderCleanup.php b/Cron/PendingOrderCleanup.php new file mode 100644 index 00000000..d88d2039 --- /dev/null +++ b/Cron/PendingOrderCleanup.php @@ -0,0 +1,227 @@ +orderCollectionFactory = $orderCollectionFactory; + $this->orderFactory = $orderFactory; + $this->worldpaypayment = $worldpaypayment; + $this->paymentservice = $paymentservice; + $this->paymentservicerequest = $paymentservicerequest; + $this->orderservice = $orderservice; + $this->worldpayhelper = $worldpayhelper; + $this->_logger = $wplogger; + $this->storeManager = $storeManager; + } + + /** + * Cancel pending order cron + */ + + public function execute() + { + $storeId = $this->storeManager->getStore()->getId(); + $orderCleanupenable = $this->worldpayhelper->getOrderCleanupEnable($storeId); + if (!$orderCleanupenable) { + return; + } + + $timeDuration = $this->worldpayhelper->getOrderCleanupOption(); + + $this->_logger->info('Pending order clean up cron started'); + $pendingOrderCollection = $this->getPendingOrders(); + foreach ($pendingOrderCollection as $order) { + $this->_logger->info('worldpay order: '.$order->getOrderId()); + + if (!empty($order->getOrderId())) { + $this->_getPaymentDetailsXmlForOrder( + $this->orderservice->getByIncrementId($order->getOrderId()) + ); + $this->applyCancel($order->getOrderId()); + } + } + $this->_logger->info('Pending order clean up cron finished'); + } + + /** + * Filter the collection to fetch pending orders + * + * @param string $createdAt + * @return orderCollection + */ + public function getPendingOrders() + { + $collection = $this->worldpaypayment->create()->getsentforAuthOrderCollection(); + return $collection; + } + + /** + * Get Payment Details Xml For Order + * + * @param Sapient\Worldpay\Model\Order $order + * @return array + */ + public function _getPaymentDetailsXmlForOrder(\Sapient\Worldpay\Model\Order $order) + { + $worldPayPayment = $order->getWorldPayPayment(); + if (!$worldPayPayment) { + return false; + } + $interactionType = ''; + $worldPayOrder = $order->getOrder(); + $response = $this->paymentservicerequest->inquiry( + $worldPayPayment->getMerchantId(), + $worldPayPayment->getWorldpayOrderId(), + $worldPayOrder->getStoreId(), + $order->getPaymentMethodCode(), + $worldPayPayment->getPaymentType(), + $interactionType, + true + ); + $paymentService = new \SimpleXmlElement($response); + $error = $paymentService->xpath('//error'); + + if ($error[0]['code'] == 5) { + $this->applyCancel($worldPayPayment->getWorldpayOrderId()); + } + } + + /** + * Apply + * + * @param string $orderId + */ + public function applyCancel($orderId) + { + if (!empty($orderId)) { + $paymentModel = $this->worldpaypayment->create()->loadByWorldpayOrderId($orderId); + //$isRedirectOrder = $paymentModel->getPaymentModel(); + $wpPaymentStatus = $paymentModel->getPaymentStatus(); + if ($wpPaymentStatus == \Sapient\Worldpay\Model\Payment\StateInterface::STATUS_SENT_FOR_AUTHORISATION) { + try { + $paymentModel->setData( + 'payment_status', + \Sapient\Worldpay\Model\Payment\StateInterface::STATUS_CANCELLED + ); + if ($paymentModel->save()) { + $this->updateOrderCancel($paymentModel->getOrderId()); + } + $this->_logger->info('Worldpay order id - '.$paymentModel->getWorldpayOrderId().' cancelled'); + + } catch (\Exception $e) { + $this->_logger->info( + 'Unable to update payment status of order id - ' + .$paymentModel->getOrderId() + .' Exception message:'.$e->getMessage() + ); + } + } + } + } + + /** + * Cancel magento order + * + * @param string $orderId + */ + public function updateOrderCancel($orderId) + { + try { + $order = $this->orderFactory->create()->loadByIncrementId($orderId); + $order->addStatusHistoryComment( + 'Order has been canceled because could not find payment' + ) + ->setIsVisibleOnFront(true); + $order->cancel()->save(); + $this->_logger->info('update oder: '.$orderId); + } catch (\Exception $e) { + $this->_logger->info('Unable to cancel order id - '.$orderId.' Exception message:'.$e->getMessage()); + } + } +} diff --git a/Helper/Data.php b/Helper/Data.php index f6c484b9..6c8ef8de 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -260,9 +260,10 @@ public function getLiveUrl() * Get MerchantCode * * @param string $paymentType + * @param string $storeId * @return string */ - public function getMerchantCode($paymentType) + public function getMerchantCode($paymentType, $storeId = null) { if ($paymentType) { $merchat_detail = $this->merchantprofile->getConfigValue($paymentType); @@ -271,19 +272,27 @@ public function getMerchantCode($paymentType) return $merchantCodeValue; } } - - return $this->_scopeConfig->getValue( - 'worldpay/general_config/merchant_code', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + return $this->_scopeConfig->getValue( + 'worldpay/general_config/merchant_code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + return $this->_scopeConfig->getValue( + 'worldpay/general_config/merchant_code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } } /** * Get Xml Username * * @param string $paymentType + * @param string $storeId * @return string */ - public function getXmlUsername($paymentType) + public function getXmlUsername($paymentType, $storeId = null) { if ($paymentType) { $merchat_detail = $this->merchantprofile->getConfigValue($paymentType); @@ -292,18 +301,27 @@ public function getXmlUsername($paymentType) return $merchantCodeValue; } } - return $this->_scopeConfig->getValue( - 'worldpay/general_config/xml_username', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + return $this->_scopeConfig->getValue( + 'worldpay/general_config/xml_username', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + return $this->_scopeConfig->getValue( + 'worldpay/general_config/xml_username', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } } /** * Get Xml Password * * @param string $paymentType + * @param string $storeId * @return string */ - public function getXmlPassword($paymentType) + public function getXmlPassword($paymentType, $storeId = null) { if ($paymentType) { $merchat_detail = $this->merchantprofile->getConfigValue($paymentType); @@ -312,10 +330,18 @@ public function getXmlPassword($paymentType) return $merchantCodeValue; } } - return $this->_scopeConfig->getValue( - 'worldpay/general_config/xml_password', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + return $this->_scopeConfig->getValue( + 'worldpay/general_config/xml_password', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + return $this->_scopeConfig->getValue( + 'worldpay/general_config/xml_password', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } } /** * Check isMacEnabled @@ -640,6 +666,18 @@ public function getApmPaymentMethods() \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } + /** + * Check Statement Narrative + * + * @return string + */ + public function isStatementNarrativeEnabled() + { + return (bool) $this->_scopeConfig->getValue( + 'worldpay/apm_config/statement_narrative', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } /** * Get Payment Method Selection * @@ -1901,7 +1939,7 @@ public function getDebitNetworks() 'worldpay/prime_routing/debit_networks', \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - if (strlen($debitNetworks)>0) { + if (!empty($debitNetworks)) { return explode(",", $debitNetworks); } } @@ -2025,7 +2063,7 @@ public function getKlarnaSliceitContries() 'worldpay/klarna_config/sliceit_config/sliceit_contries', \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - if (strlen($sliceitContries) > 0) { + if (!empty($sliceitContries)) { return $sliceitContries; } } @@ -2058,7 +2096,7 @@ public function getKlarnaPayLaterContries() 'worldpay/klarna_config/paylater_config/paylater_contries', \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - if (strlen($payLaterContries) > 0) { + if (!empty($payLaterContries)) { return $payLaterContries; } } @@ -2092,7 +2130,7 @@ public function getKlarnaPayNowContries() \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - if (strlen($paynowContries) > 0) { + if (!empty($paynowContries)) { return $paynowContries; } } @@ -2810,8 +2848,7 @@ public function getCurrentMagentoVersionDetails() /** * Get Plugin Tracker Details * - * @param string $username - * @param string $merchantCode + * @return array */ public function getPluginTrackerdetails() { @@ -2834,6 +2871,33 @@ public function getPluginTrackerdetails() return $details; } + /** + * Get Plugin Tracker Details for Header Request + * + * @return array + */ + public function getPluginTrackerHeaderdetails() + { + $details=[]; + $integrationVersion = $historicVersions= ''; + $mageDetails = $this->getCurrentMagentoVersionDetails(); + $details['ecommerce_platform'] = $mageDetails['platform']; + $details['ecommerce_platform_version'] = $mageDetails['version']; + if (($this->getCurrentWopayPluginVersion()!=null) && !empty($this->getCurrentWopayPluginVersion())) { + $integrationVersion = $this->getCurrentWopayPluginVersion(); + } + if (($this->getUpgradeDates()!=null) && !empty($this->getUpgradeDates())) { + $historicVersions = $this->getUpgradeDates(); + } + $details['ecommerce_plugin_data'] = + ['ecommerce_platform_edition'=>$mageDetails['edition'], + 'integration_version'=>$integrationVersion, + 'historic_integration_versions'=>$historicVersions + ]; + + return $details; + } + /** * Get Quote Data's * @@ -3058,84 +3122,155 @@ public function getRecurringPassword() /** * Check if Pay By Link merchant code + * + * @param string $storeId */ - public function getPayByLinkMerchantCode() + public function getPayByLinkMerchantCode($storeId = null) { - $paybyLinkMC = $this->_scopeConfig->getValue( - 'worldpay/paybylink_config/pbl_merchant_code', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + $paybyLinkMC = $this->_scopeConfig->getValue( + 'worldpay/paybylink_config/pbl_merchant_code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + $paybyLinkMC = $this->_scopeConfig->getValue( + 'worldpay/paybylink_config/pbl_merchant_code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } return $paybyLinkMC; } /** * Get Pay by Link Merchant username + * + * @param string $storeId */ - public function getPayByLinkMerchantUsername() + public function getPayByLinkMerchantUsername($storeId = null) { - $paybyLinkUn = $this->_scopeConfig->getValue( - 'worldpay/paybylink_config/pbl_xml_username', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + $paybyLinkUn = $this->_scopeConfig->getValue( + 'worldpay/paybylink_config/pbl_xml_username', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + $paybyLinkUn = $this->_scopeConfig->getValue( + 'worldpay/paybylink_config/pbl_xml_username', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } return $paybyLinkUn; } /** * Get Pay by Link merchant password + * + * @param string $storeId */ - public function getPayByLinkMerchantPassword() + public function getPayByLinkMerchantPassword($storeId = null) { - $paybyLinkPw = $this->_scopeConfig->getValue( - 'worldpay/paybylink_config/pbl_xml_password', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + $paybyLinkPw = $this->_scopeConfig->getValue( + 'worldpay/paybylink_config/pbl_xml_password', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + $paybyLinkPw = $this->_scopeConfig->getValue( + 'worldpay/paybylink_config/pbl_xml_password', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } return $paybyLinkPw; } /** * Get multishipping merchant code + * + * @param string $storeId */ - public function getMultishippingMerchantCode() + public function getMultishippingMerchantCode($storeId = null) { - $multishippingMC = $this->_scopeConfig->getValue( - 'worldpay/multishipping/ms_merchant_code', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + $multishippingMC = $this->_scopeConfig->getValue( + 'worldpay/multishipping/ms_merchant_code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + $multishippingMC = $this->_scopeConfig->getValue( + 'worldpay/multishipping/ms_merchant_code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + return $multishippingMC; } /** * Get multishipping Merchant username + * + * @param string $storeId */ - public function getMultishippingMerchantUsername() + public function getMultishippingMerchantUsername($storeId = null) { - $multishippingUn = $this->_scopeConfig->getValue( - 'worldpay/multishipping/ms_xml_username', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + $multishippingUn = $this->_scopeConfig->getValue( + 'worldpay/multishipping/ms_xml_username', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + $multishippingUn = $this->_scopeConfig->getValue( + 'worldpay/multishipping/ms_xml_username', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } return $multishippingUn; } /** * Get multishipping merchant password + * + * @param string $storeId */ - public function getMultishippingMerchantPassword() + public function getMultishippingMerchantPassword($storeId = null) { - $multishippingPw = $this->_scopeConfig->getValue( - 'worldpay/multishipping/ms_xml_password', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + $multishippingPw = $this->_scopeConfig->getValue( + 'worldpay/multishipping/ms_xml_password', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + $multishippingPw = $this->_scopeConfig->getValue( + 'worldpay/multishipping/ms_xml_password', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } return $multishippingPw; } /** * Get multishipping Installation Id + * + * @param string $storeId */ - public function getMultishippingInstallationId() + public function getMultishippingInstallationId($storeId = null) { - $multishippingIID = $this->_scopeConfig->getValue( - 'worldpay/multishipping/ms_xml_installationId', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($storeId) { + $multishippingIID = $this->_scopeConfig->getValue( + 'worldpay/multishipping/ms_xml_installationId', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } else { + $multishippingIID = $this->_scopeConfig->getValue( + 'worldpay/multishipping/ms_xml_installationId', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } return $multishippingIID; } /** @@ -3256,12 +3391,15 @@ public function msGoogleTestCardname() /** * Get PaybyLink Installation Id + * + * @param string $storeId */ - public function getPayByLinkInstallationId() + public function getPayByLinkInstallationId($storeId = null) { $pblIId = $this->_scopeConfig->getValue( 'worldpay/paybylink_config/pbl_xml_installationId', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId ); return $pblIId; } @@ -3415,4 +3553,159 @@ public function getStoreDefaultCountry($storeId = null) \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } + + /** + * Get Pending order cron enable + * + * @param int $storeId + * @return bool + */ + public function getOrderCleanupEnable($storeId = null) + { + return $this->_scopeConfig->getValue( + 'worldpay/order_cleanup_cron/order_cleanup_enable', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * Get Default country code of Magento store + * + * @param int $storeId + * @return string + */ + public function getOrderCleanupOption($storeId = null) + { + return $this->_scopeConfig->getValue( + 'worldpay/order_cleanup_cron/order_cleanup_option', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } + /** + * Get EFTPOS Enabled or not + * + * @return bool + */ + public function isEnabledEFTPOS() + { + return (bool) $this->_scopeConfig->getValue( + 'worldpay/eftpos_payments/enable_eftpos', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * Get EFTPOS Merchant Code + * + * @return string + */ + public function getEFTPOSMerchantCode() + { + return $this->_scopeConfig->getValue( + 'worldpay/eftpos_payments/eftpos_merchant_code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * Get EFTPOS Routing Mid + * + * @return string + */ + public function getEFTPOSRoutingMid() + { + return $this->_scopeConfig->getValue( + 'worldpay/eftpos_payments/eftpos_routing_mid', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * Get EFTPOS Debugging Enable + * + * @return bool + */ + public function getEFTPOSDebugging() + { + return $this->_scopeConfig->getValue( + 'worldpay/eftpos_payments/eftpos_debugging', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + /** + * Check If Storepickup is enabled from admin or not. + */ + public function isStorePickUpEnabled() + { + return $this->_scopeConfig->getValue( + 'worldpay/klarna_config/store_pickup/enabled', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * Get StorePickUp Method for Klarna StorePickUp Config + */ + public function getStorePickUpMethod() + { + return $this->_scopeConfig->getValue( + 'worldpay/klarna_config/store_pickup/shipping_method', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + /** + * Get Xml Username + * + * @param string $paymentType + * @return string + */ + public function getEFTPosXmlUsername() + { + return $this->_scopeConfig->getValue( + 'worldpay/eftpos_payments/eftpos_xml_username', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + /** + * Get Xml Password + * + * @param string $paymentType + * @return string + */ + public function getEFTPOSXmlPassword() + { + return $this->_scopeConfig->getValue( + 'worldpay/eftpos_payments/eftpos_xml_password', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + /** + * Get StorePickUp Type for Klarna Config + */ + public function getStorePickUpType() + { + return $this->_scopeConfig->getValue( + 'worldpay/klarna_config/store_pickup/shipping_type', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * Check if isStorePickup selected by user on shipping page + * + * @return bool + */ + public function isStorePickup() + { + $isStorePickup = false; + $quote = $this->_checkoutSession->getQuote(); + $shippingAddress = $quote->getShippingAddress(); + $shippingMethod = $shippingAddress->getShippingMethod(); + if (strpos($shippingMethod, 'instore_pickup') !== false) { + $isStorePickup = true; + } + return $isStorePickup; + } } diff --git a/Helper/Recurring.php b/Helper/Recurring.php index 4241a7dd..fd41a3c7 100644 --- a/Helper/Recurring.php +++ b/Helper/Recurring.php @@ -784,7 +784,7 @@ public function addItemsToQuote($tokenKey, $itemData, $quoteId) ], ] ); - return json_decode($response, true); + return json_decode($response ?? '', true); } /** @@ -844,7 +844,7 @@ public function getShippingMethods($tokenKey, $addressData) ], ] ); - return json_decode($response, true); + return json_decode($response ?? '', true); } /** @@ -879,7 +879,7 @@ public function setShippingInformation($tokenKey, $shippingInformation) ], ] ); - return json_decode($response, true); + return json_decode($response ?? '', true); } /** @@ -914,7 +914,7 @@ public function orderPayment($tokenKey, $paymentData) ], ] ); - return json_decode($response, true); + return json_decode($response ?? '', true); } /** diff --git a/Model/Authorisation/PayByLinkService.php b/Model/Authorisation/PayByLinkService.php index 7e26701c..1b5d93e5 100644 --- a/Model/Authorisation/PayByLinkService.php +++ b/Model/Authorisation/PayByLinkService.php @@ -333,10 +333,10 @@ public function authorizeRegenaretPayment( $merchantPassword = $this->worldpayhelper->getXmlPassword($redirectOrderParams['paymentType']); $installationId = $this->worldpayhelper->getInstallationId($redirectOrderParams['paymentType']); // pbl merchant configurations - $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername(); - $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword(); - $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode(); - $pblInstallationId = $this->worldpayhelper->getPayByLinkInstallationId(); + $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername($orderStoreId); + $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword($orderStoreId); + $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode($orderStoreId); + $pblInstallationId = $this->worldpayhelper->getPayByLinkInstallationId($orderStoreId); $merchantUsername = !empty($pblMerchantUn) ? $pblMerchantUn : $merchantUsername ; $merchantPassword = !empty($pblMerchantPw) ? $pblMerchantPw : $merchantPassword ; diff --git a/Model/Authorisation/PaymentOptionsService.php b/Model/Authorisation/PaymentOptionsService.php index ae3647d5..56c3c214 100644 --- a/Model/Authorisation/PaymentOptionsService.php +++ b/Model/Authorisation/PaymentOptionsService.php @@ -70,7 +70,7 @@ public function collectPaymentOptions( $responsexml = simplexml_load_string($response); $paymentoptions = $this->getPaymentOptions($responsexml); - if ($this->worldpayhelper->isGlobalApmEnable()) { + if ($this->worldpayhelper->isGlobalApmEnable() && !$this->worldpayhelper->isEnabledEFTPOS()) { $additionalMerchanPaymentoptions = $this->getAdditionalMerchantPaymentOptions($countryId, $paymentoptions); $paymentoptions = array_merge($paymentoptions, $additionalMerchanPaymentoptions); } diff --git a/Model/Authorisation/VaultService.php b/Model/Authorisation/VaultService.php index 52a850c7..67379e13 100644 --- a/Model/Authorisation/VaultService.php +++ b/Model/Authorisation/VaultService.php @@ -115,7 +115,6 @@ public function authorizePayment( $orderStoreId, $paymentDetails ); - $response = $this->paymentservicerequest->order($directOrderParams); $directResponse = $this->directResponse->setResponse($response); if (!empty($directOrderParams['primeRoutingData'])) { diff --git a/Model/Config/CronConfig.php b/Model/Config/CronConfig.php new file mode 100644 index 00000000..13d1f010 --- /dev/null +++ b/Model/Config/CronConfig.php @@ -0,0 +1,103 @@ +_runModelPath = $runModelPath; + $this->_configValueFactory = $configValueFactory; + parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); + } + + /** + * After Save Event + */ + + public function afterSave() + { + $frequency = $this->getData( + 'groups/worldpay/order_cleanup_cron/order_cleanup_option/value' + ); + $cronExprArray = [ + '*', + '*', + $frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY + ? $frequency : '*', + '*', + '*', + ]; + + $cronExprString = join(' ', $cronExprArray); + + try { + $this->_configValueFactory->create()->load( + self::CRON_STRING_PATH, + 'path' + )->setValue( + $cronExprString + )->setPath( + self::CRON_STRING_PATH + )->save(); + $this->_configValueFactory->create()->load( + self::CRON_MODEL_PATH, + 'path' + )->setValue( + $this->_runModelPath + )->setPath( + self::CRON_MODEL_PATH + )->save(); + } catch (\Exception $e) { + throw new SpecificException($e->getMessage()); + } + + return parent::afterSave(); + } +} diff --git a/Model/Config/Source/KlarnaShippingMethod.php b/Model/Config/Source/KlarnaShippingMethod.php new file mode 100644 index 00000000..4967e45d --- /dev/null +++ b/Model/Config/Source/KlarnaShippingMethod.php @@ -0,0 +1,26 @@ + 'store pick-up', 'label' => __('Store pick-up')], + ['value' => 'pick-up point', 'label' => __('Pick-up Point')], + ['value' => 'registered box', 'label' => __('Registered Box')], + ['value' => 'unregistered box', 'label' => __('Unregistered Box')] + ]; + } +} diff --git a/Model/Config/Source/KlarnaShippingType.php b/Model/Config/Source/KlarnaShippingType.php new file mode 100644 index 00000000..8990c047 --- /dev/null +++ b/Model/Config/Source/KlarnaShippingType.php @@ -0,0 +1,24 @@ + 'normal', 'label' => __('Normal')], + ['value' => 'express', 'label' => __('Express')] + ]; + } +} diff --git a/Model/Config/Source/PendingOrderCleanupOption.php b/Model/Config/Source/PendingOrderCleanupOption.php new file mode 100644 index 00000000..9811168c --- /dev/null +++ b/Model/Config/Source/PendingOrderCleanupOption.php @@ -0,0 +1,21 @@ + '1', 'label' => __('24 hours')], + ['value' => '2', 'label' => __('48 hours')], + ]; + } +} diff --git a/Model/InstantPurchase/PaymentAdditionalInformationProvider.php b/Model/InstantPurchase/PaymentAdditionalInformationProvider.php index 9e2f2ceb..bd976046 100644 --- a/Model/InstantPurchase/PaymentAdditionalInformationProvider.php +++ b/Model/InstantPurchase/PaymentAdditionalInformationProvider.php @@ -49,12 +49,18 @@ public function getAdditionalInformation(PaymentTokenInterface $paymentToken): a { $vaultCardDetails = json_decode($paymentToken->getDetails()); $dfId = $this->checkoutSession->getDfReferenceId(); + $browserScreenheight = $this->checkoutSession->getBrowserScreenHeight(); + $browserScreenwidth = $this->checkoutSession->getBrowserScreenWidth(); + $browserColordepth = $this->checkoutSession->getBrowserColorDepth(); + if ($dfId === null) { return [ 'cc_type' => $vaultCardDetails->type, 'card_brand' => str_replace('-SSL', '', $vaultCardDetails->type), 'token' => $paymentToken->getGatewayToken(), - + 'browser_screenheight'=>$browserScreenheight, + 'browser_screenwidth'=>$browserScreenwidth, + 'browser_colordepth'=>$browserColordepth ]; } else { $this->checkoutSession->unsDfReferenceId(); @@ -63,7 +69,9 @@ public function getAdditionalInformation(PaymentTokenInterface $paymentToken): a 'card_brand' => str_replace('-SSL', '', $vaultCardDetails->type), 'token' => $paymentToken->getGatewayToken(), 'dfReferenceId' => $dfId, - + 'browser_screenheight'=>$browserScreenheight, + 'browser_screenwidth'=>$browserScreenwidth, + 'browser_colordepth'=>$browserColordepth ]; } } diff --git a/Model/Mapping/Service.php b/Model/Mapping/Service.php index cf7c6160..b933f487 100644 --- a/Model/Mapping/Service.php +++ b/Model/Mapping/Service.php @@ -56,6 +56,8 @@ class Service */ public const NO_CHANGE = 'noChange'; + public const KLARNA_V2_METHOD = 'KLARNA_V2-SSL'; + /** * @var \Sapient\Worldpay\Helper\Data */ @@ -154,6 +156,15 @@ public function collectVaultOrderParameters( $isMultiShippingOrder = 1; } + $browserFields = [ + 'browser_screenHeight' => isset($paymentDetails['browser_screenheight']) ? + $paymentDetails['browser_screenheight'] : "", + 'browser_screenWidth' => isset($paymentDetails['browser_screenwidth']) ? + $paymentDetails['browser_screenwidth'] : "", + 'browser_colorDepth' => isset($paymentDetails['browser_colordepth']) ? + $paymentDetails['browser_colordepth'] : "" + ]; + $telephoneNumber = $quote->getBillingAddress()->getTelephone(); return [ 'orderCode' => $orderCode, 'merchantCode' => $this->worldpayHelper->getMerchantCode($paymentDetails['cc_type']), @@ -182,7 +193,9 @@ public function collectVaultOrderParameters( 'exponent' => $exponent, 'primeRoutingData' => $this->getPrimeRoutingDetails($paymentDetails, $quote), 'orderLineItems' => $orderLineItems, - 'isMultishippingOrder' => $isMultiShippingOrder + 'isMultishippingOrder' => $isMultiShippingOrder, + 'browserFields'=> $browserFields, + 'telephoneNumber' => $telephoneNumber ]; } /** @@ -237,7 +250,16 @@ public function collectDirectOrderParameters( if ((bool)$quote->getIsMultiShipping()) { $isMultiShippingOrder = 1; } + $browserFields = [ + 'browser_colorDepth' => isset($paymentDetails['additional_data']['browser_colordepth']) ? + $paymentDetails['additional_data']['browser_colordepth'] : "", + 'browser_screenWidth' => isset($paymentDetails['additional_data']['browser_screenwidth']) ? + $paymentDetails['additional_data']['browser_screenwidth'] : "", + 'browser_screenHeight' => isset($paymentDetails['additional_data']['browser_screenheight']) ? + $paymentDetails['additional_data']['browser_screenheight'] : "" + ]; + $telephoneNumber = $quote->getBillingAddress()->getTelephone(); return [ 'orderCode' => $orderCode, 'merchantCode' => $this->worldpayHelper->getMerchantCode($paymentDetails['additional_data']['cc_type']), @@ -271,7 +293,9 @@ public function collectDirectOrderParameters( 'exponent' => $exponent, 'primeRoutingData' => $this->getPrimeRoutingDetails($paymentDetails, $quote), 'orderLineItems' => $orderLineItems, - 'isMultishippingOrder' => $isMultiShippingOrder + 'isMultishippingOrder' => $isMultiShippingOrder, + 'browserFields'=> $browserFields, + 'telephoneNumber' => $telephoneNumber ]; } /** @@ -558,6 +582,16 @@ public function collectTokenOrderParameters( ? $paymentDetails['additional_data']['stored_credentials_enabled'] : ''; $thirdPartyData = ''; $shippingFee = ''; + $browserFields = [ + 'browser_colorDepth' => isset($paymentDetails['additional_data']['browser_colordepth']) ? + $paymentDetails['additional_data']['browser_colordepth'] : "", + 'browser_screenWidth' => isset($paymentDetails['additional_data']['browser_screenwidth']) ? + $paymentDetails['additional_data']['browser_screenwidth'] : "", + 'browser_screenHeight' => isset($paymentDetails['additional_data']['browser_screenheight']) ? + $paymentDetails['additional_data']['browser_screenheight'] : "" + ]; + $telephoneNumber = $quote->getBillingAddress()->getTelephone(); + if ((isset($paymentDetails['additional_data']['cpf']) && $paymentDetails['additional_data']['cpf'] == true) || (isset($paymentDetails['additional_data']['instalment']) @@ -621,7 +655,9 @@ public function collectTokenOrderParameters( 'exponent' => $exponent, 'primeRoutingData' => $this->getPrimeRoutingDetails($paymentDetails, $quote), 'orderLineItems' => $orderLineItems, - 'isMultishippingOrder' => $isMultiShippingOrder + 'isMultishippingOrder' => $isMultiShippingOrder, + 'browserFields'=> $browserFields, + 'telephoneNumber' => $telephoneNumber ]; } /** @@ -758,6 +794,12 @@ public function collectPaymentOptionsParameters( $msMC = $this->worldpayHelper->getMultishippingMerchantCode(); $merchantCode = !empty($msMC) ? $msMC : $merchantCode; } + $isEnabledEftPos = $this->worldpayHelper->isEnabledEFTPOS(); + if ($isEnabledEftPos) { + $eftPosMC = $this->worldpayHelper->getEFTPOSMerchantCode(); + $merchantCode = !empty($eftPosMC) ? $eftPosMC : $merchantCode; + } + return [ 'merchantCode' => $merchantCode, 'countryCode' => $countryId, @@ -894,7 +936,11 @@ private function _getOrderLineItems($quote, $paymentType = null) $lineitem['productType'] = $_item->getProductType(); $lineitem['quantity'] = (int) $_item->getQty(); $lineitem['quantityUnit'] = $this->worldpayHelper->getQuantityUnit($_item->getProduct()); - $lineitem['unitPrice'] = $rowtotal / $_item->getQty(); + if ($paymentType == 'KLARNA-SSL' && $isMultiShipping) { + $lineitem['unitPrice'] = $_item->getProduct()->getPrice(); + } else { + $lineitem['unitPrice'] = $rowtotal / $_item->getQty(); + } $lineitem['taxRate'] = $totaltax; $lineitem['totalAmount'] = $totalamount + $totaltax; $lineitem['totalTaxAmount'] = $totaltax; @@ -1161,9 +1207,8 @@ private function _getRedirectPaymentType($paymentDetails) if ('CARTEBLEUE-SSL' == $paymentDetails['additional_data']['cc_type']) { return 'ECMC-SSL'; } - if ($paymentDetails['additional_data']['cc_type'] == 'KLARNA-SSL' && - isset($paymentDetails['additional_data']['klarna_type'])) { - return $paymentDetails['additional_data']['klarna_type']; + if ($paymentDetails['additional_data']['cc_type'] == 'KLARNA-SSL') { + return self::KLARNA_V2_METHOD; } return $paymentDetails['additional_data']['cc_type']; } @@ -1308,6 +1353,14 @@ public function collectWalletOrderParameters( $sessionId = $this->session->getSessionId(); $paymentDetails['sessionId'] = $sessionId; $dfReferenceId = ''; + $browserfields = [ + 'browserScreenHeight' => $paymentDetails['additional_data'] + ['browser_screenheight'], + 'browserScreenWidth' => $paymentDetails['additional_data'] + ['browser_screenwidth'], + 'browserColourDepth' => $paymentDetails['additional_data'] + ['browser_colordepth'] + ]; $orderDescription = $this->_getOrderDescription($reservedOrderId); if (isset($paymentDetails['additional_data']['dfReferenceId'])) { $paymentDetails['dfReferenceId'] = $paymentDetails['additional_data']['dfReferenceId']; @@ -1353,7 +1406,8 @@ public function collectWalletOrderParameters( 'threeDSecureConfig' => $this->_getThreeDSecureConfig($paymentDetails['method']), 'shopperIpAddress' => $this->_getClientIPAddress(), 'exponent' => $exponent, - 'isMultishippingOrder' => $isMultiShippingOrder + 'isMultishippingOrder' => $isMultiShippingOrder, + 'browserFields'=>$browserfields ]; } } @@ -1374,7 +1428,14 @@ public function collectWalletOrderParameters( $ephemeralPublicKey = $headerObject->ephemeralPublicKey; $publicKeyHash = $headerObject->publicKeyHash; $transactionId = $headerObject->transactionId; - + $browserfields = [ + 'browserScreenHeight' => $paymentDetails['additional_data'] + ['browser_screenheight'], + 'browserScreenWidth' => $paymentDetails['additional_data'] + ['browser_screenwidth'], + 'browserColourDepth' => $paymentDetails['additional_data'] + ['browser_colordepth'], + ]; return [ 'orderCode' => $orderCode, 'merchantCode' => $this->worldpayHelper-> @@ -1393,7 +1454,8 @@ public function collectWalletOrderParameters( 'publicKeyHash' => $publicKeyHash, 'transactionId' => $transactionId, 'exponent' => $exponent, - 'isMultishippingOrder' => $isMultiShippingOrder + 'isMultishippingOrder' => $isMultiShippingOrder, + 'browserFields'=> $browserfields ]; } } @@ -1670,8 +1732,7 @@ public function getReturnUrls() private function _getSessionDetails($paymentDetails, $countryCode) { $sessionDetails = []; - if ($paymentDetails['additional_data']['cc_type'] == 'KLARNA-SSL' && - isset($paymentDetails['additional_data']['klarna_type'])) { + if ($paymentDetails['additional_data']['cc_type'] == 'KLARNA-SSL') { $sessionDetails['sessionId'] = $this->session->getSessionId(); $sessionDetails['shopperIpAddress'] = $this->_getClientIPAddress(); $sessionDetails['subscriptionDays'] = $this->worldpayHelper->getKlarnaSubscriptionDays($countryCode); diff --git a/Model/Order/Email/Sender/OrderSender.php b/Model/Order/Email/Sender/OrderSender.php index 1e9c7b95..3feb9406 100644 --- a/Model/Order/Email/Sender/OrderSender.php +++ b/Model/Order/Email/Sender/OrderSender.php @@ -239,4 +239,28 @@ public function authorisedEmailSend(order $order, $successFlag) } return true; } + + /** + * Place Order confirm email for redirect mode full page + * + * @param array $order + * @return + */ + public function fullPageRedirectOrderEmail(order $order) + { + $this->identityContainer->setStore($order->getStore()); + if (!$this->identityContainer->isEnabled()) { + return false; + } + $this->prepareTemplate($order); + /** @var SenderBuilder $sender */ + $sender = $this->getSender(); + try { + $sender->send(); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + return false; + } + return true; + } } diff --git a/Model/Payment/Service.php b/Model/Payment/Service.php index b610af28..466c1a63 100644 --- a/Model/Payment/Service.php +++ b/Model/Payment/Service.php @@ -158,11 +158,11 @@ public function getPaymentUpdateXmlForOrder(\Sapient\Worldpay\Model\Order $order if ($worldPayPayment->getIsMultishippingOrder()) { $interactionType = self::INTERACTION_TYPE_MS; } - + $worldPayOrder = $order->getOrder(); $rawXml = $this->paymentservicerequest->inquiry( $worldPayPayment->getMerchantId(), $worldPayPayment->getWorldpayOrderId(), - $worldPayPayment->getStoreId(), + $worldPayOrder->getStoreId(), $order->getPaymentMethodCode(), $worldPayPayment->getPaymentType(), $interactionType diff --git a/Model/Payment/UpdateWorldpayment.php b/Model/Payment/UpdateWorldpayment.php index 72adfbca..6848f7e5 100644 --- a/Model/Payment/UpdateWorldpayment.php +++ b/Model/Payment/UpdateWorldpayment.php @@ -98,6 +98,12 @@ class UpdateWorldpayment * @var \Sapient\Worldpay\Model\Recurring\Subscription\TransactionsFactory */ public $transactionFactory; + + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + private $storeManager; + /** * Constructor * @@ -114,6 +120,7 @@ class UpdateWorldpayment * @param EncryptorInterface $encryptor * @param \Sapient\Worldpay\Model\Recurring\Subscription\TransactionsFactory $transactionsFactory * @param \Sapient\Worldpay\Model\Worldpayment $worldpaypaymentmodel + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Json $serializer */ public function __construct( @@ -130,6 +137,7 @@ public function __construct( EncryptorInterface $encryptor, \Sapient\Worldpay\Model\Recurring\Subscription\TransactionsFactory $transactionsFactory, \Sapient\Worldpay\Model\Worldpayment $worldpaypaymentmodel, + \Magento\Store\Model\StoreManagerInterface $storeManager, Json $serializer ) { $this->wplogger = $wplogger; @@ -145,6 +153,7 @@ public function __construct( $this->encryptor = $encryptor; $this->transactionFactory = $transactionsFactory; $this->worldpaypaymentmodel = $worldpaypaymentmodel; + $this->storeManager = $storeManager; $this->serializer = $serializer; } @@ -344,6 +353,7 @@ public function updateWorldpayPaymentForMyAccount( $wpp->setData('aav_telephone_result_code', $payment->AAVTelephoneResultCode['description']); $wpp->setData('aav_email_result_code', $payment->AAVEmailResultCode['description']); $wpp->setData('latam_instalments', $lataminstalments); + $wpp->setData('store_id', $this->storeManager->getStore()->getId()); $wpp->save(); if ($this->customerSession->getIsSavedCardRequested() && $orderStatus->token) { $this->customerSession->unsIsSavedCardRequested(); @@ -429,6 +439,7 @@ public function saveTokenData($tokenElement, $payment, $merchantCode, $disclaime $savedTokenFactory->setDisclaimerFlag($disclaimerFlag); } $savedTokenFactory->setTokenType($tokenScope); + $savedTokenFactory->setStoreId($this->storeManager->getStore()->getId()); $savedTokenFactory->save(); $tokenId = $savedTokenFactory->getId(); $this->saveTokenDataToTransactions($tokenId, $orderCode); diff --git a/Model/Payment/WorldPayPayment.php b/Model/Payment/WorldPayPayment.php index 40532b9d..01ca4174 100644 --- a/Model/Payment/WorldPayPayment.php +++ b/Model/Payment/WorldPayPayment.php @@ -69,7 +69,8 @@ public function updateWorldpayPayment(\Sapient\Worldpay\Model\Payment\StateInter $wpp->setData('payment_type', $paymentState->getPaymentMethod()); } if (!empty($wpp->getData('payment_type')) && !empty($paymentState->getPaymentMethod())) { - if (strtolower($wpp->getData('payment_type')) == "all") { + if (strtolower($wpp->getData('payment_type')) == "all" || + $wpp->getData('payment_type') == 'ONLINE') { if (!in_array( strtoupper($paymentState->getPaymentMethod()), $this->apmMethods diff --git a/Model/Request.php b/Model/Request.php index ae8280fc..f445b21b 100644 --- a/Model/Request.php +++ b/Model/Request.php @@ -67,6 +67,11 @@ public function sendRequest($quote, $username, $password) $request = $this->_getRequest(); $logger = $this->_wplogger; $url = $this->_getUrl(); + + $pluginTrackerDetails = $this->collectHeaderPluginTrackerdetails($quote); + $_xml = clone($quote); + $paymentDetails = $_xml->getElementsByTagName('paymentDetails'); + $logger->info('Setting destination URL: ' . $url); $logger->info('Initialising request'); $request->setOption(CURLOPT_POST, self::CURL_POST); @@ -88,10 +93,21 @@ public function sendRequest($quote, $username, $password) } //$request->addCookie(CURLOPT_COOKIE, $cookie); $request->setTimeout(self::CURL_TIMEOUT); - $headersArray = [ - 'Content-Type'=> 'text/xml', - 'Expect'=>'' - ]; + if (isset($paymentDetails[0]->nodeValue)) { + $headersArray = [ + 'Content-Type'=> 'text/xml', + 'Expect'=>'', + 'ecommerce_platform' => $pluginTrackerDetails['ecommerce_platform'], + 'ecommerce_platform_version' => $pluginTrackerDetails['ecommerce_platform_version'], + 'ecommerce_plugin_data'=>json_encode($pluginTrackerDetails['ecommerce_plugin_data']) + ]; + } else { + $headersArray = [ + 'Content-Type'=> 'text/xml', + 'Expect'=>'' + ]; + } + $logger->info('Sending XML as: ' . $this->_getObfuscatedXmlLog($quote)); $request->setOption(CURLOPT_HEADER, 1); $request->setHeaders($headersArray); @@ -145,7 +161,7 @@ public function sendRequest($quote, $username, $password) */ protected function _getObfuscatedXmlLog($quote) { - $elems = ['cardNumber', 'cvc', 'iban', 'telephoneNumber']; + $elems = ['cardNumber', 'cvc', 'iban']; $_xml = clone($quote); foreach ($elems as $_e) { @@ -202,4 +218,30 @@ private function findErrorMessage($response) } return $errorMsg; } + + /** + * Collect Plugin Trackerdetails for Header Request + * + * @param array $quote + * @return array + */ + private function collectHeaderPluginTrackerdetails($quote) + { + $paymentMethod=''; + $_xml = clone($quote); + $paymentDetails = $_xml->getElementsByTagName('paymentDetails'); + if (isset($paymentDetails[0]->nodeValue)) { + $orderContent = $_xml->getElementsByTagName('orderContent'); + if (isset($orderContent[0]->nodeValue)) { + $orderContentdata = $orderContent[0]->nodeValue; + $result = json_decode($orderContentdata); + $paymentMethod = $result->additional_details->transaction_method; + } + } + $pluginTrackerDetails = $this->helper->getPluginTrackerHeaderdetails(); + $pluginTrackerDetails['ecommerce_plugin_data']['additional_details'] = + ['payment_method'=>$paymentMethod]; + + return $pluginTrackerDetails; + } } diff --git a/Model/Request/PaymentServiceRequest.php b/Model/Request/PaymentServiceRequest.php index dc28d8f2..96f5e8de 100644 --- a/Model/Request/PaymentServiceRequest.php +++ b/Model/Request/PaymentServiceRequest.php @@ -106,6 +106,13 @@ public function order3DSecure($directOrderParams) $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode(); $merchantCode = !empty($msMerchantCode) ? $msMerchantCode : $merchantCode ; } + $directOrderParams['paymentDetails']['isEnabledEFTPOS'] = false; + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eftPosMerchantCode = $this->worldpayhelper->getEFTPOSMerchantCode(); + $merchantCode = !empty($eftPosMerchantCode) ? $eftPosMerchantCode : $merchantCode ; + $directOrderParams['paymentDetails']['isEnabledEFTPOS'] = true; + } + if (isset($directOrderParams['tokenRequestConfig'])) { $requestConfiguration = [ 'threeDSecureConfig' => $directOrderParams['threeDSecureConfig'], @@ -150,6 +157,15 @@ public function order3DSecure($directOrderParams) $xmlUsername = !empty($msMerchantUn) ? $msMerchantUn : $xmlUsername ; $xmlPassword = !empty($msMerchantPw) ? $msMerchantPw : $xmlPassword ; } + + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eftMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eftMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + + $xmlUsername = !empty($msMerchantUn) ? $eftMerchantUn : $xmlUsername ; + $xmlPassword = !empty($msMerchantPw) ? $eftMerchantPw : $xmlPassword ; + } + return $this->_sendRequest( dom_import_simplexml($orderSimpleXml)->ownerDocument, $xmlUsername, @@ -166,7 +182,6 @@ public function order3DSecure($directOrderParams) public function order($directOrderParams) { $loggerMsg = '########## Submitting direct order request. OrderCode: '; - $this->_wplogger->info($loggerMsg . $directOrderParams['orderCode'] . ' ##########'); $requestConfiguration = [ 'threeDSecureConfig' => $directOrderParams['threeDSecureConfig'], 'tokenRequestConfig' => $directOrderParams['tokenRequestConfig'] @@ -219,6 +234,23 @@ public function order($directOrderParams) $xmlPassword = !empty($msMerchantPw) ? $msMerchantPw : $xmlPassword ; $merchantCode = !empty($msMerchantCode) ? $msMerchantCode : $merchantCode ; } + $directOrderParams['paymentDetails']['isEnabledEFTPOS'] = false; + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eftposMerchantCode = $this->worldpayhelper->getEFTPOSMerchantCode(); + $eftposMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eftposMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + + $xmlUsername = !empty($eftposMerchantUn) ? $eftposMerchantUn : $xmlUsername ; + $xmlPassword = !empty($eftposMerchantPw) ? $eftposMerchantPw : $xmlPassword ; + $merchantCode = !empty($eftposMerchantCode) ? $eftposMerchantCode : $merchantCode ; + $directOrderParams['paymentDetails']['isEnabledEFTPOS'] = true; + } + if ($this->worldpayhelper->isEnabledEFTPOS() + && !empty($this->worldpayhelper->getEFTPOSRoutingMid())) { + $directOrderParams['paymentDetails']['routingMID'] = + $this->worldpayhelper->getEFTPOSRoutingMid(); + } + $directOrderParams['paymentDetails']['sendShopperIpAddress'] = $this->isSendShopperIpAddress(); ##### Added orderContent node for plugin tracker ###### $directOrderParams['orderContent'] = $this->collectPluginTrackerDetails( $directOrderParams['paymentDetails'] @@ -261,6 +293,7 @@ public function order($directOrderParams) if (empty($directOrderParams['orderLineItems'])) { $directOrderParams['orderLineItems'] = ''; } + $orderSimpleXml = $this->xmldirectorder->build( $merchantCode, $directOrderParams['orderCode'], @@ -286,7 +319,9 @@ public function order($directOrderParams) $directOrderParams['exponent'], $directOrderParams['primeRoutingData'], $directOrderParams['orderLineItems'], - $captureDelay + $captureDelay, + $directOrderParams['browserFields'], + $directOrderParams['telephoneNumber'] ); return $this->_sendRequest( dom_import_simplexml($orderSimpleXml)->ownerDocument, @@ -462,7 +497,6 @@ public function orderToken($tokenOrderParams) $recurringUserName = $this->worldpayhelper->getRecurringUsername(); $recurringPassword = $this->worldpayhelper->getRecurringPassword(); $recurringCode = $this->worldpayhelper->getRecurringMerchantCode(); - $xmlUsername = !empty($recurringUserName) ? $recurringUserName : $xmlUsername; $xmlPassword = !empty($recurringPassword) ? $recurringPassword : $xmlPassword; $merchantCode = !empty($recurringCode) ? $recurringCode : $merchantCode; @@ -493,6 +527,25 @@ public function orderToken($tokenOrderParams) $xmlPassword = !empty($msMerchantPw) ? $msMerchantPw : $xmlPassword ; $merchantCode = !empty($msMerchantCode) ? $msMerchantCode : $merchantCode ; } + $tokenOrderParams['paymentDetails']['isEnabledEFTPOS'] = false; + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eftposMerchantCode = $this->worldpayhelper->getEFTPOSMerchantCode(); + $eftposMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eftposMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + + $xmlUsername = !empty($eftposMerchantUn) ? $eftposMerchantUn : $xmlUsername ; + $xmlPassword = !empty($eftposMerchantPw) ? $eftposMerchantPw : $xmlPassword ; + $merchantCode = !empty($eftposMerchantCode) ? $eftposMerchantCode : $merchantCode ; + $tokenOrderParams['paymentDetails']['isEnabledEFTPOS'] = true; + $tokenOrderParams['paymentDetails']['sendShopperIpAddress'] = $this->isSendShopperIpAddress(); + } + + if ($this->worldpayhelper->isEnabledEFTPOS() + && !empty($this->worldpayhelper->getEFTPOSRoutingMid())) { + $tokenOrderParams['paymentDetails']['routingMID'] = + $this->worldpayhelper->getEFTPOSRoutingMid(); + } + $captureDelay = $this->worldpayhelper->getCaptureDelayValues(); ##### Added orderContent node for plugin tracker ###### $tokenOrderParams['orderContent'] = $this->collectPluginTrackerDetails( @@ -525,7 +578,9 @@ public function orderToken($tokenOrderParams) $tokenOrderParams['exponent'], $tokenOrderParams['primeRoutingData'], $tokenOrderParams['orderLineItems'], - $captureDelay + $captureDelay, + $tokenOrderParams['browserFields'], + $tokenOrderParams['telephoneNumber'] ); return $this->_sendRequest( dom_import_simplexml($orderSimpleXml)->ownerDocument, @@ -704,7 +759,14 @@ public function redirectKlarnaOrder($redirectOrderParams) ); $captureDelay = $this->worldpayhelper->getCaptureDelayValues(); + + $isStorePickup = $this->worldpayhelper->isStorePickup(); + $isEnabledStorePickup = $this->worldpayhelper->isStorePickUpEnabled(); + $storePickUpMethod = $this->worldpayhelper->getStorePickUpMethod(); + $storepickUpType = $this->worldpayhelper->getStorePickUpType(); + $this->xmlredirectorder = new \Sapient\Worldpay\Model\XmlBuilder\RedirectKlarnaOrder(); + $redirectSimpleXml = $this->xmlredirectorder->build( $merchantCode, $redirectOrderParams['orderCode'], @@ -725,7 +787,11 @@ public function redirectKlarnaOrder($redirectOrderParams) $redirectOrderParams['exponent'], $redirectOrderParams['sessionData'], $redirectOrderParams['orderContent'], - $captureDelay + $captureDelay, + $isStorePickup, + $isEnabledStorePickup, + $storePickUpMethod, + $storepickUpType ); return $this->_sendRequest( @@ -843,16 +909,19 @@ public function capture(\Magento\Sales\Model\Order $order, $wp, $paymentMethodCo $exponent = $this->worldpayhelper->getCurrencyExponent($currencyCode); if (strpos($wp->getPaymentType(), "KLARNA") !== false && !empty($capturedItems)) { - $invoicedItems = $this->getInvoicedItemsDetails($capturedItems); + $instorePickup = ''; + if (strpos($order->getShippingMethod(), 'instore_pickup') !== false) { + $instorePickup = $orderCode; + } + $invoicedItems = $this->getInvoicedItemsDetails($capturedItems, $instorePickup); } else { $invoicedItems = ''; } $captureType = 'full'; - - $xmlUsername = $this->worldpayhelper->getXmlUsername($wp->getPaymentType()); - $xmlPassword = $this->worldpayhelper->getXmlPassword($wp->getPaymentType()); - $merchantCode = $this->worldpayhelper->getMerchantCode($wp->getPaymentType()); - + $storeId = $order->getStoreId(); + $xmlUsername = $this->worldpayhelper->getXmlUsername($wp->getPaymentType(), $storeId); + $xmlPassword = $this->worldpayhelper->getXmlPassword($wp->getPaymentType(), $storeId); + $merchantCode = $this->worldpayhelper->getMerchantCode($wp->getPaymentType(), $storeId); if ($wp->getInteractionType() === 'MOTO') { $xmlUsername = !empty($this->worldpayhelper->getMotoUsername()) ? $this->worldpayhelper->getMotoUsername() : $xmlUsername; @@ -863,24 +932,33 @@ public function capture(\Magento\Sales\Model\Order $order, $wp, $paymentMethodCo } if ($wp->getIsMultishippingOrder()) { - $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode(); - $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername(); - $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword(); + $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode($storeId); + $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername($storeId); + $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword($storeId); $xmlUsername = !empty($msMerchantUn) ? $msMerchantUn : $xmlUsername ; $xmlPassword = !empty($msMerchantPw) ? $msMerchantPw : $xmlPassword ; $merchantCode = !empty($msMerchantCode) ? $msMerchantCode : $merchantCode ; } if ($paymentMethodCode == 'worldpay_paybylink') { - - $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode(); - $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername(); - $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword(); + $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode($storeId); + $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername($storeId); + $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword($storeId); $merchantCode = !empty($pblMerchantCode) ? $pblMerchantCode : $merchantCode; $xmlUsername = !empty($pblMerchantUn) ? $pblMerchantUn : $xmlUsername; $xmlPassword = !empty($pblMerchantPw) ? $pblMerchantPw : $xmlPassword; } + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eftposMerchantCode = $this->worldpayhelper->getEFTPOSMerchantCode(); + $eftposMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eftposMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + + $xmlUsername = !empty($eftposMerchantUn) ? $eftposMerchantUn : $xmlUsername ; + $xmlPassword = !empty($eftposMerchantPw) ? $eftposMerchantPw : $xmlPassword ; + $merchantCode = !empty($eftposMerchantCode) ? $eftposMerchantCode : $merchantCode ; + } + $captureSimpleXml = $this->xmlcapture->build( $merchantCode, $orderCode, @@ -936,16 +1014,20 @@ public function partialCapture( $exponent = $this->worldpayhelper->getCurrencyExponent($currencyCode); if (strpos($wp->getPaymentType(), "KLARNA") !== false && !empty($capturedItems)) { - $invoicedItems = $this->getInvoicedItemsDetails($capturedItems); + $instorePickup=''; + if (strpos($order->getShippingMethod(), 'instore_pickup') !== false) { + $instorePickup = $orderCode; + } + $invoicedItems = $this->getInvoicedItemsDetails($capturedItems, $instorePickup); } else { $invoicedItems = ''; } $captureType = 'partial'; - - $xmlUsername = $this->worldpayhelper->getXmlUsername($wp->getPaymentType()); - $xmlPassword = $this->worldpayhelper->getXmlPassword($wp->getPaymentType()); - $merchantCode = $this->worldpayhelper->getMerchantCode($wp->getPaymentType()); + $storeId = $order->getStoreId(); + $xmlUsername = $this->worldpayhelper->getXmlUsername($wp->getPaymentType(), $storeId); + $xmlPassword = $this->worldpayhelper->getXmlPassword($wp->getPaymentType(), $storeId); + $merchantCode = $this->worldpayhelper->getMerchantCode($wp->getPaymentType(), $storeId); if ($wp->getInteractionType() === 'MOTO') { $xmlUsername = !empty($this->worldpayhelper->getMotoUsername()) @@ -956,22 +1038,33 @@ public function partialCapture( ? $this->worldpayhelper->getMotoMerchantCode() : $merchantCode; } if ($wp->getIsMultishippingOrder()) { - $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode(); - $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername(); - $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword(); + $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode($storeId); + $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername($storeId); + $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword($storeId); $xmlUsername = !empty($msMerchantUn) ? $msMerchantUn : $xmlUsername ; $xmlPassword = !empty($msMerchantPw) ? $msMerchantPw : $xmlPassword ; $merchantCode = !empty($msMerchantCode) ? $msMerchantCode : $merchantCode ; } if ($paymentMethodCode == 'worldpay_paybylink') { - $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode(); - $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername(); - $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword(); + $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode($storeId); + $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername($storeId); + $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword($storeId); $merchantCode = !empty($pblMerchantCode) ? $pblMerchantCode : $merchantCode; $xmlUsername = !empty($pblMerchantUn) ? $pblMerchantUn : $xmlUsername; $xmlPassword = !empty($pblMerchantPw) ? $pblMerchantPw : $xmlPassword; } + + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eftposMerchantCode = $this->worldpayhelper->getEFTPOSMerchantCode(); + $eftposMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eftposMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + + $xmlUsername = !empty($eftposMerchantUn) ? $eftposMerchantUn : $xmlUsername ; + $xmlPassword = !empty($eftposMerchantPw) ? $eftposMerchantPw : $xmlPassword ; + $merchantCode = !empty($eftposMerchantCode) ? $eftposMerchantCode : $merchantCode ; + } + $captureSimpleXml = $this->xmlcapture->build( $merchantCode, $orderCode, @@ -1013,14 +1106,31 @@ protected function _sendRequest($xml, $username, $password) return $response; } + /** + * Cancel Pending order Cron request + * + * @param SimpleXmlElement $xml + * @param string $username + * @param string $password + * @param bool $isOrderClenup + * @return SimpleXmlElement $response + */ + protected function _sendPendingOrderRequest($xml, $username, $password, $isOrderClenup) + { + $response = $this->_request->sendRequest($xml, $username, $password); + $this->_checkForError($response, $xml, $isOrderClenup); + return $response; + } + /** * Check error * * @param SimpleXmlElement $response * @param string|null $xml + * @param bool|null $isOrderClenup * @throw Exception */ - protected function _checkForError($response, $xml = "") + protected function _checkForError($response, $xml = "", $isOrderClenup = "") { $paymentService = new \SimpleXmlElement($response); $lastEvent = $paymentService->xpath('//lastEvent'); @@ -1028,6 +1138,17 @@ protected function _checkForError($response, $xml = "") return; } $error = $paymentService->xpath('//error'); + if ($isOrderClenup) { + if ($error) { + $this->emailErrorReportHelper->sendErrorReport([ + 'request'=>$xml->saveXML(), + 'response'=>$response, + 'error_code'=>''.$error[0]['code'], + 'error_message'=>''.$error[0] + ]); + } + return $response; + } if ($error) { $this->emailErrorReportHelper->sendErrorReport([ @@ -1073,10 +1194,10 @@ public function refund( ); $currencyCode = $order->getOrderCurrencyCode(); $exponent = $this->worldpayhelper->getCurrencyExponent($currencyCode); - - $xmlUsername = $this->worldpayhelper->getXmlUsername($wp->getPaymentType()); - $xmlPassword = $this->worldpayhelper->getXmlPassword($wp->getPaymentType()); - $merchantCode = $this->worldpayhelper->getMerchantCode($wp->getPaymentType()); + $storeId = $order->getStoreId(); + $xmlUsername = $this->worldpayhelper->getXmlUsername($wp->getPaymentType(), $storeId); + $xmlPassword = $this->worldpayhelper->getXmlPassword($wp->getPaymentType(), $storeId); + $merchantCode = $this->worldpayhelper->getMerchantCode($wp->getPaymentType(), $storeId); if ($wp->getInteractionType() === 'MOTO') { $xmlUsername = !empty($this->worldpayhelper->getMotoUsername()) ? $this->worldpayhelper->getMotoUsername() : $xmlUsername; @@ -1086,23 +1207,31 @@ public function refund( ? $this->worldpayhelper->getMotoMerchantCode() : $merchantCode; } if ($wp->getIsMultishippingOrder()) { - $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode(); - $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername(); - $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword(); + $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode($storeId); + $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername($storeId); + $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword($storeId); $xmlUsername = !empty($msMerchantUn) ? $msMerchantUn : $xmlUsername ; $xmlPassword = !empty($msMerchantPw) ? $msMerchantPw : $xmlPassword ; $merchantCode = !empty($msMerchantCode) ? $msMerchantCode : $merchantCode ; } if ($paymentMethodCode == 'worldpay_paybylink') { - $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode(); - $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername(); - $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword(); + $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode($storeId); + $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername($storeId); + $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword($storeId); $merchantCode = !empty($pblMerchantCode) ? $pblMerchantCode : $merchantCode; $xmlUsername = !empty($pblMerchantUn) ? $pblMerchantUn : $xmlUsername; $xmlPassword = !empty($pblMerchantPw) ? $pblMerchantPw : $xmlPassword; } - + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eftposMerchantCode = $this->worldpayhelper->getEFTPOSMerchantCode(); + $eftposMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eftposMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + + $xmlUsername = !empty($eftposMerchantUn) ? $eftposMerchantUn : $xmlUsername ; + $xmlPassword = !empty($eftposMerchantPw) ? $eftposMerchantPw : $xmlPassword ; + $merchantCode = !empty($eftposMerchantCode) ? $eftposMerchantCode : $merchantCode ; + } $refundSimpleXml = $this->xmlrefund->build( $merchantCode, $orderCode, @@ -1130,14 +1259,21 @@ public function refund( * @param string $paymentMethodCode * @param string $paymenttype * @param string $interactionType + * @param bool|null $isOrderClenup * @return mixed */ - public function inquiry($merchantCode, $orderCode, $storeId, $paymentMethodCode, $paymenttype, $interactionType) - { + public function inquiry( + $merchantCode, + $orderCode, + $storeId, + $paymentMethodCode, + $paymenttype, + $interactionType, + $isOrderClenup = "" + ) { $this->_wplogger->info('########## Submitting order inquiry. OrderCode: (' . $orderCode . ') ##########'); - $this->_wplogger->info('## Interaction Type'.$interactionType); - $xmlUsername = $this->worldpayhelper->getXmlUsername($paymenttype); - $xmlPassword = $this->worldpayhelper->getXmlPassword($paymenttype); + $xmlUsername = $this->worldpayhelper->getXmlUsername($paymenttype, $storeId); + $xmlPassword = $this->worldpayhelper->getXmlPassword($paymenttype, $storeId); $merchantcode = $merchantCode; if ($interactionType === 'MOTO') { @@ -1150,9 +1286,9 @@ public function inquiry($merchantCode, $orderCode, $storeId, $paymentMethodCode, } if ($interactionType == \Sapient\Worldpay\Model\Payment\Service::INTERACTION_TYPE_MS) { - $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode(); - $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername(); - $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword(); + $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode($storeId); + $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername($storeId); + $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword($storeId); $xmlUsername = !empty($msMerchantUn) ? $msMerchantUn : $xmlUsername ; $xmlPassword = !empty($msMerchantPw) ? $msMerchantPw : $xmlPassword ; @@ -1160,18 +1296,39 @@ public function inquiry($merchantCode, $orderCode, $storeId, $paymentMethodCode, } if ($paymentMethodCode == 'worldpay_paybylink') { - $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode(); - $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername(); - $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword(); - $merchantCode = !empty($pblMerchantCode) ? $pblMerchantCode : $merchantCode; + $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode($storeId); + $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername($storeId); + $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword($storeId); + $merchantcode = !empty($pblMerchantCode) ? $pblMerchantCode : $merchantcode; $xmlUsername = !empty($pblMerchantUn) ? $pblMerchantUn : $xmlUsername; $xmlPassword = !empty($pblMerchantPw) ? $pblMerchantPw : $xmlPassword; } + + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eftposMerchantCode = $this->worldpayhelper->getEFTPOSMerchantCode(); + $eftposMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eftposMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + + $xmlUsername = !empty($eftposMerchantUn) ? $eftposMerchantUn : $xmlUsername ; + $xmlPassword = !empty($eftposMerchantPw) ? $eftposMerchantPw : $xmlPassword ; + $merchantcode = !empty($eftposMerchantCode) ? $eftposMerchantCode : $merchantcode ; + } + $this->xmlinquiry = new \Sapient\Worldpay\Model\XmlBuilder\Inquiry(); $inquirySimpleXml = $this->xmlinquiry->build( $merchantcode, $orderCode ); + + if ($isOrderClenup) { + return $this->_sendPendingOrderRequest( + dom_import_simplexml($inquirySimpleXml)->ownerDocument, + $xmlUsername, + $xmlPassword, + $isOrderClenup + ); + } + return $this->_sendRequest( dom_import_simplexml($inquirySimpleXml)->ownerDocument, $xmlUsername, @@ -1269,6 +1426,15 @@ public function paymentOptionsByCountry($paymentOptionsParams, $isMultishipping $merchantUn = !empty($msMerchantUn) ? $msMerchantUn : $merchantUn; $merchantPw = !empty($mcMerchantPw) ? $mcMerchantPw : $merchantPw; } + + $isEnabledEftPos = $this->worldpayhelper->isEnabledEFTPOS(); + if ($isEnabledEftPos) { + $eftPosMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eftPoscMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + $merchantUn = !empty($eftPosMerchantUn) ? $eftPosMerchantUn : $merchantUn; + $merchantPw = !empty($eftPoscMerchantPw) ? $eftPoscMerchantPw : $merchantPw; + } + return $this->_sendRequest( dom_import_simplexml($paymentOptionsXml)->ownerDocument, $merchantUn, @@ -1286,10 +1452,10 @@ public function walletsOrder($walletOrderParams) { $loggerMsg = '########## Submitting wallet order request. OrderCode: '; $this->_wplogger->info($loggerMsg . $walletOrderParams['orderCode'] . ' ##########'); - $requestConfiguration = [ 'threeDSecureConfig' => $walletOrderParams['threeDSecureConfig'], ]; + $xmlUsername = $this->worldpayhelper->getXmlUsername($walletOrderParams['paymentType']); $xmlPassword = $this->worldpayhelper->getXmlPassword($walletOrderParams['paymentType']); $merchantCode = $walletOrderParams['merchantCode']; @@ -1298,16 +1464,25 @@ public function walletsOrder($walletOrderParams) $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode(); $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername(); $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword(); - $xmlUsername = !empty($msMerchantUn) ? $msMerchantUn : $xmlUsername ; $xmlPassword = !empty($msMerchantPw) ? $msMerchantPw : $xmlPassword ; $merchantCode = !empty($msMerchantCode) ? $msMerchantCode : $merchantCode ; } + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eFTMerchantCode = $this->worldpayhelper->getEFTPOSMerchantCode(); + $eFTMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eFTMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + $xmlUsername = !empty($eFTMerchantUn) ? $eFTMerchantUn : $xmlUsername; + $xmlPassword = !empty($eFTMerchantPw) ? $eFTMerchantPw : $xmlPassword; + $merchantCode = !empty($eFTMerchantCode) ? $eFTMerchantCode : $merchantCode; + } + $captureDelay = $this->worldpayhelper->getCaptureDelayValues(); ##### Added orderContent node for plugin tracker ###### $walletOrderParams['orderContent'] = $this->collectPluginTrackerDetails( $walletOrderParams['paymentType'] ); + $this->xmlredirectorder = new \Sapient\Worldpay\Model\XmlBuilder\WalletOrder($requestConfiguration); $walletSimpleXml = $this->xmlredirectorder->build( $merchantCode, @@ -1329,7 +1504,8 @@ public function walletsOrder($walletOrderParams) $walletOrderParams['shopperIpAddress'], $walletOrderParams['paymentDetails'], $walletOrderParams['exponent'], - $captureDelay + $captureDelay, + $walletOrderParams['browserFields'] ); return $this->_sendRequest( @@ -1387,7 +1563,8 @@ public function applePayOrder($applePayOrderParams) $applePayOrderParams['publicKeyHash'], $applePayOrderParams['transactionId'], $applePayOrderParams['exponent'], - $captureDelay + $captureDelay, + $applePayOrderParams['browserFields'] ); return $this->_sendRequest( @@ -1428,7 +1605,7 @@ public function samsungPayOrder($samsungPayOrderParams) $samsungPayOrderParams['paymentType'] ); - $appleSimpleXml = $this->xmlredirectorder->build( + $samsungPaySimpleXml = $this->xmlredirectorder->build( $merchantCode, $samsungPayOrderParams['orderCode'], $samsungPayOrderParams['orderDescription'], @@ -1439,11 +1616,14 @@ public function samsungPayOrder($samsungPayOrderParams) $samsungPayOrderParams['shopperEmail'], $samsungPayOrderParams['data'], $samsungPayOrderParams['exponent'], - $captureDelay + $captureDelay, + $samsungPayOrderParams['browserFields'], + $samsungPayOrderParams['shopperIpAddress'], + $samsungPayOrderParams['sessionId'] ); return $response = $this->_sendRequest( - dom_import_simplexml($appleSimpleXml)->ownerDocument, + dom_import_simplexml($samsungPaySimpleXml)->ownerDocument, $xmlUsername, $xmlPassword ); @@ -1480,7 +1660,8 @@ public function chromepayOrder($chromeOrderParams) $chromeOrderParams['billingAddress'], $chromeOrderParams['shopperEmail'], $chromeOrderParams['exponent'], - $captureDelay + $captureDelay, + $chromeOrderParams['browserFields'] ); //echo $this->worldpayhelper->getXmlUsername($paymentType);exit; return $this->_sendRequest( @@ -1693,10 +1874,10 @@ public function cancelOrder(\Magento\Sales\Model\Order $order, $wp, $paymentMeth $this->xmlcancel = new \Sapient\Worldpay\Model\XmlBuilder\CancelOrder(); $currencyCode = $order->getOrderCurrencyCode(); $exponent = $this->worldpayhelper->getCurrencyExponent($currencyCode); - - $xmlUsername = $this->worldpayhelper->getXmlUsername($wp->getPaymentType()); - $xmlPassword = $this->worldpayhelper->getXmlPassword($wp->getPaymentType()); - $merchantCode = $this->worldpayhelper->getMerchantCode($wp->getPaymentType()); + $storeId = $order->getStoreId(); + $xmlUsername = $this->worldpayhelper->getXmlUsername($wp->getPaymentType(), $storeId); + $xmlPassword = $this->worldpayhelper->getXmlPassword($wp->getPaymentType(), $storeId); + $merchantCode = $this->worldpayhelper->getMerchantCode($wp->getPaymentType(), $storeId); if ($wp->getInteractionType() === 'MOTO') { $xmlUsername = !empty($this->worldpayhelper->getMotoUsername()) ? $this->worldpayhelper->getMotoUsername() : $xmlUsername; @@ -1706,22 +1887,31 @@ public function cancelOrder(\Magento\Sales\Model\Order $order, $wp, $paymentMeth ? $this->worldpayhelper->getMotoMerchantCode() : $merchantCode; } if ($wp->getIsMultishippingOrder()) { - $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode(); - $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername(); - $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword(); + $msMerchantCode = $this->worldpayhelper->getMultishippingMerchantCode($storeId); + $msMerchantUn = $this->worldpayhelper->getMultishippingMerchantUsername($storeId); + $msMerchantPw = $this->worldpayhelper->getMultishippingMerchantPassword($storeId); $xmlUsername = !empty($msMerchantUn) ? $msMerchantUn : $xmlUsername ; $xmlPassword = !empty($msMerchantPw) ? $msMerchantPw : $xmlPassword ; $merchantCode = !empty($msMerchantCode) ? $msMerchantCode : $merchantCode ; } if ($paymentMethodCode == 'worldpay_paybylink') { - $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode(); - $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername(); - $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword(); + $pblMerchantCode = $this->worldpayhelper->getPayByLinkMerchantCode($storeId); + $pblMerchantUn = $this->worldpayhelper->getPayByLinkMerchantUsername($storeId); + $pblMerchantPw = $this->worldpayhelper->getPayByLinkMerchantPassword($storeId); $merchantCode = !empty($pblMerchantCode) ? $pblMerchantCode : $merchantCode; $xmlUsername = !empty($pblMerchantUn) ? $pblMerchantUn : $xmlUsername; $xmlPassword = !empty($pblMerchantPw) ? $pblMerchantPw : $xmlPassword; } + if ($this->worldpayhelper->isEnabledEFTPOS()) { + $eftposMerchantCode = $this->worldpayhelper->getEFTPOSMerchantCode(); + $eftposMerchantUn = $this->worldpayhelper->getEFTPosXmlUsername(); + $eftposMerchantPw = $this->worldpayhelper->getEFTPOSXmlPassword(); + + $xmlUsername = !empty($eftposMerchantUn) ? $eftposMerchantUn : $xmlUsername ; + $xmlPassword = !empty($eftposMerchantPw) ? $eftposMerchantPw : $xmlPassword ; + $merchantCode = !empty($eftposMerchantCode) ? $eftposMerchantCode : $merchantCode ; + } $cancelSimpleXml = $this->xmlcancel->build( $merchantCode, $orderCode, @@ -1743,9 +1933,10 @@ public function cancelOrder(\Magento\Sales\Model\Order $order, $wp, $paymentMeth * Get invoice cart item details * * @param array $capturedItems + * @param string $instorePickup * @return mixed */ - public function getInvoicedItemsDetails($capturedItems) + public function getInvoicedItemsDetails($capturedItems, $instorePickup) { $items = $this->getItemDetails($capturedItems); @@ -1755,6 +1946,9 @@ public function getInvoicedItemsDetails($capturedItems) in_array("giftcard", $items['invoicedItems']['0'])))) { $items['trackingId'] = ''; return $items; + } elseif (!empty($instorePickup)) { + $items['trackingId'] = $instorePickup; + return $items; } else { if (array_key_exists('tracking', $capturedItems) && count($capturedItems['tracking']) < 2 @@ -1813,4 +2007,18 @@ public function collectPluginTrackerDetails($paymentType) $pluginTrackerDetails['additional_details']['transaction_method'] = $paymentType; return json_encode($pluginTrackerDetails); } + /** + * Check Send Shooper IP Address or not + */ + public function isSendShopperIpAddress() + { + $sendShopperIp = true; + if ($this->worldpayhelper->isEnabledEFTPOS()) { + if ($this->worldpayhelper->getEFTPOSDebugging()) { + $sendShopperIp = false; + } + return $sendShopperIp; + } + return $sendShopperIp; + } } diff --git a/Model/SkipSubscriptionOrderRepository.php b/Model/SkipSubscriptionOrderRepository.php index 6a5a68ec..12463654 100644 --- a/Model/SkipSubscriptionOrderRepository.php +++ b/Model/SkipSubscriptionOrderRepository.php @@ -126,12 +126,12 @@ public function __construct( */ public function getById($id) { - $editHistory = $this->skipOrderFactory->create(); - $this->editHistoryResource->load($editHistory, $id); - if (!$editHistory->getId()) { + $skipOrderHistory = $this->skipOrderFactory->create(); + $this->skipOrderResource->load($skipOrderHistory, $id); + if (!$skipOrderHistory->getId()) { throw new NoSuchEntityException(__('Unable to find History with ID "%1"', $id)); } - return $editHistory; + return $skipOrderHistory; } /** diff --git a/Model/System/Config/Backend/KlarnaAllowedCountries.php b/Model/System/Config/Backend/KlarnaAllowedCountries.php new file mode 100644 index 00000000..ad9e1124 --- /dev/null +++ b/Model/System/Config/Backend/KlarnaAllowedCountries.php @@ -0,0 +1,38 @@ + 'AT', 'label' => __('Austria')], + ['value' => 'BE', 'label' => __('Belgium')], + ['value' => 'DK', 'label' => __('Denmark')], + ['value' => 'FI', 'label' => __('Finland')], + ['value' => 'FR', 'label' => __('France')], + ['value' => 'DE', 'label' => __('Germany')], + ['value' => 'IE', 'label' => __('Ireland')], + ['value' => 'IT', 'label' => __('Italy')], + ['value' => 'NL', 'label' => __('Netherlands')], + ['value' => 'NO', 'label' => __('Norway')], + ['value' => 'PL', 'label' => __('Poland')], + ['value' => 'PT', 'label' => __('Portugal')], + ['value' => 'ES', 'label' => __('Spain')], + ['value' => 'SE', 'label' => __('Sweden')], + ['value' => 'GB', 'label' => __('United Kingdom')], + ['value' => 'CZ', 'label' => __('Czech Republic')], + ['value' => 'RO', 'label' => __('Romania')], + ['value' => 'GR', 'label' => __('Greece')], + ['value' => 'CH', 'label' => __('Switzerland')] + ]; + } +} diff --git a/Model/Token.php b/Model/Token.php index 9b83e6d0..3f45e149 100644 --- a/Model/Token.php +++ b/Model/Token.php @@ -78,7 +78,7 @@ public function getPaymentToken($customerData, $paymentData) 'userAgentHeader' => php_sapi_name() !== "cli" ? filter_input( INPUT_SERVER, 'HTTP_USER_AGENT', - FILTER_SANITIZE_STRING, + FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW ) : '', 'method' => $paymentData['method'], diff --git a/Model/Utilities/PaymentMethods.php b/Model/Utilities/PaymentMethods.php index dd7b8ff8..f549e650 100644 --- a/Model/Utilities/PaymentMethods.php +++ b/Model/Utilities/PaymentMethods.php @@ -170,7 +170,7 @@ public function getAvailableMethods() protected function _readXML() { - $validator = new \Zend\Validator\File\Exists(); + $validator = new \Laminas\Validator\File\Exists(); if (!self::$_xml && $validator->isValid($this->_xmlLocation)) { self::$_xml = simplexml_load_file($this->_xmlLocation); } diff --git a/Model/WorldpayConfigProvider.php b/Model/WorldpayConfigProvider.php index c820b4f9..dd51ddae 100644 --- a/Model/WorldpayConfigProvider.php +++ b/Model/WorldpayConfigProvider.php @@ -115,7 +115,12 @@ class WorldpayConfigProvider implements ConfigProviderInterface * @var \Magento\Framework\Locale\ResolverInterface */ protected $localeResolver; - + + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + private $storeManager; + /** * @param \Sapient\Worldpay\Logger\WorldpayLogger $wplogger * @param \Sapient\Worldpay\Helper\Data $helper @@ -133,6 +138,7 @@ class WorldpayConfigProvider implements ConfigProviderInterface * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param SerializerInterface $serializer * @param \Magento\Framework\Session\SessionManagerInterface $session + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Filesystem\Driver\File $fileDriver */ public function __construct( @@ -152,6 +158,7 @@ public function __construct( \Magento\Framework\Locale\ResolverInterface $localeResolver, SerializerInterface $serializer, \Magento\Framework\Session\SessionManagerInterface $session, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Filesystem\Driver\File $fileDriver ) { @@ -173,6 +180,7 @@ public function __construct( $this->localeResolver = $localeResolver; $this->serializer = $serializer; $this->session = $session; + $this->storeManager = $storeManager; $this->fileDriver = $fileDriver; } @@ -226,6 +234,8 @@ public function getConfig() $config['payment']['ccform']['isDisclaimerMessageMandatory'] = $this->worldpayHelper ->isDisclaimerMessageMandatory(); $config['payment']['ccform']['apmtitle'] = $this->getApmtitle(); + $config['payment']['ccform']['isStatementNarrativeEnabled'] = $this->worldpayHelper + ->isStatementNarrativeEnabled(); $config['payment']['ccform']['walletstitle'] = $this->getWalletstitle(); $config['payment']['ccform']['samsungServiceId'] = $this->getSamsungServiceId(); $config['payment']['ccform']['paymentMethodSelection'] = $this->getPaymentMethodSelection(); @@ -337,6 +347,8 @@ public function getConfig() //Pay By Link $config['payment']['ccform']['isPayByLinkEnable'] = $this->worldpayHelper->isPayByLinkEnable(); $config['payment']['ccform']['payByLinkButtonName'] = $this->worldpayHelper->getPayByLinkButtonName(); + // EFTPOS + $config['payment']['ccform']['isEnabledEFTPOS'] = $this->worldpayHelper->isEnabledEFTPOS(); } } return $config; @@ -353,6 +365,7 @@ public function getSaveCardList() if ($isSavedCardEnabled && ($this->customerSession->isLoggedIn() || $this->backendAuthSession->isLoggedIn())) { $savedCardsList = $this->savedTokenFactory->create()->getCollection() ->addFieldToFilter('customer_id', $this->customerSession->getCustomerId()) + ->addFieldToFilter('store_id', $this->storeManager->getStore()->getId()) ->addFieldToFilter('token_type', $tokenType) ->addFieldToFilter('method', ['neq' => 'SEPA_DIRECT_DEBIT-SSL'])->getData(); } @@ -544,9 +557,10 @@ public function getSaveCardListForAdminOrder($customer) if ($this->customerSession->isLoggedIn() || $this->backendAuthSession->isLoggedIn()) { $savedCardsList = $this->savedTokenFactory->create()->getCollection() ->addFieldToFilter('customer_id', $customer) + ->addFieldToFilter('store_id', $this->storeManager->getStore()->getId()) ->addFieldToFilter('token_type', $tokenType)->getData(); } - return $savedCardsList; + return $savedCardsList; } /** @@ -812,6 +826,7 @@ public function getSaveCardListForMyAccount() if ($this->customerSession->isLoggedIn() || $this->backendAuthSession->isLoggedIn()) { $savedCardsList = $this->savedTokenFactory->create()->getCollection() ->addFieldToFilter('customer_id', $this->customerSession->getCustomerId()) + ->addFieldToFilter('store_id', $this->storeManager->getStore()->getId()) ->addFieldToFilter('token_type', $tokenType)->getData(); } return $savedCardsList; diff --git a/Model/Worldpayment.php b/Model/Worldpayment.php index 4ec83cfe..4c90033f 100644 --- a/Model/Worldpayment.php +++ b/Model/Worldpayment.php @@ -4,11 +4,40 @@ */ namespace Sapient\Worldpay\Model; +use Sapient\Worldpay\Model\ResourceModel\Worldpayment\CollectionFactory; + /** * Resource Model */ class Worldpayment extends \Magento\Framework\Model\AbstractModel { + /** + * @var \Sapient\Worldpay\Model\ResourceModel\SubscriptionOrder + */ + private $sentforAuthOrderCollection; + + /** + * Constructor + * + * @param \Magento\Framework\Model\Context $context + * @param \Magento\Framework\Registry $registry + * @param CollectionFactory $sentforAuthOrderCollection + * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource + * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Framework\Model\Context $context, + \Magento\Framework\Registry $registry, + CollectionFactory $sentforAuthOrderCollection, + \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, + \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, + array $data = [] + ) { + parent::__construct($context, $registry, $resource, $resourceCollection, $data); + $this->sentforAuthOrderCollection = $sentforAuthOrderCollection; + } + /** * Initialize resource model * @@ -49,4 +78,23 @@ public function loadByWorldpayOrderId($order_id) $id = $this->getResource()->loadByWorldpayOrderId($order_id); return $this->load($id); } + + /** + * Load skip order + * + * @param string $subscriptionId + * @param string $timeFilterby + * + * @return \Sapient\Worldpay\Model\Worldpayment + */ + public function getsentforAuthOrderCollection() + { + $this->sentforAuthOrderCollection = $this->sentforAuthOrderCollection->create(); + $this->sentforAuthOrderCollection + ->addFieldToFilter('payment_status', ['eq'=> 'SENT_FOR_AUTHORISATION']) + //->addFieldToFilter('payment_model', ['eq'=> 'redirect']) + ->addOrder('id', \Magento\Framework\Data\Collection::SORT_ORDER_DESC); + + return $this->sentforAuthOrderCollection; + } } diff --git a/Model/XmlBuilder/ApplePayOrder.php b/Model/XmlBuilder/ApplePayOrder.php index 0c7f1e61..490f9b4d 100644 --- a/Model/XmlBuilder/ApplePayOrder.php +++ b/Model/XmlBuilder/ApplePayOrder.php @@ -83,6 +83,10 @@ class ApplePayOrder * @var string */ private $transactionId; + /** + * @var array + */ + protected $browserFields; /** * Build xml for processing Request @@ -103,6 +107,8 @@ class ApplePayOrder * @param string $transactionId * @param string|array|float $exponent * @param string $captureDelay + * @param array $browserFields + * * @return SimpleXMLElement $xml */ public function build( @@ -121,7 +127,8 @@ public function build( $publicKeyHash, $transactionId, $exponent, - $captureDelay + $captureDelay, + $browserFields ) { $this->merchantCode = $merchantCode; $this->orderCode = $orderCode; @@ -139,6 +146,7 @@ public function build( $this->transactionId = $transactionId; $this->exponent = $exponent; $this->captureDelay = $captureDelay; + $this->browserFields = $browserFields; $xml = new \SimpleXMLElement(self::ROOT_ELEMENT); $xml['merchantCode'] = $this->merchantCode; $xml['version'] = '1.4'; @@ -249,6 +257,12 @@ private function _addShopperElement($order) $shopper = $order->addChild('shopper'); $shopper->addChild('shopperEmailAddress', $this->shopperEmail); + + $browser = $shopper->addChild('browser'); + $browserFields = $this->browserFields; + $browser->addChild('browserColourDepth', $browserFields['browserColourDepth']); + $browser->addChild('browserScreenHeight', $browserFields['browserScreenHeight']); + $browser->addChild('browserScreenWidth', $browserFields['browserScreenWidth']); } /** diff --git a/Model/XmlBuilder/ChromePayOrder.php b/Model/XmlBuilder/ChromePayOrder.php index 145c06e3..ad806a2e 100644 --- a/Model/XmlBuilder/ChromePayOrder.php +++ b/Model/XmlBuilder/ChromePayOrder.php @@ -92,6 +92,16 @@ class ChromePayOrder * @var string $captureDelay */ protected $captureDelay; + + /** + * @var array $browserFields + */ + protected $browserFields; + + /** + * @var string $telephoneNumber + */ + protected $telephoneNumber; /** * Build xml for processing Request @@ -109,6 +119,9 @@ class ChromePayOrder * @param string $shopperEmail * @param array|string $exponent * @param string $captureDelay + * @param array $browserFields + * @param string $telephoneNumber + * * @return SimpleXMLElement $xml */ public function build( @@ -128,7 +141,9 @@ public function build( //$shopperId, $shopperEmail, $exponent, - $captureDelay + $captureDelay, + $browserFields, + $telephoneNumber ) { $this->merchantCode = $merchantCode; $this->orderCode = $orderCode; @@ -147,6 +162,9 @@ public function build( //$this->acceptHeader = $acceptHeader; //$this->userAgentHeader = $userAgentHeader; + $this->telephoneNumber = $telephoneNumber; + $this->browserFields = $browserFields; + $xml = new \SimpleXMLElement(self::ROOT_ELEMENT); $xml['merchantCode'] = $this->merchantCode; $xml['version'] = '1.4'; @@ -348,18 +366,13 @@ protected function _addPaymentTypeElement($paymentDetailsElement) protected function _addShopperElement($order) { $shopper = $order->addChild(self::TOKEN_SCOPE); - $shopper->addChild('shopperEmailAddress', $this->shopperEmail); - //$shopper->addChild('authenticatedShopperID', $this->paymentDetails['customerId']); - $browser = $shopper->addChild('browser'); - -// $acceptHeader = $browser->addChild('acceptHeader'); -// $this->_addCDATA($acceptHeader, $this->acceptHeader); -// -// $userAgentHeader = $browser->addChild('userAgentHeader'); -// $this->_addCDATA($userAgentHeader, $this->userAgentHeader); + // $acceptHeader = $browser->addChild('acceptHeader'); + // $this->_addCDATA($acceptHeader, $this->acceptHeader); + // $userAgentHeader = $browser->addChild('userAgentHeader'); + // $this->_addCDATA($userAgentHeader, $this->userAgentHeader); return $shopper; } diff --git a/Model/XmlBuilder/DirectIdealOrder.php b/Model/XmlBuilder/DirectIdealOrder.php index e4f37276..519da507 100644 --- a/Model/XmlBuilder/DirectIdealOrder.php +++ b/Model/XmlBuilder/DirectIdealOrder.php @@ -346,7 +346,7 @@ private function _addPaymentDetailsElement($order) { $paymentdetails = $order->addChild('paymentDetails'); $paymenttype = $paymentdetails->addChild($this->paymentType); - $paymenttype['shopperBankCode'] = $this->bankcode; + // $paymenttype['shopperBankCode'] = $this->bankcode; $paymenttype->addChild('successURL', $this->callbackurl['successURL']); $paymenttype->addChild('failureURL', $this->callbackurl['failureURL']); $paymenttype->addChild('cancelURL', $this->callbackurl['cancelURL']); diff --git a/Model/XmlBuilder/DirectOrder.php b/Model/XmlBuilder/DirectOrder.php index bef39f66..ddc91fb7 100644 --- a/Model/XmlBuilder/DirectOrder.php +++ b/Model/XmlBuilder/DirectOrder.php @@ -150,6 +150,17 @@ class DirectOrder * @var \Magento\Customer\Model\Session */ protected $customerSession; + + /** + * @var array $browserFields + */ + protected $browserFields; + + /** + * @var string $telephoneNumber + */ + protected $telephoneNumber; + /** * Constructor * @param \Magento\Customer\Model\Session $customerSession @@ -197,6 +208,8 @@ public function __construct( * @param mixed $primeRoutingData * @param array $orderLineItems * @param string $captureDelay + * @param array $browserFields + * @param string $telephoneNumber * @return SimpleXMLElement $xml */ public function build( @@ -224,7 +237,9 @@ public function build( $exponent, $primeRoutingData, $orderLineItems, - $captureDelay + $captureDelay, + $browserFields, + $telephoneNumber ) { $this->merchantCode = $merchantCode; @@ -252,7 +267,8 @@ public function build( $this->primeRoutingData =$primeRoutingData; $this->orderLineItems = $orderLineItems; $this->captureDelay = $captureDelay; - + $this->telephoneNumber = $telephoneNumber; + $this->browserFields = $browserFields; $xml = new \SimpleXMLElement(self::ROOT_ELEMENT); $xml['merchantCode'] = $this->merchantCode; $xml['version'] = '1.4'; @@ -461,13 +477,19 @@ private function _addDynamic3DSElement($order) { $isRecurringOrder = isset($this->paymentDetails['isRecurringOrder'])? true : false; if ($this->paymentDetails['dynamicInteractionType'] == 'MOTO') { + + if ($this->paymentDetails['isEnabledEFTPOS']) { + return; + } $threeDSElement = $order->addChild('dynamic3DS'); $threeDSElement['overrideAdvice'] = self::DYNAMIC3DS_NO3DS; } if (! $this->threeDSecureConfig->isDynamic3DEnabled()) { return; } - + if ($this->paymentDetails['isEnabledEFTPOS']) { + return; + } $threeDSElement = $order->addChild('dynamic3DS'); if ($this->threeDSecureConfig->is3DSecureCheckEnabled() && $this->paymentDetails['dynamicInteractionType'] !== 'MOTO' @@ -556,7 +578,9 @@ protected function _addPaymentDetailsForCreditCardOrder($paymentDetailsElement) $this->cardAddress['street'], $this->cardAddress['postalCode'], $this->cardAddress['city'], - $this->cardAddress['countryCode'] + $this->cardAddress['countryCode'], + true, + $this->telephoneNumber ); } @@ -586,10 +610,19 @@ protected function _addPaymentDetailsElement($order) if ($this->saveCardEnabled && $this->storedCredentialsEnabled) { $this->_addStoredCredentials($paymentDetailsElement); } - $session = $paymentDetailsElement->addChild('session'); - $session['id'] = $this->paymentDetails['sessionId']; - $session['shopperIPAddress'] = $this->paymentDetails['shopperIpAddress']; - + $isSendIpAddress = true; + if (isset($this->paymentDetails['sendShopperIpAddress'])) { + $isSendIpAddress = $this->paymentDetails['sendShopperIpAddress']; + } + if ($isSendIpAddress) { + $session = $paymentDetailsElement->addChild('session'); + $session['id'] = $this->paymentDetails['sessionId']; + $session['shopperIPAddress'] = $this->paymentDetails['shopperIpAddress']; + } + if (!empty($this->paymentDetails['routingMID'])) { + $paymentDetailsElement + ->addChild('routingMID', $this->paymentDetails['routingMID']); + } if ($this->paResponse) { $info3DSecure = $paymentDetailsElement->addChild('info3DSecure'); $info3DSecure->addChild('paResponse', $this->paResponse); @@ -623,7 +656,8 @@ protected function _addPaymentTypeElement($paymentDetailsElement) $expiryDate = $paymentTypeElement->addChild('expiryDate'); $date = $expiryDate->addChild('date'); - $date['month'] = $this->paymentDetails['expiryMonth']; + $expiryMonth = $this->formatExpiryMonth($this->paymentDetails['expiryMonth']); + $date['month'] = $expiryMonth; $date['year'] = $this->paymentDetails['expiryYear']; $paymentTypeElement->addChild('cardHolderName', $this->paymentDetails['cardHolderName']); @@ -634,6 +668,18 @@ protected function _addPaymentTypeElement($paymentDetailsElement) return $paymentTypeElement; } + /** + * Format Expiry Month + * + * @param string $inputMonth + * @return string + */ + protected function formatExpiryMonth($inputMonth) + { + $month = (int) $inputMonth; + $formattedMonth = sprintf('%02d', $month); + return $formattedMonth; + } /** * Add shopper and its child tag to xml @@ -661,6 +707,11 @@ protected function _addShopperElement($order) $userAgentHeader = $browser->addChild('userAgentHeader'); $this->_addCDATA($userAgentHeader, $this->userAgentHeader); + $browserFields = $this->browserFields; + $browser->addChild('browserColourDepth', $browserFields['browser_colorDepth']); + $browser->addChild('browserScreenHeight', $browserFields['browser_screenHeight']); + $browser->addChild('browserScreenWidth', $browserFields['browser_screenWidth']); + return $shopper; } @@ -679,7 +730,9 @@ private function _addShippingElement($order) $this->shippingAddress['street'], $this->shippingAddress['postalCode'], $this->shippingAddress['city'], - $this->shippingAddress['countryCode'] + $this->shippingAddress['countryCode'], + false, + $this->telephoneNumber ); } @@ -698,7 +751,9 @@ private function _addBillingElement($order) $this->billingAddress['street'], $this->billingAddress['postalCode'], $this->billingAddress['city'], - $this->billingAddress['countryCode'] + $this->billingAddress['countryCode'], + false, + $this->telephoneNumber ); } @@ -712,6 +767,8 @@ private function _addBillingElement($order) * @param string $postalCode * @param string $city * @param string $countryCode + * @param string $cardflag + * @param string $telephoneNumber */ private function _addAddressElement( $parentElement, @@ -720,7 +777,9 @@ private function _addAddressElement( $street, $postalCode, $city, - $countryCode + $countryCode, + $cardflag, + $telephoneNumber = "" ) { $address = $parentElement->addChild('address'); @@ -730,8 +789,13 @@ private function _addAddressElement( $lastNameElement = $address->addChild('lastName'); $this->_addCDATA($lastNameElement, $lastName); - $streetElement = $address->addChild('street'); - $this->_addCDATA($streetElement, $street); + if ($cardflag) { + $address1Element = $address->addChild('address1'); + $this->_addCDATA($address1Element, substr($street, 0, 50)); + } else { + $streetElement = $address->addChild('street'); + $this->_addCDATA($streetElement, $street); + } $postalCodeElement = $address->addChild('postalCode'); //Zip code mandatory for worldpay, if not provided by customer we will pass manually @@ -747,6 +811,9 @@ private function _addAddressElement( $countryCodeElement = $address->addChild('countryCode'); $this->_addCDATA($countryCodeElement, $countryCode); + if (!empty($telephoneNumber)) { + $address->addChild('telephoneNumber', $telephoneNumber); + } } /** @@ -881,6 +948,9 @@ protected function _addRiskData($order) */ protected function _addAdditional3DsElement($order) { + if ($this->paymentDetails['isEnabledEFTPOS']) { + return; + } $dfReferenceId = isset($this->paymentDetails['dfReferenceId']) ? $this->paymentDetails['dfReferenceId'] : ''; if ($dfReferenceId) { $addisional3DsElement = $order->addChild('additional3DSData'); @@ -1041,7 +1111,9 @@ private function _addFraudSightData($order) $this->billingAddress['street'], $this->billingAddress['postalCode'], $this->billingAddress['city'], - $this->billingAddress['countryCode'] + $this->billingAddress['countryCode'], + false, + $this->telephoneNumber ); } diff --git a/Model/XmlBuilder/RedirectKlarnaOrder.php b/Model/XmlBuilder/RedirectKlarnaOrder.php index edb15a30..ff766d91 100644 --- a/Model/XmlBuilder/RedirectKlarnaOrder.php +++ b/Model/XmlBuilder/RedirectKlarnaOrder.php @@ -103,6 +103,22 @@ class RedirectKlarnaOrder * @var array */ private $orderlineitems; + /** + * @var bool $isEnabledStorePickup + */ + private $isEnabledStorePickup; + /** + * @var bool $isStorePickup + */ + private $isStorePickup; + /** + * @var string $storePickUpMethod + */ + private $storePickUpMethod; + /** + * @var string $storepickUpType + */ + private $storepickUpType; /** * RedirectKlarnaOrder constructor @@ -137,6 +153,10 @@ public function __construct() * @param string $sessionData * @param array|string $orderContent * @param string $captureDelay + * @param bool $isStorePickup + * @param string $isEnabledStorePickup + * @param string $storePickUpMethod + * @param string $storepickUpType * @return SimpleXMLElement $xml */ public function build( @@ -159,7 +179,11 @@ public function build( $exponent, $sessionData, $orderContent, - $captureDelay + $captureDelay, + $isStorePickup, + $isEnabledStorePickup, + $storePickUpMethod, + $storepickUpType ) { $this->merchantCode = $merchantCode; $this->orderCode = $orderCode; @@ -181,6 +205,10 @@ public function build( $this->sessionData = $sessionData; $this->orderContent = $orderContent; $this->captureDelay = $captureDelay; + $this->isStorePickup = $isStorePickup; + $this->isEnabledStorePickup = $isEnabledStorePickup; + $this->storePickUpMethod = $storePickUpMethod; + $this->storepickUpType = $storepickUpType; $xml = new \SimpleXMLElement(self::ROOT_ELEMENT); $xml['merchantCode'] = $this->merchantCode; $xml['version'] = '1.4'; @@ -233,8 +261,14 @@ private function _addOrderElement($submit) $this->_addOrderContentElement($order); $this->_addPaymentMethodMaskElement($order); $this->_addShopperElement($order); - $this->_addShippingElement($order); + if (!$this->isStorePickup) { + $this->_addShippingElement($order); + } $this->_addBillingElement($order); + if ($this->isEnabledStorePickup && $this->isStorePickup) { + $this->_addExtendedOrderDetails($order); + } + if (!empty($this->statementNarrative)) { $this->_addStatementNarrativeElement($order); } @@ -691,4 +725,24 @@ public function _getTime($date, $today) $date['minute'] = $today->format('i'); $date['second'] = $today->format('s'); } + + /** + * Add Extended Order Details + * + * @param string $parentElement + */ + private function _addExtendedOrderDetails($parentElement) + { + $extendedOrderDetail = $parentElement->addChild('extendedOrderDetail'); + $alternateAddress = $extendedOrderDetail->addChild('alternativeShippingAddress'); + $shippingSummary = $alternateAddress->addChild('shippingSummary'); + $shippingSummary['shippingMethod'] = $this->storePickUpMethod; + ; + $shippingSummary['shippingType'] = $this->storepickUpType; + $address = $alternateAddress->addChild('address'); + $address->addChild('address1', $this->shippingAddress['address1']); + $address->addChild('postalCode', $this->shippingAddress['postalCode']); + $address->addChild('city', $this->shippingAddress['city']); + $address->addChild('countryCode', $this->shippingAddress['countryCode']); + } } diff --git a/Model/XmlBuilder/SamsungPayOrder.php b/Model/XmlBuilder/SamsungPayOrder.php index 57d4d48d..f7596623 100644 --- a/Model/XmlBuilder/SamsungPayOrder.php +++ b/Model/XmlBuilder/SamsungPayOrder.php @@ -61,6 +61,19 @@ class SamsungPayOrder * @var array */ private $data; + /** + * @var array + */ + protected $browserFields; + /** + * @var string + */ + private $shopperIpAddress; + + /** + * @var string + */ + private $sessionId; /** * Build xml for processing Request @@ -76,6 +89,9 @@ class SamsungPayOrder * @param array $data * @param mixed $exponent * @param string $captureDelay + * @param array $browserFields + * @param string $shopperIpAddress + * @param string $sessionId * @return SimpleXMLElement $xml */ public function build( @@ -89,7 +105,10 @@ public function build( $shopperEmail, $data, $exponent, - $captureDelay + $captureDelay, + $browserFields, + $shopperIpAddress, + $sessionId ) { $this->merchantCode = $merchantCode; $this->orderCode = $orderCode; @@ -102,6 +121,10 @@ public function build( $this->data = $data; $this->exponent = $exponent; $this->captureDelay = $captureDelay; + $this->browserFields = $browserFields; + $this->shopperIpAddress = $shopperIpAddress; + $this->sessionId = $sessionId; + $xml = new \SimpleXMLElement(self::ROOT_ELEMENT); $xml['merchantCode'] = $this->merchantCode; $xml['version'] = '1.4'; @@ -192,6 +215,10 @@ private function _addPaymentDetailsElement($order) $paymentThreeDS = $paymentType->addChild('ThreeDS'); $paymentThreeDS->addChild('data', $this->data); $paymentThreeDS->addChild('version', 100); + + $session = $paymentDetails->addChild('session'); + $session['id'] = $this->sessionId; + $session['shopperIPAddress'] = $this->shopperIpAddress; } /** @@ -204,6 +231,13 @@ private function _addShopperElement($order) $shopper = $order->addChild('shopper'); $shopper->addChild('shopperEmailAddress', $this->shopperEmail); + + $browser = $shopper->addChild('browser'); + $browserFields = $this->browserFields; + + $browser->addChild('browserColourDepth', $browserFields['browser_colorDepth']); + $browser->addChild('browserScreenHeight', $browserFields['browser_screenWidth']); + $browser->addChild('browserScreenWidth', $browserFields['browser_screenHeight']); } /** diff --git a/Model/XmlBuilder/WalletOrder.php b/Model/XmlBuilder/WalletOrder.php index 6920e38b..2b340fce 100644 --- a/Model/XmlBuilder/WalletOrder.php +++ b/Model/XmlBuilder/WalletOrder.php @@ -122,9 +122,14 @@ class WalletOrder */ protected $echoData; /** - * @var string + * @var string $shopperId */ protected $shopperId; + /** + * @var array $browserFields + */ + protected $browserFields; + /** * Constructor * @@ -161,6 +166,8 @@ public function __construct(array $args = []) * @param array $paymentDetails * @param float $exponent * @param string $captureDelay + * @param array $browserFields + * * @return \SimpleXMLElement $xml */ public function build( @@ -183,7 +190,8 @@ public function build( $shopperIpAddress, $paymentDetails, $exponent, - $captureDelay + $captureDelay, + $browserFields ) { $this->merchantCode = $merchantCode; $this->orderCode = $orderCode; @@ -205,6 +213,7 @@ public function build( $this->paymentDetails = $paymentDetails; $this->exponent = $exponent; $this->captureDelay = $captureDelay; + $this->browserFields = $browserFields; $xml = new \SimpleXMLElement(self::ROOT_ELEMENT); $xml['merchantCode'] = $this->merchantCode; $xml['version'] = '1.4'; @@ -520,6 +529,11 @@ private function _addShopperElement($order) $userAgentHeader = $browser->addChild('userAgentHeader'); $this->_addCDATA($userAgentHeader, $this->userAgentHeader); + + $browser->addChild('browserColourDepth', $this->browserFields['browserColourDepth']); + $browser->addChild('browserScreenHeight', $this->browserFields['browserScreenHeight']); + $browser->addChild('browserScreenWidth', $this->browserFields['browserScreenWidth']); + return $shopper; } diff --git a/Observer/AddtoCartBefore.php b/Observer/AddtoCartBefore.php index 9436e2a9..632618ca 100644 --- a/Observer/AddtoCartBefore.php +++ b/Observer/AddtoCartBefore.php @@ -98,7 +98,8 @@ public function __construct( */ public function execute(\Magento\Framework\Event\Observer $observer) { - if ($this->wpHelper->isGooglePayEnableonPdp() && $this->wpHelper->isGooglePayEnable()) { + if (($this->wpHelper->isGooglePayEnableonPdp() && $this->wpHelper->isGooglePayEnable()) + || ($this->wpHelper->isApplePayEnableonPdp() && $this->wpHelper->isApplePayEnable() )) { $product = $observer->getEvent()->getProduct(); $productRequestInfo = $observer->getEvent()->getInfo(); if (!empty($productRequestInfo['existing_quote_id']) && $productRequestInfo['existing_quote_id'] !=0) { @@ -106,19 +107,19 @@ public function execute(\Magento\Framework\Event\Observer $observer) try { // get current Quote Id and make inactive // add current quote Id in session - $currentQuoteId = $productRequestInfo['existing_quote_id']; + //$currentQuoteId = $productRequestInfo['existing_quote_id']; + $currentQuoteId = $this->checkoutSession->getQuote()->getId(); $this->customerSession->setActiveQuoteId($currentQuoteId); $activeQuote = $this->quoteRepository->get($currentQuoteId); $activeQuote->setIsActive(0); $this->quoteRepository->save($activeQuote); - if ($this->customerSession->getCustomerId()) { $newQuoteID = $this->quoteManagement->createEmptyCartForCustomer( $this->customerSession->getCustomerId() ); $newQuote = $this->quoteRepository->get($newQuoteID); $this->customerCart->setQuote($newQuote); - $this->wplogger->info("Set Quote successfully"); + $this->wplogger->info("Set New Quote successfully"); } else { $newQuoteID = $this->quoteManagement->createEmptyCart(); diff --git a/Plugin/Checkout/CheckoutIndexPageRender.php b/Plugin/Checkout/CheckoutIndexPageRender.php new file mode 100644 index 00000000..80ddf7f9 --- /dev/null +++ b/Plugin/Checkout/CheckoutIndexPageRender.php @@ -0,0 +1,45 @@ +worldpayHelper = $worldpayHelper; + } + + /** + * Get the order date details + * + * @param Onepage $subject + * @param string $result + * + * @return string + */ + public function afterToHtml(\Magento\Checkout\Block\Onepage $subject, $result) + { + $isworldpayEnable = $this->worldpayHelper->isWorldPayEnable(); + if ($isworldpayEnable) { + $cssFile = ''; + return $result . $cssFile; + } else { + return $result; + } + } +} diff --git a/README.txt b/README.txt index 4e3c4701..e53a2209 100644 --- a/README.txt +++ b/README.txt @@ -1,13 +1,20 @@ Latest releases for all supported version: For Magento 2.4.7 +Worldpay Plugin version: 2.4.7-rc0724 +1. Magento 2.4.7 compatible +2. PHP 8.3 & 8.2 compatibility +3. EFTPOS Payment Worldpay Plugin version: 2.4.7-rc0224 1. Magento 2.4.7-beta2 compatible -2. PHP 8.2 & 8.1 ompatibility +2. PHP 8.2 & 8.1 compatibility 3. Scurity enhancement for Client side encryption 4. Enhanced feature Subscription & Recurring For Magento 2.4.6 +Worldpay Plugin version: 2.4.6-p50624 +1. Magento 2.4.6-p5 compatible +2. PHP 8.2 compatibility Worldpay Plugin version: 2.4.6-p30124 1. Magento 2.4.6-p3 compatible diff --git a/composer.json b/composer.json index 29b6056d..2eca1794 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "magento/module-quote": ">=100.0.0", "magento/module-vault": ">=100.0.0" }, - "version": "2.4.7-rc0224", + "version": "2.4.7-rc0724", "license":"proprietary", "autoload":{ "files":[ diff --git a/docs/Worldpay Plugin For Magento 2 Installation Guide.pdf b/docs/Worldpay Plugin For Magento 2 Installation Guide.pdf index 0f41fe02..a99efd1e 100644 Binary files a/docs/Worldpay Plugin For Magento 2 Installation Guide.pdf and b/docs/Worldpay Plugin For Magento 2 Installation Guide.pdf differ diff --git a/docs/Worldpay plugin for Magento 2 user guide.pdf b/docs/Worldpay plugin for Magento 2 user guide.pdf index 31cbeebf..959ee444 100644 Binary files a/docs/Worldpay plugin for Magento 2 user guide.pdf and b/docs/Worldpay plugin for Magento 2 user guide.pdf differ diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 020aa1cb..9b41db1c 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -507,11 +507,15 @@ For this detail, You must connect with your Worldpay contact. - + You must ensure you display the official wording to your shoppers so they can agree to be debited. This is official wording which is to be used to constitute a SEPA-compliant mandate. Without this official wording, shoppers can easily reverse the direct debit with their bank.. - + + + Magento\Config\Model\Config\Source\Yesno + According to the Worldpay guide, we recommend enabling this configuration. This feature enables statement narratives for all supported APMs. This text is included in the authorization request as part of the payload. + @@ -525,7 +529,7 @@ - Magento\Directory\Model\Config\Source\Country + Sapient\Worldpay\Model\System\Config\Backend\KlarnaAllowedCountries 1 @@ -580,7 +584,27 @@ 1 - + + + + + + Magento\Config\Model\Config\Source\Yesno + You will need to enable and configure Magento's store pickup before using this feature + + + + Sapient\Worldpay\Model\Config\Source\KlarnaShippingType + + + + Used in Klarna storepickup. It is different than Magento Shipping method + Sapient\Worldpay\Model\Config\Source\KlarnaShippingMethod + + + 1 + + @@ -1465,7 +1489,64 @@ Sets the number of days to delay capture by - + + + + + + + Magento\Config\Model\Config\Source\Yesno + If set to "Yes", Unpaid order will automatically cancel by the cron. + + + + In Hours. + + 1 + + Sapient\Worldpay\Model\Config\Source\PendingOrderCleanupOption + Sapient\Worldpay\Model\Config\CronConfig + + + + + + + + + Magento\Config\Model\Config\Source\Yesno + If set to "Yes", EFTPOS will be the default network for transactions + + + + required-entry + 1 + For this detail, You must connect with your Worldpay contact. + + + + required-entry + 1 + For this detail, You must connect with your Worldpay contact. + + + + required-entry + 1 + For this detail, You must connect with your Worldpay contact. + + + + 1 + For this detail, You must connect with your Worldpay contact. + + + + 1 + Magento\Config\Model\Config\Source\Yesno + + +
diff --git a/etc/config.xml b/etc/config.xml index a3888499..0de8fc56 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -82,6 +82,7 @@ PAYPAL-EXPRESS ONE-OFF By signing this mandate form, you authorise (A) Worldpay to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with the instructions from Worldpay. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited. Your rights are explained in a statement that you can obtain from your bank. + 1 JE-GB,IM-GB @@ -89,20 +90,24 @@ - SE,NO,FI,DE,AT,GB,DK,US,NL,CH + SE,NO,FI,DE,AT,GB,DK,UK,NL,CH KLARNA_SLICEIT - SE,NO,FI,DE,AT,GB,DK,US + SE,NO,FI,DE,AT,GB,DK,UK KLARNA_PAYLATER - SE,NO,FI,DE,NL,AT,CH,GB,DK,US + SE,NO,FI,DE,NL,AT,CH,GB,DK,UK KLARNA_PAYNOW SE,DE,NL,AT + + normal + store pick-up + 0 @@ -134,6 +139,9 @@ + + 1 + @@ -198,6 +206,9 @@ 13 0 + + 24 + diff --git a/etc/cron_groups.xml b/etc/cron_groups.xml index 7e052907..a8d1f82c 100644 --- a/etc/cron_groups.xml +++ b/etc/cron_groups.xml @@ -27,4 +27,13 @@ 600 1 + + 1 + 4 + 2 + 10 + 60 + 600 + 1 + \ No newline at end of file diff --git a/etc/crontab.xml b/etc/crontab.xml index 0071b5ef..e4735001 100644 --- a/etc/crontab.xml +++ b/etc/crontab.xml @@ -18,4 +18,10 @@ * * * * * + + + * * */1 * * + crontab/worldpay_pending_order_cleanup/jobs/pending_order_cleanup/schedule/cron_expr + + \ No newline at end of file diff --git a/etc/csp_whitelist.xml b/etc/csp_whitelist.xml index 0ca08fa0..98ea73b0 100644 --- a/etc/csp_whitelist.xml +++ b/etc/csp_whitelist.xml @@ -16,7 +16,10 @@ https://pay.google.com/gp/p/js/pay.js https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js www.google-analytics.com - https://payments.worldpay.com/resources/cse/js/worldpay-cse-1.0.2.min.js + *.payments.worldpay.com/resources/cse/js/worldpay-cse-1.0.2.min.js + https://d35p4vvdul393k.cloudfront.net/sdk_library/us/stg/ops/pc_gsmpi_web_sdk.js + https://d16i99j5zwwv51.cloudfront.net/sdk_library/us/prd/ops/pc_gsmpi_web_sdk.js + https://payments.worldpay.com/resources/hpp/integrations/embedded/js/hpp-embedded-integration-library.js diff --git a/etc/db_schema.xml b/etc/db_schema.xml index 510e2388..31d229db 100644 --- a/etc/db_schema.xml +++ b/etc/db_schema.xml @@ -86,6 +86,7 @@ + diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index efc5aa92..a1248173 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -22,6 +22,9 @@ + + + diff --git a/view/adminhtml/web/js/wp-form.js b/view/adminhtml/web/js/wp-form.js index ea88cc66..3abd4e04 100644 --- a/view/adminhtml/web/js/wp-form.js +++ b/view/adminhtml/web/js/wp-form.js @@ -1,7 +1,6 @@ define([ - "jquery", - "worldpay" -], function($, worldpay){ + "jquery" +], function($){ "use strict"; $.widget('mage.worldpayForm', { options: { @@ -43,4 +42,4 @@ define([ }); return $.mage.worldpayForm; -}); +}); \ No newline at end of file diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index 77c1b44e..515eca29 100644 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -1,10 +1,7 @@ - - - - - + + @@ -19,7 +16,7 @@ - + Sapient_Worldpay/js/view/payment/methodrenderer @@ -70,4 +67,4 @@ - \ No newline at end of file + diff --git a/view/frontend/requirejs-config.js b/view/frontend/requirejs-config.js index 24af9845..e99b23a1 100644 --- a/view/frontend/requirejs-config.js +++ b/view/frontend/requirejs-config.js @@ -45,8 +45,6 @@ var config = { googlePay: 'https://pay.google.com/gp/p/js/pay.js', applePay: 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js', samsungPay: sdkJs, - hmacSha256: 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha256.js', - encBase64: 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64-min.js', worldpayPriceSubscription: 'Sapient_Worldpay/js/price-subscription', "Magento_Checkout/template/minicart/content.html": "Sapient_Worldpay/template/minicart/content.html", "Magento_Checkout/template/payment.html": "Sapient_Worldpay/template/payment.html", diff --git a/view/frontend/templates/addnewcard.phtml b/view/frontend/templates/addnewcard.phtml index 0d68aaa5..9b72aa26 100644 --- a/view/frontend/templates/addnewcard.phtml +++ b/view/frontend/templates/addnewcard.phtml @@ -393,14 +393,27 @@ } if (event.origin === envUrl) { var data = JSON.parse(event.data); - if (data !== undefined && data.Status) { - var sessionId = data.SessionId; - if (sessionId) { - dfReferenceId = sessionId; + if (data !== undefined) { + // for cardinal + if(data.Payload){ + if(data.Payload.ActionCode =="SUCCESS"){ + var sessionId = data.Payload.SessionId; + if (sessionId) { + dfReferenceId = sessionId; + } + window.sessionId = dfReferenceId; + jQuery('[name=dfReferenceId]').val(dfReferenceId); + createPayment3DS(); + } + } else if(data.Status) { + var sessionId = data.SessionId; + if (sessionId) { + dfReferenceId = sessionId; + } + window.sessionId = dfReferenceId; + jQuery('[name=dfReferenceId]').val(dfReferenceId); + createPayment3DS(); } - window.sessionId = dfReferenceId; - jQuery('[name=dfReferenceId]').val(dfReferenceId); - createPayment3DS(); } } }, false); @@ -415,8 +428,10 @@ "expiryYear": jQuery('[name=expiryYear]').val(), "cvc": jQuery('[name=cvc]').val(), "cseEnabled": jQuery('[name=cseEnabled]').val(), - "disclaimerFlag": disclaimerFlag - + "disclaimerFlag": disclaimerFlag, + 'browser_screenheight': window.screen.height, + 'browser_screenwidth': window.screen.width, + 'browser_colordepth': window.screen.colorDepth } }; var jsonPaymentDetails = JSON.stringify(paymentDetails); @@ -465,7 +480,10 @@ "cvc": jQuery('[name=cvc]').val(), "cseEnabled": jQuery('[name=cseEnabled]').val(), "dfReferenceId": window.sessionId, - "disclaimerFlag": disclaimerFlag + "disclaimerFlag": disclaimerFlag, + 'browser_screenheight': window.screen.height, + 'browser_screenwidth': window.screen.width, + 'browser_colordepth': window.screen.colorDepth } }; var jsonPaymentDetails = JSON.stringify(paymentDetails); diff --git a/view/frontend/templates/multishipping/billing/billing.phtml b/view/frontend/templates/multishipping/billing/billing.phtml index c459dde2..5675d1e8 100644 --- a/view/frontend/templates/multishipping/billing/billing.phtml +++ b/view/frontend/templates/multishipping/billing/billing.phtml @@ -121,7 +121,10 @@ class="form multicheckout billing"> if ($code == 'worldpay_cc' || $code == 'worldpay_apm' || $code == 'worldpay_wallets') { - ?> + if ($block->getCcIntegrationMode() != 'redirect' || + $code != 'worldpay_cc') { + ?> +
@@ -143,7 +146,8 @@ class="form multicheckout billing">
- + @@ -172,7 +176,7 @@ class="form multicheckout billing"> foreach ($methods as $_method): $code = $_method->getCode(); $checked = $block->getSelectedMethodCode() === $code; - if (in_array($code, $block->getWorldpayMethodsCode())) { + if (in_array($code, $block->getWorldpayMethodsCode()) || $code =='worldpay_apm') { continue; } if (isset($methodsForms[$code])) { diff --git a/view/frontend/templates/recurring/order/skiporders.phtml b/view/frontend/templates/recurring/order/skiporders.phtml index bb2fff41..5a72596a 100644 --- a/view/frontend/templates/recurring/order/skiporders.phtml +++ b/view/frontend/templates/recurring/order/skiporders.phtml @@ -25,7 +25,7 @@
- + escapeHtml('Completed') ?> @@ -47,13 +47,13 @@
- -
-
+
-
+
- +
- - - - - -
- - - -
- - +
+ +
- + +
+ +
+
@@ -51,7 +46,7 @@

- +
@@ -81,7 +76,7 @@

-
-
- -
+
+
+ +

All transactions are secure and encrypted...

- worldpay logo - - - - + worldpay logo + + + + +
-
- - - -
-
-

-
-
- - -
+ + +
+
+

+
+
+ +
+
+
+
+ +
-
- +
+ - - - - -
- -
- - -
- -
- - -
-
+ + + + +
+ +
+ + +
+ +
- -
-
+ +
+
+ + +
+
- -
-
-
- - - -
- - - - - - - - - - - - -
- - -
- - - -
-
- -
- -
- -
-
US/UK - You need to make the payment within 30 days for the selected billing country.
-
ALL Other Eurpoe - You need to make the payment within 14 days for the selected billing country.
-
-
+ +
+
+
+ + + +
+ + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+ +
+
US/UK - You need to make the payment within 30 days for the selected billing country.
+
ALL Other Eurpoe - You need to make the payment within 14 days for the selected billing country.
+
+
-
- - +
+ + - - - -
+ +
- + -
+
-
- -
- -
+
+ +
+ +
-
+
-
- -
- -
+
+ +
+ +
-
+
-
- -
- -
+
+ +
+ +
-
+
-
-
-
+
+ -
+ + + + + + +
- + -
+
- - -
- -
- -
-
- Purpose of transaction will reflect on your statement, - only if it is supported by the selected payment method.
-
Purpose of transaction will be validated - by the payment method before processing.
-
Please adhere to the - Statement Narrative guidelines of the selected payment method - before entering the Purpose of transaction.
-
+
+
+ +
+ +
+ +
+
+ Purpose of transaction will reflect on your statement, + only if it is supported by the selected payment method.
+
Purpose of transaction will be validated + by the payment method before processing.
+
Please adhere to the + Statement Narrative guidelines of the selected payment method + before entering the Purpose of transaction.
+
+ - -
- - -
- - + +
+ + +
+ + -
-
- +
+
+ - - - -
- - - -
-
- - - -
-
-
- -
-
-
-
\ No newline at end of file + + + +
+ + + +
+
+ + + +
+
+
+ +
+
+
+
+ \ No newline at end of file diff --git a/view/frontend/web/template/payment/cc-form.html b/view/frontend/web/template/payment/cc-form.html index c3212074..b2db154b 100644 --- a/view/frontend/web/template/payment/cc-form.html +++ b/view/frontend/web/template/payment/cc-form.html @@ -131,7 +131,7 @@ value="" data-bind="attr: { placeholder: getCheckoutLabels('CO5'), - id: getCode() + '_cc_cid', + id: getCode() + '_cc_cid_cvv', title: $t('Card Verification Number'), 'data-container': getCode() + '-cc-cvv', 'data-validate': JSON.stringify({'required-number':true, 'validate-card-cvv':'#' + getCode() + '_cc_type'})}, @@ -240,7 +240,7 @@
-
+

diff --git a/view/frontend/web/template/payment/direct-cc.html b/view/frontend/web/template/payment/direct-cc.html index 496150a9..3170f5d6 100644 --- a/view/frontend/web/template/payment/direct-cc.html +++ b/view/frontend/web/template/payment/direct-cc.html @@ -52,7 +52,7 @@
- -
-
- - - -
- - - - -
-
- -
-
- - - -
- - - - +
+
+ + + + + + + +
+ + + +
+
+ + + +
+
-
- -
-
+
+ +
+
+ + + +
+ + -

-
+ +
+
+ +
+
+ + + +
+ + + + +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/view/frontend/web/template/payment/saved-card-form.html b/view/frontend/web/template/payment/saved-card-form.html index 6a2bc775..096bdcac 100644 --- a/view/frontend/web/template/payment/saved-card-form.html +++ b/view/frontend/web/template/payment/saved-card-form.html @@ -52,7 +52,7 @@
-