mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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();
|
$accountGateway = AccountGateway::scope($accountGatewayPublicId)->firstOrFail();
|
||||||
$oldConfig = $accountGateway->getConfig();
|
$oldConfig = $accountGateway->getConfig();
|
||||||
} else {
|
} 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 = AccountGateway::createNew();
|
||||||
$accountGateway->gateway_id = $gatewayId;
|
$accountGateway->gateway_id = $gatewayId;
|
||||||
|
|
||||||
|
@ -1359,6 +1359,7 @@ $LANG = array(
|
|||||||
'bitcoin' => 'Bitcoin',
|
'bitcoin' => 'Bitcoin',
|
||||||
'added_on' => 'Added :date',
|
'added_on' => 'Added :date',
|
||||||
'failed_remove_payment_method' => 'Failed to remove the payment method',
|
'failed_remove_payment_method' => 'Failed to remove the payment method',
|
||||||
|
'gateway_exists' => 'This gateway already exists',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user