Merge pull request #6566 from turbo124/v5-develop

Minor fixes for Stripe Import Customers
This commit is contained in:
David Bomba 2021-09-04 09:42:20 +10:00 committed by GitHub
commit baa9008a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -30,10 +30,16 @@ class NinjaPlanController extends Controller
{ {
MultiDB::findAndSetDbByCompanyKey($company_key); MultiDB::findAndSetDbByCompanyKey($company_key);
$company = Company::where('company_key', $company_key)->first(); $company = Company::where('company_key', $company_key)->first();
nlog("Ninja Plan Controller Company key found {$company->company_key}");
$account = $company->account; $account = $company->account;
if (Ninja::isHosted() && MultiDB::findAndSetDbByContactKey(request()->segment(3)) && $client_contact = ClientContact::where('contact_key', request()->segment(3))->first()) if (Ninja::isHosted() && MultiDB::findAndSetDbByContactKey($contact_key) && $client_contact = ClientContact::where('contact_key', $contact_key)->first())
{ {
nlog("Ninja Plan Controller - Found and set Client Contact");
Auth::guard('contact')->login($client_contact,true); Auth::guard('contact')->login($client_contact,true);
/* Current paid users get pushed straight to subscription overview page*/ /* Current paid users get pushed straight to subscription overview page*/

View File

@ -83,7 +83,6 @@ class ImportCustomers
if($existing_customer_token){ if($existing_customer_token){
nlog("Skipping - Customer exists: {$customer->email} just updating payment methods"); nlog("Skipping - Customer exists: {$customer->email} just updating payment methods");
$this->update_payment_methods->updateMethods($customer, $existing_customer_token->client); $this->update_payment_methods->updateMethods($customer, $existing_customer_token->client);
return;
} }
if($customer->email && $contact = $this->stripe->company_gateway->company->client_contacts()->where('email', $customer->email)->first()){ if($customer->email && $contact = $this->stripe->company_gateway->company->client_contacts()->where('email', $customer->email)->first()){