use of com.forgerock.openbanking.common.model.data.FRCustomerInfo in project openbanking-aspsp by OpenBankingToolkit.
the class DataApiController method exportUserData.
@Override
public ResponseEntity<FRUserData> exportUserData(@RequestParam("userId") String userId) {
FRUserData userData = new FRUserData(userId);
for (FRAccount account : accountsRepository.findByUserID(userId)) {
userData.addAccountData(getAccount(account));
}
FRCustomerInfo customerInfo = customerInfoRepository.findByUserID(userId);
userData.setCustomerInfo(customerInfo);
FRParty byUserId = partyRepository.findByUserId(userId);
if (byUserId != null) {
userData.setParty(toOBParty2(byUserId.getParty()));
}
return ResponseEntity.ok(userData);
}
use of com.forgerock.openbanking.common.model.data.FRCustomerInfo in project openbanking-aspsp by OpenBankingToolkit.
the class InfoApiControllerIT method testGetCustomerInfo.
@Test
public void testGetCustomerInfo() throws UnirestException {
// Given
springSecForTest.mockAuthCollector.mockAuthorities(OBRIRole.ROLE_AISP);
FRCustomerInfo customerInfo = FRCustomerInfoTestHelper.aValidFRCustomerInfo();
FRCustomerInfo createdInfo = frCustomerInfoRepository.save(customerInfo);
try {
// When
HttpResponse<ReadCustomerInfo> response = Unirest.get("https://rs-store:" + port + "/customer-info/v1.0/info").header(OBHeaders.X_FAPI_FINANCIAL_ID, rsConfiguration.getFinancialId()).header(OBHeaders.AUTHORIZATION, "token").header("x-ob-psu-user-id", customerInfo.getUserID()).asObject(ReadCustomerInfo.class);
// Then
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
assertThat(response.getBody().getData()).isNotNull();
} finally {
frCustomerInfoRepository.deleteById(createdInfo.getId());
}
}
Aggregations