Class Xs2aAisConsentService


  • @Service
    public class Xs2aAisConsentService
    extends Object
    • Constructor Detail

      • Xs2aAisConsentService

        public Xs2aAisConsentService()
    • Method Detail

      • createConsent

        public Optional<Xs2aCreateAisConsentResponse> createConsent​(CreateConsentReq request,
                                                                    de.adorsys.psd2.xs2a.core.psu.PsuIdData psuData,
                                                                    de.adorsys.psd2.xs2a.core.tpp.TppInfo tppInfo)
        Sends a POST request to CMS to store created AIS consent
        Parameters:
        request - Request body storing main consent details
        psuData - PsuIdData container of authorisation data about PSU
        tppInfo - Information about particular TPP from TPP Certificate
        Returns:
        create consent response, containing consent and its encrypted ID
      • getAccountConsentById

        public Optional<de.adorsys.psd2.core.data.ais.AisConsent> getAccountConsentById​(String consentId)
        Requests CMS to retrieve AIS consent by its identifier
        Parameters:
        consentId - String representation of identifier of stored consent
        Returns:
        Response containing AIS Consent
      • findAndTerminateOldConsentsByNewConsentId

        public boolean findAndTerminateOldConsentsByNewConsentId​(String newConsentId)
        Requests CMS to find old consents for current TPP and PSU and terminate them.
        Parameters:
        newConsentId - id of new consent
        Returns:
        true if any consents have been terminated, false - if none
      • updateConsentStatus

        public void updateConsentStatus​(String consentId,
                                        de.adorsys.psd2.xs2a.core.consent.ConsentStatus consentStatus)
        Requests CMS to update consent status into provided one
        Parameters:
        consentId - String representation of identifier of stored consent
        consentStatus - ConsentStatus the consent be changed to
      • consentActionLog

        public void consentActionLog​(String tppId,
                                     String consentId,
                                     de.adorsys.psd2.consent.api.ActionStatus actionStatus,
                                     String requestUri,
                                     boolean updateUsage,
                                     String resourceId,
                                     String transactionId)
        Sends a POST request to CMS to perform decrement of consent usages and report status of the operation held with certain AIS consent
        Parameters:
        tppId - String representation of TPP`s identifier from TPP Certificate
        consentId - String representation of identifier of stored consent
        actionStatus - Enum value representing whether the action is successful or errors occurred
        requestUri - target URL of the request
        updateUsage - Update usage indicator
        resourceId - The identification that denotes the addressed account
        transactionId - String representation of ASPSP transaction primary identifier
      • createAisConsentAuthorization

        public Optional<de.adorsys.psd2.consent.api.authorisation.CreateAuthorisationResponse> createAisConsentAuthorization​(String consentId,
                                                                                                                             de.adorsys.psd2.xs2a.core.sca.ScaStatus scaStatus,
                                                                                                                             de.adorsys.psd2.xs2a.core.psu.PsuIdData psuData)
        Sends a POST request to CMS to store created consent authorisation
        Parameters:
        consentId - String representation of identifier of stored consent
        scaStatus - Enum for status of the SCA method applied
        psuData - authorisation data about PSU
        Returns:
        CreateAisConsentAuthorizationResponse object with authorisation ID and scaStatus
      • getAccountConsentAuthorizationById

        public Optional<de.adorsys.psd2.xs2a.core.authorisation.Authorisation> getAccountConsentAuthorizationById​(String authorizationId)
        Requests CMS to retrieve AIS consent authorisation by its identifier
        Parameters:
        authorizationId - String representation of identifier of stored consent authorisation
        Returns:
        Response containing AIS Consent Authorisation
      • updateConsentAuthorization

        public void updateConsentAuthorization​(UpdateConsentPsuDataReq updatePsuData)
        Sends a PUT request to CMS to update created AIS consent authorisation
        Parameters:
        updatePsuData - Consent PSU data
      • updateConsentAuthorisationStatus

        public void updateConsentAuthorisationStatus​(String authorisationId,
                                                     de.adorsys.psd2.xs2a.core.sca.ScaStatus scaStatus)
        Sends a PUT request to CMS to update status in consent authorisation
        Parameters:
        authorisationId - String representation of authorisation identifier
        scaStatus - Enum for status of the SCA method applied
      • updateAspspAccountAccess

        public de.adorsys.psd2.consent.api.CmsResponse<de.adorsys.psd2.core.data.ais.AisConsent> updateAspspAccountAccess​(String consentId,
                                                                                                                          de.adorsys.psd2.core.data.AccountAccess accountAccess)
        Sends a PUT request to CMS to update AIS account access information by consent ID
        Parameters:
        consentId - consentId String representation of identifier of stored consent
        accountAccess - AIS account access information
        Returns:
        Response containing AIS Consent
      • getAuthorisationSubResources

        public Optional<List<String>> getAuthorisationSubResources​(String consentId)
        Requests CMS to retrieve AIS consent authorisation IDs by consent ID
        Parameters:
        consentId - String representation of identifier of stored consent
        Returns:
        list of consent authorisation IDs
      • getAuthorisationScaStatus

        public Optional<de.adorsys.psd2.xs2a.core.sca.ScaStatus> getAuthorisationScaStatus​(String consentId,
                                                                                           String authorisationId)
        Requests CMS to retrieve SCA status of AIS consent authorisation
        Parameters:
        consentId - String representation of consent identifier
        authorisationId - String representation of authorisation identifier
        Returns:
        SCA status of the authorisation
      • isAuthenticationMethodDecoupled

        public boolean isAuthenticationMethodDecoupled​(String authorisationId,
                                                       String authenticationMethodId)
        Requests CMS to retrieve authentication method and checks if requested authentication method is decoupled.
        Parameters:
        authorisationId - String representation of the authorisation identifier
        authenticationMethodId - String representation of the available authentication method identifier
        Returns:
        true, if authentication method is decoupled and false otherwise.
      • saveAuthenticationMethods

        public boolean saveAuthenticationMethods​(String authorisationId,
                                                 List<de.adorsys.psd2.xs2a.core.authorisation.AuthenticationObject> methods)
        Saves authentication methods in provided authorisation
        Parameters:
        authorisationId - String representation of the authorisation identifier
        methods - List of authentication methods to be saved
        Returns:
        true if authorisation was found and updated, false otherwise
      • updateScaApproach

        public void updateScaApproach​(String authorisationId,
                                      de.adorsys.psd2.xs2a.core.profile.ScaApproach scaApproach)
        Updates AIS SCA approach in authorisation
        Parameters:
        authorisationId - String representation of the authorisation identifier
        scaApproach - Chosen SCA approach
      • updateMultilevelScaRequired

        public void updateMultilevelScaRequired​(String consentId,
                                                boolean multilevelScaRequired)
        Updates multilevel SCA required field
        Parameters:
        consentId - String representation of the consent identifier
        multilevelScaRequired - multilevel SCA required indicator
      • getAuthorisationScaApproach

        public Optional<de.adorsys.psd2.xs2a.core.sca.AuthorisationScaApproachResponse> getAuthorisationScaApproach​(String authorisationId)
        Gets SCA approach from the authorisation
        Parameters:
        authorisationId - String representation of the authorisation identifier
        Returns:
        SCA approach