mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on importing stripe customers by id
This commit is contained in:
parent
48c330d635
commit
f7b7732f04
@ -61,7 +61,7 @@ class ACH
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], $this->stripe->stripe_connect_auth);
|
$source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], $this->stripe->stripe_connect_auth);
|
||||||
// $source = $this->stripe->stripe->customers->createSource($customer->id, ['source' => $stripe_response->token->id]);
|
|
||||||
} catch (InvalidRequestException $e) {
|
} catch (InvalidRequestException $e) {
|
||||||
throw new PaymentFailed($e->getMessage(), $e->getCode());
|
throw new PaymentFailed($e->getMessage(), $e->getCode());
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,32 @@ class ImportCustomers
|
|||||||
$this->update_payment_methods->updateMethods($customer, $client);
|
$this->update_payment_methods->updateMethods($customer, $client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function importCustomer($customer_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$this->update_payment_methods = new UpdatePaymentMethods($this->stripe);
|
||||||
|
|
||||||
|
if(strlen($this->stripe->company_gateway->getConfigField('account_id')) < 1)
|
||||||
|
throw new StripeConnectFailure('Stripe Connect has not been configured');
|
||||||
|
|
||||||
|
$customer = Customer::retrieve($customer_id, $this->stripe_connect_auth);
|
||||||
|
|
||||||
|
if(!$customer)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach($this->stripe->company_gateway->company->clients as $client)
|
||||||
|
{
|
||||||
|
if($client->present()->email() == $customer->email) {
|
||||||
|
|
||||||
|
$this->update_payment_methods->updateMethods($customer, $client);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function match()
|
public function match()
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$this->stripe->init();
|
||||||
|
@ -93,6 +93,12 @@ class UpdatePaymentMethods
|
|||||||
$this->addOrUpdateCard($method, $customer->id, $client, GatewayType::SOFORT);
|
$this->addOrUpdateCard($method, $customer->id, $client, GatewayType::SOFORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//$this->importBankAccounts($customer, $client);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function importBankAccounts($customer, $client)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private function addOrUpdateBankAccount($bank_account, $customer_reference, Client $client)
|
// private function addOrUpdateBankAccount($bank_account, $customer_reference, Client $client)
|
||||||
|
@ -550,6 +550,11 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
return (new ImportCustomers($this))->match();
|
return (new ImportCustomers($this))->match();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function importCustomer($customer_id)
|
||||||
|
{
|
||||||
|
return (new ImportCustomers($this))->importCustomer($customer_id);
|
||||||
|
}
|
||||||
|
|
||||||
public function verifyConnect()
|
public function verifyConnect()
|
||||||
{
|
{
|
||||||
return (new Verify($this))->run();
|
return (new Verify($this))->run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user