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


PHP OrderInterface::getLastPayment方法代码示例

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


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

示例1: getLastPayment

 /**
  * @param OrderInterface $order
  *
  * @return null|PaymentInterface
  */
 private function getLastPayment(OrderInterface $order)
 {
     $lastPayment = $order->getLastPayment(PaymentInterface::STATE_CANCELLED);
     if (null === $lastPayment) {
         $lastPayment = $order->getLastPayment(PaymentInterface::STATE_FAILED);
     }
     return $lastPayment;
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:13,代码来源:PaymentProcessor.php

示例2: setPaymentMethodIfNeeded

 /**
  * {@inheritdoc}
  */
 private function setPaymentMethodIfNeeded(OrderInterface $order, PaymentInterface $payment)
 {
     $lastCancelledPayment = $order->getLastPayment(PaymentInterface::STATE_CANCELLED);
     $lastNewPayment = $order->getLastPayment(PaymentInterface::STATE_NEW);
     if (!$lastNewPayment && $lastCancelledPayment) {
         $payment->setMethod($lastCancelledPayment->getMethod());
     }
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:11,代码来源:PaymentProcessor.php

示例3:

 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

示例4: getLastPayment

 /**
  * @param OrderInterface $order
  *
  * @return PaymentInterface|null
  */
 private function getLastPayment(OrderInterface $order)
 {
     $lastCancelledPayment = $order->getLastPayment(PaymentInterface::STATE_CANCELLED);
     if (null !== $lastCancelledPayment) {
         return $lastCancelledPayment;
     }
     $lastFailedPayment = $order->getLastPayment(PaymentInterface::STATE_FAILED);
     if (null !== $lastFailedPayment) {
         return $lastFailedPayment;
     }
     return null;
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:17,代码来源:OrderPaymentProvider.php

示例5:

 function it_does_not_set_order_payment_if_it_cannot_be_provided(OrderInterface $order, OrderPaymentProviderInterface $orderPaymentProvider)
 {
     $order->getState()->willReturn(OrderInterface::STATE_CART);
     $order->getLastPayment(PaymentInterface::STATE_CART)->willReturn(null);
     $orderPaymentProvider->provideOrderPayment($order, PaymentInterface::STATE_CART)->willThrow(NotProvidedOrderPaymentException::class);
     $order->addPayment(Argument::any())->shouldNotBeCalled();
     $this->process($order);
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:8,代码来源:OrderPaymentProcessorSpec.php

示例6:

 function it_tries_to_pay_again(SharedStorageInterface $sharedStorage, OrderRepositoryInterface $orderRepository, PaypalApiMocker $paypalApiMocker, OrderPaymentsPageInterface $orderPaymentsPage, OrderInterface $order, CustomerInterface $customer, UserInterface $user, PaymentInterface $payment)
 {
     $sharedStorage->get('user')->willReturn($user);
     $user->getCustomer()->willReturn($customer);
     $orderRepository->findByCustomer($customer)->willReturn([$order]);
     $order->getLastPayment()->willReturn($payment);
     $paypalApiMocker->mockApiPaymentInitializeResponse()->shouldBeCalled();
     $orderPaymentsPage->clickPayButtonForGivenPayment($payment)->shouldBeCalled();
     $this->iTryToPayAgain();
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:10,代码来源:PaypalContextSpec.php

示例7:

 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

示例8: thisOrderIsAlreadyPaid

 /**
  * @Given /^(this order) is already paid$/
  */
 public function thisOrderIsAlreadyPaid(OrderInterface $order)
 {
     $payment = $order->getLastPayment();
     $this->stateMachineFactory->get($payment, PaymentTransitions::GRAPH)->apply(PaymentTransitions::TRANSITION_COMPLETE);
     $this->objectManager->flush();
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:9,代码来源:OrderContext.php

示例9:

 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

示例10: getLastPayment

 /**
  * @param OrderInterface $order
  *
  * @return null|PaymentInterface
  */
 private function getLastPayment(OrderInterface $order)
 {
     return $order->getLastPayment(PaymentInterface::STATE_CANCELLED) ?: $order->getLastPayment(PaymentInterface::STATE_FAILED);
 }
开发者ID:origammi,项目名称:Sylius,代码行数:9,代码来源:OrderPaymentProcessor.php


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