| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class RefundResponse extends AbstractResponse |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Is the response successful? |
||
| 14 | * |
||
| 15 | * @return boolean |
||
| 16 | */ |
||
| 17 | public function isSuccessful() |
||
| 18 | { |
||
| 19 | if (empty($this->data)) { |
||
| 20 | return false; |
||
| 21 | } |
||
| 22 | |||
| 23 | return !isset($this->data->errorId) && $this->data->status == 'REFUNDED'; |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Numeric status code (also in back office / report files) |
||
| 28 | * |
||
| 29 | * @return null|string |
||
| 30 | */ |
||
| 31 | public function getCode() |
||
| 32 | { |
||
| 33 | return $this->data->statusOutput->statusCode |
||
| 34 | ?? $this->data->refundResult->statusOutput->statusCode |
||
| 35 | ?? $this->data->errors[0]->errorCode |
||
| 36 | ?? null; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get the authorisation code if available. |
||
| 41 | * |
||
| 42 | * @return null|string |
||
| 43 | */ |
||
| 44 | public function getTransactionReference() |
||
| 45 | { |
||
| 46 | return $this->data->id ?? null; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Get the merchant response message if available. |
||
| 51 | * |
||
| 52 | * @return null|string |
||
| 53 | */ |
||
| 54 | public function getMessage() |
||
| 57 | } |
||
| 58 | } |
||
| 59 |