class PaymentCancellationAspectService extends BaseAspectService<PaymentController> {

    public ResponseObject<CancelPaymentResponse> cancelPayment(ResponseObject<CancelPaymentResponse> result, PisPaymentCancellationRequest request) {
        if (!result.hasError()) {
            CancelPaymentResponse response = result.getBody();

            boolean isScaRequired = cancellationScaNeededDecider.isScaRequired(response.isStartAuthorisationRequired());
            if (isStartAuthorisationLinksNeeded(isScaRequired, response.getTransactionStatus())) {

                // in payment cancellation case 'multilevelScaRequired' is always false
                boolean isExplicitMethod = authorisationMethodDecider.isExplicitMethod(request.getTppExplicitAuthorisationPreferred(), false);
                response.setLinks(new PaymentCancellationLinks(getHttpUrl(), scaApproachResolver, redirectLinkBuilder,
                                                               redirectIdService, response, isExplicitMethod, getScaRedirectFlow(),
                                                               isAuthorisationConfirmationRequestMandated(),
                                                               requestProviderService.getInstanceId()));
            }

        }
        return result;
    }

    @Autowired public  PaymentCancellationAspectService(PaymentCancellationAuthorisationNeededDecider cancellationScaNeededDecider,
                                            AspspProfileServiceWrapper aspspProfileServiceWrapper,
                                            ScaApproachResolver scaApproachResolver,
                                            RedirectLinkBuilder redirectLinkBuilder,
                                            AuthorisationMethodDecider authorisationMethodDecider,
                                            RedirectIdService redirectIdService,
                                            RequestProviderService requestProviderService);

}