| @@ 12-61 (lines=50) @@ | ||
| 9 | /** |
|
| 10 | * FACPG2 XML Tokenize Response |
|
| 11 | */ |
|
| 12 | class CreateCardResponse extends AbstractResponse |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * Constructor |
|
| 16 | * |
|
| 17 | * @param RequestInterface $request |
|
| 18 | * @param string $data |
|
| 19 | */ |
|
| 20 | public function __construct(RequestInterface $request, $data) |
|
| 21 | { |
|
| 22 | if ( empty($data) ) |
|
| 23 | { |
|
| 24 | throw new InvalidResponseException(); |
|
| 25 | } |
|
| 26 | ||
| 27 | $this->request = $request; |
|
| 28 | $this->data = $this->xmlDeserialize($data); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Return whether or not the response was successful |
|
| 33 | * |
|
| 34 | * @return boolean |
|
| 35 | */ |
|
| 36 | public function isSuccessful() |
|
| 37 | { |
|
| 38 | return isset($this->data['Success']) && 'true' === $this->data['Success']; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Return the response's reason message |
|
| 43 | * |
|
| 44 | * @return string |
|
| 45 | */ |
|
| 46 | public function getMessage() |
|
| 47 | { |
|
| 48 | return isset($this->data['ErrorMsg']) && !empty($this->data['ErrorMsg']) ? $this->data['ErrorMsg'] : null; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Return card reference |
|
| 53 | * |
|
| 54 | * @return string |
|
| 55 | */ |
|
| 56 | public function getCardReference() |
|
| 57 | { |
|
| 58 | return isset($this->data['Token']) ? $this->data['Token'] : null; |
|
| 59 | } |
|
| 60 | ||
| 61 | } |
|
| 62 | ||
| @@ 12-59 (lines=48) @@ | ||
| 9 | /** |
|
| 10 | * FACPG2 Transaction Status Response |
|
| 11 | */ |
|
| 12 | class StatusResponse extends AbstractResponse |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * Constructor |
|
| 16 | * |
|
| 17 | * @param RequestInterface $request |
|
| 18 | * @param string $data |
|
| 19 | */ |
|
| 20 | public function __construct(RequestInterface $request, $data) |
|
| 21 | { |
|
| 22 | if ( empty($data) ) { |
|
| 23 | throw new InvalidResponseException(); |
|
| 24 | } |
|
| 25 | ||
| 26 | $this->request = $request; |
|
| 27 | $this->data = $this->xmlDeserialize($data); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * Return whether or not the response was successful |
|
| 32 | * |
|
| 33 | * @return boolean |
|
| 34 | */ |
|
| 35 | public function isSuccessful() |
|
| 36 | { |
|
| 37 | return isset($this->data['ResponseCode']) && '1' === $this->data['ResponseCode']; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * Return the response message |
|
| 42 | * |
|
| 43 | * @return string |
|
| 44 | */ |
|
| 45 | public function getMessage() |
|
| 46 | { |
|
| 47 | return isset($this->data['ReasonCodeDescription']) ? $this->data['ReasonCodeDescription'] : null; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * Return transaction reference |
|
| 52 | * |
|
| 53 | * @return string |
|
| 54 | */ |
|
| 55 | public function getTransactionReference() |
|
| 56 | { |
|
| 57 | return isset($this->data['ReferenceNumber']) ? $this->data['ReferenceNumber'] : null; |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| @@ 12-60 (lines=49) @@ | ||
| 9 | /** |
|
| 10 | * FACPG2 Transaction Modification Response |
|
| 11 | */ |
|
| 12 | class TransactionModificationResponse extends AbstractResponse |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * Constructor |
|
| 16 | * |
|
| 17 | * @param RequestInterface $request |
|
| 18 | * @param string $data |
|
| 19 | */ |
|
| 20 | public function __construct(RequestInterface $request, $data) |
|
| 21 | { |
|
| 22 | if ( empty($data) ) |
|
| 23 | { |
|
| 24 | throw new InvalidResponseException(); |
|
| 25 | } |
|
| 26 | ||
| 27 | $this->request = $request; |
|
| 28 | $this->data = $this->xmlDeserialize($data); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Return whether or not the response was successful |
|
| 33 | * |
|
| 34 | * @return boolean |
|
| 35 | */ |
|
| 36 | public function isSuccessful() |
|
| 37 | { |
|
| 38 | return isset($this->data['ResponseCode']) && '1' === $this->data['ResponseCode']; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Return the response's reason code |
|
| 43 | * |
|
| 44 | * @return string |
|
| 45 | */ |
|
| 46 | public function getCode() |
|
| 47 | { |
|
| 48 | return isset($this->data['ReasonCode']) ? $this->data['ReasonCode'] : null; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Return the response's reason message |
|
| 53 | * |
|
| 54 | * @return string |
|
| 55 | */ |
|
| 56 | public function getMessage() |
|
| 57 | { |
|
| 58 | return isset($this->data['ReasonCodeDescription']) ? $this->data['ReasonCodeDescription'] : null; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| @@ 12-61 (lines=50) @@ | ||
| 9 | /** |
|
| 10 | * FACPG2 XML Update Token Response |
|
| 11 | */ |
|
| 12 | class UpdateCardResponse extends AbstractResponse |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * Constructor |
|
| 16 | * |
|
| 17 | * @param RequestInterface $request |
|
| 18 | * @param string $data |
|
| 19 | */ |
|
| 20 | public function __construct(RequestInterface $request, $data) |
|
| 21 | { |
|
| 22 | if ( empty($data) ) |
|
| 23 | { |
|
| 24 | throw new InvalidResponseException(); |
|
| 25 | } |
|
| 26 | ||
| 27 | $this->request = $request; |
|
| 28 | $this->data = $this->xmlDeserialize($data); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Return whether or not the response was successful |
|
| 33 | * |
|
| 34 | * @return boolean |
|
| 35 | */ |
|
| 36 | public function isSuccessful() |
|
| 37 | { |
|
| 38 | return isset($this->data['Success']) && 'true' === $this->data['Success']; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Return the response's reason message |
|
| 43 | * |
|
| 44 | * @return string |
|
| 45 | */ |
|
| 46 | public function getMessage() |
|
| 47 | { |
|
| 48 | return isset($this->data['ErrorMsg']) && !empty($this->data['ErrorMsg']) ? $this->data['ErrorMsg'] : null; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Return card reference |
|
| 53 | * |
|
| 54 | * @return string |
|
| 55 | */ |
|
| 56 | public function getCardReference() |
|
| 57 | { |
|
| 58 | return isset($this->data['TokenPAN']) ? $this->data['TokenPAN'] : null; |
|
| 59 | } |
|
| 60 | ||
| 61 | } |
|
| 62 | ||