Skip to content

Commit

Permalink
Merge pull request #1 from BojanZelic/master
Browse files Browse the repository at this point in the history
Added Refund support
  • Loading branch information
architech99 committed Jul 17, 2014
2 parents 6d93223 + dc7b5f9 commit f10452b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/AIMGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
24 changes: 24 additions & 0 deletions src/Message/AIMRefundRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Omnipay\AuthorizeNet\Message;

/**
* Authorize.Net Refund Request
*/
class AIMRefundRequest extends AbstractRequest
{
protected $action = 'CREDIT';
public function getData()
{
$data = $this->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;
}
}

0 comments on commit f10452b

Please sign in to comment.