Total Complexity | 7 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class CompleteAuthorizeResponse extends AbstractResponse |
||
10 | { |
||
11 | /** |
||
12 | * The response status code. |
||
13 | * |
||
14 | * @var int |
||
15 | */ |
||
16 | private $statusCode; |
||
17 | |||
18 | public function __construct(RequestInterface $request, int $statusCode, $data) |
||
19 | { |
||
20 | parent::__construct($request, $data); |
||
21 | |||
22 | $this->statusCode = $statusCode; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * {@inheritdoc} |
||
27 | */ |
||
28 | public function isSuccessful(): bool |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | public function isCancelled(): bool |
||
37 | { |
||
38 | return $this->getTransactionStatus() === self::TRANSACTION_STATUS_CANCELLED; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function getCode(): int |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public function getTransactionReference(): ?string |
||
53 | { |
||
54 | return $this->data['id'] ?? null; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | * |
||
60 | * Fallback on the postback data that was given by ICEPAY when the transaction cannot be found. |
||
61 | * Do note: this is not a reliable way of checking the transaction status. |
||
62 | * |
||
63 | * @see https://documentation.icepay.com/payments/payment-process/payment-feedback/postback/ |
||
64 | */ |
||
65 | protected function getTransactionStatus(): ?string |
||
72 | } |
||
73 | } |
||
74 |