use of com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountRequest in project openbanking-aspsp by OpenBankingToolkit.
the class TransactionsApiControllerIT method mockAccountPermissions.
private void mockAccountPermissions(List<FRExternalPermissionsCode> permissions) {
FRAccountRequest value = new FRAccountRequest();
value.setAisp(tpp);
value.setAccountIds(Collections.singletonList("100000123"));
value.setAccountRequest(FRReadResponse.builder().data(FRReadDataResponse.builder().permissions(permissions).transactionFromDateTime(CONSENT_FROM).transactionToDateTime(CONSENT_TO).status(FRExternalRequestStatusCode.AUTHORISED).build()).build());
given(accountRequestStore.get(any())).willReturn(Optional.of(value));
}
use of com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountRequest in project openbanking-aspsp by OpenBankingToolkit.
the class InfoApiControllerIT method mockAccountPermissions.
private void mockAccountPermissions(List<FRExternalPermissionsCode> permissions) {
FRAccountRequest value = new FRAccountRequest();
Tpp tpp = new Tpp();
tpp.setClientId("test-tpp");
value.setAisp(tpp);
value.setAccountIds(Collections.singletonList("100000123"));
value.setAccountRequest(FRReadResponse.builder().data(FRReadDataResponse.builder().permissions(permissions).transactionFromDateTime(CONSENT_FROM).transactionToDateTime(CONSENT_TO).status(FRExternalRequestStatusCode.AUTHORISED).build()).build());
given(accountRequestStore.get(any())).willReturn(Optional.of(value));
}
use of com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountRequest in project openbanking-aspsp by OpenBankingToolkit.
the class AccountsApiEndpointWrapperTest method testMatls_failMatlsCheck.
@Test
public void testMatls_failMatlsCheck() {
// Given
String authorisatioNumber = "PSDGB-OB-2345343";
String clientId = "clientId";
FRAccountRequest accountRequest = new FRAccountRequest();
accountRequest.setClientId(clientId);
wrapper.accountRequest = accountRequest;
Collection<? extends GrantedAuthority> authorities = Collections.emptyList();
Authentication authentication = new X509Authentication(authorisatioNumber, authorities, null);
wrapper.principal = authentication;
Tpp tpp = new Tpp();
tpp.setAuthorisationNumber("PSDGB-OB-45434324");
given(this.tppStoreService.findByClientId(clientId)).willReturn(Optional.of(tpp));
// Then
OBErrorException exception = catchThrowableOfType(() -> wrapper.verifyMatlsFromAccountRequest(), OBErrorException.class);
assertThat(exception.getObriErrorType()).isEqualTo(MATLS_TPP_AUTHENTICATION_INVALID_FROM_ACCOUNT_REQUEST);
}
use of com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountRequest in project openbanking-aspsp by OpenBankingToolkit.
the class AccountsApiEndpointWrapperTest method testMatls_failOauth2RegistrationDeleted.
@Test
public void testMatls_failOauth2RegistrationDeleted() {
// Given
String authorisatioNumber = "PSDGB-OB-2345343";
String clientId = "clientId";
FRAccountRequest accountRequest = new FRAccountRequest();
accountRequest.setClientId(clientId);
wrapper.accountRequest = accountRequest;
Collection<? extends GrantedAuthority> authorities = Collections.emptyList();
Authentication authentication = new X509Authentication(authorisatioNumber, authorities, null);
wrapper.principal = authentication;
given(this.tppStoreService.findByClientId(clientId)).willReturn(Optional.empty());
// Then
OBErrorException exception = catchThrowableOfType(() -> wrapper.verifyMatlsFromAccountRequest(), OBErrorException.class);
assertThat(exception.getObriErrorType()).isEqualTo(MATLS_TPP_AUTHENTICATION_INVALID_FROM_ACCOUNT_REQUEST);
}
use of com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountRequest in project openbanking-aspsp by OpenBankingToolkit.
the class AccountRequestStoreServiceImpl method getAccountRequest.
private Optional<FRAccountRequest> getAccountRequest(String accountRequestId) {
ParameterizedTypeReference<Optional<FRAccountRequest>> ptr = new ParameterizedTypeReference<Optional<FRAccountRequest>>() {
};
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(rsStoreRoot + "/api/account-requests/" + accountRequestId);
URI uri = builder.build().encode().toUri();
return restTemplate.exchange(uri, HttpMethod.GET, null, ptr).getBody();
}
Aggregations