Skip to content

Commit b6e448d

Browse files
committedMar 27, 2014
fixed Undefined offset warnings: 22, 23, 24
1 parent aa744f3 commit b6e448d

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed
 

‎lib/AuthorizeNetCP.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ public function __construct($response, $delimiter, $encap_char, $custom_fields)
174174
$this->user_ref = $this->_response_array[9];
175175
$this->card_num = $this->_response_array[20];
176176
$this->card_type = $this->_response_array[21];
177-
$this->split_tender_id = $this->_response_array[22];
178-
$this->requested_amount = $this->_response_array[23];
179-
$this->approved_amount = $this->_response_array[24];
180-
$this->card_balance = $this->_response_array[25];
177+
$this->split_tender_id = isset($this->_response_array[22]) ? $this->_response_array[22] : NULL;
178+
$this->requested_amount = isset($this->_response_array[23]) ? $this->_response_array[23] : NULL;
179+
$this->approved_amount = isset($this->_response_array[24]) ? $this->_response_array[24] : NULL;
180+
$this->card_balance = isset($this->_response_array[25]) ? $this->_response_array[25] : NULL;
181181

182182

183183

‎tests/AuthorizeNetCP_Test.php

+16-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@
44

55
class AuthorizeNetCP_Test extends PHPUnit_Framework_TestCase
66
{
7-
7+
public function testAuthOnly()
8+
{
9+
$sale = new AuthorizeNetCP(CP_API_LOGIN_ID, CP_TRANSACTION_KEY);
10+
$sale->setFields(
11+
array(
12+
'amount' => rand(1, 1000),
13+
'card_num' => '4111111111111111',
14+
'exp_date' => '0415',
15+
'duplicate_window' => '5',
16+
'device_type' => '4',
17+
)
18+
);
19+
$response = $sale->authorizeOnly();
20+
$this->assertTrue($response->approved);
21+
}
22+
823
public function testAuthCapture()
924
{
1025
$sale = new AuthorizeNetCP(CP_API_LOGIN_ID, CP_TRANSACTION_KEY);

0 commit comments

Comments
 (0)
Please sign in to comment.