Ejemplo n.º 1
0
 /**
  * sets instance properties from an array of values
  *
  * @ignore
  * @access protected
  * @param array $transactionAttribs array of transaction data
  * @return none
  */
 protected function _initialize($transactionAttribs)
 {
     $this->_attributes = $transactionAttribs;
     if (isset($transactionAttribs['applePay'])) {
         $this->_set('applePayCardDetails', new Braintree_Transaction_ApplePayCardDetails($transactionAttribs['applePay']));
     }
     if (isset($transactionAttribs['creditCard'])) {
         $this->_set('creditCardDetails', new Braintree_Transaction_CreditCardDetails($transactionAttribs['creditCard']));
     }
     if (isset($transactionAttribs['coinbaseAccount'])) {
         $this->_set('coinbaseDetails', new Braintree_Transaction_CoinbaseDetails($transactionAttribs['coinbaseAccount']));
     }
     if (isset($transactionAttribs['paypal'])) {
         $this->_set('paypalDetails', new Braintree_Transaction_PayPalDetails($transactionAttribs['paypal']));
     }
     if (isset($transactionAttribs['customer'])) {
         $this->_set('customerDetails', new Braintree_Transaction_CustomerDetails($transactionAttribs['customer']));
     }
     if (isset($transactionAttribs['billing'])) {
         $this->_set('billingDetails', new Braintree_Transaction_AddressDetails($transactionAttribs['billing']));
     }
     if (isset($transactionAttribs['shipping'])) {
         $this->_set('shippingDetails', new Braintree_Transaction_AddressDetails($transactionAttribs['shipping']));
     }
     if (isset($transactionAttribs['subscription'])) {
         $this->_set('subscriptionDetails', new Braintree_Transaction_SubscriptionDetails($transactionAttribs['subscription']));
     }
     if (isset($transactionAttribs['descriptor'])) {
         $this->_set('descriptor', new Braintree_Descriptor($transactionAttribs['descriptor']));
     }
     if (isset($transactionAttribs['disbursementDetails'])) {
         $this->_set('disbursementDetails', new Braintree_DisbursementDetails($transactionAttribs['disbursementDetails']));
     }
     $disputes = array();
     if (isset($transactionAttribs['disputes'])) {
         foreach ($transactionAttribs['disputes'] as $dispute) {
             $disputes[] = Braintree_Dispute::factory($dispute);
         }
     }
     $this->_set('disputes', $disputes);
     $statusHistory = array();
     if (isset($transactionAttribs['statusHistory'])) {
         foreach ($transactionAttribs['statusHistory'] as $history) {
             $statusHistory[] = new Braintree_Transaction_StatusDetails($history);
         }
     }
     $this->_set('statusHistory', $statusHistory);
     $addOnArray = array();
     if (isset($transactionAttribs['addOns'])) {
         foreach ($transactionAttribs['addOns'] as $addOn) {
             $addOnArray[] = Braintree_AddOn::factory($addOn);
         }
     }
     $this->_set('addOns', $addOnArray);
     $discountArray = array();
     if (isset($transactionAttribs['discounts'])) {
         foreach ($transactionAttribs['discounts'] as $discount) {
             $discountArray[] = Braintree_Discount::factory($discount);
         }
     }
     $this->_set('discounts', $discountArray);
     if (isset($transactionAttribs['riskData'])) {
         $this->_set('riskData', Braintree_RiskData::factory($transactionAttribs['riskData']));
     }
     if (isset($transactionAttribs['threeDSecureInfo'])) {
         $this->_set('threeDSecureInfo', Braintree_ThreeDSecureInfo::factory($transactionAttribs['threeDSecureInfo']));
     }
 }
 protected function _initialize($attributes)
 {
     $this->_attributes = $attributes;
     if (isset($attributes['subject']['apiErrorResponse'])) {
         $wrapperNode = $attributes['subject']['apiErrorResponse'];
     } else {
         $wrapperNode = $attributes['subject'];
     }
     if (isset($wrapperNode['subscription'])) {
         $this->_set('subscription', Braintree_Subscription::factory($attributes['subject']['subscription']));
     }
     if (isset($wrapperNode['merchantAccount'])) {
         $this->_set('merchantAccount', Braintree_MerchantAccount::factory($wrapperNode['merchantAccount']));
     }
     if (isset($wrapperNode['transaction'])) {
         $this->_set('transaction', Braintree_Transaction::factory($wrapperNode['transaction']));
     }
     if (isset($wrapperNode['disbursement'])) {
         $this->_set('disbursement', Braintree_Disbursement::factory($wrapperNode['disbursement']));
     }
     if (isset($wrapperNode['partnerMerchant'])) {
         $this->_set('partnerMerchant', Braintree_PartnerMerchant::factory($wrapperNode['partnerMerchant']));
     }
     if (isset($wrapperNode['dispute'])) {
         $this->_set('dispute', Braintree_Dispute::factory($wrapperNode['dispute']));
     }
     if (isset($wrapperNode['errors'])) {
         $this->_set('errors', new Braintree_Error_ValidationErrorCollection($wrapperNode['errors']));
         $this->_set('message', $wrapperNode['message']);
     }
 }