Skip to content

Commit 45c85fc

Browse files
committed
Issue #38 new test to confirm order of transactionRequest elements.
1 parent 77729dc commit 45c85fc

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/Message/AIMAuthorizeRequest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public function getData()
1818
$data->transactionRequest->amount = $this->getAmount();
1919
$this->addPayment($data);
2020
$this->addBillingData($data);
21-
// CHECKME: is shipping data useful here?
22-
//$this->addShippingData($data);
2321
$this->addCustomerIP($data);
2422
$this->addTransactionSettings($data);
2523

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)