diff --git a/app/PaymentDrivers/Stripe/Connect/Verify.php b/app/PaymentDrivers/Stripe/Connect/Verify.php
index e957e6f5b248..fb4919529b31 100644
--- a/app/PaymentDrivers/Stripe/Connect/Verify.php
+++ b/app/PaymentDrivers/Stripe/Connect/Verify.php
@@ -52,7 +52,19 @@ class Verify
if($this->stripe->stripe_connect && strlen($this->stripe->company_gateway->getConfigField('account_id')) < 1)
throw new StripeConnectFailure('Stripe Connect has not been configured');
- $customers = Customer::all([], $this->stripe->stripe_connect_auth);
+ $total_stripe_customers = 0;
+
+ $starting_after = null;
+
+ do {
+
+ $customers = Customer::all(['limit' => 100, 'starting_after' => $starting_after], $this->stripe->stripe_connect_auth);
+
+ $total_stripe_customers += count($customers->data);
+ $starting_after = end($customers->data)['id'];
+
+ } while($customers->has_more);
+
$stripe_customers = $this->stripe->company_gateway->client_gateway_tokens->map(function ($cgt){
@@ -66,7 +78,7 @@ class Verify
});
$data = [
- 'stripe_customer_count' => count($customers),
+ 'stripe_customer_count' => $total_stripe_customers,
'stripe_customers' => $stripe_customers,
];
diff --git a/app/PaymentDrivers/Stripe/ImportCustomers.php b/app/PaymentDrivers/Stripe/ImportCustomers.php
index bd06616dafd6..38690c8aa25a 100644
--- a/app/PaymentDrivers/Stripe/ImportCustomers.php
+++ b/app/PaymentDrivers/Stripe/ImportCustomers.php
@@ -55,13 +55,20 @@ class ImportCustomers
if(Ninja::isHosted() && strlen($this->stripe->company_gateway->getConfigField('account_id')) < 1)
throw new StripeConnectFailure('Stripe Connect has not been configured');
- $customers = Customer::all([], $this->stripe->stripe_connect_auth);
+ $starting_after = null;
- foreach($customers as $customer)
- {
- $this->addCustomer($customer);
- }
+ do {
+
+ $customers = Customer::all(['limit' => 100, 'starting_after' => $starting_after], $this->stripe->stripe_connect_auth);
+ foreach($customers as $customer)
+ {
+ $this->addCustomer($customer);
+ }
+
+ $starting_after = end($customers->data)['id'];
+
+ } while($customers->has_more);
}
private function addCustomer(Customer $customer)
@@ -72,7 +79,7 @@ class ImportCustomers
if(!$account->isPaidHostedClient() && Client::where('company_id', $this->stripe->company_gateway->company_id)->count() > config('ninja.quotas.free.clients'))
return;
- nlog("search Stripe for {$customer->id}");
+ // nlog("search Stripe for {$customer->id}");
$existing_customer_token = $this->stripe
->company_gateway
@@ -97,7 +104,7 @@ class ImportCustomers
return;
}
- nlog("inserting a customer");
+ // nlog("inserting a customer");
//nlog($customer);
$client = ClientFactory::create($this->stripe->company_gateway->company_id, $this->stripe->company_gateway->user_id);
diff --git a/app/Utils/Helpers.php b/app/Utils/Helpers.php
index f1b139efa57e..6f633612e4f8 100644
--- a/app/Utils/Helpers.php
+++ b/app/Utils/Helpers.php
@@ -264,8 +264,6 @@ class Helpers
$x = str_replace(["\n", "
"], ["\r", "
"], $value);
- nlog($x);
-
return $x;
}