Skip to content

Commit 800bea8

Browse files
authored
Merge pull request #190 from XeroAPI/sid-development
pom.xml update
2 parents ca40b73 + c37067b commit 800bea8

251 files changed

Lines changed: 4565 additions & 882 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>xero-java</artifactId>
66
<packaging>jar</packaging>
77
<name>xero-java</name>
8-
<version>3.4.0</version>
8+
<version>3.5.0</version>
99
<url>https://github.com/XeroAPI/Xero-Java</url>
1010
<description>This is the official Java SDK for Xero API</description>
1111
<licenses>
@@ -87,6 +87,7 @@
8787
<artifactId>log4j-core</artifactId>
8888
<version>2.11.0</version>
8989
</dependency>
90+
9091
<!-- JSON processing: jackson -->
9192
<dependency>
9293
<groupId>com.fasterxml.jackson.core</groupId>
@@ -302,7 +303,7 @@
302303
<google-api-client-version>1.23.0</google-api-client-version>
303304
<jersey-common-version>2.25.1</jersey-common-version>
304305
<jackson-version>2.9.10</jackson-version>
305-
<jackson-databind-version>2.9.10.1</jackson-databind-version>
306+
<jackson-databind-version>2.9.10.3</jackson-databind-version>
306307
<jackson-threetenbp-version>2.6.4</jackson-threetenbp-version>
307308
<junit-version>4.12</junit-version>
308309
<org-apache-httpcomponents>4.5.3</org-apache-httpcomponents>

src/main/java/com/xero/api/StringUtil.java

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212

1313
package com.xero.api;
1414

