Skip to content

Commit

Permalink
fix issue #207 - estpos undefined authcode index
Browse files Browse the repository at this point in the history
  • Loading branch information
nuryagdym committed May 17, 2024
1 parent e173399 commit 1018a5e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function mapRefundResponse(array $rawResponseData): array
return [
'order_id' => $rawResponseData['OrderId'],
'group_id' => $rawResponseData['GroupId'],
'auth_code' => $rawResponseData['AuthCode'],
'auth_code' => $rawResponseData['AuthCode'] ?? null,
'ref_ret_num' => $rawResponseData['HostRefNum'],
'proc_return_code' => $procReturnCode,
'transaction_id' => $rawResponseData['TransId'],
Expand Down Expand Up @@ -308,7 +308,7 @@ public function mapCancelResponse(array $rawResponseData): array
return [
'order_id' => $rawResponseData['OrderId'],
'group_id' => $rawResponseData['GroupId'],
'auth_code' => $rawResponseData['AuthCode'],
'auth_code' => $rawResponseData['AuthCode'] ?? null,
'ref_ret_num' => $rawResponseData['HostRefNum'],
'proc_return_code' => $procReturnCode,
'transaction_id' => $rawResponseData['TransId'],
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/EstV3PosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro
$this->card
);

$this->assertTrue($this->pos->isSuccess());

$response = $this->pos->getResponse();
$this->assertTrue($this->pos->isSuccess(), $response['error_message'] ?? null);

$this->assertIsArray($response);
$this->assertNotEmpty($response);
$this->assertTrue($eventIsThrown);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ public static function cancelTestDataProvider(): array
{
return
[
'success1' => [
'success1' => [
'responseData' => [
'OrderId' => '20221030B3FF',
'GroupId' => '20221030B3FF',
Expand Down Expand Up @@ -1512,7 +1512,7 @@ public static function cancelTestDataProvider(): array
'status_detail' => 'approved',
],
],
'fail1' => [
'fail_order_not_found_1' => [
'responseData' => [
'OrderId' => '',
'GroupId' => '',
Expand Down Expand Up @@ -1543,8 +1543,38 @@ public static function cancelTestDataProvider(): array
'status_detail' => 'general_error',
],
],
[
// recurring success case
'fail_order_not_found_2' => [
'responseData' => [
'OrderId' => 'a1a7d184',
'GroupId' => 'a1a7d184',
'Response' => 'Declined',
'HostRefNum' => '413719757716',
'ProcReturnCode' => '99',
'TransId' => '',
'ErrMsg' => 'İptal edilmeye uygun satış işlemi bulunamadı.',
'Extra' => [
'TRXDATE' => '20240516 22:56:09',
'EXTENDED_ERROR_CODE' => '215001',
'TRACEID' => '3f423f86e9d886bf1cffae49d93268be',
'NUMCODE' => '99',
'ERRORCODE' => 'CORE-2008',
],
],
'expectedData' => [
'order_id' => 'a1a7d184',
'group_id' => 'a1a7d184',
'auth_code' => null,
'ref_ret_num' => '413719757716',
'proc_return_code' => '99',
'transaction_id' => null,
'error_code' => 'CORE-2008',
'num_code' => '99',
'error_message' => 'İptal edilmeye uygun satış işlemi bulunamadı.',
'status' => 'declined',
'status_detail' => 'general_error',
],
],
'success_recurring_1' => [
'responseData' => [
'RECURRINGOPERATION' => 'CANCEL',
'RECORDTYPE' => 'ORDER',
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Gateways/EstPosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,8 @@ public static function cancelDataProvider(): array
{
return [
'fail_1' => [
'bank_response' => EstPosResponseDataMapperTest::cancelTestDataProvider()['fail1']['responseData'],
'expected_data' => EstPosResponseDataMapperTest::cancelTestDataProvider()['fail1']['expectedData'],
'bank_response' => EstPosResponseDataMapperTest::cancelTestDataProvider()['fail_order_not_found_1']['responseData'],
'expected_data' => EstPosResponseDataMapperTest::cancelTestDataProvider()['fail_order_not_found_1']['expectedData'],
'isSuccess' => false,
],
'success_1' => [
Expand Down

0 comments on commit 1018a5e

Please sign in to comment.