mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 19:14:40 -04:00
Support saving credit card and paypal tokens for the same client
This commit is contained in:
parent
60ce0716a9
commit
293e7cbb61
@ -507,15 +507,6 @@ class BasePaymentDriver
|
|||||||
$customer->save();
|
$customer->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
// archive the old payment method
|
|
||||||
$paymentMethod = PaymentMethod::clientId($this->client()->id)
|
|
||||||
->isBankAccount($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER))
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if ($paymentMethod) {
|
|
||||||
$paymentMethod->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
$paymentMethod = $this->createPaymentMethod($customer);
|
$paymentMethod = $this->createPaymentMethod($customer);
|
||||||
|
|
||||||
if ($paymentMethod) {
|
if ($paymentMethod) {
|
||||||
@ -540,6 +531,15 @@ class BasePaymentDriver
|
|||||||
$paymentMethod->setRelation('account_gateway_token', $customer);
|
$paymentMethod->setRelation('account_gateway_token', $customer);
|
||||||
$paymentMethod = $this->creatingPaymentMethod($paymentMethod);
|
$paymentMethod = $this->creatingPaymentMethod($paymentMethod);
|
||||||
|
|
||||||
|
// archive the old payment method
|
||||||
|
$oldPaymentMethod = PaymentMethod::clientId($this->client()->id)
|
||||||
|
->wherePaymentTypeId($paymentMethod->payment_type_id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($oldPaymentMethod) {
|
||||||
|
$oldPaymentMethod->delete();
|
||||||
|
}
|
||||||
|
|
||||||
if ($paymentMethod) {
|
if ($paymentMethod) {
|
||||||
$paymentMethod->save();
|
$paymentMethod->save();
|
||||||
}
|
}
|
||||||
@ -758,7 +758,7 @@ class BasePaymentDriver
|
|||||||
} elseif ($paymentMethod->payment_type_id == PAYMENT_TYPE_PAYPAL) {
|
} elseif ($paymentMethod->payment_type_id == PAYMENT_TYPE_PAYPAL) {
|
||||||
$label = 'PayPal: ' . $paymentMethod->email;
|
$label = 'PayPal: ' . $paymentMethod->email;
|
||||||
} else {
|
} else {
|
||||||
$label = trans('texts.use_card_on_file');
|
$label = trans('texts.payment_type_on_file', ['type' => $paymentMethod->payment_type->name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$links[] = [
|
$links[] = [
|
||||||
|
@ -2050,6 +2050,7 @@ $LANG = array(
|
|||||||
'no_client_selected' => 'Please select a client',
|
'no_client_selected' => 'Please select a client',
|
||||||
|
|
||||||
'gateway_config_error' => 'It may help to set new passwords or generate new API keys.',
|
'gateway_config_error' => 'It may help to set new passwords or generate new API keys.',
|
||||||
|
'payment_type_on_file' => ':type on file',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user