Skip to content

Commit 5f243a0

Browse files
authored
Merge pull request #207 from XeroAPI/sid-development
Unit test fixes
2 parents aaea61c + 89de7c1 commit 5f243a0

File tree

353 files changed

+3116
-714
lines changed

Some content is hidden

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

353 files changed

+3116
-714
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Version 4.x and higher of Xero Java SDK only supports OAuth2 authentication and
1010
* fixed asset
1111
* projects
1212
* payroll au
13-
* payroll uk - beta
13+
* payroll uk
1414

1515
Coming soon
1616
* payroll nz
@@ -178,7 +178,6 @@ try {
178178
We've replace a specific logging plugin (org.apache.logging.log4j) with a logging facade org.slf4j. With version 4.x we'll use SLF4J and allow you to plug in the logging library of your choice at deployment time. This [blog post](https://www.baeldung.com/slf4j-with-log4j2-logback) explains how to add log4j2 for logging. To configure, add a log4j.properties file to the Resources directory.
179179

180180

181-
182181
## Looking for version 3.x of the SDK?
183182
Codebase, samples and setup instructions located in [java-3.x branch](https://github.com/XeroAPI/Xero-Java/tree/java-3.x).
184183

pom.xml

Lines changed: 1 addition & 1 deletion
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>4.0.2</version>
8+
<version>4.1.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>

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public class AccountingApi {
9393
private ApiClient apiClient;
9494
private static AccountingApi instance = null;
9595
private String userAgent = "Default";
96-
private String version = "4.0.2";
96+
private String version = "4.1.0";
9797
final static Logger logger = LoggerFactory.getLogger(AccountingApi.class);
9898

9999
public AccountingApi() {
@@ -10301,14 +10301,15 @@ public HttpResponse getPaymentServicesForHttpResponse(String accessToken, Strin
1030110301
* @param ifModifiedSince Only records created or modified since this timestamp will be returned
1030210302
* @param where Filter by an any element
1030310303
* @param order Order by an any element
10304+
* @param page Up to 100 payments will be returned in a single API call
1030410305
* @param accessToken Authorization token for user set in header of each request
1030510306
* @return Payments
1030610307
* @throws IOException if an error occurs while attempting to invoke the API
1030710308
**/
10308-
public Payments getPayments(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException {
10309+
public Payments getPayments(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException {
1030910310
try {
1031010311
TypeReference<Payments> typeRef = new TypeReference<Payments>() {};
10311-
HttpResponse response = getPaymentsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order);
10312+
HttpResponse response = getPaymentsForHttpResponse(accessToken, xeroTenantId, ifModifiedSince, where, order, page);
1031210313
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
1031310314
} catch (HttpResponseException e) {
1031410315
if (logger.isDebugEnabled()) {
@@ -10323,7 +10324,7 @@ public Payments getPayments(String accessToken, String xeroTenantId, OffsetDate
1032310324
return null;
1032410325
}
1032510326

10326-
public HttpResponse getPaymentsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order) throws IOException {
10327+
public HttpResponse getPaymentsForHttpResponse(String accessToken, String xeroTenantId, OffsetDateTime ifModifiedSince, String where, String order, Integer page) throws IOException {
1032710328
// verify the required parameter 'xeroTenantId' is set
1032810329
if (xeroTenantId == null) {
1032910330
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPayments");
@@ -10359,6 +10360,16 @@ public HttpResponse getPaymentsForHttpResponse(String accessToken, String xeroT
1035910360
} else {
1036010361
uriBuilder = uriBuilder.queryParam(key, value);
1036110362
}
10363+
} if (page != null) {
10364+
String key = "page";
10365+
Object value = page;
10366+
if (value instanceof Collection) {
10367+
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
10368+
} else if (value instanceof Object[]) {
10369+
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
10370+
} else {
10371+
uriBuilder = uriBuilder.queryParam(key, value);
10372+
}
1036210373
}
1036310374
String url = uriBuilder.build().toString();
1036410375
GenericUrl genericUrl = new GenericUrl(url);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class AssetApi {
4747
private ApiClient apiClient;
4848
private static AssetApi instance = null;
4949
private String userAgent = "Default";
50-
private String version = "4.0.2";
50+
private String version = "4.1.0";
5151
final static Logger logger = LoggerFactory.getLogger(AssetApi.class);
5252

5353
public AssetApi() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class BankFeedsApi {
4747
private ApiClient apiClient;
4848
private static BankFeedsApi instance = null;
4949
private String userAgent = "Default";
50-
private String version = "4.0.2";
50+
private String version = "4.1.0";
5151
final static Logger logger = LoggerFactory.getLogger(BankFeedsApi.class);
5252

5353
public BankFeedsApi() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class IdentityApi {
4343
private ApiClient apiClient;
4444
private static IdentityApi instance = null;
4545
private String userAgent = "Default";
46-
private String version = "4.0.2";
46+
private String version = "4.1.0";
4747
final static Logger logger = LoggerFactory.getLogger(IdentityApi.class);
4848

4949
public IdentityApi() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class PayrollAuApi {
6363
private ApiClient apiClient;
6464
private static PayrollAuApi instance = null;
6565
private String userAgent = "Default";
66-
private String version = "4.0.2";
66+
private String version = "4.1.0";
6767
final static Logger logger = LoggerFactory.getLogger(PayrollAuApi.class);
6868

6969
public PayrollAuApi() {

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

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.xero.models.payrolluk.EmployeeOpeningBalances;
2828
import com.xero.models.payrolluk.EmployeeOpeningBalancesObject;
2929
import com.xero.models.payrolluk.EmployeePayTemplateObject;
30+
import com.xero.models.payrolluk.EmployeePayTemplates;
3031
import com.xero.models.payrolluk.EmployeeStatutoryLeaveBalanceObject;
3132
import com.xero.models.payrolluk.EmployeeStatutoryLeavesSummaries;
3233
import com.xero.models.payrolluk.EmployeeStatutorySickLeave;
@@ -104,7 +105,7 @@ public class PayrollUkApi {
104105
private ApiClient apiClient;
105106
private static PayrollUkApi instance = null;
106107
private String userAgent = "Default";
107-
private String version = "4.0.2";
108+
private String version = "4.1.0";
108109
final static Logger logger = LoggerFactory.getLogger(PayrollUkApi.class);
109110

110111
public PayrollUkApi() {
@@ -1142,12 +1143,12 @@ public HttpResponse createLeaveTypeForHttpResponse(String accessToken, String x
11421143
* @param employeeId Employee id for single object
11431144
* @param earningsTemplate The earningsTemplate parameter
11441145
* @param accessToken Authorization token for user set in header of each request
1145-
* @return EmployeePayTemplateObject
1146+
* @return EmployeePayTemplates
11461147
* @throws IOException if an error occurs while attempting to invoke the API
11471148
**/
1148-
public EmployeePayTemplateObject createMultipleEmployeeEarningsTemplate(String accessToken, String xeroTenantId, UUID employeeId, List<EarningsTemplate> earningsTemplate) throws IOException {
1149+
public EmployeePayTemplates createMultipleEmployeeEarningsTemplate(String accessToken, String xeroTenantId, UUID employeeId, List<EarningsTemplate> earningsTemplate) throws IOException {
11491150
try {
1150-
TypeReference<EmployeePayTemplateObject> typeRef = new TypeReference<EmployeePayTemplateObject>() {};
1151+
TypeReference<EmployeePayTemplates> typeRef = new TypeReference<EmployeePayTemplates>() {};
11511152
HttpResponse response = createMultipleEmployeeEarningsTemplateForHttpResponse(accessToken, xeroTenantId, employeeId, earningsTemplate);
11521153
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
11531154
} catch (HttpResponseException e) {
@@ -1157,9 +1158,9 @@ public EmployeePayTemplateObject createMultipleEmployeeEarningsTemplate(String
11571158
}
11581159
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
11591160
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
1160-
TypeReference<EmployeePayTemplateObject> errorTypeRef = new TypeReference<EmployeePayTemplateObject>() {};
1161-
EmployeePayTemplateObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
1162-
handler.validationError(e.getStatusCode(),"EmployeePayTemplateObject",object.getProblem());
1161+
TypeReference<EmployeePayTemplates> errorTypeRef = new TypeReference<EmployeePayTemplates>() {};
1162+
EmployeePayTemplates object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
1163+
handler.validationError(e.getStatusCode(),"EmployeePayTemplates",object.getProblem());
11631164
} else {
11641165
handler.execute(e);
11651166
}
@@ -2893,14 +2894,14 @@ public HttpResponse getEmployeeOpeningBalancesForHttpResponse(String accessToken
28932894
* @return EmployeePayTemplateObject
28942895
* @throws IOException if an error occurs while attempting to invoke the API
28952896
**/
2896-
public EmployeePayTemplateObject getEmployeePayTemplates(String accessToken, String xeroTenantId, UUID employeeId) throws IOException {
2897+
public EmployeePayTemplateObject getEmployeePayTemplate(String accessToken, String xeroTenantId, UUID employeeId) throws IOException {
28972898
try {
28982899
TypeReference<EmployeePayTemplateObject> typeRef = new TypeReference<EmployeePayTemplateObject>() {};
2899-
HttpResponse response = getEmployeePayTemplatesForHttpResponse(accessToken, xeroTenantId, employeeId);
2900+
HttpResponse response = getEmployeePayTemplateForHttpResponse(accessToken, xeroTenantId, employeeId);
29002901
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
29012902
} catch (HttpResponseException e) {
29022903
if (logger.isDebugEnabled()) {
2903-
logger.debug("------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeePayTemplates -------------------");
2904+
logger.debug("------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeePayTemplate -------------------");
29042905
logger.debug(e.toString());
29052906
}
29062907
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
@@ -2917,16 +2918,16 @@ public EmployeePayTemplateObject getEmployeePayTemplates(String accessToken, St
29172918
return null;
29182919
}
29192920

2920-
public HttpResponse getEmployeePayTemplatesForHttpResponse(String accessToken, String xeroTenantId, UUID employeeId) throws IOException {
2921+
public HttpResponse getEmployeePayTemplateForHttpResponse(String accessToken, String xeroTenantId, UUID employeeId) throws IOException {
29212922
// verify the required parameter 'xeroTenantId' is set
29222923
if (xeroTenantId == null) {
2923-
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployeePayTemplates");
2924+
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getEmployeePayTemplate");
29242925
}// verify the required parameter 'employeeId' is set
29252926
if (employeeId == null) {
2926-
throw new IllegalArgumentException("Missing the required parameter 'employeeId' when calling getEmployeePayTemplates");
2927+
throw new IllegalArgumentException("Missing the required parameter 'employeeId' when calling getEmployeePayTemplate");
29272928
}
29282929
if (accessToken == null) {
2929-
throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getEmployeePayTemplates");
2930+
throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getEmployeePayTemplate");
29302931
}
29312932
HttpHeaders headers = new HttpHeaders();
29322933
headers.set("Xero-Tenant-Id", xeroTenantId);
@@ -5062,12 +5063,12 @@ public HttpResponse updateEmployeeSalaryAndWageForHttpResponse(String accessToke
50625063
* @param payRunID Identifier for the pay run
50635064
* @param payRun The payRun parameter
50645065
* @param accessToken Authorization token for user set in header of each request
5065-
* @return PayRuns
5066+
* @return PayRunObject
50665067
* @throws IOException if an error occurs while attempting to invoke the API
50675068
**/
5068-
public PayRuns updatePayRun(String accessToken, String xeroTenantId, UUID payRunID, PayRun payRun) throws IOException {
5069+
public PayRunObject updatePayRun(String accessToken, String xeroTenantId, UUID payRunID, PayRun payRun) throws IOException {
50695070
try {
5070-
TypeReference<PayRuns> typeRef = new TypeReference<PayRuns>() {};
5071+
TypeReference<PayRunObject> typeRef = new TypeReference<PayRunObject>() {};
50715072
HttpResponse response = updatePayRunForHttpResponse(accessToken, xeroTenantId, payRunID, payRun);
50725073
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
50735074
} catch (HttpResponseException e) {
@@ -5077,9 +5078,9 @@ public PayRuns updatePayRun(String accessToken, String xeroTenantId, UUID payRu
50775078
}
50785079
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
50795080
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
5080-
TypeReference<PayRuns> errorTypeRef = new TypeReference<PayRuns>() {};
5081-
PayRuns object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
5082-
handler.validationError(e.getStatusCode(),"PayRuns",object.getProblem());
5081+
TypeReference<PayRunObject> errorTypeRef = new TypeReference<PayRunObject>() {};
5082+
PayRunObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
5083+
handler.validationError(e.getStatusCode(),"PayRunObject",object.getProblem());
50835084
} else {
50845085
handler.execute(e);
50855086
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class ProjectApi {
5454
private ApiClient apiClient;
5555
private static ProjectApi instance = null;
5656
private String userAgent = "Default";
57-
private String version = "4.0.2";
57+
private String version = "4.1.0";
5858
final static Logger logger = LoggerFactory.getLogger(ProjectApi.class);
5959

6060
public ProjectApi() {
@@ -614,7 +614,7 @@ public HttpResponse getTaskForHttpResponse(String accessToken, String xeroTenan
614614
* @param projectId You can specify an individual project by appending the projectId to the endpoint
615615
* @param page Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
616616
* @param pageSize Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.
617-
* @param taskIds taskIds Search for all tasks that match a comma separated list of taskIds, i.e. GET https://.../tasks?taskIds&#x3D;{taskId},{taskId}
617+
* @param taskIds taskIdsSearch for all tasks that match a comma separated list of taskIds, i.e. GET https://.../tasks?taskIds&#x3D;{taskId},{taskId}
618618
* @param accessToken Authorization token for user set in header of each request
619619
* @return Tasks
620620
* @throws IOException if an error occurs while attempting to invoke the API
@@ -715,7 +715,7 @@ public HttpResponse getTasksForHttpResponse(String accessToken, String xeroTena
715715
* @param contactId Finds all time entries for this contact identifier.
716716
* @param page Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
717717
* @param pageSize Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.
718-
* @param states Comma-separated list of states to find. Will find all time entries that are in the status of whatever’s specified.
718+
* @param states Comma-separated list of states to find. Will find all time entries that are in the status of whatever’s specified.
719719
* @param isChargeable Finds all time entries which relate to tasks with the charge type &#x60;TIME&#x60; or &#x60;FIXED&#x60;.
720720
* @param dateAfterUtc ISO 8601 UTC date. Finds all time entries on or after this date filtered on the &#x60;dateUtc&#x60; field.
721721
* @param dateBeforeUtc ISO 8601 UTC date. Finds all time entries on or before this date filtered on the &#x60;dateUtc&#x60; field.

src/main/java/com/xero/models/accounting/Account.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Accounting API
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
5-
* The version of the OpenAPI document: 2.1.5
5+
* The version of the OpenAPI document: 2.2.0
66
* Contact: [email protected]
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -15,6 +15,7 @@
1515

1616
import java.util.Objects;
1717
import java.util.Arrays;
18+
import com.fasterxml.jackson.annotation.JsonInclude;
1819
import com.fasterxml.jackson.annotation.JsonProperty;
1920
import com.fasterxml.jackson.annotation.JsonCreator;
2021
import com.fasterxml.jackson.annotation.JsonValue;

0 commit comments

Comments
 (0)