/** * * Options key can be 'shipping address' and 'billing_address' or 'address' * Each of these keys must have an address array like: * $address['name'] * $address['company'] * $address['address1'] * $address['address2'] * $address['city'] * $address['state'] * $address['country'] * $address['zip'] * $address['phone'] * common pattern for addres is * $billing_address = isset($options['billing_address']) ? $options['billing_address'] : $options['address'] * $shipping_address = $options['shipping_address'] * * @param array $options */ private function add_address($options) { $billing_address = isset($options['billing_address']) ? $options['billing_address'] : $options['address']; $this->post['STREET'] = isset($billing_address['address1']) ? $billing_address['address1'] : null; $this->post['CITY'] = isset($billing_address['city']) ? $billing_address['city'] : null; $this->post['STATE'] = isset($billing_address['state']) ? $billing_address['state'] : null; $this->post['ZIP'] = isset($billing_address['zip']) ? $billing_address['zip'] : null; $this->post['COUNTRYCODE'] = isset($billing_address['country']) ? Merchant_Country::find($billing_address['country'])->code('alpha2') : null; }
private function lookup_country_code($name_or_code) { $country = Merchant_Country::find($name_or_code); return (string) $country->code($this->country_format); }