1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
This commit is contained in:
Benjamin Beganović 2021-04-22 11:55:19 +02:00
parent 255d25d6a6
commit 75da6df4fa

View File

@ -36,19 +36,28 @@ class StripeConnectController extends BaseController
'country' => $request->getCompany()->country()->iso_3166_2,
];
$exists = CompanyGateway::query()
->where('gateway_key', 'd14dd26a47cecc30fdd65700bfb67b34')
->where('company_id', $request->getCompany()->id)
->first();
if ($exists) {
return redirect()->route('stripe_connect.return');
}
$account = Account::create($data);
$link = Account::link($account->id, $token);
// $company_gateway = CompanyGatewayFactory::create($request->getCompany()->id, $request->getContact()->client->user->id);
//
// $company_gateway->fill([
// 'gateway_key' => 'provide-valid-stripe-key-here',
// 'fees_and_limits' => [],
// 'config' => encrypt(json_encode(['account_id' => $account->id]))
// ]);
//
// $company_gateway->save();
$company_gateway = CompanyGatewayFactory::create($request->getCompany()->id, $request->getContact()->client->user->id);
$company_gateway->fill([
'gateway_key' => 'd14dd26a47cecc30fdd65700bfb67b34',
'fees_and_limits' => [],
'config' => encrypt(json_encode(['account_id' => $account->id]))
]);
$company_gateway->save();
return redirect($link['url']);
}