Magento 多个 Authorize.net 网关 [英] Magento Multiple Authorize.net Gateways

查看:30
本文介绍了Magento 多个 Authorize.net 网关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到有人问过这个关于货币类型的问题,但我要问的是如何在同一家商店为不同的信用卡类型配置第二个 Authorize.net 帐户.因此,我们希望一些信用卡使用第一个主 Authorize.net 网关,而其他信用卡使用辅助 Authorize.net 帐户,以便付款可以路由到两个不同的银行帐户.这是为了和解,是一种限制;无法修改.

I've seen this question asked with regard to currency type, but what I am asking is how to configure a second Authorize.net account on the same store for a different credit card type. So, we want some credit cards to use the first main Authorize.net gateway, but the others to use the secondary Authorize.net account so that the payments can be routed into two different bank accounts. This is for purposes of reconciliation and is a constraint; can't be modified.

我想我需要做的就是在订单提交后(但在通过 API 将其发送到 Authorize.net 之前)弄清楚它是哪种卡类型,以了解将哪些凭据传递给API,但我不确定在哪里添加此代码,或者添加它的最佳方式.

I'm figuring that all I need to do is figure out once the order has been submitted (but before it has been sent via API to Authorize.net) which card type it is, to know which credentials to pass to the API, but I'm unsure as to where to add this code, or the best way in which to add it.

任何见解或建议将不胜感激.

Any insight or advice would be greatly appreciated.

推荐答案

默认情况下,无法完成此操作,因此您需要使用一些自定义代码.具体来说,覆盖Authnet支付类Mage_Paygate_Model_Authorizenet:

By default, there is no way to accomplish this, so you'll need to use some custom code. Specifically, override the Authnet payment class Mage_Paygate_Model_Authorizenet:

class MyNamespace_MyModule_Model_Authorizenet extends Mage_Paygate_Model_Authorizenet {

  /**
   * Prepare request to gateway
   *
   * @link http://www.authorize.net/support/AIM_guide.pdf
   * @param Mage_Sales_Model_Document $order
   * @return unknown
   */
  protected function _buildRequest(Varien_Object $payment) 
     //see below
  }
}

在那个函数中,对我来说,在第 277 行,执行以下代码来设置 Authnet 帐户:

In that function, on line 277 for me, the following code is executed to set the Authnet account:

    $request->setXLogin($this->getConfigData('login'))
        ->setXTranKey($this->getConfigData('trans_key'))
        ->setXType($payment->getAnetTransType())
        ->setXMethod($payment->getAnetTransMethod());   

相反,你想要一些类似的东西:

Instead, you want something along these lines:

if(whatever cc type) {
     // set alternate gateway
} else {
     // set default gateway
}

为此,您还需要在后端创建新选项,以加密形式保存凭据.希望有帮助!

To accomplish this, you'll also want to create new options in the backend to hold the credentials in an encrypted form. Hope that helps!

谢谢,乔

这篇关于Magento 多个 Authorize.net 网关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