Skip to content

Commit 439bb6e

Browse files
authored
Merge pull request #39 from thephpleague/issue38
Issue38
2 parents bd9523c + 45c85fc commit 439bb6e

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/Message/AIMAuthorizeRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public function getData()
1717
$data = $this->getBaseData();
1818
$data->transactionRequest->amount = $this->getAmount();
1919
$this->addPayment($data);
20-
$this->addCustomerIP($data);
2120
$this->addBillingData($data);
21+
$this->addCustomerIP($data);
2222
$this->addTransactionSettings($data);
2323

2424
return $data;

src/Message/AIMResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(AbstractRequest $request, $data)
2424
$xml = preg_replace('/<createTransactionResponse[^>]+>/', '<createTransactionResponse>', (string)$data);
2525

2626
try {
27-
$xml = simplexml_load_string($xml);
27+
$xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOWARNING);
2828
} catch (\Exception $e) {
2929
throw new InvalidResponseException();
3030
}

tests/Message/AIMAuthorizeRequestTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ public function testGetData()
3131
$this->assertEquals('10.0.0.1', $data->transactionRequest->customerIP);
3232
$this->assertEquals('cust-id', $data->transactionRequest->customer->id);
3333

34+
// Issue #38 Make sure the transactionRequest properties are correctly ordered.
35+
// This feels messy, but works.
36+
$transactionRequestProperties = array_keys(get_object_vars($data->transactionRequest));
37+
// The names of the properies of the $data->transactionRequest object, in the order in
38+
// which they must be defined for Authorize.Net to accept the transaction.
39+
$keys = array(
40+
"transactionType",
41+
"amount",
42+
"payment",
43+
"customer",
44+
"billTo",
45+
"shipTo",
46+
"customerIP",
47+
"transactionSettings"
48+
);
49+
$this->assertEquals($keys, $transactionRequestProperties);
50+
3451
$setting = $data->transactionRequest->transactionSettings->setting[0];
3552
$this->assertEquals('testRequest', $setting->settingName);
3653
$this->assertEquals('false', $setting->settingValue);

0 commit comments

Comments
 (0)