mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 00:54:38 -04:00
Fixes for Stripe Connect - initial account
This commit is contained in:
parent
95767f8bdd
commit
a6b2165eec
@ -60,12 +60,6 @@ class StripeConnectController extends BaseController
|
|||||||
$redirect_uri = 'https://invoicing.co/stripe/completed';
|
$redirect_uri = 'https://invoicing.co/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}";
|
$endpoint = "https://connect.stripe.com/oauth/authorize?response_type=code&client_id={$stripe_client_id}&redirect_uri={$redirect_uri}&scope=read_write&state={$token}";
|
||||||
|
|
||||||
// if($email = $request->getContact()->email)
|
|
||||||
// $endpoint .= "&stripe_user[email]={$email}";
|
|
||||||
|
|
||||||
// $company_name = str_replace(" ", "_", $company->present()->name());
|
|
||||||
// $endpoint .= "&stripe_user[business_name]={$company_name}";
|
|
||||||
|
|
||||||
return redirect($endpoint);
|
return redirect($endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,18 +81,24 @@ class StripeConnectController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nlog($response);
|
|
||||||
|
|
||||||
$company = Company::where('company_key', $request->getTokenContent()['company_key'])->first();
|
$company = Company::where('company_key', $request->getTokenContent()['company_key'])->first();
|
||||||
|
|
||||||
$company_gateway = CompanyGatewayFactory::create($company->id, $company->owner()->id);
|
$company_gateway = CompanyGateway::query()
|
||||||
$fees_and_limits = new \stdClass;
|
->where('gateway_key', 'd14dd26a47cecc30fdd65700bfb67b34')
|
||||||
$fees_and_limits->{GatewayType::CREDIT_CARD} = new FeesAndLimits;
|
->where('company_id', $company->id)
|
||||||
$company_gateway->gateway_key = 'd14dd26a47cecc30fdd65700bfb67b34';
|
->first();
|
||||||
$company_gateway->fees_and_limits = $fees_and_limits;
|
|
||||||
$company_gateway->setConfig([]);
|
if(!$company_gateway)
|
||||||
$company_gateway->token_billing = 'always';
|
{
|
||||||
// $company_gateway->save();
|
$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';
|
||||||
|
$company_gateway->fees_and_limits = $fees_and_limits;
|
||||||
|
$company_gateway->setConfig([]);
|
||||||
|
$company_gateway->token_billing = 'always';
|
||||||
|
// $company_gateway->save();
|
||||||
|
}
|
||||||
|
|
||||||
$payload = [
|
$payload = [
|
||||||
'account_id' => $response->stripe_user_id,
|
'account_id' => $response->stripe_user_id,
|
||||||
@ -111,18 +111,6 @@ class StripeConnectController extends BaseController
|
|||||||
"access_token" => $response->access_token
|
"access_token" => $response->access_token
|
||||||
];
|
];
|
||||||
|
|
||||||
/* Link account if existing account exists */
|
|
||||||
// if($account_id = $this->checkAccountAlreadyLinkToEmail($company_gateway, $request->getContact()->email)) {
|
|
||||||
|
|
||||||
// $payload['account_id'] = $account_id;
|
|
||||||
// $payload['stripe_user_id'] = $account_id;
|
|
||||||
// $company_gateway->setConfig($payload);
|
|
||||||
// $company_gateway->save();
|
|
||||||
|
|
||||||
// return view('auth.connect.existing');
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
$company_gateway->setConfig($payload);
|
$company_gateway->setConfig($payload);
|
||||||
$company_gateway->save();
|
$company_gateway->save();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user