mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-07 02:50:12 +00:00
53 - Generating a Valid Payment Token
This commit is contained in:
29
tests/unit/Billing/StripePaymentGatewayTest.php
Normal file
29
tests/unit/Billing/StripePaymentGatewayTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class StripePaymentGatewayTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
function charges_with_a_valid_payment_token_are_successful()
|
||||
{
|
||||
// Create a new StripePaymentGateway
|
||||
$paymentGateway = new StripePaymentGateway;
|
||||
|
||||
$token = \Stripe\Token::create([
|
||||
"card" => [
|
||||
"number" => "4242424242424242",
|
||||
"exp_month" => 1,
|
||||
"exp_year" => date('Y') + 1,
|
||||
"cvc" => "123"
|
||||
]
|
||||
], ['api_key' => config('services.stripe.secret')])->id;
|
||||
|
||||
// Create a new charge for some amount using a valid token
|
||||
$paymentGateway->charge(2500, $token);
|
||||
|
||||
// Verify that the charge was completed successfully
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user