Skip to content

Commit ef36670

Browse files
committed
Change postion of the AIM "order" element in the request.
The "order" element must come before the "customer" element. Authorize.Net is very fussy about the order in which the XML elements are put together.
1 parent 9259136 commit ef36670

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Message/AIMAbstractRequest.php

Lines changed: 15 additions & 1 deletion
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,13 +223,17 @@ 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

222-
$req->order->description = $this->getDescription();
236+
//$req->order->description = $this->getDescription();
223237

224238
/** @var CreditCard $card */
225239
if ($card = $this->getCard()) {

0 commit comments

Comments
 (0)