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


PHP Order::getStatus方法代码示例

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


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

示例1: execute

 /**
  * Receives webhook events from Roadrunner
  */
 public function execute()
 {
     $this->_logger->addDebug('paystandmagento/webhook/paystand endpoint was hit');
     $body = @file_get_contents('php://input');
     $json = json_decode($body);
     $this->_logger->addDebug(">>>>> body=" . print_r($body, TRUE));
     if (isset($json->resource->meta->source) && $json->resource->meta->source == "magento 2") {
         $quoteId = $json->resource->meta->quote;
         $this->_logger->addDebug('magento 2 webhook identified with quote id = ' . $quoteId);
         $this->_order->loadByAttribute('quote_id', $quoteId);
         if (!empty($this->_order->getIncrementId())) {
             $this->_logger->addDebug('current order increment id = ' . $this->_order->getIncrementId());
             $state = $this->_order->getState();
             $this->_logger->addDebug('current order state = ' . $state);
             $status = $this->_order->getStatus();
             $this->_logger->addDebug('current order status = ' . $status);
             $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
             if ($this->scopeConfig->getValue(self::USE_SANDBOX, $storeScope)) {
                 $base_url = 'https://api.paystand.co/v3';
             } else {
                 $base_url = 'https://api.paystand.com/v3';
             }
             $url = $base_url . "/events/" . $json->id . "/verify";
             $auth_header = array("x-publishable-key: " . $this->scopeConfig->getValue(self::PUBLISHABLE_KEY, $storeScope));
             $curl = $this->buildCurl("POST", $url, json_encode($json), $auth_header);
             $response = $this->runCurl($curl);
             $this->_logger->addDebug("http_response_code is " . $this->http_response_code);
             if (FALSE !== $response && $this->http_response_code == 200) {
                 if ($json->resource->object = "payment") {
                     switch ($json->resource->status) {
                         case 'posted':
                             $state = 'pending';
                             $status = 'pending';
                             break;
                         case 'paid':
                             $state = 'processing';
                             $status = 'processing';
                             break;
                         case 'failed':
                             $state = 'closed';
                             $status = 'closed';
                             break;
                         case 'canceled':
                             $state = 'canceled';
                             $status = 'canceled';
                             break;
                     }
                 }
                 $this->_order->setState($state);
                 $this->_order->setStatus($status);
                 $this->_order->save();
                 $this->_logger->addDebug('new order state = ' . $state);
                 $this->_logger->addDebug('new order status = ' . $status);
             } else {
                 $this->_logger->addDebug('event verify failed');
             }
         }
     }
 }
开发者ID:steegi,项目名称:paystand-magento2,代码行数:62,代码来源:PayStand.php

