public function testDeleteCustomerFailure()
 {
     $httpResponse = $this->getMockHttpResponse('DeleteCustomerFailure.txt');
     $response = new Response($this->getMockRequest(), $httpResponse->json());
     $this->assertFalse($response->isSuccessful());
     $this->assertFalse($response->isRedirect());
     $this->assertNull($response->getTransactionReference());
     $this->assertNull($response->getCustomerReference());
     $this->assertSame('No such customer: cus_1MZeNih5LdKxDq', $response->getMessage());
 }
 /**
  * @param Payment  $payment
  * @param Response $purchaseResponse
  *
  * @throws SavePaymentFailedException
  */
 protected function updatePaymentWithStripeCharge(Payment $payment, Response $purchaseResponse)
 {
     $payment->hasBeenPaidWithGatewayTransaction(new StripePaymentId($purchaseResponse->getTransactionReference()));
     try {
         $this->repository->markAsPaid($payment);
     } catch (SavePaymentFailedException $savePaymentFailedException) {
         throw $savePaymentFailedException;
     }
 }
 /**
  * @uses TakePaymentCommandHandler::_handle()
  */
 function it_should_throw_a_payment_not_authorised_exception_if_stripe_payment_gateway_rejects_request(PaymentRepositoryInterface $repository, TakePaymentCommand $command, Response $response)
 {
     $this->setRepositoryMethodExpectations($repository);
     $this->clearRepositoryMarkAsPaidExpectation($repository);
     /** @noinspection PhpUndefinedMethodInspection */
     $response->isSuccessful()->willReturn(false);
     /** @noinspection PhpUndefinedMethodInspection */
     $response->getMessage()->willReturn('You have no money!');
     // @todo - I'd like to test this exception more accurately, but currently required exact object match, rather
     //         than like match
     $this->shouldThrow(PaymentNotAuthorisedException::class)->during('handle', [$command]);
 }