Search in sources :

Example 11 with FRCustomerInfo

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);
}
Also used : FRUserData(com.forgerock.openbanking.common.model.data.FRUserData) FRCustomerInfo(com.forgerock.openbanking.common.model.data.FRCustomerInfo)

Example 12 with FRCustomerInfo

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());
    }
}
Also used : ReadCustomerInfo(uk.org.openbanking.datamodel.customerinfo.ReadCustomerInfo) FRCustomerInfo(com.forgerock.openbanking.common.model.data.FRCustomerInfo) SpringSecForTest(com.forgerock.openbanking.integration.test.support.SpringSecForTest) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

FRCustomerInfo (com.forgerock.openbanking.common.model.data.FRCustomerInfo)12 Test (org.junit.Test)5 FRUserData (com.forgerock.openbanking.common.model.data.FRUserData)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 ReadCustomerInfo (uk.org.openbanking.datamodel.customerinfo.ReadCustomerInfo)3 FRAccountData (com.forgerock.openbanking.common.model.data.FRAccountData)2 FRAccountAccessConsent (com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountAccessConsent)2 SpringSecForTest (com.forgerock.openbanking.integration.test.support.SpringSecForTest)2 CustomerInfo (uk.org.openbanking.datamodel.customerinfo.CustomerInfo)2 FRCustomerInfoAddress (com.forgerock.openbanking.common.model.data.FRCustomerInfoAddress)1 FRFinancialAccount (com.forgerock.openbanking.common.model.openbanking.domain.account.FRFinancialAccount)1 FRPartyData (com.forgerock.openbanking.common.model.openbanking.domain.account.FRPartyData)1 AccountRequest (com.forgerock.openbanking.common.model.openbanking.persistence.account.AccountRequest)1 CustomerInfoConsentDetails (com.forgerock.openbanking.common.model.rcs.consentdetails.CustomerInfoConsentDetails)1 FRPartyConverter.toFRPartyData (com.forgerock.openbanking.common.services.openbanking.converter.account.FRPartyConverter.toFRPartyData)1 OBErrorException (com.forgerock.openbanking.exceptions.OBErrorException)1 Tpp (com.forgerock.openbanking.model.Tpp)1 DateTime (org.joda.time.DateTime)1 ResponseEntity (org.springframework.http.ResponseEntity)1 ResponseStatusException (org.springframework.web.server.ResponseStatusException)1