From c73bf8e6833a3bbc931bcccd1acfadad53590dd2 Mon Sep 17 00:00:00 2001 From: Lukas Hruby Date: Mon, 10 Jul 2017 16:20:28 +0200 Subject: [PATCH 1/5] fix build --- pom.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 985e1ff..3aba308 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ cz.hrubysoftware fio-java - 0.1.1-SNAPSHOT + 0.1.4 ${project.artifactId} Fio Bank Java Client @@ -29,6 +29,12 @@ Martin Caslavsky + + Novotass + + + Lukas Hruby + @@ -149,7 +155,7 @@ analyze-only - true + false true org.apache.httpcomponents:httpcore From 1d9376597d041fdaf4b5e769ab81c8bd98764148 Mon Sep 17 00:00:00 2001 From: Jiri Kapoun Date: Wed, 7 Aug 2019 23:14:05 +0200 Subject: [PATCH 2/5] upgraded to JDK 8, replaced org.joda.time with java.time --- README.md | 6 +++--- pom.xml | 20 ++++++++++++------- src/main/java/cz/geek/fio/FioAccountInfo.java | 2 +- src/main/java/cz/geek/fio/FioClient.java | 13 ++++++------ .../cz/geek/fio/FioConversionService.java | 4 ++-- src/main/java/cz/geek/fio/FioTransaction.java | 2 +- src/test/java/cz/geek/fio/FioClientIT.java | 8 ++++---- .../java/cz/geek/fio/FioExtractorTest.java | 4 ++-- 8 files changed, 32 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index ea64386..bba9031 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ FioAccountStatement statement = fio.getStatement(2016, 1); Get account statement within **the given period**: ```java -FioAccountStatement statement = fio.getStatement(new LocalDate(2016, 1, 1), new LocalDate(2016, 1, 31)); +FioAccountStatement statement = fio.getStatement(LocalDate.of(2016, 1, 1), LocalDate.of(2016, 1, 31)); ``` Get account statement from the **last download**: @@ -45,7 +45,7 @@ fio.getStatement(2016, 1, ExportFormat.pdf, outputStream); Export account statement within **the given period**: ```java -fio.getStatement(new LocalDate(2016, 1, 1), new LocalDate(2016, 1, 31), ExportFormat.pdf, outputStream); +fio.getStatement(LocalDate.of(2016, 1, 1), LocalDate.of(2016, 1, 31), ExportFormat.pdf, outputStream); ``` Export account statement from the **last download**: @@ -57,7 +57,7 @@ fio.getStatement(ExportFormat.pdf, outputStream); Set last downloaded statement **by date**: ```java -fio.setLast(new LocalDate(2016, 1, 1)); +fio.setLast(LocalDate.of(2016, 1, 1)); ``` Set last downloaded statement **by transaction id**: diff --git a/pom.xml b/pom.xml index 3aba308..87c9bd2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ cz.hrubysoftware fio-java - 0.1.4 + 0.2.0 ${project.artifactId} Fio Bank Java Client @@ -35,10 +35,13 @@ Lukas Hruby + + Jiri Kapoun + - 1.7 + 1.8 UTF-8 UTF-8 4.3.3 @@ -175,6 +178,14 @@ true + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + @@ -227,11 +238,6 @@ - - joda-time - joda-time - 2.7 - commons-io diff --git a/src/main/java/cz/geek/fio/FioAccountInfo.java b/src/main/java/cz/geek/fio/FioAccountInfo.java index e39ac4f..078d930 100644 --- a/src/main/java/cz/geek/fio/FioAccountInfo.java +++ b/src/main/java/cz/geek/fio/FioAccountInfo.java @@ -1,6 +1,6 @@ package cz.geek.fio; -import org.joda.time.LocalDate; +import java.time.LocalDate; import java.math.BigDecimal; import java.math.BigInteger; diff --git a/src/main/java/cz/geek/fio/FioClient.java b/src/main/java/cz/geek/fio/FioClient.java index 7192812..84b9953 100644 --- a/src/main/java/cz/geek/fio/FioClient.java +++ b/src/main/java/cz/geek/fio/FioClient.java @@ -4,9 +4,8 @@ import org.apache.http.client.config.RequestConfig; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.joda.time.LocalDate; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.web.client.RestTemplate; @@ -32,7 +31,7 @@ public class FioClient { private static final String LAST_DATE = ROOT + "set-last-date/{token}/{date}/"; private static final String LAST_ID = ROOT + "set-last-id/{token}/{id}/"; - private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd"); + private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); private final String token; private final String protocol; @@ -105,7 +104,7 @@ public FioAccountStatement getStatement(final LocalDate start, final LocalDate e notNull(end); return restTemplate.execute(STATEMENT_PERIODS, GET, null, statementExtractor(jaxb2Converter, conversionService), - protocol, hostport, token, DATE_FORMATTER.print(start), DATE_FORMATTER.print(end), ExportFormat.xml); + protocol, hostport, token, DATE_FORMATTER.format(start), DATE_FORMATTER.format(end), ExportFormat.xml); } /** @@ -121,7 +120,7 @@ public void exportStatement(final LocalDate start, final LocalDate end, final Ex notNull(end); notNull(format); restTemplate.execute(STATEMENT_PERIODS, GET, null, new OutputStreamResponseExtractor(target), - protocol, hostport, token, DATE_FORMATTER.print(start), DATE_FORMATTER.print(end), format); + protocol, hostport, token, DATE_FORMATTER.format(start), DATE_FORMATTER.format(end), format); } /** @@ -203,7 +202,7 @@ public void setLast(final String id) { public void setLast(final LocalDate date) { notNull(date); restTemplate.execute(LAST_DATE, GET, null, null, - protocol, hostport, token, DATE_FORMATTER.print(date)); + protocol, hostport, token, DATE_FORMATTER.format(date)); } } diff --git a/src/main/java/cz/geek/fio/FioConversionService.java b/src/main/java/cz/geek/fio/FioConversionService.java index bb0aa22..37862e9 100644 --- a/src/main/java/cz/geek/fio/FioConversionService.java +++ b/src/main/java/cz/geek/fio/FioConversionService.java @@ -4,7 +4,7 @@ import cz.geek.fio.model.Info; import cz.geek.fio.model.Transaction; import cz.geek.fio.model.TransactionList; -import org.joda.time.LocalDate; +import java.time.LocalDate; import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.support.GenericConversionService; @@ -127,7 +127,7 @@ public List convert(final TransactionList source) { } private static LocalDate toLocalDate(final XMLGregorianCalendar date) { - return date != null ? new LocalDate(date.getYear(), date.getMonth(), date.getDay()) : null; + return date != null ? LocalDate.of(date.getYear(), date.getMonth(), date.getDay()) : null; } } diff --git a/src/main/java/cz/geek/fio/FioTransaction.java b/src/main/java/cz/geek/fio/FioTransaction.java index ddde838..2baffa0 100644 --- a/src/main/java/cz/geek/fio/FioTransaction.java +++ b/src/main/java/cz/geek/fio/FioTransaction.java @@ -1,7 +1,7 @@ package cz.geek.fio; import lombok.Data; -import org.joda.time.LocalDate; +import java.time.LocalDate; import java.math.BigDecimal; import java.math.BigInteger; diff --git a/src/test/java/cz/geek/fio/FioClientIT.java b/src/test/java/cz/geek/fio/FioClientIT.java index 3dde35e..7a98895 100644 --- a/src/test/java/cz/geek/fio/FioClientIT.java +++ b/src/test/java/cz/geek/fio/FioClientIT.java @@ -1,6 +1,6 @@ package cz.geek.fio; -import org.joda.time.LocalDate; +import java.time.LocalDate; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -61,7 +61,7 @@ public void shouldExportTransactionsByDate() throws Exception { .withContentType("text/xml") .withStatus(200); - fio.exportStatement(new LocalDate(2016, 1, 1), new LocalDate(2016, 1, 2), ExportFormat.xml, new ByteArrayOutputStream()); + fio.exportStatement(LocalDate.of(2016, 1, 1), LocalDate.of(2016, 1, 2), ExportFormat.xml, new ByteArrayOutputStream()); } @Test @@ -74,7 +74,7 @@ public void shouldGetTransactionsByDate() throws Exception { .withContentType("text/xml") .withStatus(200); - FioAccountStatement fioAS = fio.getStatement(new LocalDate(2016, 1, 1), new LocalDate(2016, 1, 2)); + FioAccountStatement fioAS = fio.getStatement(LocalDate.of(2016, 1, 1), LocalDate.of(2016, 1, 2)); } @Test @@ -122,7 +122,7 @@ public void shouldSetLastDate() throws Exception { .respond() .withStatus(200); - fio.setLast(new LocalDate(2016, 1, 2)); + fio.setLast(LocalDate.of(2016, 1, 2)); } @AfterMethod diff --git a/src/test/java/cz/geek/fio/FioExtractorTest.java b/src/test/java/cz/geek/fio/FioExtractorTest.java index 5d4adb1..c663bef 100644 --- a/src/test/java/cz/geek/fio/FioExtractorTest.java +++ b/src/test/java/cz/geek/fio/FioExtractorTest.java @@ -1,6 +1,6 @@ package cz.geek.fio; -import org.joda.time.LocalDate; +import java.time.LocalDate; import org.springframework.http.HttpHeaders; import org.springframework.http.client.AbstractClientHttpResponse; import org.testng.annotations.Test; @@ -29,7 +29,7 @@ public void shouldName() throws Exception { assertThat(statement.getTransactions(), hasSize(2)); final FioTransaction transaction = statement.getTransactions().iterator().next(); assertThat(transaction.getTransactionId(), is("1147301403")); - assertThat(transaction.getDate(), is(new LocalDate(2012, 6, 30))); + assertThat(transaction.getDate(), is(LocalDate.of(2012, 6, 30))); } static class FakeClientHttpResponse extends AbstractClientHttpResponse { From bc920cbac493f77a03a994db90ad6cb8091e3b7a Mon Sep 17 00:00:00 2001 From: Jiri Kapoun Date: Wed, 7 Aug 2019 23:26:14 +0200 Subject: [PATCH 3/5] updated readme --- README.md | 13 ++++++++++--- pom.xml | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bba9031..c6b3c6e 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,20 @@ A Java SDK for accessing the [REST API](http://www.fio.cz/bank-services/internet ## Usage -The *Fio Bank Java Client* is available in Maven Central Repository, to use it from Maven add to `pom.xml`: +The *Fio Bank Java Client* is available in [JitPack](https://jitpack.io/) Maven repository, to use it from Maven add to `pom.xml`: + +```xml + + jitpack.io + https://jitpack.io + +``` ```xml - cz.geek + com.github.kapoun fio-java - 0.1.0 + fio-java-0.2.0 ``` diff --git a/pom.xml b/pom.xml index 87c9bd2..2660172 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ cz.hrubysoftware fio-java - 0.2.0 + 0.2.1-SNAPSHOT ${project.artifactId} Fio Bank Java Client From 5f9f4eda3717e613533c1604056382b03c147495 Mon Sep 17 00:00:00 2001 From: Jiri Kapoun Date: Sat, 4 Jan 2020 19:11:55 +0100 Subject: [PATCH 4/5] adjusted license --- LICENSE.txt => LICENSE | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) rename LICENSE.txt => LICENSE (96%) diff --git a/LICENSE.txt b/LICENSE similarity index 96% rename from LICENSE.txt rename to LICENSE index 5970d2f..593d3d1 100644 --- a/LICENSE.txt +++ b/LICENSE @@ -1,8 +1,7 @@ -Fio Bank Java Client - -BSD License +BSD 3-Clause License Copyright (c) 2016, Martin Caslavsky +Copyright (c) 2020, Jiri Kapoun Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: From 886c0bf121f53239d409ede6cb29b68f2c0db4f3 Mon Sep 17 00:00:00 2001 From: Jiri Kapoun Date: Mon, 21 Jun 2021 01:54:59 +0200 Subject: [PATCH 5/5] upgraded Spring version --- pom.xml | 4 ++-- src/main/java/cz/geek/fio/FioErrorHandler.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 2660172..d32196a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ cz.hrubysoftware fio-java - 0.2.1-SNAPSHOT + 0.2.1 ${project.artifactId} Fio Bank Java Client @@ -45,7 +45,7 @@ UTF-8 UTF-8 4.3.3 - 3.2.13.RELEASE + 5.1.5.RELEASE 1.1.1 1.5.3 diff --git a/src/main/java/cz/geek/fio/FioErrorHandler.java b/src/main/java/cz/geek/fio/FioErrorHandler.java index 5ce3cdd..6a3eac3 100644 --- a/src/main/java/cz/geek/fio/FioErrorHandler.java +++ b/src/main/java/cz/geek/fio/FioErrorHandler.java @@ -24,7 +24,7 @@ public void handleError(final ClientHttpResponse response) throws IOException { } } - private byte[] getResponseBody(final ClientHttpResponse response) { + protected byte[] getResponseBody(final ClientHttpResponse response) { try { final InputStream responseBody = response.getBody(); if (responseBody != null) { @@ -36,10 +36,10 @@ private byte[] getResponseBody(final ClientHttpResponse response) { return new byte[0]; } - private Charset getCharset(final ClientHttpResponse response) { + protected Charset getCharset(final ClientHttpResponse response) { final HttpHeaders headers = response.getHeaders(); final MediaType contentType = headers.getContentType(); - return contentType != null ? contentType.getCharSet() : Charset.forName("ISO-8859-1"); + return contentType != null ? contentType.getCharset() : Charset.forName("ISO-8859-1"); } }