Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Mark Posted June 20, 2016 Posted June 20, 2016 We have made some changes in IPS Community Suite 4.1.13 to Commerce gateways. In 4.1.13, customers may not provide their name or billing address in some circumstances. Therefore, if you have a custom gateway, you may need to make two changes: If anywhere in your gateway you access the billing address or customer's name, you should ideally make any necessary changes to accommodate for these not being present (the billing address may be NULL and the customer's name may be blank). The method signature for checkValidity() has changed to to allow NULL for $billingAddress and to add an extra parameter for an \IPS\nexus\Customer - you can use this to check if the values are provided if your gateway requires them. The new signature is: /** * Check the gateway can process this... * * @param $amount \IPS\nexus\Money The amount * @param $billingAddress \IPS\GeoLocation|NULL The billing address, which may be NULL if one if not provided * @param $customer \IPS\nexus\Customer The customer (Default NULL value is for backwards compatibility - it should always be provided.) * @return bool */ public function checkValidity( \IPS\nexus\Money $amount, \IPS\GeoLocation $billingAddress = NULL, \IPS\nexus\Customer $customer = NULL ) For example, our Authorize.Net gateway checks if the billing address is specified when building the data to send: 'x_address' => $invoice->billaddress ? implode( ', ', $invoice->billaddress->addressLines ) : '', 'x_city' => $invoice->billaddress ? $invoice->billaddress->city : '', 'x_state' => $invoice->billaddress ? $invoice->billaddress->region : '', 'x_zip' => $invoice->billaddress ? $invoice->billaddress->postalCode : '', 'x_country' => $invoice->billaddress ? $invoice->billaddress->country : '', Meanwhile, our 2CheckOut gateway's checkValidity() method has been changed to check that a name and billing address is provided (since 2CheckOut requires these details): /** * Check the gateway can process this... * * @param $amount \IPS\nexus\Money The amount * @param $billingAddress \IPS\GeoLocation|NULL The billing address, which may be NULL if one if not provided * @param $customer \IPS\nexus\Customer The customer (Default NULL value is for backwards compatibility - it should always be provided.) * @return bool */ public function checkValidity( \IPS\nexus\Money $amount, \IPS\GeoLocation $billingAddress = NULL, \IPS\nexus\Customer $customer = NULL ) { /* We require both a full name and a billing address */ if ( !$customer->cm_first_name or !$customer->cm_last_name or !$billingAddress ) { return FALSE; } /* Still here? We're good - pass to parent for general checks */ return parent::checkValidity( $amount, $billingAddress, $customer ); }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.