Skip to content

Commit da7868d

Browse files
authored
Merge pull request #10 from superbrave/fixed-transaction-status-response
Fixed the transaction status response.
2 parents 80c8794 + 732abb5 commit da7868d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/Message/TransactionStatusResponse.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ class TransactionStatusResponse extends AbstractResponse
1212
*/
1313
public function isSuccessful(): bool
1414
{
15-
return isset($this->data['statusCode']) && $this->data['statusCode'] === 200;
15+
return (isset($this->data['status']) && in_array($this->data['status'], [
16+
self::RESPONSE_STATUS_COMPLETED,
17+
self::RESPONSE_STATUS_SETTLED,
18+
])) && (isset($this->data['statusCode']) && $this->data['statusCode'] === 200);
1619
}
1720

1821
/**

tests/Message/TransactionStatusResponseTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ public function testResponseReturnsSuccessful(): void
4545
$expectedResponseBody = [
4646
'contractId' => 'NjRlYjM3MTctOGI1ZC00MDg4LTgxMDgtOTMyMjQ2NzVlNTM4',
4747
'transactionId' => '7c9cb2f4-83ce-4b10-8d5c-de230181224f',
48-
'statusCode' => 200,
48+
'status' => 'COMPLETED',
4949
'transactionStatusDetails' => '',
5050
'acquirerTransactionId' => '',
51+
'statusCode' => 200,
5152
];
5253

5354
$this->assertTrue($response->isSuccessful());
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"contractId": "NjRlYjM3MTctOGI1ZC00MDg4LTgxMDgtOTMyMjQ2NzVlNTM4",
33
"transactionId": "7c9cb2f4-83ce-4b10-8d5c-de230181224f",
4-
"statusCode": "COMPLETED",
4+
"status": "COMPLETED",
55
"transactionStatusDetails": "",
66
"acquirerTransactionId": ""
77
}

0 commit comments

Comments
 (0)