Jump to content

Pass Module Settings in Payment Gateway's call() function


Guillaume

Recommended Posts

Hi,

In my payment gateway, for safety reasons, I would like to check the form's signature (to ensure the response is genuinely from the payment provider).
For that purpose, I need to use a couple of settings which are input by the admin of the module's settings page, namely: the certificate, the mode (test or prod) and the encryption algorithm).
But while a simple $mode=$this->_module['mode'] works perfectly in fixedVariables() function, it stays empty when called in call() function.

I have tried the below, but with no luck:
$this->_module = $GLOBALS['config']->get($module);
                            
Is there any reason why I need to specifically call the module's settings differently in that function?

Best regards,
Guillaume

Link to comment
Share on other sites

When the Module class (via /classes/module.class.php) instantiates a module's class, the config settings (fetched via Module) are passed into the module's class (via the module's __construct() function) and becomes the class's private attribute _module.

This private class attribute _module is visible everywhere in the module's class. There is no need to fetch it again once inside the module's class.

I think I see you are trying to use the variable $module that was passed in via the module's __construct() function. This variable is strictly local to that function - not visible in any other function of the class - that's why it was immediately assigned to the class's private variable $this->_module.

 

Link to comment
Share on other sites

  • 2 weeks later...

Archived

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

×
×
  • Create New...