/** * Return list of allowed methods for specified country iso code * * @param string $countryCode 2-letters iso code * @return array */ public function getCountryMethods($countryCode = null) { //Countries where this method is available // (based on countries where PayFlow Pro, PayFlow Express Checkout and Billing Agreements are available) $countriesByMethod = array(self::METHOD_PAYFLOW_BILLING_AGREEMENT => array('US', 'CA', 'AU', 'NZ'), self::METHOD_PAYPAL_ORDERSTORED_AGREEMENT => array('other', 'US', 'CA', 'GB', 'AU', 'NZ', 'JP', 'FR', 'IT', 'ES', 'HK'), self::METHOD_PAYFLOW_ORDERSTORED_AGREEMENT => array('other', 'US', 'CA', 'GB', 'AU', 'NZ', 'JP', 'FR', 'IT', 'ES', 'HK')); // PayPal Direct 'Stored card' methods $countriesByMethod[self::METHOD_PAYPAL_DIRECT_CUSTOMERSTORED] = $countriesByMethod[self::METHOD_PAYPAL_DIRECT_ORDERSTORED] = array('US', 'CA', 'GB'); // PayPal Payflow-based 'Stored card' methods (Payflow Pro defines the list of supported countries) $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWADVANCED_CUSTOMERSTORED] = $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWLINK_CUSTOMERSTORED] = $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWPRO_CUSTOMERSTORED] = $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWADVANCED_ORDERSTORED] = $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWLINK_ORDERSTORED] = $countriesByMethod[self::METHOD_PAYPAL_PAYFLOWPRO_ORDERSTORED] = array('US', 'CA', 'AU', 'NZ'); $countryMethods = parent::getCountryMethods($countryCode); foreach ($countriesByMethod as $methodCode => $countries) { //Add this method to the list of available methods in appropriate countries if (is_null($countryCode)) { foreach ($countries as $country) { array_push($countryMethods[$country], $methodCode); } } elseif (in_array($countryCode, $countries)) { array_push($countryMethods, $methodCode); } } return $countryMethods; }