Class Xs2aAisConsentService
- java.lang.Object
-
- de.adorsys.psd2.xs2a.service.consent.Xs2aAisConsentService
-
@Service public class Xs2aAisConsentService extends Object
-
-
Constructor Summary
Constructors Constructor Description Xs2aAisConsentService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsentActionLog(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 consentOptional<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 authorisationOptional<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 consentbooleanfindAndTerminateOldConsentsByNewConsentId(String newConsentId)Requests CMS to find old consents for current TPP and PSU and terminate them.Optional<de.adorsys.psd2.xs2a.core.authorisation.Authorisation>getAccountConsentAuthorizationById(String authorizationId)Requests CMS to retrieve AIS consent authorisation by its identifierOptional<de.adorsys.psd2.core.data.ais.AisConsent>getAccountConsentById(String consentId)Requests CMS to retrieve AIS consent by its identifierOptional<de.adorsys.psd2.xs2a.core.sca.AuthorisationScaApproachResponse>getAuthorisationScaApproach(String authorisationId)Gets SCA approach from the authorisationOptional<de.adorsys.psd2.xs2a.core.sca.ScaStatus>getAuthorisationScaStatus(String consentId, String authorisationId)Requests CMS to retrieve SCA status of AIS consent authorisationOptional<List<String>>getAuthorisationSubResources(String consentId)Requests CMS to retrieve AIS consent authorisation IDs by consent IDbooleanisAuthenticationMethodDecoupled(String authorisationId, String authenticationMethodId)Requests CMS to retrieve authentication method and checks if requested authentication method is decoupled.booleansaveAuthenticationMethods(String authorisationId, List<de.adorsys.psd2.xs2a.core.authorisation.AuthenticationObject> methods)Saves authentication methods in provided authorisationde.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 IDvoidupdateConsentAuthorisationStatus(String authorisationId, de.adorsys.psd2.xs2a.core.sca.ScaStatus scaStatus)Sends a PUT request to CMS to update status in consent authorisationvoidupdateConsentAuthorization(UpdateConsentPsuDataReq updatePsuData)Sends a PUT request to CMS to update created AIS consent authorisationvoidupdateConsentStatus(String consentId, de.adorsys.psd2.xs2a.core.consent.ConsentStatus consentStatus)Requests CMS to update consent status into provided onevoidupdateMultilevelScaRequired(String consentId, boolean multilevelScaRequired)Updates multilevel SCA required fieldvoidupdateScaApproach(String authorisationId, de.adorsys.psd2.xs2a.core.profile.ScaApproach scaApproach)Updates AIS SCA approach in authorisation
-
-
-
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 detailspsuData- PsuIdData container of authorisation data about PSUtppInfo- 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 consentconsentStatus- 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 CertificateconsentId- String representation of identifier of stored consentactionStatus- Enum value representing whether the action is successful or errors occurredrequestUri- target URL of the requestupdateUsage- Update usage indicatorresourceId- The identification that denotes the addressed accounttransactionId- 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 consentscaStatus- Enum for status of the SCA method appliedpsuData- 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 identifierscaStatus- 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 consentaccountAccess- 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 identifierauthorisationId- 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 identifierauthenticationMethodId- String representation of the available authentication method identifier- Returns:
true, if authentication method is decoupled andfalseotherwise.
-
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 identifiermethods- List of authentication methods to be saved- Returns:
trueif authorisation was found and updated,falseotherwise
-
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 identifierscaApproach- Chosen SCA approach
-
updateMultilevelScaRequired
public void updateMultilevelScaRequired(String consentId, boolean multilevelScaRequired)
Updates multilevel SCA required field- Parameters:
consentId- String representation of the consent identifiermultilevelScaRequired- 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
-
-