1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Ping;
6:
7: use Worldline\Acquiring\Sdk\ApiResource;
8: use Worldline\Acquiring\Sdk\CallContext;
9: use Worldline\Acquiring\Sdk\Communication\ErrorResponseException;
10: use Worldline\Acquiring\Sdk\Communication\InvalidResponseException;
11: use Worldline\Acquiring\Sdk\Communication\ResponseClassMap;
12: use Worldline\Acquiring\Sdk\V1\ApiException;
13: use Worldline\Acquiring\Sdk\V1\AuthorizationException;
14: use Worldline\Acquiring\Sdk\V1\ExceptionFactory;
15: use Worldline\Acquiring\Sdk\V1\PlatformException;
16: use Worldline\Acquiring\Sdk\V1\ReferenceException;
17: use Worldline\Acquiring\Sdk\V1\ValidationException;
18:
19: /**
20: * Ping client.
21: *
22: * @package Worldline\Acquiring\Sdk\V1\Ping
23: */
24: class PingClient extends ApiResource
25: {
26: /**
27: * @var ExceptionFactory|null
28: */
29: private ?ExceptionFactory $responseExceptionFactory = null;
30:
31: /**
32: * Resource /services/v1/ping - Check API connection
33: *
34: * @param CallContext|null $callContext
35: *
36: * @return void
37: * @throws ValidationException
38: * @throws AuthorizationException
39: * @throws ReferenceException
40: * @throws PlatformException
41: * @throws ApiException
42: * @throws InvalidResponseException
43: * @link https://docs.acquiring.worldline-solutions.com/api-reference#tag/Ping/operation/ping Check API connection
44: */
45: public function ping(?CallContext $callContext = null): void
46: {
47: $responseClassMap = new ResponseClassMap();
48: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiPaymentErrorResponse';
49: try {
50: $this->getCommunicator()->get(
51: $responseClassMap,
52: $this->instantiateUri('/services/v1/ping'),
53: null,
54: $callContext
55: );
56: } catch (ErrorResponseException $e) {
57: throw $this->getResponseExceptionFactory()->createException(
58: $e->getHttpStatusCode(),
59: $e->getErrorResponse(),
60: $callContext
61: );
62: }
63: }
64:
65: /**
66: * @return ExceptionFactory
67: */
68: private function getResponseExceptionFactory(): ExceptionFactory
69: {
70: if (is_null($this->responseExceptionFactory)) {
71: $this->responseExceptionFactory = new ExceptionFactory();
72: }
73: return $this->responseExceptionFactory;
74: }
75: }
76: