use of com.forgerock.openbanking.common.model.data.FRAccountData 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());
}
use of com.forgerock.openbanking.common.model.data.FRAccountData in project openbanking-aspsp by OpenBankingToolkit.
the class DataCreatorTest method createBalancesShouldAllowCreateWhenOnLimit.
@Test
public void createBalancesShouldAllowCreateWhenOnLimit() {
// Given
String accountId = "1";
OBCashBalance1 cashBalance = new OBCashBalance1().accountId(accountId).type(OBBalanceType1Code.INTERIMAVAILABLE);
FRAccountData accountData = new FRAccountData().addBalance(cashBalance);
accountData.setAccount(new OBAccount6().accountId(accountId));
given(balanceRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(999L);
// When
dataCreator.createBalances(accountData, Collections.singleton("1"));
// Then
ArgumentCaptor<List<FRBalance>> argumentCaptor = ArgumentCaptor.forClass(List.class);
verify(balanceRepository).saveAll(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().get(0).getAccountId()).isEqualTo(accountId);
}
use of com.forgerock.openbanking.common.model.data.FRAccountData in project openbanking-aspsp by OpenBankingToolkit.
the class DataCreatorTest method createStandingOrdersShouldAllowCreateWhenOnLimit.
@Test
public void createStandingOrdersShouldAllowCreateWhenOnLimit() {
// Given
String accountId = "1";
OBStandingOrder6 standingOrder = new OBStandingOrder6().accountId(accountId).standingOrderId("2");
FRAccountData accountData = new FRAccountData().addStandingOrder(standingOrder);
accountData.setAccount(new OBAccount6().accountId(accountId));
given(standingOrderRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(999L);
// When
dataCreator.createStandingOrders(accountData, Collections.singleton("1"));
// Then
ArgumentCaptor<List<FRStandingOrder>> argumentCaptor = ArgumentCaptor.forClass(List.class);
verify(standingOrderRepository).saveAll(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().get(0).getAccountId()).isEqualTo(accountId);
}
Aggregations