/** * Makes method specific manipulations after authorize/clone transaction success * * @param Varien_Object $payment $payment * @param array $result */ protected function _processMethodSpecificTransactionSuccess($payment, $result) { // Saving token if applicable, additional manipulations for multishipping if (isset($result->transaction->creditCard['token']) && $result->transaction->creditCard['token']) { $token = $result->transaction->creditCard['token']; $payment->setTransactionAdditionalInfo('token', $token); if ($payment->getIsMultishipping()) { if (!Mage::registry(self::REGISTER_NAME)) { Mage::register(self::REGISTER_NAME, $token); } if (Mage::getSingleton('checkout/session')->getBraintreeDeleteCard() === true) { Mage::getSingleton('checkout/session')->setBraintreeDeleteCard($token); } } } // Advanced fraud protection data if (isset($result->transaction->riskData) && $this->getConfigData('fraudprotection')) { $decision = $result->transaction->riskData->decision; $helper = Mage::helper('braintree_payments'); if ($decision == self::RISK_DATA_NOT_EVALUATED || $decision == self::RISK_DATA_REVIEW) { $payment->setIsTransactionPending(true); $payment->setIsFraudDetected(true); } else { if ($decision == self::RISK_DATA_DECLINE) { Braintree_Transaction::void($result->transaction->id); throw new Mage_Payment_Model_Info_Exception($helper->__('Try another card')); } } $system = $this->getConfigData('kount_id') ? 'Kount' : $helper->__('Braintree Advanced Fraud Protection Tool'); $id = ''; if ($result->transaction->riskData->id) { $id = $helper->__(', ID is "%s"', $result->transaction->riskData->id); } $comment = $helper->__('Transaction was evaluated with %s: decision is "%s"', $system, $decision) . $id; $payment->getOrder()->addStatusHistoryComment($comment); } }