Jump to content

How to get acces to $transaction->method?


Ilya Hoilik

Recommended Posts

Posted

Hello, guys!

Can you help me please? I tried to get access to $transaction->method->settings and to my custom $transaction->method->_sort() from /interface/gateways/mycustom.php. But I didn't do this. My script terminates without any errors and warnings. I tried to var_dump( $transaction ) and I haven't seen $transaction->method at all. What am I missed?

The problematic code:

$settings = json_decode( $transaction->method->settings, TRUE );

The var_dump:

object(IPS\nexus\Transaction)#3 (5) {
  ["_url":protected]=>
  NULL
  ["_data":protected]=>
  array(16) {
    ["id"]=>
    int(321)
    ["member"]=>
    int(1)
    ["invoice"]=>
    int(375)
    ["method"]=>
    int(6)
    ["status"]=>
    string(4) "pend"
    ["amount"]=>
    string(4) "1.00"
    ["date"]=>
    int(1453492048)
    ["extra"]=>
    string(2) "[]"
    ["fraud"]=>
    NULL
    ["gw_id"]=>
    string(0) ""
    ["ip"]=>
    string(12) "93.85.27.196"
    ["fraud_blocked"]=>
    int(0)
    ["currency"]=>
    string(3) "RUB"
    ["partial_refund"]=>
    string(5) "0.000"
    ["auth"]=>
    NULL
    ["billing_agreement"]=>
    NULL
  }
  ["_new":protected]=>
  bool(false)
  ["changed"]=>
  array(0) {
  }
  ["skipCloneDuplication"]=>
  bool(false)
}
Posted

$transaction->method will return an \IPS\Gateway object (or NULL for account credit transactions) so $transaction->method->settings should work fine... if you're code is just dying with a blank page, it would indicate you hit a PHP error but you have display_errors turned off or error_reporting set to not report that error level. Check you php.ini configuration or throw something like this in your constants.php file:

ini_set( 'display_errors', 'on' );
error_reporting( E_ALL );

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...