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:
diff --git a/README.md b/README.md
index ea64386..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
```
@@ -28,7 +35,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 +52,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 +64,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 985e1ff..d32196a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
cz.hrubysoftware
fio-java
- 0.1.1-SNAPSHOT
+ 0.2.1
${project.artifactId}
Fio Bank Java Client
@@ -29,14 +29,23 @@
Martin Caslavsky
+
+ Novotass
+
+
+ Lukas Hruby
+
+
+ Jiri Kapoun
+
- 1.7
+ 1.8
UTF-8
UTF-8
4.3.3
- 3.2.13.RELEASE
+ 5.1.5.RELEASE
1.1.1
1.5.3
@@ -149,7 +158,7 @@
analyze-only
- true
+ false
true
org.apache.httpcomponents:httpcore
@@ -169,6 +178,14 @@
true
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 8
+ 8
+
+
@@ -221,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/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");
}
}
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 {