Skip to content

Commit 0208db2

Browse files
authored
Merge pull request #197 from XeroAPI/sid-development
UK Payroll Beta
2 parents 8e3dd44 + 0daf69f commit 0208db2

331 files changed

Lines changed: 23354 additions & 261 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: 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>3.5.2</version>
8+
<version>3.6.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/XeroApiExceptionHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public void execute(HttpResponseException e, ApiClient apiClient)
4141
elementsItem.addValidationErrorsItem(ve);
4242
error.addElementsItem(elementsItem);
4343
throw new XeroApiException(statusCode, error);
44+
} else if (statusCode == 401) {
45+
throw new XeroApiException(401, "Unauthorized - check your scopes and confirm access to this resource" );
4446
} else if (statusCode != 400) {
4547
throw new XeroApiException(statusCode, e.getStatusMessage());
4648
} else {

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

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class AccountingApi {
9191
private ApiClient apiClient;
9292
private static AccountingApi instance = null;
9393
private String userAgent = "Default";
94-
private String version = "3.5.2";
94+
private String version = "3.6.0";
9595

9696
public AccountingApi() {
9797
this(new ApiClient());
@@ -1263,16 +1263,16 @@ public HttpResponse createCreditNoteAllocationForHttpResponse(String accessToken
12631263
* @param xeroTenantId Xero identifier for Tenant
12641264
* @param creditNoteID Unique identifier for a Credit Note
12651265
* @param fileName Name of the file you are attaching to Credit Note
1266-
* @param includeOnline Set an attachment to be included with the invoice when viewed online (through Xero)
12671266
* @param body Byte array of file in body of request
1267+
* @param includeOnline Allows an attachment to be seen by the end customer within their online invoice
12681268
* @param accessToken Authorization token for user set in header of each request
12691269
* @return Attachments
12701270
* @throws IOException if an error occurs while attempting to invoke the API
12711271
**/
1272-
public Attachments createCreditNoteAttachmentByFileName(String accessToken, String xeroTenantId, UUID creditNoteID, String fileName, Boolean includeOnline, File body) throws IOException {
1272+
public Attachments createCreditNoteAttachmentByFileName(String accessToken, String xeroTenantId, UUID creditNoteID, String fileName, File body, Boolean includeOnline) throws IOException {
12731273
try {
12741274
TypeReference<Attachments> typeRef = new TypeReference<Attachments>() {};
1275-
HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(accessToken, xeroTenantId, creditNoteID, fileName, includeOnline, body);
1275+
HttpResponse response = createCreditNoteAttachmentByFileNameForHttpResponse(accessToken, xeroTenantId, creditNoteID, fileName, body, includeOnline);
12761276
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
12771277
} catch (HttpResponseException e) {
12781278
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
@@ -1283,7 +1283,7 @@ public Attachments createCreditNoteAttachmentByFileName(String accessToken, Str
12831283
return null;
12841284
}
12851285

1286-
public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String accessToken, String xeroTenantId, UUID creditNoteID, String fileName, Boolean includeOnline, File body) throws IOException {
1286+
public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String accessToken, String xeroTenantId, UUID creditNoteID, String fileName, File body, Boolean includeOnline) throws IOException {
12871287
// verify the required parameter 'xeroTenantId' is set
12881288
if (xeroTenantId == null) {
12891289
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createCreditNoteAttachmentByFileName");
@@ -1293,9 +1293,6 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String a
12931293
}// verify the required parameter 'fileName' is set
12941294
if (fileName == null) {
12951295
throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createCreditNoteAttachmentByFileName");
1296-
}// verify the required parameter 'includeOnline' is set
1297-
if (includeOnline == null) {
1298-
throw new IllegalArgumentException("Missing the required parameter 'includeOnline' when calling createCreditNoteAttachmentByFileName");
12991296
}// verify the required parameter 'body' is set
13001297
if (body == null) {
13011298
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createCreditNoteAttachmentByFileName");
@@ -1314,9 +1311,19 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse(String a
13141311
final Map<String, Object> uriVariables = new HashMap<String, Object>();
13151312
uriVariables.put("CreditNoteID", creditNoteID);
13161313
uriVariables.put("FileName", fileName);
1317-
uriVariables.put("IncludeOnline", includeOnline);
13181314

13191315
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
1316+
if (includeOnline != null) {
1317+
String key = "IncludeOnline";
1318+
Object value = includeOnline;
1319+
if (value instanceof Collection) {
1320+
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
1321+
} else if (value instanceof Object[]) {
1322+
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
1323+
} else {
1324+
uriBuilder = uriBuilder.queryParam(key, value);
1325+
}
1326+
}
13201327
String url = uriBuilder.buildFromMap(uriVariables).toString();
13211328
GenericUrl genericUrl = new GenericUrl(url);
13221329

@@ -1731,16 +1738,16 @@ public HttpResponse createExpenseClaimsForHttpResponse(String accessToken, Stri
17311738
* @param xeroTenantId Xero identifier for Tenant
17321739
* @param invoiceID Unique identifier for an Invoice
17331740
* @param fileName Name of the file you are attaching
1734-
* @param includeOnline Set an attachment to be included with the invoice when viewed online (through Xero)
17351741
* @param body Byte array of file in body of request
1742+
* @param includeOnline Allows an attachment to be seen by the end customer within their online invoice
17361743
* @param accessToken Authorization token for user set in header of each request
17371744
* @return Attachments
17381745
* @throws IOException if an error occurs while attempting to invoke the API
17391746
**/
1740-
public Attachments createInvoiceAttachmentByFileName(String accessToken, String xeroTenantId, UUID invoiceID, String fileName, Boolean includeOnline, File body) throws IOException {
1747+
public Attachments createInvoiceAttachmentByFileName(String accessToken, String xeroTenantId, UUID invoiceID, String fileName, File body, Boolean includeOnline) throws IOException {
17411748
try {
17421749
TypeReference<Attachments> typeRef = new TypeReference<Attachments>() {};
1743-
HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(accessToken, xeroTenantId, invoiceID, fileName, includeOnline, body);
1750+
HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse(accessToken, xeroTenantId, invoiceID, fileName, body, includeOnline);
17441751
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
17451752
} catch (HttpResponseException e) {
17461753
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
@@ -1751,7 +1758,7 @@ public Attachments createInvoiceAttachmentByFileName(String accessToken, String
17511758
return null;
17521759
}
17531760

1754-
public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String accessToken, String xeroTenantId, UUID invoiceID, String fileName, Boolean includeOnline, File body) throws IOException {
1761+
public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String accessToken, String xeroTenantId, UUID invoiceID, String fileName, File body, Boolean includeOnline) throws IOException {
17551762
// verify the required parameter 'xeroTenantId' is set
17561763
if (xeroTenantId == null) {
17571764
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createInvoiceAttachmentByFileName");
@@ -1761,9 +1768,6 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String acce
17611768
}// verify the required parameter 'fileName' is set
17621769
if (fileName == null) {
17631770
throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling createInvoiceAttachmentByFileName");
1764-
}// verify the required parameter 'includeOnline' is set
1765-
if (includeOnline == null) {
1766-
throw new IllegalArgumentException("Missing the required parameter 'includeOnline' when calling createInvoiceAttachmentByFileName");
17671771
}// verify the required parameter 'body' is set
17681772
if (body == null) {
17691773
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName");
@@ -1782,9 +1786,19 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse(String acce
17821786
final Map<String, Object> uriVariables = new HashMap<String, Object>();
17831787
uriVariables.put("InvoiceID", invoiceID);
17841788
uriVariables.put("FileName", fileName);
1785-
uriVariables.put("IncludeOnline", includeOnline);
17861789

17871790
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
1791+
if (includeOnline != null) {
1792+
String key = "IncludeOnline";
1793+
Object value = includeOnline;
1794+
if (value instanceof Collection) {
1795+
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
1796+
} else if (value instanceof Object[]) {
1797+
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
1798+
} else {
1799+
uriBuilder = uriBuilder.queryParam(key, value);
1800+
}
1801+
}
17881802
String url = uriBuilder.buildFromMap(uriVariables).toString();
17891803
GenericUrl genericUrl = new GenericUrl(url);
17901804

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

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

5050
public AssetApi() {
5151
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.5.2";
48+
private String version = "3.6.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.5.2";
44+
private String version = "3.6.0";
4545

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class PayrollAuApi {
5959
private ApiClient apiClient;
6060
private static PayrollAuApi instance = null;
6161
private String userAgent = "Default";
62-
private String version = "3.5.2";
62+
private String version = "3.6.0";
6363

6464
public PayrollAuApi() {
6565
this(new ApiClient());

0 commit comments

Comments
 (0)