2.9 - Handling Failed Charges

This commit is contained in:
Adam Wathan
2016-11-11 10:30:02 -05:00
parent 62bf031a17
commit 3f9ff57785
5 changed files with 47 additions and 9 deletions

View File

@@ -18,6 +18,9 @@ class FakePaymentGateway implements PaymentGateway
public function charge($amount, $token)
{
if ($token !== $this->getValidTestToken()) {
throw new PaymentFailedException;
}
$this->charges[] = $amount;
}

View File

@@ -0,0 +1,5 @@
<?php
namespace App\Billing;
class PaymentFailedException extends \RuntimeException {}