Search in sources :

Example 11 with FRUserData

use of com.forgerock.openbanking.common.model.data.FRUserData in project openbanking-aspsp by OpenBankingToolkit.

the class DataApiControllerIT method shouldReturnPayloadTooLargeWhenCreatingNewDataWithDataAlreadySaved.

@Test
public void shouldReturnPayloadTooLargeWhenCreatingNewDataWithDataAlreadySaved() throws Exception {
    // Given
    OBAccount6 account = new OBAccount6().accountId(UUID.randomUUID().toString());
    List<FRAccountData> accountDatas = Collections.singletonList(FRAccountData.builder().account(account).balances(Collections.singletonList(new OBCashBalance1().accountId(account.getAccountId()).type(OBBalanceType1Code.INTERIMAVAILABLE))).build());
    FRAccount savedAccount = frAccountRepository.save(FRAccount.builder().id(account.getAccountId()).userID(UUID.randomUUID().toString()).build());
    frBalanceRepository.save(FRBalance.builder().accountId(account.getAccountId()).build());
    FRUserData userData = new FRUserData();
    userData.setAccountDatas(accountDatas);
    userData.setUserName(savedAccount.getUserID());
    // When
    mockMvc.perform(post("/api/data/user").content(mapper.writeValueAsString(userData)).contentType("application/json")).andExpect(status().isPayloadTooLarge());
}
Also used : FRUserData(com.forgerock.openbanking.common.model.data.FRUserData) OBCashBalance1(uk.org.openbanking.datamodel.account.OBCashBalance1) FRAccount(com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccount) FRAccountData(com.forgerock.openbanking.common.model.data.FRAccountData) OBAccount6(uk.org.openbanking.datamodel.account.OBAccount6) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 12 with FRUserData

use of com.forgerock.openbanking.common.model.data.FRUserData in project openbanking-aspsp by OpenBankingToolkit.

the class UserDataService method createUserData.

public FRUserData createUserData(FRUserData userData) {
    LOGGER.debug("Create data for user {}", userData);
    HttpEntity request = new HttpEntity<>(userData, new HttpHeaders());
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(rsStoreRoot + "/api/data/user");
    URI uri = builder.build().encode().toUri();
    return restTemplate.exchange(uri, HttpMethod.POST, request, FRUserData.class).getBody();
}
Also used : FRUserData(com.forgerock.openbanking.common.model.data.FRUserData) HttpHeaders(org.springframework.http.HttpHeaders) HttpEntity(org.springframework.http.HttpEntity) UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) URI(java.net.URI)

Example 13 with FRUserData

use of com.forgerock.openbanking.common.model.data.FRUserData in project openbanking-aspsp by OpenBankingToolkit.

the class UserDataService method exportUserData.

public FRUserData exportUserData(String userId) {
    LOGGER.debug("Export data for user {}", userId);
    HttpEntity request = new HttpEntity<>(null, new HttpHeaders());
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(rsStoreRoot + "/api/data/user");
    builder.queryParam("userId", userId);
    URI uri = builder.build().encode().toUri();
    return restTemplate.exchange(uri, HttpMethod.GET, request, FRUserData.class).getBody();
}
Also used : FRUserData(com.forgerock.openbanking.common.model.data.FRUserData) HttpHeaders(org.springframework.http.HttpHeaders) HttpEntity(org.springframework.http.HttpEntity) UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) URI(java.net.URI)

Aggregations

FRUserData (com.forgerock.openbanking.common.model.data.FRUserData)13 FRAccountData (com.forgerock.openbanking.common.model.data.FRAccountData)6 Test (org.junit.Test)6 FRCustomerInfo (com.forgerock.openbanking.common.model.data.FRCustomerInfo)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 OBAccount6 (uk.org.openbanking.datamodel.account.OBAccount6)5 OBCashBalance1 (uk.org.openbanking.datamodel.account.OBCashBalance1)5 URI (java.net.URI)4 HttpEntity (org.springframework.http.HttpEntity)4 HttpHeaders (org.springframework.http.HttpHeaders)4 UriComponentsBuilder (org.springframework.web.util.UriComponentsBuilder)4 FRAccount (com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccount)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 FRAccountRepository (com.forgerock.openbanking.aspsp.rs.store.repository.accounts.accounts.FRAccountRepository)1 FRBalanceRepository (com.forgerock.openbanking.aspsp.rs.store.repository.accounts.balances.FRBalanceRepository)1 FRBeneficiaryRepository (com.forgerock.openbanking.aspsp.rs.store.repository.accounts.beneficiaries.FRBeneficiaryRepository)1 FRDirectDebitRepository (com.forgerock.openbanking.aspsp.rs.store.repository.accounts.directdebits.FRDirectDebitRepository)1 FROfferRepository (com.forgerock.openbanking.aspsp.rs.store.repository.accounts.offers.FROfferRepository)1 FRPartyRepository (com.forgerock.openbanking.aspsp.rs.store.repository.accounts.party.FRPartyRepository)1 FRProductRepository (com.forgerock.openbanking.aspsp.rs.store.repository.accounts.products.FRProductRepository)1