We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 96b6e925 authored by Aleffio's avatar Aleffio

PW-560: changed date format to U, added timeDiff to force a timeout after 120 seconds

parent 5459801d
...@@ -73,7 +73,7 @@ class TransactionPosCloudSync implements ClientInterface ...@@ -73,7 +73,7 @@ class TransactionPosCloudSync implements ClientInterface
public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject) public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject)
{ {
$request = $transferObject->getBody(); $request = $transferObject->getBody();
if(!empty($request['response'])){ if (!empty($request['response'])) {
//Initiate has already a response //Initiate has already a response
return $request['response']; return $request['response'];
} }
...@@ -81,9 +81,14 @@ class TransactionPosCloudSync implements ClientInterface ...@@ -81,9 +81,14 @@ class TransactionPosCloudSync implements ClientInterface
$service = new \Adyen\Service\PosPayment($this->_client); $service = new \Adyen\Service\PosPayment($this->_client);
$poiId = $this->_adyenHelper->getPoiId(); $poiId = $this->_adyenHelper->getPoiId();
$newServiceID = date("dHis"); $newServiceID = date("U");
$timeDiff = (int)$newServiceID - (int)$request['serviceID'];
if ($timeDiff > 120) {
throw new \Magento\Framework\Exception\LocalizedException(__("Pos Timeout."));
}
//Provide receipt to the shopper //Provide receipt to the shopper
$jsonStatus='{ $jsonStatus = '{
"SaleToPOIRequest": { "SaleToPOIRequest": {
"MessageHeader": { "MessageHeader": {
"ProtocolVersion": "3.0", "ProtocolVersion": "3.0",
......
...@@ -104,7 +104,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -104,7 +104,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
$service = new \Adyen\Service\PosPayment($this->_client); $service = new \Adyen\Service\PosPayment($this->_client);
$transactionType = \Adyen\TransactionType::NORMAL; $transactionType = \Adyen\TransactionType::NORMAL;
$poiId = $this->_adyenHelper->getPoiId(); $poiId = $this->_adyenHelper->getPoiId();
$serviceID = date("dHis"); $serviceID = date("U");
$timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00"); $timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00");
$customerId = $quote->getCustomerId(); $customerId = $quote->getCustomerId();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment