D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
tattooscyy
/
test
/
app
/
Libs
/
OnlinePayments
/
Sdk
/
Merchant
/
Tokens
/
Filename :
TokensClient.php
back
Copy
<?php /* * This file was automatically generated. */ namespace App\Libs\OnlinePayments\Sdk\Merchant\Tokens; use App\Libs\OnlinePayments\Sdk\Domain\CreatedTokenResponse; use App\Libs\OnlinePayments\Sdk\Domain\CreateTokenRequest; use App\Libs\OnlinePayments\Sdk\Domain\TokenResponse; use App\Libs\OnlinePayments\Sdk\ExceptionFactory; use App\Libs\Sdk\ApiResource; use App\Libs\Sdk\CallContext; use App\Libs\Sdk\Communication\ErrorResponseException; use App\Libs\Sdk\Communication\ResponseClassMap; /** * Tokens client. */ class TokensClient extends ApiResource implements TokensClientInterface { /** @var ExceptionFactory|null */ private ?ExceptionFactory $responseExceptionFactory = null; /** * @inheritdoc */ public function getToken(string $tokenId, ?CallContext $callContext = null): TokenResponse { $this->context['tokenId'] = $tokenId; $responseClassMap = new ResponseClassMap(); $responseClassMap->defaultSuccessResponseClassName = '\App\Libs\OnlinePayments\Sdk\Domain\TokenResponse'; $responseClassMap->defaultErrorResponseClassName = '\App\Libs\OnlinePayments\Sdk\Domain\ErrorResponse'; try { return $this->getCommunicator()->get( $responseClassMap, $this->instantiateUri('/v2/{merchantId}/tokens/{tokenId}'), $this->getClientMetaInfo(), null, $callContext ); } catch (ErrorResponseException $e) { throw $this->getResponseExceptionFactory()->createException( $e->getHttpStatusCode(), $e->getErrorResponse(), $callContext ); } } /** * @inheritdoc */ public function deleteToken(string $tokenId, ?CallContext $callContext = null): void { $this->context['tokenId'] = $tokenId; $responseClassMap = new ResponseClassMap(); $responseClassMap->defaultErrorResponseClassName = '\App\Libs\OnlinePayments\Sdk\Domain\ErrorResponse'; try { $this->getCommunicator()->delete( $responseClassMap, $this->instantiateUri('/v2/{merchantId}/tokens/{tokenId}'), $this->getClientMetaInfo(), null, $callContext ); } catch (ErrorResponseException $e) { throw $this->getResponseExceptionFactory()->createException( $e->getHttpStatusCode(), $e->getErrorResponse(), $callContext ); } } /** * @inheritdoc */ public function createToken(CreateTokenRequest $body, ?CallContext $callContext = null): CreatedTokenResponse { $responseClassMap = new ResponseClassMap(); $responseClassMap->defaultSuccessResponseClassName = '\App\Libs\OnlinePayments\Sdk\Domain\CreatedTokenResponse'; $responseClassMap->defaultErrorResponseClassName = '\App\Libs\OnlinePayments\Sdk\Domain\ErrorResponse'; try { return $this->getCommunicator()->post( $responseClassMap, $this->instantiateUri('/v2/{merchantId}/tokens'), $this->getClientMetaInfo(), $body, null, $callContext ); } catch (ErrorResponseException $e) { throw $this->getResponseExceptionFactory()->createException( $e->getHttpStatusCode(), $e->getErrorResponse(), $callContext ); } } /** @return ExceptionFactory */ private function getResponseExceptionFactory(): ExceptionFactory { if (is_null($this->responseExceptionFactory)) { $this->responseExceptionFactory = new ExceptionFactory(); } return $this->responseExceptionFactory; } }