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\Payments;
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\DeclinedPaymentException;
16: use Worldline\Connect\Sdk\V1\DeclinedRefundException;
17: use Worldline\Connect\Sdk\V1\Domain\ApprovePaymentRequest;
18: use Worldline\Connect\Sdk\V1\Domain\CancelApprovalPaymentResponse;
19: use Worldline\Connect\Sdk\V1\Domain\CancelPaymentResponse;
20: use Worldline\Connect\Sdk\V1\Domain\CapturePaymentRequest;
21: use Worldline\Connect\Sdk\V1\Domain\CaptureResponse;
22: use Worldline\Connect\Sdk\V1\Domain\CapturesResponse;
23: use Worldline\Connect\Sdk\V1\Domain\CompletePaymentRequest;
24: use Worldline\Connect\Sdk\V1\Domain\CompletePaymentResponse;
25: use Worldline\Connect\Sdk\V1\Domain\CreateDisputeRequest;
26: use Worldline\Connect\Sdk\V1\Domain\CreatePaymentRequest;
27: use Worldline\Connect\Sdk\V1\Domain\CreatePaymentResponse;
28: use Worldline\Connect\Sdk\V1\Domain\CreateTokenResponse;
29: use Worldline\Connect\Sdk\V1\Domain\DeviceFingerprintDetails;
30: use Worldline\Connect\Sdk\V1\Domain\DisputeResponse;
31: use Worldline\Connect\Sdk\V1\Domain\DisputesResponse;
32: use Worldline\Connect\Sdk\V1\Domain\FindPaymentsResponse;
33: use Worldline\Connect\Sdk\V1\Domain\PaymentApprovalResponse;
34: use Worldline\Connect\Sdk\V1\Domain\PaymentResponse;
35: use Worldline\Connect\Sdk\V1\Domain\RefundRequest;
36: use Worldline\Connect\Sdk\V1\Domain\RefundResponse;
37: use Worldline\Connect\Sdk\V1\Domain\RefundsResponse;
38: use Worldline\Connect\Sdk\V1\Domain\ThirdPartyStatusResponse;
39: use Worldline\Connect\Sdk\V1\Domain\TokenizePaymentRequest;
40: use Worldline\Connect\Sdk\V1\ExceptionFactory;
41: use Worldline\Connect\Sdk\V1\IdempotenceException;
42: use Worldline\Connect\Sdk\V1\PlatformException;
43: use Worldline\Connect\Sdk\V1\ReferenceException;
44: use Worldline\Connect\Sdk\V1\ValidationException;
45:
46: /**
47: * Payments client.
48: */
49: class PaymentsClient extends ApiResource
50: {
51: /** @var ExceptionFactory|null */
52: private $responseExceptionFactory = null;
53:
54: /**
55: * Resource /{merchantId}/payments - Create payment
56: *
57: * @param CreatePaymentRequest $body
58: * @param CallContext $callContext
59: * @return CreatePaymentResponse
60: *
61: * @throws DeclinedPaymentException
62: * @throws IdempotenceException
63: * @throws ValidationException
64: * @throws AuthorizationException
65: * @throws ReferenceException
66: * @throws PlatformException
67: * @throws ApiException
68: * @throws InvalidResponseException
69: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/create.html Create payment
70: */
71: public function create(CreatePaymentRequest $body, CallContext $callContext = null)
72: {
73: $responseClassMap = new ResponseClassMap();
74: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreatePaymentResponse';
75: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentErrorResponse';
76: try {
77: return $this->getCommunicator()->post(
78: $responseClassMap,
79: $this->instantiateUri('/v1/{merchantId}/payments'),
80: $this->getClientMetaInfo(),
81: $body,
82: null,
83: $callContext
84: );
85: } catch (ErrorResponseException $e) {
86: throw $this->getResponseExceptionFactory()->createException(
87: $e->getHttpStatusCode(),
88: $e->getErrorResponse(),
89: $callContext
90: );
91: }
92: }
93:
94: /**
95: * Resource /{merchantId}/payments - Find payments
96: *
97: * @param FindPaymentsParams $query
98: * @param CallContext $callContext
99: * @return FindPaymentsResponse
100: *
101: * @throws IdempotenceException
102: * @throws ValidationException
103: * @throws AuthorizationException
104: * @throws ReferenceException
105: * @throws PlatformException
106: * @throws ApiException
107: * @throws InvalidResponseException
108: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/find.html Find payments
109: */
110: public function find(FindPaymentsParams $query, CallContext $callContext = null)
111: {
112: $responseClassMap = new ResponseClassMap();
113: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\FindPaymentsResponse';
114: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
115: try {
116: return $this->getCommunicator()->get(
117: $responseClassMap,
118: $this->instantiateUri('/v1/{merchantId}/payments'),
119: $this->getClientMetaInfo(),
120: $query,
121: $callContext
122: );
123: } catch (ErrorResponseException $e) {
124: throw $this->getResponseExceptionFactory()->createException(
125: $e->getHttpStatusCode(),
126: $e->getErrorResponse(),
127: $callContext
128: );
129: }
130: }
131:
132: /**
133: * Resource /{merchantId}/payments/{paymentId} - Get payment
134: *
135: * @param string $paymentId
136: * @param GetPaymentParams $query
137: * @param CallContext $callContext
138: * @return PaymentResponse
139: *
140: * @throws IdempotenceException
141: * @throws ValidationException
142: * @throws AuthorizationException
143: * @throws ReferenceException
144: * @throws PlatformException
145: * @throws ApiException
146: * @throws InvalidResponseException
147: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/get.html Get payment
148: */
149: public function get($paymentId, GetPaymentParams $query, CallContext $callContext = null)
150: {
151: $this->context['paymentId'] = $paymentId;
152: $responseClassMap = new ResponseClassMap();
153: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentResponse';
154: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
155: try {
156: return $this->getCommunicator()->get(
157: $responseClassMap,
158: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}'),
159: $this->getClientMetaInfo(),
160: $query,
161: $callContext
162: );
163: } catch (ErrorResponseException $e) {
164: throw $this->getResponseExceptionFactory()->createException(
165: $e->getHttpStatusCode(),
166: $e->getErrorResponse(),
167: $callContext
168: );
169: }
170: }
171:
172: /**
173: * Resource /{merchantId}/payments/{paymentId}/complete - Complete payment
174: *
175: * @param string $paymentId
176: * @param CompletePaymentRequest $body
177: * @param CallContext $callContext
178: * @return CompletePaymentResponse
179: *
180: * @throws IdempotenceException
181: * @throws ValidationException
182: * @throws AuthorizationException
183: * @throws ReferenceException
184: * @throws PlatformException
185: * @throws ApiException
186: * @throws InvalidResponseException
187: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/complete.html Complete payment
188: */
189: public function complete($paymentId, CompletePaymentRequest $body, CallContext $callContext = null)
190: {
191: $this->context['paymentId'] = $paymentId;
192: $responseClassMap = new ResponseClassMap();
193: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CompletePaymentResponse';
194: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
195: try {
196: return $this->getCommunicator()->post(
197: $responseClassMap,
198: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/complete'),
199: $this->getClientMetaInfo(),
200: $body,
201: null,
202: $callContext
203: );
204: } catch (ErrorResponseException $e) {
205: throw $this->getResponseExceptionFactory()->createException(
206: $e->getHttpStatusCode(),
207: $e->getErrorResponse(),
208: $callContext
209: );
210: }
211: }
212:
213: /**
214: * Resource /{merchantId}/payments/{paymentId}/thirdpartystatus - Third party status poll
215: *
216: * @param string $paymentId
217: * @param CallContext $callContext
218: * @return ThirdPartyStatusResponse
219: *
220: * @throws IdempotenceException
221: * @throws ValidationException
222: * @throws AuthorizationException
223: * @throws ReferenceException
224: * @throws PlatformException
225: * @throws ApiException
226: * @throws InvalidResponseException
227: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/thirdPartyStatus.html Third party status poll
228: */
229: public function thirdPartyStatus($paymentId, CallContext $callContext = null)
230: {
231: $this->context['paymentId'] = $paymentId;
232: $responseClassMap = new ResponseClassMap();
233: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ThirdPartyStatusResponse';
234: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
235: try {
236: return $this->getCommunicator()->get(
237: $responseClassMap,
238: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/thirdpartystatus'),
239: $this->getClientMetaInfo(),
240: null,
241: $callContext
242: );
243: } catch (ErrorResponseException $e) {
244: throw $this->getResponseExceptionFactory()->createException(
245: $e->getHttpStatusCode(),
246: $e->getErrorResponse(),
247: $callContext
248: );
249: }
250: }
251:
252: /**
253: * Resource /{merchantId}/payments/{paymentId}/tokenize - Create a token from payment
254: *
255: * @param string $paymentId
256: * @param TokenizePaymentRequest $body
257: * @param CallContext $callContext
258: * @return CreateTokenResponse
259: *
260: * @throws IdempotenceException
261: * @throws ValidationException
262: * @throws AuthorizationException
263: * @throws ReferenceException
264: * @throws PlatformException
265: * @throws ApiException
266: * @throws InvalidResponseException
267: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/tokenize.html Create a token from payment
268: */
269: public function tokenize($paymentId, TokenizePaymentRequest $body, CallContext $callContext = null)
270: {
271: $this->context['paymentId'] = $paymentId;
272: $responseClassMap = new ResponseClassMap();
273: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreateTokenResponse';
274: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
275: try {
276: return $this->getCommunicator()->post(
277: $responseClassMap,
278: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/tokenize'),
279: $this->getClientMetaInfo(),
280: $body,
281: null,
282: $callContext
283: );
284: } catch (ErrorResponseException $e) {
285: throw $this->getResponseExceptionFactory()->createException(
286: $e->getHttpStatusCode(),
287: $e->getErrorResponse(),
288: $callContext
289: );
290: }
291: }
292:
293: /**
294: * Resource /{merchantId}/payments/{paymentId}/processchallenged - Approves challenged payment
295: *
296: * @param string $paymentId
297: * @param CallContext $callContext
298: * @return PaymentResponse
299: *
300: * @throws IdempotenceException
301: * @throws ValidationException
302: * @throws AuthorizationException
303: * @throws ReferenceException
304: * @throws PlatformException
305: * @throws ApiException
306: * @throws InvalidResponseException
307: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/processchallenged.html Approves challenged payment
308: */
309: public function processchallenged($paymentId, CallContext $callContext = null)
310: {
311: $this->context['paymentId'] = $paymentId;
312: $responseClassMap = new ResponseClassMap();
313: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentResponse';
314: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
315: try {
316: return $this->getCommunicator()->post(
317: $responseClassMap,
318: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/processchallenged'),
319: $this->getClientMetaInfo(),
320: null,
321: null,
322: $callContext
323: );
324: } catch (ErrorResponseException $e) {
325: throw $this->getResponseExceptionFactory()->createException(
326: $e->getHttpStatusCode(),
327: $e->getErrorResponse(),
328: $callContext
329: );
330: }
331: }
332:
333: /**
334: * Resource /{merchantId}/payments/{paymentId}/approve - Approve payment
335: *
336: * @param string $paymentId
337: * @param ApprovePaymentRequest $body
338: * @param CallContext $callContext
339: * @return PaymentApprovalResponse
340: *
341: * @throws IdempotenceException
342: * @throws ValidationException
343: * @throws AuthorizationException
344: * @throws ReferenceException
345: * @throws PlatformException
346: * @throws ApiException
347: * @throws InvalidResponseException
348: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/approve.html Approve payment
349: */
350: public function approve($paymentId, ApprovePaymentRequest $body, CallContext $callContext = null)
351: {
352: $this->context['paymentId'] = $paymentId;
353: $responseClassMap = new ResponseClassMap();
354: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentApprovalResponse';
355: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
356: try {
357: return $this->getCommunicator()->post(
358: $responseClassMap,
359: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/approve'),
360: $this->getClientMetaInfo(),
361: $body,
362: null,
363: $callContext
364: );
365: } catch (ErrorResponseException $e) {
366: throw $this->getResponseExceptionFactory()->createException(
367: $e->getHttpStatusCode(),
368: $e->getErrorResponse(),
369: $callContext
370: );
371: }
372: }
373:
374: /**
375: * Resource /{merchantId}/payments/{paymentId}/capture - Capture payment
376: *
377: * @param string $paymentId
378: * @param CapturePaymentRequest $body
379: * @param CallContext $callContext
380: * @return CaptureResponse
381: *
382: * @throws IdempotenceException
383: * @throws ValidationException
384: * @throws AuthorizationException
385: * @throws ReferenceException
386: * @throws PlatformException
387: * @throws ApiException
388: * @throws InvalidResponseException
389: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/capture.html Capture payment
390: */
391: public function capture($paymentId, CapturePaymentRequest $body, CallContext $callContext = null)
392: {
393: $this->context['paymentId'] = $paymentId;
394: $responseClassMap = new ResponseClassMap();
395: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CaptureResponse';
396: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
397: try {
398: return $this->getCommunicator()->post(
399: $responseClassMap,
400: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/capture'),
401: $this->getClientMetaInfo(),
402: $body,
403: null,
404: $callContext
405: );
406: } catch (ErrorResponseException $e) {
407: throw $this->getResponseExceptionFactory()->createException(
408: $e->getHttpStatusCode(),
409: $e->getErrorResponse(),
410: $callContext
411: );
412: }
413: }
414:
415: /**
416: * Resource /{merchantId}/payments/{paymentId}/cancelapproval - Undo capture payment
417: *
418: * @param string $paymentId
419: * @param CallContext $callContext
420: * @return CancelApprovalPaymentResponse
421: *
422: * @throws IdempotenceException
423: * @throws ValidationException
424: * @throws AuthorizationException
425: * @throws ReferenceException
426: * @throws PlatformException
427: * @throws ApiException
428: * @throws InvalidResponseException
429: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/cancelapproval.html Undo capture payment
430: */
431: public function cancelapproval($paymentId, CallContext $callContext = null)
432: {
433: $this->context['paymentId'] = $paymentId;
434: $responseClassMap = new ResponseClassMap();
435: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CancelApprovalPaymentResponse';
436: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
437: try {
438: return $this->getCommunicator()->post(
439: $responseClassMap,
440: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/cancelapproval'),
441: $this->getClientMetaInfo(),
442: null,
443: null,
444: $callContext
445: );
446: } catch (ErrorResponseException $e) {
447: throw $this->getResponseExceptionFactory()->createException(
448: $e->getHttpStatusCode(),
449: $e->getErrorResponse(),
450: $callContext
451: );
452: }
453: }
454:
455: /**
456: * Resource /{merchantId}/payments/{paymentId}/captures - Get captures of payment
457: *
458: * @param string $paymentId
459: * @param CallContext $callContext
460: * @return CapturesResponse
461: *
462: * @throws IdempotenceException
463: * @throws ValidationException
464: * @throws AuthorizationException
465: * @throws ReferenceException
466: * @throws PlatformException
467: * @throws ApiException
468: * @throws InvalidResponseException
469: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/captures.html Get captures of payment
470: */
471: public function captures($paymentId, CallContext $callContext = null)
472: {
473: $this->context['paymentId'] = $paymentId;
474: $responseClassMap = new ResponseClassMap();
475: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CapturesResponse';
476: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
477: try {
478: return $this->getCommunicator()->get(
479: $responseClassMap,
480: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/captures'),
481: $this->getClientMetaInfo(),
482: null,
483: $callContext
484: );
485: } catch (ErrorResponseException $e) {
486: throw $this->getResponseExceptionFactory()->createException(
487: $e->getHttpStatusCode(),
488: $e->getErrorResponse(),
489: $callContext
490: );
491: }
492: }
493:
494: /**
495: * Resource /{merchantId}/payments/{paymentId}/refund - Create refund
496: *
497: * @param string $paymentId
498: * @param RefundRequest $body
499: * @param CallContext $callContext
500: * @return RefundResponse
501: *
502: * @throws DeclinedRefundException
503: * @throws IdempotenceException
504: * @throws ValidationException
505: * @throws AuthorizationException
506: * @throws ReferenceException
507: * @throws PlatformException
508: * @throws ApiException
509: * @throws InvalidResponseException
510: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/refund.html Create refund
511: */
512: public function refund($paymentId, RefundRequest $body, CallContext $callContext = null)
513: {
514: $this->context['paymentId'] = $paymentId;
515: $responseClassMap = new ResponseClassMap();
516: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundResponse';
517: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundErrorResponse';
518: try {
519: return $this->getCommunicator()->post(
520: $responseClassMap,
521: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/refund'),
522: $this->getClientMetaInfo(),
523: $body,
524: null,
525: $callContext
526: );
527: } catch (ErrorResponseException $e) {
528: throw $this->getResponseExceptionFactory()->createException(
529: $e->getHttpStatusCode(),
530: $e->getErrorResponse(),
531: $callContext
532: );
533: }
534: }
535:
536: /**
537: * Resource /{merchantId}/payments/{paymentId}/refunds - Get refunds of payment
538: *
539: * @param string $paymentId
540: * @param CallContext $callContext
541: * @return RefundsResponse
542: *
543: * @throws IdempotenceException
544: * @throws ValidationException
545: * @throws AuthorizationException
546: * @throws ReferenceException
547: * @throws PlatformException
548: * @throws ApiException
549: * @throws InvalidResponseException
550: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/refunds.html Get refunds of payment
551: */
552: public function refunds($paymentId, CallContext $callContext = null)
553: {
554: $this->context['paymentId'] = $paymentId;
555: $responseClassMap = new ResponseClassMap();
556: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundsResponse';
557: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
558: try {
559: return $this->getCommunicator()->get(
560: $responseClassMap,
561: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/refunds'),
562: $this->getClientMetaInfo(),
563: null,
564: $callContext
565: );
566: } catch (ErrorResponseException $e) {
567: throw $this->getResponseExceptionFactory()->createException(
568: $e->getHttpStatusCode(),
569: $e->getErrorResponse(),
570: $callContext
571: );
572: }
573: }
574:
575: /**
576: * Resource /{merchantId}/payments/{paymentId}/cancel - Cancel payment
577: *
578: * @param string $paymentId
579: * @param CallContext $callContext
580: * @return CancelPaymentResponse
581: *
582: * @throws IdempotenceException
583: * @throws ValidationException
584: * @throws AuthorizationException
585: * @throws ReferenceException
586: * @throws PlatformException
587: * @throws ApiException
588: * @throws InvalidResponseException
589: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/cancel.html Cancel payment
590: */
591: public function cancel($paymentId, CallContext $callContext = null)
592: {
593: $this->context['paymentId'] = $paymentId;
594: $responseClassMap = new ResponseClassMap();
595: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CancelPaymentResponse';
596: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
597: try {
598: return $this->getCommunicator()->post(
599: $responseClassMap,
600: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/cancel'),
601: $this->getClientMetaInfo(),
602: null,
603: null,
604: $callContext
605: );
606: } catch (ErrorResponseException $e) {
607: throw $this->getResponseExceptionFactory()->createException(
608: $e->getHttpStatusCode(),
609: $e->getErrorResponse(),
610: $callContext
611: );
612: }
613: }
614:
615: /**
616: * Resource /{merchantId}/payments/{paymentId}/dispute - Create dispute
617: *
618: * @param string $paymentId
619: * @param CreateDisputeRequest $body
620: * @param CallContext $callContext
621: * @return DisputeResponse
622: *
623: * @throws IdempotenceException
624: * @throws ValidationException
625: * @throws AuthorizationException
626: * @throws ReferenceException
627: * @throws PlatformException
628: * @throws ApiException
629: * @throws InvalidResponseException
630: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/dispute.html Create dispute
631: */
632: public function dispute($paymentId, CreateDisputeRequest $body, CallContext $callContext = null)
633: {
634: $this->context['paymentId'] = $paymentId;
635: $responseClassMap = new ResponseClassMap();
636: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DisputeResponse';
637: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
638: try {
639: return $this->getCommunicator()->post(
640: $responseClassMap,
641: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/dispute'),
642: $this->getClientMetaInfo(),
643: $body,
644: null,
645: $callContext
646: );
647: } catch (ErrorResponseException $e) {
648: throw $this->getResponseExceptionFactory()->createException(
649: $e->getHttpStatusCode(),
650: $e->getErrorResponse(),
651: $callContext
652: );
653: }
654: }
655:
656: /**
657: * Resource /{merchantId}/payments/{paymentId}/disputes - Get disputes
658: *
659: * @param string $paymentId
660: * @param CallContext $callContext
661: * @return DisputesResponse
662: *
663: * @throws IdempotenceException
664: * @throws ValidationException
665: * @throws AuthorizationException
666: * @throws ReferenceException
667: * @throws PlatformException
668: * @throws ApiException
669: * @throws InvalidResponseException
670: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/disputes.html Get disputes
671: */
672: public function disputes($paymentId, CallContext $callContext = null)
673: {
674: $this->context['paymentId'] = $paymentId;
675: $responseClassMap = new ResponseClassMap();
676: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DisputesResponse';
677: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
678: try {
679: return $this->getCommunicator()->get(
680: $responseClassMap,
681: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/disputes'),
682: $this->getClientMetaInfo(),
683: null,
684: $callContext
685: );
686: } catch (ErrorResponseException $e) {
687: throw $this->getResponseExceptionFactory()->createException(
688: $e->getHttpStatusCode(),
689: $e->getErrorResponse(),
690: $callContext
691: );
692: }
693: }
694:
695: /**
696: * Resource /{merchantId}/payments/{paymentId}/devicefingerprint - Get Device Fingerprint details
697: *
698: * @param string $paymentId
699: * @param CallContext $callContext
700: * @return DeviceFingerprintDetails
701: *
702: * @throws IdempotenceException
703: * @throws ValidationException
704: * @throws AuthorizationException
705: * @throws ReferenceException
706: * @throws PlatformException
707: * @throws ApiException
708: * @throws InvalidResponseException
709: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/devicefingerprint.html Get Device Fingerprint details
710: */
711: public function devicefingerprint($paymentId, CallContext $callContext = null)
712: {
713: $this->context['paymentId'] = $paymentId;
714: $responseClassMap = new ResponseClassMap();
715: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DeviceFingerprintDetails';
716: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
717: try {
718: return $this->getCommunicator()->get(
719: $responseClassMap,
720: $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/devicefingerprint'),
721: $this->getClientMetaInfo(),
722: null,
723: $callContext
724: );
725: } catch (ErrorResponseException $e) {
726: throw $this->getResponseExceptionFactory()->createException(
727: $e->getHttpStatusCode(),
728: $e->getErrorResponse(),
729: $callContext
730: );
731: }
732: }
733:
734: /** @return ExceptionFactory */
735: private function getResponseExceptionFactory()
736: {
737: if (is_null($this->responseExceptionFactory)) {
738: $this->responseExceptionFactory = new ExceptionFactory();
739: }
740: return $this->responseExceptionFactory;
741: }
742: }
743: