Fixes for Stripe Connect

This commit is contained in:
David Bomba 2021-04-22 23:40:36 +10:00
parent 300cc9fb9e
commit 90d786211c
2 changed files with 5 additions and 3 deletions

View File

@ -32,7 +32,8 @@ class StripeConnectController extends BaseController
// Should we check if company has set country in the ap? Otherwise this will fail. // Should we check if company has set country in the ap? Otherwise this will fail.
if(!is_array($request->getTokenContent())) if(!is_array($request->getTokenContent()))
throw new \Exception('Invalid token'); abort(400, 'Invalid token');
MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']); MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']);
@ -55,7 +56,7 @@ class StripeConnectController extends BaseController
$link = Account::link($account->id, $token); $link = Account::link($account->id, $token);
$company_gateway = CompanyGatewayFactory::create($request->getCompany()->id, $request->getContact()->client->user->id); $company_gateway = CompanyGatewayFactory::create($request->getCompany()->id, $request->getContact()->id);
$company_gateway->fill([ $company_gateway->fill([
'gateway_key' => 'd14dd26a47cecc30fdd65700bfb67b34', 'gateway_key' => 'd14dd26a47cecc30fdd65700bfb67b34',

View File

@ -14,6 +14,7 @@ namespace App\Http\Requests\StripeConnect;
use App\Models\ClientContact; use App\Models\ClientContact;
use App\Models\Company; use App\Models\Company;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
@ -55,7 +56,7 @@ class InitializeStripeConnectRequest extends FormRequest
public function getContact() public function getContact()
{ {
return ClientContact::findOrFail($this->getTokenContent()['user_id']); return User::findOrFail($this->getTokenContent()['user_id']);
} }
public function getCompany() public function getCompany()