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


PHP Model\OrderInterface類代碼示例

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


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

示例1: holdInventory

 /**
  * {@inheritdoc}
  */
 public function holdInventory(OrderInterface $order)
 {
     foreach ($order->getItems() as $item) {
         $quantity = $this->applyTransition($item->getUnits(), InventoryUnitTransitions::SYLIUS_HOLD);
         $this->inventoryOperator->hold($item->getVariant(), $quantity);
     }
 }
開發者ID:TeamNovatek,項目名稱:Sylius,代碼行數:10,代碼來源:InventoryHandler.php

示例2: removeFrom

 /**
  * {@inheritdoc}
  */
 public function removeFrom(OrderInterface $order)
 {
     $adjustmentsToRemove = [AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT, AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT, AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT, AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT, AdjustmentInterface::TAX_ADJUSTMENT];
     foreach ($adjustmentsToRemove as $type) {
         $order->removeAdjustmentsRecursively($type);
     }
 }
開發者ID:okwinza,項目名稱:Sylius,代碼行數:10,代碼來源:AdjustmentsRemover.php

示例3: sendOrderComment

 /**
  * {@inheritdoc}
  */
 public function sendOrderComment(OrderInterface $order, CommentInterface $comment = null)
 {
     if (!($user = $order->getUser())) {
         throw new \InvalidArgumentException('Order has to belong to a User.');
     }
     $this->sendEmail(array('order' => $order, 'comment' => $comment), $user->getEmail());
 }
開發者ID:bcremer,項目名稱:Sylius,代碼行數:10,代碼來源:OrderCommentMailer.php

示例4:

    function it_applies_calculated_shipping_charge_for_each_shipment_associated_with_the_order(
        $adjustmentRepository,
        $calculator,
        AdjustmentInterface $adjustment,
        OrderInterface $order,
        ShipmentInterface $shipment,
        ShippingMethodInterface $shippingMethod
    ) {
        $adjustmentRepository->createNew()->willReturn($adjustment);
        $order->getShipments()->willReturn(array($shipment));

        $calculator->calculate($shipment)->willReturn(450);

        $shipment->getMethod()->willReturn($shippingMethod);
        $shippingMethod->getName()->willReturn('FedEx');

        $adjustment->setAmount(450)->shouldBeCalled();
        $adjustment->setType(AdjustmentInterface::SHIPPING_ADJUSTMENT)->shouldBeCalled();
        $adjustment->setDescription('FedEx')->shouldBeCalled();

        $order->removeAdjustments(AdjustmentInterface::SHIPPING_ADJUSTMENT)->shouldBeCalled();
        $order->addAdjustment($adjustment)->shouldBeCalled();

        $order->calculateTotal()->shouldBeCalled();

        $this->applyShippingCharges($order);
    }
開發者ID:kriswillis,項目名稱:Sylius,代碼行數:27,代碼來源:ShippingChargesProcessorSpec.php

示例5: update

 /**
  * {@inheritdoc}
  */
 public function update(OrderInterface $order)
 {
     /** @var CurrencyInterface $currency */
     $currency = $this->currencyRepository->findOneBy(['code' => $this->currencyContext->getCurrencyCode()]);
     $order->setCurrencyCode($currency->getCode());
     $order->setExchangeRate($currency->getExchangeRate());
 }
開發者ID:origammi,項目名稱:Sylius,代碼行數:10,代碼來源:OrderExchangeRateAndCurrencyUpdater.php

示例6: updateOrderShipmentStates

 /**
  * Update order's shipping state.
  *
  * @param OrderInterface $order
  * @param string         $transition
  */
 public function updateOrderShipmentStates(OrderInterface $order, $transition = ShipmentTransitions::SYLIUS_PREPARE)
 {
     if ($order->isBackorder()) {
         $transition = ShipmentTransitions::SYLIUS_BACKORDER;
     }
     $this->processor->updateShipmentStates($order->getShipments(), $transition);
 }
開發者ID:aleherse,項目名稱:Sylius,代碼行數:13,代碼來源:ShipmentStatesCallback.php

