[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Client.php
<?php declare(strict_types=1); namespace Vonage\Subaccount; use Vonage\Client\APIClient; use Vonage\Client\APIResource; use Vonage\Entity\Filter\EmptyFilter; use Vonage\Entity\Filter\FilterInterface; use Vonage\Entity\Hydrator\ArrayHydrator; use Vonage\Subaccount\Request\NumberTransferRequest; use Vonage\Subaccount\Request\TransferBalanceRequest; use Vonage\Subaccount\Request\TransferCreditRequest; use Vonage\Subaccount\SubaccountObjects\Account; use Vonage\Subaccount\SubaccountObjects\BalanceTransfer; use Vonage\Subaccount\SubaccountObjects\CreditTransfer; class Client implements APIClient { public const PRIMARY_ACCOUNT_ARRAY_KEY = 'primary_account'; public function __construct(protected APIResource $api) { } public function getAPIResource(): APIResource { return $this->api; } public function getPrimaryAccount(string $apiKey): Account { $response = $this->api->get($apiKey . '/subaccounts'); return (new Account())->fromArray($response['_embedded'][self::PRIMARY_ACCOUNT_ARRAY_KEY]); } public function getSubaccount(string $apiKey, string $subaccountApiKey): Account { $response = $this->api->get($apiKey . '/subaccounts/' . $subaccountApiKey); return (new Account())->fromArray($response); } public function getSubaccounts(string $apiKey): array { $api = clone $this->api; $api->setCollectionName('subaccounts'); $collection = $this->api->search(null, '/' . $apiKey . '/subaccounts'); $collection->setNoQueryParameters(true); $hydrator = new ArrayHydrator(); $hydrator->setPrototype(new Account()); $subaccounts = $collection->getPageData()['_embedded'][$api->getCollectionName()]; return array_map(function ($item) use ($hydrator) { return $hydrator->hydrate($item); }, $subaccounts); } public function createSubaccount(string $apiKey, Account $account): ?array { return $this->api->create($account->toArray(), '/' . $apiKey . '/subaccounts'); } public function makeBalanceTransfer(TransferBalanceRequest $transferRequest): BalanceTransfer { $response = $this->api->create($transferRequest->toArray(), '/' . $transferRequest->getApiKey() . '/balance-transfers'); return (new BalanceTransfer())->fromArray($response); } public function makeCreditTransfer(TransferCreditRequest $transferRequest): CreditTransfer { $response = $this->api->create($transferRequest->toArray(), '/' . $transferRequest->getApiKey() . '/credit-transfers'); return (new CreditTransfer())->fromArray($response); } public function updateSubaccount(string $apiKey, string $subaccountApiKey, Account $account): ?array { return $this->api->partiallyUpdate($apiKey . '/subaccounts/' . $subaccountApiKey, $account->toArray()); } public function getCreditTransfers(string $apiKey, FilterInterface $filter = null): mixed { if (!$filter) { $filter = new EmptyFilter(); } $response = $this->api->get($apiKey . '/credit-transfers', $filter->getQuery()); $hydrator = new ArrayHydrator(); $hydrator->setPrototype(new CreditTransfer()); $transfers = $response['_embedded']['credit_transfers']; return array_map(function ($item) use ($hydrator) { return $hydrator->hydrate($item); }, $transfers); } public function getBalanceTransfers(string $apiKey, FilterInterface $filter = null): mixed { if (!$filter) { $filter = new EmptyFilter(); } $response = $this->api->get($apiKey . '/balance-transfers', $filter->getQuery()); $hydrator = new ArrayHydrator(); $hydrator->setPrototype(new BalanceTransfer()); $transfers = $response['_embedded']['balance_transfers']; return array_map(function ($item) use ($hydrator) { return $hydrator->hydrate($item); }, $transfers); } public function makeNumberTransfer(NumberTransferRequest $request): ?array { return $this->api->create($request->toArray(), '/' . $request->getApiKey() . '/transfer-number'); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.8 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002