use of net.petafuel.styx.core.xs2a.utils.sepa.camt052.control.Camt052Converter in project styx by petafuel.
the class Camt052ParserUnitTest method test.
@Test
void test() throws SEPAParsingException, IOException {
String camt052Response = IOUtils.toString(getClass().getResourceAsStream("camt052.xml"), Charset.defaultCharset());
Camt052Converter converter = new Camt052Converter();
TransactionContainer transactionContainer = converter.processReport(camt052Response);
Assertions.assertNotNull(transactionContainer);
}
use of net.petafuel.styx.core.xs2a.utils.sepa.camt052.control.Camt052Converter 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