1
0
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:
Hillel Coren 2016-06-22 20:13:45 +03:00
parent e2ddabe95d
commit dcdfb4f21c
2 changed files with 11 additions and 0 deletions

View File

@ -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;

View File

@ -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',
);