function it_creates_payment(GenericEvent $event, OrderInterface $order, PaymentProcessorInterface $processor) { $event->getSubject()->willReturn($order); $order->getLastPayment()->willReturn(false); $processor->createPayment($order)->shouldBeCalled(); $this->createOrderPayment($event); }
/** * Get the order from event and create payment. * * @param GenericEvent $event * * @throws \InvalidArgumentException */ public function createOrderPayment(GenericEvent $event) { $this->paymentProcessor->createPayment($this->getOrder($event)); }
/** * Get the order from event and create payment. * * @param GenericEvent $event * * @throws \InvalidArgumentException */ public function createOrderPayment(GenericEvent $event) { if (false === $this->getOrder($event)->getLastPayment()) { $this->paymentProcessor->createPayment($this->getOrder($event)); } }