1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00

Import GoCardless customers and mandates

This commit is contained in:
David Bomba 2023-03-02 14:37:32 +11:00
parent c0e34b369e
commit 70f5c79bc2

View File

@ -422,7 +422,7 @@ class GoCardlessPaymentDriver extends BaseDriver
foreach($mandates->records as $mandate) foreach($mandates->records as $mandate)
{ {
if($customer->id != $mandate->links->customer || $mandate->status != 'active') { if($customer->id != $mandate->links->customer || $mandate->status != 'active' || ClientGatewayToken::where('token', $mandate->id)->where('gateway_customer_reference', $customer->id)->exists()) {
continue; continue;
} }
@ -504,6 +504,7 @@ class GoCardlessPaymentDriver extends BaseDriver
$contact->last_name = $customer->family_name ?: ''; $contact->last_name = $customer->family_name ?: '';
$contact->email = $customer->email ?: ''; $contact->email = $customer->email ?: '';
$contact->client_id = $client->id; $contact->client_id = $client->id;
$contact->saveQuietly();
if (! isset($client->number) || empty($client->number)) { if (! isset($client->number) || empty($client->number)) {
$x = 1; $x = 1;