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


PHP Mage_Sales_Model_Order::getGrandTotal方法代码示例

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


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

示例1: _validate

 /**
  * Check the line items and totals according to PayPal business logic limitations
  */
 protected function _validate()
 {
     $this->_areItemsValid = false;
     $this->_areTotalsValid = false;
     $referenceAmount = $this->_salesEntity->getGrandTotal();
     $itemsSubtotal = 0;
     foreach ($this->_items as $i) {
         $itemsSubtotal = $itemsSubtotal + $i['qty'] * $i['amount'];
     }
     $sum = $itemsSubtotal + $this->_totals[self::TOTAL_TAX];
     if (!$this->_isShippingAsItem) {
         $sum += $this->_totals[self::TOTAL_SHIPPING];
     }
     if (!$this->_isDiscountAsItem) {
         $sum -= $this->_totals[self::TOTAL_DISCOUNT];
     }
     /**
      * numbers are intentionally converted to strings because of possible comparison error
      * see http://php.net/float
      */
     // match sum of all the items and totals to the reference amount
     if (sprintf('%.4F', $sum) == sprintf('%.4F', $referenceAmount)) {
         $this->_areItemsValid = true;
     }
     // PayPal requires to have discount less than items subtotal
     if (!$this->_isDiscountAsItem) {
         $this->_areTotalsValid = round($this->_totals[self::TOTAL_DISCOUNT], 4) < round($itemsSubtotal, 4);
     } else {
         $this->_areTotalsValid = $itemsSubtotal > 1.0E-5;
     }
     $this->_areItemsValid = $this->_areItemsValid && $this->_areTotalsValid;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:35,代码来源:Cart.php

示例2: updateShippingInfo

 /**
  *
  * Update shipping info after notifyRequest
  * @param array $data
  */
 protected function updateShippingInfo($data)
 {
     try {
         $typeChosen = $data['Shipping']['ShippingType'];
         $cost = $data['Shipping']['ShippingCost']['Gross'];
         if (!empty($typeChosen)) {
             $quote = Mage::getModel('sales/quote')->load($this->_order->getQuoteId());
             $address = $quote->getShippingAddress();
             $shipping = Mage::getModel('shipping/shipping');
             $shippingRates = $shipping->collectRatesByAddress($address)->getResult();
             $shippingCostList = array();
             foreach ($shippingRates->getAllRates() as $rate) {
                 $type = $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();
                 if ($type == $typeChosen) {
                     $this->_order->setShippingDescription($typeChosen);
                     $this->_order->setShippingMethod($rate->getCarrier() . "_" . $rate->getMethod());
                     $current = $this->_order->getShippingAmount();
                     $this->_order->setShippingAmount($cost / 100);
                     $this->_order->setGrandTotal($this->_order->getGrandTotal() + $this->_order->getShippingAmount() - $current);
                     $this->_order->save();
                 }
             }
         }
     } catch (Exception $e) {
         Mage::logException("shipping info error: " . $e);
     }
 }
开发者ID:par-orillonsoft,项目名称:plugin_magento,代码行数:32,代码来源:Payment.php

示例3: processOrder

 /**
  * Processes payment for specified order
  * @param Mage_Sales_Model_Order $Order
  * @return
  */
 public function processOrder(Mage_Sales_Model_Order $PrimaryOrder, Mage_Sales_Model_Order $Order = null)
 {
     $amount = $Order->getGrandTotal();
     $increment = $Order->getIncrementId();
     $VendorTxCode = $increment . "-" . date("y-m-d-H-i-s", time()) . "-" . rand(0, 1000000);
     $model = Mage::getModel('sarp/protxDirect')->load($this->getSubscription()->getId(), 'subscription_id');
     $data = array('VPSProtocol' => self::PROTOCOL_VERSION, 'TxType' => self::REPEAT, 'Vendor' => Mage::getStoreConfig(self::VENDOR), 'VendorTxCode' => $VendorTxCode, 'Amount' => $amount, 'Currency' => $Order->getOrderCurrencyCode(), 'Description' => 'Order', 'RelatedVPSTxId' => $model->getVpsTxId(), 'RelatedVendorTxCode' => $model->getVendorTxCode(), 'RelatedSecurityKey' => $model->getSecurityKey(), 'RelatedTxAuthNo' => $model->getTxAuthNo());
     $ready = array();
     foreach ($data as $key => $value) {
         $ready[] = $key . '=' . $value;
     }
     $str = implode('&', $ready);
     switch (Mage::getStoreConfig(self::MODE)) {
         case 'test':
             $url = self::TEST_REPEAT_URL;
             break;
         case 'live':
             $url = self::LIVE_REPEAT_URL;
             break;
         default:
             $url = self::SIMULATOR_REPEAT_URL;
     }
     $ready = $this->requestPost($url, $str);
     if (empty($ready)) {
         throw new AW_Sarp_Exception($this->__("Order cannot be completed. Unknown error"));
     }
     if ($ready['Status'] != 'OK') {
         throw new AW_Sarp_Exception($ready['Status'] . " - " . $ready['StatusDetail']);
     }
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:35,代码来源:ProtxDirect.php

示例4: getOrderItemValue

 /**
  * Retrieve order item value by key
  *
  * @param Mage_Sales_Model_Order $order
  * @param string $key
  * @return string
  */
 public function getOrderItemValue(Mage_Sales_Model_Order $order, $key)
 {
     $escape = true;
     switch ($key) {
         case 'order_increment_id':
             $value = $order->getIncrementId();
             break;
         case 'created_at':
             $value = $this->helper('core')->formatDate($order->getCreatedAt(), 'short', true);
             break;
         case 'shipping_address':
             $value = $order->getShippingAddress() ? $this->htmlEscape($order->getShippingAddress()->getName()) : $this->__('N/A');
             break;
         case 'order_total':
             $value = $order->formatPrice($order->getGrandTotal());
             $escape = false;
             break;
         case 'status_label':
             $value = $order->getStatusLabel();
             break;
         case 'view_url':
             $value = $this->getUrl('*/order/view', array('order_id' => $order->getId()));
             break;
         default:
             $value = $order->getData($key) ? $order->getData($key) : $this->__('N/A');
     }
     return $escape ? $this->escapeHtml($value) : $value;
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:35,代码来源:View.php

示例5: _validateEventData

 /**
  * Checking returned parameters
  * Thorws Mage_Core_Exception if error
  * @param bool $fullCheck Whether to make additional validations such as payment status, transaction signature etc.
  *
  * @return array  $params request params
  */
 protected function _validateEventData($fullCheck = true)
 {
     // get request variables
     $params = $this->_eventData;
     if (empty($params)) {
         Mage::throwException('Request does not contain any elements.');
     }
     // check order ID
     if (empty($params['transaction_id']) || $fullCheck == false && $this->_getCheckout()->getMoneybookersRealOrderId() != $params['transaction_id']) {
         Mage::throwException('Missing or invalid order ID.');
     }
     // load order for further validation
     $this->_order = Mage::getModel('sales/order')->loadByIncrementId($params['transaction_id']);
     if (!$this->_order->getId()) {
         Mage::throwException('Order not found.');
     }
     if (0 !== strpos($this->_order->getPayment()->getMethodInstance()->getCode(), 'moneybookers_')) {
         Mage::throwException('Unknown payment method.');
     }
     // make additional validation
     if ($fullCheck) {
         // check payment status
         if (empty($params['status'])) {
             Mage::throwException('Unknown payment status.');
         }
         // check transaction signature
         if (empty($params['md5sig'])) {
             Mage::throwException('Invalid transaction signature.');
         }
         $checkParams = array('merchant_id', 'transaction_id', 'secret', 'mb_amount', 'mb_currency', 'status');
         $md5String = '';
         foreach ($checkParams as $key) {
             if ($key == 'merchant_id') {
                 $md5String .= Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_CUSTOMER_ID, $this->_order->getStoreId());
             } elseif ($key == 'secret') {
                 $secretKey = Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_SECRET_KEY, $this->_order->getStoreId());
                 if (empty($secretKey)) {
                     Mage::throwException('Secret key is empty.');
                 }
                 $md5String .= strtoupper(md5($secretKey));
             } elseif (isset($params[$key])) {
                 $md5String .= $params[$key];
             }
         }
         $md5String = strtoupper(md5($md5String));
         if ($md5String != $params['md5sig']) {
             Mage::throwException('Hash is not valid.');
         }
         // check transaction amount if currency matches
         if ($this->_order->getOrderCurrencyCode() == $params['mb_currency']) {
             if (round($this->_order->getGrandTotal(), 2) != $params['mb_amount']) {
                 Mage::throwException('Transaction amount does not match.');
             }
         }
     }
     return $params;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:64,代码来源:Event.php

示例6: _prepareOrderData

 /**
  * @return array
  */
 protected function _prepareOrderData()
 {
     // magento 1.5 compat
     $shipping_method_c = $this->_order->getShippingMethod(true);
     $shipping_method = $this->_order->getData('shipping_method');
     $shipping_method_code = $shipping_method_c ? $shipping_method_c->getData('carrier_code') : $shipping_method;
     $data = array_filter(array('currency_code' => $this->_order->getOrderCurrencyCode(), 'shipping_method_code' => $shipping_method_code, 'shipping_method_title' => $this->_order->getShippingDescription(), 'created_on' => $this->_order->getCreatedAt(), 'updated_on' => $this->_order->getUpdatedAt(), 'state' => $this->_order->getState(), 'status' => $this->_order->getStatus(), 'is_gift' => $this->_order->getGiftMessageId() != null, 'ref_quote_id' => $this->_order->getQuoteId(), 'order_subtotal_with_tax' => $this->_order->getSubtotalInclTax(), 'order_subtotal' => $this->_order->getSubtotal(), 'order_tax' => $this->_order->getTaxAmount(), 'order_hidden_tax' => $this->_order->getHiddenTaxAmount(), 'order_shipping_with_tax' => $this->_order->getShippingInclTax(), 'order_shipping' => $this->_order->getShippingAmount(), 'order_discount' => $this->_order->getDiscountAmount(), 'order_shipping_discount' => $this->_order->getShippingDiscountAmount(), 'order_total' => $this->_order->getGrandTotal(), 'order_total_items' => $this->_order->getTotalItemCount()));
     return $data;
 }
开发者ID:payin7-payments,项目名称:payin7-magento,代码行数:12,代码来源:Submit.php

示例7: getCreditCardInstallmentsParams

 /**
  * Return an array with installment information to be used with API
  * @param Mage_Sales_Model_Order $order
  * @param $payment Mage_Sales_Model_Order_Payment
  * @return array
  */
 public function getCreditCardInstallmentsParams(Mage_Sales_Model_Order $order, $payment)
 {
     $return = array();
     if ($payment->getAdditionalInformation('installment_quantity') && $payment->getAdditionalInformation('installment_value')) {
         $return = array('installmentQuantity' => $payment->getAdditionalInformation('installment_quantity'), 'installmentValue' => number_format($payment->getAdditionalInformation('installment_value'), 2, '.', ''));
     } else {
         $return = array('installmentQuantity' => '1', 'installmentValue' => number_format($order->getGrandTotal(), 2, '.', ''));
     }
     return $return;
 }
开发者ID:brunoalbim,项目名称:PagSeguro-Magento-Transparente,代码行数:16,代码来源:Params.php

示例8: collect

 public function collect(Mage_Sales_Model_Order $order)
 {
     $order->setData('zitec_dpd_cashondelivery_surcharge', 0);
     $order->setData('base_zitec_dpd_cashondelivery_surcharge', 0);
     $amount = $order->getOrder()->getData('zitec_dpd_cashondelivery_surcharge');
     $order->setData('zitec_dpd_cashondelivery_surcharge', $amount);
     $amount = $order->getOrder()->getData('base_zitec_dpd_cashondelivery_surcharge');
     $order->setData('base_zitec_dpd_cashondelivery_surcharge', $amount);
     $order->setGrandTotal($order->getGrandTotal() + $order->getData('zitec_dpd_cashondelivery_surcharge'));
     $order->setBaseGrandTotal($order->getBaseGrandTotal() + $order->getData('base_zitec_dpd_cashondelivery_surcharge'));
     return $this;
 }
开发者ID:GabrielCC,项目名称:zitec-dpd-master,代码行数:12,代码来源:Cashondeliverysurchage.php

示例9: getScript

 public function getScript()
 {
     $request = Mage::app()->getRequest();
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $flag = false;
     $currency = Mage::app()->getStore()->getCurrentCurrencyCode();
     $script = "<script>var apiKey = '" . $this->getKey() . "';</script>" . "\n";
     if ($module == 'checkout' && $controller == 'onestep' && $action == 'success' || $module == 'checkout' && $controller == 'onepage' && $action == 'success' || $module == 'securecheckout' && $controller == 'index' && $action == 'success' || $module == 'customdownloadable' && $controller == 'onepage' && $action == 'success' || $module == 'onepagecheckout' && $controller == 'index' && $action == 'success' || $module == 'onestepcheckout' && $controller == 'index' && $action == 'success') {
         $order = new Mage_Sales_Model_Order();
         $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
         $order->loadByIncrementId($orderId);
         // Load order details
         $order_total = round($order->getGrandTotal(), 2);
         // Get grand total
         $order_coupon = $order->getCouponCode();
         // Get coupon used
         $items = $order->getAllItems();
         // Get items info
         $cartInfo = array();
         // Convert object to string
         foreach ($items as $item) {
             $product = Mage::getModel('catalog/product')->load($item->getProductId());
             $name = $item->getName();
             $qty = $item->getQtyToInvoice();
             $cartInfo[] = array('id' => $item->getProductId(), 'name' => $name, 'quantity' => $qty);
         }
         $cartInfoString = serialize($cartInfo);
         $cartInfoString = addcslashes($cartInfoString, "'");
         $order_name = $order->getCustomerName();
         // Get customer's name
         $order_email = $order->getCustomerEmail();
         // Get customer's email id
         // Call invoiceRefiral function
         $scriptAppend = "<script>whenAvailable('invoiceRefiral',function(){invoiceRefiral('{$order_total}','{$order_total}','{$order_coupon}','{$cartInfoString}','{$order_name}','{$order_email}','{$orderId}', '{$currency}')});</script>" . "\n";
         if ($this->debug()) {
             $scriptAppend .= "<script>console.log('Module: " . $module . ", Controller: " . $controller . ", Action: " . $action . "');</script>";
             $scriptAppend .= "<script>console.log('Total: " . $order_total . ", Coupon: " . $order_coupon . ", Cart: " . $cartInfoString . ", Name: " . $order_name . ", Email: " . $order_email . ", Id: " . $orderId . ", Currency: " . $currency . "');</script>";
         }
         $script .= '<script>var showButton = false;</script>' . "\n";
     } else {
         if ($this->debug()) {
             $scriptAppend = "<script>console.log('Module: " . $module . ", Controller: " . $controller . ", Action: " . $action . "');</script>";
         } else {
             $scriptAppend = '';
         }
         $script .= '<script>var showButton = true;</script>' . "\n";
     }
     $script .= '<script type="text/javascript">(function e(){var e=document.createElement("script");e.type="text/javascript",e.async=true,e.src="//rfer.co/api/v1/js/all.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();</script>' . "\n";
     return $script . $scriptAppend;
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:52,代码来源:Data.php

示例10: processOrder

 /**
  * Processes payment for specified order
  * @param Mage_Sales_Model_Order $Order
  * @return
  */
 public function processOrder(Mage_Sales_Model_Order $PrimaryOrder, Mage_Sales_Model_Order $Order = null)
 {
     $pnref = $this->getSubscription()->getRealId();
     $amt = $Order->getGrandTotal();
     $this->getWebService()->setStoreId($this->getSubscription()->getStoreId())->getRequest()->reset()->setData(array('ORIGID' => $pnref, 'AMT' => floatval($amt)));
     if (strtolower(Mage::getStoreConfig(self::XML_PATH_PPUK_PAYMENT_ACTION) == 'sale')) {
         $result = $this->getWebService()->referenceCaptureAction();
     } else {
         $result = $this->getWebService()->referenceAuthAction();
     }
     if ($result->getResult() . '' == '0') {
         // Payment Succeded
     } else {
         throw new Mage_Core_Exception(Mage::helper('sarp')->__("PayFlow " . Mage::getStoreConfig(self::XML_PATH_PPUK_PAYMENT_ACTION) . " failed:[%s] %s", $result->getResult(), $result->getRespmsg()));
     }
 }
开发者ID:xiaoguizhidao,项目名称:mydigibits,代码行数:21,代码来源:Direct.php

示例11: addPaymentsToPayload

 /**
  * Make prepaid credit card payloads for any payments
  * remaining in the list
  * @param Mage_Sales_Model_Order $order
  * @param IPaymentContainer      $paymentContainer
  * @param SplObjectStorage       $processedPayments
  */
 public function addPaymentsToPayload(Mage_Sales_Model_Order $order, IPaymentContainer $paymentContainer, SplObjectStorage $processedPayments)
 {
     foreach ($order->getAllPayments() as $payment) {
         if ($this->_shouldIgnorePayment($payment, $processedPayments)) {
             continue;
         }
         $iterable = $paymentContainer->getPayments();
         $payload = $iterable->getEmptyPayPalPayment();
         $additionalInfo = new Varien_Object($payment->getAdditionalInformation());
         // use the grand total since it has already been adjusted for redeemed giftcards
         // by the the giftcard module's total collector.
         $amount = $order->getGrandTotal();
         $payload->setAmount($amount)->setAmountAuthorized($amount)->setCreateTimestamp($this->_getAsDateTime($payment->getCreatedAt()))->setAuthorizationResponseCode(self::AUTH_RESPONSE_CODE)->setOrderId($order->getIncrementId())->setTenderType(self::TENDER_TYPE)->setPanIsToken(true)->setAccountUniqueId(self::ACCOUNT_UNIQUE_ID)->setPaymentRequestId($additionalInfo->getAuthRequestId());
         // add the new payload
         $iterable->OffsetSet($payload, $payload);
         // put the payment in the processed payments set
         $processedPayments->attach($payment);
     }
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:26,代码来源:Payment.php

示例12: getAmount

 /**
  * Get the amount of the order in cents, make sure that we return the right value even if the locale is set to
  * something different than the default (e.g. nl_NL).
  *
  * @param Mage_Sales_Model_Order $order
  * @return int
  */
 protected function getAmount(Mage_Sales_Model_Order $order)
 {
     if ($order->getBaseCurrencyCode() === 'EUR') {
         $grand_total = $order->getBaseGrandTotal();
     } elseif ($order->getOrderCurrencyCode() === 'EUR') {
         $grand_total = $order->getGrandTotal();
     } else {
         Mage::log(__METHOD__ . ' said: Neither Base nor Order currency is in Euros.');
         Mage::throwException(__METHOD__ . ' said: Neither Base nor Order currency is in Euros.');
     }
     if (is_string($grand_total)) {
         $locale_info = localeconv();
         if ($locale_info['decimal_point'] !== '.') {
             $grand_total = strtr($grand_total, array($locale_info['thousands_sep'] => '', $locale_info['decimal_point'] => '.'));
         }
         $grand_total = floatval($grand_total);
         // Why U NO work with locales?
     }
     return floatval(round($grand_total, 2));
 }
开发者ID:Archipel,项目名称:Magento,代码行数:27,代码来源:ApiController.php

示例13: _processIncorrectPayment

 /**
  * Processes an order for which an incorrect amount has been paid (can only happen with Transfer)
  *
  * @param $newStates
  * @return bool
  */
 protected function _processIncorrectPayment($newStates)
 {
     //determine whether too much or not enough has been paid and determine the status history copmment accordingly
     $amount = round($this->_order->getBaseGrandTotal() * 100, 0);
     $setStatus = $newStates[1];
     if ($this->_postArray['brq_currency'] == $this->_order->getBaseCurrencyCode()) {
         $currencyCode = $this->_order->getBaseCurrencyCode();
         $orderAmount = $this->_order->getBaseGrandTotal();
     } else {
         $currencyCode = $this->_order->getOrderCurrencyCode();
         $orderAmount = $this->_order->getGrandTotal();
     }
     if ($amount > $this->_postArray['brq_amount']) {
         $description = Mage::helper('buckaroo3extended')->__('Not enough paid: %s has been transfered. Order grand total was: %s.', Mage::app()->getLocale()->currency($currencyCode)->toCurrency($this->_postArray['brq_amount']), Mage::app()->getLocale()->currency($currencyCode)->toCurrency($orderAmount));
     } elseif ($amount < $this->_postArray['brq_amount']) {
         $description = Mage::helper('buckaroo3extended')->__('Too much paid: %s has been transfered. Order grand total was: %s.', Mage::app()->getLocale()->currency($currencyCode)->toCurrency($this->_postArray['brq_amount']), Mage::app()->getLocale()->currency($currencyCode)->toCurrency($orderAmount));
     } else {
         //the correct amount was actually paid, so return false
         return false;
     }
     //hold the order
     $this->_order->hold()->save()->setStatus($setStatus)->save()->addStatusHistoryComment(Mage::helper('buckaroo3extended')->__($description), $setStatus)->save();
     return true;
 }
开发者ID:technomagegithub,项目名称:olgo.nl,代码行数:30,代码来源:Push.php

示例14: addInterestToOrder

 /**
  * Add interest to order
  */
 protected function addInterestToOrder(Mage_Sales_Model_Order $order, $interest)
 {
     $mundipaggInterest = $order->getMundipaggInterest();
     $setInterest = (double) ($mundipaggInterest + $interest);
     $order->setMundipaggInterest($setInterest ? $setInterest : 0);
     $order->setMundipaggBaseInterest($setInterest ? $setInterest : 0);
     $order->setGrandTotal($order->getGrandTotal() + $interest);
     $order->setBaseGrandTotal($order->getBaseGrandTotal() + $interest);
     $order->save();
     //        $info = $this->getInfoInstance();
     //        $info->setPaymentInterest(($info->getPaymentInterest()+$setInterest));
     //        $info->save();
 }
开发者ID:rorteg,项目名称:rafaelmage,代码行数:16,代码来源:Standard.php

示例15: CreateMagentoShopRequestOrder

 function CreateMagentoShopRequestOrder(Mage_Sales_Model_Order $order, $paymentmethod)
 {
     $request = new Byjuno_Cdp_Helper_Api_Classes_ByjunoRequest();
     $request->setClientId(Mage::getStoreConfig('payment/cdp/clientid', Mage::app()->getStore()));
     $request->setUserID(Mage::getStoreConfig('payment/cdp/userid', Mage::app()->getStore()));
     $request->setPassword(Mage::getStoreConfig('payment/cdp/password', Mage::app()->getStore()));
     $request->setVersion("1.00");
     try {
         $request->setRequestEmail(Mage::getStoreConfig('payment/cdp/mail', Mage::app()->getStore()));
     } catch (Exception $e) {
     }
     $b = $order->getCustomerDob();
     if (!empty($b)) {
         $request->setDateOfBirth(Mage::getModel('core/date')->date('Y-m-d', strtotime($b)));
     }
     $g = $order->getCustomerGender();
     if (!empty($g)) {
         if ($g == '1') {
             $request->setGender('1');
         } else {
             if ($g == '2') {
                 $request->setGender('2');
             }
         }
     }
     $requestId = uniqid((string) $order->getBillingAddress()->getId() . "_");
     $request->setRequestId($requestId);
     $reference = $order->getCustomerId();
     if (empty($reference)) {
         $request->setCustomerReference("guest_" . $order->getBillingAddress()->getId());
     } else {
         $request->setCustomerReference($order->getCustomerId());
     }
     $request->setFirstName((string) $order->getBillingAddress()->getFirstname());
     $request->setLastName((string) $order->getBillingAddress()->getLastname());
     $request->setFirstLine(trim((string) $order->getBillingAddress()->getStreetFull()));
     $request->setCountryCode(strtoupper((string) $order->getBillingAddress()->getCountry()));
     $request->setPostCode((string) $order->getBillingAddress()->getPostcode());
     $request->setTown((string) $order->getBillingAddress()->getCity());
     $request->setFax((string) trim($order->getBillingAddress()->getFax(), '-'));
     $request->setLanguage((string) substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2));
     if ($order->getBillingAddress()->getCompany()) {
         $request->setCompanyName1($order->getBillingAddress()->getCompany());
     }
     $request->setTelephonePrivate((string) trim($order->getBillingAddress()->getTelephone(), '-'));
     $request->setEmail((string) $order->getBillingAddress()->getEmail());
     $extraInfo["Name"] = 'ORDERCLOSED';
     $extraInfo["Value"] = 'NO';
     $request->setExtraInfo($extraInfo);
     $extraInfo["Name"] = 'ORDERAMOUNT';
     $extraInfo["Value"] = number_format($order->getGrandTotal(), 2, '.', '');
     $request->setExtraInfo($extraInfo);
     $extraInfo["Name"] = 'ORDERCURRENCY';
     $extraInfo["Value"] = $order->getBaseCurrencyCode();
     $request->setExtraInfo($extraInfo);
     /* shipping information */
     if ($order->canShip()) {
         $extraInfo["Name"] = 'DELIVERY_FIRSTNAME';
         $extraInfo["Value"] = $order->getShippingAddress()->getFirstname();
         $request->setExtraInfo($extraInfo);
         $extraInfo["Name"] = 'DELIVERY_LASTNAME';
         $extraInfo["Value"] = $order->getShippingAddress()->getLastname();
         $request->setExtraInfo($extraInfo);
         $extraInfo["Name"] = 'DELIVERY_FIRSTLINE';
         $extraInfo["Value"] = trim($order->getShippingAddress()->getStreetFull());
         $request->setExtraInfo($extraInfo);
         $extraInfo["Name"] = 'DELIVERY_HOUSENUMBER';
         $extraInfo["Value"] = '';
         $request->setExtraInfo($extraInfo);
         $extraInfo["Name"] = 'DELIVERY_COUNTRYCODE';
         $extraInfo["Value"] = strtoupper($order->getShippingAddress()->getCountry());
         $request->setExtraInfo($extraInfo);
         $extraInfo["Name"] = 'DELIVERY_POSTCODE';
         $extraInfo["Value"] = $order->getShippingAddress()->getPostcode();
         $request->setExtraInfo($extraInfo);
         $extraInfo["Name"] = 'DELIVERY_TOWN';
         $extraInfo["Value"] = $order->getShippingAddress()->getCity();
         $request->setExtraInfo($extraInfo);
         if ($order->getShippingAddress()->getCompany() != '' && Mage::getStoreConfig('payment/api/businesstobusiness', Mage::app()->getStore()) == 'enable') {
             $extraInfo["Name"] = 'DELIVERY_COMPANYNAME';
             $extraInfo["Value"] = $order->getShippingAddress()->getCompany();
             $request->setExtraInfo($extraInfo);
         }
     }
     $extraInfo["Name"] = 'PP_TRANSACTION_NUMBER';
     $extraInfo["Value"] = $requestId;
     $request->setExtraInfo($extraInfo);
     $extraInfo["Name"] = 'ORDERID';
     $extraInfo["Value"] = $order->getIncrementId();
     $request->setExtraInfo($extraInfo);
     $extraInfo["Name"] = 'PAYMENTMETHOD';
     $extraInfo["Value"] = 'BYJUNO-INVOICE';
     $request->setExtraInfo($extraInfo);
     $extraInfo["Name"] = 'CONNECTIVTY_MODULE';
     $extraInfo["Value"] = 'Byjuno Magento module 1.0.0';
     $request->setExtraInfo($extraInfo);
     return $request;
 }
开发者ID:istgin,项目名称:Byjuno,代码行数:98,代码来源:Data.php


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