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\Services;
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\BankDetailsRequest;
16: use Worldline\Connect\Sdk\V1\Domain\BankDetailsResponse;
17: use Worldline\Connect\Sdk\V1\Domain\ConvertAmount;
18: use Worldline\Connect\Sdk\V1\Domain\GetIINDetailsRequest;
19: use Worldline\Connect\Sdk\V1\Domain\GetIINDetailsResponse;
20: use Worldline\Connect\Sdk\V1\Domain\GetPrivacyPolicyResponse;
21: use Worldline\Connect\Sdk\V1\Domain\TestConnection;
22: use Worldline\Connect\Sdk\V1\ExceptionFactory;
23: use Worldline\Connect\Sdk\V1\IdempotenceException;
24: use Worldline\Connect\Sdk\V1\PlatformException;
25: use Worldline\Connect\Sdk\V1\ReferenceException;
26: use Worldline\Connect\Sdk\V1\ValidationException;
27:
28: /**
29: * Services client.
30: *
31: * @package Worldline\Connect\Sdk\V1\Merchant\Services
32: */
33: class ServicesClient extends ApiResource
34: {
35: /**
36: * @var ExceptionFactory|null
37: */
38: private ?ExceptionFactory $responseExceptionFactory = null;
39:
40: /**
41: * Resource /{merchantId}/services/convert/amount - Convert amount
42: *
43: * @param ConvertAmountParams $query
44: * @param CallContext|null $callContext
45: *
46: * @return ConvertAmount
47: * @throws IdempotenceException
48: * @throws ValidationException
49: * @throws AuthorizationException
50: * @throws ReferenceException
51: * @throws PlatformException
52: * @throws ApiException
53: * @throws InvalidResponseException
54: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/services/convertAmount.html Convert amount
55: */
56: public function convertAmount(ConvertAmountParams $query, ?CallContext $callContext = null): ConvertAmount
57: {
58: $responseClassMap = new ResponseClassMap();
59: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ConvertAmount';
60: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
61: try {
62: return $this->getCommunicator()->get(
63: $responseClassMap,
64: $this->instantiateUri('/v1/{merchantId}/services/convert/amount'),
65: $this->getClientMetaInfo(),
66: $query,
67: $callContext
68: );
69: } catch (ErrorResponseException $e) {
70: throw $this->getResponseExceptionFactory()->createException(
71: $e->getHttpStatusCode(),
72: $e->getErrorResponse(),
73: $callContext
74: );
75: }
76: }
77:
78: /**
79: * Resource /{merchantId}/services/convert/bankaccount - Convert bankaccount
80: *
81: * @param BankDetailsRequest $body
82: * @param CallContext|null $callContext
83: *
84: * @return BankDetailsResponse
85: * @throws IdempotenceException
86: * @throws ValidationException
87: * @throws AuthorizationException
88: * @throws ReferenceException
89: * @throws PlatformException
90: * @throws ApiException
91: * @throws InvalidResponseException
92: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/services/bankaccount.html Convert bankaccount
93: */
94: public function bankaccount(BankDetailsRequest $body, ?CallContext $callContext = null): BankDetailsResponse
95: {
96: $responseClassMap = new ResponseClassMap();
97: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\BankDetailsResponse';
98: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
99: try {
100: return $this->getCommunicator()->post(
101: $responseClassMap,
102: $this->instantiateUri('/v1/{merchantId}/services/convert/bankaccount'),
103: $this->getClientMetaInfo(),
104: $body,
105: null,
106: $callContext
107: );
108: } catch (ErrorResponseException $e) {
109: throw $this->getResponseExceptionFactory()->createException(
110: $e->getHttpStatusCode(),
111: $e->getErrorResponse(),
112: $callContext
113: );
114: }
115: }
116:
117: /**
118: * Resource /{merchantId}/services/getIINdetails - Get IIN details
119: *
120: * @param GetIINDetailsRequest $body
121: * @param CallContext|null $callContext
122: *
123: * @return GetIINDetailsResponse
124: * @throws IdempotenceException
125: * @throws ValidationException
126: * @throws AuthorizationException
127: * @throws ReferenceException
128: * @throws PlatformException
129: * @throws ApiException
130: * @throws InvalidResponseException
131: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/services/getIINdetails.html Get IIN details
132: */
133: public function getIINdetails(GetIINDetailsRequest $body, ?CallContext $callContext = null): GetIINDetailsResponse
134: {
135: $responseClassMap = new ResponseClassMap();
136: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetIINDetailsResponse';
137: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
138: try {
139: return $this->getCommunicator()->post(
140: $responseClassMap,
141: $this->instantiateUri('/v1/{merchantId}/services/getIINdetails'),
142: $this->getClientMetaInfo(),
143: $body,
144: null,
145: $callContext
146: );
147: } catch (ErrorResponseException $e) {
148: throw $this->getResponseExceptionFactory()->createException(
149: $e->getHttpStatusCode(),
150: $e->getErrorResponse(),
151: $callContext
152: );
153: }
154: }
155:
156: /**
157: * Resource /{merchantId}/services/privacypolicy - Get privacy policy
158: *
159: * @param PrivacypolicyParams $query
160: * @param CallContext|null $callContext
161: *
162: * @return GetPrivacyPolicyResponse
163: * @throws IdempotenceException
164: * @throws ValidationException
165: * @throws AuthorizationException
166: * @throws ReferenceException
167: * @throws PlatformException
168: * @throws ApiException
169: * @throws InvalidResponseException
170: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/services/privacypolicy.html Get privacy policy
171: */
172: public function privacypolicy(PrivacypolicyParams $query, ?CallContext $callContext = null): GetPrivacyPolicyResponse
173: {
174: $responseClassMap = new ResponseClassMap();
175: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetPrivacyPolicyResponse';
176: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
177: try {
178: return $this->getCommunicator()->get(
179: $responseClassMap,
180: $this->instantiateUri('/v1/{merchantId}/services/privacypolicy'),
181: $this->getClientMetaInfo(),
182: $query,
183: $callContext
184: );
185: } catch (ErrorResponseException $e) {
186: throw $this->getResponseExceptionFactory()->createException(
187: $e->getHttpStatusCode(),
188: $e->getErrorResponse(),
189: $callContext
190: );
191: }
192: }
193:
194: /**
195: * Resource /{merchantId}/services/testconnection - Test connection
196: *
197: * @param CallContext|null $callContext
198: *
199: * @return TestConnection
200: * @throws IdempotenceException
201: * @throws ValidationException
202: * @throws AuthorizationException
203: * @throws ReferenceException
204: * @throws PlatformException
205: * @throws ApiException
206: * @throws InvalidResponseException
207: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/services/testconnection.html Test connection
208: */
209: public function testconnection(?CallContext $callContext = null): TestConnection
210: {
211: $responseClassMap = new ResponseClassMap();
212: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\TestConnection';
213: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
214: try {
215: return $this->getCommunicator()->get(
216: $responseClassMap,
217: $this->instantiateUri('/v1/{merchantId}/services/testconnection'),
218: $this->getClientMetaInfo(),
219: null,
220: $callContext
221: );
222: } catch (ErrorResponseException $e) {
223: throw $this->getResponseExceptionFactory()->createException(
224: $e->getHttpStatusCode(),
225: $e->getErrorResponse(),
226: $callContext
227: );
228: }
229: }
230:
231: /**
232: * @return ExceptionFactory
233: */
234: private function getResponseExceptionFactory(): ExceptionFactory
235: {
236: if (is_null($this->responseExceptionFactory)) {
237: $this->responseExceptionFactory = new ExceptionFactory();
238: }
239: return $this->responseExceptionFactory;
240: }
241: }
242: