mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Checkout.com import customers
This commit is contained in:
parent
37e2e772f9
commit
fc61065e69
@ -556,7 +556,15 @@ class CheckoutComPaymentDriver extends BaseDriver
|
|||||||
->where('token', $token)
|
->where('token', $token)
|
||||||
->first();
|
->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ImportCustomers
|
||||||
|
*
|
||||||
|
* Only their methods because checkout.com
|
||||||
|
* does not have a list route for customers
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function importCustomers()
|
public function importCustomers()
|
||||||
{
|
{
|
||||||
$this->init();
|
$this->init();
|
||||||
@ -567,29 +575,21 @@ class CheckoutComPaymentDriver extends BaseDriver
|
|||||||
->cursor()
|
->cursor()
|
||||||
->each(function ($client){
|
->each(function ($client){
|
||||||
|
|
||||||
nlog("1");
|
|
||||||
|
|
||||||
if(!str_contains($client->present()->email(), "@"))
|
if(!str_contains($client->present()->email(), "@"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
nlog("2");
|
|
||||||
nlog($client->present()->email());
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$customer = $this->gateway->getCustomersClient()->get($client->present()->email());
|
$customer = $this->gateway->getCustomersClient()->get($client->present()->email());
|
||||||
}
|
}
|
||||||
catch(\Exception $e) {
|
catch(\Exception $e) {
|
||||||
nlog("returning due to exception");
|
nlog("Checkout: Customer not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlog("3");
|
|
||||||
|
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
|
|
||||||
nlog($customer['instruments']);
|
nlog($customer['instruments']);
|
||||||
|
|
||||||
foreach($customer['instruments'] as $card)
|
foreach($customer['instruments'] as $card)
|
||||||
{
|
{
|
||||||
if(
|
if(
|
||||||
@ -598,9 +598,6 @@ nlog("3");
|
|||||||
$this->getToken($card['id'], $customer['id'])
|
$this->getToken($card['id'], $customer['id'])
|
||||||
)
|
)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
nlog("4");
|
|
||||||
|
|
||||||
$payment_meta = new \stdClass();
|
$payment_meta = new \stdClass();
|
||||||
$payment_meta->exp_month = (string) $card['expiry_month'];
|
$payment_meta->exp_month = (string) $card['expiry_month'];
|
||||||
@ -617,7 +614,6 @@ nlog("4");
|
|||||||
|
|
||||||
$this->storeGatewayToken($data, ['gateway_customer_reference' => $customer['id']]);
|
$this->storeGatewayToken($data, ['gateway_customer_reference' => $customer['id']]);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user