From dc7b5f9419ddb9b72b6657dd865b907104990403 Mon Sep 17 00:00:00 2001 From: Bojan Zelic Date: Wed, 16 Jul 2014 17:23:36 -0700 Subject: [PATCH] Added Refund support --- src/AIMGateway.php | 5 +++++ src/Message/AIMRefundRequest.php | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/Message/AIMRefundRequest.php diff --git a/src/AIMGateway.php b/src/AIMGateway.php index 990c5928..e91a49a5 100644 --- a/src/AIMGateway.php +++ b/src/AIMGateway.php @@ -76,4 +76,9 @@ public function void(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMVoidRequest', $parameters); } + + public function refund(array $parameters = array()) + { + return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMRefundRequest', $parameters); + } } diff --git a/src/Message/AIMRefundRequest.php b/src/Message/AIMRefundRequest.php new file mode 100644 index 00000000..6f339e2e --- /dev/null +++ b/src/Message/AIMRefundRequest.php @@ -0,0 +1,24 @@ +getBaseData('RefundTransaction'); + + $this->validate('amount', 'transactionReference'); + + $data['x_trans_id'] = $this->getTransactionReference(); + $data['x_card_num'] = $this->getCard()->getNumber(); + $data['x_exp_date'] = $this->getCard()->getExpiryDate('my'); + $data['x_amount'] = $this->getAmount(); + + return $data; + } +}