class PaymentAuthorisationAspectService extends BaseAspectService<PaymentController> {

    public ResponseObject<AuthorisationResponse> createPisAuthorizationAspect(ResponseObject<AuthorisationResponse> result,
                                                                              Xs2aCreatePisAuthorisationRequest request) {
        if (!result.hasError()) {
            if (result.getBody() instanceof Xs2aCreatePisAuthorisationResponse) {
                Xs2aCreatePisAuthorisationResponse response = (Xs2aCreatePisAuthorisationResponse) result.getBody();

                response.setLinks(new CreatePisAuthorisationLinks(getHttpUrl(), scaApproachResolver, redirectLinkBuilder,
                                                                  redirectIdService, request, response.getAuthorisationId(),
                                                                  getScaRedirectFlow(), response.getInternalRequestId(),
                                                                  isAuthorisationConfirmationRequestMandated(),
                                                                  requestProviderService.getInstanceId()));
            } else if (result.getBody() instanceof Xs2aUpdatePisCommonPaymentPsuDataResponse) {
                Xs2aUpdatePisCommonPaymentPsuDataResponse response = (Xs2aUpdatePisCommonPaymentPsuDataResponse) result.getBody();
                response.setLinks(new UpdatePisAuthorisationLinks(getHttpUrl(), scaApproachResolver, response, request));
            }
        }
        return result;
    }

    @Autowired public  PaymentAuthorisationAspectService(ScaApproachResolver scaApproachResolver,
                                             AspspProfileServiceWrapper aspspProfileServiceWrapper, RedirectLinkBuilder redirectLinkBuilder,
                                             RedirectIdService redirectIdService, RequestProviderService requestProviderService);

}