本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: getCurrencyCode
/**
* Returns currency code
*
* @return string
*/
public function getCurrencyCode()
{
return $this->order->getBaseCurrencyCode();
}
示例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;
}