Working on importing stripe customers by id

This commit is contained in:
= 2021-08-20 22:44:39 +10:00
parent 48c330d635
commit f7b7732f04
4 changed files with 38 additions and 1 deletions

View File

@ -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());
} }

View File

@ -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();

View File

@ -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)

View File

@ -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();