mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02:00
Check to prevent duplicate gateways
This commit is contained in:
parent
e2ddabe95d
commit
dcdfb4f21c
@ -216,6 +216,16 @@ class AccountGatewayController extends BaseController
|
||||
$accountGateway = AccountGateway::scope($accountGatewayPublicId)->firstOrFail();
|
||||
$oldConfig = $accountGateway->getConfig();
|
||||
} else {
|
||||
// check they don't already have an active gateway for this provider
|
||||
// TODO complete this
|
||||
$accountGateway = AccountGateway::scope()
|
||||
->whereGatewayId($gatewayId)
|
||||
->first();
|
||||
if ($accountGateway) {
|
||||
Session::flash('error', trans('texts.gateway_exists'));
|
||||
return Redirect::to("gateways/{$accountGateway->public_id}/edit");
|
||||
}
|
||||
|
||||
$accountGateway = AccountGateway::createNew();
|
||||
$accountGateway->gateway_id = $gatewayId;
|
||||
|
||||
|
@ -1359,6 +1359,7 @@ $LANG = array(
|
||||
'bitcoin' => 'Bitcoin',
|
||||
'added_on' => 'Added :date',
|
||||
'failed_remove_payment_method' => 'Failed to remove the payment method',
|
||||
'gateway_exists' => 'This gateway already exists',
|
||||
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user