From 3addf34466b9eeb3ddf31957e0cfea9df4ef3eee Mon Sep 17 00:00:00 2001 From: behruz-dev Date: Thu, 4 Sep 2025 15:39:08 +0500 Subject: [PATCH] fix --- core/apps/payment/views.py | 70 +++++++++++++++++++------------------- core/services/payment.py | 2 +- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/core/apps/payment/views.py b/core/apps/payment/views.py index 8c1c440..0489fd8 100644 --- a/core/apps/payment/views.py +++ b/core/apps/payment/views.py @@ -29,46 +29,46 @@ class AtmosCallbackApiView(APIView): client_ip = get_client_ip(request) # if client_ip not in settings.ALLOWED_ATMOS_IPS: # return Response({"status": 0, "message": "IP ruxsat etilmagan"}, status=403) - data = request.data - print(data) - if not data: - return Response( - {'success': 0, "message": "Request body required"}, - status=status.HTTP_200_OK - ) + # data = request.data + # print(data) + # if not data: + # return Response( + # {'success': 0, "message": "Request body required"}, + # status=status.HTTP_200_OK + # ) - store_id = data.get("store_id") - transaction_id = data.get("transaction_id") - invoice = data.get("invoice") - amount = data.get("amount") - sign = data.get("sign") + # store_id = data.get("store_id") + # transaction_id = data.get("transaction_id") + # invoice = data.get("invoice") + # amount = data.get("amount") + # sign = data.get("sign") - check_string = f"{store_id}{transaction_id}{invoice}{amount}{settings.API_KEY}" - generated_sign = hashlib.sha256(check_string.encode()).hexdigest() - print(generated_sign, '----------------------------------------------------') - if generated_sign != sign: - return Response( - {"status": 0, "message": f"Инвойс с номером {invoice} отсутствует в системе"}, - status=status.HTTP_200_OK - ) + # check_string = f"{store_id}{transaction_id}{invoice}{amount}{settings.API_KEY}" + # generated_sign = hashlib.sha256(check_string.encode()).hexdigest() + # print(generated_sign, '----------------------------------------------------') + # if generated_sign != sign: + # return Response( + # {"status": 0, "message": f"Инвойс с номером {invoice} отсутствует в системе"}, + # status=status.HTTP_200_OK + # ) - try: - order = Order.objects.get(order_number=invoice) - except Order.DoesNotExist: - return Response( - {"status": 0, "message": f"Инвойс с номером {invoice} отсутствует в системе"}, - status=status.HTTP_200_OK - ) + # try: + # order = Order.objects.get(order_number=invoice) + # except Order.DoesNotExist: + # return Response( + # {"status": 0, "message": f"Инвойс с номером {invoice} отсутствует в системе"}, + # status=status.HTTP_200_OK + # ) - if str(order.total_price) != str(amount): - return Response( - {"status": 0, "message": f"Инвойс с номером {invoice} отсутствует в системе"}, - status=status.HTTP_200_OK - ) + # if str(order.total_price) != str(amount): + # return Response( + # {"status": 0, "message": f"Инвойс с номером {invoice} отсутствует в системе"}, + # status=status.HTTP_200_OK + # ) + + # order.is_paid = True + # order.save() - order.is_paid = True - order.save() - return Response( {"status": 1, "message": "Успешно"}, status=status.HTTP_200_OK diff --git a/core/services/payment.py b/core/services/payment.py index 464031b..20a031a 100644 --- a/core/services/payment.py +++ b/core/services/payment.py @@ -34,7 +34,7 @@ class Atmos: 'Authorization': f'Bearer {access_token}', } data = { - 'amount': amount, + 'amount': int(amount) * 100, 'account': str(account), 'store_id': f'{self.store_id}' }