Skip to content

Commit

Permalink
akbank pos improve history response mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
nuryagdym committed Apr 26, 2024
1 parent 9c07e38 commit e173399
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,19 +573,26 @@ private function mapSingleHistoryTransaction(array $rawTx): array
$transaction['batch_num'] = $rawTx['batchNumber'] ?? null;
$transaction['order_status'] = $this->mapOrderStatus($rawTx['txnStatus'], $rawTx['preAuthStatus'] ?? null);
$transaction['auth_code'] = $rawTx['authCode'];
if (PosInterface::PAYMENT_STATUS_PAYMENT_COMPLETED === $transaction['order_status'] && \in_array(
if (PosInterface::PAYMENT_STATUS_PAYMENT_COMPLETED === $transaction['order_status']) {
if (\in_array(
$transaction['transaction_type'],
[
PosInterface::TX_TYPE_PAY_AUTH,
PosInterface::TX_TYPE_PAY_POST_AUTH,
],
true,
)
) {
$transaction['capture_amount'] = null === $rawTx['amount'] ? null : $this->formatAmount($rawTx['amount']);
$transaction['capture'] = $transaction['first_amount'] === $transaction['capture_amount'];
if ($transaction['capture']) {
$transaction['capture_time'] = new \DateTimeImmutable($rawTx['txnDateTime']);
)) {
$transaction['capture_amount'] = null === $rawTx['amount'] ? null : $this->formatAmount($rawTx['amount']);
$transaction['capture'] = $transaction['first_amount'] === $transaction['capture_amount'];
if ($transaction['capture']) {
$transaction['capture_time'] = new \DateTimeImmutable($rawTx['txnDateTime']);
}
} elseif (PosInterface::TX_TYPE_PAY_PRE_AUTH === $transaction['transaction_type']) {
$transaction['capture_amount'] = null === $rawTx['preAuthCloseAmount'] ? null : $this->formatAmount($rawTx['preAuthCloseAmount']);
$transaction['capture'] = $transaction['first_amount'] === $transaction['capture_amount'];
if ($transaction['capture']) {
$transaction['capture_time'] = new \DateTimeImmutable($rawTx['preAuthCloseDate']);
}
}
}
} else {
Expand Down

0 comments on commit e173399

Please sign in to comment.