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


PHP OrderInterface::getShippingTotal方法代码示例

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


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

示例1:

 function it_executes_request(InvoiceNumberGeneratorInterface $invoiceNumberGenerator, CurrencyConverterInterface $currencyConverter, Convert $request, PaymentInterface $payment, OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $productVariant, ProductInterface $product)
 {
     $request->getTo()->willReturn('array');
     $payment->getId()->willReturn(19);
     $order->getId()->willReturn(92);
     $order->getId()->willReturn(92);
     $order->getCurrencyCode()->willReturn('PLN');
     $order->getTotal()->willReturn(22000);
     $order->getItems()->willReturn([$orderItem]);
     $order->getAdjustmentsTotalRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->willReturn(0);
     $order->getOrderPromotionTotal()->willReturn(0);
     $order->getShippingTotal()->willReturn(2000);
     $orderItem->getVariant()->willReturn($productVariant);
     $orderItem->getDiscountedUnitPrice()->willReturn(20000);
     $orderItem->getQuantity()->willReturn(1);
     $productVariant->getProduct()->willReturn($product);
     $product->getName()->willReturn('Lamborghini Aventador Model');
     $request->getSource()->willReturn($payment);
     $payment->getOrder()->willReturn($order);
     $invoiceNumberGenerator->generate($order, $payment)->willReturn('19-92');
     $currencyConverter->convertFromBase(22000, 'PLN')->willReturn(88000);
     $currencyConverter->convertFromBase(20000, 'PLN')->willReturn(80000);
     $currencyConverter->convertFromBase(2000, 'PLN')->willReturn(8000);
     $details = ['PAYMENTREQUEST_0_INVNUM' => '19-92', 'PAYMENTREQUEST_0_CURRENCYCODE' => 'PLN', 'PAYMENTREQUEST_0_AMT' => 880.0, 'PAYMENTREQUEST_0_ITEMAMT' => 880.0, 'L_PAYMENTREQUEST_0_NAME0' => 'Lamborghini Aventador Model', 'L_PAYMENTREQUEST_0_AMT0' => 800.0, 'L_PAYMENTREQUEST_0_QTY0' => 1, 'L_PAYMENTREQUEST_0_NAME1' => 'Shipping Total', 'L_PAYMENTREQUEST_0_AMT1' => 80.0, 'L_PAYMENTREQUEST_0_QTY1' => 1];
     $request->setResult($details)->shouldBeCalled();
     $this->execute($request);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:27,代码来源:ConvertPaymentActionSpec.php

示例2:

 function it_does_nothing_if_there_are_no_shipment_taxes_on_order($adjustmentsFactory, $calculator, $taxRateResolver, Collection $shippingAdjustments, OrderInterface $order, ShipmentInterface $shipment, ShippingMethodInterface $shippingMethod, TaxRateInterface $taxRate, ZoneInterface $zone)
 {
     $order->getLastShipment()->willReturn($shipment);
     $shipment->getMethod()->willReturn($shippingMethod);
     $taxRateResolver->resolve($shippingMethod, ['zone' => $zone])->willReturn($taxRate);
     $order->getAdjustments(AdjustmentInterface::SHIPPING_ADJUSTMENT)->willReturn($shippingAdjustments);
     $shippingAdjustments->isEmpty()->willReturn(false);
     $order->getShippingTotal()->willReturn(1000);
     $calculator->calculate(1000, $taxRate)->willReturn(0);
     $adjustmentsFactory->createWithData(Argument::cetera())->shouldNotBeCalled();
     $order->addAdjustment(Argument::any())->shouldNotBeCalled();
     $this->apply($order, $zone);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:13,代码来源:OrderShipmentTaxesApplicatorSpec.php

示例3: apply

 /**
  * {@inheritdoc}
  */
 public function apply(OrderInterface $order, ZoneInterface $zone)
 {
     $shippingTotal = $order->getShippingTotal();
     if (0 === $shippingTotal) {
         return;
     }
     $taxRate = $this->taxRateResolver->resolve($this->getShippingMethod($order), ['zone' => $zone]);
     if (null === $taxRate) {
         return;
     }
     $taxAmount = $this->calculator->calculate($shippingTotal, $taxRate);
     if (0 === $taxAmount) {
         return;
     }
     $this->addAdjustment($order, $taxAmount, $taxRate->getLabel(), $taxRate->isIncludedInPrice());
 }
开发者ID:sylius,项目名称:core,代码行数:19,代码来源:OrderShipmentTaxesApplicator.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(), ['zone' => $zone]);
     if (null === $taxRate) {
         return;
     }
     $shippingPrice = $order->getShippingTotal();
     $taxAmount = $this->calculator->calculate($shippingPrice, $taxRate);
     if (0 === $taxAmount) {
         return;
     }
     $this->addAdjustment($order, $taxAmount, $taxRate->getLabel(), $taxRate->isIncludedInPrice());
 }
开发者ID:loic425,项目名称:Sylius,代码行数:24,代码来源:OrderShipmentTaxesApplicator.php

示例5:

 function it_does_nothing_if_order_has_0_shipping_total(TaxRateResolverInterface $taxRateResolver, OrderInterface $order, ZoneInterface $zone)
 {
     $order->getShippingTotal()->willReturn(0);
     $taxRateResolver->resolve(Argument::any())->shouldNotBeCalled();
     $order->addAdjustment(Argument::any())->shouldNotBeCalled();
     $this->apply($order, $zone);
 }
开发者ID:sylius,项目名称:core,代码行数:7,代码来源:OrderShipmentTaxesApplicatorSpec.php


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