From ac06aa34a07df08f5c666488ec9532bd1d7276ec Mon Sep 17 00:00:00 2001 From: Nuryagdy Mustapayev Date: Tue, 16 Jan 2024 17:20:15 +0100 Subject: [PATCH] fix issue #173 --- .../PosNetResponseDataMapper.php | 9 +++++++++ .../PosNetResponseDataMapperTest.php | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/DataMapper/ResponseDataMapper/PosNetResponseDataMapper.php b/src/DataMapper/ResponseDataMapper/PosNetResponseDataMapper.php index 7cad2810..4f3d8d0d 100644 --- a/src/DataMapper/ResponseDataMapper/PosNetResponseDataMapper.php +++ b/src/DataMapper/ResponseDataMapper/PosNetResponseDataMapper.php @@ -90,6 +90,15 @@ public function map3DPaymentData(array $raw3DAuthResponseData, ?array $rawPaymen $status = self::TX_APPROVED; } + if (!isset($raw3DAuthResponseData['oosResolveMerchantDataResponse'])) { + $defaultResponse = $this->getDefaultPaymentResponse(); + $defaultResponse['proc_return_code'] = $procReturnCode; + $defaultResponse['error_code'] = $raw3DAuthResponseData['respCode']; + $defaultResponse['error_message'] = $raw3DAuthResponseData['respText']; + + return $defaultResponse; + } + /** @var array $oosResolveMerchantDataResponse */ $oosResolveMerchantDataResponse = $raw3DAuthResponseData['oosResolveMerchantDataResponse']; diff --git a/tests/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php b/tests/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php index f2f0af63..2340c249 100644 --- a/tests/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php +++ b/tests/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php @@ -268,6 +268,25 @@ public function threeDPaymentDataProvider(): array 'status_detail' => null, ], ], + 'fail_no_oosResolveMerchantDataResponse' => [ + 'threeDResponseData' => [ + 'approved' => '0', + 'respCode' => 'E216', + 'respText' => 'Mac Do\u011frulama hatal\u0131', + ], + 'paymentData' => [], + 'expectedData' => [ + 'order_id' => null, + 'trans_id' => null, + 'auth_code' => null, + 'ref_ret_num' => null, + 'proc_return_code' => '0', + 'status' => 'declined', + 'status_detail' => null, + 'error_code' => 'E216', + 'error_message' => 'Mac Do\u011frulama hatal\u0131', + ], + ], ]; }