1 | <?php |
||
2 | |||
3 | namespace ByTIC\Omnipay\PlatiOnline\Message\Traits; |
||
4 | |||
5 | use SimpleXMLElement; |
||
6 | |||
7 | /** |
||
8 | * Trait RelayResponseTrait |
||
9 | * @package ByTIC\Omnipay\PlatiOnline\Message\Traits |
||
10 | */ |
||
11 | trait RelayResponseTrait |
||
12 | { |
||
13 | /** |
||
14 | * @inheritDoc |
||
15 | * @noinspection PhpMissingReturnTypeInspection |
||
16 | */ |
||
17 | public function isSuccessful() |
||
18 | { |
||
19 | return $this->getCode() == '2'; |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @inheritDoc |
||
24 | * @noinspection PhpMissingReturnTypeInspection |
||
25 | */ |
||
26 | public function isPending() |
||
27 | { |
||
28 | return $this->getCode() == '13'; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @inheritDoc |
||
33 | * @noinspection PhpMissingReturnTypeInspection |
||
34 | */ |
||
35 | public function getMessage() |
||
36 | { |
||
37 | return |
||
38 | 'CODE: ' . $this->getNotification()->x_response_reason_code |
||
39 | . ' ' . $this->getNotification()->x_response_reason_text; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @inheritDoc |
||
44 | * @noinspection PhpMissingReturnTypeInspection |
||
45 | */ |
||
46 | public function getCode() |
||
47 | { |
||
48 | return (string)$this->getNotification()->x_response_code; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @inheritDoc |
||
53 | * @noinspection PhpMissingReturnTypeInspection |
||
54 | */ |
||
55 | public function getTransactionReference() |
||
56 | { |
||
57 | return (string)$this->getNotification()->x_trans_id; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @inheritDoc |
||
62 | * @noinspection PhpMissingReturnTypeInspection |
||
63 | */ |
||
64 | public function getTransactionId() |
||
65 | { |
||
66 | return (string)$this->getNotification()->f_order_number; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return SimpleXMLElement |
||
71 | */ |
||
72 | protected function getNotification() |
||
73 | { |
||
74 | return $this->getDataProperty('notification'); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
75 | } |
||
76 | } |
||
77 |