mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 03:04:05 +00:00
61 - When Interfaces Aren't Enough
This commit is contained in:
@@ -23,7 +23,7 @@ class StripePaymentGateway implements PaymentGateway
|
||||
'currency' => 'usd',
|
||||
], ['api_key' => $this->apiKey]);
|
||||
} catch (InvalidRequest $e) {
|
||||
throw new PaymentFailedException;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,15 +28,9 @@ class StripePaymentGatewayTest extends TestCase
|
||||
/** @test */
|
||||
function charges_with_an_invalid_payment_token_fail()
|
||||
{
|
||||
try {
|
||||
$paymentGateway = new StripePaymentGateway(config('services.stripe.secret'));
|
||||
$paymentGateway->charge(2500, 'invalid-payment-token');
|
||||
} catch (PaymentFailedException $e) {
|
||||
$this->assertCount(0, $this->newCharges());
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail("Charging with an invalid payment token did not throw a PaymentFailedException.");
|
||||
$paymentGateway = new StripePaymentGateway(config('services.stripe.secret'));
|
||||
$result = $paymentGateway->charge(2500, 'invalid-payment-token');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
private function lastCharge()
|
||||
|
||||
Reference in New Issue
Block a user