1 | <?php |
||
2 | |||
3 | namespace Omnipay\Moneris\Message; |
||
4 | |||
5 | use Omnipay\Common\Message\AbstractResponse; |
||
6 | |||
7 | class Response extends AbstractResponse |
||
8 | { |
||
9 | 51 | public function isSuccessful() |
|
10 | { |
||
11 | if (( |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
12 | 51 | (isset($this->data->receipt->Complete) && (bool) $this->data->receipt->Complete === true) || |
|
13 | 51 | (isset($this->data->receipt->ResSuccess) && (bool) $this->data->receipt->ResSuccess === true) |
|
14 | ) && |
||
15 | ( |
||
16 | 45 | isset($this->data->receipt->ResponseCode) && $this->data->receipt->ResponseCode != 'null' && |
|
17 | 51 | (int) $this->data->receipt->ResponseCode >= 0 && (int) $this->data->receipt->ResponseCode <= 49 |
|
18 | ) |
||
19 | ) { |
||
20 | 24 | return true; |
|
21 | } |
||
22 | |||
23 | 27 | return false; |
|
24 | } |
||
25 | |||
26 | 3 | public function getCardReference() |
|
27 | { |
||
28 | 3 | return isset($this->data->receipt->DataKey) ? (string) $this->data->receipt->DataKey : null; |
|
29 | } |
||
30 | |||
31 | 6 | public function getCode() |
|
32 | { |
||
33 | 6 | return isset($this->data->receipt->ResponseCode) ? (string) $this->data->receipt->ResponseCode : null; |
|
34 | } |
||
35 | |||
36 | 3 | public function getAuthCode() |
|
37 | { |
||
38 | 3 | return isset($this->data->receipt->AuthCode) ? (string) $this->data->receipt->AuthCode : null; |
|
39 | } |
||
40 | |||
41 | 3 | public function getTransactionId() |
|
42 | { |
||
43 | 3 | return isset($this->data->receipt->TransID) ? (string) $this->data->receipt->TransID : null; |
|
44 | } |
||
45 | |||
46 | 6 | public function getTransactionReference() |
|
47 | { |
||
48 | 6 | return isset($this->data->receipt->ReferenceNum) ? (string) $this->data->receipt->ReferenceNum : null; |
|
49 | } |
||
50 | |||
51 | 6 | public function getMessage() |
|
52 | { |
||
53 | 6 | return isset($this->data->receipt->Message) ? (string) $this->data->receipt->Message : null; |
|
54 | } |
||
55 | |||
56 | 3 | public function getOrderNumber() |
|
57 | { |
||
58 | 3 | return isset($this->data->receipt->ReceiptId) ? (string) $this->data->receipt->ReceiptId : null; |
|
59 | } |
||
60 | |||
61 | 3 | public function getData() |
|
62 | { |
||
63 | 3 | $response = null; |
|
0 ignored issues
–
show
|
|||
64 | |||
65 | try { |
||
66 | 3 | $response = preg_replace('/\n/', '', ($this->data)->asXML()); |
|
67 | 3 | } catch (\Error $e) { |
|
68 | 3 | $response = $this->data; |
|
69 | } |
||
70 | |||
71 | 3 | return $response; |
|
72 | } |
||
73 | } |
||
74 |