#2 Bug Reports » Payment Gateway Credentials Broken » April 17, 2019 4:04pm

Eden-i72
Replies: 3

Screenshot

I just updated a site to 4.4.3. We'd noticed an issue when configuring Authorize.Net (under Developer > Payment Gateway > Authorize.Net). The form fields appear to update successfully (we see the "Updated Payment Gateway" message and get redirected to the Developer root), but once we return to the form, the fields are blank again. I did some digging and it looks like a CMS bug.

The form loads saved values for each field from a BigTreePaymentGateway object. The actual settings appear to be saving correctly when the form is submitted; it’s just that the Settings and Service properties of the BigTreePaymentGateway object don't seem to be set correctly in the constructor (in core/inc/bigtree/apis/payment-gateway.php) .

The BigTreePaymentGateway constructor calls BigTreeCMS::getSetting('bigtree-internal-payment-gateway’).

public function __construct($gateway_override = false) {
	// This returns an array of settings
	$s = BigTreeCMS::getSetting("bigtree-internal-payment-gateway");

	// ... other stuff I cut out for relevance

	// Makes an empty setting if it doesn't exist--the structure doesn't match so it sets the properties as empty
	$this->Service = isset($s["value"]["service"]) ? $s["value"]["service"] : "";
	$this->Settings = isset($s["value"]["settings"]) ? $s["value"]["settings"] : array();

	// ... the rest of the function cut out for relevance

The problem is that BigTreeCMS::getSetting returns a string or array of the setting’s value, and the BigTreePaymentGateway constructor is looking for it to return an array with the ‘value’ key set to the setting’s value. The structure expected doesn’t match the structure returned, so it’s treated as if there are no settings.

I noticed BigTreeAdmin::getSetting looks like it does return the expected structure at least in most cases (and was used in earlier versions), in case that's helpful for resolving this.

Thanks.

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.