62 - Refactoring Towards Duplication

This commit is contained in:
Adam Wathan
2017-01-17 19:57:34 -05:00
parent 74ed409e46
commit f1a57e27f6
4 changed files with 32 additions and 5 deletions

View File

@@ -5,4 +5,6 @@ namespace App\Billing;
interface PaymentGateway
{
public function charge($amount, $token);
public function getValidTestToken();
}

View File

@@ -26,4 +26,16 @@ class StripePaymentGateway implements PaymentGateway
throw new PaymentFailedException;
}
}
public function getValidTestToken()
{
return \Stripe\Token::create([
"card" => [
"number" => "4242424242424242",
"exp_month" => 1,
"exp_year" => date('Y') + 1,
"cvc" => "123"
]
], ['api_key' => $this->apiKey])->id;
}
}