mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 08:24:39 -04:00
Set most recent payment method as default
This commit is contained in:
parent
c2121a051d
commit
0138d8d246
@ -501,28 +501,28 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
*/
|
*/
|
||||||
public function storeGatewayToken(array $data, array $additional = []): ?ClientGatewayToken
|
public function storeGatewayToken(array $data, array $additional = []): ?ClientGatewayToken
|
||||||
{
|
{
|
||||||
$company_gateway_token = new ClientGatewayToken();
|
$cgt = new ClientGatewayToken();
|
||||||
$company_gateway_token->company_id = $this->client->company->id;
|
$cgt->company_id = $this->client->company->id;
|
||||||
$company_gateway_token->client_id = $this->client->id;
|
$cgt->client_id = $this->client->id;
|
||||||
$company_gateway_token->token = $data['token'];
|
$cgt->token = $data['token'];
|
||||||
$company_gateway_token->company_gateway_id = $this->company_gateway->id;
|
$cgt->company_gateway_id = $this->company_gateway->id;
|
||||||
$company_gateway_token->gateway_type_id = $data['payment_method_id'];
|
$cgt->gateway_type_id = $data['payment_method_id'];
|
||||||
$company_gateway_token->meta = $data['payment_meta'];
|
$cgt->meta = $data['payment_meta'];
|
||||||
|
|
||||||
foreach ($additional as $key => $value) {
|
foreach ($additional as $key => $value) {
|
||||||
$company_gateway_token->{$key} = $value;
|
$cgt->{$key} = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$company_gateway_token->save();
|
$cgt->save();
|
||||||
|
|
||||||
if ($this->client->gateway_tokens->count() == 1) {
|
if ($this->client->gateway_tokens->count() == 1) {
|
||||||
$this->client->gateway_tokens()->update(['is_default' => 0]);
|
$this->client->gateway_tokens()->update(['is_default' => 0]);
|
||||||
|
|
||||||
$company_gateway_token->is_default = 1;
|
|
||||||
$company_gateway_token->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $company_gateway_token;
|
$cgt->is_default = 1;
|
||||||
|
$cgt->save();
|
||||||
|
|
||||||
|
return $cgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processInternallyFailedPayment($gateway, $e)
|
public function processInternallyFailedPayment($gateway, $e)
|
||||||
|
109
public/build/assets/app-e0713224.js
vendored
Normal file
109
public/build/assets/app-e0713224.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user