mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
check that amount in transfer and creation in positive
This commit is contained in:
parent
37186f1ef2
commit
6095b0c22d
@ -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']);
|
||||
}
|
||||
|
||||
@ -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']);
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user