Magento如何为Authorize.net保存信用卡详细信息

时间:2014-07-23 06:15:53

标签: magento

我在magento网站上使用authorize.net支付门。我想自动重新订购之前收到的订单。我已经在admin中制定了计划功能,我可以从中安排订单但是我想在点击您想要保存卡详细信息时保存客户的付款详细信息如需重新订购此订单?在authorize.net付款部分。或者他点击订单审核部分的下订单。 怎么办?我尝试在OnepageController.php中跟随代码,方法是在local:

中覆盖它
<?php

require_once "Mage/Checkout/controllers/OnepageController.php";

class Supplycity_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
    public function savePaymentAction()
    {
        if ($this->_expireAjax()) {
            return;
        }
        try {
            if (!$this->getRequest()->isPost()) {
                $this->_ajaxRedirectResponse();
                return;
            }

            $data = $this->getRequest()->getPost('payment', array());
        if(Mage::getSingleton('customer/session')->isLoggedIn()) {

     $customerData = Mage::getSingleton('customer/session')->getCustomer();
      $data['customerid']= $customerData->getId();
      $dedata=json_decode(json_encode($data));
          if($data['isreorder']==2)
                {
          //Mage::getSingleton('customer/session')->setIsreorder("1");
            $connection = Mage::getSingleton('core/resource')
            ->getConnection('core_write');
            $connection->beginTransaction();
            $fields = array();
            $fields['customerid']=$customerData->getId();
            $fields['cc_type']=$dedata->cc_type;
            $fields['cc_number']=base64_decode($dedata->cc_number);
            $fields['cc_exp_month']=$dedata->cc_exp_month;
            $fields['cc_exp_year']=$dedata->cc_exp_year;
            $fields['method']=$dedata->method;
                    $fields['cc_owner']=$dedata->cc_owner;
            $fields['cc_cid']=$dedata->cc_cid; 
            $connection->insert('reorder_payement', $fields);
            $connection->commit();
        }

        }

            $result = $this->getOnepage()->savePayment($data);
       //  print_r($data);die();
            // get section and redirect data
            $redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
            if (empty($result['error']) && !$redirectUrl) {
                $this->loadLayout('checkout_onepage_review');
                $result['goto_section'] = 'review';
                $result['update_section'] = array(
                    'name' => 'review',
                    'html' => $this->_getReviewHtml()
                );
            }
            if ($redirectUrl) {
                $result['redirect'] = $redirectUrl;
            }


        } catch (Mage_Payment_Exception $e) {
            if ($e->getFields()) {
                $result['fields'] = $e->getFields();
            }
            $result['error'] = $e->getMessage();
        } catch (Mage_Core_Exception $e) {
            $result['error'] = $e->getMessage();
        } catch (Exception $e) {
            Mage::logException($e);
            //$result['error'] = $this->__('Unable to set Payment Method.');
      $result['error'] = $e->getMessage();
        }
        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
    }

}

我可以保存所有数据,如信用卡月,年,方法但无法获取信用卡号请提供指导我该怎么办?

0 个答案:

没有答案