From 98c5dc9f8d60b000fa0fe78d515a164e71400024 Mon Sep 17 00:00:00 2001 From: Godey Tech <91687536+godfredtenkorang@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:30:37 +0000 Subject: [PATCH] changes --- payment/__pycache__/models.cpython-312.pyc | Bin 4905 -> 4905 bytes ussd/__pycache__/urls.cpython-312.pyc | Bin 557 -> 455 bytes ussd/__pycache__/views.cpython-312.pyc | Bin 9255 -> 7696 bytes ussd/urls.py | 1 - ussd/views.py | 40 ------------------ votehere/__pycache__/settings.cpython-312.pyc | Bin 3356 -> 3356 bytes votehere/settings.py | 2 +- 7 files changed, 1 insertion(+), 42 deletions(-) diff --git a/payment/__pycache__/models.cpython-312.pyc b/payment/__pycache__/models.cpython-312.pyc index 77f6918ecdfd545ce9a614276a2475d89dc296b0..a0e04148c4df301d504159e58e38cc870747dada 100644 GIT binary patch delta 21 bcmZ3fwo;AfG%qg~0}!aX2&Hf2krf62I6wqx delta 21 bcmZ3fwo;AfG%qg~0}z~gvo&oakE}2NMa>3S diff --git a/ussd/__pycache__/urls.cpython-312.pyc b/ussd/__pycache__/urls.cpython-312.pyc index 4a2adce27ad448618ebf04603133252df90f1f8a..13bda0bf736ed428c790a7a959628bb5b7f6354c 100644 GIT binary patch delta 99 zcmZ3>a-3QHG%qg~0}#ZRi>2=Y(vLwL7+`}kJ{L?>&*eyGiejte)a06Y#FyDmlYO!! jqsHVk#w;!YpejZnE;gThi_w_p11mE>QzLf~A5aJYi^&pL delta 198 zcmX@kyp~1%G%qg~0}x1f2&VHeGB7*_abSQQ%J@8EqI#|Y6GJLv3TG;F77t7wL8ox7 zVOz}%;iof4u~%|y@=ToLt5GFbkXTtHIg<<4zE@cMKCrX!Gc|G-@dK3s E0EsFrZU6uP diff --git a/ussd/__pycache__/views.cpython-312.pyc b/ussd/__pycache__/views.cpython-312.pyc index 5fd447ebf8641f8b003ba9d0c09e746d16019b33..5e1eb59622a0abad380afaed0b1a5e785e96d497 100644 GIT binary patch delta 550 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b/ussd/urls.py index 4b51f6fb..a9f852d0 100644 --- a/ussd/urls.py +++ b/ussd/urls.py @@ -4,5 +4,4 @@ urlpatterns = [ path('ussd/', views.ussd_api, name='ussd'), path('callback/', views.payment_callback, name='payment_callback'), - path('paystack/webhook/', views.paystack_webhook, name='paystack_webhook'), ] diff --git a/ussd/views.py b/ussd/views.py index f6b57e6b..35526aca 100644 --- a/ussd/views.py +++ b/ussd/views.py @@ -235,43 +235,3 @@ def payment_callback(request): return JsonResponse({'status': 'error', 'message': 'Invalid request method'}, status=405) - - -import json -import hashlib -from django.http import JsonResponse -from django.views.decorators.csrf import csrf_exempt -from .models import PaymentTransaction - -@csrf_exempt -def paystack_webhook(request): - if request.method == 'POST': - try: - # Parse the JSON payload from Paystack - payload = json.loads(request.body.decode('utf-8')) - event = payload.get('event') # The event type (e.g., charge.success) - data = payload.get('data') # Payment data - - if event == 'charge.success': - transaction_id = data.get('reference') # Paystack reference - amount_paid = data.get('amount') / 100 # Convert to original currency (in cedis) - customer_email = data.get('customer', {}).get('email', None) - status = data.get('status') # Should be 'success' - - # Update your PaymentTransaction model - PaymentTransaction.objects.filter(transaction_id=transaction_id).update( - status=status, - amount=amount_paid - ) - - # You could perform additional actions like sending notifications - - return JsonResponse({'status': 'success'}, status=200) - else: - # Handle other Paystack events like 'charge.failed', etc. - return JsonResponse({'status': 'ignored', 'message': 'Unhandled event'}, status=400) - - except Exception as e: - return JsonResponse({'status': 'error', 'message': str(e)}, status=400) - - return JsonResponse({'status': 'error', 'message': 'Invalid request method'}, status=405) diff --git a/votehere/__pycache__/settings.cpython-312.pyc b/votehere/__pycache__/settings.cpython-312.pyc index 2b387ab1b95985a833861ac693902b30af86e8ca..d21c3a4ada875ccf1626af3d116b0e343892af32 100644 GIT binary patch delta 22 ccmbOuHAjl~G%qg~0}%XBOipjx$ji?Q07BITtN;K2 delta 22 ccmbOuHAjl~G%qg~0}!aQ2&T7h