Search in sources :

Example 1 with CustomerInfoConsentDetails

use of com.forgerock.openbanking.common.model.rcs.consentdetails.CustomerInfoConsentDetails in project openbanking-aspsp by OpenBankingToolkit.

the class RCSCustomerInfoDetailsApiTest method shouldReturnCustomerInfoDetails.

@Test
public void shouldReturnCustomerInfoDetails() throws OBErrorException {
    FRAccountAccessConsent frAccountAccessConsent = JMockData.mock(FRAccountAccessConsent.class);
    frAccountAccessConsent.setConsentId(IntentType.CUSTOMER_INFO_CONSENT.generateIntentId());
    FRCustomerInfo customerInfo = JMockData.mock(FRCustomerInfo.class);
    given(tppStoreService.findById(frAccountAccessConsent.getAispId())).willReturn(Optional.of(Tpp.builder().clientId(frAccountAccessConsent.getClientId()).build()));
    given(accountRequestStoreService.get(any())).willReturn(Optional.ofNullable(frAccountAccessConsent));
    given(customerInfoRepository.findByUserID(any())).willReturn(customerInfo);
    ResponseEntity<CustomerInfoConsentDetails> response = api.consentDetails("asdfas", Collections.EMPTY_LIST, frAccountAccessConsent.getUserId(), frAccountAccessConsent.getConsentId(), frAccountAccessConsent.getClientId());
    CustomerInfoConsentDetails details = response.getBody();
    assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
    assertThat(details.getCustomerInfo()).isNotNull();
}
Also used : FRAccountAccessConsent(com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountAccessConsent) CustomerInfoConsentDetails(com.forgerock.openbanking.common.model.rcs.consentdetails.CustomerInfoConsentDetails) FRCustomerInfo(com.forgerock.openbanking.common.model.data.FRCustomerInfo) Test(org.junit.Test)

Aggregations

FRCustomerInfo (com.forgerock.openbanking.common.model.data.FRCustomerInfo)1 FRAccountAccessConsent (com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountAccessConsent)1 CustomerInfoConsentDetails (com.forgerock.openbanking.common.model.rcs.consentdetails.CustomerInfoConsentDetails)1 Test (org.junit.Test)1