Magento信用卡号码与信用卡类型例外不匹配

rot*_*anj 5 php magento

我正在使用magento api,我在创建订单时遇到了一些问题.我已经能够完成创建订单以正常工作的一切.我看到的问题是当我调用方法创建订单时,我总是得到异常:Credit card number mismatch with credit card type.

我正在运行Magento ver.1.6.2.0

我已经验证我正在测试的卡通过magento前端工作.

非常感谢任何帮助.

这是我正在使用的测试代码:

<?php
$proxy = new SoapClient('http://localhost/index.php/api/soap/?wsdl');
$sessionId = $proxy->login('shopapi', 'test123');

// Create a quote, get quote identifier
$shoppingCartId = $proxy->call( $sessionId, 'cart.create');

// Set customer, for example guest
$customerAsGuest = array(
    "firstname" => "testFirstname",
    "lastname" => "testLastName",
    "email" => "test@test.com",
    //"website_id" => "0",
    //"store_id" => "0",
    "mode" => "guest"
);
$resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array( $shoppingCartId, $customerAsGuest) );

// Set customer addresses, for example guest's addresses
$arrAddresses = array(
    array(
        "mode" => "shipping",
        "firstname" => "testFirstname",
        "lastname" => "testLastname",
        "company" => "testCompany",
        "street" => "testStreet",
        "city" => "testCity",
        "region" => "CA",
        "postcode" => "90049",
        "country_id" => "US",
        "telephone" => "0123456789",
        "fax" => "0123456789",
        "is_default_shipping" => 0,
        "is_default_billing" => 0
    ),
    array(
        "mode" => "billing",
        "firstname" => "testFirstname",
        "lastname" => "testLastname",
        "company" => "testCompany",
        "street" => "testStreet",
        "city" => "testCity",
        "region" => "CA",
        "postcode" => "90049",
        "country_id" => "US",
        "telephone" => "0123456789",
        "fax" => "0123456789",
        "is_default_shipping" => 0,
        "is_default_billing" => 0
    )
);
$resultCustomerAddresses = $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses));

// add products into shopping cart
$arrProducts = array(
    array(
        "product_id" => "1",
        "qty" => 1
    )
);
$resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts));


// get list of products
$shoppingCartProducts = $proxy->call($sessionId, "cart_product.list", array($shoppingCartId));


// set payment method
$paymentMethod = array(
    "method" => "authorizenet",
    "cc_type" => 'MC',
    "cc_number" =>'5555555555554444' ,
    "cc_exp_month" => 9,
    "cc_exp_year" => 2014,
    "cc_cid" => 123     
);
$resultPaymentMethod = $proxy->call($sessionId, "cart_payment.method", array($shoppingCartId, $paymentMethod));


// create order
$resultOrderCreation = $proxy->call($sessionId,"cart.order",array($shoppingCartId));
var_dump($resultOrderCreation);
 ?>
Run Code Online (Sandbox Code Playgroud)

Lee*_*ite 8

根据您的帖子,您对cart_payment.method的调用正在成功,因此CC号码正在按照预期验证为MC卡.

问题在于,由于PCI的考虑,Magento不会在数据库中保存CC号(在大多数情况下).

因此,当您在一个请求中发送付款详细信息以及CC编号和CID,然后在另一个请求中创建订单时,状态将丢失,CC编号和CID将被清空.

创建订单时,第二次验证付款数据,当发生这种情况时,它会有一个空的CC编号,其类型为MC,导致您看到的错误.

不幸的是,我没有看到制作cart.order的方法接受付款数据作为解决方法.

您可以编写一个模块来使用一种新方法扩展结帐API,该方法可以在一次调用中执行这两个步骤,这可能会解决问题.