diff --git a/src/Message/AIMAbstractRequest.php b/src/Message/AIMAbstractRequest.php index 34d7fec9..98dacb2d 100644 --- a/src/Message/AIMAbstractRequest.php +++ b/src/Message/AIMAbstractRequest.php @@ -150,6 +150,16 @@ public function getCardReference($serialize = true) return $value; } + public function getInvoiceNumber() + { + return $this->getParameter('invoiceNumber'); + } + + public function setInvoiceNumber($value) + { + return $this->setParameter('invoiceNumber', $value); + } + public function sendData($data) { $headers = array('Content-Type' => 'text/xml; charset=utf-8'); @@ -213,12 +223,18 @@ protected function addBillingData(\SimpleXMLElement $data) /** @var mixed $req */ $req = $data->transactionRequest; + // The order must come before the customer ID. + $req->order->invoiceNumber = $this->getInvoiceNumber(); + $req->order->description = $this->getDescription(); + // Merchant assigned customer ID $customer = $this->getCustomerId(); if (!empty($customer)) { $req->customer->id = $customer; } + //$req->order->description = $this->getDescription(); + /** @var CreditCard $card */ if ($card = $this->getCard()) { // A card is present, so include billing and shipping details diff --git a/tests/AIMGatewayTest.php b/tests/AIMGatewayTest.php index 81a51537..595862ab 100644 --- a/tests/AIMGatewayTest.php +++ b/tests/AIMGatewayTest.php @@ -22,21 +22,25 @@ public function setUp() $this->purchaseOptions = array( 'amount' => '10.00', 'card' => $this->getValidCard(), + 'description' => 'purchase', ); $this->captureOptions = array( 'amount' => '10.00', 'transactionReference' => '12345', + 'description' => 'capture', ); $this->voidOptions = array( 'transactionReference' => '12345', + 'description' => 'void', ); $this->refundOptions = array( 'amount' => '10.00', 'transactionReference' => '12345', - 'card' => $this->getValidCard() + 'card' => $this->getValidCard(), + 'description' => 'refund', ); } diff --git a/tests/Message/AIMAuthorizeRequestTest.php b/tests/Message/AIMAuthorizeRequestTest.php index d4a4261d..5448905e 100644 --- a/tests/Message/AIMAuthorizeRequestTest.php +++ b/tests/Message/AIMAuthorizeRequestTest.php @@ -43,6 +43,7 @@ public function testGetData() "transactionType", "amount", "payment", + "order", "customer", "billTo", "shipTo",