| Total Complexity | 6 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class CompletePurchaseResponse extends AbstractResponse |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Constructor |
||
| 16 | * |
||
| 17 | * @param RequestInterface $request the initiating request. |
||
| 18 | * @param mixed $data |
||
| 19 | * |
||
| 20 | * @throws InvalidResponseException If merchant data or order number is missing, or signature does not match |
||
| 21 | */ |
||
| 22 | public function __construct(RequestInterface $request, $data) |
||
| 23 | { |
||
| 24 | parent::__construct($request, $data); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Is the response successful? |
||
| 29 | * |
||
| 30 | * |
||
| 31 | * @return boolean |
||
| 32 | */ |
||
| 33 | public function isSuccessful() |
||
| 34 | { |
||
| 35 | return true; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Get the transaction identifier if available. |
||
| 40 | * |
||
| 41 | * @return null|string |
||
| 42 | */ |
||
| 43 | public function getTransactionReference() |
||
| 44 | { |
||
| 45 | return $this->getKey('transaction_id'); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Get the merchant-supplied transaction identifier if available. |
||
| 50 | * |
||
| 51 | * @return null|string |
||
| 52 | */ |
||
| 53 | public function getTransactionId() |
||
| 54 | { |
||
| 55 | return $this->getKey('req_reference_number'); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Helper method to get a specific response parameter if available. |
||
| 60 | * |
||
| 61 | * @param string $key The key to look up |
||
| 62 | * |
||
| 63 | * @return null|mixed |
||
| 64 | */ |
||
| 65 | protected function getKey($key) |
||
| 68 | } |
||
| 69 | } |
||
| 70 |