Exemple #1
0
 /**
  * sets instance properties from an array of values
  *
  * @ignore
  * @access protected
  * @param array $customerAttribs array of customer data
  */
 protected function _initialize($customerAttribs)
 {
     $this->_attributes = $customerAttribs;
     $addressArray = [];
     if (isset($customerAttribs['addresses'])) {
         foreach ($customerAttribs['addresses'] as $address) {
             $addressArray[] = Address::factory($address);
         }
     }
     $this->_set('addresses', $addressArray);
     $creditCardArray = [];
     if (isset($customerAttribs['creditCards'])) {
         foreach ($customerAttribs['creditCards'] as $creditCard) {
             $creditCardArray[] = CreditCard::factory($creditCard);
         }
     }
     $this->_set('creditCards', $creditCardArray);
     $coinbaseAccountArray = [];
     if (isset($customerAttribs['coinbaseAccounts'])) {
         foreach ($customerAttribs['coinbaseAccounts'] as $coinbaseAccount) {
             $coinbaseAccountArray[] = CoinbaseAccount::factory($coinbaseAccount);
         }
     }
     $this->_set('coinbaseAccounts', $coinbaseAccountArray);
     $paypalAccountArray = [];
     if (isset($customerAttribs['paypalAccounts'])) {
         foreach ($customerAttribs['paypalAccounts'] as $paypalAccount) {
             $paypalAccountArray[] = PayPalAccount::factory($paypalAccount);
         }
     }
     $this->_set('paypalAccounts', $paypalAccountArray);
     $applePayCardArray = [];
     if (isset($customerAttribs['applePayCards'])) {
         foreach ($customerAttribs['applePayCards'] as $applePayCard) {
             $applePayCardArray[] = ApplePayCard::factory($applePayCard);
         }
     }
     $this->_set('applePayCards', $applePayCardArray);
     $androidPayCardArray = [];
     if (isset($customerAttribs['androidPayCards'])) {
         foreach ($customerAttribs['androidPayCards'] as $androidPayCard) {
             $androidPayCardArray[] = AndroidPayCard::factory($androidPayCard);
         }
     }
     $this->_set('androidPayCards', $androidPayCardArray);
     $amexExpressCheckoutCardArray = [];
     if (isset($customerAttribs['amexExpressCheckoutCards'])) {
         foreach ($customerAttribs['amexExpressCheckoutCards'] as $amexExpressCheckoutCard) {
             $amexExpressCheckoutCardArray[] = AmexExpressCheckoutCard::factory($amexExpressCheckoutCard);
         }
     }
     $this->_set('amexExpressCheckoutCards', $amexExpressCheckoutCardArray);
     $venmoAccountArray = array();
     if (isset($customerAttribs['venmoAccounts'])) {
         foreach ($customerAttribs['venmoAccounts'] as $venmoAccount) {
             $venmoAccountArray[] = VenmoAccount::factory($venmoAccount);
         }
     }
     $this->_set('venmoAccounts', $venmoAccountArray);
     $usBankAccountArray = array();
     if (isset($customerAttribs['usBankAccounts'])) {
         foreach ($customerAttribs['usBankAccounts'] as $usBankAccount) {
             $usBankAccountArray[] = UsBankAccount::factory($usBankAccount);
         }
     }
     $this->_set('usBankAccounts', $usBankAccountArray);
     $this->_set('paymentMethods', array_merge($this->creditCards, $this->paypalAccounts, $this->applePayCards, $this->coinbaseAccounts, $this->androidPayCards, $this->amexExpressCheckoutCards, $this->venmoAccounts, $this->usBankAccounts));
 }
 /**
  * sets instance properties from an array of values
  *
  * @ignore
  * @access protected
  * @param array $customerAttribs array of customer data
  */
 protected function _initialize($customerAttribs)
 {
     // set the attributes
     $this->_attributes = $customerAttribs;
     // map each address into its own object
     $addressArray = array();
     if (isset($customerAttribs['addresses'])) {
         foreach ($customerAttribs['addresses'] as $address) {
             $addressArray[] = Address::factory($address);
         }
     }
     $this->_set('addresses', $addressArray);
     // map each creditCard into its own object
     $creditCardArray = array();
     if (isset($customerAttribs['creditCards'])) {
         foreach ($customerAttribs['creditCards'] as $creditCard) {
             $creditCardArray[] = CreditCard::factory($creditCard);
         }
     }
     $this->_set('creditCards', $creditCardArray);
     // map each coinbaseAccount into its own object
     $coinbaseAccountArray = array();
     if (isset($customerAttribs['coinbaseAccounts'])) {
         foreach ($customerAttribs['coinbaseAccounts'] as $coinbaseAccount) {
             $coinbaseAccountArray[] = CoinbaseAccount::factory($coinbaseAccount);
         }
     }
     $this->_set('coinbaseAccounts', $coinbaseAccountArray);
     // map each paypalAccount into its own object
     $paypalAccountArray = array();
     if (isset($customerAttribs['paypalAccounts'])) {
         foreach ($customerAttribs['paypalAccounts'] as $paypalAccount) {
             $paypalAccountArray[] = PayPalAccount::factory($paypalAccount);
         }
     }
     $this->_set('paypalAccounts', $paypalAccountArray);
     // map each applePayCard into its own object
     $applePayCardArray = array();
     if (isset($customerAttribs['applePayCards'])) {
         foreach ($customerAttribs['applePayCards'] as $applePayCard) {
             $applePayCardArray[] = ApplePayCard::factory($applePayCard);
         }
     }
     $this->_set('applePayCards', $applePayCardArray);
     // map each androidPayCard into its own object
     $androidPayCardArray = array();
     if (isset($customerAttribs['androidPayCards'])) {
         foreach ($customerAttribs['androidPayCards'] as $androidPayCard) {
             $androidPayCardArray[] = AndroidPayCard::factory($androidPayCard);
         }
     }
     $this->_set('androidPayCards', $androidPayCardArray);
     // map each amexExpressCheckoutCard into its own object
     $amexExpressCheckoutCardArray = array();
     if (isset($customerAttribs['amexExpressCheckoutCards'])) {
         foreach ($customerAttribs['amexExpressCheckoutCards'] as $amexExpressCheckoutCard) {
             $amexExpressCheckoutCardArray[] = AmexExpressCheckoutCard::factory($amexExpressCheckoutCard);
         }
     }
     $this->_set('amexExpressCheckoutCards', $amexExpressCheckoutCardArray);
     $this->_set('paymentMethods', array_merge($this->creditCards, $this->paypalAccounts, $this->applePayCards, $this->coinbaseAccounts, $this->androidPayCards, $this->amexExpressCheckoutCards));
 }