1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Allow multiple stripe instances

This commit is contained in:
David Bomba 2024-05-04 09:22:04 +10:00
parent 244eabc448
commit 910e3f9482

View File

@ -37,18 +37,18 @@ class StripeConnectController extends BaseController
MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']);
$company_gateway = CompanyGateway::query()
->where('gateway_key', 'd14dd26a47cecc30fdd65700bfb67b34')
->where('company_id', $request->getCompany()->id)
->first();
// $company_gateway = CompanyGateway::query()
// ->where('gateway_key', 'd14dd26a47cecc30fdd65700bfb67b34')
// ->where('company_id', $request->getCompany()->id)
// ->first();
if ($company_gateway) {
$config = $company_gateway->getConfig();
// if ($company_gateway) {
// $config = $company_gateway->getConfig();
if (property_exists($config, 'account_id') && strlen($config->account_id) > 5) {
return view('auth.connect.existing');
}
}
// if (property_exists($config, 'account_id') && strlen($config->account_id) > 5) {
// return view('auth.connect.existing');
// }
// }
$stripe_client_id = config('ninja.ninja_stripe_client_id');
$redirect_uri = config('ninja.app_url').'/stripe/completed';
@ -127,7 +127,6 @@ class StripeConnectController extends BaseController
'refresh_token' => $response->refresh_token,
'access_token' => $response->access_token,
'appleDomainVerification' => '',
// "statementDescriptor" => "",
];
$company_gateway->setConfig($payload);
@ -145,9 +144,6 @@ class StripeConnectController extends BaseController
nlog("could not harvest stripe company name");
}
// nlog("Stripe Connect Redirect URI = {$redirect_uri}");
// StripeWebhook::dispatch($company->company_key, $company_gateway->id);
if(isset($request->getTokenContent()['is_react']) && $request->getTokenContent()['is_react']) {
$redirect_uri = config('ninja.react_url').'/#/settings/online_payments';
} else {
@ -158,7 +154,7 @@ class StripeConnectController extends BaseController
//response here
return view('auth.connect.completed', ['url' => $redirect_uri]);
// return redirect($redirect_uri);
}
}