/**
  * {@inheritdoc}
  */
 public function process(OrderInterface $order)
 {
     if (OrderInterface::STATE_CANCELLED === $order->getState()) {
         return;
     }
     $this->exchangeRateUpdater->update($order);
 }
 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);
 }
예제 #3
0
 /**
  * {@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);
 }
 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);
 }
 function it_processes_the_order(OrderUpdaterInterface $orderUpdater, OrderInterface $order)
 {
     $order->getState()->willReturn(Argument::not(OrderInterface::STATE_CANCELLED));
     $orderUpdater->update($order)->shouldBeCalled();
     $this->process($order);
 }
예제 #6
0
 /**
  * @Then /^(this order) should not be cancelled$/
  */
 public function thisOrderShouldNotBeCancelled(OrderInterface $order)
 {
     Assert::notSame(OrderInterface::STATE_CANCELLED, $order->getState(), 'Order should not be cancelled, but its is.');
 }