private function map_address($billing_address)
 {
     $address = new Address($billing_address);
     $address->map('name', 'PAYMENTREQUEST_0_SHIPTONAME')->map('phone', 'PAYMENTREQUEST_0_SHIPTOPHONENUM')->map('city', 'PAYMENTREQUEST_0_SHIPTOCITY')->map('address1', 'PAYMENTREQUEST_0_SHIPTOSTREET')->map('address2', 'PAYMENTREQUEST_0_SHIPTOSTREET2')->map('state', 'PAYMENTREQUEST_0_SHIPTOSTATE')->map('country', 'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE')->map('zip', 'PAYMENTREQUEST_0_SHIPTOZIP');
     return $address;
 }
示例#2
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 = $options->billing_address ?: $options->address;
     if (null == $billing_address) {
         return;
     }
     $address = new Address($billing_address);
     $address->map('city', 'city')->map('address1', 'address')->map('state', 'state')->map('country', 'country')->map('zip', 'postcode');
     $this->post['address'] = $address->getMappedFields();
 }