check that amount in transfer and creation in positive

This commit is contained in:
Dario Rekowski on RockPI 2021-03-01 16:30:45 +00:00 committed by Ulf Gebhardt
parent 37186f1ef2
commit 6095b0c22d
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
4 changed files with 16 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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