public function abandonCart(PurchaseCompleteEvent $event)
 {
     if (in_array($event->getSubject()->getState(), [PaymentInterface::STATE_PENDING, PaymentInterface::STATE_PROCESSING, PaymentInterface::STATE_COMPLETED])) {
         $this->cartProvider->abandonCart();
         return;
     }
     $event->setResponse(new RedirectResponse($this->router->generate($this->redirectTo)));
 }
 function it_should_not_abandon_cart_if_payment_status_unknown(CartProviderInterface $cartProvider, PurchaseCompleteEvent $event, PaymentInterface $payment)
 {
     $payment->getState()->willReturn(PaymentInterface::STATE_UNKNOWN);
     $cartProvider->abandonCart()->shouldNotBeCalled();
     $event->setResponse(new RedirectResponse('/payment'))->shouldBeCalled();
     $this->abandonCart($event);
 }