private function add_address($options)
    {
        $country = Country::find($options['country'])->getCode('numeric');
        $this->xml .= <<<XML
      <Address>
        <Name DataType="String">{$options['name']}</Name>
        <Street1 DataType="String">{$options['address1']}</Street1>
        <Street2 DataType="String">{$options['address2']}</Street2>
        <City DataType="String" >{$options['city']}</City>
        <StateProv DataType="String">{$options['state']}</StateProv>
        <PostalCode DataType="String">{$options['zip']}</PostalCode>
        <Country DataType="String">{$country}</Country>
      </Address>
XML;
    }
Пример #2
0
 /**
  *
  * 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']) ? Country::find($billing_address['country'])->getCode('alpha2')->__toString() : null;
 }
Пример #3
0
 /**
  * Options key can be 'shipping address' and 'billing_address' or 'address'
  *
  * Each of these keys must have an address array like:
  * <code>
  *      $address['name']
  *      $address['company']
  *      $address['address1']
  *      $address['address2']
  *      $address['city']
  *      $address['state']
  *      $address['country']
  *      $address['zip']
  *      $address['phone']
  * </code>
  *
  * common pattern for address is
  * 
  * <code>
  *      $billing_address = isset($options['billing_address'])
  *          ? $options['billing_address']
  *          : $options['address'];
  *      $shipping_address = $options['shipping_address'];
  * </code>
  *
  * @param  array $options
  *
  * @return void
  */
 private function add_address($options)
 {
     $billing_address = isset($options['billing_address']) ? $options['billing_address'] : (array_key_exists('address', $options) ? $options['address'] : array());
     if (empty($billing_address)) {
         return;
     }
     // Paypal Express needs 2 digits alpha2 country code.
     $country_code = Country::find($billing_address['country'])->getCode('alpha2');
     $billing_address['country'] = $country_code;
     $address = $this->map_address($billing_address);
     $this->post = array_merge($this->post, $address->getMappedFields());
 }
Пример #4
0
 private function add_customer_details($creditcard, $options, $shipTo = false)
 {
     $customer = array('CustomerDetails' => array('BillingAddress' => array('Address1' => $options->billing_address->address1, 'Address2' => $options->billing_address->address2, 'City' => $options->billing_address->city, 'State' => $options->billing_address->state, 'PostCode' => $options->billing_address->zip, 'CountryCode' => $options->billing_address->country ? Country::find($options->billing_address->country)->getCode('numeric')->__toString() : null), 'PhoneNumber' => $options->billing_address->phone, 'EmailAddress' => $options->email, 'CustomerIPAddress' => $options->ip ? $options->ip : "127.0.0.1"));
     return $customer;
 }
Пример #5
0
 /**
  * @expectedException \OutOfRangeException
  */
 public function testNotFoundCountry()
 {
     $country = Country::find('Asgard');
 }