Skip to content

Commit

Permalink
Merge pull request #3 from PomeloPay/support-multi-tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
m4yankpomelo authored Jul 27, 2023
2 parents 6e7e286 + fc93b7b commit 6bd6b70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ $options = ['headers' => ['foo' => 'bar']];
$client = new Client('apikey', 'appid', 'sandbox', $options);
```

If you want to pass a custom base URL:

```php
use PomeloPayConnect\Client;

$options = ['baseUrl' => 'my-custom-url'];
$client = new Client('apikey', 'appid', 'sandbox', $options);
```

## Available API Operations

The following exposed API operations from the Pomelo Pay Connect API are available using the API Client.
Expand Down
5 changes: 3 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ class Client
* @param array<mixed, mixed> $clientOptions
*/
public function __construct(string $apiKey, string $appId, $mode = 'production', array $clientOptions = [])
{
{
$this->apiKey = $apiKey;
$this->appId = $appId;
$this->mode = $mode;
$this->baseUrl = ($mode === 'production' ? self::PRODUCTION_ENDPOINT : self::SANDBOX_ENDPOINT);
$this->baseUrl = isset($clientOptions['baseUrl']) ? $clientOptions['baseUrl'] : ($mode === 'production' ? self::PRODUCTION_ENDPOINT : self::SANDBOX_ENDPOINT);
if (isset($clientOptions['baseUrl'])) unset($clientOptions['baseUrl']);
$this->clientOptions = $clientOptions;

$this->initiateHttpClient();
Expand Down

0 comments on commit 6bd6b70

Please sign in to comment.