当前位置: 首页>>代码示例>>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;未经允许,请勿转载。