/** * Assign corresponding data * * @return Braintree_Payments_Model_Paymentmethod */ public function assignData($data) { parent::assignData($data); $infoInstance = $this->getInfoInstance(); $infoInstance->setAdditionalInformation(array('nonce' => $data->getNonce())); return $this; }
/** * Assign corresponding data * * @return Braintree_Payments_Model_Paymentmethod */ public function assignData($data) { parent::assignData($data); $infoInstance = $this->getInfoInstance(); $infoInstance->setCcLast4($data->getCcLast4()); $additionalData = array(); $nonce = ''; if ($data->getCcToken()) { $nonce = Mage::helper('braintree_payments')->getNonceForVaultedToken($data->getCcToken()); $additionalData['ccToken'] = $data->getCcToken(); } else { if ($data->getNonce() && $infoInstance->getAdditionalInformation('nonceLocked') != true) { $nonce = $data->getNonce(); } else { if (Mage::app()->getRequest()->getParam('payment_method_nonce')) { $nonce = Mage::app()->getRequest()->getParam('payment_method_nonce'); } } } $additionalData['nonce'] = $nonce; if (Mage::app()->getRequest()->getParam('device_data')) { $additionalData['deviceData'] = Mage::app()->getRequest()->getParam('device_data'); } if ($data->hasLiabilityShifted() || $data->hasLiabilityShiftPossible()) { $additionalData['liabilityShifted'] = $data->getLiabilityShifted(); $additionalData['liabilityShiftPossible'] = $data->getLiabilityShiftPossible(); $additionalData['threeDSecure'] = true; if ($infoInstance->getAdditionalInformation('nonceLocked') != true) { $additionalData['nonce'] = $data->getNonce(); $additionalData['nonceLocked'] = true; } else { $additionalData['nonceLocked'] = false; $additionalData['nonce'] = $infoInstance->getAdditionalInformation('nonce'); } } else { $additionalData['threeDSecure'] = false; } if ($data->getStoreInVault()) { $additionalData['storeInVault'] = $data->getStoreInVault(); } $infoInstance->setAdditionalInformation($additionalData); return $this; }