mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-08 11:50:38 +00:00
62 - Refactoring Towards Duplication
This commit is contained in:
@@ -5,4 +5,6 @@ namespace App\Billing;
|
||||
interface PaymentGateway
|
||||
{
|
||||
public function charge($amount, $token);
|
||||
|
||||
public function getValidTestToken();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user