使用付款方式 ccsave 以编程方式创建订单时出现异常
我是 magento 的新手。 使用付款方式 ccsave 以编程方式创建订单时(用于信用卡付款) 我得到以下异常:
异常“Mage_Core_Exception”,消息“信用卡到期日期不正确”
可能是我的信用卡信息或信用卡设置数据错误。”
$quote->addProduct($product, new Varien_Object(10));
$addressData = array(
'firstname' => $data[2],
'lastname' => $data[3],
'street' => $data[4],
'city' => $data[6],
'postcode' =>$data[8],
'telephone' => $data[9],
'country_id' => 'US',
'region_id' => $data[7]
);
$billingAddress = $quote->getBillingAddress()->addData($addressData);
$shippingAddress = $quote->getShippingAddress()->addData($addressData);
$payment= array(
'cc_owner' => 'ffffffffff',
'cc_type' => 'VI',
'cc_number' => 1234567890123456,
'cc_exp_month' => 11,
'cc_exp_year' => 2015,
'cc_cid' => 123
);
$quote->getPayment()->addData($payment);
$quote->setPaymentData($payment);
$shippingAddress->setBaseShippingAmount(100);
$shippingAddress->setShippingMethod('customshippingrate');
$shippingAddress->setShippingDescription('abcd');
$quote->getPayment()->importData(array('method' => 'ccsave'));
$quote->collectTotals()->save();
Mage::app()->getStore()->setConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_ENABLED, "0");
$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();
I am new to magento.
while creating order programmatically with payment method ccsave (for credit card payment)
I got following exception:
exception 'Mage_Core_Exception' with message 'Incorrect credit card expiration date
may be I am wrong with credit card information or set data about credit card.
$quote->addProduct($product, new Varien_Object(10));
$addressData = array(
'firstname' => $data[2],
'lastname' => $data[3],
'street' => $data[4],
'city' => $data[6],
'postcode' =>$data[8],
'telephone' => $data[9],
'country_id' => 'US',
'region_id' => $data[7]
);
$billingAddress = $quote->getBillingAddress()->addData($addressData);
$shippingAddress = $quote->getShippingAddress()->addData($addressData);
$payment= array(
'cc_owner' => 'ffffffffff',
'cc_type' => 'VI',
'cc_number' => 1234567890123456,
'cc_exp_month' => 11,
'cc_exp_year' => 2015,
'cc_cid' => 123
);
$quote->getPayment()->addData($payment);
$quote->setPaymentData($payment);
$shippingAddress->setBaseShippingAmount(100);
$shippingAddress->setShippingMethod('customshippingrate');
$shippingAddress->setShippingDescription('abcd');
$quote->getPayment()->importData(array('method' => 'ccsave'));
$quote->collectTotals()->save();
Mage::app()->getStore()->setConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_ENABLED, "0");
$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将代码更改为,并解决了异常“Mage_Core_Exception”的问题,并显示消息“信用卡到期日期不正确”
I changed code to and I have solved problem of exception 'Mage_Core_Exception' with message 'Incorrect credit card expiration date'