From 2f02e614fe50dfe81a2065f3bfc155183f6eaecb Mon Sep 17 00:00:00 2001 From: emile Date: Mon, 8 Apr 2024 20:53:23 +0300 Subject: [PATCH] New --- .../__pycache__/views.cpython-310.pyc | Bin 2335 -> 2355 bytes osinaweb/customercore/views.py | 9 +++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/osinaweb/customercore/__pycache__/views.cpython-310.pyc b/osinaweb/customercore/__pycache__/views.cpython-310.pyc index 951fabd231143ebfb607c3b078a4438d434b94a8..de8cf3380ec94feca6af7565a84799962facb8d7 100644 GIT binary patch delta 437 zcmXX?O-md>5bf%jo$j5P9@q6FY@+5MAu8f*gt&qrf>96x9(KXR+hC2jimvpuBGMDV zjYm&?3JBT7Yc3-B6*&eE?hnYtKj1OFAq7Rfs`scW-uLo-S+s=ki48v<-hH?ezi1To zJDaOEv(WsZGZzjr?dk$@ETWIW4bMFdn(oq^ov$fp-^EaSnxVLMa;^#(X}<4uSeLXZ z5Q{ku98memqGDcDK9+FsE78SHfaNZHAZ=(v?rXmj;!qdz;2#>cC{#iRIxOMH4Q;~~ zsS~?=RCDvq8GnBTBo{!=hwSW?7X4F7;0qjU0#@+lHQgc}`ApENzKHt&YMz|#0N)Oi z6&M9@M+P*D-mE#4JW%!b`XCCo-JT3SsT zFbn>G*jm{82Y!HHVPRwK=!FC4ak*U1bMc|*hOR4!p3PeM`0>eoqn@jkt+A#No9cru zT!W<2KqhlCj~p!&X!k{GcGeT)G>48f(Y>cBOY-PRc4`h-MtT&8<{S%WG&<1CN_ir1 z2#0TpNf z<*r~$P3BidTNmy6MG(b$zus7yhxZ)%iLX@t4mO@A%m%=?+GP{qsx!8wUf7&j(H%w8 z>XTK?>R(-}YK&Jb3KYyA>UnCJPs5^W^8Mnhj^70aN1=WwjN)iUz4Dq4zxbLVJop7o C%4a74 diff --git a/osinaweb/customercore/views.py b/osinaweb/customercore/views.py index bfd60fdc..7928f656 100644 --- a/osinaweb/customercore/views.py +++ b/osinaweb/customercore/views.py @@ -37,6 +37,7 @@ def pricing(request, *args, **kwargs): + @customer_login_required def initiate_checkout(request): # Your Mastercard API credentials @@ -50,8 +51,6 @@ 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, @@ -61,9 +60,11 @@ def initiate_checkout(request): "order.description": "description_of_order" } + # Set up Basic HTTP authentication + auth = (api_username, api_password) try: - response = requests.post("https://creditlibanais-netcommerce.gateway.mastercard.com/api/nvp/version/72", data=data) + response = requests.post("https://creditlibanais-netcommerce.gateway.mastercard.com/api/rest/version/78/merchant/TEST06127800/session", data=data, auth=auth) print("Response Content:", response.content.decode()) # Print response content @@ -79,4 +80,4 @@ def initiate_checkout(request): except Exception as e: print("Exception:", e) # Print exception traceback - return JsonResponse({"error": "Internal Server Error"}, status=500) \ No newline at end of file + return JsonResponse({"error": "Internal Server Error"}, status=500)