Commit b03bbbb4 by Damien Moulard

remove auth in add shares view method

parent 76b93ae3
Pipeline #1829 passed with stage
in 1 minute 30 seconds
...@@ -395,24 +395,19 @@ def panel_get_purchases(request): ...@@ -395,24 +395,19 @@ def panel_get_purchases(request):
def add_shares_to_member(request): def add_shares_to_member(request):
res = {} res = {}
is_connected_user = CagetteUser.are_credentials_ok(request) try:
if is_connected_user is True: data = json.loads(request.body.decode())
try: partner_id = int(data["partner_id"])
data = json.loads(request.body.decode()) amount = int(data["amount"])
partner_id = int(data["partner_id"])
amount = int(data["amount"]) except Exception as e:
res['error'] = "Wrong params"
except Exception as e: return JsonResponse(res, safe=False, status=400)
res['error'] = "Wrong params"
return JsonResponse(res, safe=False, status=400)
m = CagetteMember(partner_id) m = CagetteMember(partner_id)
today = datetime.date.today().strftime("%Y-%m-%d") today = datetime.date.today().strftime("%Y-%m-%d")
res = m.create_capital_subscription_invoice(amount, today) res = m.create_capital_subscription_invoice(amount, today)
return JsonResponse(res, safe=False) return JsonResponse(res, safe=False)
else:
res['error'] = "Forbidden"
return JsonResponse(res, safe=False, status=403)
# # # BDM # # # # # # BDM # # #
def save_partner_info(request): def save_partner_info(request):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment