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 #634

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
3 changes: 3 additions & 0 deletions MangoPay/Libraries/ApiOAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public function CreateToken()
$rest->AddRequestHttpHeader('Host: ' . @$urlDetails['host']);
$rest->AddRequestHttpHeader('Authorization: Basic ' . $authHlp->GetHttpHeaderBasicKey());
$rest->AddRequestHttpHeader('Content-Type: application/x-www-form-urlencoded');
if($this->_root->Config->UKHeaderFlag){
$rest->AddRequestHttpHeader('x-tenant-id: uk');
}
$response = $rest->Request($urlMethod, $requestType, $requestData);
$token = $this->CastResponseToEntity($response, '\MangoPay\Libraries\OAuthToken');
$token->autentication_key = $authHlp->GetAutenticationKey();
Expand Down
5 changes: 5 additions & 0 deletions MangoPay/Libraries/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@ class Configuration
* Set the user:password proxy
*/
public $UserPasswordProxy = null;

/**
* Set to true for uk traffic
*/
public $UKHeaderFlag = false;
}
5 changes: 5 additions & 0 deletions MangoPay/Libraries/RestTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ private function GetHttpHeaders($idempotencyKey = null)
// Add User-Agent Header

array_push($this->_requestHttpHeaders, 'User-Agent: MangoPay V2 SDK PHP ' . self::VERSION);

if ($this->_root->Config->UKHeaderFlag) {
array_push($this->_requestHttpHeaders, 'x-tenant-id: uk');
}

// Authentication http header
if ($this->_authRequired) {
$authHlp = new AuthenticationHelper($this->_root);
Expand Down
Loading