在magento中基于自定义API的支付方法中实现3D安全验证

在magento中基于自定义API的支付方法中实现3D安全验证,magento,payment-gateway,Magento,Payment Gateway,我正在开发基于自定义API的支付网关。对于3D安全验证,支付网关返回编码表单,需要提交给第三方网站上的重定向用户进行卡验证 我在支付模型的捕获功能中处理此代码 这里我的问题是如何使用编码表单将用户从支付模型捕获方法重定向到第三方站点 我已经使用getOrderPlaceRedirectUrl在托管表单方法中重定向用户 请建议。我创建了一个新的控制器操作,并将用户从getOrderPlaceRedirectUrl()重定向到它。这个新的控制器操作将显示一个隐藏表单,该表单将MD、PaReq等显示为

我正在开发基于自定义API的支付网关。对于3D安全验证,支付网关返回编码表单,需要提交给第三方网站上的重定向用户进行卡验证

我在支付模型的捕获功能中处理此代码

这里我的问题是如何使用编码表单将用户从支付模型捕获方法重定向到第三方站点

我已经使用getOrderPlaceRedirectUrl在托管表单方法中重定向用户


请建议。

我创建了一个新的控制器操作,并将用户从getOrderPlaceRedirectUrl()重定向到它。这个新的控制器操作将显示一个隐藏表单,该表单将MD、PaReq等显示为隐藏字段。然后,此表单可以自动提交到ACS URL

下面是一些未经测试的伪代码。你需要根据自己的需要修改它,但希望它能让人理解你的想法

在您的支付方式实例中:

function getOrderPlaceUrl() {
    Mage::getModel('core/session')->setMd('valuehere'); //  Set all the 3DS params into the session by the time this function call finished.  Don't set them here in actual code - bad style.  This is just for demonstration.
    return Mage::getUrl('module/payment/action');
}
app/code/local/Namespace/Module/controllers/Payment.php:

class Namespace_Module_PaymentController extends Mage_Core_Controller_Varien_Front {
    public function redirectAction() {
        $this->loadLayout();
        $this->renderLayout();
    }
}
app/design/front/base/default/layout/module.xml:

<namespace_module_payment_redirect>
    <reference name="content">
        <block type="namespace_module/payment_redirect</block" name="namespace.module.payment.redirect" template="namespace/module/payment/redirect.tpl" />
    </reference>
</namespace_module_payment_redirect>
app/design/frontend/base/default/templates/module/payment/redirect.tpl:

<form action="payment_gateway_url_here" method="post">
    <input type="hidden" name="MD" value="<?php print $this->getMd(); ?>" />
</form>


谢谢你的回答。在控制器上重定向之后,我正在检查捕获功能中的所有条件,但当重定向订单状态已更改为“处理并生成发票”时。。你能帮个忙吗?我妈在做什么吗wrong@PankajPareek上面的代码不会带你走完全程;你需要扩展它。当您重定向到自定义控制器时,Magento已经调用了
Mage\u Sales\u Model\u Order\u Payment::place()
。此函数负责调用付款方法的
authorize()
capture()
函数。您应该根据需要扩展
authorize()
capture()
。我自己的解决方案还包括在事件
checkout\u submit\u all\u after
上附加一个观察者,加载活动订单并将其状态和状态更新为“Pending 3D Secure”。我如何控制在捕获方法中生成发票?@PankajPareek您可能想创建一个新的SO问题:)@PankajPareek如果回答了您的原始问题请随意接受答案!
<form action="payment_gateway_url_here" method="post">
    <input type="hidden" name="MD" value="<?php print $this->getMd(); ?>" />
</form>