use of net.petafuel.styx.core.xs2a.entities.AccountAccess in project styx by petafuel.
the class ConsentResourcesTest method createConsentEndpoint.
Response createConsentEndpoint() {
Invocation.Builder invocationBuilder = getInvocationBuilder(String.format(POST_CONSENT, consentId));
POSTConsentRequest request = new POSTConsentRequest();
request.setAccess(new AccountAccess());
request.getAccess().setAccounts(new ArrayList<>());
request.getAccess().getAccounts().add(getAccountReference());
request.getAccess().setBalances(new ArrayList<>());
request.getAccess().getBalances().add(getAccountReference());
request.getAccess().setTransactions(new ArrayList<>());
request.getAccess().getTransactions().add(getAccountReference());
request.setRecurringIndicator(true);
Invocation invocation = invocationBuilder.buildPost(Entity.entity(request, MediaType.APPLICATION_JSON));
return invocation.invoke(Response.class);
}
use of net.petafuel.styx.core.xs2a.entities.AccountAccess in project styx by petafuel.
the class PersistentConsent method dbToModel.
/**
* Maps the query ResultSet to a consent model
*
* @param resultSet Result set of a selecting database function
* @return Mapped Consent from the database columns
* @throws SQLException If the expected database column is not available
*/
private Consent dbToModel(ResultSet resultSet) throws SQLException {
Consent consent = new Consent();
consent.setId(resultSet.getString("id"));
try (Jsonb jsonb = JsonbBuilder.create()) {
AccountAccess consentAccess = jsonb.fromJson(resultSet.getString("access"), AccountAccess.class);
consent.setAccess(consentAccess);
} catch (Exception e) {
throw new SerializerException(e.getMessage(), e);
}
consent.setRecurringIndicator(resultSet.getBoolean("recurring_indicator"));
consent.setLastAction(getDateFromTimestamp(resultSet.getTimestamp("last_action")));
consent.setValidUntil(getDateFromTimestamp(resultSet.getTimestamp("valid_until")));
consent.setLastUpdated(getDateFromTimestamp(resultSet.getTimestamp("last_updated")));
consent.setCreatedAt(getDateFromTimestamp(resultSet.getTimestamp("created_at")));
consent.setFrequencyPerDay(resultSet.getInt("frequency_per_day"));
consent.setState(ConsentStatus.getByString(resultSet.getString("state")));
consent.getSca().setApproach(SCA.Approach.valueOf(resultSet.getString("chosen_sca_method")));
consent.setCombinedServiceIndicator(resultSet.getBoolean("combined_service_indicator"));
consent.setxRequestId(UUID.fromString(resultSet.getString("x_request_id")));
PSU psu = new PSU(resultSet.getString("psu_id"));
psu.setIdType(resultSet.getString("psu_id_type"));
psu.setIp(resultSet.getString("psu_ip_address"));
psu.setPort(resultSet.getInt("psu_ip_port"));
psu.setUserAgent(resultSet.getString("psu_user_agent"));
psu.setGeoLocation(resultSet.getString("psu_geo_location"));
psu.setCorporateId(resultSet.getString("psu_corporate_id"));
psu.setCorporateIdType(resultSet.getString("psu_corporate_id_type"));
consent.setPsu(psu);
return consent;
}
Aggregations