diff --git a/osinaweb/customercore/__pycache__/views.cpython-310.pyc b/osinaweb/customercore/__pycache__/views.cpython-310.pyc index 951fabd2..de8cf338 100644 Binary files a/osinaweb/customercore/__pycache__/views.cpython-310.pyc and b/osinaweb/customercore/__pycache__/views.cpython-310.pyc differ 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)