use of net.petafuel.styx.core.xs2a.standards.berlingroup.v1_2.http.ReadTransactionsRequest in project styx by petafuel.
the class STYX06 method apply.
@Override
public boolean apply(XS2AFactoryInput xs2AFactoryInput, XS2ARequest xs2ARequest, XS2AResponse xs2AResponse) throws ImplementerOptionException {
Boolean optionRequired = ioParser.getOption(IO, IOParser.Option.REQUIRED);
// return immediately if this options is not required
if (optionRequired == null || !optionRequired || !(xs2ARequest instanceof ReadTransactionsRequest)) {
return false;
}
ReadTransactionsRequest request = (ReadTransactionsRequest) xs2ARequest;
request.setXml(true);
return true;
}
use of net.petafuel.styx.core.xs2a.standards.berlingroup.v1_2.http.ReadTransactionsRequest in project styx by petafuel.
the class BerlinGroupAIS method getTransactionsByAccount.
@Override
public TransactionContainer getTransactionsByAccount(AISRequest request) throws BankRequestFailedException {
this.setUrl(this.url + request.getServicePath() + this.getHttpQueryString(request));
boolean isXmlRequest = false;
if (request instanceof ReadTransactionsRequest && ((ReadTransactionsRequest) request).isXml()) {
isXmlRequest = true;
request.addHeader(XS2AHeader.ACCEPT, "application/xml");
}
this.createBody(RequestType.GET);
this.createHeaders(request);
try (Response response = this.execute();
Jsonb jsonb = JsonbBuilder.create()) {
String responseBody = extractResponseBody(response, 200);
if (isXmlRequest) {
Camt052Converter converter = new Camt052Converter();
return converter.processReport(responseBody);
}
return jsonb.fromJson(responseBody, TransactionContainer.class);
} catch (Exception e) {
throw new BankRequestFailedException(e.getMessage(), e);
}
}
Aggregations