Jump to content

4.1.13 Gateway Changes


Mark
 Share

Recommended Posts

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:

  1. 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).
  2. 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 );
	}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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