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


PHP OrderInterface::getTotal方法代码示例

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


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

示例1: processOrderPayments

 /**
  * {@inheritdoc}
  */
 public function processOrderPayments(OrderInterface $order)
 {
     if (OrderInterface::STATE_CANCELLED === $order->getState()) {
         return;
     }
     $newPayment = $order->getLastPayment(PaymentInterface::STATE_NEW);
     if (null !== $newPayment) {
         $newPayment->setAmount($order->getTotal());
         return;
     }
     /** @var $payment PaymentInterface */
     $payment = $this->paymentFactory->createWithAmountAndCurrencyCode($order->getTotal(), $order->getCurrencyCode());
     $this->setPaymentMethodIfNeeded($order, $payment);
     $order->addPayment($payment);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:18,代码来源:PaymentProcessor.php

示例2:

 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

示例3: resolvePaymentState

 /**
  * {@inheritdoc}
  */
 public function resolvePaymentState(OrderInterface $order)
 {
     $paymentState = PaymentInterface::STATE_NEW;
     if ($order->hasPayments()) {
         $payments = $order->getPayments();
         $completedPaymentTotal = 0;
         foreach ($payments as $payment) {
             if (PaymentInterface::STATE_COMPLETED === $payment->getState()) {
                 $completedPaymentTotal += $payment->getAmount();
             }
         }
         if ($completedPaymentTotal >= $order->getTotal()) {
             // Payment is completed if we have received full amount.
             $paymentState = PaymentInterface::STATE_COMPLETED;
         } else {
             // Payment is processing if one of the payment is.
             if ($payments->exists(function ($key, $payment) {
                 return in_array($payment->getState(), [PaymentInterface::STATE_PROCESSING, PaymentInterface::STATE_PENDING]);
             })) {
                 $paymentState = PaymentInterface::STATE_PROCESSING;
             }
         }
     }
     $order->setPaymentState($paymentState);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:28,代码来源:StateResolver.php

示例4: processOrderPayments

 /**
  * {@inheritdoc}
  */
 public function processOrderPayments(OrderInterface $order)
 {
     /** @var $payment PaymentInterface */
     $payment = $this->paymentFactory->createWithAmountAndCurrency($order->getTotal(), $order->getCurrency());
     $this->setPaymentMethodIfNeeded($order, $payment);
     $order->addPayment($payment);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:10,代码来源:PaymentProcessor.php

示例5:

 function it_processes_payment_for_given_order(PaymentFactoryInterface $paymentFactory, PaymentInterface $payment, OrderInterface $order)
 {
     $order->getTotal()->willReturn(1234);
     $order->getCurrency()->willReturn('EUR');
     $paymentFactory->createWithAmountAndCurrency(1234, 'EUR')->willReturn($payment);
     $order->addPayment($payment)->shouldBeCalled();
     $this->processOrderPayments($order);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:8,代码来源:PaymentProcessorSpec.php

示例6: createPayment

 /**
  * {@inheritdoc}
  */
 public function createPayment(OrderInterface $order)
 {
     $payment = $this->paymentRepository->createNew();
     $payment->setCurrency($order->getCurrency());
     $payment->setAmount($order->getTotal());
     $order->addPayment($payment);
     return $payment;
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:11,代码来源:PaymentProcessor.php

示例7:

 function it_sets_last_order_currency_with_target_state_currency_code_and_amount(OrderInterface $order, PaymentInterface $payment)
 {
     $order->getState()->willReturn(OrderInterface::STATE_CART);
     $order->getLastPayment(PaymentInterface::STATE_CART)->willReturn($payment);
     $order->getCurrencyCode()->willReturn('PLN');
     $order->getTotal()->willReturn(1000);
     $payment->setCurrencyCode('PLN')->shouldBeCalled();
     $payment->setAmount(1000)->shouldBeCalled();
     $this->process($order);
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:10,代码来源:OrderPaymentProcessorSpec.php

示例8:

 function it_does_not_set_payment_method_from_last_cancelled_payment_during_processing_if_new_payment_exists(PaymentFactoryInterface $paymentFactory, PaymentInterface $newPaymentReadyToPay, PaymentInterface $cancelledPayment, PaymentInterface $payment, OrderInterface $order)
 {
     $order->getTotal()->willReturn(1234);
     $order->getCurrency()->willReturn('EUR');
     $order->getLastPayment(PaymentInterface::STATE_CANCELLED)->willReturn($cancelledPayment);
     $order->getLastPayment(PaymentInterface::STATE_NEW)->willReturn($newPaymentReadyToPay);
     $paymentFactory->createWithAmountAndCurrency(1234, 'EUR')->willReturn($payment);
     $payment->setMethod($cancelledPayment)->shouldNotBeCalled();
     $order->addPayment($payment)->shouldBeCalled();
     $this->processOrderPayments($order);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:11,代码来源:PaymentProcessorSpec.php

示例9:

 function it_sets_not_started_payments_as_cancelled_while_creating_payment($paymentManager, $paymentFactory, OrderInterface $order, PaymentInterface $existingPayment, PaymentInterface $payment)
 {
     $existingPayment->getState()->willReturn('new');
     $order->getPayments()->willReturn(array($existingPayment))->shouldBeCalled();
     $existingPayment->setState('cancelled')->shouldBeCalled();
     $paymentManager->flush()->shouldBeCalled();
     $order->getCurrency()->willReturn('EUR')->shouldBeCalled();
     $order->getTotal()->willReturn(100)->shouldBeCalled();
     $paymentFactory->createNew()->willReturn($payment)->shouldBeCalled();
     $payment->setCurrency('EUR')->shouldBeCalled();
     $payment->setAmount(100)->shouldBeCalled();
     $order->addPayment($payment)->shouldBeCalled();
     $this->createPayment($order)->shouldReturn($payment);
 }
开发者ID:bendavies,项目名称:Sylius,代码行数:14,代码来源:PaymentProcessorSpec.php

示例10: ArrayCollection

 function it_marks_order_as_partially_paid_if_one_of_the_payment_is_processing(FactoryInterface $stateMachineFactory, StateMachineInterface $stateMachine, OrderInterface $order, PaymentInterface $payment1, PaymentInterface $payment2)
 {
     $payment1->getAmount()->willReturn(6000);
     $payment1->getState()->willReturn(PaymentInterface::STATE_PROCESSING);
     $payment2->getAmount()->willReturn(4000);
     $payment2->getState()->willReturn(PaymentInterface::STATE_COMPLETED);
     $payments = new ArrayCollection([$payment1->getWrappedObject(), $payment2->getWrappedObject()]);
     $order->hasPayments()->willReturn(true);
     $order->getPayments()->willReturn($payments);
     $order->getPaymentState()->willReturn(OrderPaymentStates::STATE_AWAITING_PAYMENT);
     $order->getTotal()->willReturn(10000);
     $stateMachineFactory->get($order, OrderPaymentTransitions::GRAPH)->willReturn($stateMachine);
     $stateMachine->can(OrderPaymentTransitions::TRANSITION_PARTIALLY_PAY)->willReturn(true);
     $stateMachine->apply(OrderPaymentTransitions::TRANSITION_PARTIALLY_PAY)->shouldBeCalled();
     $this->resolve($order);
 }
开发者ID:starspire,项目名称:Sylius,代码行数:16,代码来源:OrderPaymentStateResolverSpec.php

示例11: provideOrderPayment

 /**
  * {@inheritdoc}
  */
 public function provideOrderPayment(OrderInterface $order, $targetState)
 {
     /** @var PaymentInterface $payment */
     $payment = $this->paymentFactory->createWithAmountAndCurrencyCode($order->getTotal(), $order->getCurrencyCode());
     $paymentMethod = $this->getDefaultPaymentMethod($payment, $order);
     $lastPayment = $this->getLastPayment($order);
     if (null !== $lastPayment) {
         $paymentMethod = $lastPayment->getMethod();
     }
     if (null === $paymentMethod) {
         throw new NotProvidedOrderPaymentException();
     }
     $payment->setMethod($paymentMethod);
     $this->applyRequiredTransition($payment, $targetState);
     return $payment;
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:19,代码来源:OrderPaymentProvider.php

示例12:

 function it_sets_orders_total_on_payment_amount_when_payment_is_new(OrderInterface $order, PaymentInterface $payment)
 {
     $order->getState()->willReturn(OrderInterface::STATE_NEW);
     $order->getTotal()->willReturn(123);
     $order->getCurrencyCode()->willReturn('EUR');
     $payment->getState()->willReturn(PaymentInterface::STATE_NEW);
     $order->getLastPayment(PaymentInterface::STATE_NEW)->willReturn($payment);
     $payment->setAmount(123)->shouldBeCalled();
     $payment->setCurrencyCode('EUR')->shouldBeCalled();
     $this->process($order);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:11,代码来源:OrderPaymentProcessorSpec.php

示例13: Payment

 function it_marks_order_as_new_if_no_payment_is_in_process(OrderInterface $order)
 {
     $payment1 = new Payment();
     $payment1->setAmount(6000);
     $payment1->setState(PaymentInterface::STATE_NEW);
     $payment2 = new Payment();
     $payment2->setAmount(4000);
     $payment2->setState(PaymentInterface::STATE_NEW);
     $payments = new ArrayCollection(array($payment1, $payment2));
     $order->hasPayments()->willReturn(true);
     $order->getPayments()->willReturn($payments);
     $order->getTotal()->willReturn(10000);
     $order->setPaymentState(PaymentInterface::STATE_NEW)->shouldBeCalled();
     $this->resolvePaymentState($order);
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:15,代码来源:StateResolverSpec.php

示例14:

 function it_throws_exception_if_payment_method_cannot_be_resolved_for_provided_payment(OrderInterface $order, PaymentFactoryInterface $paymentFactory, PaymentInterface $lastFailedPayment, PaymentInterface $newPayment)
 {
     $order->getTotal()->willReturn(1000);
     $order->getCurrencyCode()->willReturn('USD');
     $order->getLastPayment(PaymentInterface::STATE_CANCELLED)->willReturn(null);
     $order->getLastPayment(PaymentInterface::STATE_FAILED)->willReturn($lastFailedPayment);
     $lastFailedPayment->getMethod()->willReturn(null);
     $paymentFactory->createWithAmountAndCurrencyCode(1000, 'USD')->willReturn($newPayment);
     $this->shouldThrow(NotProvidedOrderPaymentException::class)->during('provideOrderPayment', [$order, PaymentInterface::STATE_NEW]);
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:10,代码来源:OrderPaymentProviderSpec.php


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