1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

force sandbox url for specific company

This commit is contained in:
Benjamin Beganović 2024-09-25 17:46:31 +02:00
parent 58640ec8e6
commit e07cf0603c

View File

@ -44,6 +44,9 @@ class GoCardlessOAuthController extends Controller
? 'https://connect.gocardless.com/oauth/authorize?%s'
: 'https://connect-sandbox.gocardless.com/oauth/authorize?%s';
if (config('services.gocardless.testing_company') == $company->id) {
$url = 'https://connect-sandbox.gocardless.com/oauth/authorize?%s';
}
return redirect()->to(
sprintf($url, http_build_query($params))
@ -55,13 +58,14 @@ class GoCardlessOAuthController extends Controller
/** @var \App\Models\Company $company */
$company = $request->getCompany();
// LBo0v_561xgFGnFUae6uEQEfrWoSEMnZ&state=5O2O85C8dPv1Gp1UPVq0xs4FVTZdq5dO
// https://invoicing.co/gocardless/oauth/connect/confirm?code=sH55_xb-2s1JtuEw-j7W0hT0Z1sFkM7l
$url = config('services.gocardless.environment') === 'production'
? 'https://connect.gocardless.com/oauth/access_token'
: 'https://connect-sandbox.gocardless.com/oauth/access_token';
if (config('services.gocardless.testing_company') == $company->id) {
$url = 'https://connect-sandbox.gocardless.com/oauth/access_token';
}
$response = Http::post($url, [
'client_id' => config('services.gocardless.client_id'),
'client_secret' => config('services.gocardless.client_secret'),