diff --git a/src/Message/AcceptNotificationRequest.php b/src/Message/AcceptNotificationRequest.php index da93078..3cc8f8a 100644 --- a/src/Message/AcceptNotificationRequest.php +++ b/src/Message/AcceptNotificationRequest.php @@ -2,7 +2,9 @@ namespace Omnipay\Aerotow\Message; -class AcceptNotificationRequest extends CompletePurchaseRequest +use Omnipay\Common\Message\NotificationInterface; + +class AcceptNotificationRequest extends CompletePurchaseRequest implements NotificationInterface { /** * @param array $data @@ -12,4 +14,22 @@ public function sendData($data) { return $this->response = new AcceptNotificationResponse($this, $data); } + + public function getTransactionStatus() + { + return $this->getNotificationResponse()->getTransactionStatus(); + } + + public function getMessage() + { + return $this->getNotificationResponse()->getMessage(); + } + + /** + * @return AcceptNotificationResponse + */ + protected function getNotificationResponse() + { + return ! $this->response ? $this->send() : $this->response; + } } diff --git a/src/Message/AcceptNotificationResponse.php b/src/Message/AcceptNotificationResponse.php index a42f0ce..200ecfa 100644 --- a/src/Message/AcceptNotificationResponse.php +++ b/src/Message/AcceptNotificationResponse.php @@ -2,6 +2,12 @@ namespace Omnipay\Aerotow\Message; -class AcceptNotificationResponse extends CompletePurchaseResponse +use Omnipay\Common\Message\NotificationInterface; + +class AcceptNotificationResponse extends CompletePurchaseResponse implements NotificationInterface { + public function getTransactionStatus() + { + return $this->isSuccessful() ? self::STATUS_COMPLETED : self::STATUS_FAILED; + } } diff --git a/src/Message/CompletePurchaseRequest.php b/src/Message/CompletePurchaseRequest.php index 4500697..287b1dd 100644 --- a/src/Message/CompletePurchaseRequest.php +++ b/src/Message/CompletePurchaseRequest.php @@ -8,9 +8,8 @@ use Omnipay\Aerotow\Traits\HasOrderInfo; use Omnipay\Common\Exception\InvalidRequestException; use Omnipay\Common\Message\AbstractRequest; -use Omnipay\Common\Message\NotificationInterface; -class CompletePurchaseRequest extends AbstractRequest implements NotificationInterface +class CompletePurchaseRequest extends AbstractRequest { use HasMerchant; use HasOrderInfo; @@ -52,24 +51,6 @@ public function sendData($data) return $this->response = new CompletePurchaseResponse($this, $data); } - public function getTransactionStatus() - { - return $this->getNotification()->getTransactionStatus(); - } - - public function getMessage() - { - return $this->getNotification()->getMessage(); - } - - /** - * @return NotificationInterface - */ - protected function getNotification() - { - return ! $this->response ? $this->send() : $this->response; - } - /** * @return array * @throws InvalidRequestException diff --git a/src/Message/CompletePurchaseResponse.php b/src/Message/CompletePurchaseResponse.php index 4f9bd8e..e588752 100644 --- a/src/Message/CompletePurchaseResponse.php +++ b/src/Message/CompletePurchaseResponse.php @@ -3,9 +3,8 @@ namespace Omnipay\Aerotow\Message; use Omnipay\Common\Message\AbstractResponse; -use Omnipay\Common\Message\NotificationInterface; -class CompletePurchaseResponse extends AbstractResponse implements NotificationInterface +class CompletePurchaseResponse extends AbstractResponse { /** * Is the response successful? @@ -36,9 +35,4 @@ public function getTransactionId() { return $this->data['Ordernum']; } - - public function getTransactionStatus() - { - return $this->isSuccessful() ? self::STATUS_COMPLETED : self::STATUS_FAILED; - } } diff --git a/src/Message/PurchaseRequest.php b/src/Message/PurchaseRequest.php index b781ded..bfb5aaf 100644 --- a/src/Message/PurchaseRequest.php +++ b/src/Message/PurchaseRequest.php @@ -165,6 +165,14 @@ public function sendData($data) return $this->response = new PurchaseResponse($this, $data); } + /** + * @return bool + */ + public function isAtm() + { + return $this->getGatewayName() === 'Aerotow_ATM'; + } + /** * @return array * @throws InvalidRequestException @@ -197,12 +205,4 @@ private function getCvsData() 'Hour' => $this->getHour(), ]); } - - /** - * @return bool - */ - public function isAtm() - { - return $this->getGatewayName() === 'Aerotow_ATM'; - } }