Skip to content

Commit b2ba0a8

Browse files
author
brianmc
committed
Merge branch 'ncpga-master'
2 parents 209dedf + 7a45bfb commit b2ba0a8

4 files changed

Lines changed: 72 additions & 4 deletions

File tree

tests/AuthorizeNetAIM_Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ public function testMultipleLineItems()
584584
$merchant->allow_partial_auth = "false";
585585

586586
$creditCard = array(
587-
'exp_date' => '02/2012',
587+
'exp_date' => '02/2020',
588588
'card_num' => '6011000000000012',
589589
'card_code' => '452',
590590
);
@@ -657,7 +657,7 @@ public function testAllFieldsLongMethod()
657657
$merchant->allow_partial_auth = "false";
658658

659659
$creditCard = array(
660-
'exp_date' => '02/2012',
660+
'exp_date' => '02/2020',
661661
'card_num' => '6011000000000012',
662662
'card_code' => '452',
663663
);

tests/AuthorizeNetARB_Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function testAllMethods()
1010
$subscription->name = "Short subscription";
1111
$subscription->intervalLength = "1";
1212
$subscription->intervalUnit = "months";
13-
$subscription->startDate = "2011-03-12";
13+
$subscription->startDate = "2020-03-12";
1414
$subscription->totalOccurrences = "14";
1515
$subscription->amount = rand(1,100);
1616
$subscription->creditCardCardNumber = "6011000000000012";

tests/AuthorizeNetCP_Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function testResponseFields()
112112
$this->assertEquals('1.0',$response->version);
113113
$this->assertEquals('1',$response->response_code);
114114
$this->assertEquals('1',$response->response_reason_code);
115-
$this->assertEquals('(TESTMODE) This transaction has been approved.',$response->response_reason_text);
115+
$this->assertEquals('This transaction has been approved.',$response->response_reason_text);
116116
$this->assertEquals('000000',$response->authorization_code);
117117
$this->assertEquals('P',$response->avs_code);
118118
$this->assertEquals('',$response->card_code_response);

tests/AuthorizeNetTD_Test.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,36 @@ public function testGetTransactionList()
4444
$this->assertTrue($response->isOk());
4545
}
4646

47+
public function testGetTransactionListReturnedItems()
48+
{
49+
$request = new AuthorizeNetTD;
50+
$batchId = 0; // Set your $batchId here
51+
$response = $request->getTransactionList($batchId);
52+
$this->assertTrue($response->isOk());
53+
$transactions = $response->xpath("transactions/transaction");
54+
$transId = $transactions[0]->transId;
55+
56+
$details = new AuthorizeNetTD;
57+
$response = $details->getTransactionDetails($transId);
58+
$this->assertTrue($response->isOk());
59+
$transaction = $response->xml->transaction[0];
60+
$this->assertFalse(empty($transaction->returnedItems));
61+
62+
}
63+
64+
65+
public function testGetTransactionListSubscription()
66+
{
67+
$transId = 0; // Set your $transId here
68+
69+
$details = new AuthorizeNetTD;
70+
$response = $details->getTransactionDetails($transId);
71+
$this->assertTrue($response->isOk());
72+
$transaction = $response->xml->transaction[0];
73+
74+
$this->assertFalse(empty($transaction->subscription));
75+
}
76+
4777
public function testGetTransactionDetails()
4878
{
4979
$sale = new AuthorizeNetAIM;
@@ -63,6 +93,27 @@ public function testGetTransactionDetails()
6393

6494
}
6595

96+
97+
public function testGetTransactionDetailsWithSolutionId()
98+
{
99+
$sale = new AuthorizeNetAIM;
100+
$amount = rand(1, 100);
101+
$sale->setCustomField('x_solution_id', 'A1000002');
102+
$response = $sale->authorizeAndCapture($amount, '4012888818888', '04/17');
103+
$this->assertTrue($response->approved);
104+
105+
$transId = $response->transaction_id;
106+
107+
$request = new AuthorizeNetTD;
108+
$response = $request->getTransactionDetails($transId);
109+
$this->assertTrue($response->isOk());
110+
111+
$this->assertEquals($transId, (string)$response->xml->transaction->transId);
112+
$this->assertEquals($amount, (string)$response->xml->transaction->authAmount);
113+
$this->assertEquals("Visa", (string)$response->xml->transaction->payment->creditCard->cardType);
114+
$this->assertEquals("A1000002", (string)$response->xml->transaction->solution->id);
115+
}
116+
66117
public function testGetUnsettledTransactionList()
67118
{
68119
$sale = new AuthorizeNetAIM;
@@ -76,6 +127,23 @@ public function testGetUnsettledTransactionList()
76127
$this->assertTrue($response->xml->transactions->count() >= 1);
77128
}
78129

130+
public function testGetUnsettledTransactionListHasNoReturnedItems()
131+
{
132+
$request = new AuthorizeNetTD;
133+
$response = $request->getUnsettledTransactionList();
134+
$this->assertTrue($response->isOk());
135+
$this->assertTrue($response->xml->transactions->count() >= 1);
136+
137+
foreach($response->xml->transactions->transaction as $transaction)
138+
{
139+
if($transaction->hasReturnedItems)
140+
{
141+
$this->assertEquals("false", $transaction->hasReturnedItems);
142+
}
143+
}
144+
}
145+
146+
79147
public function testGetBatchStatistics()
80148
{
81149
$request = new AuthorizeNetTD;

0 commit comments

Comments
 (0)