本文介绍了错误:必须明确设置信用卡详细信息,或者必须有支持ObtainCreditCard请求的操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Payum稳定版0.13和Zend框架v2通过AuthorizeNet进行付款.我的测试代码:

I use Payum stable version 0.13 and Zend framework v2 for make payments via AuthorizeNet.My code for test:

    $storage = $this->getServiceLocator()
        ->get('payum')
        ->getStorage('LowbiddoPayment\Entity\AgreementDetails');

    $details                = $storage->create();
    $details['currency']    = 'USD';
    $details['amount']      = 100;
    $details['card_num']    = new SensitiveValue('4111111111111111');
    $details['exp_date']    = new SensitiveValue('10/16');
    $details['description'] = 'Test';
    $storage->update($details);

    $this->getServiceLocator()
        ->get('payum.security.token_factory')
        ->setUrlPlugin($this->url());

    $doneUrl = $this->url()->fromRoute('payment_done', array('id' => $orderId), array('force_canonical' => true));

    $captureToken = $this->getServiceLocator()
        ->get('payum.security.token_factory')
        ->createCaptureToken('authorize-net-aim', $details, $doneUrl);

我有这个错误

/vendor/payum/payum/src/Payum/AuthorizeNet/Aim/Action/CaptureAction.php:58

Credit card details has to be set explicitly or there has to be an action that supports ObtainCreditCard request.

我该如何解决?谢谢!

How can I fix it?Thanks!

推荐答案

PayumModule不提供(但尚未提供)内置的ObtainCreditCardAction.因此,有两种方法.

PayumModule does not provide (yet) a built-in ObtainCreditCardAction. So there are two ways to go.

  • 您可以自己索取信用卡信息.喜欢创建表单而不是呈现表单.用户填写并提交.您将获得该信息,并将其与其余信息一起传递给Payum. Authorize.Net AIM要求输入"card_num","exp_date"字段.

  • You can ask for credit card information yourself. Like create a form than render it. User fills it and submit. You get that info and pass it to Payum with the rest of information. Authorize.Net AIM asks for 'card_num', 'exp_date' fields.

另一种方法是创建一个特定于zend的ObtainCreditCardAction,然后使用addAction方法将其添加到Payment对象.这是Symfony的ObtainCreditCardAction的示例: https://github.com/Payum/Payum/blob/master/src/Payum/Core/Bridge/Symfony/Action/ObtainCreditCardAction.php

The other way is to create a zend specific ObtainCreditCardAction and add it to Payment object using addAction method. Here's an example of ObtainCreditCardAction for Symfony: https://github.com/Payum/Payum/blob/master/src/Payum/Core/Bridge/Symfony/Action/ObtainCreditCardAction.php

这篇关于错误:必须明确设置信用卡详细信息,或者必须有支持ObtainCreditCard请求的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 11:06