mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 03:04:05 +00:00
157 - Authorizing with Stripe
This commit is contained in:
23
app/Http/Controllers/Backstage/StripeConnectController.php
Normal file
23
app/Http/Controllers/Backstage/StripeConnectController.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backstage;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class StripeConnectController extends Controller
|
||||
{
|
||||
public function authorizeRedirect()
|
||||
{
|
||||
$url = vsprintf('%s?%s', [
|
||||
'https://connect.stripe.com/oauth/authorize',
|
||||
http_build_query([
|
||||
'response_type' => 'code',
|
||||
'scope' => 'read_write',
|
||||
'client_id' => config('services.stripe.client_id'),
|
||||
]),
|
||||
]);
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ return [
|
||||
'model' => App\User::class,
|
||||
'key' => env('STRIPE_KEY'),
|
||||
'secret' => env('STRIPE_SECRET'),
|
||||
'client_id' => env('STRIPE_CLIENT_ID')
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -17,6 +17,8 @@ class CreateUsersTable extends Migration
|
||||
$table->increments('id');
|
||||
$table->string('email')->unique();
|
||||
$table->string('password');
|
||||
$table->string('stripe_account_id')->nullable();
|
||||
$table->string('stripe_access_token')->nullable();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
@@ -35,5 +35,7 @@ Route::group(['middleware' => 'auth', 'prefix' => 'backstage', 'namespace' => 'B
|
||||
|
||||
Route::get('/concerts/{id}/messages/new', 'ConcertMessagesController@create')->name('backstage.concert-messages.new');
|
||||
Route::post('/concerts/{id}/messages', 'ConcertMessagesController@store')->name('backstage.concert-messages.store');
|
||||
|
||||
Route::get('/stripe-connect/authorize', 'StripeConnectController@authorizeRedirect');
|
||||
});
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
|
||||
class ConnectWithStripeTest extends DuskTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
/** @test */
|
||||
public function connecting_a_stripe_account_successfully()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user