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