mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 11:14:31 -04:00
Merge pull request #5748 from turbo124/v5-develop
Fixes for importing customers into Stripe.
This commit is contained in:
commit
24d32c5d88
@ -57,15 +57,19 @@ class ImportCustomers
|
|||||||
private function addCustomer(Customer $customer)
|
private function addCustomer(Customer $customer)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!$account->isPaidHostedClient() && Client::where('company_id', $this->stripe->company_gateway->company_id)->count() > config('ninja.quotas.free.clients'))
|
||||||
|
return;
|
||||||
|
|
||||||
$account = $this->stripe->company_gateway->company->account;
|
$account = $this->stripe->company_gateway->company->account;
|
||||||
|
|
||||||
|
nlog("search Stripe for {$custom->id}");
|
||||||
|
|
||||||
$existing_customer = $this->stripe
|
$existing_customer = $this->stripe
|
||||||
->company_gateway
|
->company_gateway
|
||||||
->client_gateway_tokens()
|
->client_gateway_tokens()
|
||||||
->where('gateway_customer_reference', $customer->id)
|
->where('gateway_customer_reference', $customer->id)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
|
|
||||||
if($existing_customer)
|
if($existing_customer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -105,8 +109,6 @@ class ImportCustomers
|
|||||||
|
|
||||||
$client->name = property_exists($customer, 'name') ? $customer->name : '';
|
$client->name = property_exists($customer, 'name') ? $customer->name : '';
|
||||||
|
|
||||||
if(!$account->isPaidHostedClient() && Client::where('company_id', $this->stripe->company_gateway->company_id)->count() <= config('ninja.quotas.free.clients')){
|
|
||||||
|
|
||||||
$client->save();
|
$client->save();
|
||||||
|
|
||||||
$contact = ClientContactFactory::create($client->company_id, $client->user_id);
|
$contact = ClientContactFactory::create($client->company_id, $client->user_id);
|
||||||
@ -116,6 +118,5 @@ class ImportCustomers
|
|||||||
$contact->email = $client->email ?: '';
|
$contact->email = $client->email ?: '';
|
||||||
$contact->save();
|
$contact->save();
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user