Skip to content

Commit

Permalink
Merge pull request #143 from Worldpay/release-v2.4.7-rc0724
Browse files Browse the repository at this point in the history
Release v2.4.7 rc0724
  • Loading branch information
chandan-PS authored Aug 12, 2024
2 parents ee3679b + de4175a commit 5564c0f
Show file tree
Hide file tree
Showing 86 changed files with 2,899 additions and 1,053 deletions.
5 changes: 5 additions & 0 deletions Block/Adminhtml/Order/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
37 changes: 32 additions & 5 deletions Block/Checkout/Multishipping/Billing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
}
32 changes: 27 additions & 5 deletions Block/Savedcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class Savedcard extends \Magento\Framework\View\Element\Template
* @var SerializerInterface
*/
private $serializer;

/**
* @var $storeManager
*/
protected $storeManager;
/**
* constructor
*
Expand All @@ -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(
Expand All @@ -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;
Expand All @@ -70,6 +77,7 @@ public function __construct(
$this->currentCustomerAddress = $currentCustomerAddress;
$this->_addressConfig = $addressConfig;
$this->addressMapper = $addressMapper;
$this->storeManager = $storeManager;
parent::__construct($context, $data);
}

Expand All @@ -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
*
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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();
}
}
6 changes: 6 additions & 0 deletions Controller/Button/PlaceOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,19 @@ 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)) {
$dfReferenceId = (string)$request->getParam('instant_purchase_dfreference');
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());
}
}
Expand Down
9 changes: 9 additions & 0 deletions Controller/Cartdetails/Chromepay.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
Expand Down
40 changes: 39 additions & 1 deletion Controller/Redirectresult/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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);
}
/**
Expand All @@ -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;
}
}
24 changes: 23 additions & 1 deletion Controller/Samsungpay/CallBack.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
Expand Down Expand Up @@ -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]);
}
}
18 changes: 15 additions & 3 deletions Controller/Samsungpay/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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(
Expand All @@ -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);
Expand All @@ -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;
}
/**
Expand Down Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 5564c0f

Please sign in to comment.