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: class PingClient extends ApiResource
23: {
24: /** @var ExceptionFactory|null */
25: private $responseExceptionFactory = null;
26:
27: /**
28: * Resource /services/v1/ping - Check API connection
29: *
30: * @param CallContext|null $callContext
31: * @return null
32: *
33: * @throws ValidationException
34: * @throws AuthorizationException
35: * @throws ReferenceException
36: * @throws PlatformException
37: * @throws ApiException
38: * @throws InvalidResponseException
39: * @link https://docs.acquiring.worldline-solutions.com/api-reference#tag/Ping/operation/ping Check API connection
40: */
41: public function ping(CallContext $callContext = null)
42: {
43: $responseClassMap = new ResponseClassMap();
44: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiPaymentErrorResponse';
45: try {
46: return $this->getCommunicator()->get(
47: $responseClassMap,
48: $this->instantiateUri('/services/v1/ping'),
49: null,
50: $callContext
51: );
52: } catch (ErrorResponseException $e) {
53: throw $this->getResponseExceptionFactory()->createException(
54: $e->getHttpStatusCode(),
55: $e->getErrorResponse(),
56: $callContext
57: );
58: }
59: }
60:
61: /** @return ExceptionFactory */
62: private function getResponseExceptionFactory()
63: {
64: if (is_null($this->responseExceptionFactory)) {
65: $this->responseExceptionFactory = new ExceptionFactory();
66: }
67: return $this->responseExceptionFactory;
68: }
69: }
70: