Skip to content

Commit

Permalink
Merge pull request #634 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 ebbbd28 + 9fad906 commit ef83135
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
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

0 comments on commit ef83135

Please sign in to comment.