1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Fixes for Stripe Connect

This commit is contained in:
David Bomba 2021-05-18 13:28:59 +10:00
parent 9599c8de4f
commit f39bdaef73
2 changed files with 10 additions and 16 deletions

View File

@ -53,17 +53,10 @@ class StripeConnectController extends BaseController
if(property_exists($config, 'account_id'))
return view('auth.connect.existing');
}
$company = Company::where('company_key', $request->getTokenContent()['company_key'])->first();
auth()->login($request->getContact(), true);
$stripe_client_id = config('ninja.ninja_stripe_client_id');
auth()->user()->setCompany($company);
$redirect_uri = 'http://ninja.test:8000/stripe/completed';
$endpoint = "https://connect.stripe.com/oauth/authorize?response_type=code&client_id={$stripe_client_id}&redirect_uri={$redirect_uri}&scope=read_write&state={$token}";
return redirect($endpoint);
@ -80,9 +73,8 @@ class StripeConnectController extends BaseController
]);
$company = Company::where('company_key', $request->getTokenContent()['company_key'])->first();
auth()->user()->setCompany($company);
$company_gateway = CompanyGatewayFactory::create($company->id, auth()->user()->id);
$company_gateway = CompanyGatewayFactory::create($company->id, $company->owner()->id);
$fees_and_limits = new \stdClass;
$fees_and_limits->{GatewayType::CREDIT_CARD} = new FeesAndLimits;
$company_gateway->gateway_key = 'd14dd26a47cecc30fdd65700bfb67b34';
@ -114,9 +106,9 @@ class StripeConnectController extends BaseController
}
$company_gateway->config = encrypt(json_encode($payload));
$company_gateway->save();
auth()->logout();
//response here
return view('auth.connect.completed');
}

View File

@ -34,14 +34,16 @@ class RedirectIfAuthenticated
}
break;
case 'user':
if (Auth::guard($guard)->check()) {
return redirect()->route('dashboard.index');
}
Auth::logout();
// if (Auth::guard($guard)->check()) {
// return redirect()->route('dashboard.index');
// }
break;
default:
if (Auth::guard($guard)->check()) {
return redirect('/');
}
Auth::logout();
// if (Auth::guard($guard)->check()) {
// return redirect('/');
// }
break;
}