1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Disputemanagement;
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\Domain\AcceptDisputeLiabilityRequest;
15: use Worldline\Acquiring\Sdk\V1\Domain\DisputeResponse;
16: use Worldline\Acquiring\Sdk\V1\Domain\SearchDisputesRequest;
17: use Worldline\Acquiring\Sdk\V1\Domain\SearchDisputesResponse;
18: use Worldline\Acquiring\Sdk\V1\Domain\SubmitEvidenceRequest;
19: use Worldline\Acquiring\Sdk\V1\ExceptionFactory;
20: use Worldline\Acquiring\Sdk\V1\PlatformException;
21: use Worldline\Acquiring\Sdk\V1\ReferenceException;
22: use Worldline\Acquiring\Sdk\V1\ValidationException;
23:
24: /**
25: * DisputeManagement client.
26: *
27: * @package Worldline\Acquiring\Sdk\V1\Disputemanagement
28: */
29: class DisputeManagementClient extends ApiResource
30: {
31: /**
32: * @var ExceptionFactory|null
33: */
34: private ?ExceptionFactory $responseExceptionFactory = null;
35:
36: /**
37: * Resource /dispute-management/v1/disputes/search - Search Disputes
38: *
39: * @param SearchDisputesRequest $body
40: * @param CallContext|null $callContext
41: *
42: * @return SearchDisputesResponse
43: * @throws ValidationException
44: * @throws AuthorizationException
45: * @throws ReferenceException
46: * @throws PlatformException
47: * @throws ApiException
48: * @throws InvalidResponseException
49: * @link https://docs.acquiring.worldline-solutions.com/api-reference#tag/Dispute-Management/operation/searchDisputes Search Disputes
50: */
51: public function searchDisputes(SearchDisputesRequest $body, ?CallContext $callContext = null): SearchDisputesResponse
52: {
53: $responseClassMap = new ResponseClassMap();
54: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\SearchDisputesResponse';
55: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiPaymentErrorResponse';
56: try {
57: return $this->getCommunicator()->post(
58: $responseClassMap,
59: $this->instantiateUri('/dispute-management/v1/disputes/search'),
60: $body,
61: null,
62: $callContext
63: );
64: } catch (ErrorResponseException $e) {
65: throw $this->getResponseExceptionFactory()->createException(
66: $e->getHttpStatusCode(),
67: $e->getErrorResponse(),
68: $callContext
69: );
70: }
71: }
72:
73: /**
74: * Resource /dispute-management/v1/disputes/{disputeId} - Retrieve Dispute
75: *
76: * @param string $disputeId
77: * @param GetDisputeParams $query
78: * @param CallContext|null $callContext
79: *
80: * @return DisputeResponse
81: * @throws ValidationException
82: * @throws AuthorizationException
83: * @throws ReferenceException
84: * @throws PlatformException
85: * @throws ApiException
86: * @throws InvalidResponseException
87: * @link https://docs.acquiring.worldline-solutions.com/api-reference#tag/Dispute-Management/operation/getDispute Retrieve Dispute
88: */
89: public function getDispute(string $disputeId, GetDisputeParams $query, ?CallContext $callContext = null): DisputeResponse
90: {
91: $this->context['disputeId'] = $disputeId;
92: $responseClassMap = new ResponseClassMap();
93: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\DisputeResponse';
94: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiPaymentErrorResponse';
95: try {
96: return $this->getCommunicator()->get(
97: $responseClassMap,
98: $this->instantiateUri('/dispute-management/v1/disputes/{disputeId}'),
99: $query,
100: $callContext
101: );
102: } catch (ErrorResponseException $e) {
103: throw $this->getResponseExceptionFactory()->createException(
104: $e->getHttpStatusCode(),
105: $e->getErrorResponse(),
106: $callContext
107: );
108: }
109: }
110:
111: /**
112: * Resource /dispute-management/v1/disputes/{disputeId}/accept - Accept Liability
113: *
114: * @param string $disputeId
115: * @param AcceptDisputeLiabilityRequest $body
116: * @param CallContext|null $callContext
117: *
118: * @return DisputeResponse
119: * @throws ValidationException
120: * @throws AuthorizationException
121: * @throws ReferenceException
122: * @throws PlatformException
123: * @throws ApiException
124: * @throws InvalidResponseException
125: * @link https://docs.acquiring.worldline-solutions.com/api-reference#tag/Dispute-Management/operation/acceptDisputeLiability Accept Liability
126: */
127: public function acceptDisputeLiability(string $disputeId, AcceptDisputeLiabilityRequest $body, ?CallContext $callContext = null): DisputeResponse
128: {
129: $this->context['disputeId'] = $disputeId;
130: $responseClassMap = new ResponseClassMap();
131: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\DisputeResponse';
132: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiPaymentErrorResponse';
133: try {
134: return $this->getCommunicator()->post(
135: $responseClassMap,
136: $this->instantiateUri('/dispute-management/v1/disputes/{disputeId}/accept'),
137: $body,
138: null,
139: $callContext
140: );
141: } catch (ErrorResponseException $e) {
142: throw $this->getResponseExceptionFactory()->createException(
143: $e->getHttpStatusCode(),
144: $e->getErrorResponse(),
145: $callContext
146: );
147: }
148: }
149:
150: /**
151: * Resource /dispute-management/v1/disputes/{disputeId}/submit-evidence - Submit Evidence
152: *
153: * @param string $disputeId
154: * @param SubmitEvidenceRequest $body
155: * @param CallContext|null $callContext
156: *
157: * @return DisputeResponse
158: * @throws ValidationException
159: * @throws AuthorizationException
160: * @throws ReferenceException
161: * @throws PlatformException
162: * @throws ApiException
163: * @throws InvalidResponseException
164: * @link https://docs.acquiring.worldline-solutions.com/api-reference#tag/Dispute-Management/operation/submitEvidence Submit Evidence
165: */
166: public function submitEvidence(string $disputeId, SubmitEvidenceRequest $body, ?CallContext $callContext = null): DisputeResponse
167: {
168: $this->context['disputeId'] = $disputeId;
169: $responseClassMap = new ResponseClassMap();
170: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\DisputeResponse';
171: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiPaymentErrorResponse';
172: try {
173: return $this->getCommunicator()->post(
174: $responseClassMap,
175: $this->instantiateUri('/dispute-management/v1/disputes/{disputeId}/submit-evidence'),
176: $body,
177: null,
178: $callContext
179: );
180: } catch (ErrorResponseException $e) {
181: throw $this->getResponseExceptionFactory()->createException(
182: $e->getHttpStatusCode(),
183: $e->getErrorResponse(),
184: $callContext
185: );
186: }
187: }
188:
189: /**
190: * @return ExceptionFactory
191: */
192: private function getResponseExceptionFactory(): ExceptionFactory
193: {
194: if (is_null($this->responseExceptionFactory)) {
195: $this->responseExceptionFactory = new ExceptionFactory();
196: }
197: return $this->responseExceptionFactory;
198: }
199: }
200: