Search in sources :

Example 16 with FRAccountIdentifier

use of com.forgerock.openbanking.common.model.openbanking.domain.common.FRAccountIdentifier in project openbanking-aspsp by OpenBankingToolkit.

the class FRAccountIdentifierConverterTest method FRAccountIdentifier_toOBFundsConfirmationConsent1DataDebtorAccount.

@Test
public void FRAccountIdentifier_toOBFundsConfirmationConsent1DataDebtorAccount() {
    // Given
    FRAccountIdentifier accountIdentifier = new FRAccountIdentifier();
    accountIdentifier.setName(this.name);
    accountIdentifier.setIdentification(this.identification);
    accountIdentifier.setSchemeName(this.schemeName);
    accountIdentifier.setSecondaryIdentification(this.secondaryIdentification);
    // When
    OBFundsConfirmationConsent1DataDebtorAccount account = toOBFundsConfirmationConsent1DataDebtorAccount(accountIdentifier);
    // Then
    assertThat(account.getName()).isEqualTo(this.name);
    assertThat(account.getIdentification()).isEqualTo(this.identification);
    assertThat(account.getSchemeName()).isEqualTo(this.schemeName);
    assertThat(account.getSecondaryIdentification()).isEqualTo(this.secondaryIdentification);
}
Also used : FRAccountIdentifier(com.forgerock.openbanking.common.model.openbanking.domain.common.FRAccountIdentifier) FRAccountIdentifierConverter.toFRAccountIdentifier(com.forgerock.openbanking.common.services.openbanking.converter.common.FRAccountIdentifierConverter.toFRAccountIdentifier) OBFundsConfirmationConsent1DataDebtorAccount(uk.org.openbanking.datamodel.fund.OBFundsConfirmationConsent1DataDebtorAccount) FRAccountIdentifierConverter.toOBFundsConfirmationConsent1DataDebtorAccount(com.forgerock.openbanking.common.services.openbanking.converter.common.FRAccountIdentifierConverter.toOBFundsConfirmationConsent1DataDebtorAccount) Test(org.junit.Test)

Example 17 with FRAccountIdentifier

use of com.forgerock.openbanking.common.model.openbanking.domain.common.FRAccountIdentifier in project openbanking-aspsp by OpenBankingToolkit.

the class FRAccountRepositoryImpl method filterAccount.

private void filterAccount(FRAccount account, List<FRExternalPermissionsCode> permissions) {
    for (FRExternalPermissionsCode permission : permissions) {
        switch(permission) {
            case READACCOUNTSBASIC:
                account.getAccount().setAccounts(null);
                account.getAccount().setServicer(null);
                break;
            case READACCOUNTSDETAIL:
                if (!CollectionUtils.isEmpty(account.getAccount().getAccounts())) {
                    for (FRAccountIdentifier subAccount : account.getAccount().getAccounts()) {
                        if (!permissions.contains(FRExternalPermissionsCode.READPAN) && OBExternalAccountIdentification3Code.PAN.toString().equals(subAccount.getSchemeName())) {
                            subAccount.setIdentification("xxx");
                        }
                    }
                }
                break;
        }
    }
}
Also used : FRAccountIdentifier(com.forgerock.openbanking.common.model.openbanking.domain.common.FRAccountIdentifier) FRExternalPermissionsCode(com.forgerock.openbanking.common.model.openbanking.domain.account.common.FRExternalPermissionsCode)

Aggregations

FRAccountIdentifier (com.forgerock.openbanking.common.model.openbanking.domain.common.FRAccountIdentifier)17 Test (org.junit.Test)15 AccountWithBalance (com.forgerock.openbanking.common.model.openbanking.persistence.account.AccountWithBalance)11 ResponseEntity (org.springframework.http.ResponseEntity)11 FRInternationalConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalConsent)5 InternationalPaymentConsentDetails (com.forgerock.openbanking.common.model.rcs.consentdetails.InternationalPaymentConsentDetails)5 FRAccountIdentifierTestDataFactory.aValidFRAccountIdentifier (com.forgerock.openbanking.aspsp.rs.store.api.openbanking.testsupport.domain.FRAccountIdentifierTestDataFactory.aValidFRAccountIdentifier)2 FRInternationalScheduledConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalScheduledConsent)2 FRDomesticVRPConsent (com.forgerock.openbanking.common.model.openbanking.persistence.vrp.FRDomesticVRPConsent)2 InternationalSchedulePaymentConsentDetails (com.forgerock.openbanking.common.model.rcs.consentdetails.InternationalSchedulePaymentConsentDetails)2 FRAccountIdentifierConverter.toFRAccountIdentifier (com.forgerock.openbanking.common.services.openbanking.converter.common.FRAccountIdentifierConverter.toFRAccountIdentifier)2 FRAccountIdentifierConverter.toOBFundsConfirmationConsent1DataDebtorAccount (com.forgerock.openbanking.common.services.openbanking.converter.common.FRAccountIdentifierConverter.toOBFundsConfirmationConsent1DataDebtorAccount)2 SpringSecForTest (com.forgerock.openbanking.integration.test.support.SpringSecForTest)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 OBFundsConfirmationConsent1DataDebtorAccount (uk.org.openbanking.datamodel.fund.OBFundsConfirmationConsent1DataDebtorAccount)2 OBVRPFundsConfirmationRequestTestDataFactory.aValidOBVRPFundsConfirmationRequest (uk.org.openbanking.testsupport.vrp.OBVRPFundsConfirmationRequestTestDataFactory.aValidOBVRPFundsConfirmationRequest)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JodaModule (com.fasterxml.jackson.datatype.joda.JodaModule)1 FRExternalPermissionsCode (com.forgerock.openbanking.common.model.openbanking.domain.account.common.FRExternalPermissionsCode)1 FRFinancialAgent (com.forgerock.openbanking.common.model.openbanking.domain.common.FRFinancialAgent)1