本文整理汇总了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);
}
}
示例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);
}
}
示例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());
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例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));
}
}
示例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;
}
示例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);
}
示例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);
}
示例14: updateExistingPaymentsStates
/**
* @param OrderInterface $order
*/
private function updateExistingPaymentsStates(OrderInterface $order)
{
foreach ($order->getPayments() as $payment) {
$this->cancelPaymentStateIfNotStarted($payment);
}
$this->paymentManager->flush();
}
示例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);
}