1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Acquirer\Merchant\Technicalreversals;
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\ApiTechnicalReversalRequest;
15: use Worldline\Acquiring\Sdk\V1\Domain\ApiTechnicalReversalResponse;
16: use Worldline\Acquiring\Sdk\V1\ExceptionFactory;
17: use Worldline\Acquiring\Sdk\V1\PlatformException;
18: use Worldline\Acquiring\Sdk\V1\ReferenceException;
19: use Worldline\Acquiring\Sdk\V1\ValidationException;
20:
21: /**
22: * TechnicalReversals client.
23: */
24: class TechnicalReversalsClient extends ApiResource
25: {
26: /** @var ExceptionFactory|null */
27: private $responseExceptionFactory = null;
28:
29: /**
30: * Resource /processing/v1/{acquirerId}/{merchantId}/operations/{operationId}/reverse - Technical reversal
31: *
32: * @param string $operationId
33: * @param ApiTechnicalReversalRequest $body
34: * @param CallContext|null $callContext
35: * @return ApiTechnicalReversalResponse
36: *
37: * @throws ValidationException
38: * @throws AuthorizationException
39: * @throws ReferenceException
40: * @throws PlatformException
41: * @throws ApiException
42: * @throws InvalidResponseException
43: * @link https://docs.acquiring.worldline-solutions.com/api-reference#tag/Technical-Reversals/operation/technicalReversal Technical reversal
44: */
45: public function technicalReversal($operationId, ApiTechnicalReversalRequest $body, CallContext $callContext = null)
46: {
47: $this->context['operationId'] = $operationId;
48: $responseClassMap = new ResponseClassMap();
49: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiTechnicalReversalResponse';
50: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiPaymentErrorResponse';
51: try {
52: return $this->getCommunicator()->post(
53: $responseClassMap,
54: $this->instantiateUri('/processing/v1/{acquirerId}/{merchantId}/operations/{operationId}/reverse'),
55: $body,
56: null,
57: $callContext
58: );
59: } catch (ErrorResponseException $e) {
60: throw $this->getResponseExceptionFactory()->createException(
61: $e->getHttpStatusCode(),
62: $e->getErrorResponse(),
63: $callContext
64: );
65: }
66: }
67:
68: /** @return ExceptionFactory */
69: private function getResponseExceptionFactory()
70: {
71: if (is_null($this->responseExceptionFactory)) {
72: $this->responseExceptionFactory = new ExceptionFactory();
73: }
74: return $this->responseExceptionFactory;
75: }
76: }
77: