当前位置: 首页>>代码示例>>PHP>>正文


PHP VirtueMartCart::emptyCart方法代码示例

本文整理汇总了PHP中VirtueMartCart::emptyCart方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtueMartCart::emptyCart方法的具体用法?PHP VirtueMartCart::emptyCart怎么用?PHP VirtueMartCart::emptyCart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VirtueMartCart的用法示例。


在下文中一共展示了VirtueMartCart::emptyCart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: plgVmConfirmedOrder

 /**
  * Reimplementation of vmPaymentPlugin::plgVmOnConfirmedOrder()
  *
  * @link http://www.authorize.net/support/AIM_guide.pdf
  * Credit Cards Test Numbers
  * Visa Test Account           4007000000027
  * Amex Test Account           370000000000002
  * Master Card Test Account    6011000000000012
  * Discover Test Account       5424000000000015
  * @author Valerie Isaksen
  */
 function plgVmConfirmedOrder(VirtueMartCart $cart, $order)
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     $usrBT = $order['details']['BT'];
     $usrST = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $transaction_key = $this->get_passkey();
     if ($transaction_key === FALSE) {
         return FALSE;
     }
     $payment_currency_id = shopFunctions::getCurrencyIDByName(self::AUTHORIZE_PAYMENT_CURRENCY);
     $paymentCurrency = CurrencyDisplay::getInstance($payment_currency_id);
     $totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo(self::AUTHORIZE_PAYMENT_CURRENCY, $order['details']['BT']->order_total, FALSE), 2);
     $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
     // Set up data
     $formdata = array();
     $formdata = array_merge($this->_setHeader(), $formdata);
     $formdata = array_merge($this->_setResponseConfiguration(), $formdata);
     $formdata = array_merge($this->_setBillingInformation($usrBT), $formdata);
     $formdata = array_merge($this->_setShippingInformation($usrST), $formdata);
     $formdata = array_merge($this->_setTransactionData($order['details']['BT'], $method, $totalInPaymentCurrency), $formdata);
     $formdata = array_merge($this->_setMerchantData($method), $formdata);
     // prepare the array to post
     $poststring = '';
     foreach ($formdata as $key => $val) {
         $poststring .= urlencode($key) . "=" . urlencode($val) . "&";
     }
     $poststring = rtrim($poststring, "& ");
     // Prepare data that should be stored in the database
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['virtuemart_order_id'] = $order['details']['BT']->virtuemart_order_id;
     $dbValues['payment_method_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
     $dbValues['return_context'] = $return_context;
     $dbValues['payment_name'] = parent::renderPluginName($method);
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency;
     $dbValues['payment_currency'] = $payment_currency_id;
     $this->storePSPluginInternalData($dbValues);
     // send a request
     $response = $this->_sendRequest($this->_getPostUrl($method), $poststring);
     $this->logInfo($response);
     $authnet_values = array();
     // to check the values???
     // evaluate the response
     $html = $this->_handleResponse($response, $authnet_values, $order, $dbValues['payment_name']);
     if ($this->error) {
         $new_status = $method->payment_declined_status;
         $this->_handlePaymentCancel($order['details']['BT']->virtuemart_order_id, $html);
         return;
         // will not process the order
     } else {
         if ($this->approved) {
             $this->_clearAuthorizeNetSession();
             $new_status = $method->payment_approved_status;
         } else {
             if ($this->declined) {
                 JRequest::setVar('html', $html);
                 $new_status = $method->payment_declined_status;
                 $this->_handlePaymentCancel($order['details']['BT']->virtuemart_order_id, $html);
                 return;
             } else {
                 if ($this->held) {
                     $this->_clearAuthorizeNetSession();
                     $new_status = $method->payment_held_status;
                 }
             }
         }
     }
     $modelOrder = VmModel::getModel('orders');
     $order['order_status'] = $new_status;
     $order['customer_notified'] = 1;
     $order['comments'] = '';
     $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
     //We delete the old stuff
     $cart->emptyCart();
     JRequest::setVar('html', $html);
 }
开发者ID:Roma48,项目名称:abazherka_old,代码行数:96,代码来源:authorizenet.php

示例2: plgVmConfirmedOrder

 function plgVmConfirmedOrder(VirtueMartCart $cart, $order)
 {
     if (!($this->_currentMethod = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return null;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($this->_currentMethod->payment_element)) {
         return FALSE;
     }
     $session = JFactory::getSession();
     $return_context = $session->getId();
     // Prepare data that should be stored in the database
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['virtuemart_order_id'] = $order['details']['BT']->virtuemart_order_id;
     $dbValues['payment_method_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
     $dbValues['return_context'] = $return_context;
     $dbValues['payment_name'] = parent::renderPluginName($this->_currentMethod);
     $dbValues['cost_per_transaction'] = $this->_currentMethod->cost_per_transaction;
     $dbValues['cost_percent_total'] = $this->_currentMethod->cost_percent_total;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['payment_currency'] = $payment_currency_id;
     $this->debugLog("before store", "plgVmConfirmedOrder", 'debug');
     if ($this->_currentMethod->sandbox) {
         Everypay\Everypay::$isTest = true;
     }
     Everypay\Everypay::setApiKey($this->getSecretKey());
     $token = $this->getToken();
     $response = Everypay\Payment::create(array('token' => $token, 'description' => 'Order #' . $order['details']['BT']->order_number));
     if (isset($response->error)) {
         $new_status = $this->_currentMethod->payment_declined_status;
         $this->_handlePaymentCancel($order['details']['BT']->virtuemart_order_id, $html);
         return;
         // will not process the order
     }
     $dbValues['everypay_response_token'] = $response->token;
     $dbValues['everypay_response_description'] = $response->description;
     $dbValues['everypay_response_status'] = $response->status;
     $dbValues['everypay_response_last_four'] = $response->last_four;
     $dbValues['everypay_response_holder_name'] = $response->holder_name;
     $dbValues['payment_order_total'] = number_format($response->amount / 100, 2);
     $this->storePSPluginInternalData($dbValues);
     $cart->emptyCart();
     $session = JFactory::getSession();
     $session->clear('everypay_token', 'vm');
 }
开发者ID:everypay,项目名称:everypay-virtuemart,代码行数:45,代码来源:everypay.php


注:本文中的VirtueMartCart::emptyCart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。