/** * @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_store_a_successful_payment(TakePaymentCommand $command, PaymentRepositoryInterface $repository) { $this->setRepositoryMethodExpectations($repository); /** @noinspection PhpUndefinedMethodInspection */ $this->handle($command); $expectedPayment = new Payment($this->cost, self::TOKEN, self::DESCRIPTION, $this->userEmail); $expectedPayment->hasBeenPaidWithGatewayTransaction(new StripePaymentId(self::STRIPE_PAYMENT_ID)); }