mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-17 23:54:25 +00:00
53 - Generating a Valid Payment Token
This commit is contained in:
@@ -7,7 +7,8 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.6.4",
|
"php": ">=5.6.4",
|
||||||
"laravel/framework": "5.3.*",
|
"laravel/framework": "5.3.*",
|
||||||
"zondicons/blade-bridge": "^0.1.0"
|
"zondicons/blade-bridge": "^0.1.0",
|
||||||
|
"stripe/stripe-php": "^4.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fzaninotto/faker": "~1.4",
|
"fzaninotto/faker": "~1.4",
|
||||||
|
|||||||
59
composer.lock
generated
59
composer.lock
generated
@@ -4,8 +4,8 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "aa61d5762f0cbc8027e79c0b940a6b7d",
|
"hash": "8cdff7401ffaa77e712fc773720a0a25",
|
||||||
"content-hash": "50e4deb4c8728b5460bf609f167ef2b2",
|
"content-hash": "4283a0ebb9e0602a14c02b45b50cb2d7",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "classpreloader/classpreloader",
|
"name": "classpreloader/classpreloader",
|
||||||
@@ -1027,6 +1027,61 @@
|
|||||||
],
|
],
|
||||||
"time": "2016-10-02 15:51:17"
|
"time": "2016-10-02 15:51:17"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "stripe/stripe-php",
|
||||||
|
"version": "v4.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/stripe/stripe-php.git",
|
||||||
|
"reference": "234bcbd7483873c8762a67dfbdf2e6594b0a2ecc"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/234bcbd7483873c8762a67dfbdf2e6594b0a2ecc",
|
||||||
|
"reference": "234bcbd7483873c8762a67dfbdf2e6594b0a2ecc",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-curl": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.0",
|
||||||
|
"satooshi/php-coveralls": "~0.6.1",
|
||||||
|
"squizlabs/php_codesniffer": "~2.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Stripe\\": "lib/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Stripe and contributors",
|
||||||
|
"homepage": "https://github.com/stripe/stripe-php/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Stripe PHP Library",
|
||||||
|
"homepage": "https://stripe.com/",
|
||||||
|
"keywords": [
|
||||||
|
"api",
|
||||||
|
"payment processing",
|
||||||
|
"stripe"
|
||||||
|
],
|
||||||
|
"time": "2016-11-30 19:16:32"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "swiftmailer/swiftmailer",
|
"name": "swiftmailer/swiftmailer",
|
||||||
"version": "v5.4.3",
|
"version": "v5.4.3",
|
||||||
|
|||||||
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