Working on importing stripe customers by id
This commit is contained in:
parent
48c330d635
commit
f7b7732f04
4 changed files with 38 additions and 1 deletions
|
|
@ -61,7 +61,7 @@ class ACH
|
|||
|
||||
try {
|
||||
$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) {
|
||||
throw new PaymentFailed($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,6 +142,32 @@ class ImportCustomers
|
|||
$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()
|
||||
{
|
||||
$this->stripe->init();
|
||||
|
|
|
|||
|
|
@ -93,6 +93,12 @@ class UpdatePaymentMethods
|
|||
$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)
|
||||
|
|
|
|||
|
|
@ -550,6 +550,11 @@ class StripePaymentDriver extends BaseDriver
|
|||
return (new ImportCustomers($this))->match();
|
||||
}
|
||||
|
||||
public function importCustomer($customer_id)
|
||||
{
|
||||
return (new ImportCustomers($this))->importCustomer($customer_id);
|
||||
}
|
||||
|
||||
public function verifyConnect()
|
||||
{
|
||||
return (new Verify($this))->run();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue