We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday 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
public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject)
{
$request = $transferObject->getBody();
if(!empty($request['response'])){
if (!empty($request['response'])) {
//Initiate has already a response
return $request['response'];
}
......@@ -81,9 +81,14 @@ class TransactionPosCloudSync implements ClientInterface
$service = new \Adyen\Service\PosPayment($this->_client);
$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
$jsonStatus='{
$jsonStatus = '{
"SaleToPOIRequest": {
"MessageHeader": {
"ProtocolVersion": "3.0",
......
......@@ -104,7 +104,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
$service = new \Adyen\Service\PosPayment($this->_client);
$transactionType = \Adyen\TransactionType::NORMAL;
$poiId = $this->_adyenHelper->getPoiId();
$serviceID = date("dHis");
$serviceID = date("U");
$timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00");
$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