Merge pull request #5509 from turbo124/v5-develop

Fixes for stripe connect
This commit is contained in:
David Bomba 2021-04-22 23:41:58 +10:00 committed by GitHub
commit 1cf96a5ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 14 deletions

View File

@ -291,7 +291,9 @@ class SetupController extends Controller
Artisan::call('migrate', ['--force' => true]); Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]);
return redirect('/?clear_cache=true'); $this->buildCache(true);
return redirect('/');
} }
} }

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()

View File

@ -370,7 +370,7 @@ class BaseDriver extends AbstractPaymentDriver
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->get(); $invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->get();
$invoices->first()->invitations->each(function ($invitation) { $invoices->first()->invitations->each(function ($invitation) use ($nmo){
if ($invitation->contact->send_email && $invitation->contact->email) { if ($invitation->contact->send_email && $invitation->contact->email) {

View File

@ -58,7 +58,7 @@ trait Utilities
private function processSuccessfulPayment(Payment $_payment) private function processSuccessfulPayment(Payment $_payment)
{ {
if ($this->getParent()->payment_hash->data->store_card) { if ($this->getParent()->payment_hash->data->store_card) {
$this->storePaymentMethod($_payment); $this->storeLocalPaymentMethod($_payment);
} }
$data = [ $data = [
@ -118,7 +118,7 @@ trait Utilities
} }
} }
private function storePaymentMethod(Payment $response) private function storeLocalPaymentMethod(Payment $response)
{ {
try { try {
$payment_meta = new stdClass; $payment_meta = new stdClass;

View File

@ -37,11 +37,8 @@ trait AppSetup
{ {
$cached_tables = config('ninja.cached_tables'); $cached_tables = config('ninja.cached_tables');
if(request()->has('clear_cache'))
Artisan::call('optimize');
foreach ($cached_tables as $name => $class) { foreach ($cached_tables as $name => $class) {
if (request()->has('clear_cache') || !Cache::has($name) || $force) { if (!Cache::has($name) || $force) {
// check that the table exists in case the migration is pending // check that the table exists in case the migration is pending
if (!Schema::hasTable((new $class())->getTable())) { if (!Schema::hasTable((new $class())->getTable())) {
@ -64,9 +61,8 @@ trait AppSetup
} }
/*Build template cache*/ /*Build template cache*/
if (request()->has('clear_cache') || !Cache::has('templates')) { $this->buildTemplates();
$this->buildTemplates();
}
} }

View File

@ -1775,6 +1775,7 @@ $LANG = array(
'lang_Chinese - Taiwan' => 'Chinese - Taiwan', 'lang_Chinese - Taiwan' => 'Chinese - Taiwan',
'lang_Serbian' => 'Serbian', 'lang_Serbian' => 'Serbian',
'lang_Bulgarian' => 'Bulgarian', 'lang_Bulgarian' => 'Bulgarian',
'lang_Russian' => 'Russian',
// Industries // Industries
'industry_Accounting & Legal' => 'Accounting & Legal', 'industry_Accounting & Legal' => 'Accounting & Legal',