Class Xs2aAisConsentService


  • @Service
    public class Xs2aAisConsentService
    extends Object
    • Constructor Detail

      • Xs2aAisConsentService

        public Xs2aAisConsentService()
    • Method Detail

      • createConsent

        public Xs2aResponse<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
      • findAndTerminateOldConsents

        public boolean findAndTerminateOldConsents​(String newConsentId,
                                                   de.adorsys.psd2.xs2a.core.consent.TerminateOldConsentsRequest request)
        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
      • updateConsentAuthorisation

        public void updateConsentAuthorisation​(UpdateConsentPsuDataReq updatePsuData)
        Sends a PUT request to CMS to update created AIS consent authorisation
        Parameters:
        updatePsuData - Consent PSU data
      • 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
      • 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