From cad61e7a5b93a3f7b7bcf2d46c6ebb0ac1e4642e Mon Sep 17 00:00:00 2001 From: emile Date: Mon, 8 Apr 2024 20:57:39 +0300 Subject: [PATCH] new --- .../__pycache__/views.cpython-310.pyc | Bin 2406 -> 2335 bytes osinaweb/customercore/views.py | 13 ++++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/osinaweb/customercore/__pycache__/views.cpython-310.pyc b/osinaweb/customercore/__pycache__/views.cpython-310.pyc index 0a017929fe81b57fe6041cb47dcb403f1ffdebf9..cf441a50c421157494248d01f5271f88c5d66a7e 100644 GIT binary patch delta 617 zcmYL`QESvd5XW~mxnz@Ua_yx(TRn>um0o+&Rs<2mf)?~as8EXZ5FvD8xr&!FNvoDb z!K)7&RS{Nw$FG?{Ntnidz(kp?>iBSCH{cLo?H}3W{O|bdK%Z*k4Vx9UWz6 zpnJ%3Gp(SPnLEb79I`$KMl7)Un8zDLRxVN-$8h|BWn$o9Z3wIMt3KpbW(_3zL&)ut zCWxHW&Fsv<$z$G!2lv@JqvrLZVbM5s@f1#V0H^WvAup;rOT8Dbf#nj|zE9pWnf&K$ z{C65`lOefY%Jq|1Y5K5fw`I`lto6b;NIOxt?NGLngmE``5|+umAW5D@F{&^6bGWNo zl^gZ$UT<+Pj1%%NUcKCek&Zzcs85wQa7Qf|U;XMxOVW6x@9uVRR4Md|YMD1_50N0=5-fuoWjbDs=ZP&GkZ0Etmu4$cm zvv72}v{pre>Pxe3h87yg`lJVSTe6APh#ko`IwN)^yXcMB`|@!Oz!n+wp(M8H3n+_k zbjI`L3HdP(<%lQ61zmirputtHA zZsK!?yI4A-J=h{OBIT30Fc&Aj7%Iip!s`z}QV+;+QAV$D?|%%ZaJC6JjWZ{7i|FJT zL7DZ&t6i?*mooHO-Dz~18=Wv}B+Yh9d{vL&K-|>s-HpOH30{R!EVqNzYH%1vJ9~{* z5^S#5Hka?*y1iOmUJl|g&Jz}BrtZh>R;D(($)0$py@#iQ=|9V3nGz>argpnc%(Q%7 ziAwT^GYz|koml+UAHcM@Z%l(P>c-<@reY&$)XiMBontg9J{ybroUDn;;=6Gjmc$>U zV(Pywn<TiBU&&n#alip~ N*{Ny)H7|$l!9R8UpE3Xd diff --git a/osinaweb/customercore/views.py b/osinaweb/customercore/views.py index 3bd77ac1..bfd60fdc 100644 --- a/osinaweb/customercore/views.py +++ b/osinaweb/customercore/views.py @@ -4,8 +4,6 @@ from django.http import JsonResponse import requests from .decorators import * import uuid -import json - # Create your views here. @customer_login_required @@ -39,7 +37,6 @@ def pricing(request, *args, **kwargs): - @customer_login_required def initiate_checkout(request): # Your Mastercard API credentials @@ -53,6 +50,8 @@ def initiate_checkout(request): # Data for Initiate Checkout operation data = { "apiOperation": "INITIATE_CHECKOUT", + "apiUsername": api_username, + "apiPassword": api_password, "merchant": merchant_id, "interaction.operation": "PURCHASE", "interaction.merchant.name": merchant_name, @@ -62,13 +61,9 @@ def initiate_checkout(request): "order.description": "description_of_order" } - json_data = json.dumps(data) - - # Set up Basic HTTP authentication - auth = (api_username, api_password) try: - response = requests.post("https://creditlibanais-netcommerce.gateway.mastercard.com/api/rest/version/78/merchant/TEST06127800/session", json=json_data, auth=auth) + response = requests.post("https://creditlibanais-netcommerce.gateway.mastercard.com/api/nvp/version/72", data=data) print("Response Content:", response.content.decode()) # Print response content @@ -84,4 +79,4 @@ def initiate_checkout(request): except Exception as e: print("Exception:", e) # Print exception traceback - return JsonResponse({"error": "Internal Server Error"}, status=500) + return JsonResponse({"error": "Internal Server Error"}, status=500) \ No newline at end of file