1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Improve offsite payment checks

This commit is contained in:
Hillel Coren 2016-07-18 21:45:32 +03:00
parent cef35a98e1
commit 078964d297
2 changed files with 14 additions and 0 deletions

View File

@ -715,6 +715,18 @@ class BasePaymentDriver
}
}
// check invoice still has balance
if ( ! $this->invoice()->balance) {
throw new Exception(trans('texts.payment_error_code', ['code' => 'NB']));
}
// check this isn't a duplicate transaction reference
if (Payment::whereAccountId($this->invitation->account_id)
->whereTransactionReference($ref)
->first()) {
throw new Exception(trans('texts.payment_error_code', ['code' => 'DT']));
}
return $this->createPayment($ref);
}

View File

@ -2040,6 +2040,8 @@ $LANG = array(
'enable_buy_now_buttons_help' => 'Enable support for buy now buttons',
'changes_take_effect_immediately' => 'Note: changes take effect immediately',
'wepay_account_description' => 'Payment gateway for Invoice Ninja',
'payment_error_code' => 'There was an error processing your payment [:code]. Please try again later.',
);