Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a configuration for UK #355

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mangopay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
temp_dir = None
api_version = 2.01
sandbox = True
uk_header_flag = False

package_version = None
try:
Expand Down
6 changes: 5 additions & 1 deletion mangopay/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class APIRequest(object):


def __init__(self, client_id=None, apikey=None, api_url=None, api_sandbox_url=None, sandbox=None,
timeout=30.0, storage_strategy=None, proxies=None):
timeout=30.0, storage_strategy=None, proxies=None, uk_header_flag=False):
global rate_limits
rate_limits = None
if (sandbox is None and mangopay.sandbox) or sandbox:
Expand All @@ -51,6 +51,7 @@ def __init__(self, client_id=None, apikey=None, api_url=None, api_sandbox_url=No
self.auth_manager = AuthorizationTokenManager(self, storage_strategy)
self.timeout = timeout
self.proxies = proxies
self.uk_header_flag = uk_header_flag or mangopay.uk_header_flag

def set_rate_limit(self, rate_limit):
global rate_limits
Expand Down Expand Up @@ -80,6 +81,9 @@ def custom_request(self, method, url, data=None, idempotency_key=None, oauth_req

if idempotency_key:
headers['Idempotency-Key'] = idempotency_key

if self.uk_header_flag:
headers['x-tenant-id'] = 'uk'
else:
if "data_XXX" in params:
params[str("data")] = params[str("data_XXX")]
Expand Down
Loading