1
0

1.1.0 Release (#44)

* Automated commit message

* add changelog

---------

Co-authored-by: PayPalServerSDKs <server-sdks@paypal.com>
Co-authored-by: Patrick Powers <patickpowers@hey.com>
This commit is contained in:
Patrick Powers
2025-05-27 13:31:17 -05:00
committed by GitHub
parent 671a2b2e5a
commit 6da8b9b5b8
234 changed files with 3130 additions and 1544 deletions

View File

@@ -21,6 +21,7 @@ use PaypalServerSdkLib\Controllers\VaultController;
use PaypalServerSdkLib\Logging\LoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\RequestLoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\ResponseLoggingConfigurationBuilder;
use PaypalServerSdkLib\Proxy\ProxyConfigurationBuilder;
use PaypalServerSdkLib\Utils\CompatibilityConverter;
use Unirest\Configuration;
use Unirest\HttpClient;
@@ -39,6 +40,8 @@ class PaypalServerSdkClient implements ConfigurationInterface
private $loggingConfigurationBuilder;
private $proxyConfiguration;
private $config;
private $client;
@@ -58,11 +61,14 @@ class PaypalServerSdkClient implements ConfigurationInterface
$this->loggingConfigurationBuilder = $this->config['loggingConfiguration'];
$loggingConfiguration = $this->loggingConfigurationBuilder->build();
}
$this->client = ClientBuilder::init(new HttpClient(Configuration::init($this)))
$this->proxyConfiguration = $this->config['proxyConfiguration'] ?? ConfigurationDefaults::PROXY_CONFIGURATION;
$this->client = ClientBuilder::init(
new HttpClient(Configuration::init($this)->proxyConfiguration($this->proxyConfiguration))
)
->converter(new CompatibilityConverter())
->jsonHelper(ApiHelper::getJsonHelper())
->apiCallback($this->config['httpCallback'] ?? null)
->userAgent('PayPal REST API PHP SDK, Version: 1.0.0, on OS {os-info}')
->userAgent('PayPal REST API PHP SDK, Version: 1.1.0, on OS {os-info}')
->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::DEFAULT_)
->authManagers(['Oauth2' => $this->clientCredentialsAuthManager])
->loggingConfiguration($loggingConfiguration)
@@ -88,7 +94,8 @@ class PaypalServerSdkClient implements ConfigurationInterface
->httpStatusCodesToRetry($this->getHttpStatusCodesToRetry())
->httpMethodsToRetry($this->getHttpMethodsToRetry())
->environment($this->getEnvironment())
->httpCallback($this->config['httpCallback'] ?? null);
->httpCallback($this->config['httpCallback'] ?? null)
->proxyConfiguration($this->getProxyConfigurationBuilder());
$clientCredentialsAuth = $this->getClientCredentialsAuthCredentialsBuilder();
if ($clientCredentialsAuth != null) {
@@ -195,6 +202,18 @@ class PaypalServerSdkClient implements ConfigurationInterface
->unmaskHeaders(...$config['responseConfiguration']['unmaskHeaders']));
}
/**
* Get the proxy configuration builder
*/
public function getProxyConfigurationBuilder(): ProxyConfigurationBuilder
{
return ProxyConfigurationBuilder::init($this->proxyConfiguration['address'])
->port($this->proxyConfiguration['port'])
->tunnel($this->proxyConfiguration['tunnel'])
->auth($this->proxyConfiguration['auth']['user'], $this->proxyConfiguration['auth']['pass'])
->authMethod($this->proxyConfiguration['auth']['method']);
}
/**
* Get the client configuration as an associative array
*