JourneyJoker/payment/paypal/api.py
Klaus-Uwe Mitterer 54e84be36a Implement login system
Copy over payment system from kumi.xxx
Add missing requirements
Other stuff
2021-03-21 16:50:50 +01:00

9 lines
No EOL
548 B
Python

from paypalcheckoutsdk.core import PayPalHttpClient, SandboxEnvironment, LiveEnvironment
from dbsettings.functions import getValue
class PaypalAPI:
def __init__(self, client_id=None, client_secret=None, mode=None):
mode = SandboxEnvironment if (client_secret == "sandbox" or getValue("paypal.mode") == "sandbox") else LiveEnvironment
environment = mode(client_id=(client_id or getValue("paypal.client_id")), client_secret=(client_secret or getValue("paypal.client_secret")))
self.client = PayPalHttpClient(environment)