cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Card Present PHP SDK BUG

Hi, i have downloaded the lastest version of php sdk

 

im running my transactions with this values

 

->setField('device_type',4);

->setField('duplicate_window',5);

->setField('exp_date',$expire_date);

->setField('amount',$amount);

->setField('card_num',$cardName);

 

transaction type ->authorizeOnly();

 

 

 

with the default php sdk, im geting the following errors :

 

 

---------------------------------------

Undefined property: AuthorizeNetCP::$_custom_fields

------------------------------------------------

ON LINE 86

"return new AuthorizeNetCP_Response($response, $this->_x_post_fields['delim_char'], $this->_x_post_fields['encap_char'], $this->_custom_fields);"

 

($_custom_fields is defined on partnet class , but its private so its not accecbile from AuthorizeNetCP class)

 

 

so i added

private $_custom_fields = array();

to AuthorizeNetCP class

 

then when im tring again , im getting

Undefined offset: 22

Undefined offset: 23

Undefined offset: 24

 

(lines 178-181)

 

so i have changed this lines to be

 

 $this->split_tender_id      = isset($this->_response_array[22]) ? $this->_response_array[22] : NULL;
                $this->requested_amount     = isset($this->_response_array[23]) ? $this->_response_array[23] : NULL;
                $this->approved_amount      = isset($this->_response_array[24]) ? $this->_response_array[24] : NULL;
                $this->card_balance         = isset($this->_response_array[25]) ? $this->_response_array[25] : NULL;
   

 

 

its seems like i never get this values .

all other values are ok.

 

after changed api works fine.

 

 

is it really the sdk problem ?

thanks.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

rotem
Member
8 REPLIES 8
Hi,
 
Thank you for bringing this to our attention, we tested this and have reproduced the error. We'll pass it to our developers for review.
 
Thanks,
Joy
Joy
Administrator Administrator
Administrator

I am getting these errors too. It's been a year, isn't this important?

 

Undefined property: AuthorizeNetCP::$_custom_fields in .\anet_php_sdk\lib\AuthorizeNetCP.php on line 86
Undefined offset: 22 in .\anet_php_sdk\lib\AuthorizeNetCP.php on line 177
Undefined offset: 23 in .\anet_php_sdk\lib\AuthorizeNetCP.php on line 178
Undefined offset: 24 in .\anet_php_sdk\lib\AuthorizeNetCP.php on line 179
Undefined offset: 25 in .\anet_php_sdk\lib\AuthorizeNetCP.php on line 180
Undefined property: AuthorizeNetCP_Response::$error_message in .\jsi_sync_mgdc.php on line 1641

 

Hello @tdietsche9 

I've reported your issue to the product team for analysis.

I'd recommend subscribing to this topic so that you'll be alerted via email if there are updates. To subscribe, click Topic Options at the top of this thread and then select Subscribe. You'll then receive an email once anyone replies to your post.

Thanks,

Richard

This issue is now resolved in version 1.8.0.  You may obtain the latest version of the sdk from Github:  https://github.com/AuthorizeNet/sdk-php

 

Richard

 

Thanks for the fast turnaround on fixing this. Appreciate it.

Tom Dietsche

Comparing the new and old AuthorizeNetCP.php files shows that only the

"undefined offset" errors were fixed. The "undefined property" error was NOT fixed.

It doesn't define a class property for _custom_fields (like AuthorizeNetAIM.php does).

 

I added this code after line 50 and it seems to prevent this php error:

 

    /**
     * Only used if merchant wants to send custom fields.
     */
    private $_custom_fields = array();

 

Also, the "error_message" property is only defined and returned if there IS an error.

It would be better if it always returned a value (empty string if trx is approved, otherwise an error message string). I fixed my script to only obtain the value of this response property if there was an error, not always.

Hello  @tdietsche9 

 

Thanks for letting us know.  I've logged an issue in GitHub to track your request: https://github.com/AuthorizeNet/sdk-php/issues/9 

 

You are also welcome in the future to go ahead and log issues right there too.  You can even submit your fix for our review and inclusion:  https://help.github.com/articles/using-pull-requests

 

Richard