Skip to content

Commit 104290d

Browse files
authored
Merge pull request #64 from academe/pr57
PR57 + Fix
2 parents ab9cac1 + e719a3a commit 104290d

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/Message/AIMAbstractRequest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ public function getCardReference($serialize = true)
150150
return $value;
151151
}
152152

153+
public function getInvoiceNumber()
154+
{
155+
return $this->getParameter('invoiceNumber');
156+
}
157+
158+
public function setInvoiceNumber($value)
159+
{
160+
return $this->setParameter('invoiceNumber', $value);
161+
}
162+
153163
public function sendData($data)
154164
{
155165
$headers = array('Content-Type' => 'text/xml; charset=utf-8');
@@ -213,12 +223,18 @@ protected function addBillingData(\SimpleXMLElement $data)
213223
/** @var mixed $req */
214224
$req = $data->transactionRequest;
215225

226+
// The order must come before the customer ID.
227+
$req->order->invoiceNumber = $this->getInvoiceNumber();
228+
$req->order->description = $this->getDescription();
229+
216230
// Merchant assigned customer ID
217231
$customer = $this->getCustomerId();
218232
if (!empty($customer)) {
219233
$req->customer->id = $customer;
220234
}
221235

236+
//$req->order->description = $this->getDescription();
237+
222238
/** @var CreditCard $card */
223239
if ($card = $this->getCard()) {
224240
// A card is present, so include billing and shipping details

tests/AIMGatewayTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,25 @@ public function setUp()
2222
$this->purchaseOptions = array(
2323
'amount' => '10.00',
2424
'card' => $this->getValidCard(),
25+
'description' => 'purchase',
2526
);
2627

2728
$this->captureOptions = array(
2829
'amount' => '10.00',
2930
'transactionReference' => '12345',
31+
'description' => 'capture',
3032
);
3133

3234
$this->voidOptions = array(
3335
'transactionReference' => '12345',
36+
'description' => 'void',
3437
);
3538

3639
$this->refundOptions = array(
3740
'amount' => '10.00',
3841
'transactionReference' => '12345',
39-
'card' => $this->getValidCard()
42+
'card' => $this->getValidCard(),
43+
'description' => 'refund',
4044
);
4145
}
4246

tests/Message/AIMAuthorizeRequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function testGetData()
4343
"transactionType",
4444
"amount",
4545
"payment",
46+
"order",
4647
"customer",
4748
"billTo",
4849
"shipTo",

0 commit comments

Comments
 (0)