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


PHP Order::getIsVirtual方法代码示例

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


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

示例1: _setPaymentAuthorized

 /**
  * @param bool $manualReviewComment
  * @param bool $createInvoice
  * @throws Exception
  */
 protected function _setPaymentAuthorized($manualReviewComment = true, $createInvoice = false)
 {
     $this->_adyenLogger->addAdyenNotificationCronjob('Set order to authorised');
     // if full amount is captured create invoice
     $currency = $this->_order->getOrderCurrencyCode();
     $amount = $this->_value;
     $orderAmount = (int) $this->_adyenHelper->formatAmount($this->_order->getGrandTotal(), $currency);
     // create invoice for the capture notification if you are on manual capture
     if ($createInvoice == true && $amount == $orderAmount) {
         $this->_adyenLogger->addAdyenNotificationCronjob('amount notification:' . $amount . ' amount order:' . $orderAmount);
         $this->_createInvoice();
     }
     // if you have capture on shipment enabled don't set update the status of the payment
     $captureOnShipment = $this->_getConfigData('capture_on_shipment', 'adyen_abstract', $this->_order->getStoreId());
     if (!$captureOnShipment) {
         $status = $this->_getConfigData('payment_authorized', 'adyen_abstract', $this->_order->getStoreId());
     }
     // virtual order can have different status
     if ($this->_order->getIsVirtual()) {
         $this->_adyenLogger->addAdyenNotificationCronjob('Product is a virtual product');
         $virtualStatus = $this->_getConfigData('payment_authorized_virtual');
         if ($virtualStatus != "") {
             $status = $virtualStatus;
         }
     }
     // check for boleto if payment is totally paid
     if ($this->_paymentMethodCode() == "adyen_boleto") {
         // check if paid amount is the same as orginal amount
         $orginalAmount = $this->_boletoOriginalAmount;
         $paidAmount = $this->_boletoPaidAmount;
         if ($orginalAmount != $paidAmount) {
             // not the full amount is paid. Check if it is underpaid or overpaid
             // strip the  BRL of the string
             $orginalAmount = str_replace("BRL", "", $orginalAmount);
             $orginalAmount = floatval(trim($orginalAmount));
             $paidAmount = str_replace("BRL", "", $paidAmount);
             $paidAmount = floatval(trim($paidAmount));
             if ($paidAmount > $orginalAmount) {
                 $overpaidStatus = $this->_getConfigData('order_overpaid_status', 'adyen_boleto');
                 // check if there is selected a status if not fall back to the default
                 $status = !empty($overpaidStatus) ? $overpaidStatus : $status;
             } else {
                 $underpaidStatus = $this->_getConfigData('order_underpaid_status', 'adyen_boleto');
                 // check if there is selected a status if not fall back to the default
                 $status = !empty($underpaidStatus) ? $underpaidStatus : $status;
             }
         }
     }
     $comment = "Adyen Payment Successfully completed";
     // if manual review is true use the manual review status if this is set
     if ($manualReviewComment == true && $this->_fraudManualReview) {
         // check if different status is selected
         $fraudManualReviewStatus = $this->_getFraudManualReviewStatus();
         if ($fraudManualReviewStatus != "") {
             $status = $fraudManualReviewStatus;
             $comment = "Adyen Payment is in Manual Review check the Adyen platform";
         }
     }
     $status = !empty($status) ? $status : $this->_order->getStatus();
     $this->_order->addStatusHistoryComment(__($comment), $status);
     $this->_adyenLogger->addAdyenNotificationCronjob('Order status is changed to authorised status, status is ' . $status);
 }
开发者ID:Adyen,项目名称:adyen-magento2,代码行数:67,代码来源:Cron.php

示例2: _captureOrder

 /**
  * Capture order's payment using AIM.
  *
  * @param \Magento\Sales\Model\Order $order
  * @return void
  */
 protected function _captureOrder(\Magento\Sales\Model\Order $order)
 {
     $payment = $order->getPayment();
     if ($payment->getAdditionalInformation('payment_type') == self::ACTION_AUTHORIZE_CAPTURE) {
         try {
             $payment->setTransactionId(null)->setParentTransactionId($this->getResponse()->getXTransId())->capture(null);
             // set status from config for AUTH_AND_CAPTURE orders.
             if ($order->getState() == \Magento\Sales\Model\Order::STATE_PROCESSING) {
                 $orderStatus = $this->getConfigData('order_status');
                 if (!$orderStatus || $order->getIsVirtual()) {
                     $orderStatus = $order->getConfig()->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_PROCESSING);
                 }
                 if ($orderStatus) {
                     $order->setStatus($orderStatus);
                 }
             }
             $order->save();
         } catch (\Exception $e) {
             //if we couldn't capture order, just leave it as NEW order.
             $this->_logger->logException($e);
         }
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:29,代码来源:Directpost.php

示例3: getFormattedShippingAddress

 /**
  * @param Order $order
  * @return string|null
  */
 protected function getFormattedShippingAddress($order)
 {
     return $order->getIsVirtual() ? null : $this->addressRenderer->format($order->getShippingAddress(), 'html');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:Sender.php


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