From 42955c4e54c0077891979d2189504ccd1167c6a7 Mon Sep 17 00:00:00 2001 From: mustapayev Date: Sat, 12 Oct 2024 13:24:57 +0200 Subject: [PATCH] interpos - remove ref_ret_num mapping as it is always equal to "hostid" --- .../InterPosResponseDataMapper.php | 8 ++--- .../InterPosResponseDataMapperTest.php | 30 +++++++++---------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/DataMapper/ResponseDataMapper/InterPosResponseDataMapper.php b/src/DataMapper/ResponseDataMapper/InterPosResponseDataMapper.php index 41435167..a90d942a 100644 --- a/src/DataMapper/ResponseDataMapper/InterPosResponseDataMapper.php +++ b/src/DataMapper/ResponseDataMapper/InterPosResponseDataMapper.php @@ -48,7 +48,6 @@ public function mapPaymentResponse(array $rawPaymentResponseData, string $txType $result['order_id'] = $rawPaymentResponseData['OrderId']; $result['transaction_id'] = $rawPaymentResponseData['TransId']; $result['auth_code'] = $rawPaymentResponseData['AuthCode']; - $result['ref_ret_num'] = $rawPaymentResponseData['HostRefNum']; $result['error_code'] = $rawPaymentResponseData['ErrorCode']; $result['error_message'] = $rawPaymentResponseData['ErrorMessage']; $result['currency'] = $order['currency']; @@ -118,7 +117,7 @@ public function mapRefundResponse(array $rawResponseData): array 'order_id' => $rawResponseData['OrderId'], 'group_id' => null, 'auth_code' => null, - 'ref_ret_num' => $rawResponseData['HostRefNum'], + 'ref_ret_num' => null, 'proc_return_code' => $procReturnCode, 'transaction_id' => $rawResponseData['TransId'], 'error_code' => $rawResponseData['ErrorCode'], @@ -145,7 +144,7 @@ public function mapCancelResponse($rawResponseData): array 'order_id' => $rawResponseData['OrderId'], 'group_id' => null, 'auth_code' => $rawResponseData['AuthCode'], - 'ref_ret_num' => $rawResponseData['HostRefNum'], + 'ref_ret_num' => null, 'proc_return_code' => $procReturnCode, 'transaction_id' => $rawResponseData['TransId'], 'error_code' => $rawResponseData['ErrorCode'], @@ -180,7 +179,6 @@ public function mapStatusResponse(array $rawResponseData): array $defaultResponse['refund_amount'] = $rawResponseData['RefundedAmount'] > 0 ? $this->formatAmount($rawResponseData['RefundedAmount']) : null; // todo success cevap ornegi bulundugunda guncellenecek: - $defaultResponse['ref_ret_num'] = null; $defaultResponse['order_status'] = null; $defaultResponse['capture_amount'] = null; $defaultResponse['capture'] = null; @@ -309,7 +307,6 @@ private function map3DPaymentResponse(?array $rawPaymentResponseData, string $tx $result['order_id'] = $rawPaymentResponseData['OrderId']; $result['transaction_id'] = $rawPaymentResponseData['TransId']; $result['auth_code'] = $rawPaymentResponseData['AuthCode']; - $result['ref_ret_num'] = $rawPaymentResponseData['HostRefNum']; $result['error_code'] = $rawPaymentResponseData['ErrorCode']; $result['error_message'] = $rawPaymentResponseData['ErrorMessage']; $result['all'] = $rawPaymentResponseData; @@ -353,7 +350,6 @@ private function map3DCommonResponseData(array $raw3DAuthResponseData, ?array $r $threeDResponse = [ 'order_id' => $paymentResponseData['order_id'] ?? $raw3DAuthResponseData['OrderId'], 'proc_return_code' => $paymentResponseData['proc_return_code'] ?? $procReturnCode, - 'ref_ret_num' => $paymentResponseData['ref_ret_num'] ?? $raw3DAuthResponseData['HostRefNum'], 'transaction_security' => null === $mdStatus ? null : $this->mapResponseTransactionSecurity($mdStatus), 'payment_model' => $paymentModel, 'md_status' => $mdStatus, diff --git a/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php index 5516cf02..5eb608de 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php @@ -233,7 +233,7 @@ public static function paymentTestDataProvider(): array 'responseData' => [ 'OrderId' => '20221225662C', 'ProcReturnCode' => '81', - 'HostRefNum' => 'hostid', + 'HostRefNum' => null, 'AuthCode' => '', 'TxnResult' => 'Failed', 'ErrorMessage' => 'Terminal Aktif Degil', @@ -266,7 +266,7 @@ public static function paymentTestDataProvider(): array 'amount' => 1.01, 'payment_model' => 'regular', 'auth_code' => null, - 'ref_ret_num' => 'hostid', + 'ref_ret_num' => null, 'batch_num' => null, 'proc_return_code' => '81', 'status' => 'declined', @@ -340,7 +340,7 @@ public static function threeDPaymentDataProvider(): array 'FailUrl' => 'http:\/\/localhost\/interpos\/3d\/response.php', '3DStatus' => '0', 'AuthCode' => null, - 'HostRefNum' => 'hostid', + 'HostRefNum' => null, 'TransId' => null, 'TRXDATE' => null, 'CardHolderName' => null, @@ -359,7 +359,7 @@ public static function threeDPaymentDataProvider(): array 'order_id' => '20221225E1DF', 'transaction_id' => null, 'auth_code' => null, - 'ref_ret_num' => 'hostid', + 'ref_ret_num' => null, 'batch_num' => null, 'proc_return_code' => '81', 'status' => 'declined', @@ -413,7 +413,7 @@ public static function threeDPaymentDataProvider(): array 'FailUrl' => 'gizlendi', '3DStatus' => '1', 'AuthCode' => '', - 'HostRefNum' => 'hostid', + 'HostRefNum' => null, 'TransId' => '', 'TRXDATE' => '', 'CardHolderName' => '', @@ -430,7 +430,7 @@ public static function threeDPaymentDataProvider(): array 'paymentData' => [ 'OrderId' => '33554969', 'ProcReturnCode' => '00', - 'HostRefNum' => 'hostid', + 'HostRefNum' => null, 'AuthCode' => 'auth-code-123', 'TxnResult' => 'Success', 'ErrorMessage' => '', @@ -471,7 +471,7 @@ public static function threeDPaymentDataProvider(): array 'order_id' => '33554969', 'transaction_id' => 'trans-id-123', 'auth_code' => 'auth-code-123', - 'ref_ret_num' => 'hostid', + 'ref_ret_num' => null, 'batch_num' => null, 'proc_return_code' => '00', 'status' => 'approved', @@ -532,7 +532,7 @@ public static function threeDPayPaymentDataProvider(): array 'FailUrl' => 'http:\/\/localhost\/interpos\/3d-pay\/response.php', '3DStatus' => '0', 'AuthCode' => '', - 'HostRefNum' => 'hostid', + 'HostRefNum' => null, 'TransId' => '', 'TRXDATE' => '', 'CardHolderName' => '', @@ -550,7 +550,7 @@ public static function threeDPayPaymentDataProvider(): array 'order_id' => '20221225B83B', 'transaction_id' => null, 'auth_code' => null, - 'ref_ret_num' => 'hostid', + 'ref_ret_num' => null, 'batch_num' => null, 'proc_return_code' => '81', 'status' => 'declined', @@ -611,7 +611,7 @@ public static function threeDHostPaymentDataProvider(): array 'FailUrl' => 'http:\/\/localhost\/interpos\/3d-host\/response.php', '3DStatus' => '0', 'AuthCode' => '', - 'HostRefNum' => 'hostid', + 'HostRefNum' => null, 'TransId' => '', 'TRXDATE' => '', 'CardHolderName' => '', @@ -631,7 +631,7 @@ public static function threeDHostPaymentDataProvider(): array 'order_id' => '202212256D26', 'transaction_id' => null, 'auth_code' => null, - 'ref_ret_num' => 'hostid', + 'ref_ret_num' => null, 'batch_num' => null, 'proc_return_code' => '81', 'status' => 'declined', @@ -714,7 +714,7 @@ public static function cancelTestDataProvider(): array 'responseData' => [ 'OrderId' => 'SYSOID121330755', 'ProcReturnCode' => '81', - 'HostRefNum' => 'hostid', + 'HostRefNum' => null, 'AuthCode' => '', 'TxnResult' => 'Failed', 'ErrorMessage' => 'Terminal Aktif Degil', @@ -743,7 +743,7 @@ public static function cancelTestDataProvider(): array 'order_id' => 'SYSOID121330755', 'group_id' => null, 'auth_code' => null, - 'ref_ret_num' => 'hostid', + 'ref_ret_num' => null, 'proc_return_code' => '81', 'transaction_id' => null, 'error_code' => 'B810002', @@ -762,7 +762,7 @@ public static function refundTestDataProvider(): array 'responseData' => [ 'OrderId' => 'SYSOID121332551', 'ProcReturnCode' => '81', - 'HostRefNum' => 'hostid', + 'HostRefNum' => null, 'AuthCode' => '', 'TxnResult' => 'Failed', 'ErrorMessage' => 'Terminal Aktif Degil', @@ -791,7 +791,7 @@ public static function refundTestDataProvider(): array 'order_id' => 'SYSOID121332551', 'group_id' => null, 'auth_code' => null, - 'ref_ret_num' => 'hostid', + 'ref_ret_num' => null, 'proc_return_code' => '81', 'transaction_id' => null, 'error_code' => 'B810002',