mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Stripe Customer Email Not Passed Through #1569
This commit is contained in:
parent
e05b04485d
commit
fda0eeaf5e
@ -119,6 +119,18 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
$data = $this->paymentDetails();
|
$data = $this->paymentDetails();
|
||||||
$data['description'] = $client->getDisplayName();
|
$data['description'] = $client->getDisplayName();
|
||||||
|
|
||||||
|
// if a customer already exists link the token to it
|
||||||
|
if ($customer = $this->customer()) {
|
||||||
|
$data['customerReference'] = $customer->token;
|
||||||
|
// otherwise create a new customer
|
||||||
|
} else {
|
||||||
|
$response = $this->gateway()->createCustomer([
|
||||||
|
'description' => $client->getDisplayName(),
|
||||||
|
'email' => $this->contact()->email,
|
||||||
|
])->send();
|
||||||
|
$data['customerReference'] = $response->getCustomerReference();
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($data['plaidPublicToken'])) {
|
if (! empty($data['plaidPublicToken'])) {
|
||||||
$plaidResult = $this->getPlaidToken($data['plaidPublicToken'], $data['plaidAccountId']);
|
$plaidResult = $this->getPlaidToken($data['plaidPublicToken'], $data['plaidAccountId']);
|
||||||
unset($data['plaidPublicToken']);
|
unset($data['plaidPublicToken']);
|
||||||
@ -126,11 +138,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
$data['token'] = $plaidResult['stripe_bank_account_token'];
|
$data['token'] = $plaidResult['stripe_bank_account_token'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a customer already exists link the token to it
|
|
||||||
if ($customer = $this->customer()) {
|
|
||||||
$data['customerReference'] = $customer->token;
|
|
||||||
}
|
|
||||||
|
|
||||||
$tokenResponse = $this->gateway()
|
$tokenResponse = $this->gateway()
|
||||||
->createCard($data)
|
->createCard($data)
|
||||||
->send();
|
->send();
|
||||||
@ -146,7 +153,11 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
|
|
||||||
public function creatingCustomer($customer)
|
public function creatingCustomer($customer)
|
||||||
{
|
{
|
||||||
$customer->token = $this->tokenResponse['id'];
|
if (isset($this->tokenResponse['customer'])) {
|
||||||
|
$customer->token = $this->tokenResponse['customer'];
|
||||||
|
} else {
|
||||||
|
$customer->token = $this->tokenResponse['id'];
|
||||||
|
}
|
||||||
|
|
||||||
return $customer;
|
return $customer;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user