/** * @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; } }
/** * Clears the expected calls on PaymentRepositoryInterface stub markAsPaid() method * * @param PaymentRepositoryInterface $repository */ protected function clearRepositoryMarkAsPaidExpectation(PaymentRepositoryInterface $repository) { /** @noinspection PhpVoidFunctionResultUsedInspection */ /** @noinspection PhpUndefinedMethodInspection */ $repository->markAsPaid($this->expectedProcessedPayment)->shouldNotBeCalled(); }