- 30 Nov, 2018 1 commit
-
-
Rik ter Beek authored
New Release Adyen Payment 2.4.0
-
- 29 Nov, 2018 2 commits
-
-
Rik ter Beek authored
Resolve PR comments
-
attilak authored
- Pass api key to initializeClient function isntead of setting the key directly
-
- 27 Nov, 2018 1 commit
-
-
Rik ter Beek authored
-
- 26 Nov, 2018 1 commit
-
-
Alessio Zampatti authored
-
- 22 Nov, 2018 1 commit
-
-
Alessio Zampatti authored
-
- 16 Nov, 2018 5 commits
-
-
Giorgos Adam authored
Disabling POS Cloud for backend orders
-
Rik ter Beek authored
PW-560: Merge Cloud API branch
-
Giorgos Adam authored
Accepting notifications for multiple merchant accounts
-
cyattilakiss authored
Resolve comments during code review
-
attilak authored
-
- 15 Nov, 2018 1 commit
-
-
attilak authored
-
- 13 Nov, 2018 1 commit
-
-
Alessio Zampatti authored
* removed customerCollectionFactory * do not expose storemanager, storeid mandatory for getAdyenMerchantAccount * phpdoc fix
-
- 12 Nov, 2018 7 commits
-
-
Alessio Zampatti authored
Re-merging "PW-615"
-
Aleffio authored
-
Aleffio authored
Remove customer prefix, re-add 1 minute delay on notifications, re-add store_id on query Billing Agreements
-
cyattilakiss authored
Co-Authored-By: Aleffio <gigendh@gmail.com>
-
Aleffio authored
-
Aleffio authored
-
stkams authored
* customer reference prefix * added java doc; made customer_reference_prefix only available in default * workaround for adyen notification processing delay * updated the module version to that of master * Allow to retrieve api key for a specified store
-
- 09 Nov, 2018 20 commits
-
-
Aleffio authored
-
Aleffio authored
-
Rik ter Beek authored
-
Aleffio authored
PW-560: changed JSON status request to array, added new total_timeout value in config, reverted serviceID to previous dateformat
-
Aleffio authored
-
Aleffio authored
-
Aleffio authored
-
Aleffio authored
-
Aleffio authored
-
Aleffio authored
-
Rik ter Beek authored
-
Rik ter Beek authored
-
Rik ter Beek authored
-
Rik ter Beek authored
-
Rik ter Beek authored
-
Rik ter Beek authored
diff --git a/Model/AdyenInitiateTerminalApi.php b/Model/AdyenInitiateTerminalApi.php index 464ae2e..a21c9c9 100644 --- a/Model/AdyenInitiateTerminalApi.php +++ b/Model/AdyenInitiateTerminalApi.php @@ -22,11 +22,14 @@ * Author: Adyen <magento@adyen.com> */ + namespace Adyen\Payment\Model; + use Adyen\Payment\Api\AdyenInitiateTerminalApiInterface; use Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider; use Adyen\Util\Util; +use Magento\Payment\Gateway\Http\ClientInterface; class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface { @@ -90,9 +93,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface /** * Trigger sync call on terminal - * * @return mixed - * @throws \Magento\Framework\Exception\LocalizedException */ public function initiate() { @@ -106,69 +107,71 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface $poiId = $this->_adyenHelper->getPoiId(); $serviceID = date("dHis"); $timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00"); + + // if custom is logged in send data accross $customerId = $quote->getCustomerId(); - $request = [ - 'SaleToPOIRequest' => - [ - 'MessageHeader' => - [ - 'MessageType' => 'Request', - 'MessageClass' => 'Service', - 'MessageCategory' => 'Payment', - 'SaleID' => 'Magento2Cloud', - 'POIID' => $poiId, - 'ProtocolVersion' => '3.0', - 'ServiceID' => $serviceID, - ], - 'PaymentRequest' => - [ - 'SaleData' => - [ - 'TokenRequestedType' => 'Customer', - 'SaleTransactionID' => - [ - 'TransactionID' => $reference, - 'TimeStamp' => $timeStamper, - ], - ], - 'PaymentTransaction' => - [ - 'AmountsReq' => - [ - 'Currency' => $quote->getCurrency()->getQuoteCurrencyCode(), - 'RequestedAmount' => $quote->getGrandTotal(), - ], - ], - 'PaymentData' => - [ - 'PaymentType' => $transactionType, - ], - ], - ], - ]; - - // If customer exists add it into the request to store request + + $newStructureValue = ""; +// $oldValueStructure = ""; if (!empty($customerId)) { $shopperEmail = $quote->getCustomerEmail(); $recurringContract = $this->_adyenHelper->getAdyenPosCloudConfigData('recurring_type'); - if (!empty($recurringContract)) { - $jsonValue = '{ + $jsonValue = '{ "shopperEmail": "' . $shopperEmail . '", "shopperReference": "' . $customerId . '", "recurringContract": "' . $recurringContract . '" }'; - $request['SaleToPOIRequest']['PaymentRequest']['SaleData']['SaleToAcquirerData'] = base64_encode($jsonValue); - } + $jsonValueBase64 = base64_encode($jsonValue); + + $newStructureValue = '"SaleToAcquirerData":"' . $jsonValueBase64 . '",'; +// $oldValueStructure = '"SaleToAcquirerData":"shopperEmail=' . $shopperEmail . '&shopperReference=' . $customerId . '&recurringContract=' . $recurringContract . '",'; } + $json = '{ + "SaleToPOIRequest": { + "MessageHeader": { + "MessageType": "Request", + "MessageClass": "Service", + "MessageCategory": "Payment", + "SaleID": "Magento2Cloud", + "POIID": "' . $poiId . '", + "ProtocolVersion": "3.0", + "ServiceID": "' . $serviceID . '" + }, + "PaymentRequest": { + "SaleData": { + ' . $newStructureValue . ' + "TokenRequestedType":"Customer", + "SaleTransactionID": { + "TransactionID": "' . $reference . '", + "TimeStamp": "' . $timeStamper . '" + }, + "TokenRequestedType": "Customer" + }, + "PaymentTransaction": { + "AmountsReq": { + "Currency": "' . $quote->getCurrency()->getQuoteCurrencyCode() . '", + "RequestedAmount": ' . $quote->getGrandTotal() . ' + } + }, + "PaymentData": { + "PaymentType": "' . $transactionType . '" + } + } + } + } + '; + + $params = json_decode($json, true); //Create associative array for passing along + $quote->getPayment()->getMethodInstance()->getInfoInstance()->setAdditionalInformation('serviceID', $serviceID); try { - $response = $service->runTenderSync($request); + $response = $service->runTenderSync($params); } catch (\Adyen\AdyenException $e) { //Not able to perform a payment $this->_adyenLogger->addAdyenDebug("adyenexception");
-
Rik ter Beek authored
-
Rik ter Beek authored
-
Rik ter Beek authored
-
Alessio Zampatti authored
* PW-503: Parse Payment receipt from TerminalAPI PaymentResponse * PW-503: call formatTerminalAPIReceipt from the validator * PW-503: removed redundant html tags, added custom table class * PW-503: removed redundant table, refactor, added nbsp if empty
-