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


PHP Order::getBaseCurrencyCode方法代码示例

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


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

示例1: setDataFromOrder

 /**
  * Set entity data to request
  *
  * @param \Magento\Sales\Model\Order $order
  * @param \Magento\Authorizenet\Model\Directpost $paymentMethod
  * @return $this
  */
 public function setDataFromOrder(\Magento\Sales\Model\Order $order, \Magento\Authorizenet\Model\Directpost $paymentMethod)
 {
     $payment = $order->getPayment();
     $this->setXType($payment->getAnetTransType());
     $this->setXFpSequence($order->getQuoteId());
     $this->setXInvoiceNum($order->getIncrementId());
     $this->setXAmount($payment->getBaseAmountAuthorized());
     $this->setXCurrencyCode($order->getBaseCurrencyCode());
     $this->setXTax(sprintf('%.2F', $order->getBaseTaxAmount()))->setXFreight(sprintf('%.2F', $order->getBaseShippingAmount()));
     //need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript,
     //but we need "" for null values.
     $billing = $order->getBillingAddress();
     if (!empty($billing)) {
         $this->setXFirstName(strval($billing->getFirstname()))->setXLastName(strval($billing->getLastname()))->setXCompany(strval($billing->getCompany()))->setXAddress(strval($billing->getStreetLine(1)))->setXCity(strval($billing->getCity()))->setXState(strval($billing->getRegion()))->setXZip(strval($billing->getPostcode()))->setXCountry(strval($billing->getCountry()))->setXPhone(strval($billing->getTelephone()))->setXFax(strval($billing->getFax()))->setXCustId(strval($billing->getCustomerId()))->setXCustomerIp(strval($order->getRemoteIp()))->setXCustomerTaxId(strval($billing->getTaxId()))->setXEmail(strval($order->getCustomerEmail()))->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer')))->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email')));
     }
     $shipping = $order->getShippingAddress();
     if (!empty($shipping)) {
         $this->setXShipToFirstName(strval($shipping->getFirstname()))->setXShipToLastName(strval($shipping->getLastname()))->setXShipToCompany(strval($shipping->getCompany()))->setXShipToAddress(strval($shipping->getStreetLine(1)))->setXShipToCity(strval($shipping->getCity()))->setXShipToState(strval($shipping->getRegion()))->setXShipToZip(strval($shipping->getPostcode()))->setXShipToCountry(strval($shipping->getCountry()));
     }
     $this->setXPoNum(strval($payment->getPoNumber()));
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:29,代码来源:Request.php

示例2: _getOrderData

 /**
  * Get order request data as array
  *
  * @param \Magento\Sales\Model\Order $order
  * @return array
  */
 protected function _getOrderData(\Magento\Sales\Model\Order $order)
 {
     $request = array('subtotal' => $this->_formatPrice($this->_formatPrice($order->getPayment()->getBaseAmountAuthorized()) - $this->_formatPrice($order->getBaseTaxAmount()) - $this->_formatPrice($order->getBaseShippingAmount())), 'tax' => $this->_formatPrice($order->getBaseTaxAmount()), 'shipping' => $this->_formatPrice($order->getBaseShippingAmount()), 'invoice' => $order->getIncrementId(), 'address_override' => 'true', 'currency_code' => $order->getBaseCurrencyCode(), 'buyer_email' => $order->getCustomerEmail());
     // append to request billing address data
     if ($billingAddress = $order->getBillingAddress()) {
         $request = array_merge($request, $this->_getBillingAddress($billingAddress));
     }
     // append to request shipping address data
     if ($shippingAddress = $order->getShippingAddress()) {
         $request = array_merge($request, $this->_getShippingAddress($shippingAddress));
     }
     return $request;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:19,代码来源:Request.php

示例3: _getOrderData

 /**
  * Get order request data as array
  *
  * @param \Magento\Sales\Model\Order $order
  * @return array
  */
 protected function _getOrderData(\Magento\Sales\Model\Order $order)
 {
     $request = ['invoice' => $order->getIncrementId(), 'address_override' => 'true', 'currency_code' => $order->getBaseCurrencyCode(), 'buyer_email' => $order->getCustomerEmail()];
     // append to request billing address data
     if ($billingAddress = $order->getBillingAddress()) {
         $request = array_merge($request, $this->_getBillingAddress($billingAddress));
     }
     // append to request shipping address data
     if ($shippingAddress = $order->getShippingAddress()) {
         $request = array_merge($request, $this->_getShippingAddress($shippingAddress));
     }
     return $request;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:Request.php

示例4: getCurrencyCode

 /**
  * Returns currency code
  *
  * @return string
  */
 public function getCurrencyCode()
 {
     return $this->order->getBaseCurrencyCode();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:OrderAdapter.php

示例5: _checkIpnRequest

 protected function _checkIpnRequest()
 {
     $request = $this->getRequest()->getPost();
     $this->_order = $this->_getOrder($request['ordernumber']);
     // check order ID
     $orderId = $this->_order->getRealOrderId();
     if ($orderId != $request['ordernumber']) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Order not found'));
     }
     $this->_paymentInst = $this->_order->getPayment()->getMethodInstance();
     // check merchant ID
     if ($this->_paymentInst->getConfigData('merchant') != $request['merchant_id']) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Invalid merchant ID: ' . $request['merchant_id']));
     }
     // failed operation
     if ('AS000' != $request['responsecode']) {
         throw new \Magento\Framework\Exception\LocalizedException($this->_paymentInst->getAssistErrors($request['responsecode']));
     }
     // wrong test mode
     if ($this->_paymentInst->getConfigData('mode') != $request['testmode']) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Wrong Test Mode.'));
     }
     // accept only Approve operations, cancel and capture are processed real time
     if ('100' != $request['operationtype']) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Wrong Operation Type. Only Approve is supported by IPN.'));
     }
     // check currency
     if ($this->_order->getBaseCurrencyCode() != $request['ordercurrency']) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Invalid currency: ' . $request['ordercurrency']));
     }
     // check amount
     $orderAmount = number_format($this->_order->getGrandTotal(), 2, '.', '');
     if ($orderAmount != $request['orderamount']) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Invalid amount: ' . $request['orderamount']));
     }
     /*
     if (Mage::helper('assist')->isResponseSecuredMd5()) {
         $x = array(
             $this->_paymentInst->getConfigData('merchant'),
             $request['ordernumber'],
             $request['amount'],
             $request['currency'],
             $request['orderstate']
         );
         if ($this->_paymentInst->secreyKey(implode("", $x)) != $request['checkvalue']) {
             Mage::throwException('Incorrect Checkvalue: ' . $request['checkvalue']);
         }
     }
     if (Mage::helper('assist')->isResponseSecuredPgp()) {
         $y = implode("", array(
             $this->_paymentInst->getConfigData('merchant'),
             $request['ordernumber'],
             $request['amount'], 
             $request['currency'],
             $request['orderstate']
         ));
         $keyFile = Mage::getBaseDir('var') . DS . 'assist' . DS . $this->_paymentInst->getConfigData('assist_key');
         if ($this->_paymentInst->sign($y, $keyFile) != $request['signature']) {
             Mage::throwException('Incorrect Signature.');
         }
     }
     */
     return $request;
 }
开发者ID:vuleticd,项目名称:vuleticd_assist2,代码行数:64,代码来源:Ipn.php


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