1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Merchant\Installments;
7:
8: use Worldline\Connect\Sdk\ApiResource;
9: use Worldline\Connect\Sdk\CallContext;
10: use Worldline\Connect\Sdk\Communication\ErrorResponseException;
11: use Worldline\Connect\Sdk\Communication\InvalidResponseException;
12: use Worldline\Connect\Sdk\Communication\ResponseClassMap;
13: use Worldline\Connect\Sdk\V1\ApiException;
14: use Worldline\Connect\Sdk\V1\AuthorizationException;
15: use Worldline\Connect\Sdk\V1\Domain\GetInstallmentRequest;
16: use Worldline\Connect\Sdk\V1\Domain\InstallmentOptionsResponse;
17: use Worldline\Connect\Sdk\V1\ExceptionFactory;
18: use Worldline\Connect\Sdk\V1\IdempotenceException;
19: use Worldline\Connect\Sdk\V1\PlatformException;
20: use Worldline\Connect\Sdk\V1\ReferenceException;
21: use Worldline\Connect\Sdk\V1\ValidationException;
22:
23: /**
24: * Installments client.
25: */
26: class InstallmentsClient extends ApiResource
27: {
28: /** @var ExceptionFactory|null */
29: private $responseExceptionFactory = null;
30:
31: /**
32: * Resource /{merchantId}/installments/getInstallmentsInfo - Get installment information
33: *
34: * @param GetInstallmentRequest $body
35: * @param CallContext $callContext
36: * @return InstallmentOptionsResponse
37: *
38: * @throws IdempotenceException
39: * @throws ValidationException
40: * @throws AuthorizationException
41: * @throws ReferenceException
42: * @throws PlatformException
43: * @throws ApiException
44: * @throws InvalidResponseException
45: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/installments/getInstallmentsInfo.html Get installment information
46: */
47: public function getInstallmentsInfo(GetInstallmentRequest $body, CallContext $callContext = null)
48: {
49: $responseClassMap = new ResponseClassMap();
50: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\InstallmentOptionsResponse';
51: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
52: try {
53: return $this->getCommunicator()->post(
54: $responseClassMap,
55: $this->instantiateUri('/v1/{merchantId}/installments/getInstallmentsInfo'),
56: $this->getClientMetaInfo(),
57: $body,
58: null,
59: $callContext
60: );
61: } catch (ErrorResponseException $e) {
62: throw $this->getResponseExceptionFactory()->createException(
63: $e->getHttpStatusCode(),
64: $e->getErrorResponse(),
65: $callContext
66: );
67: }
68: }
69:
70: /** @return ExceptionFactory */
71: private function getResponseExceptionFactory()
72: {
73: if (is_null($this->responseExceptionFactory)) {
74: $this->responseExceptionFactory = new ExceptionFactory();
75: }
76: return $this->responseExceptionFactory;
77: }
78: }
79: