Skip to content

Commit

Permalink
Merge pull request #355 from Mangopay/feature/configuration_for_UK
Browse files Browse the repository at this point in the history
Add a configuration for UK
  • Loading branch information
iulian03 authored Mar 8, 2024
2 parents 2aa3c2a + d4450aa commit 735cdfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit 735cdfb

Please sign in to comment.