Skip to content

Commit

Permalink
Merge pull request #291 from TransbankDevelopers/feat/improve-status-…
Browse files Browse the repository at this point in the history
…response

feat: improve status response
  • Loading branch information
Matiasnickolas authored Sep 3, 2024
2 parents 15863b2 + c0bbddb commit fc30d67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Utils/HasTransactionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function setTransactionStatusFields(array $json): void
$this->buyOrder = Utils::returnValueIfExists($json, 'buy_order');
$this->sessionId = Utils::returnValueIfExists($json, 'session_id');
$this->cardDetail = Utils::returnValueIfExists($json, 'card_detail');
$this->cardNumber = Utils::returnValueIfExists($this->cardDetail, 'card_number');
$this->cardNumber = Utils::returnValueIfExists($this->cardDetail ?? [], 'card_number');
$this->accountingDate = Utils::returnValueIfExists($json, 'accounting_date');
$this->transactionDate = Utils::returnValueIfExists($json, 'transaction_date');
$this->authorizationCode = Utils::returnValueIfExists($json, 'authorization_code');
Expand Down
11 changes: 11 additions & 0 deletions tests/Webpay/WebpayPlus/WebpayPlusWithoutMocksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,15 @@ public function it_can_not_capture_a_transaction_with_simultaneous_capture_comme

$this->assertTrue(true);
}

/** @test */
public function it_returns_a_card_number_in_null_when_it_not_exists()
{
$transaction = new Transaction($this->options);
$createResponse = $transaction->create($this->buyOrder, $this->sessionId, $this->amount, $this->returnUrl);
$statusResponse = $transaction->status($createResponse->getToken());

$this->assertEquals(TransactionStatusResponse::class, get_class($statusResponse));
$this->assertEquals(null, $statusResponse->getCardNumber());
}
}

0 comments on commit fc30d67

Please sign in to comment.