本文整理汇总了PHP中Mage_Payment_Model_Method_Cc::fetchTransactionInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Method_Cc::fetchTransactionInfo方法的具体用法?PHP Mage_Payment_Model_Method_Cc::fetchTransactionInfo怎么用?PHP Mage_Payment_Model_Method_Cc::fetchTransactionInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Payment_Model_Method_Cc
的用法示例。
在下文中一共展示了Mage_Payment_Model_Method_Cc::fetchTransactionInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchTransactionInfo
/**
* Fetch transaction details info
*
* Update transaction info if there is one placing transaction only
*
* @param Mage_Payment_Model_Info $payment
* @param string $transactionId
* @return array
*/
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
{
$data = parent::fetchTransactionInfo($payment, $transactionId);
$cardsStorage = $this->getCardsStorage($payment);
if ($cardsStorage->getCardsCount() != 1) {
return $data;
}
$cards = $cardsStorage->getCards();
$card = array_shift($cards);
/*
* We need try to get transaction from Mage::registry,
* because in cases when fetch calling from Mage_Adminhtml_Sales_TransactionsController::fetchAction()
* this line "$transaction = $payment->getTransaction($transactionId)" loads a fetching transaction into a new object,
* so some changes (for ex. $transaction->setAdditionalInformation($this->_isTransactionFraud, false) ) will not saved,
* because controller have another object for this transaction and Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS isn't includes _isTransactionFraud flag.
*/
$transaction = Mage::registry('current_transaction');
if (is_null($transaction)) {
//this is for payment info update:
$transactionId = $card->getLastTransId();
$transaction = $payment->getTransaction($transactionId);
}
//because in child transaction, the txn_id spoils by added additional word (@see $this->_preauthorizeCaptureCardTransaction()):
if (empty($transactionId) || $transaction->getParentId()) {
$transactionId = $transaction->getAdditionalInformation($this->_realTransactionIdKey);
}
$response = $this->_getTransactionDetails($transactionId);
$data = array_merge($data, $response->getData());
if ($response->getResponseCode() == self::RESPONSE_CODE_APPROVED) {
$transaction->setAdditionalInformation($this->_isTransactionFraud, false);
$payment->setIsTransactionApproved(true);
} elseif ($response->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED) {
$payment->setIsTransactionDenied(true);
}
return $data;
}
示例2: fetchTransactionInfo
/**
* Fetch transaction details info
*
* Update transaction info if there is one placing transaction only
*
* @param Mage_Payment_Model_Info $payment
* @param string $transactionId
* @return array
*/
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
{
$cardsStorage = $this->getCardsStorage($payment);
if ($cardsStorage->getCardsCount() != 1) {
return parent::fetchTransactionInfo($payment, $transactionId);
}
$cards = $cardsStorage->getCards();
$card = array_shift($cards);
$transactionId = $card->getLastTransId();
$transaction = $payment->getTransaction($transactionId);
if (!$transaction->getAdditionalInformation($this->_isTransactionFraud)) {
return parent::fetchTransactionInfo($payment, $transactionId);
}
$response = $this->_getTransactionDetails($transactionId);
if ($response->getResponseCode() == self::RESPONSE_CODE_APPROVED) {
$transaction->setAdditionalInformation($this->_isTransactionFraud, false);
$payment->setIsTransactionApproved(true);
} elseif ($response->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED) {
$payment->setIsTransactionDenied(true);
}
return parent::fetchTransactionInfo($payment, $transactionId);
}
示例3: fetchTransactionInfo
/**
* Fetch transaction info -- fraud detection
*/
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
{
$this->_log('fetchTransactionInfo(' . $transactionId . ')');
$this->_loadOrCreateCard($payment);
/**
* Process transaction and results
*/
$this->_beforeFraudUpdate($payment, $transactionId);
$response = $this->gateway()->fraudUpdate($payment, $transactionId);
$this->_afterFraudUpdate($payment, $transactionId, $response);
if ($response->getIsApproved()) {
$transaction = $payment->getTransaction($transactionId);
$transaction->setAdditionalInformation('is_transaction_fraud', false);
$payment->setIsTransactionApproved(true);
} elseif ($response->getIsDenied()) {
$payment->setIsTransactionDenied(true);
}
$this->_log(json_encode($response->getData()));
return parent::fetchTransactionInfo($payment, $transactionId);
}