當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OrderInterface::getAdjustments方法代碼示例

本文整理匯總了PHP中Sylius\Component\Core\Model\OrderInterface::getAdjustments方法的典型用法代碼示例。如果您正苦於以下問題:PHP OrderInterface::getAdjustments方法的具體用法?PHP OrderInterface::getAdjustments怎麽用?PHP OrderInterface::getAdjustments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sylius\Component\Core\Model\OrderInterface的用法示例。


在下文中一共展示了OrderInterface::getAdjustments方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

 function it_does_nothing_if_order_has_no_shipping_adjustments(Collection $shippingAdjustments, OrderInterface $order, ShipmentInterface $shipment, ZoneInterface $zone)
 {
     $order->getLastShipment()->willReturn($shipment);
     $order->getAdjustments(AdjustmentInterface::SHIPPING_ADJUSTMENT)->willReturn($shippingAdjustments);
     $shippingAdjustments->isEmpty()->willReturn(true);
     $shippingAdjustments->last()->shouldNotBeCalled();
     $this->apply($order, $zone);
 }
開發者ID:sidibea,項目名稱:Sylius,代碼行數:8,代碼來源:OrderShipmentTaxesByZoneApplicatorSpec.php

示例2: calculateNonNeutralTaxTotal

 private function calculateNonNeutralTaxTotal(OrderInterface $order)
 {
     $nonNeutralTaxTotal = 0;
     foreach ($order->getAdjustments(AdjustmentInterface::TAX_ADJUSTMENT) as $taxAdjustment) {
         if (!$taxAdjustment->isNeutral()) {
             $nonNeutralTaxTotal = $taxAdjustment->getAmount();
         }
     }
     return $nonNeutralTaxTotal;
 }
開發者ID:ekipower,項目名稱:payum-nganluong,代碼行數:10,代碼來源:CapturePaymentUsingXXXAction.php

示例3: iDeleteTheOrder

 /**
  * @When I delete the order :order
  */
 public function iDeleteTheOrder(OrderInterface $order)
 {
     $adjustmentsId = [];
     foreach ($order->getAdjustments() as $adjustment) {
         $adjustmentsId[] = $adjustment->getId();
     }
     $this->sharedStorage->set('deleted_adjustments', $adjustmentsId);
     $this->sharedStorage->set('deleted_addresses', [$order->getShippingAddress()->getId(), $order->getBillingAddress()->getId()]);
     $this->sharedStorage->set('order_id', $order->getId());
     $this->orderRepository->remove($order);
 }
開發者ID:gabiudrescu,項目名稱:Sylius,代碼行數:14,代碼來源:ManagingOrdersContext.php

示例4: apply

 /**
  * {@inheritdoc}
  */
 public function apply(OrderInterface $order, ZoneInterface $zone)
 {
     $lastShipment = $order->getLastShipment();
     if (!$lastShipment) {
         return;
     }
     $shippingAdjustments = $order->getAdjustments(AdjustmentInterface::SHIPPING_ADJUSTMENT);
     if ($shippingAdjustments->isEmpty()) {
         return;
     }
     $taxRate = $this->taxRateResolver->resolve($lastShipment->getMethod(), array('zone' => $zone));
     if (null === $taxRate) {
         return;
     }
     $lastShippingAdjustment = $shippingAdjustments->last();
     $taxAmount = $this->calculator->calculate($lastShippingAdjustment->getAmount(), $taxRate);
     $this->addAdjustment($order, $taxAmount, $taxRate->getLabel(), $taxRate->isIncludedInPrice());
 }
開發者ID:sidibea,項目名稱:Sylius,代碼行數:21,代碼來源:OrderShipmentTaxesByZoneApplicator.php


注:本文中的Sylius\Component\Core\Model\OrderInterface::getAdjustments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。