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


PHP OrderInterface::getChannel方法代码示例

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


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

示例1:

 function it_recalculates_prices_adding_customer_to_the_context(ChannelInterface $channel, CustomerGroupInterface $group, CustomerInterface $customer, OrderInterface $order, OrderItemInterface $item, ProductVariantInterface $variant, ProductVariantPriceCalculatorInterface $productVariantPriceCalculator)
 {
     $order->getCustomer()->willReturn($customer);
     $order->getChannel()->willReturn(null);
     $order->getItems()->willReturn([$item]);
     $order->getCurrencyCode()->willReturn(null);
     $customer->getGroup()->willReturn($group);
     $item->isImmutable()->willReturn(false);
     $item->getQuantity()->willReturn(5);
     $item->getVariant()->willReturn($variant);
     $order->getChannel()->willReturn($channel);
     $productVariantPriceCalculator->calculate($variant, ['channel' => $channel])->willReturn(10);
     $item->setUnitPrice(10)->shouldBeCalled();
     $this->process($order);
 }
开发者ID:sylius,项目名称:core,代码行数:15,代码来源:OrderPricesRecalculatorSpec.php

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

示例3: recalculate

 /**
  * {@inheritdoc}
  */
 public function recalculate(OrderInterface $order)
 {
     $context = [];
     if (null !== ($customer = $order->getCustomer())) {
         $context['customer'] = $customer;
         $context['groups'] = $customer->getGroups()->toArray();
     }
     if (null !== $order->getChannel()) {
         $context['channel'] = [$order->getChannel()];
     }
     foreach ($order->getItems() as $item) {
         if ($item->isImmutable()) {
             continue;
         }
         $context['quantity'] = $item->getQuantity();
         $item->setUnitPrice($this->priceCalculator->calculate($item->getVariant(), $context));
     }
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:21,代码来源:PricesRecalculator.php

示例4:

 function it_updates_order_exchange_rate(OrderInterface $order, CurrencyContextInterface $currencyContext, RepositoryInterface $currencyRepository, CurrencyInterface $currency, ChannelInterface $channel)
 {
     $order->getChannel()->willReturn($channel);
     $currencyContext->getCurrencyCode()->willReturn('GBP');
     $currencyRepository->findOneBy(['code' => 'GBP'])->willReturn($currency);
     $currency->getExchangeRate()->willReturn(3.5);
     $currency->getCode()->willReturn('GBP');
     $order->setCurrencyCode('GBP')->shouldBeCalled();
     $order->setExchangeRate(3.5)->shouldBeCalled();
     $this->update($order);
 }
开发者ID:origammi,项目名称:Sylius,代码行数:11,代码来源:OrderExchangeRateAndCurrencyUpdaterSpec.php

示例5:

 function it_recalculates_prices_without_adding_anything_to_the_context_if_its_not_needed(DelegatingCalculatorInterface $priceCalculator, OrderInterface $order, OrderItemInterface $item, PriceableInterface $variant)
 {
     $order->getCustomer()->willReturn(null);
     $order->getChannel()->willReturn(null);
     $order->getItems()->willReturn([$item]);
     $item->isImmutable()->willReturn(false);
     $item->getQuantity()->willReturn(5);
     $item->getVariant()->willReturn($variant);
     $priceCalculator->calculate($variant, ['quantity' => 5])->willReturn(10);
     $item->setUnitPrice(10)->shouldBeCalled();
     $this->recalculate($order);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:12,代码来源:PricesRecalculatorSpec.php

示例6:

 function it_cannot_be_supported_when_the_tax_calculation_strategy_from_order_channel_does_not_match_the_strategy_type(ChannelInterface $channel, OrderInterface $order, ZoneInterface $zone)
 {
     $order->getChannel()->willReturn($channel);
     $channel->getTaxCalculationStrategy()->willReturn('order_item_units_based');
     $this->supports($order, $zone)->shouldReturn(false);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:6,代码来源:TaxCalculationStrategySpec.php

示例7:

 function it_provides_default_tax_zone_from_order_channel(ChannelInterface $channel, OrderInterface $order, ZoneInterface $defaultTaxZone)
 {
     $order->getChannel()->willReturn($channel);
     $channel->getDefaultTaxZone()->willReturn($defaultTaxZone);
     $this->getZone($order)->shouldReturn($defaultTaxZone);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:6,代码来源:ChannelBasedDefaultTaxZoneProviderSpec.php

示例8:

 function it_returns_false_if_there_is_no_configuration_for_order_channel(ChannelInterface $channel, OrderInterface $order)
 {
     $order->getChannel()->willReturn($channel);
     $channel->getCode()->willReturn('WEB_US');
     $this->isEligible($order, [])->shouldReturn(false);
 }
开发者ID:sylius,项目名称:core,代码行数:6,代码来源:ItemTotalRuleCheckerSpec.php

示例9: selectPayment

 /**
  * @param OrderInterface $order
  */
 private function selectPayment(OrderInterface $order)
 {
     $paymentMethod = $this->faker->randomElement($order->getChannel()->getPaymentMethods()->toArray());
     Assert::notNull($paymentMethod);
     foreach ($order->getPayments() as $payment) {
         $payment->setMethod($paymentMethod);
     }
     $this->applyCheckoutStateTransition($order, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:12,代码来源:OrderFixture.php

示例10: selectPayment

 /**
  * @param OrderInterface $order
  */
 private function selectPayment(OrderInterface $order)
 {
     $paymentMethod = $this->faker->randomElement($this->paymentMethodRepository->findEnabledForChannel($order->getChannel()));
     Assert::notNull($paymentMethod, 'Payment method should not be null.');
     foreach ($order->getPayments() as $payment) {
         $payment->setMethod($paymentMethod);
     }
     $this->applyCheckoutStateTransition($order, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT);
 }
开发者ID:sylius,项目名称:sylius,代码行数:12,代码来源:OrderFixture.php

示例11:

 function it_does_not_apply_discount_if_percentage_configuration_not_defined(ChannelInterface $channel, OrderInterface $order, PromotionInterface $promotion)
 {
     $order->getChannel()->willReturn($channel);
     $channel->getCode()->willReturn('WEB_PL');
     $order->getItems()->shouldNotBeCalled();
     $this->execute($order, ['WEB_PL' => []], $promotion)->shouldReturn(false);
 }
开发者ID:sylius,项目名称:core,代码行数:7,代码来源:UnitPercentageDiscountPromotionActionCommandSpec.php

示例12:

 function it_returns_false_if_taxon_with_configured_code_cannot_be_found(ChannelInterface $channel, OrderInterface $order, TaxonRepositoryInterface $taxonRepository)
 {
     $order->getChannel()->willReturn($channel);
     $channel->getCode()->willReturn('WEB_US');
     $taxonRepository->findOneBy(['code' => 'sniper_rifles'])->willReturn(null);
     $this->isEligible($order, ['WEB_US' => ['taxon' => 'sniper_rifles', 'amount' => 1000]])->shouldReturn(false);
 }
开发者ID:sylius,项目名称:core,代码行数:7,代码来源:TotalOfItemsFromTaxonRuleCheckerSpec.php

示例13:

 function it_does_not_apply_discount_if_configuration_is_invalid(ChannelInterface $channel, OrderInterface $order, PromotionInterface $promotion)
 {
     $order->getChannel()->willReturn($channel, $channel);
     $channel->getCode()->willReturn('WEB_US', 'WEB_US');
     $order->countItems()->willReturn(1, 1);
     $this->execute($order, ['WEB_US' => []], $promotion)->shouldReturn(false);
     $this->execute($order, ['WEB_US' => ['amount' => 'string']], $promotion)->shouldReturn(false);
 }
开发者ID:sylius,项目名称:core,代码行数:8,代码来源:FixedDiscountPromotionActionCommandSpec.php

示例14: ArrayCollection

 function it_reverts_a_proper_promotion_adjustment_from_all_units(AdjustmentInterface $promotionAdjustment1, AdjustmentInterface $promotionAdjustment2, ChannelInterface $channel, OrderInterface $order, OrderItemInterface $orderItem, OrderItemUnitInterface $unit, PromotionInterface $promotion)
 {
     $order->getChannel()->willReturn($channel);
     $channel->getCode()->willReturn('WEB_US');
     $order->getItems()->willReturn(new ArrayCollection([$orderItem->getWrappedObject()]));
     $orderItem->getUnits()->willReturn(new ArrayCollection([$unit->getWrappedObject()]));
     $unit->getAdjustments(AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT)->willReturn(new ArrayCollection([$promotionAdjustment1->getWrappedObject(), $promotionAdjustment2->getWrappedObject()]));
     $promotion->getCode()->willReturn('PROMOTION');
     $promotionAdjustment1->getOriginCode()->willReturn('PROMOTION');
     $unit->removeAdjustment($promotionAdjustment1)->shouldBeCalled();
     $promotionAdjustment2->getOriginCode()->willReturn('OTHER_PROMOTION');
     $unit->removeAdjustment($promotionAdjustment2)->shouldNotBeCalled();
     $this->revert($order, ['WEB_US' => ['amount' => 1000]], $promotion);
 }
开发者ID:sylius,项目名称:core,代码行数:14,代码来源:UnitFixedDiscountPromotionActionCommandSpec.php

示例15:

 function it_provides_active_promotions_for_given_subject_channel($promotionRepository, ChannelInterface $channel, PromotionInterface $promotion1, PromotionInterface $promotion2, OrderInterface $subject)
 {
     $subject->getChannel()->willReturn($channel);
     $promotionRepository->findActiveByChannel($channel)->willReturn([$promotion1, $promotion2]);
     $this->getPromotions($subject)->shouldReturn([$promotion1, $promotion2]);
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:6,代码来源:ActivePromotionsByChannelProviderSpec.php


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