class PaymentController implements PaymentApi {

    @Override
    public ResponseEntity cancelPayment(String paymentService, String paymentProduct, String paymentId,
                                        UUID xRequestID, String digest, String signature, byte[] tpPSignatureCertificate,
                                        Boolean tpPRedirectPreferred, String tpPNokRedirectURI, String tpPRedirectURI,
                                        Boolean tppExplicitAuthorisationPreferred, String psUIPAddress, String psUIPPort,
                                        String psUAccept, String psUAcceptCharset, String psUAcceptEncoding,
                                        String psUAcceptLanguage, String psUUserAgent, String psUHttpMethod,
                                        UUID psUDeviceID, String psUGeoLocation) {

        PisPaymentCancellationRequest paymentCancellationRequest = paymentModelMapperPsd2.mapToPaymentCancellationRequest(paymentProduct, paymentService, paymentId, tppExplicitAuthorisationPreferred, tpPRedirectURI, tpPNokRedirectURI);
        ResponseObject<CancelPaymentResponse> serviceResponse = xs2aPaymentService.cancelPayment(paymentCancellationRequest);

        if (serviceResponse.hasError()) {
            return responseErrorMapper.generateErrorResponse(serviceResponse.getError());
        }

        CancelPaymentResponse cancelPayment = serviceResponse.getBody();
        PaymentInitiationCancelResponse202 response = paymentModelMapperPsd2.mapToPaymentInitiationCancelResponse(cancelPayment);

        return cancelPayment.isStartAuthorisationRequired()
                   ? responseMapper.accepted(ResponseObject.builder().body(response).build())
                   : responseMapper.delete(serviceResponse);
    }

}