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


PHP OrderInterface::addPayment方法代码示例

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


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

示例1:

 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

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

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

 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

示例5:

 function it_does_not_add_a_new_payment_if_the_order_is_cancelled(OrderInterface $order)
 {
     $order->getState()->willReturn(OrderInterface::STATE_CANCELLED);
     $order->addPayment(Argument::any())->shouldNotBeCalled();
     $this->process($order);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:6,代码来源:OrderPaymentProcessorSpec.php

示例6: processOrderPayments

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


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