|
@@ -83,6 +83,10 @@ def order():
|
|
|
session_id = request.json['session_id']
|
|
|
amount = request.json['amount']
|
|
|
amount = float(amount)
|
|
|
+ if amount < 0:
|
|
|
+ return bad_request('You can not order a negative amount.')
|
|
|
+ if amount < 1:
|
|
|
+ return bad_request('The minimum order size is 1.')
|
|
|
ownable_name = request.json['ownable']
|
|
|
time_until_expiration = float(request.json['time_until_expiration'])
|
|
|
if time_until_expiration < 0:
|
|
@@ -140,7 +144,7 @@ def gift():
|
|
|
sender_id = model.get_user_id_by_session_id(request.json['session_id'])
|
|
|
recipient_id = model.get_user_id_by_name(request.json['username'])
|
|
|
if not model.user_owns_at_least(amount, sender_id, ownable_id):
|
|
|
- return bad_request('You do not own enough.')
|
|
|
+ amount = model.available_amount(sender_id, ownable_id)
|
|
|
|
|
|
model.send_ownable(sender_id, recipient_id, request.json['object_name'], amount)
|
|
|
|