protected function Braintree_Transaction::_initialize in Commerce Braintree 7
sets instance properties from an array of values
@ignore @access protected
Parameters
array $transactionAttribs array of transaction data:
Return value
none
File
- braintree_php/
lib/ Braintree/ Transaction.php, line 470
Class
- Braintree_Transaction
- Creates and manages transactions
Code
protected function _initialize($transactionAttribs) {
$this->_attributes = $transactionAttribs;
$this
->_set('creditCardDetails', new Braintree_Transaction_CreditCardDetails($transactionAttribs['creditCard']));
$this
->_set('customerDetails', new Braintree_Transaction_CustomerDetails($transactionAttribs['customer']));
$this
->_set('billingDetails', new Braintree_Transaction_AddressDetails($transactionAttribs['billing']));
$this
->_set('shippingDetails', new Braintree_Transaction_AddressDetails($transactionAttribs['shipping']));
$this
->_set('subscriptionDetails', new Braintree_Transaction_SubscriptionDetails($transactionAttribs['subscription']));
$this
->_set('descriptor', new Braintree_Descriptor($transactionAttribs['descriptor']));
$statusHistory = array();
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);
}