D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
tattooscyy
/
test
/
app
/
Libs
/
OnlinePayments
/
Sdk
/
Merchant
/
HostedCheckout
/
Filename :
HostedCheckoutClient.php
back
Copy
<?php /* * This file was automatically generated. */ namespace App\Libs\OnlinePayments\Sdk\Merchant\HostedCheckout; use App\Libs\OnlinePayments\Sdk\Domain\CreateHostedCheckoutRequest; use App\Libs\OnlinePayments\Sdk\Domain\CreateHostedCheckoutResponse; use App\Libs\OnlinePayments\Sdk\Domain\GetHostedCheckoutResponse; 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; /** * HostedCheckout client. */ class HostedCheckoutClient extends ApiResource implements HostedCheckoutClientInterface { /** @var ExceptionFactory|null */ private ?ExceptionFactory $responseExceptionFactory = null; /** * @inheritdoc */ public function createHostedCheckout(CreateHostedCheckoutRequest $body, ?CallContext $callContext = null): CreateHostedCheckoutResponse { $responseClassMap = new ResponseClassMap(); $responseClassMap->defaultSuccessResponseClassName = '\App\Libs\OnlinePayments\Sdk\Domain\CreateHostedCheckoutResponse'; $responseClassMap->defaultErrorResponseClassName = '\App\Libs\OnlinePayments\Sdk\Domain\ErrorResponse'; try { return $this->getCommunicator()->post( $responseClassMap, $this->instantiateUri('/v2/{merchantId}/hostedcheckouts'), $this->getClientMetaInfo(), $body, null, $callContext ); } catch (ErrorResponseException $e) { throw $this->getResponseExceptionFactory()->createException( $e->getHttpStatusCode(), $e->getErrorResponse(), $callContext ); } } /** * @inheritdoc */ public function getHostedCheckout(string $hostedCheckoutId, ?CallContext $callContext = null): GetHostedCheckoutResponse { $this->context['hostedCheckoutId'] = $hostedCheckoutId; $responseClassMap = new ResponseClassMap(); $responseClassMap->defaultSuccessResponseClassName = '\App\Libs\OnlinePayments\Sdk\Domain\GetHostedCheckoutResponse'; $responseClassMap->defaultErrorResponseClassName = '\App\Libs\OnlinePayments\Sdk\Domain\ErrorResponse'; try { return $this->getCommunicator()->get( $responseClassMap, $this->instantiateUri('/v2/{merchantId}/hostedcheckouts/{hostedCheckoutId}'), $this->getClientMetaInfo(), 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; } }