示例2: _assertOrder

 /**
  * Perform order state and status assertions depending on currency code
  *
  * @param \Magento\Sales\Model\Order $order
  * @param string $currencyCode
  */
 protected function _assertOrder($order, $currencyCode)
 {
     if ($currencyCode == 'USD') {
         $this->assertEquals('complete', $order->getState());
         $this->assertEquals('complete', $order->getStatus());
     } else {
         $this->assertEquals('payment_review', $order->getState());
         $this->assertEquals('fraud', $order->getStatus());
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:IpnTest.php

示例3: canView

 /**
  * {@inheritdoc}
  */
 public function canView(\Magento\Sales\Model\Order $order)
 {
     $customerId = $this->customerSession->getCustomerId();
     $availableStatuses = $this->orderConfig->getVisibleOnFrontStatuses();
     if ($order->getId() && $order->getCustomerId() && $order->getCustomerId() == $customerId && in_array($order->getStatus(), $availableStatuses, true)) {
         return true;
     }
     return false;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:OrderViewAuthorization.php

示例4: updateOrder

 /**
  * Set appropriate state to order or add status to order history
  *
  * @param Order $order
  * @param string $orderState
  * @param string $orderStatus
  * @param bool $isCustomerNotified
  * @return void
  */
 protected function updateOrder(Order $order, $orderState, $orderStatus, $isCustomerNotified)
 {
     // add message if order was put into review during authorization or capture
     $message = $order->getCustomerNote();
     $originalOrderState = $order->getState();
     $originalOrderStatus = $order->getStatus();
     switch (true) {
         case $message && $originalOrderState == Order::STATE_PAYMENT_REVIEW:
             $order->addStatusToHistory($originalOrderStatus, $message, $isCustomerNotified);
             break;
         case $message:
         case $originalOrderState && $message:
         case $originalOrderState != $orderState:
         case $originalOrderStatus != $orderStatus:
             $order->setState($orderState)->setStatus($orderStatus)->addStatusHistoryComment($message)->setIsCustomerNotified($isCustomerNotified);
             break;
         default:
             break;
     }
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:29,代码来源:Payment.php

示例5: isVisible

 /**
  * Is order visible
  *
  * @param Order $order
  * @return bool
  */
 protected function isVisible(Order $order)
 {
     return !in_array($order->getStatus(), $this->_orderConfig->getInvisibleOnFrontStatuses());
 }
开发者ID:smart2pay,项目名称:magento20,代码行数:10,代码来源:Send.php

示例6: build

 /**
  * Loads the order info from a Magento order model.
  *
  * @param Order $order the order model.
  * @return \NostoOrder
  */
 public function build(Order $order)
 {
     $nostoOrder = new \NostoOrder();
     try {
         $nostoCurrency = new NostoCurrencyCode($order->getOrderCurrencyCode());
         $nostoOrder->setOrderNumber($order->getId());
         $nostoOrder->setExternalRef($order->getRealOrderId());
         $nostoOrder->setCreatedDate(new NostoDate(strtotime($order->getCreatedAt())));
         $nostoOrder->setPaymentProvider(new NostoOrderPaymentProvider($order->getPayment()->getMethod()));
         if ($order->getStatus()) {
             $nostoStatus = new NostoOrderStatus();
             $nostoStatus->setCode($order->getStatus());
             $nostoStatus->setLabel($order->getStatusLabel());
             $nostoOrder->setStatus($nostoStatus);
         }
         foreach ($order->getAllStatusHistory() as $item) {
             if ($item->getStatus()) {
                 $nostoStatus = new NostoOrderStatus();
                 $nostoStatus->setCode($item->getStatus());
                 $nostoStatus->setLabel($item->getStatusLabel());
                 $nostoStatus->setCreatedAt(new NostoDate(strtotime($item->getCreatedAt())));
                 $nostoOrder->addHistoryStatus($nostoStatus);
             }
         }
         // Set the buyer information
         $nostoBuyer = new NostoOrderBuyer();
         $nostoBuyer->setFirstName($order->getCustomerFirstname());
         $nostoBuyer->setLastName($order->getCustomerLastname());
         $nostoBuyer->setEmail($order->getCustomerEmail());
         $nostoOrder->setBuyer($nostoBuyer);
         // Add each ordered item as a line item
         /** @var Item $item */
         foreach ($order->getAllVisibleItems() as $item) {
             $nostoItem = new NostoOrderItem();
             $nostoItem->setItemId((int) $this->buildItemProductId($item));
             $nostoItem->setQuantity((int) $item->getQtyOrdered());
             $nostoItem->setName($this->buildItemName($item));
             try {
                 $nostoItem->setUnitPrice(new NostoPrice($this->_priceHelper->getItemFinalPriceInclTax($item)));
             } catch (\NostoInvalidArgumentException $E) {
                 $nostoItem->setUnitPrice(new NostoPrice(0));
             }
             $nostoItem->setCurrency($nostoCurrency);
             $nostoOrder->addItem($nostoItem);
         }
         // Add discounts as a pseudo line item
         if (($discount = $order->getDiscountAmount()) < 0) {
             $nostoItem = new NostoOrderItem();
             $nostoItem->setItemId(-1);
             $nostoItem->setQuantity(1);
             $nostoItem->setName($this->buildDiscountRuleDescription($order));
             $nostoItem->setUnitPrice(new NostoPrice($discount));
             $nostoItem->setCurrency($nostoCurrency);
             $nostoOrder->addItem($nostoItem);
         }
         // Add shipping and handling as a pseudo line item
         if (($shippingInclTax = $order->getShippingInclTax()) > 0) {
             $nostoItem = new NostoOrderItem();
             $nostoItem->setItemId(-1);
             $nostoItem->setQuantity(1);
             $nostoItem->setName('Shipping and handling');
             $nostoItem->setUnitPrice(new NostoPrice($shippingInclTax));
             $nostoItem->setCurrency($nostoCurrency);
             $nostoOrder->addItem($nostoItem);
         }
     } catch (Exception $e) {
         $this->_logger->error($e, ['exception' => $e]);
     }
     return $nostoOrder;
 }
开发者ID:Nosto,项目名称:nosto-magento2,代码行数:76,代码来源:Builder.php

示例7: _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


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