15+
import java.io.IOException;
16+
import java.util.regex.Matcher;
17+
import java.util.regex.Pattern;
18+
19+
import org.threeten.bp.Instant;
20+
import org.threeten.bp.LocalDate;
21+
import org.threeten.bp.OffsetDateTime;
22+
import org.threeten.bp.ZoneId;
23+
1524
public class StringUtil {
1625
/**
1726
* Check if the given array contains the given value (with case-insensitive
@@ -61,4 +70,42 @@ public static String join(String[] array, String separator) {
6170
}
6271
return out.toString();
6372
}
73+
74+
public LocalDate convertStringToDate(String date)
75+
throws IOException {
76+
LocalDate formattedDate;
77+
Pattern datePatt = Pattern.compile("^/Date\\((\\d+)([+-]\\d+)?\\)/$");
78+
Pattern datePattNeg = Pattern.compile("^/Date\\(-(\\d+)([+-]\\d+)?\\)/$");
79+
Matcher m = datePatt.matcher(date);
80+
Matcher matchNeg = datePattNeg.matcher(date);
81+
if (m != null && m.matches()) {
82+
Long l = Long.parseLong(m.group(1));
83+
formattedDate = Instant.ofEpochMilli(l).atZone(ZoneId.systemDefault()).toLocalDate();
84+
} else if (matchNeg != null && matchNeg.matches()) {
85+
Long l = Long.parseLong(matchNeg.group(1));
86+
formattedDate = Instant.ofEpochMilli(-l).atZone(ZoneId.systemDefault()).toLocalDate();
87+
} else {
88+
throw new IllegalArgumentException("Wrong date format");
89+
}
90+
return formattedDate;
91+
}
92+
93+
public OffsetDateTime convertStringToOffsetDateTime(String date)
94+
throws IOException {
95+
OffsetDateTime formattedDate;
96+
Pattern datePatt = Pattern.compile("^/Date\\((\\d+)([+-]\\d+)?\\)/$");
97+
Matcher m = datePatt.matcher(date);
98+
Pattern datePattNeg = Pattern.compile("^/Date\\(-(\\d+)([+-]\\d+)?\\)/$");
99+
Matcher mNeg = datePattNeg.matcher(date);
100+
if (m != null && m.matches()) {
101+
Long l = Long.parseLong(m.group(1));
102+
formattedDate = Instant.ofEpochMilli(l).atZone(ZoneId.systemDefault()).toOffsetDateTime();
103+
} else if (mNeg != null && mNeg.matches()) {
104+
Long l = Long.parseLong(mNeg.group(1));
105+
formattedDate = Instant.ofEpochMilli(-l).atZone(ZoneId.systemDefault()).toOffsetDateTime();
106+
} else {
107+
throw new IllegalArgumentException("Wrong date format");
108+
}
109+
return formattedDate;
110+
}
64111
}

src/main/java/com/xero/api/client/AccountingApi.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.xero.models.accounting.Organisations;
3636
import com.xero.models.accounting.Overpayments;
3737
import com.xero.models.accounting.Payment;
38+
import com.xero.models.accounting.PaymentDelete;
3839
import com.xero.models.accounting.PaymentService;
3940
import com.xero.models.accounting.PaymentServices;
4041
import com.xero.models.accounting.Payments;
@@ -90,7 +91,7 @@ public class AccountingApi {
9091
private ApiClient apiClient;
9192
private static AccountingApi instance = null;
9293
private String userAgent = "Default";
93-
private String version = "3.4.0";
94+
private String version = "3.5.0";
9495

9596
public AccountingApi() {
9697
this(new ApiClient());
@@ -3974,15 +3975,15 @@ public HttpResponse deleteLinkedTransactionForHttpResponse(String accessToken,
39743975
* <p><b>400</b> - A failed request due to validation error
39753976
* @param xeroTenantId Xero identifier for Tenant
39763977
* @param paymentID Unique identifier for a Payment
3977-
* @param payments The payments parameter
3978+
* @param paymentDelete The paymentDelete parameter
39783979
* @param accessToken Authorization token for user set in header of each request
39793980
* @return Payments
39803981
* @throws IOException if an error occurs while attempting to invoke the API
39813982
**/
3982-
public Payments deletePayment(String accessToken, String xeroTenantId, UUID paymentID, Payments payments) throws IOException {
3983+
public Payments deletePayment(String accessToken, String xeroTenantId, UUID paymentID, PaymentDelete paymentDelete) throws IOException {
39833984
try {
39843985
TypeReference<Payments> typeRef = new TypeReference<Payments>() {};
3985-
HttpResponse response = deletePaymentForHttpResponse(accessToken, xeroTenantId, paymentID, payments);
3986+
HttpResponse response = deletePaymentForHttpResponse(accessToken, xeroTenantId, paymentID, paymentDelete);
39863987
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
39873988
} catch (HttpResponseException e) {
39883989
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
@@ -3993,16 +3994,16 @@ public Payments deletePayment(String accessToken, String xeroTenantId, UUID pay
39933994
return null;
39943995
}
39953996

3996-
public HttpResponse deletePaymentForHttpResponse(String accessToken, String xeroTenantId, UUID paymentID, Payments payments) throws IOException {
3997+
public HttpResponse deletePaymentForHttpResponse(String accessToken, String xeroTenantId, UUID paymentID, PaymentDelete paymentDelete) throws IOException {
39973998
// verify the required parameter 'xeroTenantId' is set
39983999
if (xeroTenantId == null) {
39994000
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling deletePayment");
40004001
}// verify the required parameter 'paymentID' is set
40014002
if (paymentID == null) {
40024003
throw new IllegalArgumentException("Missing the required parameter 'paymentID' when calling deletePayment");
4003-
}// verify the required parameter 'payments' is set
4004-
if (payments == null) {
4005-
throw new IllegalArgumentException("Missing the required parameter 'payments' when calling deletePayment");
4004+
}// verify the required parameter 'paymentDelete' is set
4005+
if (paymentDelete == null) {
4006+
throw new IllegalArgumentException("Missing the required parameter 'paymentDelete' when calling deletePayment");
40064007
}
40074008
if (accessToken == null) {
40084009
throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling deletePayment");
@@ -4024,7 +4025,7 @@ public HttpResponse deletePaymentForHttpResponse(String accessToken, String xer
40244025

40254026

40264027
HttpContent content = null;
4027-
content = apiClient.new JacksonJsonHttpContent(payments);
4028+
content = apiClient.new JacksonJsonHttpContent(paymentDelete);
40284029

40294030
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
40304031
HttpTransport transport = apiClient.getHttpTransport();

src/main/java/com/xero/api/client/AssetApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class AssetApi {
4444
private ApiClient apiClient;
4545
private static AssetApi instance = null;
4646
private String userAgent = "Default";
47-
private String version = "3.4.0";
47+
private String version = "3.5.0";
4848

4949
public AssetApi() {
5050
this(new ApiClient());

src/main/java/com/xero/api/client/BankFeedsApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class BankFeedsApi {
4545
private ApiClient apiClient;
4646
private static BankFeedsApi instance = null;
4747
private String userAgent = "Default";
48-
private String version = "3.4.0";
48+
private String version = "3.5.0";
4949

5050
public BankFeedsApi() {
5151
this(new ApiClient());

src/main/java/com/xero/api/client/IdentityApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class IdentityApi {
4141
private ApiClient apiClient;
4242
private static IdentityApi instance = null;
4343
private String userAgent = "Default";
44-
private String version = "3.4.0";
44+
private String version = "3.5.0";
4545

4646
public IdentityApi() {
4747
this(new ApiClient());

0 commit comments

Comments
 (0)