From 7e5985fdc7c8d869ee53480407f179e1093e1cce Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Sat, 30 Apr 2022 15:31:17 -0600 Subject: [PATCH] Set proper Paypal environment for production --- src/storefront/payments.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/storefront/payments.py b/src/storefront/payments.py index 2a7bc5a..6a26ec2 100644 --- a/src/storefront/payments.py +++ b/src/storefront/payments.py @@ -3,7 +3,7 @@ import sys import json import logging -from paypalcheckoutsdk.core import PayPalHttpClient, SandboxEnvironment +from paypalcheckoutsdk.core import PayPalHttpClient, SandboxEnvironment, LiveEnvironment from paypalcheckoutsdk.orders import OrdersCreateRequest, OrdersCaptureRequest from paypalhttp.serializers.json_serializer import Json @@ -23,7 +23,10 @@ class PayPalClient: """Setting up and Returns PayPal SDK environment with PayPal Access credentials. For demo purpose, we are using SandboxEnvironment. In production this will be LiveEnvironment.""" - self.environment = SandboxEnvironment(client_id=self.client_id, client_secret=self.client_secret) + if settings.DEBUG: + self.environment = SandboxEnvironment(client_id=self.client_id, client_secret=self.client_secret) + else: + self.environment = LiveEnvironment(client_id=self.client_id, client_secret=self.client_secret) """ Returns PayPal HTTP client instance with environment which has access credentials context. This can be used invoke PayPal API's provided the