示例7:

 function it_decrements_a_usage_of_promotions_applied_on_order(OrderInterface $order, PromotionInterface $firstPromotion, PromotionInterface $secondPromotion)
 {
     $order->getPromotions()->willReturn([$firstPromotion, $secondPromotion]);
     $firstPromotion->decrementUsed()->shouldBeCalled();
     $secondPromotion->decrementUsed()->shouldBeCalled();
     $this->decrement($order);
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:7,代碼來源:OrderPromotionsUsageModifierSpec.php

示例8: sendOrderConfirmation

 /**
  * {@inheritdoc}
  */
 public function sendOrderConfirmation(OrderInterface $order)
 {
     if (!($user = $order->getUser())) {
         throw new \InvalidArgumentException('Order has to belong to a User');
     }
     $this->sendEmail(array('order' => $order), $user->getEmail());
 }
開發者ID:bcremer,項目名稱:Sylius,代碼行數:10,代碼來源:OrderConfirmationMailer.php

示例9: generateForOrderCheckoutState

 /**
  * {@inheritdoc}
  */
 public function generateForOrderCheckoutState(OrderInterface $order, $parameters = [], $referenceType = self::ABSOLUTE_PATH)
 {
     if (!isset($this->routeCollection[$order->getCheckoutState()]['route'])) {
         throw new RouteNotFoundException();
     }
     return $this->router->generate($this->routeCollection[$order->getCheckoutState()]['route'], $parameters, $referenceType);
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:10,代碼來源:CheckoutStateUrlGenerator.php

示例10: addAdjustmentIfForNotCancelled

 /**
  * @param OrderInterface   $order
  * @param PaymentSubjectInterface $payment
  */
 private function addAdjustmentIfForNotCancelled(OrderInterface $order, PaymentSubjectInterface $payment)
 {
     if (PaymentInterface::STATE_CANCELLED !== $payment->getState())
     {
         $order->addAdjustment($this->prepareAdjustmentForOrder($payment));
     }
 }
開發者ID:kriswillis,項目名稱:Sylius,代碼行數:11,代碼來源:PaymentChargesProcessor.php

示例11: supports

 /**
  * {@inheritdoc}
  */
 public function supports(OrderInterface $order, ZoneInterface $zone)
 {
     $channel = $order->getChannel();
     /** @var ChannelInterface $channel */
     Assert::isInstanceOf($channel, ChannelInterface::class);
     return $channel->getTaxCalculationStrategy() === $this->type;
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:10,代碼來源:TaxCalculationStrategy.php

示例12:

 function it_returns_false_if_variant_is_not_included_and_exclude_is_not_set(OrderInterface $subject, OrderItem $orderItem, ProductVariant $variant)
 {
     $subject->getItems()->willReturn([$orderItem]);
     $orderItem->getVariant()->willReturn($variant);
     $variant->getId()->willReturn(2);
     $this->isEligible($subject, ['variant' => 1, 'exclude' => false])->shouldReturn(false);
 }
開發者ID:aleherse,項目名稱:Sylius,代碼行數:7,代碼來源:ContainsProductRuleCheckerSpec.php

示例13:

 function it_decrements_promotion_usage_if_promotion_was_used(OrderInterface $order, PromotionInterface $promotion)
 {
     $order->getPromotions()->willReturn([$promotion]);
     $promotion->getUsed()->willReturn(5);
     $promotion->setUsed(4)->shouldBeCalled();
     $this->decrementPromotionUsage($order);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:7,代碼來源:PromotionUsageCallbackSpec.php

示例14: updateExistingPaymentsStates

 /**
  * @param OrderInterface $order
  */
 private function updateExistingPaymentsStates(OrderInterface $order)
 {
     foreach ($order->getPayments() as $payment) {
         $this->cancelPaymentStateIfNotStarted($payment);
     }
     $this->paymentManager->flush();
 }
開發者ID:aleherse,項目名稱:Sylius,代碼行數:10,代碼來源:PaymentProcessor.php

示例15: array

 function it_should_recognize_subject_as_eligible_if_country_match(OrderInterface $subject, AddressInterface $address, CountryInterface $country)
 {
     $subject->getShippingAddress()->shouldBeCalled()->willReturn($address);
     $address->getCountry()->shouldBeCalled()->willReturn($country);
     $country->getId()->shouldBeCalled()->willReturn(1);
     $this->isEligible($subject, array('country' => 1))->shouldReturn(true);
 }
開發者ID:aleherse,項目名稱:Sylius,代碼行數:7,代碼來源:ShippingCountryRuleCheckerSpec.php


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