diff --git a/src/Controller/TransactionCreationsController.php b/src/Controller/TransactionCreationsController.php index 951ac14af..5e29a7997 100644 --- a/src/Controller/TransactionCreationsController.php +++ b/src/Controller/TransactionCreationsController.php @@ -483,6 +483,9 @@ class TransactionCreationsController extends AppController if($amount > 10000000) { return $this->returnJson(['state' => 'error', 'msg' => 'amount is to big']); } + if($amount <= 0) { + return $this->returnJson(['state' => 'error', 'msg' => 'amount must be > 0']); + } if(!isset($jsonData['target_date'])) { return $this->returnJson(['state' => 'parameter missing', 'msg' => 'target_date not found']); } diff --git a/src/Controller/TransactionSendCoinsController.php b/src/Controller/TransactionSendCoinsController.php index a6fab144c..e99dd4f13 100644 --- a/src/Controller/TransactionSendCoinsController.php +++ b/src/Controller/TransactionSendCoinsController.php @@ -313,6 +313,9 @@ class TransactionSendCoinsController extends AppController if(!isset($jsonData['amount']) || !isset($jsonData['email'])) { return $this->returnJson(['state' => 'parameter missing', 'msg' => 'amount and/or email not set']); } + if($jsonData['amount'] < 0) { + return $this->returnJson(['state' => 'error', 'msg' => 'amout must be > 0']); + } if(!isset($user['balance']) || $jsonData['amount'] > $user['balance']) { return $this->returnJson(['state' => 'error', 'msg' => 'not enough GDD']); diff --git a/src/Model/Transactions/TransactionCreation.php b/src/Model/Transactions/TransactionCreation.php index 2bd326ea7..e9feed4e9 100644 --- a/src/Model/Transactions/TransactionCreation.php +++ b/src/Model/Transactions/TransactionCreation.php @@ -189,6 +189,12 @@ class TransactionCreation extends TransactionBase { return false; } } else {*/ + if($newSum2 <= 0) { + $this->addError( + 'TransactionCreation::validate', + 'Creation less than 0 GDD per Month for '. $receiverEmail .' in target_date not allowed' + ); + } if($newSum2 > 10000000) { $this->addError( 'TransactionCreation::validate', diff --git a/src/Model/Transactions/TransactionTransfer.php b/src/Model/Transactions/TransactionTransfer.php index 8ad726d53..d22dbadef 100644 --- a/src/Model/Transactions/TransactionTransfer.php +++ b/src/Model/Transactions/TransactionTransfer.php @@ -154,6 +154,10 @@ class TransactionTransfer extends TransactionBase { $this->addError($functionName, 'sender amount doesn\'t match receiver amount'); return false; } + if($senderSum < 0) { + $this->addError($functionName, 'negative amount not supported'); + return false; + } //die("\n"); return true; }