From a9529f30c0979aac864f2bb4d6b7765815efc241 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 13 Sep 2024 12:43:39 +0530 Subject: [PATCH 01/45] replaced postman URL with PRISM Url for Accounting YML --- .../api/client/AccountingApiAccountsTest.java | 43 ++++--------------- .../AccountingApiBankTransactionTest.java | 32 ++------------ .../client/AccountingApiBankTransferTest.java | 29 +------------ .../client/AccountingApiBatchPaymentTest.java | 28 +----------- .../AccountingApiBrandingThemeTest.java | 30 +------------ .../client/AccountingApiContactGroupTest.java | 32 +------------- .../api/client/AccountingApiContactsTest.java | 26 +---------- .../client/AccountingApiCreditNotesTest.java | 28 +----------- .../client/AccountingApiEmployeesTest.java | 31 +------------ .../AccountingApiExpenseClaimsTest.java | 29 +------------ .../api/client/AccountingApiInvoicesTest.java | 26 +---------- .../api/client/AccountingApiItemsTest.java | 33 +------------- .../api/client/AccountingApiJournalsTest.java | 33 +------------- .../AccountingApiLinkedTransactionsTest.java | 31 +------------ .../AccountingApiManualJournalsTest.java | 36 +++------------- .../AccountingApiOrganisationsTest.java | 31 +------------ .../client/AccountingApiOverpaymentsTest.java | 28 +----------- .../AccountingApiPaymentServicesTest.java | 32 +------------- .../api/client/AccountingApiPaymentsTest.java | 29 +------------ .../client/AccountingApiPrepaymentsTest.java | 29 +------------ .../AccountingApiPurchaseOrdersTest.java | 29 +------------ .../api/client/AccountingApiQuotesTest.java | 32 +------------- .../api/client/AccountingApiReceiptsTest.java | 30 +------------ .../AccountingApiRepeatingInvoicesTest.java | 30 +------------ .../api/client/AccountingApiReportsTest.java | 39 +++-------------- .../api/client/AccountingApiTaxRatesTest.java | 33 +------------- .../AccountingApiTrackingCategoriesTest.java | 32 +------------- .../api/client/AccountingApiUsersTest.java | 31 +------------ 28 files changed, 48 insertions(+), 824 deletions(-) diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java index 52a3b0798..8df6b5671 100644 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -1,45 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - -import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.junit.*; - import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - public class AccountingApiAccountsTest { ApiClient defaultClient; @@ -58,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); @@ -156,13 +127,17 @@ public void testGetAccountAttachments() throws Exception { public void testCreateAccountAttachmentByFileName() throws Exception { System.out.println("@Test - createAccountAttachmentByFileName"); - UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); - + Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,null, null, null); + UUID accountID = accounts.getAccounts().get(0).getAccountID(); + // UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + ClassLoader classLoader = getClass().getClassLoader(); File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); - String newFileName = "sample5.jpg"; - Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accessToken,xeroTenantId,accountID, newFileName, bytes, null); + String newFileName = bytes.getName(); + String idempotencyKey = null; + // String idempotencyKey = "KEY_VALUE"; + Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accessToken,xeroTenantId,accountID, newFileName, bytes, idempotencyKey); assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("ab95b276-9dce-4925-9077-439818ba270f"))); assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java index 22006ab40..11ccce760 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java @@ -1,42 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiBankTransactionTest { @@ -55,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); @@ -158,8 +132,8 @@ public void createBankTransactionAttachmentByFileNameTest() throws IOException { UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); ClassLoader classLoader = getClass().getClassLoader(); File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); - String fileName = "sample5.jpg"; - + String fileName = "helo-heros.jpg"; + System.out.println("File path: " + bytes.getAbsolutePath()); Attachments response = accountingApi.createBankTransactionAttachmentByFileName(accessToken,xeroTenantId,bankTransactionID, fileName, bytes, null); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); assertThat(response.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java index b36ffb21c..44e7f8829 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java @@ -1,43 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiBankTransferTest { @@ -57,7 +30,7 @@ public void setUp() { xeroTenantId = "xyz"; // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java index 4d574b2d1..84a88b29d 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java @@ -1,40 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; public class AccountingApiBatchPaymentTest { @@ -55,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java index 2119a9694..a2f6e7ced 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java @@ -1,40 +1,12 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; public class AccountingApiBrandingThemeTest { @@ -55,7 +27,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java index 218ed4eb7..a65df9f84 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiContactGroupTest { @@ -58,7 +28,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java index da18515c1..6b37b35ec 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java @@ -1,42 +1,18 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiContactsTest { @@ -57,7 +33,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java index b70e1ba8f..adec2334d 100644 --- a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java @@ -1,42 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiCreditNotesTest { @@ -56,7 +30,7 @@ public void setUp() { xeroTenantId = "xyz"; // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); diff --git a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java index b9b9feffc..55cd2fd2b 100644 --- a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiEmployeesTest { @@ -58,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs diff --git a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java index 49fc446f3..6dc2802ac 100644 --- a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java @@ -1,43 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiExpenseClaimsTest { @@ -58,7 +31,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); diff --git a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java index 0ec2420da..271634335 100644 --- a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java @@ -1,42 +1,18 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiInvoicesTest { @@ -56,7 +32,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); diff --git a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java index bf90e61c9..1afeb63cd 100644 --- a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiItemsTest { @@ -58,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -95,7 +66,7 @@ public void createItemTest() throws IOException { assertThat(response.getItems().get(0).getIsTrackedAsInventory(), is(equalTo(false))); assertThat(response.getItems().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2019-03-11T19:17:51.707Z")))); assertThat(response.getItems().get(0).getItemID(), is(equalTo(UUID.fromString("a4544d51-48f6-441f-a623-99ecbced6ab7")))); - assertThat(response.getItems().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Price List Item with Code 'abc' already exists"))); + assertThat(response.getItems().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("Price List Item with Code ''abc'' already exists"))); //System.out.println(response.getItems().get(0).toString()); } diff --git a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java index 678651f17..06e2eacf1 100644 --- a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiJournalsTest { @@ -57,7 +28,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -84,7 +55,7 @@ public void tearDown() { public void getJournalTest() throws IOException { System.out.println("@Test - getJournal"); UUID journalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); - Journals response = accountingApi.getJournal(accessToken,xeroTenantId,journalID); + Journals response = accountingApi.getJournalByNumber(accessToken,xeroTenantId,1); assertThat(response.getJournals().get(0).getJournalID(), is(equalTo(UUID.fromString("1b31feeb-aa23-404c-8c19-24c827c53661")))); assertThat(response.getJournals().get(0).getJournalDateAsDate(), is(equalTo(LocalDate.of(2018,10,20)))); diff --git a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java index 4e412d57d..c1991d772 100644 --- a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiLinkedTransactionsTest { @@ -58,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs diff --git a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java index 70a7fc8fa..396dcedac 100644 --- a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java @@ -1,42 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiManualJournalsTest { @@ -57,7 +31,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); @@ -112,7 +86,7 @@ public void createManualJournalsTest() throws IOException { assertThat(response.getManualJournals().get(0).getShowOnCashBasisReports(), is(equalTo(true))); assertThat(response.getManualJournals().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2019-03-14T20:39:32.920Z")))); assertThat(response.getManualJournals().get(0).getManualJournalID(), is(equalTo(UUID.fromString("d312dd5e-a53e-46d1-9d51-c569ef4570b7")))); - assertThat(response.getManualJournals().get(0).getWarnings().get(0).getMessage(), is(equalTo("Account code '476' has been removed as it does not match a recognised account."))); + assertThat(response.getManualJournals().get(0).getWarnings().get(0).getMessage(), is(equalTo("Account code ''476'' has been removed as it does not match a recognised account."))); assertThat(response.getManualJournals().get(0).getValidationErrors().get(0).getMessage(), is(equalTo("The total debits (100.00) must equal total credits (-10.00)"))); //System.out.println(response.getManualJournals().get(0).toString()); } @@ -140,11 +114,11 @@ public void getManualJournalTest() throws IOException { UUID manualJournalID = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); ManualJournals response = accountingApi.getManualJournal(accessToken,xeroTenantId,manualJournalID); - assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("These aren't the droids you are looking for"))); + assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("These aren''t the droids you are looking for"))); assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount(), is(equalTo(100.0))); assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getLineAmount().toString(), is(equalTo("100.0"))); assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getAccountCode(), is(equalTo("429"))); - assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getDescription(), is(equalTo("These aren't the droids you are looking for"))); + assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("These aren''t the droids you are looking for"))); assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getTaxType(), is(equalTo("NONE"))); assertThat(response.getManualJournals().get(0).getJournalLines().get(0).getIsBlank(), is(equalTo(false))); assertThat(response.getManualJournals().get(0).getJournalLines().get(1).getLineAmount(), is(equalTo(-100.0))); @@ -193,7 +167,7 @@ public void getManualJournalsTest() throws IOException { Integer pageSize = null; ManualJournals response = accountingApi.getManualJournals(accessToken,xeroTenantId,ifModifiedSince, where, order, page, pageSize); - assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Reversal: These aren't the droids you are looking for"))); + assertThat(response.getManualJournals().get(0).getNarration(), is(equalTo("Reversal: These aren''t the droids you are looking for"))); assertThat(response.getManualJournals().get(0).getDateAsDate(), is(equalTo(LocalDate.of(2019,03,21)))); assertThat(response.getManualJournals().get(0).getLineAmountTypes(), is(equalTo(com.xero.models.accounting.LineAmountTypes.NOTAX))); assertThat(response.getManualJournals().get(0).getStatus(), is(equalTo(com.xero.models.accounting.ManualJournal.StatusEnum.POSTED))); diff --git a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java index 3d25d954d..009b2b4e5 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiOrganisationsTest { @@ -58,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs diff --git a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java index 962d993c7..1c8ab9234 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java @@ -1,42 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiOverpaymentsTest { @@ -57,7 +31,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java index 4f5383cbe..54effc585 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiPaymentServicesTest { @@ -58,7 +28,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java index 1569d2848..25a3d8ec4 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java @@ -1,42 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiPaymentsTest { @@ -53,7 +26,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java index 9f664c91c..3e4870982 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java @@ -1,42 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiPrepaymentsTest { @@ -56,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs diff --git a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java index d6fdc271a..a3f6f26a1 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java @@ -1,42 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiPurchaseOrdersTest { @@ -55,7 +28,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs diff --git a/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java b/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java index aea933475..49e9da450 100644 --- a/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java @@ -1,45 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - -import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.junit.*; - import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - public class AccountingApiQuotesTest { ApiClient defaultClient; @@ -58,7 +28,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java index ac2c7008a..3a2d07ce8 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java @@ -1,44 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiReceiptsTest { @@ -58,7 +30,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); diff --git a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java index 6fa289a6b..34504b38c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java @@ -1,44 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiRepeatingInvoicesTest { @@ -58,7 +30,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); diff --git a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java index 43a5a33f8..1295f9b98 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiReportsTest { @@ -56,7 +27,7 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -254,9 +225,9 @@ public void getReportTenNinetyNineTest() throws IOException { Reports response = accountingApi.getReportTenNinetyNine(accessToken,xeroTenantId,reportYear); - assertThat(response.getReports().get(0).getReportName(), is(equalTo("1099 report"))); - assertThat(response.getReports().get(0).getReportDate(), is(equalTo("1 Jan 2016 to 31 Dec 2016"))); - assertThat(response.getReports().get(0).getContacts().get(0).getBox3(), is(equalTo(1000.00))); + assertThat(response.getReports().get(0).getReportName(), is(equalTo("1099-NEC report"))); + assertThat(response.getReports().get(0).getReportDate(), is(equalTo("1 Jan 2023 to 31 Dec 2023"))); + assertThat(response.getReports().get(0).getContacts().get(0).getBox4(), is(equalTo(1150.00))); assertThat(response.getReports().get(0).getContacts().get(0).getName(), is(equalTo("Bank West"))); assertThat(response.getReports().get(0).getContacts().get(0).getFederalTaxIDType(), is(equalTo("SSN"))); assertThat(response.getReports().get(0).getContacts().get(0).getCity(), is(equalTo("Pinehaven"))); @@ -265,7 +236,7 @@ public void getReportTenNinetyNineTest() throws IOException { assertThat(response.getReports().get(0).getContacts().get(0).getEmail(), is(equalTo("jack@bowest.com"))); assertThat(response.getReports().get(0).getContacts().get(0).getTaxID(), is(equalTo("234-22-2223"))); assertThat(response.getReports().get(0).getContacts().get(0).getContactId(), is(equalTo(UUID.fromString("81d5706a-8057-4338-8511-747cd85f4c68")))); - assertThat(response.getReports().get(0).getContacts().get(2).getBox1(), is(equalTo(5543.75))); + assertThat(response.getReports().get(0).getContacts().get(0).getBox1(), is(equalTo(0.00))); //System.out.println(response.getReports().toString()); } diff --git a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java index a9c749e1c..af2ce4ce4 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java @@ -1,44 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiTaxRatesTest { @@ -57,7 +26,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs diff --git a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java index 030cbf127..8c99de179 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiTrackingCategoriesTest { @@ -57,7 +27,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs diff --git a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java index c73767010..e3def3ce9 100644 --- a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.accounting.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class AccountingApiUsersTest { @@ -57,7 +28,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs From 4df0162f32a4c2cb943d6f89e57969c03a144dc4 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 13 Sep 2024 12:49:04 +0530 Subject: [PATCH 02/45] replace POSTMAN url with PRISM url for appstore related tests --- .../com/xero/api/client/AppStoreApiTest.java | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/src/test/java/com/xero/api/client/AppStoreApiTest.java b/src/test/java/com/xero/api/client/AppStoreApiTest.java index b0dfd445c..f5ff53d4a 100644 --- a/src/test/java/com/xero/api/client/AppStoreApiTest.java +++ b/src/test/java/com/xero/api/client/AppStoreApiTest.java @@ -1,45 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - -import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.junit.*; - import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; import com.xero.api.XeroApiException; -import com.xero.api.client.*; import com.xero.models.appstore.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; - -import org.apache.commons.io.IOUtils; - public class AppStoreApiTest { ApiClient defaultClient; @@ -55,7 +25,7 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - defaultClient = new ApiClient("https://ec5d3540-e90b-47b9-9a5d-95180950a89b.mock.pstmn.io/appstore/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4011",null,null,null,null); appStoreApi = AppStoreApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs From fb295c45a9e9fc5f7b9b0656e68ecb79687cd96a Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 13 Sep 2024 14:25:32 +0530 Subject: [PATCH 03/45] Fixed issues w.r to Assets, Bankfeed yml --- .../com/xero/api/client/AssetsApiTest.java | 38 +++++-------------- .../client/BankfeedApiFeedConnectionTest.java | 2 +- .../api/client/BankfeedApiStatementTest.java | 33 +--------------- 3 files changed, 11 insertions(+), 62 deletions(-) diff --git a/src/test/java/com/xero/api/client/AssetsApiTest.java b/src/test/java/com/xero/api/client/AssetsApiTest.java index a997b20f7..b566e32f3 100644 --- a/src/test/java/com/xero/api/client/AssetsApiTest.java +++ b/src/test/java/com/xero/api/client/AssetsApiTest.java @@ -1,45 +1,19 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - -import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.junit.*; - import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; import com.xero.api.XeroApiException; -import com.xero.api.client.*; import com.xero.models.assets.*; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; +import com.xero.models.assets.BookDepreciationSetting.DepreciationMethodEnum; import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; -import org.apache.commons.io.IOUtils; - public class AssetsApiTest { ApiClient defaultClient; @@ -56,8 +30,7 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init clienthttps://3e140044-4914-47dd-b4e1-df0cc040a44f.mock.pstmn.io/bankfeeds.xro/1.0 - defaultClient = new ApiClient("https://0a44a319-84a5-4918-91ce-338acd97a84d.mock.pstmn.io/assets.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4012",null,null,null,null); assetApi = AssetApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -86,6 +59,7 @@ public void testCreateAsset() throws Exception { System.out.println("@Test - createAsset"); Asset newAsset = new Asset(); + newAsset.setAssetName("Computer7486"); try { Asset response = assetApi.createAsset(accessToken,xeroTenantId,newAsset,null); assertThat(response.getAssetId().toString(), (equalTo("2257c64a-77ca-444c-a5ea-fa9a588c7039"))); @@ -200,6 +174,12 @@ public void testCreateAssetType() throws Exception { System.out.println("@Test - createAssetType"); AssetType newAssetType = new AssetType(); + newAssetType.setAssetTypeName("Machinery11004"); + newAssetType.setFixedAssetAccountId(UUID.fromString("3d8d063a-c148-4bb8-8b3c-a5e2ad3b1e82")); + newAssetType.setDepreciationExpenseAccountId(UUID.fromString("d1602f69-f900-4616-8d34-90af393fa368")); + BookDepreciationSetting bookDepreciationSetting = new BookDepreciationSetting(); + bookDepreciationSetting.setDepreciationMethod(DepreciationMethodEnum.DIMINISHINGVALUE100); + newAssetType.setBookDepreciationSetting(bookDepreciationSetting); try { AssetType response = assetApi.createAssetType(accessToken,xeroTenantId,newAssetType,null); diff --git a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java index 3a1033f2a..7fe49b2d3 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java @@ -31,7 +31,7 @@ public void setUp() { // Init AccountingApi client //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); - defaultClient = new ApiClient("https://3e140044-4914-47dd-b4e1-df0cc040a44f.mock.pstmn.io/bankfeeds.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4013",null,null,null,null); bankfeedsApi = BankFeedsApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs diff --git a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java index afcb542d8..27d008aae 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java @@ -1,44 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - -import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.junit.*; - import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.bankfeeds.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; public class BankfeedApiStatementTest { @@ -58,7 +27,7 @@ public void setUp() { // Init AccountingApi client //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); - defaultClient = new ApiClient("https://3e140044-4914-47dd-b4e1-df0cc040a44f.mock.pstmn.io/bankfeeds.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4013",null,null,null,null); bankfeedsApi = BankFeedsApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs From 1b5bbdd5afbab3b308116e1f30aa8642895b3081 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 13 Sep 2024 14:32:06 +0530 Subject: [PATCH 04/45] fixed test cases with Finance.yml --- .../com/xero/api/client/FinanceApiTest.java | 34 ++----------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/src/test/java/com/xero/api/client/FinanceApiTest.java b/src/test/java/com/xero/api/client/FinanceApiTest.java index e00468fff..8be82ad6a 100644 --- a/src/test/java/com/xero/api/client/FinanceApiTest.java +++ b/src/test/java/com/xero/api/client/FinanceApiTest.java @@ -1,45 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - -import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.junit.*; - import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; import com.xero.api.XeroApiException; -import com.xero.api.client.*; import com.xero.models.finance.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.*; -import org.apache.commons.io.IOUtils; - public class FinanceApiTest { ApiClient defaultClient; @@ -55,7 +27,7 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - defaultClient = new ApiClient("https://73cb2c15-a3e8-4230-86d6-8af203c03b5f.mock.pstmn.io/finance.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4014",null,null,null,null); financeApi = FinanceApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -116,7 +88,7 @@ public void testGetAccountingActivityLockHistory() throws Exception { try { LockHistoryResponse response = financeApi.getAccountingActivityLockHistory(accessToken, "73151de8-3676-4887-a021-edec960dd537", null); assertThat(response.getOrganisationId().toString(), (equalTo("73151de8-3676-4887-a021-edec960dd537"))); - assertThat(response.getLockDates().get(1).getUpdatedDateUtc().toString(), (equalTo("2019-01-20T10:50:03Z"))); + assertThat(response.getLockDates().get(1).getUpdatedDateUtc().toString(), (equalTo("2019-01-21T10:59:33Z"))); } catch (XeroApiException xe) { System.out.println(xe.toString()); @@ -212,7 +184,6 @@ public void testGetFinancialStatementContactsRevenue() throws Exception { System.out.println("@Test - getFinancialStatementContactsRevenue"); List contacts = new ArrayList(); contacts.add(UUID.fromString("1f580fe2-0659-31ee-eeb4-5c49d15d8bfa")); - contacts.add(UUID.fromString("20e94281-4751-fb7e-ee5e-96b43ae93c8a")); try { IncomeByContactResponse response = financeApi.getFinancialStatementContactsRevenue(accessToken, "73151de8-3676-4887-a021-edec960dd537",contacts,true,null,null); assertThat(response.getContacts().get(0).getName(), (equalTo("FirstContact"))); @@ -226,7 +197,6 @@ public void testGetFinancialStatementContactsExpense() throws Exception { System.out.println("@Test - getFinancialStatementContactsExpense"); List contacts = new ArrayList(); contacts.add(UUID.fromString("1f580fe2-0659-31ee-eeb4-5c49d15d8bfa")); - contacts.add(UUID.fromString("20e94281-4751-fb7e-ee5e-96b43ae93c8a")); try { IncomeByContactResponse response = financeApi.getFinancialStatementContactsExpense(accessToken, "73151de8-3676-4887-a021-edec960dd537",contacts,true,null,null); assertThat(response.getContacts().get(0).getName(), (equalTo("FirstContact"))); From 19d8b04a5ec663960ec2f8cec245308482f63366 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 20 Sep 2024 10:31:10 +0530 Subject: [PATCH 05/45] fixed test cases related to payroll UK APIs --- .../client/PayrollUkApiDeductionsTest.java | 39 ++------- .../client/PayrollUkApiEarningRatesTest.java | 40 ++------- .../PayrollUkApiEarningsOrdersTest.java | 35 +------- ...PayrollUkApiEmployeeLeaveBalancesTest.java | 32 +------ .../PayrollUkApiEmployeeLeavePeriodsTest.java | 31 +------ .../client/PayrollUkApiEmployeeLeaveTest.java | 40 ++------- .../PayrollUkApiEmployeeLeaveTypesTest.java | 34 +------- ...yrollUkApiEmployeeOpeningBalancesTest.java | 32 +------ .../PayrollUkApiEmployeePayTemplatesTest.java | 30 +------ ...ApiEmployeeStatutoryLeaveBalancesTest.java | 31 +------ ...ApiEmployeeStatutoryLeavesSummaryTest.java | 31 +------ ...llUkApiEmployeeStatutorySickLeaveTest.java | 37 ++------- .../client/PayrollUkApiEmployeeTaxTest.java | 32 +------ .../api/client/PayrollUkApiEmployeeTest.java | 83 ++++++++++--------- .../PayrollUkApiEmployerPensionsTest.java | 38 ++------- .../client/PayrollUkApiEmploymentTest.java | 37 ++------- .../client/PayrollUkApiLeaveTypesTest.java | 40 ++------- .../PayrollUkApiPayRunCalendarsTest.java | 39 ++------- .../api/client/PayrollUkApiPayRunsTest.java | 35 +------- .../PayrollUkApiPaymentMethodsTest.java | 37 +-------- .../api/client/PayrollUkApiPayslipsTest.java | 36 +------- .../PayrollUkApiReimbursementsTest.java | 37 +-------- .../api/client/PayrollUkApiSettingsTest.java | 36 +------- .../client/PayrollUkApiTimesheetsTest.java | 56 +++++-------- .../PayrollUkApiTrackingCategoriesTest.java | 36 +------- 25 files changed, 139 insertions(+), 815 deletions(-) diff --git a/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java index 49f59d2c9..694cec8bd 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java @@ -1,46 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiDeductionsTest { @@ -58,7 +25,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -111,6 +78,10 @@ public void createDeductionTest() throws IOException { System.out.println("@Test UK Payroll - createDeductionTest"); Deduction deduction = new Deduction(); + deduction.setDeductionName("Test Name"); + deduction.setDeductionCategory(com.xero.models.payrolluk.Deduction.DeductionCategoryEnum.SALARYSACRIFICE); + deduction.setLiabilityAccountId(UUID.randomUUID()); + deduction.calculationType(com.xero.models.payrolluk.Deduction.CalculationTypeEnum.FIXEDAMOUNT); DeductionObject response = payrollUkApi.createDeduction(accessToken, xeroTenantId, deduction, null); assertThat(response.getDeduction().getDeductionId(), is(equalTo(UUID.fromString("b3695b29-750f-4957-98b4-678e4a529043")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java index bfd83284b..f4aae1365 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java @@ -1,46 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEarningRatesTest { @@ -58,7 +25,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -117,6 +84,11 @@ public void createEarningsRateTest() throws IOException { System.out.println("@Test UK Payroll - createEarningsRateTest"); EarningsRate earningsRate = new EarningsRate(); + earningsRate.setName("My Earnings Rate"); + earningsRate.setEarningsType(com.xero.models.payrolluk.EarningsRate.EarningsTypeEnum.REGULAREARNINGS); + earningsRate.setRateType(com.xero.models.payrolluk.EarningsRate.RateTypeEnum.RATEPERUNIT); + earningsRate.setTypeOfUnits("hours"); + earningsRate.setExpenseAccountID(UUID.fromString("e4eb36f6-97e3-4427-a394-dd4e1b355c2e")); EarningsRateObject response = payrollUkApi.createEarningsRate(accessToken, xeroTenantId, earningsRate, null); assertThat(response.getEarningsRate().getEarningsRateID(),is(equalTo(UUID.fromString("fcf811a8-3843-4e87-8431-c62e83158aef")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java index caf1a4aa9..c0f3fdca5 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java @@ -1,46 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEarningsOrdersTest { @@ -58,7 +25,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java index 6ded2c292..f48537b2c 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeLeaveBalancesTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java index 1078fbe08..6696c78ca 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeLeavePeriodsTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java index e1fe1bbcb..fa82c5103 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java @@ -1,45 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeLeaveTest { @@ -57,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -93,6 +63,10 @@ public void createEmployeeLeaveTest() throws IOException { System.out.println("@Test UK Payroll - createEmployeeLeaveTest"); EmployeeLeave employeeLeave = new EmployeeLeave(); + employeeLeave.setLeaveTypeID(UUID.fromString("b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4")); + employeeLeave.setDescription("Creating a Description"); + employeeLeave.setStartDate(LocalDate.of(2020, 04, 24)); + employeeLeave.setEndDate(LocalDate.of(2020, 04, 26)); UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); EmployeeLeaveObject response = payrollUkApi.createEmployeeLeave(accessToken, xeroTenantId, employeeId, employeeLeave, null); @@ -141,6 +115,10 @@ public void updateEmployeeLeaveTest() throws IOException { UUID leaveId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); EmployeeLeave employeeLeave = new EmployeeLeave(); + employeeLeave.setLeaveTypeID(UUID.fromString("b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4")); + employeeLeave.setDescription("Creating a Description"); + employeeLeave.setStartDate(LocalDate.of(2020, 04, 24)); + employeeLeave.setEndDate(LocalDate.of(2020, 04, 26)); EmployeeLeaveObject response = payrollUkApi.updateEmployeeLeave(accessToken, xeroTenantId, employeeId, leaveId, employeeLeave, null); assertThat(response.getLeave().getLeaveID(), is(equalTo(UUID.fromString("8340b795-50c1-428e-9fda-90badf081ab4")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java index e8c202bbb..ccdb073d2 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeLeaveTypesTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -91,6 +62,9 @@ public void createEmployeeLeaveTypesTest() throws IOException { UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); EmployeeLeaveType employeeLeaveType = new EmployeeLeaveType(); + employeeLeaveType.setLeaveTypeID(UUID.randomUUID()); + employeeLeaveType.setScheduleOfAccrual(com.xero.models.payrolluk.EmployeeLeaveType.ScheduleOfAccrualEnum.BEGINNINGOFCALENDARYEAR); + employeeLeaveType.setHoursAccruedAnnually(10.00); EmployeeLeaveTypeObject response = payrollUkApi.createEmployeeLeaveType(accessToken, xeroTenantId, employeeId, employeeLeaveType, null); assertThat(response.getLeaveType().getLeaveTypeID(), is(equalTo(UUID.fromString("4918f233-bd31-43f9-9633-bcc6de1178f2")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java index f01cd051f..0b5acd995 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeOpeningBalancesTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java index 9886e9797..afa9027ac 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java @@ -1,44 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeePayTemplatesTest { @@ -56,7 +28,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java index 6d05632f6..4d0ee21f9 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeStatutoryLeaveBalancesTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java index 9125fd094..e022541e8 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeStatutoryLeavesSummaryTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java index e2a05da44..00f3db911 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java @@ -1,44 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeStatutorySickLeaveTest { @@ -56,7 +28,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -72,6 +44,13 @@ public void createEmployeeStatutorySickLeaveTest() throws IOException { UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); EmployeeStatutorySickLeave employeeStatutorySickLeave = new EmployeeStatutorySickLeave(); + employeeStatutorySickLeave.setEmployeeID(UUID.randomUUID()); + employeeStatutorySickLeave.setEndDate(LocalDate.of(2020, 04, 21)); + employeeStatutorySickLeave.setStartDate(LocalDate.of(2020, 04, 21)); + employeeStatutorySickLeave.setWorkPattern(List.of("Monday", "Wednesday")); + employeeStatutorySickLeave.setLeaveTypeID(UUID.randomUUID()); + employeeStatutorySickLeave.isPregnancyRelated(false); + employeeStatutorySickLeave.setSufficientNotice(true); EmployeeStatutorySickLeaveObject response = payrollUkApi.createEmployeeStatutorySickLeave(accessToken, xeroTenantId, employeeStatutorySickLeave, null); assertThat(response.getStatutorySickLeave().getStatutoryLeaveID(), is(equalTo(UUID.fromString("a2b5a1fb-ae21-47b4-876d-0b61fa6b37ab")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java index 43578a888..4ec6afe33 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeTaxTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java index 66fef7f76..43692cba4 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java @@ -1,44 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; +import com.xero.models.payrolluk.Employee.GenderEnum; import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployeeTest { @@ -56,7 +28,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -94,6 +66,23 @@ public void createEmployeeTest() throws IOException { System.out.println("@Test UK Payroll - createEmployeeTest"); Employee employee = new Employee(); + Address address = new Address(); + address.setAddressLine1("101 Green St"); + address.setCity("Rangiora"); + address.setPostCode("SW6 6EY"); + address.setCountryName("UNITED KINGDOM"); + employee.setAddress(address); + employee.setEmployeeID(UUID.randomUUID()); + employee.setFirstName("Adam"); + employee.setLastName("Adamson"); + employee.setDateOfBirth(LocalDate.of(2019, 7, 12)); + employee.setTitle("Mrs"); + employee.setGender(GenderEnum.M); + employee.email("test@test.com"); + employee.setPhoneNumber("415-555-1212"); + employee.setStartDate(LocalDate.of(2023, 7, 12)); + employee.setEndDate(LocalDate.of(2024, 7, 12)); + System.out.println(employee); EmployeeObject response = payrollUkApi.createEmployee(accessToken, xeroTenantId, employee, null); assertThat(response.getEmployee().getEmployeeID(), is(equalTo(UUID.fromString("316146c7-26a4-4065-b9bd-346d0557ea96")))); @@ -119,20 +108,19 @@ public void getEmployeeTest() throws IOException { UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); EmployeeObject response = payrollUkApi.getEmployee(accessToken, xeroTenantId, employeeId); - assertThat(response.getEmployee().getEmployeeID(), is(equalTo(UUID.fromString("aad6b292-7b94-408b-93f6-e489867e3fb0")))); + assertThat(response.getEmployee().getEmployeeID(), is(equalTo(UUID.fromString("d17e008e-3381-45c0-b50c-2fab7757e503")))); assertThat(response.getEmployee().getTitle(), is(equalTo("Mr."))); - assertThat(response.getEmployee().getFirstName(), is(equalTo("Jack"))); - assertThat(response.getEmployee().getLastName(), is(equalTo("Allan"))); - assertThat(response.getEmployee().getDateOfBirth(), is(equalTo(LocalDate.of(1987, 12, 23)))); - assertThat(response.getEmployee().getAddress().getAddressLine1(), is(equalTo("171 Midsummer Boulevard"))); - assertThat(response.getEmployee().getAddress().getCity(), is(equalTo("Milton Keynes"))); + assertThat(response.getEmployee().getFirstName(), is(equalTo("Edgar"))); + assertThat(response.getEmployee().getLastName(), is(equalTo("Allan Po"))); + assertThat(response.getEmployee().getDateOfBirth(), is(equalTo(LocalDate.of(1985, 03, 24)))); + assertThat(response.getEmployee().getAddress().getAddressLine1(), is(equalTo("171 Midsummer"))); + assertThat(response.getEmployee().getAddress().getCity(), is(equalTo("Milton Keyness"))); assertThat(response.getEmployee().getAddress().getPostCode(), is(equalTo("MK9 1EB"))); assertThat(response.getEmployee().getAddress().getCountryName(), is(equalTo("UNITED KINGDOM"))); assertThat(response.getEmployee().getGender() , is(equalTo(com.xero.models.payrolluk.Employee.GenderEnum.M))); - assertThat(response.getEmployee().getStartDate(), is(equalTo(LocalDate.of(2020, 02, 03)))); assertThat(response.getEmployee().getPayrollCalendarID(), is(equalTo(UUID.fromString("216d80e6-af55-47b1-b718-9457c3f5d2fe")))); - assertThat(response.getEmployee().getUpdatedDateUTC(), is(equalTo(LocalDateTime.of(2020, 02, 13, 16, 23 ,31) ))); - assertThat(response.getEmployee().getCreatedDateUTC(), is(equalTo(LocalDateTime.of(2020, 02, 10, 10, 00, 24) ))); + assertThat(response.getEmployee().getUpdatedDateUTC(), is(equalTo(LocalDateTime.of(2017, 05, 12, 10, 00 ,24) ))); + assertThat(response.getEmployee().getCreatedDateUTC(), is(equalTo(LocalDateTime.of(2017, 05, 12, 10, 00, 24) ))); assertThat(response.getEmployee().getNationalInsuranceNumber(), is(equalTo("AB123456C"))); //System.out.println(response.toString()); } @@ -143,6 +131,23 @@ public void updateEmployeeTest() throws IOException { UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); Employee employee = new Employee(); + employee.setEmployeeID(UUID.randomUUID()); + employee.setFirstName("Adam"); + employee.setLastName("Adamson"); + employee.setDateOfBirth(LocalDate.of(2019, 7, 12)); + employee.setTitle("Mrs"); + employee.setGender(GenderEnum.M); + employee.email("test@test.com"); + employee.setPhoneNumber("415-555-1212"); + employee.setStartDate(LocalDate.of(2023, 7, 12)); + employee.setEndDate(LocalDate.of(2024, 7, 12)); + Address address = new Address(); + address.setAddressLine1("101 Green St"); + address.setCity("Rangiora"); + address.setPostCode("SW6 6EY"); + address.setCountryName("UNITED KINGDOM"); + employee.setAddress(address); + EmployeeObject response = payrollUkApi.updateEmployee(accessToken, xeroTenantId, employeeId, employee, null); assertThat(response.getEmployee().getEmployeeID(), is(equalTo(UUID.fromString("aad6b292-7b94-408b-93f6-e489867e3fb0")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java index df3567a42..d6c55e911 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java @@ -1,46 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; import com.xero.models.payrolluk.Benefit.CategoryEnum; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmployerPensionsTest { @@ -58,7 +28,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -112,6 +82,12 @@ public void createBenefitTest() throws IOException { System.out.println("@Test UK Payroll - createBenefitTest"); Benefit benefit = new Benefit(); + benefit.setName("Test"); + benefit.setCategory(CategoryEnum.STAKEHOLDERPENSION); + benefit.setLiabilityAccountId(UUID.randomUUID()); + benefit.setExpenseAccountId(UUID.randomUUID()); + benefit.setCalculationType(CalculationTypeEnum.FIXEDAMOUNT); + benefit.setPercentage(100.00); BenefitObject response = payrollUkApi.createBenefit(accessToken, xeroTenantId, benefit, null); assertThat(response.getBenefit().getId(), is(equalTo(UUID.fromString("d295bf25-fb61-4f91-9b62-a9ae87633746")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java index b10a27577..58881e952 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java @@ -1,44 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; +import com.xero.models.payrolluk.Employment.NiCategoryEnum; import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiEmploymentTest { @@ -56,7 +28,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -71,9 +43,12 @@ public void createEmploymentTest() throws IOException { System.out.println("@Test UK Payroll - createEmploymentTest"); Employment employment = new Employment(); + employment.setEmployeeNumber("007"); + employment.setPayrollCalendarID(UUID.randomUUID()); + employment.setStartDate(LocalDate.of(2024, 04, 01)); + employment.setNiCategory(NiCategoryEnum.A); UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); EmploymentObject response = payrollUkApi.createEmployment(accessToken, xeroTenantId, employeeId, employment, null); - assertThat(response.getEmployment().getPayrollCalendarID(), is(equalTo(UUID.fromString("216d80e6-af55-47b1-b718-9457c3f5d2fe")))); assertThat(response.getEmployment().getStartDate(), is(equalTo(LocalDate.of(2020, 04, 01)))); assertThat(response.getEmployment().getEmployeeNumber(), is(equalTo("123ABC"))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java index 6d22aa7fe..c0c426ea0 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java @@ -1,46 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiLeaveTypesTest { @@ -58,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -109,6 +77,12 @@ public void createLeaveTypeTest() throws IOException { System.out.println("@Test UK Payroll - createLeaveTypeTest"); LeaveType leaveType = new LeaveType(); + leaveType.setLeaveID(UUID.randomUUID()); + leaveType.setName("My opebvwbfxf Leave"); + leaveType.setIsStatutoryLeave(true); + leaveType.setIsPaidLeave(true); + leaveType.isActive(true); + leaveType.setShowOnPayslip(true); LeaveTypeObject response = payrollUkApi.createLeaveType(accessToken, xeroTenantId, leaveType, null); assertThat(response.getLeaveType().getLeaveTypeID(),is(equalTo(UUID.fromString("4c027a23-6e7b-4547-808b-c34b2b140fef")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java index c1fcc47be..ca6e1bca0 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java @@ -1,47 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiPayRunCalendarsTest { @@ -59,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -112,6 +79,10 @@ public void createPayRunCalendarTest() throws IOException { System.out.println("@Test UK Payroll - createPayRunCalendarTest"); PayRunCalendar payRunCalendar = new PayRunCalendar(); + payRunCalendar.setName("My Weekly Cal"); + payRunCalendar.setCalendarType(com.xero.models.payrolluk.PayRunCalendar.CalendarTypeEnum.ANNUAL); + payRunCalendar.setPeriodStartDate(LocalDate.of(2020, 05, 01)); + payRunCalendar.setPaymentDate(LocalDate.of(2020, 05, 15)); PayRunCalendarObject response = payrollUkApi.createPayRunCalendar(accessToken, xeroTenantId, payRunCalendar, null); assertThat(response.getPayRunCalendar().getPayrollCalendarID(),is(equalTo(UUID.fromString("5f29322d-9123-49be-bef0-9b14c35653d1")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java index f5a943f04..3acbed615 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java @@ -1,47 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiPayRunsTest { @@ -59,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java index 1ab37ae8f..de0142a79 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java @@ -1,47 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiPaymentMethodsTest { @@ -59,7 +25,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -92,6 +58,7 @@ public void createEmployeePaymentMethodTest() throws IOException { int page = 1; UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); PaymentMethod paymentMethod = new PaymentMethod(); + paymentMethod.setPaymentMethod(com.xero.models.payrolluk.PaymentMethod.PaymentMethodEnum.ELECTRONICALLY); PaymentMethodObject response = payrollUkApi.createEmployeePaymentMethod(accessToken, xeroTenantId, employeeId, paymentMethod, null); assertThat(response.getPaymentMethod().getPaymentMethod(), is(equalTo(com.xero.models.payrolluk.PaymentMethod.PaymentMethodEnum.ELECTRONICALLY))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java index d2bd33a44..b9cc422cf 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java @@ -1,47 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiPayslipsTest { @@ -59,7 +25,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java index e903e9f5b..68cbe6f26 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java @@ -1,46 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiReimbursementsTest { @@ -58,7 +25,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -103,6 +70,8 @@ public void createReimbursementTest() throws IOException { System.out.println("@Test UK Payroll - createReimbursementTest"); Reimbursement reimbursement = new Reimbursement(); + reimbursement.setName("My new Reimburse"); + reimbursement.setAccountID(UUID.randomUUID()); ReimbursementObject response = payrollUkApi.createReimbursement(accessToken, xeroTenantId, reimbursement, null); assertThat(response.getReimbursement().getReimbursementID(),is(equalTo(UUID.fromString("2b1b587a-39f6-43f8-9dd9-a858314333c8")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java index d58082d97..b347f103c 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java @@ -1,47 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiSettingsTest { @@ -59,7 +25,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java index 6ab5c5073..a685668b6 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java @@ -1,47 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; +import java.util.List; +import java.util.UUID; public class PayrollUkApiTimesheetsTest { @@ -59,7 +28,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } @@ -118,8 +87,19 @@ public void createTimesheetTest() throws IOException { System.out.println("@Test UK Payroll - createTimesheetTest"); int page = 1; - UUID timesheetID = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); + UUID timesheetID = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); + List timesheetLines = new ArrayList<>(); + TimesheetLine timesheetLine = new TimesheetLine(); + timesheetLine.setEarningsRateID(UUID.randomUUID()); + timesheetLine.setNumberOfUnits(12.00); + timesheetLine.setDate(LocalDate.now()); + timesheetLines.add(timesheetLine); Timesheet timesheet = new Timesheet(); + timesheet.setTimesheetLines(timesheetLines); + timesheet.setPayrollCalendarID(UUID.randomUUID()); + timesheet.setEndDate(LocalDate.of(2020, 04, 19)); + timesheet.setStartDate(LocalDate.of(2020, 04, 13)); + timesheet.setEmployeeID(UUID.randomUUID()); TimesheetObject response = payrollUkApi.createTimesheet(accessToken, xeroTenantId, timesheet, null); assertThat(response.getTimesheet().getTimesheetID(),is(equalTo(UUID.fromString("88d2038a-06f7-4b8a-bdab-809804c0aa1d")))); @@ -144,6 +124,9 @@ public void createTimesheetLineTest() throws IOException { UUID timesheetID = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); TimesheetLine timesheetLine = new TimesheetLine(); + timesheetLine.setEarningsRateID(UUID.randomUUID()); + timesheetLine.setNumberOfUnits(12.00); + timesheetLine.setDate(LocalDate.now()); TimesheetLineObject response = payrollUkApi.createTimesheetLine(accessToken, xeroTenantId, timesheetID, timesheetLine, null); assertThat(response.getTimesheetLine().getTimesheetLineID(),is(equalTo(UUID.fromString("56fce87e-7f0d-4c19-8f74-7f5656651c81")))); @@ -161,6 +144,9 @@ public void updateTimesheetLineTest() throws IOException { UUID timesheetID = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); UUID timesheetLineID = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); TimesheetLine timesheetLine = new TimesheetLine(); + timesheetLine.setEarningsRateID(UUID.randomUUID()); + timesheetLine.setNumberOfUnits(12.00); + timesheetLine.setDate(LocalDate.now()); TimesheetLineObject response = payrollUkApi.updateTimesheetLine(accessToken, xeroTenantId, timesheetID, timesheetLineID, timesheetLine, null); assertThat(response.getTimesheetLine().getTimesheetLineID(),is(equalTo(UUID.fromString("c88edcad-af32-4536-a682-9a4772c21c8d")))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java index 081ca2826..0456dd479 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java @@ -1,47 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrolluk.*; -import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; -import com.xero.models.payrolluk.Benefit.CategoryEnum; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollUkApiTrackingCategoriesTest { @@ -59,7 +25,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://ba3fd247-8fc6-4d7c-bcd1-bdbea4ea1803.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); payrollUkApi = PayrollUkApi.getInstance(defaultClient); } From 8ee3e8089c6ca38256adabe9c7e4e30c7d860da9 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 20 Sep 2024 11:12:56 +0530 Subject: [PATCH 06/45] Fixed test cases with payroll nz api --- .../client/PayrollNzApiDeductionsTest.java | 36 ++----------- .../client/PayrollNzApiEarningRatesTest.java | 38 +++----------- ...PayrollNzApiEmployeeLeaveBalancesTest.java | 32 +----------- .../PayrollNzApiEmployeeLeavePeriodsTest.java | 33 +----------- .../PayrollNzApiEmployeeLeaveSetupTest.java | 32 +----------- .../client/PayrollNzApiEmployeeLeaveTest.java | 40 ++++----------- .../PayrollNzApiEmployeeLeaveTypesTest.java | 31 +---------- ...yrollNzApiEmployeeOpeningBalancesTest.java | 29 +---------- .../PayrollNzApiEmployeePayTemplatesTest.java | 30 +---------- .../client/PayrollNzApiEmployeeTaxTest.java | 32 +----------- .../api/client/PayrollNzApiEmployeeTest.java | 47 +++++++---------- .../client/PayrollNzApiEmploymentTest.java | 34 ++----------- .../client/PayrollNzApiLeaveTypesTest.java | 36 +++---------- .../PayrollNzApiPayRunCalendarsTest.java | 36 ++----------- .../api/client/PayrollNzApiPayRunsTest.java | 32 +----------- .../api/client/PayrollNzApiPaySlipsTest.java | 32 +----------- .../PayrollNzApiPaymentMethodsTest.java | 33 +----------- .../PayrollNzApiReimbursementsTest.java | 34 ++----------- .../PayrollNzApiSalaryAndWagesTest.java | 51 +++++++------------ .../api/client/PayrollNzApiSettingsTest.java | 33 +----------- .../PayrollNzApiStatutoryDeductionsTest.java | 36 ++----------- .../PayrollNzApiSuperannuationsTest.java | 44 ++++------------ .../client/PayrollNzApiTimesheetsTest.java | 49 +++++++----------- .../PayrollNzApiTrackingCategoriesTest.java | 33 +----------- .../api/client/PayrollUkApiEmployeeTest.java | 8 +-- .../client/PayrollUkApiEmploymentTest.java | 2 +- 26 files changed, 126 insertions(+), 747 deletions(-) diff --git a/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java index 058e9b401..3d6548c1d 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; +import com.xero.models.payrollnz.Deduction.DeductionCategoryEnum; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiDeductionsTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -104,6 +75,9 @@ public void createDeductionTest() throws IOException { System.out.println("@Test NZ Payroll - createDeductionTest"); Deduction deduction = new Deduction(); + deduction.setDeductionName("Test Name"); + deduction.setDeductionCategory(DeductionCategoryEnum.NZOTHER); + deduction.setLiabilityAccountId(UUID.randomUUID()); DeductionObject response = payrollNzApi.createDeduction(accessToken, xeroTenantId, deduction, null); assertThat(response.getDeduction().getDeductionId(), is(equalTo(UUID.fromString("0ee805eb-f5b0-4061-9b35-d9ea550da04e")))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java index 04e263c0d..c2c3bc3ca 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java @@ -1,43 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; +import com.xero.models.payrollnz.EarningsRate.EarningsTypeEnum; +import com.xero.models.payrollnz.EarningsRate.RateTypeEnum; -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEarningRatesTest { @@ -55,7 +28,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -112,6 +85,11 @@ public void createEarningsRateTest() throws IOException { System.out.println("@Test NZ Payroll - createEarningsRateTest"); EarningsRate earningsRate = new EarningsRate(); + earningsRate.setName("My Earnings Rate"); + earningsRate.setEarningsType(EarningsTypeEnum.REGULAREARNINGS); + earningsRate.setRateType(RateTypeEnum.RATEPERUNIT); + earningsRate.setTypeOfUnits("hours"); + earningsRate.setExpenseAccountID(UUID.fromString("e4eb36f6-97e3-4427-a394-dd4e1b355c2e")); EarningsRateObject response = payrollNzApi.createEarningsRate(accessToken, xeroTenantId, earningsRate, null); assertThat(response.getEarningsRate().getEarningsRateID(),is(equalTo(UUID.fromString("4369b0ef-a64d-42e1-bb6d-f2fc984de133")))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java index 58b507b74..baad8765d 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmployeeLeaveBalancesTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java index dcdddcbca..bed2d6af0 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmployeeLeavePeriodsTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -77,7 +48,7 @@ public void getEmployeeLeavePeriodsTest() throws IOException { assertThat(response.getPeriods().get(0).getPeriodStartDate(), is(equalTo(LocalDate.of(2020, 02, 24)))); assertThat(response.getPeriods().get(0).getPeriodEndDate(), is(equalTo(LocalDate.of(2020, 03, 01)))); - assertThat(response.getPeriods().get(0).getNumberOfUnits() , is(equalTo(0.0))); + assertThat(response.getPeriods().get(0).getNumberOfUnits() , is(equalTo(24.0))); //System.out.println(response.toString()); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java index f8ceaca21..39a9edcb0 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmployeeLeaveSetupTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java index bf06c15f8..3b55fb6a3 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java @@ -1,45 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmployeeLeaveTest { @@ -57,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -93,6 +63,10 @@ public void createEmployeeLeaveTest() throws IOException { System.out.println("@Test NZ Payroll - createEmployeeLeaveTest"); EmployeeLeave employeeLeave = new EmployeeLeave(); + employeeLeave.setLeaveTypeID(UUID.fromString("b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4")); + employeeLeave.setDescription("Creating a Description"); + employeeLeave.setStartDate(LocalDate.of(2020, 04, 24)); + employeeLeave.setEndDate(LocalDate.of(2020, 04, 26)); UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); EmployeeLeaveObject response = payrollNzApi.createEmployeeLeave(accessToken, xeroTenantId, employeeId, employeeLeave, null); @@ -119,6 +93,10 @@ public void updateEmployeeLeaveTest() throws IOException { UUID leaveId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); EmployeeLeave employeeLeave = new EmployeeLeave(); + employeeLeave.setLeaveTypeID(UUID.fromString("b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4")); + employeeLeave.setDescription("Creating a Description"); + employeeLeave.setStartDate(LocalDate.of(2020, 04, 24)); + employeeLeave.setEndDate(LocalDate.of(2020, 04, 26)); EmployeeLeaveObject response = payrollNzApi.updateEmployeeLeave(accessToken, xeroTenantId, employeeId, leaveId, employeeLeave, null); assertThat(response.getLeave().getLeaveID(), is(equalTo(UUID.fromString("82a04ba6-a5cc-4e7d-86d4-b9f381a494e8")))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java index ffd4b3e36..2ada5713a 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmployeeLeaveTypesTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java index 69622c116..7c121d7fd 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmployeeOpeningBalancesTest { @@ -56,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java index 0bcaff831..f4ae5f4f9 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java @@ -1,44 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmployeePayTemplatesTest { @@ -56,7 +28,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java index 2cc685efc..0bda039d9 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmployeeTaxTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java index 61c15c312..b9a94882a 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmployeeTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -94,6 +65,14 @@ public void createEmployeeTest() throws IOException { System.out.println("@Test UK Payroll - createEmployeeTest"); Employee employee = new Employee(); + Address address = new Address(); + address.setAddressLine1("101 Green St"); + address.setCity("San Francisco"); + address.setPostCode("4351"); + employee.setAddress(address); + employee.setFirstName("Mike"); + employee.setLastName("Johntzxzpxhmkgson"); + employee.setDateOfBirth(LocalDate.now()); EmployeeObject response = payrollNzApi.createEmployee(accessToken, xeroTenantId, employee, null); assertThat(response.getEmployee().getEmployeeID(), is(equalTo(UUID.fromString("658be485-3feb-402e-9e77-ac17623aad42")))); @@ -141,6 +120,14 @@ public void updateEmployeeTest() throws IOException { UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); Employee employee = new Employee(); + Address address = new Address(); + address.setAddressLine1("101 Green St"); + address.setCity("San Francisco"); + address.setPostCode("4351"); + employee.setAddress(address); + employee.setFirstName("Mike"); + employee.setLastName("Johntzxzpxhmkgson"); + employee.setDateOfBirth(LocalDate.now()); EmployeeObject response = payrollNzApi.updateEmployee(accessToken, xeroTenantId, employeeId, employee, null); assertThat(response.getEmployee().getEmployeeID(), is(equalTo(UUID.fromString("68342973-c405-4b86-b5d3-d7b877c27995")))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java index 25411d6b6..b6e16d202 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiEmploymentTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -72,6 +43,9 @@ public void createEmploymentTest() throws IOException { Employment employment = new Employment(); UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); + employment.setPayrollCalendarID(UUID.fromString("9aa56064-990f-4ad3-a189-d966d8f6a030")); + employment.setStartDate(LocalDate.now()); + employment.setEngagementType("FixedTerm"); EmploymentObject response = payrollNzApi.createEmployment(accessToken, xeroTenantId, employeeId, employment, null); assertThat(response.getEmployment().getPayrollCalendarID(), is(equalTo(UUID.fromString("9aa56064-990f-4ad3-a189-d966d8f6a030")))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java index d12394fee..96a26192c 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiLeaveTypesTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -105,6 +76,11 @@ public void createLeaveTypeTest() throws IOException { System.out.println("@Test NZ Payroll - createLeaveTypeTest"); LeaveType leaveType = new LeaveType(); + leaveType.setLeaveTypeID(UUID.randomUUID()); + leaveType.setName("My opebvwbfxf Leave"); + leaveType.setIsPaidLeave(true); + leaveType.isActive(true); + leaveType.setShowOnPayslip(true); LeaveTypeObject response = payrollNzApi.createLeaveType(accessToken, xeroTenantId, leaveType, null); assertThat(response.getLeaveType().getLeaveTypeID(),is(equalTo(UUID.fromString("80464f55-b5c9-4d05-84c7-219d98baa3e2")))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java index 0dad9252b..7aab061db 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java @@ -1,45 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiPayRunCalendarsTest { @@ -57,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -110,6 +80,10 @@ public void createPayRunCalendarTest() throws IOException { System.out.println("@Test NZ Payroll - createPayRunCalendarTest"); PayRunCalendar payRunCalendar = new PayRunCalendar(); + payRunCalendar.setName("My Weekly Cal"); + payRunCalendar.setCalendarType(com.xero.models.payrollnz.CalendarType.WEEKLY); + payRunCalendar.setPeriodStartDate(LocalDate.of(2020, 05, 01)); + payRunCalendar.setPaymentDate(LocalDate.of(2020, 05, 15)); PayRunCalendarObject response = payrollNzApi.createPayRunCalendar(accessToken, xeroTenantId, payRunCalendar, null); assertThat(response.getPayRunCalendar().getPayrollCalendarID(),is(equalTo(UUID.fromString("54e9706a-c4e8-45ff-9c63-6fcac7ee7cde")))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java index 428f8fae0..09e258ba5 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java @@ -1,45 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiPayRunsTest { @@ -57,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java index 2bbfbcd66..c6993f9db 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java @@ -1,45 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiPaySlipsTest { @@ -57,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java index 7dd98fc23..2e1033d37 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java @@ -1,45 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiPaymentMethodsTest { @@ -57,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java index f6e689539..e79c7b1c8 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiReimbursementsTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -122,6 +92,8 @@ public void createReimbursementTest() throws IOException { System.out.println("@Test NZ Payroll - createReimbursementTest"); Reimbursement reimbursement = new Reimbursement(); + reimbursement.setName("My new Reimburse"); + reimbursement.setAccountID(UUID.randomUUID()); ReimbursementObject response = payrollNzApi.createReimbursement(accessToken, xeroTenantId, reimbursement, null); // assertThat(response.getReimbursement().getReimbursementID(),is(equalTo(UUID.fromString("2b1b587a-39f6-43f8-9dd9-a858314333c8")))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java index 545163985..73f30eb62 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; - -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; +import com.xero.models.payrollnz.SalaryAndWage.PaymentTypeEnum; +import com.xero.models.payrollnz.SalaryAndWage.StatusEnum; import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiSalaryAndWagesTest { @@ -56,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -91,7 +64,14 @@ public void getSalaryAndWagesTest() throws IOException { public void createEmployeeSalaryAndWageTest() throws IOException { System.out.println("@Test NZ Payroll - createEmployeeSalaryAndWageTest"); - SalaryAndWage salaryAndWage = new SalaryAndWage(); + SalaryAndWage salaryAndWage = new SalaryAndWage(); + salaryAndWage.setEarningsRateID(UUID.randomUUID()); + salaryAndWage.setNumberOfUnitsPerWeek(1.00); + salaryAndWage.setNumberOfUnitsPerDay(1.00); + salaryAndWage.setEffectiveFrom(LocalDate.now()); + salaryAndWage.setAnnualSalary(2.00); + salaryAndWage.setStatus(StatusEnum.ACTIVE); + salaryAndWage .setPaymentType(PaymentTypeEnum.HOURLY); UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); SalaryAndWageObject response = payrollNzApi.createEmployeeSalaryAndWage(accessToken, xeroTenantId, employeeId, salaryAndWage, null); @@ -134,7 +114,14 @@ public void getEmployeeSalaryAndWageTest() throws IOException { public void updateEmployeeSalaryAndWageTest() throws IOException { System.out.println("@Test NZ Payroll - updateEmployeeSalaryAndWageTest"); - SalaryAndWage salaryAndWage = new SalaryAndWage(); + SalaryAndWage salaryAndWage = new SalaryAndWage(); + salaryAndWage.setEarningsRateID(UUID.randomUUID()); + salaryAndWage.setNumberOfUnitsPerWeek(1.00); + salaryAndWage.setNumberOfUnitsPerDay(1.00); + salaryAndWage.setEffectiveFrom(LocalDate.now()); + salaryAndWage.setAnnualSalary(2.00); + salaryAndWage.setStatus(StatusEnum.ACTIVE); + salaryAndWage .setPaymentType(PaymentTypeEnum.HOURLY); UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); UUID salaryAndWagesId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); SalaryAndWageObject response = payrollNzApi.updateEmployeeSalaryAndWage(accessToken, xeroTenantId, employeeId, salaryAndWagesId, salaryAndWage, null); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java index 032022506..3c98904ef 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java @@ -1,45 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiSettingsTest { @@ -57,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java index ebf5f3fb1..b461ca026 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiStatutoryDeductionsTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -73,7 +43,7 @@ public void getStatutoryDeductionsTest() throws IOException { int page = 1; StatutoryDeductions response = payrollNzApi.getStatutoryDeductions(accessToken, xeroTenantId, page); - assertThat(response.getStatutoryDeductions().get(0).getId(), is(equalTo(UUID.fromString("e3731829-9801-4809-a1a1-bbe40cd18b7e")))); + assertThat(response.getStatutoryDeductions().get(0).getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getStatutoryDeductions().get(0).getLiabilityAccountId(), is(equalTo(UUID.fromString("fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488")))); assertThat(response.getStatutoryDeductions().get(0).getName(), is(equalTo("Child Support"))); assertThat(response.getStatutoryDeductions().get(0).getStatutoryDeductionCategory(), is(equalTo(com.xero.models.payrollnz.StatutoryDeductionCategory.CHILDSUPPORT))); @@ -89,7 +59,7 @@ public void getStatutoryDeductionTest() throws IOException { UUID deductionId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); StatutoryDeductionObject response = payrollNzApi.getStatutoryDeduction(accessToken, xeroTenantId, deductionId); - assertThat(response.getStatutoryDeduction().getId(), is(equalTo(UUID.fromString("e3731829-9801-4809-a1a1-bbe40cd18b7e")))); + assertThat(response.getStatutoryDeduction().getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getStatutoryDeduction().getLiabilityAccountId(), is(equalTo(UUID.fromString("fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488")))); assertThat(response.getStatutoryDeduction().getName(), is(equalTo("Child Support"))); assertThat(response.getStatutoryDeduction().getStatutoryDeductionCategory(), is(equalTo(com.xero.models.payrollnz.StatutoryDeductionCategory.CHILDSUPPORT))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java index a647eea88..445d6a188 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiSuperannuationsTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -73,7 +43,7 @@ public void getSuperannuationsTest() throws IOException { int page = 1; Superannuations response = payrollNzApi.getSuperannuations(accessToken, xeroTenantId, page); - assertThat(response.getBenefits().get(0).getId(), is(equalTo(UUID.fromString("563273ea-0dae-4f82-86a4-e0db77c008ea")))); + assertThat(response.getBenefits().get(0).getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getBenefits().get(0).getLiabilityAccountId(), is(equalTo(UUID.fromString("fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488")))); assertThat(response.getBenefits().get(0).getExpenseAccountId(), is(equalTo(UUID.fromString("b343c3b0-5941-4166-82b4-dd926622e0e2")))); assertThat(response.getBenefits().get(0).getName(), is(equalTo("KiwiSaver"))); @@ -91,7 +61,7 @@ public void getSuperannuationTest() throws IOException { UUID superannuationId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); SuperannuationObject response = payrollNzApi.getSuperannuation(accessToken, xeroTenantId, superannuationId); - assertThat(response.getBenefit().getId(), is(equalTo(UUID.fromString("563273ea-0dae-4f82-86a4-e0db77c008ea")))); + assertThat(response.getBenefit().getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getBenefit().getLiabilityAccountId(), is(equalTo(UUID.fromString("fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488")))); assertThat(response.getBenefit().getExpenseAccountId(), is(equalTo(UUID.fromString("b343c3b0-5941-4166-82b4-dd926622e0e2")))); assertThat(response.getBenefit().getName(), is(equalTo("KiwiSaver"))); @@ -107,9 +77,15 @@ public void createSuperannuationTest() throws IOException { System.out.println("@Test NZ Payroll - createSuperannuationTest"); Benefit benefit = new Benefit(); + benefit.setName("New Benefit"); + benefit.setCategory(com.xero.models.payrollnz.Benefit.CategoryEnum.OTHER); + benefit.setLiabilityAccountId(UUID.randomUUID()); + benefit.setExpenseAccountId(UUID.randomUUID()); + benefit.setCalculationTypeNZ(com.xero.models.payrollnz.Benefit.CalculationTypeNZEnum.FIXEDAMOUNT); + benefit.setPercentage(12.00); SuperannuationObject response = payrollNzApi.createSuperannuation(accessToken, xeroTenantId, benefit, null); - assertThat(response.getBenefit().getId(), is(equalTo(UUID.fromString("8905a754-7ce8-40e2-9fa5-f819deb7adce")))); + assertThat(response.getBenefit().getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getBenefit().getLiabilityAccountId(), is(equalTo(UUID.fromString("568f2e9a-0870-46cc-8678-f83f132ed4e3")))); assertThat(response.getBenefit().getExpenseAccountId(), is(equalTo(UUID.fromString("e4eb36f6-97e3-4427-a394-dd4e1b355c2e")))); assertThat(response.getBenefit().getName(), is(equalTo("SidSaver"))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java index ba7e20b11..efb12f7c1 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java @@ -1,45 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; -import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; +import java.util.List; public class PayrollNzApiTimesheetsTest { @@ -57,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } @@ -116,7 +88,18 @@ public void createTimesheetTest() throws IOException { int page = 1; UUID timesheetID = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); + List timesheetLines = new ArrayList<>(); + TimesheetLine timesheetLine = new TimesheetLine(); + timesheetLine.setEarningsRateID(UUID.randomUUID()); + timesheetLine.setNumberOfUnits(12.00); + timesheetLine.setDate(LocalDate.now()); + timesheetLines.add(timesheetLine); Timesheet timesheet = new Timesheet(); + timesheet.setTimesheetLines(timesheetLines); + timesheet.setPayrollCalendarID(UUID.randomUUID()); + timesheet.setEndDate(LocalDate.of(2020, 04, 19)); + timesheet.setStartDate(LocalDate.of(2020, 04, 13)); + timesheet.setEmployeeID(UUID.randomUUID()); TimesheetObject response = payrollNzApi.createTimesheet(accessToken, xeroTenantId, timesheet, null); assertThat(response.getTimesheet().getTimesheetID(),is(equalTo(UUID.fromString("d227445a-4188-453a-a196-48163a38188c")))); @@ -141,6 +124,9 @@ public void createTimesheetLineTest() throws IOException { UUID timesheetID = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); TimesheetLine timesheetLine = new TimesheetLine(); + timesheetLine.setEarningsRateID(UUID.randomUUID()); + timesheetLine.setNumberOfUnits(12.00); + timesheetLine.setDate(LocalDate.now()); TimesheetLineObject response = payrollNzApi.createTimesheetLine(accessToken, xeroTenantId, timesheetID, timesheetLine, null); assertThat(response.getTimesheetLine().getTimesheetLineID(),is(equalTo(UUID.fromString("10c3c63e-6cd0-4630-861f-08a2baa657fa")))); @@ -158,6 +144,9 @@ public void updateTimesheetLineTest() throws IOException { UUID timesheetID = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); UUID timesheetLineID = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); TimesheetLine timesheetLine = new TimesheetLine(); + timesheetLine.setEarningsRateID(UUID.randomUUID()); + timesheetLine.setNumberOfUnits(12.00); + timesheetLine.setDate(LocalDate.now()); TimesheetLineObject response = payrollNzApi.updateTimesheetLine(accessToken, xeroTenantId, timesheetID, timesheetLineID, timesheetLine, null); assertThat(response.getTimesheetLine().getTimesheetLineID(),is(equalTo(UUID.fromString("3397aab1-6cac-4804-a72b-00f396b04a08")))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java index 9931127b7..a79059b86 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java @@ -1,45 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollnz.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; -import org.threeten.bp.temporal.ChronoUnit; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollNzApiTrackingCategoriesTest { @@ -57,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5d4d8dd7-b3b2-4151-87c6-31841929f349.mock.pstmn.io/payroll.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java index 43692cba4..c10d0679b 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java @@ -90,9 +90,9 @@ public void createEmployeeTest() throws IOException { assertThat(response.getEmployee().getFirstName(), is(equalTo("Mike"))); assertThat(response.getEmployee().getLastName(), is(equalTo("Fancy"))); assertThat(response.getEmployee().getDateOfBirth(), is(equalTo(LocalDate.of(1999, 01, 01)))); - assertThat(response.getEmployee().getAddress().getAddressLine1(), is(equalTo("101 Green St"))); - assertThat(response.getEmployee().getAddress().getCity(), is(equalTo("San Francisco"))); - assertThat(response.getEmployee().getAddress().getPostCode(), is(equalTo("6TGR4F"))); + assertThat(response.getEmployee().getAddress().getAddressLine1(), is(equalTo("171 Midsummer"))); + assertThat(response.getEmployee().getAddress().getCity(), is(equalTo("Milton Keyness"))); + assertThat(response.getEmployee().getAddress().getPostCode(), is(equalTo("MK9 1EB"))); assertThat(response.getEmployee().getEmail(), is(equalTo("mike@starkindustries.com"))); assertThat(response.getEmployee().getGender() , is(equalTo(com.xero.models.payrolluk.Employee.GenderEnum.M))); assertThat(response.getEmployee().getUpdatedDateUTC(), is(equalTo(LocalDateTime.of(2020, 03, 25, 03, 12, 10) ))); @@ -150,7 +150,7 @@ public void updateEmployeeTest() throws IOException { EmployeeObject response = payrollUkApi.updateEmployee(accessToken, xeroTenantId, employeeId, employee, null); - assertThat(response.getEmployee().getEmployeeID(), is(equalTo(UUID.fromString("aad6b292-7b94-408b-93f6-e489867e3fb0")))); + assertThat(response.getEmployee().getEmployeeID(), is(equalTo(UUID.fromString("07f0f9fc-cc95-46ac-9a8a-aa03779f2bde")))); assertThat(response.getEmployee().getTitle(), is(equalTo("Mr"))); assertThat(response.getEmployee().getFirstName(), is(equalTo("Mike"))); assertThat(response.getEmployee().getLastName(), is(equalTo("Johnllsbkrhwopson"))); diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java index 58881e952..5489eb2d9 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java @@ -43,8 +43,8 @@ public void createEmploymentTest() throws IOException { System.out.println("@Test UK Payroll - createEmploymentTest"); Employment employment = new Employment(); - employment.setEmployeeNumber("007"); employment.setPayrollCalendarID(UUID.randomUUID()); + employment.setEmployeeNumber("007"); employment.setStartDate(LocalDate.of(2024, 04, 01)); employment.setNiCategory(NiCategoryEnum.A); UUID employeeId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); From f133c1b90e579fbfcfec39a8f6a3e4c507879a46 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 20 Sep 2024 11:25:22 +0530 Subject: [PATCH 07/45] Fixed test cases in project api --- .../client/ProjectsApiProjectTasksTest.java | 40 ++---------- .../client/ProjectsApiProjectUsersTest.java | 38 ++---------- .../api/client/ProjectsApiProjectsTest.java | 45 +++----------- .../client/ProjectsApiTimeEntriesTest.java | 62 ++++++------------- 4 files changed, 36 insertions(+), 149 deletions(-) diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java index 68ed245a6..1ed860975 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.project.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class ProjectsApiProjectTasksTest { @@ -57,7 +27,7 @@ public void setUp() { // Init projectsApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://3fe1c2ee-7113-4035-9e6d-53dad2fb2af3.mock.pstmn.io/projects.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4018",null,null,null,null); projectApi = ProjectApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -93,13 +63,13 @@ public void getTasksTest() throws IOException { assertThat(response.getPagination().getItemCount(), is(equalTo(1))); assertThat(response.getPagination().getPageCount(), is(equalTo(1))); assertThat(response.getPagination().getPageSize(), is(equalTo(50))); - assertThat(response.getItems().get(0).getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); + assertThat(response.getItems().get(0).getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getItems().get(0).getName(), is(equalTo("Demolition"))); assertThat(response.getItems().get(0).getRate().getCurrency(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getItems().get(0).getRate().getValue(), is(equalTo(20.0))); assertThat(response.getItems().get(0).getChargeType(), is(equalTo(com.xero.models.project.ChargeType.TIME))); assertThat(response.getItems().get(0).getEstimateMinutes(), is(equalTo(12000))); - assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); + assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getItems().get(0).getTotalMinutes(), is(equalTo(180))); assertThat(response.getItems().get(0).getTotalAmount().getCurrency(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getItems().get(0).getTotalAmount().getValue(), is(equalTo(60.0))); @@ -124,13 +94,13 @@ public void getTaskTest() throws IOException { Task response = projectApi.getTask(accessToken, xeroTenantId, projectId, taskId); - assertThat(response.getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); + assertThat(response.getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getName(), is(equalTo("Demolition"))); assertThat(response.getRate().getCurrency(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getRate().getValue(), is(equalTo(20.0))); assertThat(response.getChargeType(), is(equalTo(com.xero.models.project.ChargeType.TIME))); assertThat(response.getEstimateMinutes(), is(equalTo(12000))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getTotalMinutes(), is(equalTo(300))); assertThat(response.getTotalAmount().getCurrency(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getTotalAmount().getValue(), is(equalTo(100.0))); diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java index d48ea6f6d..76b6aaaf2 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.project.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class ProjectsApiProjectUsersTest { @@ -57,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://3fe1c2ee-7113-4035-9e6d-53dad2fb2af3.mock.pstmn.io/projects.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4018",null,null,null,null); projectApi = ProjectApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -92,9 +62,9 @@ public void getProjectUsersTest() throws IOException { assertThat(response.getPagination().getItemCount(), is(equalTo(2))); assertThat(response.getPagination().getPageCount(), is(equalTo(1))); assertThat(response.getPagination().getPageSize(), is(equalTo(50))); - assertThat(response.getItems().get(0).getUserId(), is(equalTo(UUID.fromString("740add2a-a703-4b8a-a670-1093919c2040")))); - assertThat(response.getItems().get(0).getName(), is(equalTo("Sidney Maestre"))); - assertThat(response.getItems().get(0).getEmail(), is(equalTo("sid.maestre@xero.com"))); + assertThat(response.getItems().get(0).getUserId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getName(), is(equalTo("Test User"))); + assertThat(response.getItems().get(0).getEmail(), is(equalTo("test@xero.com"))); // System.out.println(response.toString()); } diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java index 6b364be64..ebd7aacb4 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java @@ -1,44 +1,16 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.project.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class ProjectsApiProjectsTest { @@ -57,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://3fe1c2ee-7113-4035-9e6d-53dad2fb2af3.mock.pstmn.io/projects.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4018",null,null,null,null); projectApi = projectApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -94,8 +66,8 @@ public void getProjectsTest() throws IOException { assertThat(response.getPagination().getItemCount(), is(equalTo(9))); assertThat(response.getPagination().getPageCount(), is(equalTo(1))); assertThat(response.getPagination().getPageSize(), is(equalTo(50))); - assertThat(response.getItems().get(0).getContactId(), is(equalTo(UUID.fromString("216830cb-9a68-487e-928b-c1a7ccc4fc81")))); - assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); + assertThat(response.getItems().get(0).getContactId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getItems().get(0).getName(), is(equalTo("FooProject28916"))); assertThat(response.getItems().get(0).getCurrencyCode(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getItems().get(0).getMinutesLogged(), is(equalTo(180))); @@ -134,10 +106,11 @@ public void createProjectsTest() throws IOException { System.out.println("@Test - createProjectsTest"); ProjectCreateOrUpdate projectCreateOrUpdate = new ProjectCreateOrUpdate(); + projectCreateOrUpdate.setName("New Kitchen"); Project response = projectApi.createProject(accessToken, xeroTenantId, projectCreateOrUpdate, null); - assertThat(response.getContactId(), is(equalTo(UUID.fromString("216830cb-9a68-487e-928b-c1a7ccc4fc81")))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("ed957eee-bc6f-4f52-a663-aa42e6af9620")))); + assertThat(response.getContactId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getName(), is(equalTo("New Kitchen"))); assertThat(response.getCurrencyCode(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getMinutesLogged(), is(equalTo(0))); @@ -178,9 +151,9 @@ public void getProjectTest() throws IOException { UUID projectId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Project response = projectApi.getProject(accessToken, xeroTenantId, projectId); - assertThat(response.getContactId(), is(equalTo(UUID.fromString("216830cb-9a68-487e-928b-c1a7ccc4fc81")))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); - assertThat(response.getName(), is(equalTo("FooProject28916"))); + assertThat(response.getContactId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getName(), is(equalTo("Remodeling 2012"))); assertThat(response.getCurrencyCode(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getMinutesLogged(), is(equalTo(180))); assertThat(response.getTotalTaskAmount().getCurrency(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); diff --git a/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java b/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java index 7130b06d8..302231664 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java @@ -1,47 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.project.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import jakarta.ws.rs.core.Response; - import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class ProjectsApiTimeEntriesTest { @@ -60,7 +30,7 @@ public void setUp() { // Init projectsApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://3fe1c2ee-7113-4035-9e6d-53dad2fb2af3.mock.pstmn.io/projects.xro/2.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4018",null,null,null,null); projectApi = ProjectApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs @@ -104,12 +74,12 @@ public void getTimeEntriesTest() throws IOException { assertThat(response.getPagination().getItemCount(), is(equalTo(9))); assertThat(response.getPagination().getPageCount(), is(equalTo(1))); assertThat(response.getPagination().getPageSize(), is(equalTo(50))); - assertThat(response.getItems().get(0).getTimeEntryId(),is(equalTo(UUID.fromString("3cd35eca-704f-4bca-b258-236028ae8ed1")))); - assertThat(response.getItems().get(0).getUserId(), is(equalTo(UUID.fromString("740add2a-a703-4b8a-a670-1093919c2040")))); - assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); - assertThat(response.getItems().get(0).getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); + assertThat(response.getItems().get(0).getTimeEntryId(),is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getUserId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getItems().get(0).getDateUtc(), is(equalTo(OffsetDateTime.parse("2020-02-27T15:00Z")))); - assertThat(response.getItems().get(0).getDateEnteredUtc(), is(equalTo(OffsetDateTime.parse("2020-02-21T21:41:22.264272700Z")))); + assertThat(response.getItems().get(0).getDateEnteredUtc(), is(equalTo(OffsetDateTime.parse("2020-02-28T03:24:29.221564100Z")))); assertThat(response.getItems().get(0).getDuration(), is(equalTo(45))); assertThat(response.getItems().get(0).getStatus(),is(equalTo(com.xero.models.project.TimeEntry.StatusEnum.ACTIVE))); //System.out.println(response.toString()); @@ -120,13 +90,17 @@ public void createTimeEntryTest() throws IOException { System.out.println("@Test - createTimeEntryTest"); TimeEntryCreateOrUpdate timeEntryCreateOrUpdate = new TimeEntryCreateOrUpdate(); + timeEntryCreateOrUpdate.setUserId(UUID.fromString("c6539534-f1d2-43a6-80df-3bd1f8aca24d")); + timeEntryCreateOrUpdate.setTaskId(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")); + timeEntryCreateOrUpdate.setDateUtc(OffsetDateTime.parse("2020-02-26T15:00Z")); + timeEntryCreateOrUpdate.setDuration(1); UUID projectId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); TimeEntry response = projectApi.createTimeEntry(accessToken, xeroTenantId, projectId, timeEntryCreateOrUpdate, null); - assertThat(response.getTimeEntryId(),is(equalTo(UUID.fromString("c6539534-f1d2-43a6-80df-3bd1f8aca24d")))); - assertThat(response.getUserId(), is(equalTo(UUID.fromString("740add2a-a703-4b8a-a670-1093919c2040")))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); - assertThat(response.getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); + assertThat(response.getTimeEntryId(),is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getUserId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getDateUtc(), is(equalTo(OffsetDateTime.parse("2020-02-26T15:00Z")))); assertThat(response.getDateEnteredUtc(), is(equalTo(OffsetDateTime.parse("2020-02-28T20:37:42.865283200Z")))); assertThat(response.getDuration(), is(equalTo(30))); @@ -142,10 +116,10 @@ public void getTimeEntryTest() throws IOException { UUID timeEntryId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); TimeEntry response = projectApi.getTimeEntry(accessToken, xeroTenantId, projectId, timeEntryId); - assertThat(response.getTimeEntryId(),is(equalTo(UUID.fromString("3cd35eca-704f-4bca-b258-236028ae8ed1")))); - assertThat(response.getUserId(), is(equalTo(UUID.fromString("740add2a-a703-4b8a-a670-1093919c2040")))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); - assertThat(response.getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); + assertThat(response.getTimeEntryId(),is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getUserId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); assertThat(response.getDateUtc(), is(equalTo(OffsetDateTime.parse("2020-02-27T15:00Z")))); assertThat(response.getDateEnteredUtc(), is(equalTo(OffsetDateTime.parse("2020-02-21T21:41:22.264272700Z")))); assertThat(response.getDuration(), is(equalTo(45))); From 5119b376723d2ba258fbf6067f00cedd7847259c Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 20 Sep 2024 11:35:32 +0530 Subject: [PATCH 08/45] Fixed test cases in payroll au api --- .../api/client/PayrollAuApiEmployeeTest.java | 29 +-------------- .../PayrollAuApiLeaveApplicationTest.java | 35 +++---------------- .../api/client/PayrollAuApiPayItemTest.java | 31 +--------------- .../api/client/PayrollAuApiPayRunTest.java | 29 +-------------- .../PayrollAuApiPayrollCalendarTest.java | 29 +-------------- .../api/client/PayrollAuApiPayslipTest.java | 29 +-------------- .../api/client/PayrollAuApiSettingsTest.java | 32 +---------------- .../api/client/PayrollAuApiSuperFundTest.java | 29 +-------------- .../PayrollAuApiSuperfundProductTest.java | 33 +---------------- .../api/client/PayrollAuApiTimesheetTest.java | 29 +-------------- 10 files changed, 13 insertions(+), 292 deletions(-) diff --git a/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java index 4a26781ec..617f49c8f 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiEmployeeTest { @@ -56,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java b/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java index a73ea5252..aaf18f023 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiLeaveApplicationTest { @@ -56,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } @@ -102,7 +75,7 @@ public void getLeaveApplicationTest() throws IOException { assertThat(response.getLeaveApplications().get(0).getEndDateAsDate(), is(equalTo(LocalDate.of(2019,11,12)))); assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodStartDateAsDate() , is(equalTo(LocalDate.of(2019,11,8)))); assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodEndDateAsDate() , is(equalTo(LocalDate.of(2019,11,14)))); - assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(0.0))); + assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(7.6))); assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getLeavePeriodStatus(), is(equalTo(com.xero.models.payrollau.LeavePeriodStatus.SCHEDULED))); assertThat(response.getLeaveApplications().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2019-11-13T05:30:08Z")))); //System.out.println(response.toString()); @@ -123,7 +96,7 @@ public void createLeaveApplicationTest() throws IOException { assertThat(response.getLeaveApplications().get(0).getEndDateAsDate(), is(equalTo(LocalDate.of(2019,11,01)))); assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodStartDateAsDate() , is(equalTo(LocalDate.of(2019,11,1)))); assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodEndDateAsDate() , is(equalTo(LocalDate.of(2019,11,07)))); - assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(0.6))); + assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(7.6))); assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getLeavePeriodStatus(), is(equalTo(com.xero.models.payrollau.LeavePeriodStatus.SCHEDULED))); assertThat(response.getLeaveApplications().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2019-11-13T21:16:31.897Z")))); //System.out.println(response.toString()); @@ -146,7 +119,7 @@ public void updateLeaveApplicationTest() throws IOException { assertThat(response.getLeaveApplications().get(0).getDescription(), is(equalTo("My updated Description"))); assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodStartDateAsDate() , is(equalTo(LocalDate.of(2019,11,01)))); assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodEndDateAsDate() , is(equalTo(LocalDate.of(2019,11,07)))); - assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(0.6))); + assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(7.6))); assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getLeavePeriodStatus(), is(equalTo(com.xero.models.payrollau.LeavePeriodStatus.SCHEDULED))); assertThat(response.getLeaveApplications().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2019-11-13T21:16:32.293Z")))); //System.out.println(response.toString()); diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java index a18b3bb37..b276a251b 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java @@ -1,44 +1,15 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiPayItemTest { @@ -56,7 +27,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java index 59ce86246..9c0af8643 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiPayRunTest { @@ -56,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java index e91252346..721e77f47 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiPayrollCalendarTest { @@ -56,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java index aa7019bf1..aeaa26bca 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiPayslipTest { @@ -56,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java b/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java index ceb82cadd..4662fe8a9 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java @@ -1,44 +1,14 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiSettingsTest { @@ -56,7 +26,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java b/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java index 4ced621a2..174354da1 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiSuperFundTest { @@ -56,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java b/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java index 4e8c466d6..73e3cb160 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java @@ -1,44 +1,13 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - -import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiSuperfundProductTest { @@ -56,7 +25,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java b/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java index 1568d49bf..f3d5df821 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java @@ -1,44 +1,17 @@ package com.xero.api.client; -import static org.junit.Assert.assertTrue; - import org.junit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Every.everyItem; - import com.xero.api.ApiClient; -import com.xero.api.client.*; import com.xero.models.payrollau.*; -import java.io.File; -import java.net.URL; - -import com.google.api.client.auth.oauth2.BearerToken; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; - import org.threeten.bp.*; import java.io.IOException; -import com.fasterxml.jackson.core.type.TypeReference; - -import java.io.File; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import java.util.Calendar; -import java.util.Map; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.math.BigDecimal; public class PayrollAuApiTimesheetTest { @@ -56,7 +29,7 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null); + defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); payrollAuApi = PayrollAuApi.getInstance(defaultClient); } From 9c2a68076dbe0eaceb86d53478ac02d84cfc5155 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 20 Sep 2024 14:59:55 +0530 Subject: [PATCH 09/45] fixed final issue findings --- src/main/java/com/xero/api/client/AccountingApi.java | 7 +++++++ src/main/java/com/xero/api/client/BankFeedsApi.java | 4 ++-- .../com/xero/api/client/AccountingApiAccountsTest.java | 10 +++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index bf7710599..62781eba9 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -526,6 +526,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); + headers.setContentType("application/octet-stream"); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables @@ -815,6 +816,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1508,6 +1510,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2327,6 +2330,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5468,6 +5472,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8354,6 +8359,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8778,6 +8784,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java index d2451d1e8..ccb52485d 100644 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -327,7 +327,7 @@ public HttpResponse createStatementsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/jsonapplication/problem+json"); + headers.setAccept("application/json;application/problem+json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Statements"); String url = uriBuilder.build().toString(); @@ -872,7 +872,7 @@ public HttpResponse getStatementsForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Xero-Application-Id", xeroApplicationId); headers.set("Xero-User-Id", xeroUserId); - headers.setAccept("application/jsonapplication/problem+json"); + headers.setAccept("application/json;application/problem+json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Statements"); if (page != null) { diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java index 8df6b5671..01f7b24a1 100644 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -127,17 +127,13 @@ public void testGetAccountAttachments() throws Exception { public void testCreateAccountAttachmentByFileName() throws Exception { System.out.println("@Test - createAccountAttachmentByFileName"); - Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,null, null, null); - UUID accountID = accounts.getAccounts().get(0).getAccountID(); - // UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); + UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); ClassLoader classLoader = getClass().getClassLoader(); File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); - String newFileName = bytes.getName(); - String idempotencyKey = null; - // String idempotencyKey = "KEY_VALUE"; - Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accessToken,xeroTenantId,accountID, newFileName, bytes, idempotencyKey); + String newFileName = "sample5.jpg"; + Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accessToken,xeroTenantId,accountID, newFileName, bytes, null); assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("ab95b276-9dce-4925-9077-439818ba270f"))); assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); From 770bd4e4e8bb3908d4787cd2f01d782561f0d409 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Fri, 20 Sep 2024 15:58:25 +0530 Subject: [PATCH 10/45] removed unused code --- .../com/xero/api/client/AccountingApiBankTransactionTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java index 11ccce760..3d60e0b4a 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java @@ -132,8 +132,7 @@ public void createBankTransactionAttachmentByFileNameTest() throws IOException { UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9"); ClassLoader classLoader = getClass().getClassLoader(); File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); - String fileName = "helo-heros.jpg"; - System.out.println("File path: " + bytes.getAbsolutePath()); + String fileName = "sample5.jpg"; Attachments response = accountingApi.createBankTransactionAttachmentByFileName(accessToken,xeroTenantId,bankTransactionID, fileName, bytes, null); assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b")))); assertThat(response.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg"))); From 8efad97a91c10266beb783263463e90085e8fd98 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 23 Sep 2024 13:34:06 +0530 Subject: [PATCH 11/45] PETOS-560 Adds Content Type for API Calls --- .../com/xero/api/client/AccountingApi.java | 259 ++++++++++++++++++ .../java/com/xero/api/client/AppStoreApi.java | 4 + .../java/com/xero/api/client/AssetApi.java | 6 + .../com/xero/api/client/BankFeedsApi.java | 11 +- .../java/com/xero/api/client/FilesApi.java | 18 ++ .../java/com/xero/api/client/FinanceApi.java | 12 + .../java/com/xero/api/client/IdentityApi.java | 2 + .../com/xero/api/client/PayrollAuApi.java | 32 +++ .../com/xero/api/client/PayrollNzApi.java | 72 +++++ .../com/xero/api/client/PayrollUkApi.java | 70 +++++ .../java/com/xero/api/client/ProjectApi.java | 16 ++ 11 files changed, 500 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index bb016a1d0..c89a49789 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -255,6 +255,7 @@ public HttpResponse createAccountForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); String url = uriBuilder.build().toString(); @@ -385,6 +386,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -527,6 +529,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -671,6 +674,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -815,6 +819,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -952,6 +957,7 @@ public HttpResponse createBankTransactionHistoryRecordForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1089,6 +1095,7 @@ public HttpResponse createBankTransactionsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); if (summarizeErrors != null) { @@ -1238,6 +1245,7 @@ public HttpResponse createBankTransferForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); String url = uriBuilder.build().toString(); @@ -1367,6 +1375,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1508,6 +1517,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1644,6 +1654,7 @@ public HttpResponse createBankTransferHistoryRecordForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1770,6 +1781,7 @@ public HttpResponse createBatchPaymentForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); if (summarizeErrors != null) { @@ -1919,6 +1931,7 @@ public HttpResponse createBatchPaymentHistoryRecordForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2053,6 +2066,7 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2187,6 +2201,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2327,6 +2342,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2445,6 +2461,7 @@ public HttpResponse createContactGroupForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); String url = uriBuilder.build().toString(); @@ -2571,6 +2588,7 @@ public HttpResponse createContactGroupContactsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2701,6 +2719,7 @@ public HttpResponse createContactHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2827,6 +2846,7 @@ public HttpResponse createContactsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); if (summarizeErrors != null) { @@ -2983,6 +3003,7 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3154,6 +3175,7 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3331,6 +3353,7 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3483,6 +3506,7 @@ public HttpResponse createCreditNoteHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3617,6 +3641,7 @@ public HttpResponse createCreditNotesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); if (summarizeErrors != null) { @@ -3763,6 +3788,7 @@ public HttpResponse createCurrencyForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); String url = uriBuilder.build().toString(); @@ -3884,6 +3910,7 @@ public HttpResponse createEmployeesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (summarizeErrors != null) { @@ -4025,6 +4052,7 @@ public HttpResponse createExpenseClaimHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4141,6 +4169,7 @@ public HttpResponse createExpenseClaimsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); String url = uriBuilder.build().toString(); @@ -4286,6 +4315,7 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4456,6 +4486,7 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4608,6 +4639,7 @@ public HttpResponse createInvoiceHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4740,6 +4772,7 @@ public HttpResponse createInvoicesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); if (summarizeErrors != null) { @@ -4901,6 +4934,7 @@ public HttpResponse createItemHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5032,6 +5066,7 @@ public HttpResponse createItemsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); if (summarizeErrors != null) { @@ -5190,6 +5225,7 @@ public HttpResponse createLinkedTransactionForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); String url = uriBuilder.build().toString(); @@ -5323,6 +5359,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5468,6 +5505,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5604,6 +5642,7 @@ public HttpResponse createManualJournalHistoryRecordForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5732,6 +5771,7 @@ public HttpResponse createManualJournalsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); if (summarizeErrors != null) { @@ -5890,6 +5930,7 @@ public HttpResponse createOverpaymentAllocationsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6042,6 +6083,7 @@ public HttpResponse createOverpaymentHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6155,6 +6197,7 @@ public HttpResponse createPaymentForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); String url = uriBuilder.build().toString(); @@ -6282,6 +6325,7 @@ public HttpResponse createPaymentHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6404,6 +6448,7 @@ public HttpResponse createPaymentServiceForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); String url = uriBuilder.build().toString(); @@ -6525,6 +6570,7 @@ public HttpResponse createPaymentsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); if (summarizeErrors != null) { @@ -6681,6 +6727,7 @@ public HttpResponse createPrepaymentAllocationsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6833,6 +6880,7 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6969,6 +7017,7 @@ public HttpResponse createPurchaseOrderAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7112,6 +7161,7 @@ public HttpResponse createPurchaseOrderAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7246,6 +7296,7 @@ public HttpResponse createPurchaseOrderHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7374,6 +7425,7 @@ public HttpResponse createPurchaseOrdersForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); if (summarizeErrors != null) { @@ -7522,6 +7574,7 @@ public HttpResponse createQuoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7661,6 +7714,7 @@ public HttpResponse createQuoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7792,6 +7846,7 @@ public HttpResponse createQuoteHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7918,6 +7973,7 @@ public HttpResponse createQuotesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes"); if (summarizeErrors != null) { @@ -8058,6 +8114,7 @@ public HttpResponse createReceiptForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); if (unitdp != null) { @@ -8210,6 +8267,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8354,6 +8412,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8488,6 +8547,7 @@ public HttpResponse createReceiptHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8632,6 +8692,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8778,6 +8839,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8915,6 +8977,7 @@ public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9047,6 +9110,7 @@ public HttpResponse createRepeatingInvoicesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); if (summarizeErrors != null) { @@ -9175,6 +9239,7 @@ public HttpResponse createTaxRatesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); String url = uriBuilder.build().toString(); @@ -9292,6 +9357,7 @@ public HttpResponse createTrackingCategoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); String url = uriBuilder.build().toString(); @@ -9417,6 +9483,7 @@ public HttpResponse createTrackingOptionsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9525,6 +9592,7 @@ public HttpResponse deleteAccountForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9642,6 +9710,7 @@ public HttpResponse deleteBatchPaymentForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); String url = uriBuilder.build().toString(); @@ -9761,6 +9830,7 @@ public HttpResponse deleteBatchPaymentByUrlParamForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9860,6 +9930,7 @@ public HttpResponse deleteContactGroupContactForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9947,6 +10018,7 @@ public HttpResponse deleteContactGroupContactsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept(""); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10045,6 +10117,7 @@ public HttpResponse deleteCreditNoteAllocationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10134,6 +10207,7 @@ public HttpResponse deleteItemForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10222,6 +10296,7 @@ public HttpResponse deleteLinkedTransactionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10323,6 +10398,7 @@ public HttpResponse deleteOverpaymentAllocationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10451,6 +10527,7 @@ public HttpResponse deletePaymentForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10550,6 +10627,7 @@ public HttpResponse deletePrepaymentAllocationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10648,6 +10726,7 @@ public HttpResponse deleteTrackingCategoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10752,6 +10831,7 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10876,6 +10956,7 @@ public HttpResponse emailInvoiceForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10966,6 +11047,7 @@ public HttpResponse getAccountForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11077,6 +11159,7 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11196,6 +11279,7 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11287,6 +11371,7 @@ public HttpResponse getAccountAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11389,6 +11474,7 @@ public HttpResponse getAccountsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); if (where != null) { @@ -11521,6 +11607,7 @@ public HttpResponse getBankTransactionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11663,6 +11750,7 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11788,6 +11876,7 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11884,6 +11973,7 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12006,6 +12096,7 @@ public HttpResponse getBankTransactionsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); if (where != null) { @@ -12191,6 +12282,7 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12281,6 +12373,7 @@ public HttpResponse getBankTransferForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12403,6 +12496,7 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12527,6 +12621,7 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12621,6 +12716,7 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12710,6 +12806,7 @@ public HttpResponse getBankTransferHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12812,6 +12909,7 @@ public HttpResponse getBankTransfersForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); if (where != null) { @@ -12938,6 +13036,7 @@ public HttpResponse getBatchPaymentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13027,6 +13126,7 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13129,6 +13229,7 @@ public HttpResponse getBatchPaymentsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); if (where != null) { @@ -13253,6 +13354,7 @@ public HttpResponse getBrandingThemeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13348,6 +13450,7 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13431,6 +13534,7 @@ public HttpResponse getBrandingThemesForHttpResponse(String accessToken, String HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes"); String url = uriBuilder.build().toString(); @@ -13521,6 +13625,7 @@ public HttpResponse getBudgetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13651,6 +13756,7 @@ public HttpResponse getBudgetsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Budgets"); if (ids != null) { @@ -13794,6 +13900,7 @@ public HttpResponse getContactForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13905,6 +14012,7 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14024,6 +14132,7 @@ public HttpResponse getContactAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14126,6 +14235,7 @@ public HttpResponse getContactAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14217,6 +14327,7 @@ public HttpResponse getContactByContactNumberForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14306,6 +14417,7 @@ public HttpResponse getContactCISSettingsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14397,6 +14509,7 @@ public HttpResponse getContactGroupForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14484,6 +14597,7 @@ public HttpResponse getContactGroupsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); if (where != null) { @@ -14608,6 +14722,7 @@ public HttpResponse getContactHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14755,6 +14870,7 @@ public HttpResponse getContactsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); if (where != null) { @@ -15005,6 +15121,7 @@ public HttpResponse getCreditNoteForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15116,6 +15233,7 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/pdf"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15238,6 +15356,7 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15357,6 +15476,7 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15450,6 +15570,7 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15539,6 +15660,7 @@ public HttpResponse getCreditNoteHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15658,6 +15780,7 @@ public HttpResponse getCreditNotesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); if (where != null) { @@ -15839,6 +15962,7 @@ public HttpResponse getCurrenciesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); if (where != null) { @@ -15962,6 +16086,7 @@ public HttpResponse getEmployeeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16063,6 +16188,7 @@ public HttpResponse getEmployeesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (where != null) { @@ -16189,6 +16315,7 @@ public HttpResponse getExpenseClaimForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16278,6 +16405,7 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16380,6 +16508,7 @@ public HttpResponse getExpenseClaimsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); if (where != null) { @@ -16508,6 +16637,7 @@ public HttpResponse getInvoiceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16617,6 +16747,7 @@ public HttpResponse getInvoiceAsPdfForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/pdf"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16728,6 +16859,7 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16849,6 +16981,7 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16942,6 +17075,7 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -17031,6 +17165,7 @@ public HttpResponse getInvoiceHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -17113,6 +17248,7 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String accessToken, Strin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); @@ -17287,6 +17423,7 @@ public HttpResponse getInvoicesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); if (where != null) { @@ -17634,6 +17771,7 @@ public HttpResponse getItemForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -17741,6 +17879,7 @@ public HttpResponse getItemHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -17848,6 +17987,7 @@ public HttpResponse getItemsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); if (where != null) { @@ -17991,6 +18131,7 @@ public HttpResponse getJournalForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18079,6 +18220,7 @@ public HttpResponse getJournalByNumberForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18186,6 +18328,7 @@ public HttpResponse getJournalsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals"); if (offset != null) { @@ -18314,6 +18457,7 @@ public HttpResponse getLinkedTransactionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18445,6 +18589,7 @@ public HttpResponse getLinkedTransactionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); if (page != null) { @@ -18651,6 +18796,7 @@ public HttpResponse getManualJournalForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18773,6 +18919,7 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18899,6 +19046,7 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18994,6 +19142,7 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19110,6 +19259,7 @@ public HttpResponse getManualJournalsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); if (where != null) { @@ -19274,6 +19424,7 @@ public HttpResponse getManualJournalsHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19362,6 +19513,7 @@ public HttpResponse getOnlineInvoiceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19446,6 +19598,7 @@ public HttpResponse getOrganisationActionsForHttpResponse(String accessToken, St HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/Actions"); String url = uriBuilder.build().toString(); @@ -19533,6 +19686,7 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19615,6 +19769,7 @@ public HttpResponse getOrganisationsForHttpResponse(String accessToken, String x HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation"); String url = uriBuilder.build().toString(); @@ -19701,6 +19856,7 @@ public HttpResponse getOverpaymentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19790,6 +19946,7 @@ public HttpResponse getOverpaymentHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19909,6 +20066,7 @@ public HttpResponse getOverpaymentsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments"); if (where != null) { @@ -20092,6 +20250,7 @@ public HttpResponse getPaymentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -20180,6 +20339,7 @@ public HttpResponse getPaymentHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -20262,6 +20422,7 @@ public HttpResponse getPaymentServicesForHttpResponse(String accessToken, String HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); String url = uriBuilder.build().toString(); @@ -20368,6 +20529,7 @@ public HttpResponse getPaymentsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); if (where != null) { @@ -20531,6 +20693,7 @@ public HttpResponse getPrepaymentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -20620,6 +20783,7 @@ public HttpResponse getPrepaymentHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -20739,6 +20903,7 @@ public HttpResponse getPrepaymentsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments"); if (where != null) { @@ -20925,6 +21090,7 @@ public HttpResponse getPurchaseOrderForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21018,6 +21184,7 @@ public HttpResponse getPurchaseOrderAsPdfForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/pdf"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21140,6 +21307,7 @@ public HttpResponse getPurchaseOrderAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21264,6 +21432,7 @@ public HttpResponse getPurchaseOrderAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21357,6 +21526,7 @@ public HttpResponse getPurchaseOrderAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21450,6 +21620,7 @@ public HttpResponse getPurchaseOrderByNumberForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21539,6 +21710,7 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21676,6 +21848,7 @@ public HttpResponse getPurchaseOrdersForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); if (status != null) { @@ -21878,6 +22051,7 @@ public HttpResponse getQuoteForHttpResponse(String accessToken, String xeroTenan HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21967,6 +22141,7 @@ public HttpResponse getQuoteAsPdfForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/pdf"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22076,6 +22251,7 @@ public HttpResponse getQuoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22186,6 +22362,7 @@ public HttpResponse getQuoteAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22277,6 +22454,7 @@ public HttpResponse getQuoteAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22365,6 +22543,7 @@ public HttpResponse getQuoteHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22511,6 +22690,7 @@ public HttpResponse getQuotesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes"); if (dateFrom != null) { @@ -22779,6 +22959,7 @@ public HttpResponse getReceiptForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22910,6 +23091,7 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23031,6 +23213,7 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23124,6 +23307,7 @@ public HttpResponse getReceiptAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23213,6 +23397,7 @@ public HttpResponse getReceiptHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23322,6 +23507,7 @@ public HttpResponse getReceiptsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); if (where != null) { @@ -23468,6 +23654,7 @@ public HttpResponse getRepeatingInvoiceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23590,6 +23777,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23715,6 +23903,7 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23813,6 +24002,7 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23904,6 +24094,7 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23994,6 +24185,7 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); if (where != null) { @@ -24139,6 +24331,7 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); @@ -24326,6 +24519,7 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); @@ -24526,6 +24720,7 @@ public HttpResponse getReportBalanceSheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); if (date != null) { @@ -24750,6 +24945,7 @@ public HttpResponse getReportBankSummaryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); if (fromDate != null) { @@ -24877,6 +25073,7 @@ public HttpResponse getReportBudgetSummaryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); if (date != null) { @@ -25017,6 +25214,7 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); @@ -25121,6 +25319,7 @@ public HttpResponse getReportFromIdForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -25259,6 +25458,7 @@ public HttpResponse getReportProfitAndLossForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); if (fromDate != null) { @@ -25539,6 +25739,7 @@ public HttpResponse getReportTenNinetyNineForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); if (reportYear != null) { @@ -25643,6 +25844,7 @@ public HttpResponse getReportTrialBalanceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); if (date != null) { @@ -25759,6 +25961,7 @@ public HttpResponse getReportsListForHttpResponse(String accessToken, String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); String url = uriBuilder.build().toString(); @@ -25843,6 +26046,7 @@ public HttpResponse getTaxRateByTaxTypeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -25928,6 +26132,7 @@ public HttpResponse getTaxRatesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); if (where != null) { @@ -26057,6 +26262,7 @@ public HttpResponse getTrackingCategoriesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); if (where != null) { @@ -26203,6 +26409,7 @@ public HttpResponse getTrackingCategoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -26290,6 +26497,7 @@ public HttpResponse getUserForHttpResponse(String accessToken, String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -26391,6 +26599,7 @@ public HttpResponse getUsersForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users"); if (where != null) { @@ -26524,6 +26733,7 @@ public HttpResponse postSetupForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Setup"); String url = uriBuilder.build().toString(); @@ -26649,6 +26859,7 @@ public HttpResponse updateAccountForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -26783,6 +26994,7 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -26925,6 +27137,7 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -27068,6 +27281,7 @@ public HttpResponse updateBankTransactionForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -27230,6 +27444,7 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -27374,6 +27589,7 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -27511,6 +27727,7 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -27652,6 +27869,7 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -27782,6 +28000,7 @@ public HttpResponse updateContactForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -27912,6 +28131,7 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -28050,6 +28270,7 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -28180,6 +28401,7 @@ public HttpResponse updateContactGroupForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -28314,6 +28536,7 @@ public HttpResponse updateCreditNoteForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -28472,6 +28695,7 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -28617,6 +28841,7 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -28747,6 +28972,7 @@ public HttpResponse updateExpenseClaimForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -28881,6 +29107,7 @@ public HttpResponse updateInvoiceForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -29035,6 +29262,7 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -29177,6 +29405,7 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -29313,6 +29542,7 @@ public HttpResponse updateItemForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -29466,6 +29696,7 @@ public HttpResponse updateLinkedTransactionForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -29596,6 +29827,7 @@ public HttpResponse updateManualJournalForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -29734,6 +29966,7 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -29879,6 +30112,7 @@ public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -30018,6 +30252,7 @@ public HttpResponse updateOrCreateBankTransactionsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); if (summarizeErrors != null) { @@ -30179,6 +30414,7 @@ public HttpResponse updateOrCreateContactsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); if (summarizeErrors != null) { @@ -30328,6 +30564,7 @@ public HttpResponse updateOrCreateCreditNotesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); if (summarizeErrors != null) { @@ -30489,6 +30726,7 @@ public HttpResponse updateOrCreateEmployeesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (summarizeErrors != null) { @@ -30636,6 +30874,7 @@ public HttpResponse updateOrCreateInvoicesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); if (summarizeErrors != null) { @@ -30803,6 +31042,7 @@ public HttpResponse updateOrCreateItemsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); if (summarizeErrors != null) { @@ -30968,6 +31208,7 @@ public HttpResponse updateOrCreateManualJournalsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); if (summarizeErrors != null) { @@ -31113,6 +31354,7 @@ public HttpResponse updateOrCreatePurchaseOrdersForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); if (summarizeErrors != null) { @@ -31254,6 +31496,7 @@ public HttpResponse updateOrCreateQuotesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes"); if (summarizeErrors != null) { @@ -31402,6 +31645,7 @@ public HttpResponse updateOrCreateRepeatingInvoicesForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); if (summarizeErrors != null) { @@ -31545,6 +31789,7 @@ public HttpResponse updatePurchaseOrderForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -31681,6 +31926,7 @@ public HttpResponse updatePurchaseOrderAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -31824,6 +32070,7 @@ public HttpResponse updatePurchaseOrderAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -31945,6 +32192,7 @@ public HttpResponse updateQuoteForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -32077,6 +32325,7 @@ public HttpResponse updateQuoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -32216,6 +32465,7 @@ public HttpResponse updateQuoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -32351,6 +32601,7 @@ public HttpResponse updateReceiptForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -32507,6 +32758,7 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -32651,6 +32903,7 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -32782,6 +33035,7 @@ public HttpResponse updateRepeatingInvoiceForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -32926,6 +33180,7 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -33072,6 +33327,7 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -33188,6 +33444,7 @@ public HttpResponse updateTaxRateForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); String url = uriBuilder.build().toString(); @@ -33314,6 +33571,7 @@ public HttpResponse updateTrackingCategoryForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -33457,6 +33715,7 @@ public HttpResponse updateTrackingOptionsForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/AppStoreApi.java b/src/main/java/com/xero/api/client/AppStoreApi.java index 8b7cc13a7..8a9544faa 100644 --- a/src/main/java/com/xero/api/client/AppStoreApi.java +++ b/src/main/java/com/xero/api/client/AppStoreApi.java @@ -170,6 +170,7 @@ public HttpResponse getSubscriptionForHttpResponse(String accessToken, UUID subs } HttpHeaders headers = new HttpHeaders(); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -257,6 +258,7 @@ public HttpResponse getUsageRecordsForHttpResponse(String accessToken, UUID subs } HttpHeaders headers = new HttpHeaders(); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -372,6 +374,7 @@ public HttpResponse postUsageRecordsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -504,6 +507,7 @@ public HttpResponse putUsageRecordsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/AssetApi.java b/src/main/java/com/xero/api/client/AssetApi.java index 025017985..e94b15e3a 100644 --- a/src/main/java/com/xero/api/client/AssetApi.java +++ b/src/main/java/com/xero/api/client/AssetApi.java @@ -197,6 +197,7 @@ public HttpResponse createAssetForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Assets"); String url = uriBuilder.build().toString(); @@ -306,6 +307,7 @@ public HttpResponse createAssetTypeForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AssetTypes"); String url = uriBuilder.build().toString(); @@ -396,6 +398,7 @@ public HttpResponse getAssetByIdForHttpResponse(String accessToken, String xeroT HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -482,6 +485,7 @@ public HttpResponse getAssetSettingsForHttpResponse(String accessToken, String x HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings"); String url = uriBuilder.build().toString(); @@ -564,6 +568,7 @@ public HttpResponse getAssetTypesForHttpResponse(String accessToken, String xero HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AssetTypes"); String url = uriBuilder.build().toString(); @@ -693,6 +698,7 @@ public HttpResponse getAssetsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Assets"); if (status != null) { diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java index 452d53313..6590724ef 100644 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -204,6 +204,7 @@ public HttpResponse createFeedConnectionsForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FeedConnections"); String url = uriBuilder.build().toString(); @@ -327,7 +328,8 @@ public HttpResponse createStatementsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/jsonapplication/problem+json"); + headers.setAccept("application/json;application/problem+json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Statements"); String url = uriBuilder.build().toString(); @@ -434,6 +436,7 @@ public HttpResponse deleteFeedConnectionsForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FeedConnections/DeleteRequests"); @@ -526,6 +529,7 @@ public HttpResponse getFeedConnectionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -630,6 +634,7 @@ public HttpResponse getFeedConnectionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FeedConnections"); if (page != null) { @@ -759,6 +764,7 @@ public HttpResponse getStatementForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -872,7 +878,8 @@ public HttpResponse getStatementsForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Xero-Application-Id", xeroApplicationId); headers.set("Xero-User-Id", xeroUserId); - headers.setAccept("application/jsonapplication/problem+json"); + headers.setAccept("application/json;application/problem+json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Statements"); if (page != null) { diff --git a/src/main/java/com/xero/api/client/FilesApi.java b/src/main/java/com/xero/api/client/FilesApi.java index 3027d1d02..3e4edbe6c 100644 --- a/src/main/java/com/xero/api/client/FilesApi.java +++ b/src/main/java/com/xero/api/client/FilesApi.java @@ -211,6 +211,7 @@ public HttpResponse createFileAssociationForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -313,6 +314,7 @@ public HttpResponse createFolderForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Folders"); String url = uriBuilder.build().toString(); @@ -393,6 +395,7 @@ public HttpResponse deleteFileForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept(""); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -484,6 +487,7 @@ public HttpResponse deleteFileAssociationForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept(""); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -569,6 +573,7 @@ public HttpResponse deleteFolderForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept(""); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -682,6 +687,7 @@ public HttpResponse getAssociationsByObjectForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -853,6 +859,7 @@ public HttpResponse getAssociationsCountForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Associations/Count"); if (objectIds != null) { @@ -956,6 +963,7 @@ public HttpResponse getFileForHttpResponse(String accessToken, String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1043,6 +1051,7 @@ public HttpResponse getFileAssociationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1135,6 +1144,7 @@ public HttpResponse getFileContentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/octet-stream"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1225,6 +1235,7 @@ public HttpResponse getFilesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files"); if (pagesize != null) { @@ -1370,6 +1381,7 @@ public HttpResponse getFolderForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1453,6 +1465,7 @@ public HttpResponse getFoldersForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Folders"); if (sort != null) { @@ -1549,6 +1562,7 @@ public HttpResponse getInboxForHttpResponse(String accessToken, String xeroTenan HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Inbox"); String url = uriBuilder.build().toString(); @@ -1658,6 +1672,7 @@ public HttpResponse updateFileForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1767,6 +1782,7 @@ public HttpResponse updateFolderForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1895,6 +1911,7 @@ public HttpResponse uploadFileForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("multipart/form-data"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files"); String url = uriBuilder.build().toString(); @@ -2052,6 +2069,7 @@ public HttpResponse uploadFileToFolderForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("multipart/form-data"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/FinanceApi.java b/src/main/java/com/xero/api/client/FinanceApi.java index 3c2571ee9..e181e7c1f 100644 --- a/src/main/java/com/xero/api/client/FinanceApi.java +++ b/src/main/java/com/xero/api/client/FinanceApi.java @@ -195,6 +195,7 @@ public HttpResponse getAccountingActivityAccountUsageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/AccountUsage"); @@ -332,6 +333,7 @@ public HttpResponse getAccountingActivityLockHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/LockHistory"); @@ -449,6 +451,7 @@ public HttpResponse getAccountingActivityReportHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/ReportHistory"); @@ -569,6 +572,7 @@ public HttpResponse getAccountingActivityUserActivitiesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/UserActivities"); @@ -726,6 +730,7 @@ public HttpResponse getBankStatementAccountingForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankStatementsPlus/statements"); @@ -947,6 +952,7 @@ public HttpResponse getCashValidationForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CashValidation"); if (balanceDate != null) { @@ -1101,6 +1107,7 @@ public HttpResponse getFinancialStatementBalanceSheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/BalanceSheet"); @@ -1225,6 +1232,7 @@ public HttpResponse getFinancialStatementCashflowForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/Cashflow"); @@ -1394,6 +1402,7 @@ public HttpResponse getFinancialStatementContactsExpenseForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/contacts/expense"); @@ -1603,6 +1612,7 @@ public HttpResponse getFinancialStatementContactsRevenueForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/contacts/revenue"); @@ -1781,6 +1791,7 @@ public HttpResponse getFinancialStatementProfitAndLossForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/ProfitAndLoss"); @@ -1912,6 +1923,7 @@ public HttpResponse getFinancialStatementTrialBalanceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/TrialBalance"); diff --git a/src/main/java/com/xero/api/client/IdentityApi.java b/src/main/java/com/xero/api/client/IdentityApi.java index 7225b8b0b..c2a1e30a8 100644 --- a/src/main/java/com/xero/api/client/IdentityApi.java +++ b/src/main/java/com/xero/api/client/IdentityApi.java @@ -167,6 +167,7 @@ public HttpResponse deleteConnectionForHttpResponse(String accessToken, UUID id) } HttpHeaders headers = new HttpHeaders(); headers.setAccept(""); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -242,6 +243,7 @@ public HttpResponse getConnectionsForHttpResponse(String accessToken, UUID authE } HttpHeaders headers = new HttpHeaders(); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Connections"); if (authEventId != null) { diff --git a/src/main/java/com/xero/api/client/PayrollAuApi.java b/src/main/java/com/xero/api/client/PayrollAuApi.java index c796d4faf..8bd7ca799 100644 --- a/src/main/java/com/xero/api/client/PayrollAuApi.java +++ b/src/main/java/com/xero/api/client/PayrollAuApi.java @@ -207,6 +207,7 @@ public HttpResponse approveLeaveApplicationForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -321,6 +322,7 @@ public HttpResponse createEmployeeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); String url = uriBuilder.build().toString(); @@ -439,6 +441,7 @@ public HttpResponse createLeaveApplicationForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveApplications"); String url = uriBuilder.build().toString(); @@ -536,6 +539,7 @@ public HttpResponse createPayItemForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayItems"); String url = uriBuilder.build().toString(); @@ -646,6 +650,7 @@ public HttpResponse createPayRunForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns"); String url = uriBuilder.build().toString(); @@ -764,6 +769,7 @@ public HttpResponse createPayrollCalendarForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayrollCalendars"); String url = uriBuilder.build().toString(); @@ -874,6 +880,7 @@ public HttpResponse createSuperfundForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Superfunds"); String url = uriBuilder.build().toString(); @@ -984,6 +991,7 @@ public HttpResponse createTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); String url = uriBuilder.build().toString(); @@ -1069,6 +1077,7 @@ public HttpResponse getEmployeeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1179,6 +1188,7 @@ public HttpResponse getEmployeesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (where != null) { @@ -1323,6 +1333,7 @@ public HttpResponse getLeaveApplicationForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1434,6 +1445,7 @@ public HttpResponse getLeaveApplicationsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveApplications"); if (where != null) { @@ -1600,6 +1612,7 @@ public HttpResponse getLeaveApplicationsV2ForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveApplications/v2"); if (where != null) { @@ -1766,6 +1779,7 @@ public HttpResponse getPayItemsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayItems"); if (where != null) { @@ -1909,6 +1923,7 @@ public HttpResponse getPayRunForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2018,6 +2033,7 @@ public HttpResponse getPayRunsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns"); if (where != null) { @@ -2166,6 +2182,7 @@ public HttpResponse getPayrollCalendarForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2277,6 +2294,7 @@ public HttpResponse getPayrollCalendarsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayrollCalendars"); if (where != null) { @@ -2420,6 +2438,7 @@ public HttpResponse getPayslipForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2500,6 +2519,7 @@ public HttpResponse getSettingsForHttpResponse(String accessToken, String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings"); String url = uriBuilder.build().toString(); @@ -2583,6 +2603,7 @@ public HttpResponse getSuperfundForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2674,6 +2695,7 @@ public HttpResponse getSuperfundProductsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/SuperfundProducts"); if (ABN != null) { @@ -2820,6 +2842,7 @@ public HttpResponse getSuperfundsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Superfunds"); if (where != null) { @@ -2963,6 +2986,7 @@ public HttpResponse getTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3074,6 +3098,7 @@ public HttpResponse getTimesheetsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); if (where != null) { @@ -3231,6 +3256,7 @@ public HttpResponse rejectLeaveApplicationForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3343,6 +3369,7 @@ public HttpResponse updateEmployeeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3460,6 +3487,7 @@ public HttpResponse updateLeaveApplicationForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3572,6 +3600,7 @@ public HttpResponse updatePayRunForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3692,6 +3721,7 @@ public HttpResponse updatePayslipForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3804,6 +3834,7 @@ public HttpResponse updateSuperfundForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3917,6 +3948,7 @@ public HttpResponse updateTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/PayrollNzApi.java b/src/main/java/com/xero/api/client/PayrollNzApi.java index fd92d0bc5..12bd143fc 100644 --- a/src/main/java/com/xero/api/client/PayrollNzApi.java +++ b/src/main/java/com/xero/api/client/PayrollNzApi.java @@ -256,6 +256,7 @@ public HttpResponse approveTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -363,6 +364,7 @@ public HttpResponse createDeductionForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Deductions"); String url = uriBuilder.build().toString(); @@ -468,6 +470,7 @@ public HttpResponse createEarningsRateForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsRates"); String url = uriBuilder.build().toString(); @@ -571,6 +574,7 @@ public HttpResponse createEmployeeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); String url = uriBuilder.build().toString(); @@ -697,6 +701,7 @@ public HttpResponse createEmployeeEarningsTemplateForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -823,6 +828,7 @@ public HttpResponse createEmployeeLeaveForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -953,6 +959,7 @@ public HttpResponse createEmployeeLeaveSetupForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1081,6 +1088,7 @@ public HttpResponse createEmployeeLeaveTypeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1211,6 +1219,7 @@ public HttpResponse createEmployeeOpeningBalancesForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1337,6 +1346,7 @@ public HttpResponse createEmployeePaymentMethodForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1463,6 +1473,7 @@ public HttpResponse createEmployeeSalaryAndWageForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1601,6 +1612,7 @@ public HttpResponse createEmployeeWorkingPatternForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1725,6 +1737,7 @@ public HttpResponse createEmploymentForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1834,6 +1847,7 @@ public HttpResponse createLeaveTypeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveTypes"); String url = uriBuilder.build().toString(); @@ -1960,6 +1974,7 @@ public HttpResponse createMultipleEmployeeEarningsTemplateForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2068,6 +2083,7 @@ public HttpResponse createPayRunForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns"); String url = uriBuilder.build().toString(); @@ -2174,6 +2190,7 @@ public HttpResponse createPayRunCalendarForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRunCalendars"); String url = uriBuilder.build().toString(); @@ -2280,6 +2297,7 @@ public HttpResponse createReimbursementForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reimbursements"); String url = uriBuilder.build().toString(); @@ -2385,6 +2403,7 @@ public HttpResponse createSuperannuationForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Superannuations"); String url = uriBuilder.build().toString(); @@ -2489,6 +2508,7 @@ public HttpResponse createTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); String url = uriBuilder.build().toString(); @@ -2609,6 +2629,7 @@ public HttpResponse createTimesheetLineForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2714,6 +2735,7 @@ public HttpResponse deleteEmployeeEarningsTemplateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2820,6 +2842,7 @@ public HttpResponse deleteEmployeeLeaveForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2920,6 +2943,7 @@ public HttpResponse deleteEmployeeSalaryAndWageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3034,6 +3058,7 @@ public HttpResponse deleteEmployeeWorkingPatternForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3130,6 +3155,7 @@ public HttpResponse deleteTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3232,6 +3258,7 @@ public HttpResponse deleteTimesheetLineForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3329,6 +3356,7 @@ public HttpResponse getDeductionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3421,6 +3449,7 @@ public HttpResponse getDeductionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Deductions"); if (page != null) { @@ -3532,6 +3561,7 @@ public HttpResponse getEarningsRateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3624,6 +3654,7 @@ public HttpResponse getEarningsRatesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsRates"); if (page != null) { @@ -3733,6 +3764,7 @@ public HttpResponse getEmployeeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3829,6 +3861,7 @@ public HttpResponse getEmployeeLeaveBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3943,6 +3976,7 @@ public HttpResponse getEmployeeLeavePeriodsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4083,6 +4117,7 @@ public HttpResponse getEmployeeLeaveTypesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4178,6 +4213,7 @@ public HttpResponse getEmployeeLeavesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4277,6 +4313,7 @@ public HttpResponse getEmployeeOpeningBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4378,6 +4415,7 @@ public HttpResponse getEmployeePayTemplatesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4479,6 +4517,7 @@ public HttpResponse getEmployeePaymentMethodForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4584,6 +4623,7 @@ public HttpResponse getEmployeeSalaryAndWageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4689,6 +4729,7 @@ public HttpResponse getEmployeeSalaryAndWagesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4804,6 +4845,7 @@ public HttpResponse getEmployeeTaxForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4916,6 +4958,7 @@ public HttpResponse getEmployeeWorkingPatternForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5018,6 +5061,7 @@ public HttpResponse getEmployeeWorkingPatternsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5116,6 +5160,7 @@ public HttpResponse getEmployeesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (filter != null) { @@ -5246,6 +5291,7 @@ public HttpResponse getLeaveTypeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5345,6 +5391,7 @@ public HttpResponse getLeaveTypesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveTypes"); if (page != null) { @@ -5474,6 +5521,7 @@ public HttpResponse getPayRunForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5570,6 +5618,7 @@ public HttpResponse getPayRunCalendarForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5663,6 +5712,7 @@ public HttpResponse getPayRunCalendarsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRunCalendars"); if (page != null) { @@ -5776,6 +5826,7 @@ public HttpResponse getPayRunsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns"); if (page != null) { @@ -5905,6 +5956,7 @@ public HttpResponse getPaySlipForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6004,6 +6056,7 @@ public HttpResponse getPaySlipsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaySlips"); if (page != null) { @@ -6136,6 +6189,7 @@ public HttpResponse getReimbursementForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6228,6 +6282,7 @@ public HttpResponse getReimbursementsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reimbursements"); if (page != null) { @@ -6330,6 +6385,7 @@ public HttpResponse getSettingsForHttpResponse(String accessToken, String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings"); String url = uriBuilder.build().toString(); @@ -6414,6 +6470,7 @@ public HttpResponse getStatutoryDeductionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6501,6 +6558,7 @@ public HttpResponse getStatutoryDeductionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/StatutoryDeductions"); if (page != null) { @@ -6605,6 +6663,7 @@ public HttpResponse getSuperannuationForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6691,6 +6750,7 @@ public HttpResponse getSuperannuationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Superannuations"); if (page != null) { @@ -6801,6 +6861,7 @@ public HttpResponse getTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6927,6 +6988,7 @@ public HttpResponse getTimesheetsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); if (page != null) { @@ -7131,6 +7193,7 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String accessToken, Str HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings/TrackingCategories"); @@ -7234,6 +7297,7 @@ public HttpResponse revertTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7355,6 +7419,7 @@ public HttpResponse updateEmployeeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7499,6 +7564,7 @@ public HttpResponse updateEmployeeEarningsTemplateForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7635,6 +7701,7 @@ public HttpResponse updateEmployeeLeaveForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7776,6 +7843,7 @@ public HttpResponse updateEmployeeSalaryAndWageForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7898,6 +7966,7 @@ public HttpResponse updateEmployeeTaxForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8012,6 +8081,7 @@ public HttpResponse updatePayRunForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8134,6 +8204,7 @@ public HttpResponse updatePaySlipLineItemsForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8271,6 +8342,7 @@ public HttpResponse updateTimesheetLineForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/PayrollUkApi.java b/src/main/java/com/xero/api/client/PayrollUkApi.java index c71e06151..a9709986e 100644 --- a/src/main/java/com/xero/api/client/PayrollUkApi.java +++ b/src/main/java/com/xero/api/client/PayrollUkApi.java @@ -253,6 +253,7 @@ public HttpResponse approveTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -359,6 +360,7 @@ public HttpResponse createBenefitForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Benefits"); String url = uriBuilder.build().toString(); @@ -463,6 +465,7 @@ public HttpResponse createDeductionForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Deductions"); String url = uriBuilder.build().toString(); @@ -568,6 +571,7 @@ public HttpResponse createEarningsRateForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsRates"); String url = uriBuilder.build().toString(); @@ -671,6 +675,7 @@ public HttpResponse createEmployeeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); String url = uriBuilder.build().toString(); @@ -797,6 +802,7 @@ public HttpResponse createEmployeeEarningsTemplateForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -923,6 +929,7 @@ public HttpResponse createEmployeeLeaveForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1051,6 +1058,7 @@ public HttpResponse createEmployeeLeaveTypeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1181,6 +1189,7 @@ public HttpResponse createEmployeeOpeningBalancesForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1307,6 +1316,7 @@ public HttpResponse createEmployeePaymentMethodForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1433,6 +1443,7 @@ public HttpResponse createEmployeeSalaryAndWageForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1555,6 +1566,7 @@ public HttpResponse createEmployeeStatutorySickLeaveForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/StatutoryLeaves/Sick"); String url = uriBuilder.build().toString(); @@ -1674,6 +1686,7 @@ public HttpResponse createEmploymentForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1783,6 +1796,7 @@ public HttpResponse createLeaveTypeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveTypes"); String url = uriBuilder.build().toString(); @@ -1907,6 +1921,7 @@ public HttpResponse createMultipleEmployeeEarningsTemplateForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2018,6 +2033,7 @@ public HttpResponse createPayRunCalendarForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRunCalendars"); String url = uriBuilder.build().toString(); @@ -2124,6 +2140,7 @@ public HttpResponse createReimbursementForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reimbursements"); String url = uriBuilder.build().toString(); @@ -2228,6 +2245,7 @@ public HttpResponse createTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); String url = uriBuilder.build().toString(); @@ -2348,6 +2366,7 @@ public HttpResponse createTimesheetLineForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2447,6 +2466,7 @@ public HttpResponse deleteEmployeeEarningsTemplateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept(""); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2553,6 +2573,7 @@ public HttpResponse deleteEmployeeLeaveForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2648,6 +2669,7 @@ public HttpResponse deleteEmployeeSalaryAndWageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept(""); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2743,6 +2765,7 @@ public HttpResponse deleteTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2845,6 +2868,7 @@ public HttpResponse deleteTimesheetLineForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2941,6 +2965,7 @@ public HttpResponse getBenefitForHttpResponse(String accessToken, String xeroTen HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3032,6 +3057,7 @@ public HttpResponse getBenefitsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Benefits"); if (page != null) { @@ -3142,6 +3168,7 @@ public HttpResponse getDeductionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3234,6 +3261,7 @@ public HttpResponse getDeductionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Deductions"); if (page != null) { @@ -3345,6 +3373,7 @@ public HttpResponse getEarningsOrderForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3436,6 +3465,7 @@ public HttpResponse getEarningsOrdersForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsOrders"); if (page != null) { @@ -3547,6 +3577,7 @@ public HttpResponse getEarningsRateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3639,6 +3670,7 @@ public HttpResponse getEarningsRatesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsRates"); if (page != null) { @@ -3748,6 +3780,7 @@ public HttpResponse getEmployeeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3850,6 +3883,7 @@ public HttpResponse getEmployeeLeaveForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3948,6 +3982,7 @@ public HttpResponse getEmployeeLeaveBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4062,6 +4097,7 @@ public HttpResponse getEmployeeLeavePeriodsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4202,6 +4238,7 @@ public HttpResponse getEmployeeLeaveTypesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4297,6 +4334,7 @@ public HttpResponse getEmployeeLeavesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4396,6 +4434,7 @@ public HttpResponse getEmployeeOpeningBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4499,6 +4538,7 @@ public HttpResponse getEmployeePayTemplateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4600,6 +4640,7 @@ public HttpResponse getEmployeePaymentMethodForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4707,6 +4748,7 @@ public HttpResponse getEmployeeSalaryAndWageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4812,6 +4854,7 @@ public HttpResponse getEmployeeSalaryAndWagesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4951,6 +4994,7 @@ public HttpResponse getEmployeeStatutoryLeaveBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5095,6 +5139,7 @@ public HttpResponse getEmployeeStatutorySickLeaveForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5191,6 +5236,7 @@ public HttpResponse getEmployeeTaxForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5289,6 +5335,7 @@ public HttpResponse getEmployeesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (filter != null) { @@ -5419,6 +5466,7 @@ public HttpResponse getLeaveTypeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5518,6 +5566,7 @@ public HttpResponse getLeaveTypesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveTypes"); if (page != null) { @@ -5647,6 +5696,7 @@ public HttpResponse getPayRunForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5743,6 +5793,7 @@ public HttpResponse getPayRunCalendarForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5836,6 +5887,7 @@ public HttpResponse getPayRunCalendarsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRunCalendars"); if (page != null) { @@ -5949,6 +6001,7 @@ public HttpResponse getPayRunsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns"); if (page != null) { @@ -6078,6 +6131,7 @@ public HttpResponse getPaySlipForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6177,6 +6231,7 @@ public HttpResponse getPaySlipsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payslips"); if (page != null) { @@ -6309,6 +6364,7 @@ public HttpResponse getReimbursementForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6401,6 +6457,7 @@ public HttpResponse getReimbursementsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reimbursements"); if (page != null) { @@ -6503,6 +6560,7 @@ public HttpResponse getSettingsForHttpResponse(String accessToken, String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings"); String url = uriBuilder.build().toString(); @@ -6604,6 +6662,7 @@ public HttpResponse getStatutoryLeaveSummaryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6719,6 +6778,7 @@ public HttpResponse getTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6845,6 +6905,7 @@ public HttpResponse getTimesheetsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); if (page != null) { @@ -7049,6 +7110,7 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String accessToken, Str HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings/trackingCategories"); @@ -7152,6 +7214,7 @@ public HttpResponse revertTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7273,6 +7336,7 @@ public HttpResponse updateEmployeeForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7417,6 +7481,7 @@ public HttpResponse updateEmployeeEarningsTemplateForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7553,6 +7618,7 @@ public HttpResponse updateEmployeeLeaveForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7684,6 +7750,7 @@ public HttpResponse updateEmployeeOpeningBalancesForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7824,6 +7891,7 @@ public HttpResponse updateEmployeeSalaryAndWageForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -7940,6 +8008,7 @@ public HttpResponse updatePayRunForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -8077,6 +8146,7 @@ public HttpResponse updateTimesheetLineForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/ProjectApi.java b/src/main/java/com/xero/api/client/ProjectApi.java index 708ad9be8..4e901ca93 100644 --- a/src/main/java/com/xero/api/client/ProjectApi.java +++ b/src/main/java/com/xero/api/client/ProjectApi.java @@ -204,6 +204,7 @@ public HttpResponse createProjectForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Projects"); String url = uriBuilder.build().toString(); @@ -316,6 +317,7 @@ public HttpResponse createTaskForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -435,6 +437,7 @@ public HttpResponse createTimeEntryForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -533,6 +536,7 @@ public HttpResponse deleteTaskForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -632,6 +636,7 @@ public HttpResponse deleteTimeEntryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -727,6 +732,7 @@ public HttpResponse getProjectForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -821,6 +827,7 @@ public HttpResponse getProjectUsersForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ProjectsUsers"); if (page != null) { @@ -972,6 +979,7 @@ public HttpResponse getProjectsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Projects"); if (projectIds != null) { @@ -1169,6 +1177,7 @@ public HttpResponse getTaskForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1294,6 +1303,7 @@ public HttpResponse getTasksForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1542,6 +1552,7 @@ public HttpResponse getTimeEntriesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1847,6 +1858,7 @@ public HttpResponse getTimeEntryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); + headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1960,6 +1972,7 @@ public HttpResponse patchProjectForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2073,6 +2086,7 @@ public HttpResponse updateProjectForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2194,6 +2208,7 @@ public HttpResponse updateTaskForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2322,6 +2337,7 @@ public HttpResponse updateTimeEntryForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); From 4b860f6c80e9090b2a2685797a43f3081c26f32a Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Tue, 24 Sep 2024 08:56:12 +0530 Subject: [PATCH 12/45] Fixed review comment - Set content type only if it is available --- .../com/xero/api/client/AccountingApi.java | 138 ------------------ .../java/com/xero/api/client/AppStoreApi.java | 2 - .../java/com/xero/api/client/AssetApi.java | 4 - .../com/xero/api/client/BankFeedsApi.java | 4 - .../java/com/xero/api/client/FilesApi.java | 12 -- .../java/com/xero/api/client/FinanceApi.java | 12 -- .../java/com/xero/api/client/IdentityApi.java | 2 - .../com/xero/api/client/PayrollAuApi.java | 19 --- .../com/xero/api/client/PayrollNzApi.java | 44 ------ .../com/xero/api/client/PayrollUkApi.java | 45 ------ .../java/com/xero/api/client/ProjectApi.java | 9 -- 11 files changed, 291 deletions(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index c89a49789..e4d8488ea 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -9592,7 +9592,6 @@ public HttpResponse deleteAccountForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -9930,7 +9929,6 @@ public HttpResponse deleteContactGroupContactForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10018,7 +10016,6 @@ public HttpResponse deleteContactGroupContactsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept(""); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10117,7 +10114,6 @@ public HttpResponse deleteCreditNoteAllocationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10207,7 +10203,6 @@ public HttpResponse deleteItemForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10296,7 +10291,6 @@ public HttpResponse deleteLinkedTransactionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10398,7 +10392,6 @@ public HttpResponse deleteOverpaymentAllocationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10627,7 +10620,6 @@ public HttpResponse deletePrepaymentAllocationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10726,7 +10718,6 @@ public HttpResponse deleteTrackingCategoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -10831,7 +10822,6 @@ public HttpResponse deleteTrackingOptionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11047,7 +11037,6 @@ public HttpResponse getAccountForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11159,7 +11148,6 @@ public HttpResponse getAccountAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11279,7 +11267,6 @@ public HttpResponse getAccountAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11371,7 +11358,6 @@ public HttpResponse getAccountAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11474,7 +11460,6 @@ public HttpResponse getAccountsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Accounts"); if (where != null) { @@ -11607,7 +11592,6 @@ public HttpResponse getBankTransactionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11750,7 +11734,6 @@ public HttpResponse getBankTransactionAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11876,7 +11859,6 @@ public HttpResponse getBankTransactionAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -11973,7 +11955,6 @@ public HttpResponse getBankTransactionAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12096,7 +12077,6 @@ public HttpResponse getBankTransactionsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); if (where != null) { @@ -12282,7 +12262,6 @@ public HttpResponse getBankTransactionsHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12373,7 +12352,6 @@ public HttpResponse getBankTransferForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12496,7 +12474,6 @@ public HttpResponse getBankTransferAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12621,7 +12598,6 @@ public HttpResponse getBankTransferAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12716,7 +12692,6 @@ public HttpResponse getBankTransferAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12806,7 +12781,6 @@ public HttpResponse getBankTransferHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -12909,7 +12883,6 @@ public HttpResponse getBankTransfersForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers"); if (where != null) { @@ -13036,7 +13009,6 @@ public HttpResponse getBatchPaymentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13126,7 +13098,6 @@ public HttpResponse getBatchPaymentHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13229,7 +13200,6 @@ public HttpResponse getBatchPaymentsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BatchPayments"); if (where != null) { @@ -13354,7 +13324,6 @@ public HttpResponse getBrandingThemeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13450,7 +13419,6 @@ public HttpResponse getBrandingThemePaymentServicesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13534,7 +13502,6 @@ public HttpResponse getBrandingThemesForHttpResponse(String accessToken, String HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BrandingThemes"); String url = uriBuilder.build().toString(); @@ -13625,7 +13592,6 @@ public HttpResponse getBudgetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -13756,7 +13722,6 @@ public HttpResponse getBudgetsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Budgets"); if (ids != null) { @@ -13900,7 +13865,6 @@ public HttpResponse getContactForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14012,7 +13976,6 @@ public HttpResponse getContactAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14132,7 +14095,6 @@ public HttpResponse getContactAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14235,7 +14197,6 @@ public HttpResponse getContactAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14327,7 +14288,6 @@ public HttpResponse getContactByContactNumberForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14417,7 +14377,6 @@ public HttpResponse getContactCISSettingsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14509,7 +14468,6 @@ public HttpResponse getContactGroupForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14597,7 +14555,6 @@ public HttpResponse getContactGroupsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); if (where != null) { @@ -14722,7 +14679,6 @@ public HttpResponse getContactHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -14870,7 +14826,6 @@ public HttpResponse getContactsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); if (where != null) { @@ -15121,7 +15076,6 @@ public HttpResponse getCreditNoteForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15233,7 +15187,6 @@ public HttpResponse getCreditNoteAsPdfForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/pdf"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15356,7 +15309,6 @@ public HttpResponse getCreditNoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15476,7 +15428,6 @@ public HttpResponse getCreditNoteAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15570,7 +15521,6 @@ public HttpResponse getCreditNoteAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15660,7 +15610,6 @@ public HttpResponse getCreditNoteHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -15780,7 +15729,6 @@ public HttpResponse getCreditNotesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); if (where != null) { @@ -15962,7 +15910,6 @@ public HttpResponse getCurrenciesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Currencies"); if (where != null) { @@ -16086,7 +16033,6 @@ public HttpResponse getEmployeeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16188,7 +16134,6 @@ public HttpResponse getEmployeesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (where != null) { @@ -16315,7 +16260,6 @@ public HttpResponse getExpenseClaimForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16405,7 +16349,6 @@ public HttpResponse getExpenseClaimHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16508,7 +16451,6 @@ public HttpResponse getExpenseClaimsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims"); if (where != null) { @@ -16637,7 +16579,6 @@ public HttpResponse getInvoiceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16747,7 +16688,6 @@ public HttpResponse getInvoiceAsPdfForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/pdf"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16859,7 +16799,6 @@ public HttpResponse getInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -16981,7 +16920,6 @@ public HttpResponse getInvoiceAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -17075,7 +17013,6 @@ public HttpResponse getInvoiceAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -17165,7 +17102,6 @@ public HttpResponse getInvoiceHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -17248,7 +17184,6 @@ public HttpResponse getInvoiceRemindersForHttpResponse(String accessToken, Strin HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/InvoiceReminders/Settings"); @@ -17423,7 +17358,6 @@ public HttpResponse getInvoicesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); if (where != null) { @@ -17771,7 +17705,6 @@ public HttpResponse getItemForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -17879,7 +17812,6 @@ public HttpResponse getItemHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -17987,7 +17919,6 @@ public HttpResponse getItemsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); if (where != null) { @@ -18131,7 +18062,6 @@ public HttpResponse getJournalForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18220,7 +18150,6 @@ public HttpResponse getJournalByNumberForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18328,7 +18257,6 @@ public HttpResponse getJournalsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Journals"); if (offset != null) { @@ -18457,7 +18385,6 @@ public HttpResponse getLinkedTransactionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18589,7 +18516,6 @@ public HttpResponse getLinkedTransactionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions"); if (page != null) { @@ -18796,7 +18722,6 @@ public HttpResponse getManualJournalForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -18919,7 +18844,6 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19046,7 +18970,6 @@ public HttpResponse getManualJournalAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19142,7 +19065,6 @@ public HttpResponse getManualJournalAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19259,7 +19181,6 @@ public HttpResponse getManualJournalsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); if (where != null) { @@ -19424,7 +19345,6 @@ public HttpResponse getManualJournalsHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19513,7 +19433,6 @@ public HttpResponse getOnlineInvoiceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19598,7 +19517,6 @@ public HttpResponse getOrganisationActionsForHttpResponse(String accessToken, St HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation/Actions"); String url = uriBuilder.build().toString(); @@ -19686,7 +19604,6 @@ public HttpResponse getOrganisationCISSettingsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19769,7 +19686,6 @@ public HttpResponse getOrganisationsForHttpResponse(String accessToken, String x HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Organisation"); String url = uriBuilder.build().toString(); @@ -19856,7 +19772,6 @@ public HttpResponse getOverpaymentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -19946,7 +19861,6 @@ public HttpResponse getOverpaymentHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -20066,7 +19980,6 @@ public HttpResponse getOverpaymentsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Overpayments"); if (where != null) { @@ -20250,7 +20163,6 @@ public HttpResponse getPaymentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -20339,7 +20251,6 @@ public HttpResponse getPaymentHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -20422,7 +20333,6 @@ public HttpResponse getPaymentServicesForHttpResponse(String accessToken, String HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaymentServices"); String url = uriBuilder.build().toString(); @@ -20529,7 +20439,6 @@ public HttpResponse getPaymentsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payments"); if (where != null) { @@ -20693,7 +20602,6 @@ public HttpResponse getPrepaymentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -20783,7 +20691,6 @@ public HttpResponse getPrepaymentHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -20903,7 +20810,6 @@ public HttpResponse getPrepaymentsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Prepayments"); if (where != null) { @@ -21090,7 +20996,6 @@ public HttpResponse getPurchaseOrderForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21184,7 +21089,6 @@ public HttpResponse getPurchaseOrderAsPdfForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/pdf"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21307,7 +21211,6 @@ public HttpResponse getPurchaseOrderAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21432,7 +21335,6 @@ public HttpResponse getPurchaseOrderAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21526,7 +21428,6 @@ public HttpResponse getPurchaseOrderAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21620,7 +21521,6 @@ public HttpResponse getPurchaseOrderByNumberForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21710,7 +21610,6 @@ public HttpResponse getPurchaseOrderHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -21848,7 +21747,6 @@ public HttpResponse getPurchaseOrdersForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); if (status != null) { @@ -22051,7 +21949,6 @@ public HttpResponse getQuoteForHttpResponse(String accessToken, String xeroTenan HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22141,7 +22038,6 @@ public HttpResponse getQuoteAsPdfForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/pdf"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22251,7 +22147,6 @@ public HttpResponse getQuoteAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22362,7 +22257,6 @@ public HttpResponse getQuoteAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22454,7 +22348,6 @@ public HttpResponse getQuoteAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22543,7 +22436,6 @@ public HttpResponse getQuoteHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -22690,7 +22582,6 @@ public HttpResponse getQuotesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes"); if (dateFrom != null) { @@ -22959,7 +22850,6 @@ public HttpResponse getReceiptForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23091,7 +22981,6 @@ public HttpResponse getReceiptAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23213,7 +23102,6 @@ public HttpResponse getReceiptAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23307,7 +23195,6 @@ public HttpResponse getReceiptAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23397,7 +23284,6 @@ public HttpResponse getReceiptHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23507,7 +23393,6 @@ public HttpResponse getReceiptsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts"); if (where != null) { @@ -23654,7 +23539,6 @@ public HttpResponse getRepeatingInvoiceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23777,7 +23661,6 @@ public HttpResponse getRepeatingInvoiceAttachmentByFileNameForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -23903,7 +23786,6 @@ public HttpResponse getRepeatingInvoiceAttachmentByIdForHttpResponse( headers.set("xero-tenant-id", xeroTenantId); headers.set("contentType", contentType); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -24002,7 +23884,6 @@ public HttpResponse getRepeatingInvoiceAttachmentsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -24094,7 +23975,6 @@ public HttpResponse getRepeatingInvoiceHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -24185,7 +24065,6 @@ public HttpResponse getRepeatingInvoicesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); if (where != null) { @@ -24331,7 +24210,6 @@ public HttpResponse getReportAgedPayablesByContactForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedPayablesByContact"); @@ -24519,7 +24397,6 @@ public HttpResponse getReportAgedReceivablesByContactForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/AgedReceivablesByContact"); @@ -24720,7 +24597,6 @@ public HttpResponse getReportBalanceSheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BalanceSheet"); if (date != null) { @@ -24945,7 +24821,6 @@ public HttpResponse getReportBankSummaryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BankSummary"); if (fromDate != null) { @@ -25073,7 +24948,6 @@ public HttpResponse getReportBudgetSummaryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/BudgetSummary"); if (date != null) { @@ -25214,7 +25088,6 @@ public HttpResponse getReportExecutiveSummaryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ExecutiveSummary"); @@ -25319,7 +25192,6 @@ public HttpResponse getReportFromIdForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -25458,7 +25330,6 @@ public HttpResponse getReportProfitAndLossForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/ProfitAndLoss"); if (fromDate != null) { @@ -25739,7 +25610,6 @@ public HttpResponse getReportTenNinetyNineForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TenNinetyNine"); if (reportYear != null) { @@ -25844,7 +25714,6 @@ public HttpResponse getReportTrialBalanceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports/TrialBalance"); if (date != null) { @@ -25961,7 +25830,6 @@ public HttpResponse getReportsListForHttpResponse(String accessToken, String xer HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reports"); String url = uriBuilder.build().toString(); @@ -26046,7 +25914,6 @@ public HttpResponse getTaxRateByTaxTypeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -26132,7 +25999,6 @@ public HttpResponse getTaxRatesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TaxRates"); if (where != null) { @@ -26262,7 +26128,6 @@ public HttpResponse getTrackingCategoriesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/TrackingCategories"); if (where != null) { @@ -26409,7 +26274,6 @@ public HttpResponse getTrackingCategoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -26497,7 +26361,6 @@ public HttpResponse getUserForHttpResponse(String accessToken, String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -26599,7 +26462,6 @@ public HttpResponse getUsersForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Users"); if (where != null) { diff --git a/src/main/java/com/xero/api/client/AppStoreApi.java b/src/main/java/com/xero/api/client/AppStoreApi.java index 8a9544faa..b97b920dc 100644 --- a/src/main/java/com/xero/api/client/AppStoreApi.java +++ b/src/main/java/com/xero/api/client/AppStoreApi.java @@ -170,7 +170,6 @@ public HttpResponse getSubscriptionForHttpResponse(String accessToken, UUID subs } HttpHeaders headers = new HttpHeaders(); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -258,7 +257,6 @@ public HttpResponse getUsageRecordsForHttpResponse(String accessToken, UUID subs } HttpHeaders headers = new HttpHeaders(); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/AssetApi.java b/src/main/java/com/xero/api/client/AssetApi.java index e94b15e3a..606c8db84 100644 --- a/src/main/java/com/xero/api/client/AssetApi.java +++ b/src/main/java/com/xero/api/client/AssetApi.java @@ -398,7 +398,6 @@ public HttpResponse getAssetByIdForHttpResponse(String accessToken, String xeroT HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -485,7 +484,6 @@ public HttpResponse getAssetSettingsForHttpResponse(String accessToken, String x HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings"); String url = uriBuilder.build().toString(); @@ -568,7 +566,6 @@ public HttpResponse getAssetTypesForHttpResponse(String accessToken, String xero HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AssetTypes"); String url = uriBuilder.build().toString(); @@ -698,7 +695,6 @@ public HttpResponse getAssetsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Assets"); if (status != null) { diff --git a/src/main/java/com/xero/api/client/BankFeedsApi.java b/src/main/java/com/xero/api/client/BankFeedsApi.java index 6590724ef..8a01cb329 100644 --- a/src/main/java/com/xero/api/client/BankFeedsApi.java +++ b/src/main/java/com/xero/api/client/BankFeedsApi.java @@ -529,7 +529,6 @@ public HttpResponse getFeedConnectionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -634,7 +633,6 @@ public HttpResponse getFeedConnectionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FeedConnections"); if (page != null) { @@ -764,7 +762,6 @@ public HttpResponse getStatementForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -879,7 +876,6 @@ public HttpResponse getStatementsForHttpResponse( headers.set("Xero-Application-Id", xeroApplicationId); headers.set("Xero-User-Id", xeroUserId); headers.setAccept("application/json;application/problem+json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Statements"); if (page != null) { diff --git a/src/main/java/com/xero/api/client/FilesApi.java b/src/main/java/com/xero/api/client/FilesApi.java index 3e4edbe6c..edf38e41d 100644 --- a/src/main/java/com/xero/api/client/FilesApi.java +++ b/src/main/java/com/xero/api/client/FilesApi.java @@ -395,7 +395,6 @@ public HttpResponse deleteFileForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept(""); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -487,7 +486,6 @@ public HttpResponse deleteFileAssociationForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept(""); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -573,7 +571,6 @@ public HttpResponse deleteFolderForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept(""); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -687,7 +684,6 @@ public HttpResponse getAssociationsByObjectForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -859,7 +855,6 @@ public HttpResponse getAssociationsCountForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Associations/Count"); if (objectIds != null) { @@ -963,7 +958,6 @@ public HttpResponse getFileForHttpResponse(String accessToken, String xeroTenant HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1051,7 +1045,6 @@ public HttpResponse getFileAssociationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1144,7 +1137,6 @@ public HttpResponse getFileContentForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/octet-stream"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1235,7 +1227,6 @@ public HttpResponse getFilesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files"); if (pagesize != null) { @@ -1381,7 +1372,6 @@ public HttpResponse getFolderForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1465,7 +1455,6 @@ public HttpResponse getFoldersForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Folders"); if (sort != null) { @@ -1562,7 +1551,6 @@ public HttpResponse getInboxForHttpResponse(String accessToken, String xeroTenan HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Inbox"); String url = uriBuilder.build().toString(); diff --git a/src/main/java/com/xero/api/client/FinanceApi.java b/src/main/java/com/xero/api/client/FinanceApi.java index e181e7c1f..3c2571ee9 100644 --- a/src/main/java/com/xero/api/client/FinanceApi.java +++ b/src/main/java/com/xero/api/client/FinanceApi.java @@ -195,7 +195,6 @@ public HttpResponse getAccountingActivityAccountUsageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/AccountUsage"); @@ -333,7 +332,6 @@ public HttpResponse getAccountingActivityLockHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/LockHistory"); @@ -451,7 +449,6 @@ public HttpResponse getAccountingActivityReportHistoryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/ReportHistory"); @@ -572,7 +569,6 @@ public HttpResponse getAccountingActivityUserActivitiesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/UserActivities"); @@ -730,7 +726,6 @@ public HttpResponse getBankStatementAccountingForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankStatementsPlus/statements"); @@ -952,7 +947,6 @@ public HttpResponse getCashValidationForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CashValidation"); if (balanceDate != null) { @@ -1107,7 +1101,6 @@ public HttpResponse getFinancialStatementBalanceSheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/BalanceSheet"); @@ -1232,7 +1225,6 @@ public HttpResponse getFinancialStatementCashflowForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/Cashflow"); @@ -1402,7 +1394,6 @@ public HttpResponse getFinancialStatementContactsExpenseForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/contacts/expense"); @@ -1612,7 +1603,6 @@ public HttpResponse getFinancialStatementContactsRevenueForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/contacts/revenue"); @@ -1791,7 +1781,6 @@ public HttpResponse getFinancialStatementProfitAndLossForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/ProfitAndLoss"); @@ -1923,7 +1912,6 @@ public HttpResponse getFinancialStatementTrialBalanceForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/TrialBalance"); diff --git a/src/main/java/com/xero/api/client/IdentityApi.java b/src/main/java/com/xero/api/client/IdentityApi.java index c2a1e30a8..7225b8b0b 100644 --- a/src/main/java/com/xero/api/client/IdentityApi.java +++ b/src/main/java/com/xero/api/client/IdentityApi.java @@ -167,7 +167,6 @@ public HttpResponse deleteConnectionForHttpResponse(String accessToken, UUID id) } HttpHeaders headers = new HttpHeaders(); headers.setAccept(""); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -243,7 +242,6 @@ public HttpResponse getConnectionsForHttpResponse(String accessToken, UUID authE } HttpHeaders headers = new HttpHeaders(); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Connections"); if (authEventId != null) { diff --git a/src/main/java/com/xero/api/client/PayrollAuApi.java b/src/main/java/com/xero/api/client/PayrollAuApi.java index 8bd7ca799..f77386a55 100644 --- a/src/main/java/com/xero/api/client/PayrollAuApi.java +++ b/src/main/java/com/xero/api/client/PayrollAuApi.java @@ -207,7 +207,6 @@ public HttpResponse approveLeaveApplicationForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1077,7 +1076,6 @@ public HttpResponse getEmployeeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1188,7 +1186,6 @@ public HttpResponse getEmployeesForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (where != null) { @@ -1333,7 +1330,6 @@ public HttpResponse getLeaveApplicationForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1445,7 +1441,6 @@ public HttpResponse getLeaveApplicationsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveApplications"); if (where != null) { @@ -1612,7 +1607,6 @@ public HttpResponse getLeaveApplicationsV2ForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveApplications/v2"); if (where != null) { @@ -1779,7 +1773,6 @@ public HttpResponse getPayItemsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayItems"); if (where != null) { @@ -1923,7 +1916,6 @@ public HttpResponse getPayRunForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2033,7 +2025,6 @@ public HttpResponse getPayRunsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns"); if (where != null) { @@ -2182,7 +2173,6 @@ public HttpResponse getPayrollCalendarForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2294,7 +2284,6 @@ public HttpResponse getPayrollCalendarsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayrollCalendars"); if (where != null) { @@ -2438,7 +2427,6 @@ public HttpResponse getPayslipForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2519,7 +2507,6 @@ public HttpResponse getSettingsForHttpResponse(String accessToken, String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings"); String url = uriBuilder.build().toString(); @@ -2603,7 +2590,6 @@ public HttpResponse getSuperfundForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2695,7 +2681,6 @@ public HttpResponse getSuperfundProductsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/SuperfundProducts"); if (ABN != null) { @@ -2842,7 +2827,6 @@ public HttpResponse getSuperfundsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Superfunds"); if (where != null) { @@ -2986,7 +2970,6 @@ public HttpResponse getTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3098,7 +3081,6 @@ public HttpResponse getTimesheetsForHttpResponse( headers.setIfModifiedSince(ifModifiedSince.toString()); } headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); if (where != null) { @@ -3256,7 +3238,6 @@ public HttpResponse rejectLeaveApplicationForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/PayrollNzApi.java b/src/main/java/com/xero/api/client/PayrollNzApi.java index 12bd143fc..d8ff7e661 100644 --- a/src/main/java/com/xero/api/client/PayrollNzApi.java +++ b/src/main/java/com/xero/api/client/PayrollNzApi.java @@ -256,7 +256,6 @@ public HttpResponse approveTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2735,7 +2734,6 @@ public HttpResponse deleteEmployeeEarningsTemplateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2842,7 +2840,6 @@ public HttpResponse deleteEmployeeLeaveForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2943,7 +2940,6 @@ public HttpResponse deleteEmployeeSalaryAndWageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3058,7 +3054,6 @@ public HttpResponse deleteEmployeeWorkingPatternForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3155,7 +3150,6 @@ public HttpResponse deleteTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3258,7 +3252,6 @@ public HttpResponse deleteTimesheetLineForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3356,7 +3349,6 @@ public HttpResponse getDeductionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3449,7 +3441,6 @@ public HttpResponse getDeductionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Deductions"); if (page != null) { @@ -3561,7 +3552,6 @@ public HttpResponse getEarningsRateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3654,7 +3644,6 @@ public HttpResponse getEarningsRatesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsRates"); if (page != null) { @@ -3764,7 +3753,6 @@ public HttpResponse getEmployeeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3861,7 +3849,6 @@ public HttpResponse getEmployeeLeaveBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3976,7 +3963,6 @@ public HttpResponse getEmployeeLeavePeriodsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4117,7 +4103,6 @@ public HttpResponse getEmployeeLeaveTypesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4213,7 +4198,6 @@ public HttpResponse getEmployeeLeavesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4313,7 +4297,6 @@ public HttpResponse getEmployeeOpeningBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4415,7 +4398,6 @@ public HttpResponse getEmployeePayTemplatesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4517,7 +4499,6 @@ public HttpResponse getEmployeePaymentMethodForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4623,7 +4604,6 @@ public HttpResponse getEmployeeSalaryAndWageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4729,7 +4709,6 @@ public HttpResponse getEmployeeSalaryAndWagesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4845,7 +4824,6 @@ public HttpResponse getEmployeeTaxForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4958,7 +4936,6 @@ public HttpResponse getEmployeeWorkingPatternForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5061,7 +5038,6 @@ public HttpResponse getEmployeeWorkingPatternsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5160,7 +5136,6 @@ public HttpResponse getEmployeesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (filter != null) { @@ -5291,7 +5266,6 @@ public HttpResponse getLeaveTypeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5391,7 +5365,6 @@ public HttpResponse getLeaveTypesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveTypes"); if (page != null) { @@ -5521,7 +5494,6 @@ public HttpResponse getPayRunForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5618,7 +5590,6 @@ public HttpResponse getPayRunCalendarForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5712,7 +5683,6 @@ public HttpResponse getPayRunCalendarsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRunCalendars"); if (page != null) { @@ -5826,7 +5796,6 @@ public HttpResponse getPayRunsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns"); if (page != null) { @@ -5956,7 +5925,6 @@ public HttpResponse getPaySlipForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6056,7 +6024,6 @@ public HttpResponse getPaySlipsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PaySlips"); if (page != null) { @@ -6189,7 +6156,6 @@ public HttpResponse getReimbursementForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6282,7 +6248,6 @@ public HttpResponse getReimbursementsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reimbursements"); if (page != null) { @@ -6385,7 +6350,6 @@ public HttpResponse getSettingsForHttpResponse(String accessToken, String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings"); String url = uriBuilder.build().toString(); @@ -6470,7 +6434,6 @@ public HttpResponse getStatutoryDeductionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6558,7 +6521,6 @@ public HttpResponse getStatutoryDeductionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/StatutoryDeductions"); if (page != null) { @@ -6663,7 +6625,6 @@ public HttpResponse getSuperannuationForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6750,7 +6711,6 @@ public HttpResponse getSuperannuationsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Superannuations"); if (page != null) { @@ -6861,7 +6821,6 @@ public HttpResponse getTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6988,7 +6947,6 @@ public HttpResponse getTimesheetsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); if (page != null) { @@ -7193,7 +7151,6 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String accessToken, Str HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings/TrackingCategories"); @@ -7297,7 +7254,6 @@ public HttpResponse revertTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/PayrollUkApi.java b/src/main/java/com/xero/api/client/PayrollUkApi.java index a9709986e..97358466a 100644 --- a/src/main/java/com/xero/api/client/PayrollUkApi.java +++ b/src/main/java/com/xero/api/client/PayrollUkApi.java @@ -253,7 +253,6 @@ public HttpResponse approveTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2466,7 +2465,6 @@ public HttpResponse deleteEmployeeEarningsTemplateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept(""); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2573,7 +2571,6 @@ public HttpResponse deleteEmployeeLeaveForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2669,7 +2666,6 @@ public HttpResponse deleteEmployeeSalaryAndWageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept(""); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2765,7 +2761,6 @@ public HttpResponse deleteTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2868,7 +2863,6 @@ public HttpResponse deleteTimesheetLineForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -2965,7 +2959,6 @@ public HttpResponse getBenefitForHttpResponse(String accessToken, String xeroTen HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3057,7 +3050,6 @@ public HttpResponse getBenefitsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Benefits"); if (page != null) { @@ -3168,7 +3160,6 @@ public HttpResponse getDeductionForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3261,7 +3252,6 @@ public HttpResponse getDeductionsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Deductions"); if (page != null) { @@ -3373,7 +3363,6 @@ public HttpResponse getEarningsOrderForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3465,7 +3454,6 @@ public HttpResponse getEarningsOrdersForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsOrders"); if (page != null) { @@ -3577,7 +3565,6 @@ public HttpResponse getEarningsRateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3670,7 +3657,6 @@ public HttpResponse getEarningsRatesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsRates"); if (page != null) { @@ -3780,7 +3766,6 @@ public HttpResponse getEmployeeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3883,7 +3868,6 @@ public HttpResponse getEmployeeLeaveForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -3982,7 +3966,6 @@ public HttpResponse getEmployeeLeaveBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4097,7 +4080,6 @@ public HttpResponse getEmployeeLeavePeriodsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4238,7 +4220,6 @@ public HttpResponse getEmployeeLeaveTypesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4334,7 +4315,6 @@ public HttpResponse getEmployeeLeavesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4434,7 +4414,6 @@ public HttpResponse getEmployeeOpeningBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4538,7 +4517,6 @@ public HttpResponse getEmployeePayTemplateForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4640,7 +4618,6 @@ public HttpResponse getEmployeePaymentMethodForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4748,7 +4725,6 @@ public HttpResponse getEmployeeSalaryAndWageForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4854,7 +4830,6 @@ public HttpResponse getEmployeeSalaryAndWagesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -4994,7 +4969,6 @@ public HttpResponse getEmployeeStatutoryLeaveBalancesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5139,7 +5113,6 @@ public HttpResponse getEmployeeStatutorySickLeaveForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5236,7 +5209,6 @@ public HttpResponse getEmployeeTaxForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5335,7 +5307,6 @@ public HttpResponse getEmployeesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (filter != null) { @@ -5466,7 +5437,6 @@ public HttpResponse getLeaveTypeForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5566,7 +5536,6 @@ public HttpResponse getLeaveTypesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveTypes"); if (page != null) { @@ -5696,7 +5665,6 @@ public HttpResponse getPayRunForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5793,7 +5761,6 @@ public HttpResponse getPayRunCalendarForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -5887,7 +5854,6 @@ public HttpResponse getPayRunCalendarsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRunCalendars"); if (page != null) { @@ -6001,7 +5967,6 @@ public HttpResponse getPayRunsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns"); if (page != null) { @@ -6131,7 +6096,6 @@ public HttpResponse getPaySlipForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6231,7 +6195,6 @@ public HttpResponse getPaySlipsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payslips"); if (page != null) { @@ -6364,7 +6327,6 @@ public HttpResponse getReimbursementForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6457,7 +6419,6 @@ public HttpResponse getReimbursementsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reimbursements"); if (page != null) { @@ -6560,7 +6521,6 @@ public HttpResponse getSettingsForHttpResponse(String accessToken, String xeroTe HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings"); String url = uriBuilder.build().toString(); @@ -6662,7 +6622,6 @@ public HttpResponse getStatutoryLeaveSummaryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6778,7 +6737,6 @@ public HttpResponse getTimesheetForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -6905,7 +6863,6 @@ public HttpResponse getTimesheetsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); if (page != null) { @@ -7110,7 +7067,6 @@ public HttpResponse getTrackingCategoriesForHttpResponse(String accessToken, Str HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings/trackingCategories"); @@ -7214,7 +7170,6 @@ public HttpResponse revertTimesheetForHttpResponse( headers.set("Xero-Tenant-Id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); diff --git a/src/main/java/com/xero/api/client/ProjectApi.java b/src/main/java/com/xero/api/client/ProjectApi.java index 4e901ca93..9d8ea02fc 100644 --- a/src/main/java/com/xero/api/client/ProjectApi.java +++ b/src/main/java/com/xero/api/client/ProjectApi.java @@ -536,7 +536,6 @@ public HttpResponse deleteTaskForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -636,7 +635,6 @@ public HttpResponse deleteTimeEntryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -732,7 +730,6 @@ public HttpResponse getProjectForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -827,7 +824,6 @@ public HttpResponse getProjectUsersForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ProjectsUsers"); if (page != null) { @@ -979,7 +975,6 @@ public HttpResponse getProjectsForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Projects"); if (projectIds != null) { @@ -1177,7 +1172,6 @@ public HttpResponse getTaskForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1303,7 +1297,6 @@ public HttpResponse getTasksForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1552,7 +1545,6 @@ public HttpResponse getTimeEntriesForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); @@ -1858,7 +1850,6 @@ public HttpResponse getTimeEntryForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); - headers.setContentType(""); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); From 8ff765e80f1f04088e293d1ddeb6b2151416a1d6 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Tue, 24 Sep 2024 10:30:11 +0530 Subject: [PATCH 13/45] updated values from zero --- .../PayrollNzApiStatutoryDeductionsTest.java | 4 ++-- .../PayrollNzApiSuperannuationsTest.java | 6 ++--- .../client/ProjectsApiProjectTasksTest.java | 8 +++---- .../client/ProjectsApiProjectUsersTest.java | 2 +- .../api/client/ProjectsApiProjectsTest.java | 12 +++++----- .../client/ProjectsApiTimeEntriesTest.java | 24 +++++++++---------- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java index b461ca026..bb9c943e9 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java @@ -43,7 +43,7 @@ public void getStatutoryDeductionsTest() throws IOException { int page = 1; StatutoryDeductions response = payrollNzApi.getStatutoryDeductions(accessToken, xeroTenantId, page); - assertThat(response.getStatutoryDeductions().get(0).getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getStatutoryDeductions().get(0).getId(), is(equalTo(UUID.fromString("e3731829-9801-4809-a1a1-bbe40cd18b7e")))); assertThat(response.getStatutoryDeductions().get(0).getLiabilityAccountId(), is(equalTo(UUID.fromString("fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488")))); assertThat(response.getStatutoryDeductions().get(0).getName(), is(equalTo("Child Support"))); assertThat(response.getStatutoryDeductions().get(0).getStatutoryDeductionCategory(), is(equalTo(com.xero.models.payrollnz.StatutoryDeductionCategory.CHILDSUPPORT))); @@ -59,7 +59,7 @@ public void getStatutoryDeductionTest() throws IOException { UUID deductionId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); StatutoryDeductionObject response = payrollNzApi.getStatutoryDeduction(accessToken, xeroTenantId, deductionId); - assertThat(response.getStatutoryDeduction().getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getStatutoryDeduction().getId(), is(equalTo(UUID.fromString("e3731829-9801-4809-a1a1-bbe40cd18b7e")))); assertThat(response.getStatutoryDeduction().getLiabilityAccountId(), is(equalTo(UUID.fromString("fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488")))); assertThat(response.getStatutoryDeduction().getName(), is(equalTo("Child Support"))); assertThat(response.getStatutoryDeduction().getStatutoryDeductionCategory(), is(equalTo(com.xero.models.payrollnz.StatutoryDeductionCategory.CHILDSUPPORT))); diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java index 445d6a188..8ea5ae21e 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java @@ -43,7 +43,7 @@ public void getSuperannuationsTest() throws IOException { int page = 1; Superannuations response = payrollNzApi.getSuperannuations(accessToken, xeroTenantId, page); - assertThat(response.getBenefits().get(0).getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getBenefits().get(0).getId(), is(equalTo(UUID.fromString("563273ea-0dae-4f82-86a4-e0db77c008ea")))); assertThat(response.getBenefits().get(0).getLiabilityAccountId(), is(equalTo(UUID.fromString("fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488")))); assertThat(response.getBenefits().get(0).getExpenseAccountId(), is(equalTo(UUID.fromString("b343c3b0-5941-4166-82b4-dd926622e0e2")))); assertThat(response.getBenefits().get(0).getName(), is(equalTo("KiwiSaver"))); @@ -61,7 +61,7 @@ public void getSuperannuationTest() throws IOException { UUID superannuationId = UUID.fromString("cdfb8371-0b21-4b8a-8903-1024df6c391e"); SuperannuationObject response = payrollNzApi.getSuperannuation(accessToken, xeroTenantId, superannuationId); - assertThat(response.getBenefit().getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getBenefit().getId(), is(equalTo(UUID.fromString("563273ea-0dae-4f82-86a4-e0db77c008ea")))); assertThat(response.getBenefit().getLiabilityAccountId(), is(equalTo(UUID.fromString("fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488")))); assertThat(response.getBenefit().getExpenseAccountId(), is(equalTo(UUID.fromString("b343c3b0-5941-4166-82b4-dd926622e0e2")))); assertThat(response.getBenefit().getName(), is(equalTo("KiwiSaver"))); @@ -85,7 +85,7 @@ public void createSuperannuationTest() throws IOException { benefit.setPercentage(12.00); SuperannuationObject response = payrollNzApi.createSuperannuation(accessToken, xeroTenantId, benefit, null); - assertThat(response.getBenefit().getId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getBenefit().getId(), is(equalTo(UUID.fromString("8905a754-7ce8-40e2-9fa5-f819deb7adce")))); assertThat(response.getBenefit().getLiabilityAccountId(), is(equalTo(UUID.fromString("568f2e9a-0870-46cc-8678-f83f132ed4e3")))); assertThat(response.getBenefit().getExpenseAccountId(), is(equalTo(UUID.fromString("e4eb36f6-97e3-4427-a394-dd4e1b355c2e")))); assertThat(response.getBenefit().getName(), is(equalTo("SidSaver"))); diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java index 1ed860975..4f0c7a5e8 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java @@ -63,13 +63,13 @@ public void getTasksTest() throws IOException { assertThat(response.getPagination().getItemCount(), is(equalTo(1))); assertThat(response.getPagination().getPageCount(), is(equalTo(1))); assertThat(response.getPagination().getPageSize(), is(equalTo(50))); - assertThat(response.getItems().get(0).getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); assertThat(response.getItems().get(0).getName(), is(equalTo("Demolition"))); assertThat(response.getItems().get(0).getRate().getCurrency(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getItems().get(0).getRate().getValue(), is(equalTo(20.0))); assertThat(response.getItems().get(0).getChargeType(), is(equalTo(com.xero.models.project.ChargeType.TIME))); assertThat(response.getItems().get(0).getEstimateMinutes(), is(equalTo(12000))); - assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); assertThat(response.getItems().get(0).getTotalMinutes(), is(equalTo(180))); assertThat(response.getItems().get(0).getTotalAmount().getCurrency(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getItems().get(0).getTotalAmount().getValue(), is(equalTo(60.0))); @@ -94,13 +94,13 @@ public void getTaskTest() throws IOException { Task response = projectApi.getTask(accessToken, xeroTenantId, projectId, taskId); - assertThat(response.getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); assertThat(response.getName(), is(equalTo("Demolition"))); assertThat(response.getRate().getCurrency(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getRate().getValue(), is(equalTo(20.0))); assertThat(response.getChargeType(), is(equalTo(com.xero.models.project.ChargeType.TIME))); assertThat(response.getEstimateMinutes(), is(equalTo(12000))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); assertThat(response.getTotalMinutes(), is(equalTo(300))); assertThat(response.getTotalAmount().getCurrency(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getTotalAmount().getValue(), is(equalTo(100.0))); diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java index 76b6aaaf2..d45d0a2c1 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java @@ -62,7 +62,7 @@ public void getProjectUsersTest() throws IOException { assertThat(response.getPagination().getItemCount(), is(equalTo(2))); assertThat(response.getPagination().getPageCount(), is(equalTo(1))); assertThat(response.getPagination().getPageSize(), is(equalTo(50))); - assertThat(response.getItems().get(0).getUserId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getUserId(), is(equalTo(UUID.fromString("740add2a-a703-4b8a-a670-1093919c2040")))); assertThat(response.getItems().get(0).getName(), is(equalTo("Test User"))); assertThat(response.getItems().get(0).getEmail(), is(equalTo("test@xero.com"))); diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java index ebd7aacb4..7b3f938a4 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java @@ -66,8 +66,8 @@ public void getProjectsTest() throws IOException { assertThat(response.getPagination().getItemCount(), is(equalTo(9))); assertThat(response.getPagination().getPageCount(), is(equalTo(1))); assertThat(response.getPagination().getPageSize(), is(equalTo(50))); - assertThat(response.getItems().get(0).getContactId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getContactId(), is(equalTo(UUID.fromString("216830cb-9a68-487e-928b-c1a7ccc4fc81")))); + assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); assertThat(response.getItems().get(0).getName(), is(equalTo("FooProject28916"))); assertThat(response.getItems().get(0).getCurrencyCode(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getItems().get(0).getMinutesLogged(), is(equalTo(180))); @@ -109,8 +109,8 @@ public void createProjectsTest() throws IOException { projectCreateOrUpdate.setName("New Kitchen"); Project response = projectApi.createProject(accessToken, xeroTenantId, projectCreateOrUpdate, null); - assertThat(response.getContactId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getContactId(), is(equalTo(UUID.fromString("216830cb-9a68-487e-928b-c1a7ccc4fc81")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("ed957eee-bc6f-4f52-a663-aa42e6af9620")))); assertThat(response.getName(), is(equalTo("New Kitchen"))); assertThat(response.getCurrencyCode(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getMinutesLogged(), is(equalTo(0))); @@ -151,8 +151,8 @@ public void getProjectTest() throws IOException { UUID projectId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); Project response = projectApi.getProject(accessToken, xeroTenantId, projectId); - assertThat(response.getContactId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getContactId(), is(equalTo(UUID.fromString("216830cb-9a68-487e-928b-c1a7ccc4fc81")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); assertThat(response.getName(), is(equalTo("Remodeling 2012"))); assertThat(response.getCurrencyCode(), is(equalTo(com.xero.models.project.CurrencyCode.AUD))); assertThat(response.getMinutesLogged(), is(equalTo(180))); diff --git a/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java b/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java index 302231664..76db5ea74 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java @@ -74,10 +74,10 @@ public void getTimeEntriesTest() throws IOException { assertThat(response.getPagination().getItemCount(), is(equalTo(9))); assertThat(response.getPagination().getPageCount(), is(equalTo(1))); assertThat(response.getPagination().getPageSize(), is(equalTo(50))); - assertThat(response.getItems().get(0).getTimeEntryId(),is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getItems().get(0).getUserId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getItems().get(0).getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getItems().get(0).getTimeEntryId(),is(equalTo(UUID.fromString("3cd35eca-704f-4bca-b258-236028ae8ed1")))); + assertThat(response.getItems().get(0).getUserId(), is(equalTo(UUID.fromString("740add2a-a703-4b8a-a670-1093919c2040")))); + assertThat(response.getItems().get(0).getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); + assertThat(response.getItems().get(0).getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); assertThat(response.getItems().get(0).getDateUtc(), is(equalTo(OffsetDateTime.parse("2020-02-27T15:00Z")))); assertThat(response.getItems().get(0).getDateEnteredUtc(), is(equalTo(OffsetDateTime.parse("2020-02-28T03:24:29.221564100Z")))); assertThat(response.getItems().get(0).getDuration(), is(equalTo(45))); @@ -97,10 +97,10 @@ public void createTimeEntryTest() throws IOException { UUID projectId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); TimeEntry response = projectApi.createTimeEntry(accessToken, xeroTenantId, projectId, timeEntryCreateOrUpdate, null); - assertThat(response.getTimeEntryId(),is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getUserId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getTimeEntryId(),is(equalTo(UUID.fromString("c6539534-f1d2-43a6-80df-3bd1f8aca24d")))); + assertThat(response.getUserId(), is(equalTo(UUID.fromString("c6539534-f1d2-43a6-80df-3bd1f8aca24d")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); + assertThat(response.getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); assertThat(response.getDateUtc(), is(equalTo(OffsetDateTime.parse("2020-02-26T15:00Z")))); assertThat(response.getDateEnteredUtc(), is(equalTo(OffsetDateTime.parse("2020-02-28T20:37:42.865283200Z")))); assertThat(response.getDuration(), is(equalTo(30))); @@ -116,10 +116,10 @@ public void getTimeEntryTest() throws IOException { UUID timeEntryId = UUID.fromString("8138a266-fb42-49b2-a104-014b7045753d"); TimeEntry response = projectApi.getTimeEntry(accessToken, xeroTenantId, projectId, timeEntryId); - assertThat(response.getTimeEntryId(),is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getUserId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getProjectId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); - assertThat(response.getTaskId(), is(equalTo(UUID.fromString("00000000-0000-0000-0000-000000000000")))); + assertThat(response.getTimeEntryId(),is(equalTo(UUID.fromString("3cd35eca-704f-4bca-b258-236028ae8ed1")))); + assertThat(response.getUserId(), is(equalTo(UUID.fromString("740add2a-a703-4b8a-a670-1093919c2040")))); + assertThat(response.getProjectId(), is(equalTo(UUID.fromString("b021e7cb-1903-4292-b48b-5b27b4271e3e")))); + assertThat(response.getTaskId(), is(equalTo(UUID.fromString("7be77337-feec-4458-bb1b-dbaa5a4aafce")))); assertThat(response.getDateUtc(), is(equalTo(OffsetDateTime.parse("2020-02-27T15:00Z")))); assertThat(response.getDateEnteredUtc(), is(equalTo(OffsetDateTime.parse("2020-02-21T21:41:22.264272700Z")))); assertThat(response.getDuration(), is(equalTo(45))); From 90d068c9d2ae5ad7f89e94279ccf134d1772124f Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Tue, 24 Sep 2024 11:45:24 +0530 Subject: [PATCH 14/45] adds config file and reference from config file --- .../api/client/AccountingApiAccountsTest.java | 15 ++++++++++++--- .../client/AccountingApiBankTransactionTest.java | 14 +++++++++++--- .../client/AccountingApiBankTransferTest.java | 14 +++++++++++--- .../client/AccountingApiBatchPaymentTest.java | 15 ++++++++++++--- .../client/AccountingApiBrandingThemeTest.java | 15 ++++++++++++--- .../client/AccountingApiContactGroupTest.java | 14 +++++++++++--- .../api/client/AccountingApiContactsTest.java | 14 +++++++++++--- .../api/client/AccountingApiCreditNotesTest.java | 13 +++++++++++-- .../api/client/AccountingApiEmployeesTest.java | 13 +++++++++++-- .../client/AccountingApiExpenseClaimsTest.java | 13 +++++++++++-- .../api/client/AccountingApiInvoicesTest.java | 13 +++++++++++-- .../xero/api/client/AccountingApiItemsTest.java | 13 +++++++++++-- .../api/client/AccountingApiJournalsTest.java | 13 +++++++++++-- .../AccountingApiLinkedTransactionsTest.java | 13 +++++++++++-- .../client/AccountingApiManualJournalsTest.java | 13 +++++++++++-- .../client/AccountingApiOrganisationsTest.java | 13 +++++++++++-- .../client/AccountingApiOverpaymentsTest.java | 13 +++++++++++-- .../client/AccountingApiPaymentServicesTest.java | 13 +++++++++++-- .../api/client/AccountingApiPaymentsTest.java | 13 +++++++++++-- .../api/client/AccountingApiPrepaymentsTest.java | 13 +++++++++++-- .../client/AccountingApiPurchaseOrdersTest.java | 13 +++++++++++-- .../xero/api/client/AccountingApiQuotesTest.java | 15 ++++++++++++--- .../api/client/AccountingApiReceiptsTest.java | 13 +++++++++++-- .../AccountingApiRepeatingInvoicesTest.java | 13 +++++++++++-- .../api/client/AccountingApiReportsTest.java | 13 +++++++++++-- .../api/client/AccountingApiTaxRatesTest.java | 13 +++++++++++-- .../AccountingApiTrackingCategoriesTest.java | 13 +++++++++++-- .../xero/api/client/AccountingApiUsersTest.java | 13 +++++++++++-- .../com/xero/api/client/AppStoreApiTest.java | 14 ++++++++++++-- .../java/com/xero/api/client/AssetsApiTest.java | 14 ++++++++++++-- .../client/BankfeedApiFeedConnectionTest.java | 14 ++++++++++++-- .../api/client/BankfeedApiStatementTest.java | 14 ++++++++++++-- .../java/com/xero/api/client/FinanceApiTest.java | 16 +++++++++++----- src/test/resources/config.properties | 9 +++++++++ 34 files changed, 380 insertions(+), 77 deletions(-) create mode 100644 src/test/resources/config.properties diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java index 01f7b24a1..407a6b929 100644 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -10,6 +10,9 @@ import java.io.File; import org.threeten.bp.*; import java.util.UUID; +import java.util.Properties; +import java.io.IOException; +import java.io.InputStream; public class AccountingApiAccountsTest { @@ -29,9 +32,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiAccountsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java index 3d60e0b4a..7136dc7e5 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java @@ -11,6 +11,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiBankTransactionTest { @@ -29,9 +31,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiBankTransactionTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java index 44e7f8829..05ad16453 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java @@ -11,6 +11,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiBankTransferTest { @@ -30,9 +32,15 @@ public void setUp() { xeroTenantId = "xyz"; // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiBankTransferTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java index 84a88b29d..fd2bf2fbc 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java @@ -10,6 +10,9 @@ import java.io.File; import org.threeten.bp.*; import java.util.UUID; +import java.util.Properties; +import java.io.IOException; +import java.io.InputStream; public class AccountingApiBatchPaymentTest { ApiClient defaultClient; @@ -29,9 +32,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiBatchPaymentTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java index a2f6e7ced..9df609068 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java @@ -8,6 +8,9 @@ import com.xero.models.accounting.*; import java.util.UUID; +import java.util.Properties; +import java.io.IOException; +import java.io.InputStream; public class AccountingApiBrandingThemeTest { @@ -27,9 +30,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiBrandingThemeTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java index a65df9f84..ab8f4ed43 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiContactGroupTest { @@ -28,9 +30,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiContactGroupTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java index 6b37b35ec..170f96b95 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java @@ -13,6 +13,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiContactsTest { @@ -33,9 +35,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiContactsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java index adec2334d..409fbbe3c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java @@ -11,6 +11,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiCreditNotesTest { @@ -30,8 +32,15 @@ public void setUp() { xeroTenantId = "xyz"; // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiCreditNotesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java index 55cd2fd2b..b759f39ae 100644 --- a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiEmployeesTest { @@ -29,8 +31,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiEmployeesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java index 6dc2802ac..b952527ec 100644 --- a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java @@ -11,6 +11,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiExpenseClaimsTest { @@ -31,8 +33,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiExpenseClaimsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java index 271634335..146947d96 100644 --- a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java @@ -13,6 +13,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiInvoicesTest { @@ -32,8 +34,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiInvoicesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java index 1afeb63cd..978c5dff8 100644 --- a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiItemsTest { @@ -29,8 +31,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiItemsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java index 06e2eacf1..f80e0eed3 100644 --- a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiJournalsTest { @@ -28,8 +30,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiJournalsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java index c1991d772..d57cff1d6 100644 --- a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiLinkedTransactionsTest { @@ -29,8 +31,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiLinkedTransactionsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java index 396dcedac..5d3b98462 100644 --- a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java @@ -11,6 +11,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiManualJournalsTest { @@ -31,8 +33,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiManualJournalsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java index 009b2b4e5..aadb13ac1 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiOrganisationsTest { @@ -29,8 +31,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiOrganisationsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java index 1c8ab9234..5ee94739a 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java @@ -11,6 +11,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiOverpaymentsTest { @@ -31,8 +33,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiOverpaymentsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java index 54effc585..8152b7649 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiPaymentServicesTest { @@ -28,8 +30,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiPaymentServicesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java index 25a3d8ec4..b3b8e481d 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiPaymentsTest { @@ -26,8 +28,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiPaymentsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java index 3e4870982..c612f06fe 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiPrepaymentsTest { @@ -29,8 +31,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiPrepaymentsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java index a3f6f26a1..955348d86 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiPurchaseOrdersTest { @@ -28,8 +30,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiPurchaseOrdersTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java b/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java index 49e9da450..1d0e5eb88 100644 --- a/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java @@ -9,6 +9,9 @@ import org.threeten.bp.*; import java.util.UUID; +import java.util.Properties; +import java.io.IOException; +import java.io.InputStream; public class AccountingApiQuotesTest { @@ -28,9 +31,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiQuotesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java index 3a2d07ce8..ac6cf8e23 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java @@ -11,6 +11,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiReceiptsTest { @@ -30,8 +32,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiReceiptsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java index 34504b38c..7e57306c3 100644 --- a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java @@ -11,6 +11,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiRepeatingInvoicesTest { @@ -30,8 +32,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiRepeatingInvoicesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java index 1295f9b98..1525a0121 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiReportsTest { @@ -27,8 +29,15 @@ public void setUp() { xeroTenantId = "xyz"; // Init AccountingApi client - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiReportsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java index af2ce4ce4..a1ce75b70 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java @@ -8,6 +8,8 @@ import com.xero.models.accounting.*; import java.io.IOException; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiTaxRatesTest { @@ -26,8 +28,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiTaxRatesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java index 8c99de179..3f09a83d2 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiTrackingCategoriesTest { @@ -27,8 +29,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiTrackingCategoriesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java index e3def3ce9..4c9bed341 100644 --- a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.Properties; +import java.io.InputStream; public class AccountingApiUsersTest { @@ -28,8 +30,15 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AccountingApiUsersTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AppStoreApiTest.java b/src/test/java/com/xero/api/client/AppStoreApiTest.java index f5ff53d4a..d034b72e3 100644 --- a/src/test/java/com/xero/api/client/AppStoreApiTest.java +++ b/src/test/java/com/xero/api/client/AppStoreApiTest.java @@ -9,6 +9,9 @@ import com.xero.models.appstore.*; import java.util.UUID; +import java.util.Properties; +import java.io.IOException; +import java.io.InputStream; public class AppStoreApiTest { @@ -25,8 +28,15 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - defaultClient = new ApiClient("http://127.0.0.1:4011",null,null,null,null); - appStoreApi = AppStoreApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AppStoreApiTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("appstore.api.url"),null,null,null,null); + appStoreApi = AppStoreApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AssetsApiTest.java b/src/test/java/com/xero/api/client/AssetsApiTest.java index b566e32f3..03b54a955 100644 --- a/src/test/java/com/xero/api/client/AssetsApiTest.java +++ b/src/test/java/com/xero/api/client/AssetsApiTest.java @@ -11,6 +11,9 @@ import org.threeten.bp.*; import java.util.UUID; +import java.util.Properties; +import java.io.IOException; +import java.io.InputStream; import java.util.List; @@ -30,8 +33,15 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - defaultClient = new ApiClient("http://127.0.0.1:4012",null,null,null,null); - assetApi = AssetApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = AssetsApiTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("assets.api.url"),null,null,null,null); + assetApi = AssetApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java index 7fe49b2d3..162887ef5 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java @@ -12,6 +12,9 @@ import org.junit.Before; import org.junit.Test; +import java.util.Properties; +import java.io.InputStream; +import java.io.IOException; public class BankfeedApiFeedConnectionTest { @@ -31,8 +34,15 @@ public void setUp() { // Init AccountingApi client //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); - defaultClient = new ApiClient("http://127.0.0.1:4013",null,null,null,null); - bankfeedsApi = BankFeedsApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = BankfeedApiFeedConnectionTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("bankfeeds.api.url"),null,null,null,null); + bankfeedsApi = BankFeedsApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java index 27d008aae..aac44c88c 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java @@ -8,6 +8,9 @@ import com.xero.models.bankfeeds.*; import org.threeten.bp.*; +import java.util.Properties; +import java.io.IOException; +import java.io.InputStream; public class BankfeedApiStatementTest { @@ -27,8 +30,15 @@ public void setUp() { // Init AccountingApi client //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); - defaultClient = new ApiClient("http://127.0.0.1:4013",null,null,null,null); - bankfeedsApi = BankFeedsApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = BankfeedApiStatementTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("bankfeeds.api.url"),null,null,null,null); + bankfeedsApi = BankFeedsApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/FinanceApiTest.java b/src/test/java/com/xero/api/client/FinanceApiTest.java index 8be82ad6a..94323a94f 100644 --- a/src/test/java/com/xero/api/client/FinanceApiTest.java +++ b/src/test/java/com/xero/api/client/FinanceApiTest.java @@ -8,9 +8,9 @@ import com.xero.api.XeroApiException; import com.xero.models.finance.*; -import java.util.UUID; - import java.util.*; +import java.io.IOException; +import java.io.InputStream; public class FinanceApiTest { @@ -26,9 +26,15 @@ public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; xeroTenantId = "xyz"; - - defaultClient = new ApiClient("http://127.0.0.1:4014",null,null,null,null); - financeApi = FinanceApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = FinanceApiTest.class.getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("finance.api.url"),null,null,null,null); + financeApi = FinanceApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/resources/config.properties b/src/test/resources/config.properties new file mode 100644 index 000000000..092114adc --- /dev/null +++ b/src/test/resources/config.properties @@ -0,0 +1,9 @@ +accounting.api.url=http://127.0.0.1:4010 +appstore.api.url=http://127.0.0.1:4011 +assets.api.url=http://127.0.0.1:4012 +bankfeeds.api.url=http://127.0.0.1:4013 +finance.api.url=http://127.0.0.1:4014 +payrolluk.api.url=http://127.0.0.1:4015 +payrollnz.api.url=http://127.0.0.1:4016 +payrollau.api.url=http://127.0.0.1:4017 +projects.api.url=http://127.0.0.1:4018 From 024c46f4a7305797c0f0e5e765fc3c0f6d9018aa Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Tue, 24 Sep 2024 12:20:22 +0530 Subject: [PATCH 15/45] fixed review comments --- .../api/client/PayrollAuApiEmployeeTest.java | 13 +++++++++++-- .../client/PayrollAuApiLeaveApplicationTest.java | 13 +++++++++++-- .../xero/api/client/PayrollAuApiPayItemTest.java | 13 +++++++++++-- .../xero/api/client/PayrollAuApiPayRunTest.java | 13 +++++++++++-- .../client/PayrollAuApiPayrollCalendarTest.java | 13 +++++++++++-- .../xero/api/client/PayrollAuApiPayslipTest.java | 13 +++++++++++-- .../api/client/PayrollAuApiSettingsTest.java | 13 +++++++++++-- .../api/client/PayrollAuApiSuperFundTest.java | 13 +++++++++++-- .../client/PayrollAuApiSuperfundProductTest.java | 13 +++++++++++-- .../api/client/PayrollAuApiTimesheetTest.java | 13 +++++++++++-- .../api/client/PayrollNzApiDeductionsTest.java | 13 +++++++++++-- .../api/client/PayrollNzApiEarningRatesTest.java | 13 +++++++++++-- .../PayrollNzApiEmployeeLeaveBalancesTest.java | 13 +++++++++++-- .../PayrollNzApiEmployeeLeavePeriodsTest.java | 13 +++++++++++-- .../PayrollNzApiEmployeeLeaveSetupTest.java | 13 +++++++++++-- .../client/PayrollNzApiEmployeeLeaveTest.java | 13 +++++++++++-- .../PayrollNzApiEmployeeLeaveTypesTest.java | 13 +++++++++++-- .../PayrollNzApiEmployeeOpeningBalancesTest.java | 13 +++++++++++-- .../PayrollNzApiEmployeePayTemplatesTest.java | 13 +++++++++++-- .../api/client/PayrollNzApiEmployeeTaxTest.java | 13 +++++++++++-- .../api/client/PayrollNzApiEmployeeTest.java | 13 +++++++++++-- .../api/client/PayrollNzApiEmploymentTest.java | 13 +++++++++++-- .../api/client/PayrollNzApiLeaveTypesTest.java | 13 +++++++++++-- .../client/PayrollNzApiPayRunCalendarsTest.java | 13 +++++++++++-- .../xero/api/client/PayrollNzApiPayRunsTest.java | 13 +++++++++++-- .../api/client/PayrollNzApiPaySlipsTest.java | 14 +++++++++++--- .../client/PayrollNzApiPaymentMethodsTest.java | 13 +++++++++++-- .../client/PayrollNzApiReimbursementsTest.java | 14 +++++++++++--- .../client/PayrollNzApiSalaryAndWagesTest.java | 14 +++++++++++--- .../api/client/PayrollNzApiSettingsTest.java | 14 +++++++++++--- .../PayrollNzApiStatutoryDeductionsTest.java | 14 +++++++++++--- .../client/PayrollNzApiSuperannuationsTest.java | 14 +++++++++++--- .../api/client/PayrollNzApiTimesheetsTest.java | 16 +++++++++++----- .../PayrollNzApiTrackingCategoriesTest.java | 14 +++++++++++--- .../api/client/PayrollUkApiDeductionsTest.java | 13 +++++++++++-- .../api/client/PayrollUkApiEarningRatesTest.java | 14 +++++++++++--- .../client/PayrollUkApiEarningsOrdersTest.java | 14 +++++++++++--- .../PayrollUkApiEmployeeLeaveBalancesTest.java | 14 +++++++++++--- .../PayrollUkApiEmployeeLeavePeriodsTest.java | 14 +++++++++++--- .../client/PayrollUkApiEmployeeLeaveTest.java | 14 +++++++++++--- .../PayrollUkApiEmployeeLeaveTypesTest.java | 14 +++++++++++--- .../PayrollUkApiEmployeeOpeningBalancesTest.java | 14 +++++++++++--- .../PayrollUkApiEmployeePayTemplatesTest.java | 16 +++++++++++----- ...lUkApiEmployeeStatutoryLeaveBalancesTest.java | 14 +++++++++++--- ...lUkApiEmployeeStatutoryLeavesSummaryTest.java | 14 +++++++++++--- ...yrollUkApiEmployeeStatutorySickLeaveTest.java | 15 +++++++++++---- .../api/client/PayrollUkApiEmployeeTaxTest.java | 14 +++++++++++--- .../api/client/PayrollUkApiEmployeeTest.java | 14 +++++++++++--- .../client/PayrollUkApiEmployerPensionsTest.java | 14 +++++++++++--- .../api/client/PayrollUkApiEmploymentTest.java | 14 +++++++++++--- .../api/client/PayrollUkApiLeaveTypesTest.java | 14 +++++++++++--- .../client/PayrollUkApiPayRunCalendarsTest.java | 14 +++++++++++--- .../xero/api/client/PayrollUkApiPayRunsTest.java | 14 +++++++++++--- .../client/PayrollUkApiPaymentMethodsTest.java | 14 +++++++++++--- .../api/client/PayrollUkApiPayslipsTest.java | 14 +++++++++++--- .../client/PayrollUkApiReimbursementsTest.java | 14 +++++++++++--- .../api/client/PayrollUkApiSettingsTest.java | 14 +++++++++++--- .../api/client/PayrollUkApiTimesheetsTest.java | 16 +++++++++++----- .../PayrollUkApiTrackingCategoriesTest.java | 14 +++++++++++--- .../api/client/ProjectsApiProjectTasksTest.java | 14 +++++++++++--- .../api/client/ProjectsApiProjectUsersTest.java | 14 +++++++++++--- .../xero/api/client/ProjectsApiProjectsTest.java | 15 +++++++++++---- .../api/client/ProjectsApiTimeEntriesTest.java | 16 +++++++++++----- src/test/resources/config.properties | 9 +++++++++ 64 files changed, 702 insertions(+), 172 deletions(-) create mode 100644 src/test/resources/config.properties diff --git a/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java index 617f49c8f..1795db49b 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java @@ -12,6 +12,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiEmployeeTest { @@ -29,8 +31,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java b/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java index aaf18f023..e945f2ab1 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java @@ -12,6 +12,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiLeaveApplicationTest { @@ -29,8 +31,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java index b276a251b..8894817c1 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiPayItemTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java index 9c0af8643..2f31a14b4 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java @@ -12,6 +12,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiPayRunTest { @@ -29,8 +31,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java index 721e77f47..64e2d5b5f 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java @@ -12,6 +12,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiPayrollCalendarTest { @@ -29,8 +31,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java index aeaa26bca..39c7a5163 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java @@ -12,6 +12,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiPayslipTest { @@ -29,8 +31,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java b/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java index 4662fe8a9..c14499285 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiSettingsTest { @@ -26,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java b/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java index 174354da1..9c766e79b 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java @@ -12,6 +12,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiSuperFundTest { @@ -29,8 +31,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java b/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java index 73e3cb160..c3d0a2ef4 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java @@ -8,6 +8,8 @@ import com.xero.models.payrollau.*; import java.io.IOException; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiSuperfundProductTest { @@ -25,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java b/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java index f3d5df821..4bddaf493 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java @@ -12,6 +12,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollAuApiTimesheetTest { @@ -29,8 +31,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java index 3d6548c1d..2a398855e 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java @@ -10,6 +10,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiDeductionsTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java index c2c3bc3ca..2de0724ed 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java @@ -11,6 +11,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEarningRatesTest { @@ -28,8 +30,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java index baad8765d..a9f47c475 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmployeeLeaveBalancesTest { @@ -26,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java index bed2d6af0..6572dfc0b 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmployeeLeavePeriodsTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java index 39a9edcb0..def1629d6 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmployeeLeaveSetupTest { @@ -26,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java index 3b55fb6a3..576e4614c 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmployeeLeaveTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java index 2ada5713a..c0c6f2172 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmployeeLeaveTypesTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java index 7c121d7fd..3ce7d1111 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java @@ -12,6 +12,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmployeeOpeningBalancesTest { @@ -29,8 +31,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java index f4ae5f4f9..c259f03fc 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java @@ -11,6 +11,8 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmployeePayTemplatesTest { @@ -28,8 +30,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java index 0bda039d9..0824e9ddc 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmployeeTaxTest { @@ -26,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java index b9a94882a..90072c7c6 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmployeeTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java index b6e16d202..bf6e31c04 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiEmploymentTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java index 96a26192c..7408f1f68 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiLeaveTypesTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java index 7aab061db..e69770916 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiPayRunCalendarsTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java index 09e258ba5..64a81c7ca 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java @@ -10,6 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiPayRunsTest { @@ -27,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java index c6993f9db..cd9a40de1 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java @@ -9,7 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiPaySlipsTest { @@ -27,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java index 2e1033d37..6730ebd26 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiPaymentMethodsTest { @@ -26,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java index e79c7b1c8..dba9968ae 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrollnz.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiReimbursementsTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java index 73f30eb62..f15e2495c 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java @@ -11,7 +11,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiSalaryAndWagesTest { @@ -29,8 +30,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java index 3c98904ef..7060163b9 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrollnz.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiSettingsTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java index bb9c943e9..e31fde782 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrollnz.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiStatutoryDeductionsTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java index 8ea5ae21e..bf7e5a2a9 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrollnz.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiSuperannuationsTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java index efb12f7c1..2afd80d8b 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java @@ -9,9 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; -import java.util.ArrayList; -import java.util.List; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiTimesheetsTest { @@ -29,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java index a79059b86..6bf51909c 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollNzApiTrackingCategoriesTest { @@ -26,9 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4016",null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java index 694cec8bd..119cf0f00 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java @@ -8,6 +8,8 @@ import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiDeductionsTest { @@ -25,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java index f4aae1365..8238504ea 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java @@ -7,7 +7,8 @@ import com.xero.api.ApiClient; import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEarningRatesTest { @@ -25,8 +26,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java index c0f3fdca5..a774f9f23 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java @@ -7,7 +7,8 @@ import com.xero.api.ApiClient; import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEarningsOrdersTest { @@ -25,8 +26,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java index f48537b2c..1cc9b70d7 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeLeaveBalancesTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java index 6696c78ca..75169ebe3 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java @@ -9,7 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeLeavePeriodsTest { @@ -27,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java index fa82c5103..f6b91d866 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java @@ -9,7 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeLeaveTest { @@ -27,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java index ccdb073d2..9d64f2e14 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java @@ -9,7 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeLeaveTypesTest { @@ -27,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java index 0b5acd995..5dcabf2d2 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeOpeningBalancesTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java index afa9027ac..eade63759 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java @@ -8,9 +8,8 @@ import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeePayTemplatesTest { @@ -28,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java index 4d0ee21f9..c884d0d1a 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java @@ -9,7 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeStatutoryLeaveBalancesTest { @@ -27,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java index e022541e8..fe90f442a 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java @@ -9,7 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeStatutoryLeavesSummaryTest { @@ -27,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java index 00f3db911..3ee5c0658 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java @@ -9,8 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; -import java.util.List; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeStatutorySickLeaveTest { @@ -28,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java index 4ec6afe33..f23ad6f0c 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeTaxTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java index c10d0679b..c138d4c11 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java @@ -10,7 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployeeTest { @@ -28,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java index d6c55e911..59baa6a9b 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java @@ -10,7 +10,8 @@ import com.xero.models.payrolluk.Benefit.CategoryEnum; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmployerPensionsTest { @@ -28,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java index 5489eb2d9..8052438a2 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java @@ -10,7 +10,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiEmploymentTest { @@ -28,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java index c0c426ea0..10dcf988c 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiLeaveTypesTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java index ca6e1bca0..abd44d318 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiPayRunCalendarsTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java index 3acbed615..f6f197701 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java @@ -8,7 +8,8 @@ import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiPayRunsTest { @@ -26,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java index de0142a79..df1515422 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java @@ -7,7 +7,8 @@ import com.xero.api.ApiClient; import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiPaymentMethodsTest { @@ -25,8 +26,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java index b9cc422cf..93220166d 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java @@ -7,7 +7,8 @@ import com.xero.api.ApiClient; import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiPayslipsTest { @@ -25,8 +26,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java index 68cbe6f26..a6e780eba 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java @@ -7,7 +7,8 @@ import com.xero.api.ApiClient; import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiReimbursementsTest { @@ -25,8 +26,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java index b347f103c..ed98b76dc 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java @@ -7,7 +7,8 @@ import com.xero.api.ApiClient; import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiSettingsTest { @@ -25,8 +26,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java index a685668b6..5e37f6871 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java @@ -8,9 +8,8 @@ import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiTimesheetsTest { @@ -28,8 +27,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java index 0456dd479..546994e8e 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java @@ -7,7 +7,8 @@ import com.xero.api.ApiClient; import com.xero.models.payrolluk.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class PayrollUkApiTrackingCategoriesTest { @@ -25,8 +26,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4015",null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } } diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java index 4f0c7a5e8..78d54f5c5 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java @@ -8,7 +8,8 @@ import com.xero.models.project.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class ProjectsApiProjectTasksTest { @@ -27,8 +28,15 @@ public void setUp() { // Init projectsApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4018",null,null,null,null); - projectApi = ProjectApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("projects.api.url"),null,null,null,null); + projectApi = ProjectApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java index d45d0a2c1..5d0d202eb 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java @@ -8,7 +8,8 @@ import com.xero.models.project.*; import java.io.IOException; -import java.util.UUID; +import java.util.*; +import java.io.InputStream; public class ProjectsApiProjectUsersTest { @@ -27,8 +28,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4018",null,null,null,null); - projectApi = ProjectApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("projects.api.url"),null,null,null,null); + projectApi = ProjectApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java index 7b3f938a4..99afcdda4 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java @@ -9,8 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; -import java.util.List; +import java.util.*; +import java.io.InputStream; public class ProjectsApiProjectsTest { @@ -29,8 +29,15 @@ public void setUp() { // Init projectApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4018",null,null,null,null); - projectApi = projectApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("projects.api.url"),null,null,null,null); + projectApi = ProjectApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java b/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java index 76db5ea74..e9036ae05 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java @@ -9,9 +9,8 @@ import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; - -import java.util.List; +import java.util.*; +import java.io.InputStream; public class ProjectsApiTimeEntriesTest { @@ -30,8 +29,15 @@ public void setUp() { // Init projectsApi client // NEW Sandbox for API Mocking - defaultClient = new ApiClient("http://127.0.0.1:4018",null,null,null,null); - projectApi = ProjectApi.getInstance(defaultClient); + Properties properties = new Properties(); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ + properties.load(input); + defaultClient = new ApiClient(properties.getProperty("projects.api.url"),null,null,null,null); + projectApi = ProjectApi.getInstance(defaultClient); + + } catch (IOException ex) { + ex.printStackTrace(); + } // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/resources/config.properties b/src/test/resources/config.properties new file mode 100644 index 000000000..092114adc --- /dev/null +++ b/src/test/resources/config.properties @@ -0,0 +1,9 @@ +accounting.api.url=http://127.0.0.1:4010 +appstore.api.url=http://127.0.0.1:4011 +assets.api.url=http://127.0.0.1:4012 +bankfeeds.api.url=http://127.0.0.1:4013 +finance.api.url=http://127.0.0.1:4014 +payrolluk.api.url=http://127.0.0.1:4015 +payrollnz.api.url=http://127.0.0.1:4016 +payrollau.api.url=http://127.0.0.1:4017 +projects.api.url=http://127.0.0.1:4018 From ecd55818887fba06205c97d7f6fd07bb10f2ec41 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Tue, 24 Sep 2024 12:23:54 +0530 Subject: [PATCH 16/45] simplified getting classes --- .../java/com/xero/api/client/AccountingApiAccountsTest.java | 2 +- .../com/xero/api/client/AccountingApiBankTransactionTest.java | 2 +- .../java/com/xero/api/client/AccountingApiBankTransferTest.java | 2 +- .../java/com/xero/api/client/AccountingApiBatchPaymentTest.java | 2 +- .../com/xero/api/client/AccountingApiBrandingThemeTest.java | 2 +- .../java/com/xero/api/client/AccountingApiContactGroupTest.java | 2 +- .../java/com/xero/api/client/AccountingApiContactsTest.java | 2 +- .../java/com/xero/api/client/AccountingApiCreditNotesTest.java | 2 +- .../java/com/xero/api/client/AccountingApiEmployeesTest.java | 2 +- .../com/xero/api/client/AccountingApiExpenseClaimsTest.java | 2 +- .../java/com/xero/api/client/AccountingApiInvoicesTest.java | 2 +- src/test/java/com/xero/api/client/AccountingApiItemsTest.java | 2 +- .../java/com/xero/api/client/AccountingApiJournalsTest.java | 2 +- .../xero/api/client/AccountingApiLinkedTransactionsTest.java | 2 +- .../com/xero/api/client/AccountingApiManualJournalsTest.java | 2 +- .../com/xero/api/client/AccountingApiOrganisationsTest.java | 2 +- .../java/com/xero/api/client/AccountingApiOverpaymentsTest.java | 2 +- .../com/xero/api/client/AccountingApiPaymentServicesTest.java | 2 +- .../java/com/xero/api/client/AccountingApiPaymentsTest.java | 2 +- .../java/com/xero/api/client/AccountingApiPrepaymentsTest.java | 2 +- .../com/xero/api/client/AccountingApiPurchaseOrdersTest.java | 2 +- src/test/java/com/xero/api/client/AccountingApiQuotesTest.java | 2 +- .../java/com/xero/api/client/AccountingApiReceiptsTest.java | 2 +- .../com/xero/api/client/AccountingApiRepeatingInvoicesTest.java | 2 +- src/test/java/com/xero/api/client/AccountingApiReportsTest.java | 2 +- .../java/com/xero/api/client/AccountingApiTaxRatesTest.java | 2 +- .../xero/api/client/AccountingApiTrackingCategoriesTest.java | 2 +- src/test/java/com/xero/api/client/AccountingApiUsersTest.java | 2 +- src/test/java/com/xero/api/client/AppStoreApiTest.java | 2 +- src/test/java/com/xero/api/client/AssetsApiTest.java | 2 +- .../java/com/xero/api/client/BankfeedApiFeedConnectionTest.java | 2 +- src/test/java/com/xero/api/client/BankfeedApiStatementTest.java | 2 +- src/test/java/com/xero/api/client/FinanceApiTest.java | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java index 407a6b929..7d1717487 100644 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -33,7 +33,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiAccountsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java index 7136dc7e5..ab34553fe 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java @@ -32,7 +32,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiBankTransactionTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java index 05ad16453..d5fdab81c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java @@ -33,7 +33,7 @@ public void setUp() { // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiBankTransferTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java index fd2bf2fbc..c938a08e9 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java @@ -33,7 +33,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiBatchPaymentTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java index 9df609068..b74dee101 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java @@ -31,7 +31,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiBrandingThemeTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java index ab8f4ed43..84f369896 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java @@ -31,7 +31,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiContactGroupTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java index 170f96b95..2a88570b6 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java @@ -36,7 +36,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiContactsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java index 409fbbe3c..c15cc1d84 100644 --- a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java @@ -33,7 +33,7 @@ public void setUp() { // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiCreditNotesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java index b759f39ae..b59d4f30c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java @@ -32,7 +32,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiEmployeesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java index b952527ec..5752dae2f 100644 --- a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java @@ -34,7 +34,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiExpenseClaimsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java index 146947d96..9f5d59003 100644 --- a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java @@ -35,7 +35,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiInvoicesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java index 978c5dff8..8740d3dd3 100644 --- a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java @@ -32,7 +32,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiItemsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java index f80e0eed3..4187340c4 100644 --- a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java @@ -31,7 +31,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiJournalsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java index d57cff1d6..4538f9751 100644 --- a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java @@ -32,7 +32,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiLinkedTransactionsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java index 5d3b98462..1a0939ea5 100644 --- a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java @@ -34,7 +34,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiManualJournalsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java index aadb13ac1..e2000071d 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java @@ -32,7 +32,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiOrganisationsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java index 5ee94739a..2107da8f9 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java @@ -34,7 +34,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiOverpaymentsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java index 8152b7649..55dd63595 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java @@ -31,7 +31,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiPaymentServicesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java index b3b8e481d..c24495927 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java @@ -29,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiPaymentsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java index c612f06fe..043e9f673 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java @@ -32,7 +32,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiPrepaymentsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java index 955348d86..3238e1cb8 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java @@ -31,7 +31,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiPurchaseOrdersTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java b/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java index 1d0e5eb88..930599e68 100644 --- a/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java @@ -32,7 +32,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiQuotesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java index ac6cf8e23..c4a5aef08 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java @@ -33,7 +33,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiReceiptsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java index 7e57306c3..f0813d56c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java @@ -33,7 +33,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiRepeatingInvoicesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java index 1525a0121..927bcca85 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java @@ -30,7 +30,7 @@ public void setUp() { // Init AccountingApi client Properties properties = new Properties(); - try (InputStream input = AccountingApiReportsTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java index a1ce75b70..27564d80e 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java @@ -29,7 +29,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiTaxRatesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java index 3f09a83d2..1335313b6 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java @@ -30,7 +30,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiTrackingCategoriesTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java index 4c9bed341..34cdc8948 100644 --- a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java @@ -31,7 +31,7 @@ public void setUp() { // Init AccountingApi client // NEW Sandbox for API Mocking Properties properties = new Properties(); - try (InputStream input = AccountingApiUsersTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); accountingApi = AccountingApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AppStoreApiTest.java b/src/test/java/com/xero/api/client/AppStoreApiTest.java index d034b72e3..01f54684b 100644 --- a/src/test/java/com/xero/api/client/AppStoreApiTest.java +++ b/src/test/java/com/xero/api/client/AppStoreApiTest.java @@ -29,7 +29,7 @@ public void setUp() { xeroTenantId = "xyz"; Properties properties = new Properties(); - try (InputStream input = AppStoreApiTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("appstore.api.url"),null,null,null,null); appStoreApi = AppStoreApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/AssetsApiTest.java b/src/test/java/com/xero/api/client/AssetsApiTest.java index 03b54a955..d5b222e41 100644 --- a/src/test/java/com/xero/api/client/AssetsApiTest.java +++ b/src/test/java/com/xero/api/client/AssetsApiTest.java @@ -34,7 +34,7 @@ public void setUp() { xeroTenantId = "xyz"; Properties properties = new Properties(); - try (InputStream input = AssetsApiTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("assets.api.url"),null,null,null,null); assetApi = AssetApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java index 162887ef5..b5fea3f20 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java @@ -35,7 +35,7 @@ public void setUp() { // Init AccountingApi client //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); Properties properties = new Properties(); - try (InputStream input = BankfeedApiFeedConnectionTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("bankfeeds.api.url"),null,null,null,null); bankfeedsApi = BankFeedsApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java index aac44c88c..9e00b3e5d 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java @@ -31,7 +31,7 @@ public void setUp() { // Init AccountingApi client //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); Properties properties = new Properties(); - try (InputStream input = BankfeedApiStatementTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("bankfeeds.api.url"),null,null,null,null); bankfeedsApi = BankFeedsApi.getInstance(defaultClient); diff --git a/src/test/java/com/xero/api/client/FinanceApiTest.java b/src/test/java/com/xero/api/client/FinanceApiTest.java index 94323a94f..cbb9466f4 100644 --- a/src/test/java/com/xero/api/client/FinanceApiTest.java +++ b/src/test/java/com/xero/api/client/FinanceApiTest.java @@ -27,7 +27,7 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; Properties properties = new Properties(); - try (InputStream input = FinanceApiTest.class.getClassLoader().getResourceAsStream("config.properties")){ + try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ properties.load(input); defaultClient = new ApiClient(properties.getProperty("finance.api.url"),null,null,null,null); financeApi = FinanceApi.getInstance(defaultClient); From 334678dcec618a2c79babccef2cfb916c1e90b7b Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Tue, 24 Sep 2024 12:46:00 +0530 Subject: [PATCH 17/45] removed duplicate codes --- .../api/client/AccountingApiAccountsTest.java | 17 +++------------- .../AccountingApiBankTransactionTest.java | 16 +++------------ .../client/AccountingApiBankTransferTest.java | 15 +++----------- .../client/AccountingApiBatchPaymentTest.java | 17 +++------------- .../AccountingApiBrandingThemeTest.java | 19 ++++-------------- .../client/AccountingApiContactGroupTest.java | 16 +++------------ .../api/client/AccountingApiContactsTest.java | 16 +++------------ .../client/AccountingApiCreditNotesTest.java | 15 +++----------- .../client/AccountingApiEmployeesTest.java | 16 +++------------ .../AccountingApiExpenseClaimsTest.java | 16 +++------------ .../api/client/AccountingApiInvoicesTest.java | 16 +++------------ .../api/client/AccountingApiItemsTest.java | 16 +++------------ .../api/client/AccountingApiJournalsTest.java | 16 +++------------ .../AccountingApiLinkedTransactionsTest.java | 16 +++------------ .../AccountingApiManualJournalsTest.java | 16 +++------------ .../AccountingApiOrganisationsTest.java | 16 +++------------ .../client/AccountingApiOverpaymentsTest.java | 16 +++------------ .../AccountingApiPaymentServicesTest.java | 18 ++++------------- .../api/client/AccountingApiPaymentsTest.java | 16 +++------------ .../client/AccountingApiPrepaymentsTest.java | 16 +++------------ .../AccountingApiPurchaseOrdersTest.java | 18 ++++------------- .../api/client/AccountingApiQuotesTest.java | 17 +++------------- .../api/client/AccountingApiReceiptsTest.java | 16 +++------------ .../AccountingApiRepeatingInvoicesTest.java | 16 +++------------ .../api/client/AccountingApiReportsTest.java | 15 +++----------- .../api/client/AccountingApiTaxRatesTest.java | 18 ++++------------- .../AccountingApiTrackingCategoriesTest.java | 16 +++------------ .../api/client/AccountingApiUsersTest.java | 16 +++------------ .../com/xero/api/client/AppStoreApiTest.java | 15 +++----------- .../com/xero/api/client/AssetsApiTest.java | 16 +++------------ .../client/BankfeedApiFeedConnectionTest.java | 17 +++------------- .../api/client/BankfeedApiStatementTest.java | 17 +++------------- .../com/xero/api/client/FinanceApiTest.java | 12 +++-------- .../xero/api/util/ConfigurationLoader.java | 20 +++++++++++++++++++ 34 files changed, 123 insertions(+), 431 deletions(-) create mode 100644 src/test/java/com/xero/api/util/ConfigurationLoader.java diff --git a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java index 7d1717487..8d738d88d 100644 --- a/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiAccountsTest.java @@ -5,14 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.util.UUID; -import java.util.Properties; -import java.io.IOException; -import java.io.InputStream; public class AccountingApiAccountsTest { @@ -30,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java index ab34553fe..77973850c 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiBankTransactionTest { @@ -29,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java index d5fdab81c..9fcc0b2ea 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiBankTransferTest { @@ -31,16 +30,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java index c938a08e9..34635d365 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java @@ -5,14 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.util.UUID; -import java.util.Properties; -import java.io.IOException; -import java.io.InputStream; public class AccountingApiBatchPaymentTest { ApiClient defaultClient; @@ -30,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); bytes = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java index b74dee101..02a3d9b82 100644 --- a/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java @@ -5,12 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.util.UUID; -import java.util.Properties; -import java.io.IOException; -import java.io.InputStream; public class AccountingApiBrandingThemeTest { @@ -27,18 +25,9 @@ public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; xeroTenantId = "xyz"; - - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java index 84f369896..951265469 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java @@ -5,12 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiContactGroupTest { @@ -28,17 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java index 2a88570b6..8a5e7dfbe 100644 --- a/src/test/java/com/xero/api/client/AccountingApiContactsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiContactsTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; @@ -13,8 +14,6 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiContactsTest { @@ -33,17 +32,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java index c15cc1d84..a157a3778 100644 --- a/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiCreditNotesTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiCreditNotesTest { @@ -31,16 +30,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java index b59d4f30c..9d3ddff3a 100644 --- a/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiEmployeesTest { @@ -29,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java index 5752dae2f..dbe23f64e 100644 --- a/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiExpenseClaimsTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiExpenseClaimsTest { @@ -31,17 +30,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java index 9f5d59003..585445b30 100644 --- a/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; @@ -13,8 +14,6 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiInvoicesTest { @@ -32,17 +31,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java index 8740d3dd3..284cb0ef2 100644 --- a/src/test/java/com/xero/api/client/AccountingApiItemsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiItemsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiItemsTest { @@ -29,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java index 4187340c4..1f5583f3a 100644 --- a/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiJournalsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiJournalsTest { @@ -28,17 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java index 4538f9751..d58e040c3 100644 --- a/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiLinkedTransactionsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiLinkedTransactionsTest { @@ -29,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java index 1a0939ea5..2380c89c8 100644 --- a/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiManualJournalsTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiManualJournalsTest { @@ -31,17 +30,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java index e2000071d..a2e945daa 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOrganisationsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiOrganisationsTest { @@ -29,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java index 2107da8f9..c1cd3ae91 100644 --- a/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiOverpaymentsTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiOverpaymentsTest { @@ -31,17 +30,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java index 55dd63595..6e05a70b4 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentServicesTest.java @@ -5,12 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiPaymentServicesTest { @@ -26,19 +25,10 @@ public class AccountingApiPaymentServicesTest { public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; - xeroTenantId = "xyz"; - - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + xeroTenantId = "xyz"; - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java index c24495927..6879d7ae1 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPaymentsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiPaymentsTest { @@ -26,17 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java index 043e9f673..2b5fe2d18 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPrepaymentsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiPrepaymentsTest { @@ -29,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java index 3238e1cb8..29dd59842 100644 --- a/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiPurchaseOrdersTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiPurchaseOrdersTest { @@ -26,19 +25,10 @@ public class AccountingApiPurchaseOrdersTest { public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; - xeroTenantId = "xyz"; - - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); + xeroTenantId = "xyz"; - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java b/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java index 930599e68..886623bd1 100644 --- a/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiQuotesTest.java @@ -5,13 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.util.UUID; -import java.util.Properties; -import java.io.IOException; -import java.io.InputStream; public class AccountingApiQuotesTest { @@ -29,17 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java index c4a5aef08..04b2728d2 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReceiptsTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiReceiptsTest { @@ -30,17 +29,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java index f0813d56c..11a9c0ee4 100644 --- a/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiRepeatingInvoicesTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.File; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiRepeatingInvoicesTest { @@ -30,17 +29,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); ClassLoader classLoader = getClass().getClassLoader(); body = new File(classLoader.getResource("helo-heros.jpg").getFile()); diff --git a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java index 927bcca85..727254db3 100644 --- a/src/test/java/com/xero/api/client/AccountingApiReportsTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiReportsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiReportsTest { @@ -28,16 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java index 27564d80e..f3cbb59c6 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTaxRatesTest.java @@ -5,11 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.IOException; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiTaxRatesTest { @@ -25,18 +24,9 @@ public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; xeroTenantId = "xyz"; - - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java index 1335313b6..7ae2823cb 100644 --- a/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiTrackingCategoriesTest.java @@ -5,12 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiTrackingCategoriesTest { @@ -27,17 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java index 34cdc8948..9cf9d6d42 100644 --- a/src/test/java/com/xero/api/client/AccountingApiUsersTest.java +++ b/src/test/java/com/xero/api/client/AccountingApiUsersTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.accounting.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.Properties; -import java.io.InputStream; public class AccountingApiUsersTest { @@ -28,17 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null); - accountingApi = AccountingApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("accounting.api.url"),null,null,null,null); + accountingApi = AccountingApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AppStoreApiTest.java b/src/test/java/com/xero/api/client/AppStoreApiTest.java index 01f54684b..3930a772a 100644 --- a/src/test/java/com/xero/api/client/AppStoreApiTest.java +++ b/src/test/java/com/xero/api/client/AppStoreApiTest.java @@ -6,12 +6,10 @@ import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; import com.xero.api.XeroApiException; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.appstore.*; import java.util.UUID; -import java.util.Properties; -import java.io.IOException; -import java.io.InputStream; public class AppStoreApiTest { @@ -27,16 +25,9 @@ public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; xeroTenantId = "xyz"; - - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("appstore.api.url"),null,null,null,null); - appStoreApi = AppStoreApi.getInstance(defaultClient); - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("appstore.api.url"),null,null,null,null); + appStoreApi = AppStoreApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/AssetsApiTest.java b/src/test/java/com/xero/api/client/AssetsApiTest.java index d5b222e41..b0c6efb40 100644 --- a/src/test/java/com/xero/api/client/AssetsApiTest.java +++ b/src/test/java/com/xero/api/client/AssetsApiTest.java @@ -6,15 +6,12 @@ import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; import com.xero.api.XeroApiException; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.assets.*; import com.xero.models.assets.BookDepreciationSetting.DepreciationMethodEnum; import org.threeten.bp.*; import java.util.UUID; -import java.util.Properties; -import java.io.IOException; -import java.io.InputStream; - import java.util.List; public class AssetsApiTest { @@ -33,15 +30,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("assets.api.url"),null,null,null,null); - assetApi = AssetApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("assets.api.url"),null,null,null,null); + assetApi = AssetApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java index b5fea3f20..89588477c 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiFeedConnectionTest.java @@ -7,14 +7,12 @@ import java.util.UUID; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.bankfeeds.FeedConnection; import com.xero.models.bankfeeds.FeedConnections; import org.junit.Before; import org.junit.Test; -import java.util.Properties; -import java.io.InputStream; -import java.io.IOException; public class BankfeedApiFeedConnectionTest { @@ -31,18 +29,9 @@ public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; xeroTenantId = "xyz"; - - // Init AccountingApi client - //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("bankfeeds.api.url"),null,null,null,null); - bankfeedsApi = BankFeedsApi.getInstance(defaultClient); - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("bankfeeds.api.url"),null,null,null,null); + bankfeedsApi = BankFeedsApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java index 9e00b3e5d..03bf63bf0 100644 --- a/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java +++ b/src/test/java/com/xero/api/client/BankfeedApiStatementTest.java @@ -5,12 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.bankfeeds.*; import org.threeten.bp.*; -import java.util.Properties; -import java.io.IOException; -import java.io.InputStream; public class BankfeedApiStatementTest { @@ -28,17 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init AccountingApi client - //defaultClient = new ApiClient("https://virtserver.swaggerhub.com/Xero/bankfeeds/1.0.0",null,null,null,null); - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("bankfeeds.api.url"),null,null,null,null); - bankfeedsApi = BankFeedsApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("bankfeeds.api.url"),null,null,null,null); + bankfeedsApi = BankFeedsApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/FinanceApiTest.java b/src/test/java/com/xero/api/client/FinanceApiTest.java index cbb9466f4..04ccaa6d8 100644 --- a/src/test/java/com/xero/api/client/FinanceApiTest.java +++ b/src/test/java/com/xero/api/client/FinanceApiTest.java @@ -6,6 +6,7 @@ import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; import com.xero.api.XeroApiException; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.finance.*; import java.util.*; @@ -26,15 +27,8 @@ public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; xeroTenantId = "xyz"; - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("finance.api.url"),null,null,null,null); - financeApi = FinanceApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("finance.api.url"),null,null,null,null); + financeApi = FinanceApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/util/ConfigurationLoader.java b/src/test/java/com/xero/api/util/ConfigurationLoader.java new file mode 100644 index 000000000..e69c746c2 --- /dev/null +++ b/src/test/java/com/xero/api/util/ConfigurationLoader.java @@ -0,0 +1,20 @@ +package com.xero.api.util; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +public class ConfigurationLoader { + private static Properties properties = new Properties(); + + static { + try (InputStream input = ConfigurationLoader.class.getClassLoader().getResourceAsStream("config.properties")) { + properties.load(input); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + public static String getProperty(String key) { + return properties.getProperty(key); + } +} From 3f9c14c8b765f8205c48c1e448bc95f9dd49750b Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Tue, 24 Sep 2024 13:06:32 +0530 Subject: [PATCH 18/45] fixed review comments - remove duplicates --- .../api/client/PayrollAuApiEmployeeTest.java | 17 +++------------- .../PayrollAuApiLeaveApplicationTest.java | 17 +++------------- .../api/client/PayrollAuApiPayItemTest.java | 17 +++------------- .../api/client/PayrollAuApiPayRunTest.java | 16 +++------------ .../PayrollAuApiPayrollCalendarTest.java | 17 +++------------- .../api/client/PayrollAuApiPayslipTest.java | 16 +++------------ .../api/client/PayrollAuApiSettingsTest.java | 16 +++------------ .../api/client/PayrollAuApiSuperFundTest.java | 16 +++------------ .../PayrollAuApiSuperfundProductTest.java | 17 +++------------- .../api/client/PayrollAuApiTimesheetTest.java | 18 +++-------------- .../client/PayrollNzApiDeductionsTest.java | 17 +++------------- .../client/PayrollNzApiEarningRatesTest.java | 17 +++------------- ...PayrollNzApiEmployeeLeaveBalancesTest.java | 17 +++------------- .../PayrollNzApiEmployeeLeavePeriodsTest.java | 17 +++------------- .../PayrollNzApiEmployeeLeaveSetupTest.java | 17 +++------------- .../client/PayrollNzApiEmployeeLeaveTest.java | 17 +++------------- .../PayrollNzApiEmployeeLeaveTypesTest.java | 17 +++------------- ...yrollNzApiEmployeeOpeningBalancesTest.java | 17 +++------------- .../PayrollNzApiEmployeePayTemplatesTest.java | 17 +++------------- .../client/PayrollNzApiEmployeeTaxTest.java | 17 +++------------- .../api/client/PayrollNzApiEmployeeTest.java | 17 +++------------- .../client/PayrollNzApiEmploymentTest.java | 17 +++------------- .../client/PayrollNzApiLeaveTypesTest.java | 17 +++------------- .../PayrollNzApiPayRunCalendarsTest.java | 17 +++------------- .../api/client/PayrollNzApiPayRunsTest.java | 17 +++------------- .../api/client/PayrollNzApiPaySlipsTest.java | 16 +++------------ .../PayrollNzApiPaymentMethodsTest.java | 17 +++------------- .../PayrollNzApiReimbursementsTest.java | 16 +++------------ .../PayrollNzApiSalaryAndWagesTest.java | 16 +++------------ .../api/client/PayrollNzApiSettingsTest.java | 16 +++------------ .../PayrollNzApiStatutoryDeductionsTest.java | 16 +++------------ .../PayrollNzApiSuperannuationsTest.java | 16 +++------------ .../client/PayrollNzApiTimesheetsTest.java | 15 +++----------- .../PayrollNzApiTrackingCategoriesTest.java | 18 ++++------------- .../client/PayrollUkApiDeductionsTest.java | 17 +++------------- .../client/PayrollUkApiEarningRatesTest.java | 16 +++------------ .../PayrollUkApiEarningsOrdersTest.java | 16 +++------------ ...PayrollUkApiEmployeeLeaveBalancesTest.java | 16 +++------------ .../PayrollUkApiEmployeeLeavePeriodsTest.java | 16 +++------------ .../client/PayrollUkApiEmployeeLeaveTest.java | 16 +++------------ .../PayrollUkApiEmployeeLeaveTypesTest.java | 16 +++------------ ...yrollUkApiEmployeeOpeningBalancesTest.java | 16 +++------------ .../PayrollUkApiEmployeePayTemplatesTest.java | 16 +++------------ ...ApiEmployeeStatutoryLeaveBalancesTest.java | 16 +++------------ ...ApiEmployeeStatutoryLeavesSummaryTest.java | 16 +++------------ ...llUkApiEmployeeStatutorySickLeaveTest.java | 16 +++------------ .../client/PayrollUkApiEmployeeTaxTest.java | 16 +++------------ .../api/client/PayrollUkApiEmployeeTest.java | 16 +++------------ .../PayrollUkApiEmployerPensionsTest.java | 16 +++------------ .../client/PayrollUkApiEmploymentTest.java | 16 +++------------ .../client/PayrollUkApiLeaveTypesTest.java | 16 +++------------ .../PayrollUkApiPayRunCalendarsTest.java | 16 +++------------ .../api/client/PayrollUkApiPayRunsTest.java | 16 +++------------ .../PayrollUkApiPaymentMethodsTest.java | 16 +++------------ .../api/client/PayrollUkApiPayslipsTest.java | 17 +++------------- .../PayrollUkApiReimbursementsTest.java | 15 +++----------- .../api/client/PayrollUkApiSettingsTest.java | 15 +++----------- .../client/PayrollUkApiTimesheetsTest.java | 15 +++----------- .../PayrollUkApiTrackingCategoriesTest.java | 15 +++----------- .../client/ProjectsApiProjectTasksTest.java | 15 +++----------- .../client/ProjectsApiProjectUsersTest.java | 15 +++----------- .../api/client/ProjectsApiProjectsTest.java | 15 +++----------- .../client/ProjectsApiTimeEntriesTest.java | 15 +++----------- .../xero/api/util/ConfigurationLoader.java | 20 +++++++++++++++++++ 64 files changed, 210 insertions(+), 836 deletions(-) create mode 100644 src/test/java/com/xero/api/util/ConfigurationLoader.java diff --git a/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java index 1795db49b..f3267341f 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import org.threeten.bp.*; @@ -12,8 +13,6 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.*; -import java.io.InputStream; public class PayrollAuApiEmployeeTest { @@ -29,18 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java b/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java index e945f2ab1..02531fb5a 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiLeaveApplicationTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import org.threeten.bp.*; @@ -12,8 +13,6 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.*; -import java.io.InputStream; public class PayrollAuApiLeaveApplicationTest { @@ -29,18 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java index 8894817c1..3e806a1bc 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollAuApiPayItemTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java index 2f31a14b4..d30ff1393 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import org.threeten.bp.*; @@ -12,8 +13,6 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.*; -import java.io.InputStream; public class PayrollAuApiPayRunTest { @@ -29,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java index 64e2d5b5f..2fdcc80f3 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayrollCalendarTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import org.threeten.bp.*; @@ -12,8 +13,6 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.*; -import java.io.InputStream; public class PayrollAuApiPayrollCalendarTest { @@ -29,18 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java b/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java index 39c7a5163..349ca07ac 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import org.threeten.bp.*; @@ -12,8 +13,6 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.*; -import java.io.InputStream; public class PayrollAuApiPayslipTest { @@ -29,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java b/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java index c14499285..343575b28 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiSettingsTest.java @@ -5,12 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollAuApiSettingsTest { @@ -26,17 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java b/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java index 9c766e79b..5d7477a27 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiSuperFundTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import org.threeten.bp.*; @@ -12,8 +13,6 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.*; -import java.io.InputStream; public class PayrollAuApiSuperFundTest { @@ -29,17 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java b/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java index c3d0a2ef4..e07614691 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiSuperfundProductTest.java @@ -5,12 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import java.io.IOException; -import java.util.*; -import java.io.InputStream; - public class PayrollAuApiSuperfundProductTest { ApiClient defaultClient; @@ -25,17 +23,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java b/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java index 4bddaf493..908b0a75d 100644 --- a/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java +++ b/src/test/java/com/xero/api/client/PayrollAuApiTimesheetTest.java @@ -5,13 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollau.*; import org.threeten.bp.*; import java.io.IOException; -import java.util.UUID; -import java.util.List; -import java.util.ArrayList; import java.util.*; import java.io.InputStream; @@ -28,19 +26,9 @@ public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; xeroTenantId = "xyz"; - - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollau.api.url"),null,null,null,null); - payrollAuApi = PayrollAuApi.getInstance(defaultClient); - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollau.api.url"),null,null,null,null); + payrollAuApi = PayrollAuApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java index 2a398855e..b97fb3738 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiDeductionsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import com.xero.models.payrollnz.Deduction.DeductionCategoryEnum; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiDeductionsTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java index 2de0724ed..28303e2f7 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEarningRatesTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import com.xero.models.payrollnz.EarningsRate.EarningsTypeEnum; import com.xero.models.payrollnz.EarningsRate.RateTypeEnum; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEarningRatesTest { @@ -28,18 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java index a9f47c475..f4464026a 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveBalancesTest.java @@ -5,12 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmployeeLeaveBalancesTest { @@ -26,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java index 6572dfc0b..1528dee14 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeavePeriodsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmployeeLeavePeriodsTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java index def1629d6..99c3f4b5a 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveSetupTest.java @@ -5,12 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmployeeLeaveSetupTest { @@ -26,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java index 576e4614c..c60994e63 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmployeeLeaveTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java index c0c6f2172..dc5cd87f5 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeLeaveTypesTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmployeeLeaveTypesTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java index 3ce7d1111..4052aba1a 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeOpeningBalancesTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; @@ -12,8 +13,6 @@ import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmployeeOpeningBalancesTest { @@ -29,18 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java index c259f03fc..0f3f2f8d9 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeePayTemplatesTest.java @@ -5,14 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; import java.util.UUID; import java.util.List; import java.util.ArrayList; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmployeePayTemplatesTest { @@ -28,18 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java index 0824e9ddc..b0f6c606b 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTaxTest.java @@ -5,12 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmployeeTaxTest { @@ -26,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java index 90072c7c6..fd0ee7893 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmployeeTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmployeeTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java b/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java index bf6e31c04..c9277153a 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiEmploymentTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiEmploymentTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java index 7408f1f68..ae9c42437 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiLeaveTypesTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiLeaveTypesTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java index e69770916..b3404e7cd 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPayRunCalendarsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiPayRunCalendarsTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java index 64a81c7ca..9e8cdf0a3 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPayRunsTest.java @@ -5,13 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiPayRunsTest { @@ -27,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java index cd9a40de1..ef886e4ab 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPaySlipsTest.java @@ -5,12 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollNzApiPaySlipsTest { @@ -26,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java index 6730ebd26..a143ffaf7 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiPaymentMethodsTest.java @@ -5,12 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollNzApiPaymentMethodsTest { @@ -26,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java index dba9968ae..a665ea671 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiReimbursementsTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollNzApiReimbursementsTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java index f15e2495c..af3d59276 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSalaryAndWagesTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import com.xero.models.payrollnz.SalaryAndWage.PaymentTypeEnum; import com.xero.models.payrollnz.SalaryAndWage.StatusEnum; @@ -12,7 +13,6 @@ import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollNzApiSalaryAndWagesTest { @@ -28,18 +28,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java index 7060163b9..452fdb5d7 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSettingsTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollNzApiSettingsTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java index e31fde782..6432b99ba 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiStatutoryDeductionsTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollNzApiStatutoryDeductionsTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java index bf7e5a2a9..80deadf87 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiSuperannuationsTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollNzApiSuperannuationsTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java b/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java index 2afd80d8b..433ae18f5 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiTimesheetsTest.java @@ -5,12 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollNzApiTimesheetsTest { @@ -26,17 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java index 6bf51909c..bc9740cea 100644 --- a/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/PayrollNzApiTrackingCategoriesTest.java @@ -5,12 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrollnz.*; import java.io.IOException; -import java.util.UUID; import java.util.*; -import java.io.InputStream; public class PayrollNzApiTrackingCategoriesTest { @@ -25,18 +24,9 @@ public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; xeroTenantId = "xyz"; - - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrollnz.api.url"),null,null,null,null); - payrollNzApi = PayrollNzApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrollnz.api.url"),null,null,null,null); + payrollNzApi = PayrollNzApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java index 119cf0f00..b701af4ed 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiDeductionsTest.java @@ -5,11 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.UUID; -import java.util.*; -import java.io.InputStream; public class PayrollUkApiDeductionsTest { @@ -25,18 +24,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java index 8238504ea..69a795aab 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEarningRatesTest.java @@ -5,10 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEarningRatesTest { @@ -24,18 +24,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java index a774f9f23..6db7d140e 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEarningsOrdersTest.java @@ -5,10 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEarningsOrdersTest { @@ -24,18 +24,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java index 1cc9b70d7..efa5d0e49 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveBalancesTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeLeaveBalancesTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java index 75169ebe3..e1d7d529b 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeavePeriodsTest.java @@ -5,12 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeLeavePeriodsTest { @@ -26,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java index f6b91d866..6d6ba3892 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTest.java @@ -5,12 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeLeaveTest { @@ -26,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java index 9d64f2e14..7b59395dc 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeLeaveTypesTest.java @@ -5,12 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeLeaveTypesTest { @@ -26,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java index 5dcabf2d2..cb276d772 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeOpeningBalancesTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeOpeningBalancesTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java index eade63759..1903527d7 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeePayTemplatesTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeePayTemplatesTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java index c884d0d1a..2541adfd9 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeaveBalancesTest.java @@ -5,12 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeStatutoryLeaveBalancesTest { @@ -26,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java index fe90f442a..ebf24043b 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutoryLeavesSummaryTest.java @@ -5,12 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeStatutoryLeavesSummaryTest { @@ -26,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java index 3ee5c0658..8ebb77494 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeStatutorySickLeaveTest.java @@ -5,12 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeStatutorySickLeaveTest { @@ -26,18 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java index f23ad6f0c..aafdb7f5c 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTaxTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeTaxTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java index c138d4c11..c8678ee13 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployeeTest.java @@ -5,13 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import com.xero.models.payrolluk.Employee.GenderEnum; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployeeTest { @@ -27,18 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java index 59baa6a9b..f6e5d0668 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmployerPensionsTest.java @@ -5,13 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import com.xero.models.payrolluk.Benefit.CalculationTypeEnum; import com.xero.models.payrolluk.Benefit.CategoryEnum; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmployerPensionsTest { @@ -27,18 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java b/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java index 8052438a2..bf8f001a5 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiEmploymentTest.java @@ -5,13 +5,13 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import com.xero.models.payrolluk.Employment.NiCategoryEnum; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiEmploymentTest { @@ -27,18 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java index 10dcf988c..a29ac76f9 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiLeaveTypesTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiLeaveTypesTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java index abd44d318..9b5dc97cd 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPayRunCalendarsTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiPayRunCalendarsTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java index f6f197701..96540344b 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPayRunsTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiPayRunsTest { @@ -25,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java index df1515422..1430f260d 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPaymentMethodsTest.java @@ -5,10 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiPaymentMethodsTest { @@ -24,18 +24,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java index 93220166d..3b0dbaedc 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiPayslipsTest.java @@ -5,11 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; - public class PayrollUkApiPayslipsTest { ApiClient defaultClient; @@ -24,18 +23,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java index a6e780eba..b4daf10e4 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiReimbursementsTest.java @@ -5,10 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiReimbursementsTest { @@ -24,17 +24,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java index ed98b76dc..43d13f39e 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiSettingsTest.java @@ -5,10 +5,10 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiSettingsTest { @@ -24,17 +24,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java b/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java index 5e37f6871..8141fc3a3 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiTimesheetsTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class PayrollUkApiTimesheetsTest { @@ -25,17 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } diff --git a/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java b/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java index 546994e8e..9d09b9f62 100644 --- a/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java +++ b/src/test/java/com/xero/api/client/PayrollUkApiTrackingCategoriesTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.payrolluk.*; import java.io.IOException; import java.util.*; @@ -24,18 +25,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("payrolluk.api.url"),null,null,null,null); - payrollUkApi = PayrollUkApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } - + defaultClient = new ApiClient(ConfigurationLoader.getProperty("payrolluk.api.url"),null,null,null,null); + payrollUkApi = PayrollUkApi.getInstance(defaultClient); } public void tearDown() { diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java index 78d54f5c5..a6c3b5421 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectTasksTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.project.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class ProjectsApiProjectTasksTest { @@ -26,17 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectsApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("projects.api.url"),null,null,null,null); - projectApi = ProjectApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("projects.api.url"),null,null,null,null); + projectApi = ProjectApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java index 5d0d202eb..7f8d5dadc 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectUsersTest.java @@ -5,11 +5,11 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.project.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class ProjectsApiProjectUsersTest { @@ -26,17 +26,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("projects.api.url"),null,null,null,null); - projectApi = ProjectApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("projects.api.url"),null,null,null,null); + projectApi = ProjectApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java b/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java index 99afcdda4..47580c375 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiProjectsTest.java @@ -5,12 +5,12 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.project.*; import org.threeten.bp.*; import java.io.IOException; import java.util.*; -import java.io.InputStream; public class ProjectsApiProjectsTest { @@ -27,17 +27,8 @@ public void setUp() { accessToken = "123"; xeroTenantId = "xyz"; - // Init projectApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("projects.api.url"),null,null,null,null); - projectApi = ProjectApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("projects.api.url"),null,null,null,null); + projectApi = ProjectApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java b/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java index e9036ae05..0444f4178 100644 --- a/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java +++ b/src/test/java/com/xero/api/client/ProjectsApiTimeEntriesTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import com.xero.api.ApiClient; +import com.xero.api.util.ConfigurationLoader; import com.xero.models.project.*; import org.threeten.bp.*; @@ -26,18 +27,8 @@ public void setUp() { // Set Access Token and Tenant Id accessToken = "123"; xeroTenantId = "xyz"; - - // Init projectsApi client - // NEW Sandbox for API Mocking - Properties properties = new Properties(); - try (InputStream input = getClass().getClassLoader().getResourceAsStream("config.properties")){ - properties.load(input); - defaultClient = new ApiClient(properties.getProperty("projects.api.url"),null,null,null,null); - projectApi = ProjectApi.getInstance(defaultClient); - - } catch (IOException ex) { - ex.printStackTrace(); - } + defaultClient = new ApiClient(ConfigurationLoader.getProperty("projects.api.url"),null,null,null,null); + projectApi = ProjectApi.getInstance(defaultClient); // ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs if (setUpIsDone) { diff --git a/src/test/java/com/xero/api/util/ConfigurationLoader.java b/src/test/java/com/xero/api/util/ConfigurationLoader.java new file mode 100644 index 000000000..e69c746c2 --- /dev/null +++ b/src/test/java/com/xero/api/util/ConfigurationLoader.java @@ -0,0 +1,20 @@ +package com.xero.api.util; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +public class ConfigurationLoader { + private static Properties properties = new Properties(); + + static { + try (InputStream input = ConfigurationLoader.class.getClassLoader().getResourceAsStream("config.properties")) { + properties.load(input); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + public static String getProperty(String key) { + return properties.getProperty(key); + } +} From 349b76e0b088bd936fa3fad279c6e0a6fee736b9 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Tue, 24 Sep 2024 13:39:38 +0530 Subject: [PATCH 19/45] Updated Readme.md file for running test cases --- README.md | 11 +++++++++++ src/test/java/com/xero/api/util/start-prism.sh | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100755 src/test/java/com/xero/api/util/start-prism.sh diff --git a/README.md b/README.md index e2e838648..b3e15156a 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ The **Xero-Java** SDK makes it easy for developers to access Xero's APIs in thei - [App Store Subscriptions](#app-store-subscriptions) - [API Clients](#api-clients) - [Usage Examples](#usage-examples) +- [Running Test(s) in Local](#running-tests-in-local) - [SDK conventions](#sdk-conventions) - [Participating in Xero’s developer community](#participating-in-xeros-developoer-community) @@ -677,7 +678,17 @@ try { System.out.println(e.getMessage()); } ``` +## Running Test(s) in Local +For Running Test cases PRISM Mock Server needs to be started in the local machine. +Steps to Run Test(s) +* Install PRISM from npm using the command: **npm install -g @stoplight/prism-cli** +* Verify Installation: **prism --version** +* Navigate to **Xero-Java--> src--> test--> util** folder in the terminal +* Execute the script **./start-prism.sh** +* This will start the PRISM Server in Local +* Run **mvn clean verify -DskipTests=false** to build the Java code along with Test Cases. +--- ## SDK conventions ### Working with dates diff --git a/src/test/java/com/xero/api/util/start-prism.sh b/src/test/java/com/xero/api/util/start-prism.sh new file mode 100755 index 000000000..92b55f1dd --- /dev/null +++ b/src/test/java/com/xero/api/util/start-prism.sh @@ -0,0 +1,9 @@ +prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_accounting.yaml --host 127.0.0.1 --port 4010 & +prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-app-store.yaml --host 127.0.0.1 --port 4011 & +prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_assets.yaml --host 127.0.0.1 --port 4012 & +prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_bankfeeds.yaml --host 127.0.0.1 --port 4013 & +prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-finance.yaml --host 127.0.0.1 --port 4014 & +prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-uk.yaml --host 127.0.0.1 --port 4015 & +prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-nz.yaml --host 127.0.0.1 --port 4016 & +prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-au.yaml --host 127.0.0.1 --port 4017 & +prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-projects.yaml --host 127.0.0.1 --port 4018 From d0a28a4537c92827253eee0ae2325773481399a2 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Tue, 24 Sep 2024 16:50:27 +0530 Subject: [PATCH 20/45] remove duplicate content type setting --- src/main/java/com/xero/api/client/AccountingApi.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index db8a1dd05..e4d8488ea 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -528,7 +528,6 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); - headers.setContentType("application/octet-stream"); headers.setAccept("application/json"); headers.setContentType("application/octet-stream"); headers.setUserAgent(this.getUserAgent()); From b209452751ced99128b16920e50df095e6520959 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Wed, 25 Sep 2024 16:47:28 +0530 Subject: [PATCH 21/45] Replaced byte content type by binary for octet-stream --- docs/v4/accounting/index.html | 1288 ++- docs/v4/appstore/index.html | 9 +- docs/v4/assets/index.html | 38 +- docs/v4/payroll-au/index.html | 31 +- docs/v4/payroll-nz/index.html | 329 +- docs/v4/payroll-uk/index.html | 207 +- .../com/xero/api/client/AccountingApi.java | 7024 +++++------------ .../com/xero/models/payrollnz/Employee.java | 7 +- .../com/xero/models/payrollnz/Employment.java | 11 +- .../com/xero/models/payrolluk/Employee.java | 11 +- .../com/xero/models/payrolluk/Employment.java | 10 +- 11 files changed, 3550 insertions(+), 5415 deletions(-) diff --git a/docs/v4/accounting/index.html b/docs/v4/accounting/index.html index 9667a9f00..5f020aa02 100644 --- a/docs/v4/accounting/index.html +++ b/docs/v4/accounting/index.html @@ -7212,7 +7212,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Account" }, - "example" : "{ \"Code\":\"123456\", \"Name\":\"Foobar\", \"Type\":\"EXPENSE\", \"Description\":\"Hello World\" }" + "example" : { + "Code" : "123456", + "Name" : "Foobar", + "Type" : "EXPENSE", + "Description" : "Hello World" + } } }, "required" : true @@ -7263,14 +7268,9 @@

Usage and SDK Samples

UUID accountID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.createAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createAccountAttachmentByFileName"); @@ -7408,7 +7408,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -7425,7 +7425,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -7477,14 +7477,9 @@

Usage and SDK Samples

UUID bankTransactionID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.createBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createBankTransactionAttachmentByFileName"); @@ -7622,7 +7617,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -7639,7 +7634,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -7831,7 +7826,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -8007,7 +8006,23 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/BankTransactions" }, - "example" : "{ bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, contact: { contactID: \"00000000-0000-0000-0000-000000000000\" }, lineItems: [{ description: \"Foobar\", quantity: 1.0, unitAmount: 20.0, accountCode: \"000\" } ], bankAccount: { code: \"000\" }}]}" + "example" : { + "bankTransactions" : [ { + "type" : "BankTransaction.TypeEnum.SPEND", + "contact" : { + "contactID" : "00000000-0000-0000-0000-000000000000" + }, + "lineItems" : [ { + "description" : "Foobar", + "quantity" : 1.0, + "unitAmount" : 20.0, + "accountCode" : "000" + } ], + "bankAccount" : { + "code" : "000" + } + } ] + } } }, "required" : true @@ -8218,7 +8233,50 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/BankTransfers" }, - "example" : "{ \"BankTransfers\": [ { \"FromBankAccount\": { \"Code\": \"090\", \"Name\": \"My Savings\", \"AccountID\": \"00000000-0000-0000-0000-000000000000\", \"Type\": \"BANK\", \"BankAccountNumber\": \"123455\", \"Status\": \"ACTIVE\", \"BankAccountType\": \"BANK\", \"CurrencyCode\": \"USD\", \"TaxType\": \"NONE\", \"EnablePaymentsToAccount\": false, \"ShowInExpenseClaims\": false, \"Class\": \"ASSET\", \"ReportingCode\": \"ASS\", \"ReportingCodeName\": \"Assets\", \"HasAttachments\": false, \"UpdatedDateUTC\": \"2016-10-17T13:45:33.993-07:00\" }, \"ToBankAccount\": { \"Code\": \"088\", \"Name\": \"Business Wells Fargo\", \"AccountID\": \"00000000-0000-0000-0000-000000000000\", \"Type\": \"BANK\", \"BankAccountNumber\": \"123455\", \"Status\": \"ACTIVE\", \"BankAccountType\": \"BANK\", \"CurrencyCode\": \"USD\", \"TaxType\": \"NONE\", \"EnablePaymentsToAccount\": false, \"ShowInExpenseClaims\": false, \"Class\": \"ASSET\", \"ReportingCode\": \"ASS\", \"ReportingCodeName\": \"Assets\", \"HasAttachments\": false, \"UpdatedDateUTC\": \"2016-06-03T08:31:14.517-07:00\" }, \"Amount\": \"50.00\", \"FromIsReconciled\": true, \"ToIsReconciled\": true, \"Reference\": \"Sub 098801\" } ] }" + "example" : { + "BankTransfers" : [ { + "FromBankAccount" : { + "Code" : "090", + "Name" : "My Savings", + "AccountID" : "00000000-0000-0000-0000-000000000000", + "Type" : "BANK", + "BankAccountNumber" : "123455", + "Status" : "ACTIVE", + "BankAccountType" : "BANK", + "CurrencyCode" : "USD", + "TaxType" : "NONE", + "EnablePaymentsToAccount" : false, + "ShowInExpenseClaims" : false, + "Class" : "ASSET", + "ReportingCode" : "ASS", + "ReportingCodeName" : "Assets", + "HasAttachments" : false, + "UpdatedDateUTC" : "2016-10-17T13:45:33.993-07:00" + }, + "ToBankAccount" : { + "Code" : "088", + "Name" : "Business Wells Fargo", + "AccountID" : "00000000-0000-0000-0000-000000000000", + "Type" : "BANK", + "BankAccountNumber" : "123455", + "Status" : "ACTIVE", + "BankAccountType" : "BANK", + "CurrencyCode" : "USD", + "TaxType" : "NONE", + "EnablePaymentsToAccount" : false, + "ShowInExpenseClaims" : false, + "Class" : "ASSET", + "ReportingCode" : "ASS", + "ReportingCodeName" : "Assets", + "HasAttachments" : false, + "UpdatedDateUTC" : "2016-06-03T08:31:14.517-07:00" + }, + "Amount" : "50.00", + "FromIsReconciled" : true, + "ToIsReconciled" : true, + "Reference" : "Sub 098801" + } ] + } } }, "required" : true @@ -8269,14 +8327,9 @@

Usage and SDK Samples

UUID bankTransferID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.createBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createBankTransferAttachmentByFileName"); @@ -8414,7 +8467,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -8431,7 +8484,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -8623,7 +8676,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -8802,7 +8859,28 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/BatchPayments" }, - "example" : "{ \"BatchPayments\": [ { \"Account\": { \"AccountID\": \"00000000-0000-0000-0000-000000000000\" }, \"Reference\": \"ref\", \"Date\": \"2018-08-01\", \"Payments\": [ { \"Account\": { \"Code\": \"001\" }, \"Date\": \"2019-12-31\", \"Amount\": 500, \"Invoice\": { \"InvoiceID\": \"00000000-0000-0000-0000-000000000000\", \"LineItems\": [], \"Contact\": {}, \"Type\": \"ACCPAY\" } } ] } ] }" + "example" : { + "BatchPayments" : [ { + "Account" : { + "AccountID" : "00000000-0000-0000-0000-000000000000" + }, + "Reference" : "ref", + "Date" : "2018-08-01", + "Payments" : [ { + "Account" : { + "Code" : "001" + }, + "Date" : "2019-12-31", + "Amount" : 500, + "Invoice" : { + "InvoiceID" : "00000000-0000-0000-0000-000000000000", + "LineItems" : [ ], + "Contact" : { }, + "Type" : "ACCPAY" + } + } ] + } ] + } } }, "required" : true @@ -9020,7 +9098,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -9214,7 +9296,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PaymentServices" }, - "example" : "{ \"PaymentServices\": [ { \"PaymentServiceID\": \"54b3b4f6-0443-4fba-bcd1-61ec0c35ca55\", \"PaymentServiceName\": \"PayUpNow\", \"PaymentServiceUrl\": \"https://www.payupnow.com/\", \"PaymentServiceType\": \"Custom\", \"PayNowText\": \"Time To Pay\" } ] }" + "example" : { + "PaymentServices" : [ { + "PaymentServiceID" : "54b3b4f6-0443-4fba-bcd1-61ec0c35ca55", + "PaymentServiceName" : "PayUpNow", + "PaymentServiceUrl" : "https://www.payupnow.com/", + "PaymentServiceType" : "Custom", + "PayNowText" : "Time To Pay" + } ] + } } }, "required" : true @@ -9265,14 +9355,9 @@

Usage and SDK Samples

UUID contactID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.createContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createContactAttachmentByFileName"); @@ -9410,7 +9495,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -9427,7 +9512,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -9584,7 +9669,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/ContactGroups" }, - "example" : "{ \"ContactGroups\": [{ \"Name\": \"VIPs\" }]}" + "example" : { + "ContactGroups" : [ { + "Name" : "VIPs" + } ] + } } }, "required" : true @@ -9775,7 +9864,13 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Contacts" }, - "example" : "{ \"Contacts\": [ { \"ContactID\": \"a3675fc4-f8dd-4f03-ba5b-f1870566bcd7\" }, { \"ContactID\": \"4e1753b9-018a-4775-b6aa-1bc7871cfee3\" } ] }" + "example" : { + "Contacts" : [ { + "ContactID" : "a3675fc4-f8dd-4f03-ba5b-f1870566bcd7" + }, { + "ContactID" : "4e1753b9-018a-4775-b6aa-1bc7871cfee3" + } ] + } } }, "required" : true @@ -9966,7 +10061,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -10132,7 +10231,66 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Contacts" }, - "example" : "{ \"Contacts\": [ { \"ContactID\": \"3ff6d40c-af9a-40a3-89ce-3c1556a25591\", \"ContactStatus\": \"ACTIVE\", \"Name\": \"Foo9987\", \"EmailAddress\": \"sid32476@blah.com\", \"BankAccountDetails\": \"\", \"Addresses\": [ { \"AddressType\": \"STREET\", \"City\": \"\", \"Region\": \"\", \"PostalCode\": \"\", \"Country\": \"\" }, { \"AddressType\": \"POBOX\", \"City\": \"\", \"Region\": \"\", \"PostalCode\": \"\", \"Country\": \"\" } ], \"Phones\": [ { \"PhoneType\": \"DEFAULT\", \"PhoneNumber\": \"\", \"PhoneAreaCode\": \"\", \"PhoneCountryCode\": \"\" }, { \"PhoneType\": \"DDI\", \"PhoneNumber\": \"\", \"PhoneAreaCode\": \"\", \"PhoneCountryCode\": \"\" }, { \"PhoneType\": \"FAX\", \"PhoneNumber\": \"\", \"PhoneAreaCode\": \"\", \"PhoneCountryCode\": \"\" }, { \"PhoneType\": \"MOBILE\", \"PhoneNumber\": \"555-1212\", \"PhoneAreaCode\": \"415\", \"PhoneCountryCode\": \"\" } ], \"UpdatedDateUTC\": \"/Date(1551399321043+0000)/\", \"ContactGroups\": [], \"IsSupplier\": false, \"IsCustomer\": false, \"SalesTrackingCategories\": [], \"PurchasesTrackingCategories\": [], \"PaymentTerms\": { \"Bills\": { \"Day\": 15, \"Type\": \"OFCURRENTMONTH\" }, \"Sales\": { \"Day\": 10, \"Type\": \"DAYSAFTERBILLMONTH\" } }, \"ContactPersons\": [] } ] }" + "example" : { + "Contacts" : [ { + "ContactID" : "3ff6d40c-af9a-40a3-89ce-3c1556a25591", + "ContactStatus" : "ACTIVE", + "Name" : "Foo9987", + "EmailAddress" : "sid32476@blah.com", + "BankAccountDetails" : "", + "Addresses" : [ { + "AddressType" : "STREET", + "City" : "", + "Region" : "", + "PostalCode" : "", + "Country" : "" + }, { + "AddressType" : "POBOX", + "City" : "", + "Region" : "", + "PostalCode" : "", + "Country" : "" + } ], + "Phones" : [ { + "PhoneType" : "DEFAULT", + "PhoneNumber" : "", + "PhoneAreaCode" : "", + "PhoneCountryCode" : "" + }, { + "PhoneType" : "DDI", + "PhoneNumber" : "", + "PhoneAreaCode" : "", + "PhoneCountryCode" : "" + }, { + "PhoneType" : "FAX", + "PhoneNumber" : "", + "PhoneAreaCode" : "", + "PhoneCountryCode" : "" + }, { + "PhoneType" : "MOBILE", + "PhoneNumber" : "555-1212", + "PhoneAreaCode" : "415", + "PhoneCountryCode" : "" + } ], + "UpdatedDateUTC" : "/Date(1551399321043+0000)/", + "ContactGroups" : [ ], + "IsSupplier" : false, + "IsCustomer" : false, + "SalesTrackingCategories" : [ ], + "PurchasesTrackingCategories" : [ ], + "PaymentTerms" : { + "Bills" : { + "Day" : 15, + "Type" : "OFCURRENTMONTH" + }, + "Sales" : { + "Day" : 10, + "Type" : "DAYSAFTERBILLMONTH" + } + }, + "ContactPersons" : [ ] + } ] + } } }, "required" : true @@ -10357,7 +10515,16 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Allocations" }, - "example" : "{ \"Allocations\": [ { \"Invoice\": { \"LineItems\": [], \"InvoiceID\": \"c45720a1-ade3-4a38-a064-d15489be6841\" }, \"Amount\": 1, \"Date\": \"2019-03-05\" } ] }" + "example" : { + "Allocations" : [ { + "Invoice" : { + "LineItems" : [ ], + "InvoiceID" : "c45720a1-ade3-4a38-a064-d15489be6841" + }, + "Amount" : 1, + "Date" : "2019-03-05" + } ] + } } }, "required" : true @@ -10436,14 +10603,9 @@

Usage and SDK Samples

String fileName = 'xero-dev.jpg'; Boolean includeOnline = true; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, body, includeOnline, idempotencyKey, mimeType); + Attachments result = apiInstance.createCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, body, includeOnline, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createCreditNoteAttachmentByFileName"); @@ -10581,7 +10743,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -10598,7 +10760,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -10817,7 +10979,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -10991,7 +11157,21 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/CreditNotes" }, - "example" : "{ \"CreditNotes\":[ { \"Type\":\"ACCPAYCREDIT\", \"Contact\":{ \"ContactID\":\"430fa14a-f945-44d3-9f97-5df5e28441b8\" }, \"Date\":\"2019-01-05\", \"LineItems\":[ { \"Description\":\"Foobar\", \"Quantity\":2.0, \"UnitAmount\":20.0, \"AccountCode\":\"400\" } ] } ] }" + "example" : { + "CreditNotes" : [ { + "Type" : "ACCPAYCREDIT", + "Contact" : { + "ContactID" : "430fa14a-f945-44d3-9f97-5df5e28441b8" + }, + "Date" : "2019-01-05", + "LineItems" : [ { + "Description" : "Foobar", + "Quantity" : 2.0, + "UnitAmount" : 20.0, + "AccountCode" : "400" + } ] + } ] + } } }, "required" : true @@ -11192,7 +11372,10 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Currency" }, - "example" : "{ \"Code\": \"USD\", \"Description\": \"United States Dollar\" }" + "example" : { + "Code" : "USD", + "Description" : "United States Dollar" + } } }, "required" : true @@ -11350,7 +11533,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Employees" }, - "example" : "{ \"Employees\": [ { \"FirstName\": \"Nick\", \"LastName\": \"Fury\", \"ExternalLink\": { \"Url\": \"http://twitter.com/#!/search/Nick+Fury\" } } ] }" + "example" : { + "Employees" : [ { + "FirstName" : "Nick", + "LastName" : "Fury", + "ExternalLink" : { + "Url" : "http://twitter.com/#!/search/Nick+Fury" + } + } ] + } } }, "required" : true @@ -11568,7 +11759,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -11737,7 +11932,18 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/ExpenseClaims" }, - "example" : "{ \"ExpenseClaims\": [ { \"Status\": \"SUBMITTED\", \"User\": { \"UserID\": \"d1164823-0ac1-41ad-987b-b4e30fe0b273\" }, \"Receipts\": [ { \"Lineitems\": [], \"ReceiptID\": \"dc1c7f6d-0a4c-402f-acac-551d62ce5816\" } ] } ] }" + "example" : { + "ExpenseClaims" : [ { + "Status" : "SUBMITTED", + "User" : { + "UserID" : "d1164823-0ac1-41ad-987b-b4e30fe0b273" + }, + "Receipts" : [ { + "Lineitems" : [ ], + "ReceiptID" : "dc1c7f6d-0a4c-402f-acac-551d62ce5816" + } ] + } ] + } } }, "required" : true @@ -11789,14 +11995,9 @@

Usage and SDK Samples

String fileName = 'xero-dev.jpg'; Boolean includeOnline = true; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, body, includeOnline, idempotencyKey, mimeType); + Attachments result = apiInstance.createInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, body, includeOnline, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createInvoiceAttachmentByFileName"); @@ -11934,7 +12135,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -11951,7 +12152,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -12170,7 +12371,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -12356,7 +12561,26 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Invoices" }, - "example" : "{ \"Invoices\": [ { \"Type\": \"ACCREC\", \"Contact\": { \"ContactID\": \"430fa14a-f945-44d3-9f97-5df5e28441b8\" }, \"LineItems\": [ { \"Description\": \"Acme Tires\", \"Quantity\": 2, \"UnitAmount\": 20, \"AccountCode\": \"200\", \"TaxType\": \"NONE\", \"LineAmount\": 40 } ], \"Date\": \"2019-03-11\", \"DueDate\": \"2018-12-10\", \"Reference\": \"Website Design\", \"Status\": \"AUTHORISED\" } ] }" + "example" : { + "Invoices" : [ { + "Type" : "ACCREC", + "Contact" : { + "ContactID" : "430fa14a-f945-44d3-9f97-5df5e28441b8" + }, + "LineItems" : [ { + "Description" : "Acme Tires", + "Quantity" : 2, + "UnitAmount" : 20, + "AccountCode" : "200", + "TaxType" : "NONE", + "LineAmount" : 40 + } ], + "Date" : "2019-03-11", + "DueDate" : "2018-12-10", + "Reference" : "Website Design", + "Status" : "AUTHORISED" + } ] + } } }, "required" : true @@ -12594,7 +12818,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -12759,7 +12987,17 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Items" }, - "example" : "{ \"Items\": [ { \"Code\": \"code123\", \"Name\": \"Item Name XYZ\", \"Description\": \"Foobar\", \"InventoryAssetAccountCode\": \"140\", \"PurchaseDetails\": { \"COGSAccountCode\": \"500\" } } ] }" + "example" : { + "Items" : [ { + "Code" : "code123", + "Name" : "Item Name XYZ", + "Description" : "Foobar", + "InventoryAssetAccountCode" : "140", + "PurchaseDetails" : { + "COGSAccountCode" : "500" + } + } ] + } } }, "required" : true @@ -12960,7 +13198,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/LinkedTransaction" }, - "example" : "{ \"LinkedTransactions\": [ { \"SourceTransactionID\": \"a848644a-f20f-4630-98c3-386bd7505631\", \"SourceLineItemID\": \"b0df260d-3cc8-4ced-9bd6-41924f624ed3\" } ] }" + "example" : { + "LinkedTransactions" : [ { + "SourceTransactionID" : "a848644a-f20f-4630-98c3-386bd7505631", + "SourceLineItemID" : "b0df260d-3cc8-4ced-9bd6-41924f624ed3" + } ] + } } }, "required" : true @@ -13011,14 +13254,9 @@

Usage and SDK Samples

UUID manualJournalID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.createManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createManualJournalAttachmentByFileName"); @@ -13156,7 +13394,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -13173,7 +13411,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -13365,7 +13603,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -13539,7 +13781,25 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/ManualJournals" }, - "example" : "{ \"ManualJournals\": [ { \"Narration\": \"Journal Desc\", \"JournalLines\": [ { \"LineAmount\": 100, \"AccountCode\": \"400\", \"Description\": \"Money Movement\" }, { \"LineAmount\": -100, \"AccountCode\": \"400\", \"Description\": \"Prepayment of things\", \"Tracking\": [ { \"Name\": \"North\", \"Option\": \"Region\" } ] } ], \"Date\": \"2019-03-14\" } ] }" + "example" : { + "ManualJournals" : [ { + "Narration" : "Journal Desc", + "JournalLines" : [ { + "LineAmount" : 100, + "AccountCode" : "400", + "Description" : "Money Movement" + }, { + "LineAmount" : -100, + "AccountCode" : "400", + "Description" : "Prepayment of things", + "Tracking" : [ { + "Name" : "North", + "Option" : "Region" + } ] + } ], + "Date" : "2019-03-14" + } ] + } } }, "required" : true @@ -13764,7 +14024,18 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Allocations" }, - "example" : "{ \"Allocations\": [ { \"Invoice\": { \"InvoiceID\": \"00000000-0000-0000-0000-000000000000\", \"LineItems\": [], \"Contact\": {}, \"Type\": \"ACCPAY\" }, \"Amount\": 10.00, \"Date\": \"2019-03-12\" } ] }" + "example" : { + "Allocations" : [ { + "Invoice" : { + "InvoiceID" : "00000000-0000-0000-0000-000000000000", + "LineItems" : [ ], + "Contact" : { }, + "Type" : "ACCPAY" + }, + "Amount" : 10.0, + "Date" : "2019-03-12" + } ] + } } }, "required" : true @@ -13982,7 +14253,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -14148,7 +14423,19 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Payment" }, - "example" : "{ \"Payments\": [ { \"Invoice\": { \"LineItems\": [], \"InvoiceID\": \"00000000-0000-0000-0000-000000000000\" }, \"Account\": { \"Code\": \"970\" }, \"Date\": \"2019-03-12\", \"Amount\": 1 } ] }" + "example" : { + "Payments" : [ { + "Invoice" : { + "LineItems" : [ ], + "InvoiceID" : "00000000-0000-0000-0000-000000000000" + }, + "Account" : { + "Code" : "970" + }, + "Date" : "2019-03-12", + "Amount" : 1 + } ] + } } }, "required" : true @@ -14339,7 +14626,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -14497,7 +14788,13 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PaymentServices" }, - "example" : "{ \"PaymentServices\": [ { \"PaymentServiceName\": \"PayUpNow\", \"PaymentServiceUrl\": \"https://www.payupnow.com/\", \"PayNowText\": \"Time To Pay\" } ] }" + "example" : { + "PaymentServices" : [ { + "PaymentServiceName" : "PayUpNow", + "PaymentServiceUrl" : "https://www.payupnow.com/", + "PayNowText" : "Time To Pay" + } ] + } } }, "required" : true @@ -14664,7 +14961,19 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Payments" }, - "example" : "{ \"Payments\": [ { \"Invoice\": { \"LineItems\": [], \"InvoiceID\": \"00000000-0000-0000-0000-000000000000\" }, \"Account\": { \"Code\": \"970\" }, \"Date\": \"2019-03-12\", \"Amount\": 1 } ] }" + "example" : { + "Payments" : [ { + "Invoice" : { + "LineItems" : [ ], + "InvoiceID" : "00000000-0000-0000-0000-000000000000" + }, + "Account" : { + "Code" : "970" + }, + "Date" : "2019-03-12", + "Amount" : 1 + } ] + } } }, "required" : true @@ -14889,7 +15198,16 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Allocations" }, - "example" : "{ \"Allocations\": [ { \"Invoice\": { \"LineItems\": [], \"InvoiceID\": \"00000000-0000-0000-0000-000000000000\" }, \"Amount\": 1, \"Date\": \"2019-01-10\" } ] }" + "example" : { + "Allocations" : [ { + "Invoice" : { + "LineItems" : [ ], + "InvoiceID" : "00000000-0000-0000-0000-000000000000" + }, + "Amount" : 1, + "Date" : "2019-01-10" + } ] + } } }, "required" : true @@ -15107,7 +15425,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -15158,14 +15480,9 @@

Usage and SDK Samples

UUID purchaseOrderID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createPurchaseOrderAttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.createPurchaseOrderAttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createPurchaseOrderAttachmentByFileName"); @@ -15303,7 +15620,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -15320,7 +15637,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -15512,7 +15829,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -15684,7 +16005,20 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PurchaseOrders" }, - "example" : "{ \"PurchaseOrders\": [ { \"Contact\": { \"ContactID\": \"00000000-0000-0000-0000-000000000000\" }, \"LineItems\": [ { \"Description\": \"Foobar\", \"Quantity\": 1, \"UnitAmount\": 20, \"AccountCode\": \"710\" } ], \"Date\": \"2019-03-13\" } ] }" + "example" : { + "PurchaseOrders" : [ { + "Contact" : { + "ContactID" : "00000000-0000-0000-0000-000000000000" + }, + "LineItems" : [ { + "Description" : "Foobar", + "Quantity" : 1, + "UnitAmount" : 20, + "AccountCode" : "710" + } ], + "Date" : "2019-03-13" + } ] + } } }, "required" : true @@ -15762,14 +16096,9 @@

Usage and SDK Samples

UUID quoteID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.createQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createQuoteAttachmentByFileName"); @@ -15907,7 +16236,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -15924,7 +16253,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -16116,7 +16445,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -16288,7 +16621,20 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Quotes" }, - "example" : "{ \"Quotes\": [ { \"Contact\": { \"ContactID\": \"00000000-0000-0000-0000-000000000000\" }, \"LineItems\": [ { \"Description\": \"Foobar\", \"Quantity\": 1, \"UnitAmount\": 20, \"AccountCode\": \"12775\" } ], \"Date\": \"2020-02-01\" } ] }" + "example" : { + "Quotes" : [ { + "Contact" : { + "ContactID" : "00000000-0000-0000-0000-000000000000" + }, + "LineItems" : [ { + "Description" : "Foobar", + "Quantity" : 1, + "UnitAmount" : 20, + "AccountCode" : "12775" + } ], + "Date" : "2020-02-01" + } ] + } } }, "required" : true @@ -16491,7 +16837,26 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Receipts" }, - "example" : "{ \"Receipts\": [ { \"Contact\": { \"ContactID\": \"00000000-0000-0000-0000-000000000000\" }, \"Lineitems\": [ { \"Description\": \"Foobar\", \"Quantity\": 2, \"UnitAmount\": 20, \"AccountCode\": \"400\", \"TaxType\": \"NONE\", \"LineAmount\": 40 } ], \"User\": { \"UserID\": \"00000000-0000-0000-0000-000000000000\" }, \"LineAmountTypes\": \"NoTax\", \"Status\": \"DRAFT\" } ] }" + "example" : { + "Receipts" : [ { + "Contact" : { + "ContactID" : "00000000-0000-0000-0000-000000000000" + }, + "Lineitems" : [ { + "Description" : "Foobar", + "Quantity" : 2, + "UnitAmount" : 20, + "AccountCode" : "400", + "TaxType" : "NONE", + "LineAmount" : 40 + } ], + "User" : { + "UserID" : "00000000-0000-0000-0000-000000000000" + }, + "LineAmountTypes" : "NoTax", + "Status" : "DRAFT" + } ] + } } }, "required" : true @@ -16569,14 +16934,9 @@

Usage and SDK Samples

UUID receiptID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.createReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createReceiptAttachmentByFileName"); @@ -16714,7 +17074,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -16731,7 +17091,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -16923,7 +17283,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -16974,14 +17338,9 @@

Usage and SDK Samples

UUID repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.createRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.createRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#createRepeatingInvoiceAttachmentByFileName"); @@ -17119,7 +17478,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -17136,7 +17495,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -17328,7 +17687,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/HistoryRecords" }, - "example" : "{ \"HistoryRecords\": [ { \"Details\": \"Hello World\" } ] }" + "example" : { + "HistoryRecords" : [ { + "Details" : "Hello World" + } ] + } } }, "required" : true @@ -17479,7 +17842,42 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/RepeatingInvoices" }, - "example" : "{ \"RepeatingInvoices\": [ { \"Schedule\": { \"Period\": 1, \"Unit\": \"MONTHLY\", \"DueDate\": 10, \"DueDateType\": \"OFFOLLOWINGMONTH\", \"StartDate\": \"\\/Date(1555286400000+0000)\\/\" }, \"Type\": \"ACCREC\", \"Reference\": \"[Week]\", \"ApprovedForSending\": false, \"SendCopy\": false, \"MarkAsSent\": false, \"IncludePDF\": false, \"Contact\": { \"ContactID\": \"430fa14a-f945-44d3-9f97-5df5e28441b8\", \"Name\": \"Liam Gallagher\" }, \"Status\": \"AUTHORISED\", \"LineAmountTypes\": \"Exclusive\", \"LineItems\": [ { \"Description\": \"Guitars Fender Strat\", \"UnitAmount\": 5000.00, \"TaxType\": \"OUTPUT2\", \"TaxAmount\": 750.00, \"LineAmount\": 5000.00, \"AccountCode\": \"200\", \"Tracking\": [], \"Quantity\": 1.0000, \"LineItemID\": \"13a8353c-d2af-4d5b-920c-438449f08900\", \"DiscountEnteredAsPercent\": true } ], \"CurrencyCode\": \"NZD\" } ] }" + "example" : { + "RepeatingInvoices" : [ { + "Schedule" : { + "Period" : 1, + "Unit" : "MONTHLY", + "DueDate" : 10, + "DueDateType" : "OFFOLLOWINGMONTH", + "StartDate" : "/Date(1555286400000+0000)/" + }, + "Type" : "ACCREC", + "Reference" : "[Week]", + "ApprovedForSending" : false, + "SendCopy" : false, + "MarkAsSent" : false, + "IncludePDF" : false, + "Contact" : { + "ContactID" : "430fa14a-f945-44d3-9f97-5df5e28441b8", + "Name" : "Liam Gallagher" + }, + "Status" : "AUTHORISED", + "LineAmountTypes" : "Exclusive", + "LineItems" : [ { + "Description" : "Guitars Fender Strat", + "UnitAmount" : 5000.0, + "TaxType" : "OUTPUT2", + "TaxAmount" : 750.0, + "LineAmount" : 5000.0, + "AccountCode" : "200", + "Tracking" : [ ], + "Quantity" : 1.0, + "LineItemID" : "13a8353c-d2af-4d5b-920c-438449f08900", + "DiscountEnteredAsPercent" : true + } ], + "CurrencyCode" : "NZD" + } ] + } } }, "required" : true @@ -17670,7 +18068,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TaxRates" }, - "example" : "{ \"TaxRates\": [ { \"Name\": \"CA State Tax\", \"TaxComponents\": [ { \"Name\": \"State Tax\", \"Rate\": 2.25 } ] } ] }" + "example" : { + "TaxRates" : [ { + "Name" : "CA State Tax", + "TaxComponents" : [ { + "Name" : "State Tax", + "Rate" : 2.25 + } ] + } ] + } } }, "required" : true @@ -17823,7 +18229,9 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TrackingCategory" }, - "example" : "{ name: \"FooBar\" }" + "example" : { + "name" : "FooBar" + } } }, "required" : true @@ -18011,7 +18419,9 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TrackingOption" }, - "example" : "{ name: \" Bar\" }" + "example" : { + "name" : " Bar" + } } }, "required" : true @@ -18291,7 +18701,10 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/BatchPaymentDelete" }, - "example" : "{ \"BatchPaymentID\": \"9bf296e9-0748-4d29-a3dc-24dde1098030\", \"Status\":\"DELETED\" }" + "example" : { + "BatchPaymentID" : "9bf296e9-0748-4d29-a3dc-24dde1098030", + "Status" : "DELETED" + } } }, "required" : true @@ -18475,7 +18888,9 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/BatchPaymentDeleteByUrlParam" }, - "example" : "{ \"Status\":\"DELETED\" }" + "example" : { + "Status" : "DELETED" + } } }, "required" : true @@ -19504,7 +19919,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PaymentDelete" }, - "example" : "{ \"Payments\":[ { \"Status\":\"DELETED\" } ] }" + "example" : { + "Payments" : [ { + "Status" : "DELETED" + } ] + } } }, "required" : true @@ -20126,7 +20545,7 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/RequestEmpty" }, - "example" : "{}" + "example" : { } } }, "required" : true @@ -40660,7 +41079,33 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Setup" }, - "example" : "{ \"ConversionDate\": {}, \"ConversionBalances\": [], \"Accounts\": [ { \"Code\": \"200\", \"Name\": \"Sales\", \"Type\": \"SALES\", \"ReportingCode\": \"REV.TRA.GOO\" }, { \"Code\": \"400\", \"Name\": \"Advertising\", \"Type\": \"OVERHEADS\", \"ReportingCode\": \"EXP\" }, { \"Code\": \"610\", \"Name\": \"Accounts Receivable\", \"Type\": \"CURRENT\", \"SystemAccount\": \"DEBTORS\", \"ReportingCode\": \"ASS.CUR.REC.TRA\" }, { \"Code\": \"800\", \"Name\": \"Accounts Payable\", \"Type\": \"CURRLIAB\", \"SystemAccount\": \"CREDITORS\", \"ReportingCode\": \"LIA.CUR.PAY\" } ] }" + "example" : { + "ConversionDate" : { }, + "ConversionBalances" : [ ], + "Accounts" : [ { + "Code" : "200", + "Name" : "Sales", + "Type" : "SALES", + "ReportingCode" : "REV.TRA.GOO" + }, { + "Code" : "400", + "Name" : "Advertising", + "Type" : "OVERHEADS", + "ReportingCode" : "EXP" + }, { + "Code" : "610", + "Name" : "Accounts Receivable", + "Type" : "CURRENT", + "SystemAccount" : "DEBTORS", + "ReportingCode" : "ASS.CUR.REC.TRA" + }, { + "Code" : "800", + "Name" : "Accounts Payable", + "Type" : "CURRLIAB", + "SystemAccount" : "CREDITORS", + "ReportingCode" : "LIA.CUR.PAY" + } ] + } } }, "required" : true @@ -40855,7 +41300,22 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Accounts" }, - "example" : "{ \"Accounts\":[ { \"Code\":\"123456\", \"Name\":\"BarFoo\", \"AccountID\":\"99ce6032-0678-4aa0-8148-240c75fee33a\", \"Type\":\"EXPENSE\", \"Description\":\"GoodBye World\", \"TaxType\":\"INPUT\", \"EnablePaymentsToAccount\":false, \"ShowInExpenseClaims\":false, \"Class\":\"EXPENSE\", \"ReportingCode\":\"EXP\", \"ReportingCodeName\":\"Expense\", \"UpdatedDateUTC\":\"2019-02-21T16:29:47.96-08:00\" } ] }" + "example" : { + "Accounts" : [ { + "Code" : "123456", + "Name" : "BarFoo", + "AccountID" : "99ce6032-0678-4aa0-8148-240c75fee33a", + "Type" : "EXPENSE", + "Description" : "GoodBye World", + "TaxType" : "INPUT", + "EnablePaymentsToAccount" : false, + "ShowInExpenseClaims" : false, + "Class" : "EXPENSE", + "ReportingCode" : "EXP", + "ReportingCodeName" : "Expense", + "UpdatedDateUTC" : "2019-02-21T16:29:47.96-08:00" + } ] + } } }, "required" : true @@ -40906,14 +41366,9 @@

Usage and SDK Samples

UUID accountID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateAccountAttachmentByFileName"); @@ -41051,7 +41506,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -41068,7 +41523,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -41279,7 +41734,77 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/BankTransactions" }, - "example" : "{ \"BankTransactions\": [ { \"Type\": \"SPEND\", \"Contact\": { \"ContactID\": \"00000000-0000-0000-0000-000000000000\", \"ContactStatus\": \"ACTIVE\", \"Name\": \"Buzz Lightyear\", \"FirstName\": \"Buzz\", \"LastName\": \"Lightyear\", \"EmailAddress\": \"buzz.Lightyear@email.com\", \"ContactPersons\": [], \"BankAccountDetails\": \"\", \"Addresses\": [ { \"AddressType\": \"STREET\", \"City\": \"\", \"Region\": \"\", \"PostalCode\": \"\", \"Country\": \"\" }, { \"AddressType\": \"POBOX\", \"AddressLine1\": \"\", \"AddressLine2\": \"\", \"AddressLine3\": \"\", \"AddressLine4\": \"\", \"City\": \"Palo Alto\", \"Region\": \"CA\", \"PostalCode\": \"94020\", \"Country\": \"United States\" } ], \"Phones\": [ { \"PhoneType\": \"DEFAULT\", \"PhoneNumber\": \"847-1294\", \"PhoneAreaCode\": \"(626)\", \"PhoneCountryCode\": \"\" }, { \"PhoneType\": \"DDI\", \"PhoneNumber\": \"\", \"PhoneAreaCode\": \"\", \"PhoneCountryCode\": \"\" }, { \"PhoneType\": \"FAX\", \"PhoneNumber\": \"\", \"PhoneAreaCode\": \"\", \"PhoneCountryCode\": \"\" }, { \"PhoneType\": \"MOBILE\", \"PhoneNumber\": \"\", \"PhoneAreaCode\": \"\", \"PhoneCountryCode\": \"\" } ], \"UpdatedDateUTC\": \"2017-08-21T13:49:04.227-07:00\", \"ContactGroups\": [] }, \"Lineitems\": [], \"BankAccount\": { \"Code\": \"088\", \"Name\": \"Business Wells Fargo\", \"AccountID\": \"00000000-0000-0000-0000-000000000000\" }, \"IsReconciled\": false, \"Date\": \"2019-02-25\", \"Reference\": \"You just updated\", \"CurrencyCode\": \"USD\", \"CurrencyRate\": 1, \"Status\": \"AUTHORISED\", \"LineAmountTypes\": \"Inclusive\", \"TotalTax\": 1.74, \"BankTransactionID\": \"00000000-0000-0000-0000-000000000000\", \"UpdatedDateUTC\": \"2019-02-26T12:39:27.813-08:00\" } ] }" + "example" : { + "BankTransactions" : [ { + "Type" : "SPEND", + "Contact" : { + "ContactID" : "00000000-0000-0000-0000-000000000000", + "ContactStatus" : "ACTIVE", + "Name" : "Buzz Lightyear", + "FirstName" : "Buzz", + "LastName" : "Lightyear", + "EmailAddress" : "buzz.Lightyear@email.com", + "ContactPersons" : [ ], + "BankAccountDetails" : "", + "Addresses" : [ { + "AddressType" : "STREET", + "City" : "", + "Region" : "", + "PostalCode" : "", + "Country" : "" + }, { + "AddressType" : "POBOX", + "AddressLine1" : "", + "AddressLine2" : "", + "AddressLine3" : "", + "AddressLine4" : "", + "City" : "Palo Alto", + "Region" : "CA", + "PostalCode" : "94020", + "Country" : "United States" + } ], + "Phones" : [ { + "PhoneType" : "DEFAULT", + "PhoneNumber" : "847-1294", + "PhoneAreaCode" : "(626)", + "PhoneCountryCode" : "" + }, { + "PhoneType" : "DDI", + "PhoneNumber" : "", + "PhoneAreaCode" : "", + "PhoneCountryCode" : "" + }, { + "PhoneType" : "FAX", + "PhoneNumber" : "", + "PhoneAreaCode" : "", + "PhoneCountryCode" : "" + }, { + "PhoneType" : "MOBILE", + "PhoneNumber" : "", + "PhoneAreaCode" : "", + "PhoneCountryCode" : "" + } ], + "UpdatedDateUTC" : "2017-08-21T13:49:04.227-07:00", + "ContactGroups" : [ ] + }, + "Lineitems" : [ ], + "BankAccount" : { + "Code" : "088", + "Name" : "Business Wells Fargo", + "AccountID" : "00000000-0000-0000-0000-000000000000" + }, + "IsReconciled" : false, + "Date" : "2019-02-25", + "Reference" : "You just updated", + "CurrencyCode" : "USD", + "CurrencyRate" : 1, + "Status" : "AUTHORISED", + "LineAmountTypes" : "Inclusive", + "TotalTax" : 1.74, + "BankTransactionID" : "00000000-0000-0000-0000-000000000000", + "UpdatedDateUTC" : "2019-02-26T12:39:27.813-08:00" + } ] + } } }, "required" : true @@ -41357,14 +41882,9 @@

Usage and SDK Samples

UUID bankTransactionID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateBankTransactionAttachmentByFileName"); @@ -41502,7 +42022,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -41519,7 +42039,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -41571,14 +42091,9 @@

Usage and SDK Samples

UUID bankTransferID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateBankTransferAttachmentByFileName"); @@ -41716,7 +42231,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -41733,7 +42248,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -41926,7 +42441,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Contacts" }, - "example" : "{ \"Contacts\": [{ \"ContactID\": \"00000000-0000-0000-0000-000000000000\", \"Name\": \"Thanos\" }]}" + "example" : { + "Contacts" : [ { + "ContactID" : "00000000-0000-0000-0000-000000000000", + "Name" : "Thanos" + } ] + } } }, "required" : true @@ -41977,14 +42497,9 @@

Usage and SDK Samples

UUID contactID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateContactAttachmentByFileName"); @@ -42122,7 +42637,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -42139,7 +42654,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -42331,7 +42846,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/ContactGroups" }, - "example" : "{ \"ContactGroups\":[ { \"Name\":\"Suppliers\" } ] }" + "example" : { + "ContactGroups" : [ { + "Name" : "Suppliers" + } ] + } } }, "required" : true @@ -42541,7 +43060,24 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/CreditNotes" }, - "example" : "{ \"CreditNotes\": [ { \"Type\": \"ACCPAYCREDIT\", \"Contact\": { \"ContactID\": \"430fa14a-f945-44d3-9f97-5df5e28441b8\" }, \"Date\": \"2019-01-05\", \"Status\": \"AUTHORISED\", \"Reference\": \"HelloWorld\", \"SentToContact\": true, \"LineItems\": [ { \"Description\": \"Foobar\", \"Quantity\": 2, \"UnitAmount\": 20, \"AccountCode\": \"400\" } ] } ] }" + "example" : { + "CreditNotes" : [ { + "Type" : "ACCPAYCREDIT", + "Contact" : { + "ContactID" : "430fa14a-f945-44d3-9f97-5df5e28441b8" + }, + "Date" : "2019-01-05", + "Status" : "AUTHORISED", + "Reference" : "HelloWorld", + "SentToContact" : true, + "LineItems" : [ { + "Description" : "Foobar", + "Quantity" : 2, + "UnitAmount" : 20, + "AccountCode" : "400" + } ] + } ] + } } }, "required" : true @@ -42619,14 +43155,9 @@

Usage and SDK Samples

UUID creditNoteID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateCreditNoteAttachmentByFileName"); @@ -42764,7 +43295,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -42781,7 +43312,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -42985,7 +43516,18 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/ExpenseClaims" }, - "example" : "{ \"ExpenseClaims\": [ { \"Status\": \"SUBMITTED\", \"User\": { \"UserID\": \"d1164823-0ac1-41ad-987b-b4e30fe0b273\" }, \"Receipts\": [ { \"Lineitems\": [], \"ReceiptID\": \"dc1c7f6d-0a4c-402f-acac-551d62ce5816\" } ] } ] }" + "example" : { + "ExpenseClaims" : [ { + "Status" : "SUBMITTED", + "User" : { + "UserID" : "d1164823-0ac1-41ad-987b-b4e30fe0b273" + }, + "Receipts" : [ { + "Lineitems" : [ ], + "ReceiptID" : "dc1c7f6d-0a4c-402f-acac-551d62ce5816" + } ] + } ] + } } }, "required" : true @@ -43176,7 +43718,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Invoices" }, - "example" : "{ \"Invoices\": [{ Reference: \"May the force be with you\", \"InvoiceID\": \"00000000-0000-0000-0000-000000000000\", \"LineItems\": [], \"Contact\": {}, \"Type\": \"ACCPAY\" }]}" + "example" : { + "Invoices" : [ { + "Reference" : "May the force be with you", + "InvoiceID" : "00000000-0000-0000-0000-000000000000", + "LineItems" : [ ], + "Contact" : { }, + "Type" : "ACCPAY" + } ] + } } }, "required" : true @@ -43254,14 +43804,9 @@

Usage and SDK Samples

UUID invoiceID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateInvoiceAttachmentByFileName"); @@ -43399,7 +43944,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -43416,7 +43961,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -43609,7 +44154,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Items" }, - "example" : "{ \"Items\": [ { \"Code\": \"ItemCode123\", \"Description\": \"Description 123\" } ] }" + "example" : { + "Items" : [ { + "Code" : "ItemCode123", + "Description" : "Description 123" + } ] + } } }, "required" : true @@ -43827,7 +44377,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/LinkedTransactions" }, - "example" : "{ \"LinkedTransactions\": [ { \"SourceTransactionID\": \"00000000-0000-0000-0000-000000000000\", \"SourceLineItemID\": \"00000000-0000-0000-0000-000000000000\" } ] }" + "example" : { + "LinkedTransactions" : [ { + "SourceTransactionID" : "00000000-0000-0000-0000-000000000000", + "SourceLineItemID" : "00000000-0000-0000-0000-000000000000" + } ] + } } }, "required" : true @@ -44034,7 +44589,13 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/ManualJournals" }, - "example" : "{ \"ManualJournals\": [ { \"Narration\": \"Hello Xero\", \"ManualJournalID\": \"00000000-0000-0000-0000-000000000000\", \"JournalLines\": [] } ] }" + "example" : { + "ManualJournals" : [ { + "Narration" : "Hello Xero", + "ManualJournalID" : "00000000-0000-0000-0000-000000000000", + "JournalLines" : [ ] + } ] + } } }, "required" : true @@ -44085,14 +44646,9 @@

Usage and SDK Samples

UUID manualJournalID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateManualJournalAttachmentByFileName"); @@ -44230,7 +44786,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -44247,7 +44803,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -44423,7 +44979,23 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/BankTransactions" }, - "example" : "{ \"BankTransactions\": [ { \"Type\": \"SPEND\", \"Contact\": { \"ContactID\": \"00000000-0000-0000-0000-000000000000\" }, \"Lineitems\": [ { \"Description\": \"Foobar\", \"Quantity\": 1, \"UnitAmount\": 20, \"AccountCode\": \"400\" } ], \"BankAccount\": { \"Code\": \"088\" } } ] }" + "example" : { + "BankTransactions" : [ { + "Type" : "SPEND", + "Contact" : { + "ContactID" : "00000000-0000-0000-0000-000000000000" + }, + "Lineitems" : [ { + "Description" : "Foobar", + "Quantity" : 1, + "UnitAmount" : 20, + "AccountCode" : "400" + } ], + "BankAccount" : { + "Code" : "088" + } + } ] + } } }, "required" : true @@ -44635,7 +45207,27 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Contacts" }, - "example" : "{ \"Contacts\": [ { \"Name\": \"Bruce Banner\", \"EmailAddress\": \"hulk@avengers.com\", \"Phones\": [ { \"PhoneType\": \"MOBILE\", \"PhoneNumber\": \"555-1212\", \"PhoneAreaCode\": \"415\" } ], \"PaymentTerms\": { \"Bills\": { \"Day\": 15, \"Type\": \"OFCURRENTMONTH\" }, \"Sales\": { \"Day\": 10, \"Type\": \"DAYSAFTERBILLMONTH\" } } } ] }" + "example" : { + "Contacts" : [ { + "Name" : "Bruce Banner", + "EmailAddress" : "hulk@avengers.com", + "Phones" : [ { + "PhoneType" : "MOBILE", + "PhoneNumber" : "555-1212", + "PhoneAreaCode" : "415" + } ], + "PaymentTerms" : { + "Bills" : { + "Day" : 15, + "Type" : "OFCURRENTMONTH" + }, + "Sales" : { + "Day" : 10, + "Type" : "DAYSAFTERBILLMONTH" + } + } + } ] + } } }, "required" : true @@ -44836,7 +45428,23 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/CreditNotes" }, - "example" : "{ \"CreditNotes\":[ { \"Type\":\"ACCPAYCREDIT\", \"Contact\":{ \"ContactID\":\"430fa14a-f945-44d3-9f97-5df5e28441b8\" }, \"Date\":\"2019-01-05\", \"Status\":\"AUTHORISED\", \"Reference\": \"HelloWorld\", \"LineItems\":[ { \"Description\":\"Foobar\", \"Quantity\":2.0, \"UnitAmount\":20.0, \"AccountCode\":\"400\" } ] } ] }" + "example" : { + "CreditNotes" : [ { + "Type" : "ACCPAYCREDIT", + "Contact" : { + "ContactID" : "430fa14a-f945-44d3-9f97-5df5e28441b8" + }, + "Date" : "2019-01-05", + "Status" : "AUTHORISED", + "Reference" : "HelloWorld", + "LineItems" : [ { + "Description" : "Foobar", + "Quantity" : 2.0, + "UnitAmount" : 20.0, + "AccountCode" : "400" + } ] + } ] + } } }, "required" : true @@ -45041,7 +45649,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Employees" }, - "example" : "{ \"Employees\": [ { \"FirstName\": \"Nick\", \"LastName\": \"Fury\", \"ExternalLink\": { \"Url\": \"http://twitter.com/#!/search/Nick+Fury\" } } ] }" + "example" : { + "Employees" : [ { + "FirstName" : "Nick", + "LastName" : "Fury", + "ExternalLink" : { + "Url" : "http://twitter.com/#!/search/Nick+Fury" + } + } ] + } } }, "required" : true @@ -45245,7 +45861,26 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Invoices" }, - "example" : "{ \"Invoices\": [ { \"Type\": \"ACCREC\", \"Contact\": { \"ContactID\": \"430fa14a-f945-44d3-9f97-5df5e28441b8\" }, \"LineItems\": [ { \"Description\": \"Acme Tires\", \"Quantity\": 2, \"UnitAmount\": 20, \"AccountCode\": \"200\", \"TaxType\": \"NONE\", \"LineAmount\": 40 } ], \"Date\": \"2019-03-11\", \"DueDate\": \"2018-12-10\", \"Reference\": \"Website Design\", \"Status\": \"AUTHORISED\" } ] }" + "example" : { + "Invoices" : [ { + "Type" : "ACCREC", + "Contact" : { + "ContactID" : "430fa14a-f945-44d3-9f97-5df5e28441b8" + }, + "LineItems" : [ { + "Description" : "Acme Tires", + "Quantity" : 2, + "UnitAmount" : 20, + "AccountCode" : "200", + "TaxType" : "NONE", + "LineAmount" : 40 + } ], + "Date" : "2019-03-11", + "DueDate" : "2018-12-10", + "Reference" : "Website Design", + "Status" : "AUTHORISED" + } ] + } } }, "required" : true @@ -45451,7 +46086,13 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Items" }, - "example" : "{ \"Items\": [ { \"Code\": \"ItemCode123\", \"Name\": \"ItemName XYZ\", \"Description\": \"Item Description ABC\" } ] }" + "example" : { + "Items" : [ { + "Code" : "ItemCode123", + "Name" : "ItemName XYZ", + "Description" : "Item Description ABC" + } ] + } } }, "required" : true @@ -45672,7 +46313,25 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/ManualJournals" }, - "example" : "{ \"ManualJournals\": [ { \"Narration\": \"Journal Desc\", \"JournalLines\": [ { \"LineAmount\": 100, \"AccountCode\": \"400\", \"Description\": \"Money Movement\" }, { \"LineAmount\": -100, \"AccountCode\": \"400\", \"Description\": \"Prepayment of things\", \"Tracking\": [ { \"Name\": \"North\", \"Option\": \"Region\" } ] } ], \"Date\": \"2019-03-14\" } ] }" + "example" : { + "ManualJournals" : [ { + "Narration" : "Journal Desc", + "JournalLines" : [ { + "LineAmount" : 100, + "AccountCode" : "400", + "Description" : "Money Movement" + }, { + "LineAmount" : -100, + "AccountCode" : "400", + "Description" : "Prepayment of things", + "Tracking" : [ { + "Name" : "North", + "Option" : "Region" + } ] + } ], + "Date" : "2019-03-14" + } ] + } } }, "required" : true @@ -45870,7 +46529,20 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PurchaseOrders" }, - "example" : "{ \"PurchaseOrders\": [ { \"Contact\": { \"ContactID\": \"00000000-0000-0000-0000-000000000000\" }, \"LineItems\": [ { \"Description\": \"Foobar\", \"Quantity\": 1, \"UnitAmount\": 20, \"AccountCode\": \"710\" } ], \"Date\": \"2019-03-13\" } ] }" + "example" : { + "PurchaseOrders" : [ { + "Contact" : { + "ContactID" : "00000000-0000-0000-0000-000000000000" + }, + "LineItems" : [ { + "Description" : "Foobar", + "Quantity" : 1, + "UnitAmount" : 20, + "AccountCode" : "710" + } ], + "Date" : "2019-03-13" + } ] + } } }, "required" : true @@ -46068,7 +46740,20 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Quotes" }, - "example" : "{ \"Quotes\": [ { \"Contact\": { \"ContactID\": \"00000000-0000-0000-0000-000000000000\" }, \"LineItems\": [ { \"Description\": \"Foobar\", \"Quantity\": 1, \"UnitAmount\": 20, \"AccountCode\": \"12775\" } ], \"Date\": \"2020-02-01\" } ] }" + "example" : { + "Quotes" : [ { + "Contact" : { + "ContactID" : "00000000-0000-0000-0000-000000000000" + }, + "LineItems" : [ { + "Description" : "Foobar", + "Quantity" : 1, + "UnitAmount" : 20, + "AccountCode" : "12775" + } ], + "Date" : "2020-02-01" + } ] + } } }, "required" : true @@ -46246,7 +46931,42 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/RepeatingInvoices" }, - "example" : "{ \"RepeatingInvoices\": [ { \"Schedule\": { \"Period\": 1, \"Unit\": \"MONTHLY\", \"DueDate\": 10, \"DueDateType\": \"OFFOLLOWINGMONTH\", \"StartDate\": \"\\/Date(1555286400000+0000)\\/\" }, \"Type\": \"ACCREC\", \"Reference\": \"[Week]\", \"ApprovedForSending\": false, \"SendCopy\": false, \"MarkAsSent\": false, \"IncludePDF\": false, \"Contact\": { \"ContactID\": \"430fa14a-f945-44d3-9f97-5df5e28441b8\", \"Name\": \"Liam Gallagher\" }, \"Status\": \"AUTHORISED\", \"LineAmountTypes\": \"Exclusive\", \"LineItems\": [ { \"Description\": \"Guitars Fender Strat\", \"UnitAmount\": 5000.00, \"TaxType\": \"OUTPUT2\", \"TaxAmount\": 750.00, \"LineAmount\": 5000.00, \"AccountCode\": \"200\", \"Tracking\": [], \"Quantity\": 1.0000, \"LineItemID\": \"13a8353c-d2af-4d5b-920c-438449f08900\", \"DiscountEnteredAsPercent\": true } ], \"CurrencyCode\": \"NZD\" } ] }" + "example" : { + "RepeatingInvoices" : [ { + "Schedule" : { + "Period" : 1, + "Unit" : "MONTHLY", + "DueDate" : 10, + "DueDateType" : "OFFOLLOWINGMONTH", + "StartDate" : "/Date(1555286400000+0000)/" + }, + "Type" : "ACCREC", + "Reference" : "[Week]", + "ApprovedForSending" : false, + "SendCopy" : false, + "MarkAsSent" : false, + "IncludePDF" : false, + "Contact" : { + "ContactID" : "430fa14a-f945-44d3-9f97-5df5e28441b8", + "Name" : "Liam Gallagher" + }, + "Status" : "AUTHORISED", + "LineAmountTypes" : "Exclusive", + "LineItems" : [ { + "Description" : "Guitars Fender Strat", + "UnitAmount" : 5000.0, + "TaxType" : "OUTPUT2", + "TaxAmount" : 750.0, + "LineAmount" : 5000.0, + "AccountCode" : "200", + "Tracking" : [ ], + "Quantity" : 1.0, + "LineItemID" : "13a8353c-d2af-4d5b-920c-438449f08900", + "DiscountEnteredAsPercent" : true + } ], + "CurrencyCode" : "NZD" + } ] + } } }, "required" : true @@ -46463,7 +47183,13 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PurchaseOrders" }, - "example" : "{ \"PurchaseOrders\": [ { \"AttentionTo\": \"Peter Parker\", \"LineItems\": [], \"Contact\": {} } ] }" + "example" : { + "PurchaseOrders" : [ { + "AttentionTo" : "Peter Parker", + "LineItems" : [ ], + "Contact" : { } + } ] + } } }, "required" : true @@ -46514,14 +47240,9 @@

Usage and SDK Samples

UUID purchaseOrderID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updatePurchaseOrderAttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updatePurchaseOrderAttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updatePurchaseOrderAttachmentByFileName"); @@ -46659,7 +47380,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -46676,7 +47397,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -46873,7 +47594,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Quotes" }, - "example" : "{ \"Quotes\": [ { \"Reference\": \"I am an update\", \"Contact\": { \"ContactID\": \"00000000-0000-0000-0000-000000000000\" }, \"Date\": \"2020-02-01\" } ] }" + "example" : { + "Quotes" : [ { + "Reference" : "I am an update", + "Contact" : { + "ContactID" : "00000000-0000-0000-0000-000000000000" + }, + "Date" : "2020-02-01" + } ] + } } }, "required" : true @@ -46924,14 +47653,9 @@

Usage and SDK Samples

UUID quoteID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateQuoteAttachmentByFileName"); @@ -47069,7 +47793,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -47086,7 +47810,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -47284,7 +48008,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Receipts" }, - "example" : "{ \"Receipts\": [ { \"Lineitems\": [], \"User\": { \"UserID\": \"00000000-0000-0000-0000-000000000000\" }, \"Reference\": \"Foobar\" } ] }" + "example" : { + "Receipts" : [ { + "Lineitems" : [ ], + "User" : { + "UserID" : "00000000-0000-0000-0000-000000000000" + }, + "Reference" : "Foobar" + } ] + } } }, "required" : true @@ -47362,14 +48094,9 @@

Usage and SDK Samples

UUID receiptID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateReceiptAttachmentByFileName"); @@ -47507,7 +48234,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -47524,7 +48251,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -47709,7 +48436,53 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/RepeatingInvoices" }, - "example" : "{ \"Schedule\": { \"Period\": 1, \"Unit\": \"MONTHLY\", \"DueDate\": 10, \"DueDateType\": \"OFFOLLOWINGMONTH\", \"StartDate\": \"\\/Date(1555286400000+0000)\\/\", \"EndDate\": \"\\/Date(1569801600000+0000)\\/\", \"NextScheduledDate\": \"\\/Date(1555286400000+0000)\\/\" }, \"RepeatingInvoiceID\": \"428c0d75-909f-4b04-8403-a48dc27283b0\", \"Type\": \"ACCREC\", \"Reference\": \"[Week]\", \"HasAttachments\": true, \"ApprovedForSending\": false, \"SendCopy\": false, \"MarkAsSent\": false, \"IncludePDF\": false, \"ID\": \"428c0d75-909f-4b04-8403-a48dc27283b0\", \"Contact\": { \"ContactID\": \"430fa14a-f945-44d3-9f97-5df5e28441b8\", \"Name\": \"Liam Gallagher\", \"Addresses\": [], \"Phones\": [], \"ContactGroups\": [], \"ContactPersons\": [], \"HasValidationErrors\": false }, \"Status\": \"DELETED\", \"LineAmountTypes\": \"Exclusive\", \"LineItems\": [ { \"Description\": \"Guitars Fender Strat\", \"UnitAmount\": 5000.00, \"TaxType\": \"OUTPUT2\", \"TaxAmount\": 750.00, \"LineAmount\": 5000.00, \"AccountCode\": \"200\", \"Tracking\": [], \"Quantity\": 1.0000, \"LineItemID\": \"13a8353c-d2af-4d5b-920c-438449f08900\", \"DiscountEnteredAsPercent\": true } ], \"SubTotal\": 5000.00, \"TotalTax\": 750.00, \"Total\": 5750.00, \"CurrencyCode\": \"NZD\" }" + "example" : { + "Schedule" : { + "Period" : 1, + "Unit" : "MONTHLY", + "DueDate" : 10, + "DueDateType" : "OFFOLLOWINGMONTH", + "StartDate" : "/Date(1555286400000+0000)/", + "EndDate" : "/Date(1569801600000+0000)/", + "NextScheduledDate" : "/Date(1555286400000+0000)/" + }, + "RepeatingInvoiceID" : "428c0d75-909f-4b04-8403-a48dc27283b0", + "Type" : "ACCREC", + "Reference" : "[Week]", + "HasAttachments" : true, + "ApprovedForSending" : false, + "SendCopy" : false, + "MarkAsSent" : false, + "IncludePDF" : false, + "ID" : "428c0d75-909f-4b04-8403-a48dc27283b0", + "Contact" : { + "ContactID" : "430fa14a-f945-44d3-9f97-5df5e28441b8", + "Name" : "Liam Gallagher", + "Addresses" : [ ], + "Phones" : [ ], + "ContactGroups" : [ ], + "ContactPersons" : [ ], + "HasValidationErrors" : false + }, + "Status" : "DELETED", + "LineAmountTypes" : "Exclusive", + "LineItems" : [ { + "Description" : "Guitars Fender Strat", + "UnitAmount" : 5000.0, + "TaxType" : "OUTPUT2", + "TaxAmount" : 750.0, + "LineAmount" : 5000.0, + "AccountCode" : "200", + "Tracking" : [ ], + "Quantity" : 1.0, + "LineItemID" : "13a8353c-d2af-4d5b-920c-438449f08900", + "DiscountEnteredAsPercent" : true + } ], + "SubTotal" : 5000.0, + "TotalTax" : 750.0, + "Total" : 5750.0, + "CurrencyCode" : "NZD" + } } }, "required" : true @@ -47760,14 +48533,9 @@

Usage and SDK Samples

UUID repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'; String fileName = 'xero-dev.jpg'; String idempotencyKey = 'KEY_VALUE'; - - File input = new File("/path/to/local/xero-dev.jpg"); - java.nio.file.Path inputPath = input.toPath(); - byte[] body = FileUtils.readFileToByteArray(input); - String mimeType = Files.probeContentType(inputPath); try { - Attachments result = apiInstance.updateRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, idempotencyKey, mimeType); + Attachments result = apiInstance.updateRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, idempotencyKey); System.out.println(result); } catch (XeroException e) { System.err.println("Exception when calling AccountingApi#updateRepeatingInvoiceAttachmentByFileName"); @@ -47905,7 +48673,7 @@

Parameters

- byte[] + File
Byte array of file in body of request @@ -47922,7 +48690,7 @@

Parameters

"application/octet-stream" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } }, @@ -48086,7 +48854,17 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TaxRates" }, - "example" : "{ \"TaxRates\": [ { \"Name\": \"State Tax NY\", \"TaxComponents\": [ { \"Name\": \"State Tax\", \"Rate\": 2.25 } ], \"Status\": \"DELETED\", \"ReportTaxType\": \"INPUT\" } ] }" + "example" : { + "TaxRates" : [ { + "Name" : "State Tax NY", + "TaxComponents" : [ { + "Name" : "State Tax", + "Rate" : 2.25 + } ], + "Status" : "DELETED", + "ReportTaxType" : "INPUT" + } ] + } } }, "required" : true @@ -48273,7 +49051,9 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TrackingCategory" }, - "example" : "{ \"Name\": \"Avengers\" }" + "example" : { + "Name" : "Avengers" + } } }, "required" : true @@ -48488,7 +49268,9 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TrackingOption" }, - "example" : "{ name: \"Vision\" }" + "example" : { + "name" : "Vision" + } } }, "required" : true diff --git a/docs/v4/appstore/index.html b/docs/v4/appstore/index.html index 3f39be5d4..6408b41d8 100644 --- a/docs/v4/appstore/index.html +++ b/docs/v4/appstore/index.html @@ -1640,7 +1640,10 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/CreateUsageRecord" }, - "example" : "{ \"timestamp\": \"2022-01-21T13:01:00\", \"quantity\": 10 }" + "example" : { + "timestamp" : "2022-01-21T13:01:00", + "quantity" : 10 + } } }, "required" : true @@ -1857,7 +1860,9 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/UpdateUsageRecord" }, - "example" : "{ \"quantity\": 10 }" + "example" : { + "quantity" : 10 + } } }, "required" : true diff --git a/docs/v4/assets/index.html b/docs/v4/assets/index.html index d22ba9b37..6204e671c 100644 --- a/docs/v4/assets/index.html +++ b/docs/v4/assets/index.html @@ -1028,7 +1028,6 @@ }; defs["BookDepreciationDetail"] = { "title" : "", - "required" : [ "name" ], "properties" : { "currentCapitalGain" : { "type" : "number", @@ -1082,7 +1081,6 @@ }; defs["BookDepreciationSetting"] = { "title" : "", - "required" : [ "name" ], "properties" : { "depreciationMethod" : { "type" : "string", @@ -1571,7 +1569,28 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Asset" }, - "example" : "{ \"assetName\":\"Computer74863\", \"assetNumber\":\"123477544\", \"purchaseDate\":\"2020-01-01\", \"purchasePrice\":100.0, \"disposalPrice\":23.23, \"assetStatus\":\"Draft\", \"bookDepreciationSetting\":{ \"depreciationMethod\":\"StraightLine\", \"averagingMethod\":\"ActualDays\", \"depreciationRate\":0.5, \"depreciationCalculationMethod\":\"None\" }, \"bookDepreciationDetail\":{ \"currentCapitalGain\":5.32, \"currentGainLoss\":3.88, \"depreciationStartDate\":\"2020-01-02\", \"costLimit\":100.0, \"currentAccumDepreciationAmount\":2.25 }, \"AccountingBookValue\":99.5 }" + "example" : { + "assetName" : "Computer74863", + "assetNumber" : "123477544", + "purchaseDate" : "2020-01-01", + "purchasePrice" : 100.0, + "disposalPrice" : 23.23, + "assetStatus" : "Draft", + "bookDepreciationSetting" : { + "depreciationMethod" : "StraightLine", + "averagingMethod" : "ActualDays", + "depreciationRate" : 0.5, + "depreciationCalculationMethod" : "None" + }, + "bookDepreciationDetail" : { + "currentCapitalGain" : 5.32, + "currentGainLoss" : 3.88, + "depreciationStartDate" : "2020-01-02", + "costLimit" : 100.0, + "currentAccumDepreciationAmount" : 2.25 + }, + "AccountingBookValue" : 99.5 + } } }, "required" : true @@ -1734,7 +1753,18 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/AssetType" }, - "example" : "{ \"assetTypeName\":\"Machinery11004\", \"fixedAssetAccountId\":\"3d8d063a-c148-4bb8-8b3c-a5e2ad3b1e82\", \"depreciationExpenseAccountId\":\"d1602f69-f900-4616-8d34-90af393fa368\", \"accumulatedDepreciationAccountId\":\"9195cadd-8645-41e6-9f67-7bcd421defe8\", \"bookDepreciationSetting\":{ \"depreciationMethod\":\"DiminishingValue100\", \"averagingMethod\":\"ActualDays\", \"depreciationRate\":0.05, \"depreciationCalculationMethod\":\"None\" } }" + "example" : { + "assetTypeName" : "Machinery11004", + "fixedAssetAccountId" : "3d8d063a-c148-4bb8-8b3c-a5e2ad3b1e82", + "depreciationExpenseAccountId" : "d1602f69-f900-4616-8d34-90af393fa368", + "accumulatedDepreciationAccountId" : "9195cadd-8645-41e6-9f67-7bcd421defe8", + "bookDepreciationSetting" : { + "depreciationMethod" : "DiminishingValue100", + "averagingMethod" : "ActualDays", + "depreciationRate" : 0.05, + "depreciationCalculationMethod" : "None" + } + } } }, "required" : true diff --git a/docs/v4/payroll-au/index.html b/docs/v4/payroll-au/index.html index f588e5d23..62bdacfa5 100644 --- a/docs/v4/payroll-au/index.html +++ b/docs/v4/payroll-au/index.html @@ -4181,7 +4181,25 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PayItem" }, - "example" : "{ \"EarningsRates\": [ { \"Name\": \"MyRate\", \"AccountCode\": \"400\", \"TypeOfUnits\": \"4.00\", \"IsExemptFromTax\": true, \"IsExemptFromSuper\": true, \"IsReportableAsW1\": false, \"AllowanceContributesToAnnualLeaveRate\": false, \"AllowanceContributesToOvertimeRate\": false, \"EarningsType\": \"ORDINARYTIMEEARNINGS\", \"EarningsRateID\": \"1fa4e226-b711-46ba-a8a7-4344c9c5fb87\", \"RateType\": \"MULTIPLE\", \"RatePerUnit\": \"10.0\", \"Multiplier\": 1.5, \"Amount\": 5, \"EmploymentTerminationPaymentType\": \"O\" } ] }" + "example" : { + "EarningsRates" : [ { + "Name" : "MyRate", + "AccountCode" : "400", + "TypeOfUnits" : "4.00", + "IsExemptFromTax" : true, + "IsExemptFromSuper" : true, + "IsReportableAsW1" : false, + "AllowanceContributesToAnnualLeaveRate" : false, + "AllowanceContributesToOvertimeRate" : false, + "EarningsType" : "ORDINARYTIMEEARNINGS", + "EarningsRateID" : "1fa4e226-b711-46ba-a8a7-4344c9c5fb87", + "RateType" : "MULTIPLE", + "RatePerUnit" : "10.0", + "Multiplier" : 1.5, + "Amount" : 5, + "EmploymentTerminationPaymentType" : "O" + } ] + } } }, "required" : true @@ -8453,7 +8471,16 @@

Parameters

"$ref" : "#/components/schemas/PayslipLines" } }, - "example" : "{ \"Payslip\": { \"EmployeeID\": \"cdfb8371-0b21-4b8a-8903-1024df6c391e\", \"DeductionLines\": [ { \"DeductionTypeID\": \"727af5e8-b347-4ae7-85fc-9b82266d0aec\", \"CalculationType\": \"FIXEDAMOUNT\", \"NumberOfUnits\": 10 } ] } }" + "example" : { + "Payslip" : { + "EmployeeID" : "cdfb8371-0b21-4b8a-8903-1024df6c391e", + "DeductionLines" : [ { + "DeductionTypeID" : "727af5e8-b347-4ae7-85fc-9b82266d0aec", + "CalculationType" : "FIXEDAMOUNT", + "NumberOfUnits" : 10 + } ] + } + } } }, "required" : true diff --git a/docs/v4/payroll-nz/index.html b/docs/v4/payroll-nz/index.html index c59067533..a23f62bf8 100644 --- a/docs/v4/payroll-nz/index.html +++ b/docs/v4/payroll-nz/index.html @@ -1046,7 +1046,7 @@ }; defs["Deduction"] = { "title" : "", - "required" : [ "calculationType", "deductionCategory", "deductionName", "liabilityAccountId" ], + "required" : [ "deductionCategory", "deductionName", "liabilityAccountId" ], "type" : "object", "properties" : { "deductionId" : { @@ -1420,7 +1420,7 @@ }; defs["Employee"] = { "title" : "", - "required" : [ "Address", "DateOfBirth", "FirstName", "LastName" ], + "required" : [ "address", "dateOfBirth", "firstName", "lastName" ], "type" : "object", "properties" : { "employeeID" : { @@ -2426,7 +2426,7 @@ }; defs["Employment"] = { "title" : "", - "required" : [ "EngagementType", "PayrollCalendarID", "StartDate" ], + "required" : [ "engagementType", "payrollCalendarID", "startDate" ], "type" : "object", "properties" : { "payrollCalendarID" : { @@ -4555,7 +4555,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Deduction" }, - "example" : "{ \"deductionName\": \"My new deduction\", \"deductionCategory\": \"NzOther\", \"liabilityAccountId\": \"568f2e9a-0870-46cc-8678-f83f132ed4e3\" }" + "example" : { + "deductionName" : "My new deduction", + "deductionCategory" : "NzOther", + "liabilityAccountId" : "568f2e9a-0870-46cc-8678-f83f132ed4e3" + } } }, "required" : true @@ -4709,7 +4713,13 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EarningsRate" }, - "example" : "{ \"name\": \"My Earnings Rate\", \"earningsType\": \"RegularEarnings\", \"rateType\": \"RatePerUnit\", \"typeOfUnits\": \"hours\", \"expenseAccountID\": \"e4eb36f6-97e3-4427-a394-dd4e1b355c2e\" }" + "example" : { + "name" : "My Earnings Rate", + "earningsType" : "RegularEarnings", + "rateType" : "RatePerUnit", + "typeOfUnits" : "hours", + "expenseAccountID" : "e4eb36f6-97e3-4427-a394-dd4e1b355c2e" + } } }, "required" : true @@ -4871,7 +4881,20 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Employee" }, - "example" : "{ \"title\": \"Mr\", \"firstName\": \"Mike\", \"lastName\": \"Johntzxzpxhmkgson\", \"dateOfBirth\": \"2000-01-01\", \"address\": { \"addressLine1\": \"101 Green St\", \"city\": \"San Francisco\", \"postCode\": \"4351\", \"countryName\": \"United Kingdom\" }, \"email\": \"83139@starkindustries.com\", \"gender\": \"M\" }" + "example" : { + "title" : "Mr", + "firstName" : "Mike", + "lastName" : "Johntzxzpxhmkgson", + "dateOfBirth" : "2000-01-01", + "address" : { + "addressLine1" : "101 Green St", + "city" : "San Francisco", + "postCode" : "4351", + "countryName" : "United Kingdom" + }, + "email" : "83139@starkindustries.com", + "gender" : "M" + } } }, "required" : true @@ -5066,7 +5089,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EarningsTemplate" }, - "example" : "{ \"ratePerUnit\": 20, \"numberOfUnits\": 8, \"earningsRateID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\", \"name\": \"My New One\" }" + "example" : { + "ratePerUnit" : 20, + "numberOfUnits" : 8, + "earningsRateID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5", + "name" : "My New One" + } } }, "required" : true @@ -5259,7 +5287,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeLeave" }, - "example" : "{ \"leaveTypeID\": \"b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4\", \"description\": \"Creating a Description\", \"startDate\": \"2020-04-24\", \"endDate\": \"2020-04-26\" }" + "example" : { + "leaveTypeID" : "b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4", + "description" : "Creating a Description", + "startDate" : "2020-04-24", + "endDate" : "2020-04-26" + } } }, "required" : true @@ -5456,7 +5489,16 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeLeaveSetup" }, - "example" : "{ \"holidayPayOpeningBalance\": 10, \"annualLeaveOpeningBalance\": 100, \"sickLeaveHoursToAccrueAnnually\": 20, \"sickLeaveToAccrueAnnually\": 20, \"sickLeaveOpeningBalance\": 10, \"sickLeaveScheduleOfAccrual\": \"OnAnniversaryDate\", \"sickLeaveAnniversaryDate\": \"2023-12-31\", \"annualLeaveAnniversaryDate\": \"2023-12-31\" }" + "example" : { + "holidayPayOpeningBalance" : 10, + "annualLeaveOpeningBalance" : 100, + "sickLeaveHoursToAccrueAnnually" : 20, + "sickLeaveToAccrueAnnually" : 20, + "sickLeaveOpeningBalance" : 10, + "sickLeaveScheduleOfAccrual" : "OnAnniversaryDate", + "sickLeaveAnniversaryDate" : "2023-12-31", + "annualLeaveAnniversaryDate" : "2023-12-31" + } } }, "required" : true @@ -5646,7 +5688,17 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeLeaveType" }, - "example" : "{ \"leaveTypeID\": \"35da97ae-05b9-427f-9a98-69157ba42cec\", \"scheduleOfAccrual\": \"AnnuallyAfter6Months\", \"hoursAccruedAnnually\": 10, \"unitsAccruedAnnually\": 10, \"typeOfUnitsToAccrue\": \"Hours\", \"openingBalanceTypeOfUnits\": \"Hours\" \"maximumToAccrue\": 80, \"openingBalance\": 100, \"rateAccruedHourly\": 3.5 }" + "example" : { + "leaveTypeID" : "35da97ae-05b9-427f-9a98-69157ba42cec", + "scheduleOfAccrual" : "AnnuallyAfter6Months", + "hoursAccruedAnnually" : 10, + "unitsAccruedAnnually" : 10, + "typeOfUnitsToAccrue" : "Hours", + "openingBalanceTypeOfUnits" : "Hours", + "maximumToAccrue" : 80, + "openingBalance" : 100, + "rateAccruedHourly" : 3.5 + } } }, "required" : true @@ -6035,7 +6087,18 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PaymentMethod" }, - "example" : "" + "example" : { + "bankAccounts" : [ { + "accountName" : "Casual Worker", + "accountNumber" : "0607050201419000", + "sortCode" : null, + "particulars" : null, + "code" : null, + "dollarAmount" : null, + "reference" : "", + "calculationType" : "Balance" + } ] + } } }, "required" : true @@ -6225,7 +6288,17 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/SalaryAndWage" }, - "example" : "{ \"earningsRateID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\", \"numberOfUnitsPerWeek\": 2, \"ratePerUnit\": 10, \"numberOfUnitsPerDay\": 2, \"daysPerWeek\": 1, \"effectiveFrom\": \"2020-05-01\", \"annualSalary\": 100, \"status\": \"Active\", \"paymentType\": \"Salary\" }" + "example" : { + "earningsRateID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5", + "numberOfUnitsPerWeek" : 2, + "ratePerUnit" : 10, + "numberOfUnitsPerDay" : 2, + "daysPerWeek" : 1, + "effectiveFrom" : "2020-05-01", + "annualSalary" : 100, + "status" : "Active", + "paymentType" : "Salary" + } } }, "required" : true @@ -6419,7 +6492,18 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeWorkingPatternWithWorkingWeeksRequest" }, - "example" : "{ \"effectiveFrom\": \"2020-01-01T00:00:00\", \"workingWeeks\": [ { \"monday\": 0.0, \"tuesday\": 3.0000, \"wednesday\": 0.0, \"thursday\": 0.0, \"friday\": 0.0, \"saturday\": 0.0, \"sunday\": 0.0 } ] }" + "example" : { + "effectiveFrom" : "2020-01-01T00:00:00", + "workingWeeks" : [ { + "monday" : 0.0, + "tuesday" : 3.0, + "wednesday" : 0.0, + "thursday" : 0.0, + "friday" : 0.0, + "saturday" : 0.0, + "sunday" : 0.0 + } ] + } } }, "required" : true @@ -6610,7 +6694,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Employment" }, - "example" : "{ \"payrollCalendarID\": \"9aa56064-990f-4ad3-a189-d966d8f6a030\", \"startDate\": \"2020-09-02\", \"engagementType\": \"FixedTerm\", \"fixedTermEndDate\": \"2026-01-01\" }" + "example" : { + "payrollCalendarID" : "9aa56064-990f-4ad3-a189-d966d8f6a030", + "startDate" : "2020-09-02", + "engagementType" : "FixedTerm", + "fixedTermEndDate" : "2026-01-01" + } } }, "required" : true @@ -6764,7 +6853,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/LeaveType" }, - "example" : "{ \"name\": \"My wqwhhiktun Leave\", \"isPaidLeave\": false, \"showOnPayslip\": true }" + "example" : { + "name" : "My wqwhhiktun Leave", + "isPaidLeave" : false, + "showOnPayslip" : true + } } }, "required" : true @@ -7112,7 +7205,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PayRun" }, - "example" : "{ \"payrollCalendarID\": \"9aa56064-990f-4ad3-a189-d966d8f6a030\", \"periodStartDate\": \"2020-09-08\", \"periodEndDate\": \"2020-09-15\", \"paymentDate\": \"2020-09-20\", \"payRunStatus\": \"Draft\", \"payRunType\": \"Scheduled\", \"calendarType\": \"Weekly\" }" + "example" : { + "payrollCalendarID" : "9aa56064-990f-4ad3-a189-d966d8f6a030", + "periodStartDate" : "2020-09-08", + "periodEndDate" : "2020-09-15", + "paymentDate" : "2020-09-20", + "payRunStatus" : "Draft", + "payRunType" : "Scheduled", + "calendarType" : "Weekly" + } } }, "required" : true @@ -7268,7 +7369,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PayRunCalendar" }, - "example" : "{ \"name\": \"My Weekly Cal\", \"calendarType\": \"Weekly\", \"periodStartDate\": \"2020-05-01\", \"paymentDate\": \"2020-05-15\" }" + "example" : { + "name" : "My Weekly Cal", + "calendarType" : "Weekly", + "periodStartDate" : "2020-05-01", + "paymentDate" : "2020-05-15" + } } }, "required" : true @@ -7423,7 +7529,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Reimbursement" }, - "example" : "{ \"name\": \"My new Reimburse\", \"accountID\": \"fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488\", \"reimbursementCategory\": \"GSTInclusive\", \"calculationType\": \"FixedAmount\" }" + "example" : { + "name" : "My new Reimburse", + "accountID" : "fa5cdc43-643b-4ad8-b4ac-3ffe0d0f4488", + "reimbursementCategory" : "GSTInclusive", + "calculationType" : "FixedAmount" + } } }, "required" : true @@ -7580,7 +7691,14 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Benefit" }, - "example" : "{ \"name\": \"SidSaver\", \"category\": \"Other\", \"liabilityAccountId\": \"568f2e9a-0870-46cc-8678-f83f132ed4e3\", \"expenseAccountId\": \"e4eb36f6-97e3-4427-a394-dd4e1b355c2e\", \"CalculationTypeNZ\": \"FixedAmount\", \"standardAmount\": 10 }" + "example" : { + "name" : "SidSaver", + "category" : "Other", + "liabilityAccountId" : "568f2e9a-0870-46cc-8678-f83f132ed4e3", + "expenseAccountId" : "e4eb36f6-97e3-4427-a394-dd4e1b355c2e", + "CalculationTypeNZ" : "FixedAmount", + "standardAmount" : 10 + } } }, "required" : true @@ -7737,7 +7855,21 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Timesheet" }, - "example" : "{ \"payrollCalendarID\": \"9aa56064-990f-4ad3-a189-d966d8f6a030\", \"employeeID\": \"68342973-c405-4b86-b5d3-d7b877c27995\", \"startDate\": \"2020-04-13\", \"endDate\": \"2020-04-19\", \"timesheetLines\": [ { \"date\": \"2020-04-13\", \"earningsRateID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\", \"numberOfUnits\": 8 }, { \"date\": \"2020-04-15\", \"earningsRateID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\", \"numberOfUnits\": 6 } ] }" + "example" : { + "payrollCalendarID" : "9aa56064-990f-4ad3-a189-d966d8f6a030", + "employeeID" : "68342973-c405-4b86-b5d3-d7b877c27995", + "startDate" : "2020-04-13", + "endDate" : "2020-04-19", + "timesheetLines" : [ { + "date" : "2020-04-13", + "earningsRateID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5", + "numberOfUnits" : 8 + }, { + "date" : "2020-04-15", + "earningsRateID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5", + "numberOfUnits" : 6 + } ] + } } }, "required" : true @@ -7929,7 +8061,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TimesheetLine" }, - "example" : "{ \"date\": \"2020-08-03\", \"earningsRateID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\", \"numberOfUnits\": 1 }" + "example" : { + "date" : "2020-08-03", + "earningsRateID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5", + "numberOfUnits" : 1 + } } }, "required" : true @@ -14116,7 +14252,20 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Employee" }, - "example" : "{ \"title\": \"Mr\", \"firstName\": \"Tony\", \"lastName\": \"Starkgtrzgquusrson\", \"dateOfBirth\": \"1999-01-01\", \"address\": { \"addressLine1\": \"101 Green St\", \"city\": \"San Francisco\", \"postCode\": \"4432\", \"countryName\": \"United Kingdom\" }, \"email\": \"58315@starkindustries.com\", \"gender\": \"M\" }" + "example" : { + "title" : "Mr", + "firstName" : "Tony", + "lastName" : "Starkgtrzgquusrson", + "dateOfBirth" : "1999-01-01", + "address" : { + "addressLine1" : "101 Green St", + "city" : "San Francisco", + "postCode" : "4432", + "countryName" : "United Kingdom" + }, + "email" : "58315@starkindustries.com", + "gender" : "M" + } } }, "required" : true @@ -14339,7 +14488,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EarningsTemplate" }, - "example" : "{ \"ratePerUnit\": 25, \"numberOfUnits\": 4, \"earningsRateID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\" }" + "example" : { + "ratePerUnit" : 25, + "numberOfUnits" : 4, + "earningsRateID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5" + } } }, "required" : true @@ -14558,7 +14711,18 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeLeave" }, - "example" : "{ \"leaveTypeID\": \"b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4\", \"description\": \"Creating a Description\", \"startDate\": \"2020-04-24\", \"endDate\": \"2020-04-26\", \"periods\": [ { \"periodStartDate\": \"2020-04-20\", \"periodEndDate\": \"2020-04-26\", \"numberOfUnits\": 1, \"periodStatus\": \"Approved\" } ] }" + "example" : { + "leaveTypeID" : "b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4", + "description" : "Creating a Description", + "startDate" : "2020-04-24", + "endDate" : "2020-04-26", + "periods" : [ { + "periodStartDate" : "2020-04-20", + "periodEndDate" : "2020-04-26", + "numberOfUnits" : 1, + "periodStatus" : "Approved" + } ] + } } }, "required" : true @@ -14776,7 +14940,17 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/SalaryAndWage" }, - "example" : "{ \"earningsRateID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\", \"numberOfUnitsPerWeek\": 3, \"ratePerUnit\": 11, \"numberOfUnitsPerDay\": 3, \"daysPerWeek\": 1, \"effectiveFrom\": \"2020-05-15\", \"annualSalary\": 101, \"status\": \"Active\", \"paymentType\": \"Salary\" }" + "example" : { + "earningsRateID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5", + "numberOfUnitsPerWeek" : 3, + "ratePerUnit" : 11, + "numberOfUnitsPerDay" : 3, + "daysPerWeek" : 1, + "effectiveFrom" : "2020-05-15", + "annualSalary" : 101, + "status" : "Active", + "paymentType" : "Salary" + } } }, "required" : true @@ -14975,7 +15149,24 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeTax" }, - "example" : "" + "example" : { + "irdNumber" : "111111111", + "taxCode" : "M", + "esctRatePercentage" : 17.5, + "isEligibleForKiwiSaver" : true, + "hasSpecialStudentLoanRate" : false, + "specialStudentLoanRatePercentage" : null, + "specialTaxRatePercentage" : null, + "kiwiSaverContributions" : "MakeContributions", + "kiwiSaverOptOutDate" : null, + "kiwiSaverContributionHolidayEndDate" : null, + "kiwiSaverEmployeeContributionRatePercentage" : 3, + "kiwiSaverEmployerContributionRatePercentage" : 3, + "kiwiSaverEmployerSalarySacrificeContributionRatePercentage" : 0, + "hasStudentLoanBalance" : false, + "studentLoanBalance" : null, + "studentLoanAsAt" : null + } } }, "required" : true @@ -15166,7 +15357,9 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PayRun" }, - "example" : "{ \"paymentDate\": \"2019-07-01\" }" + "example" : { + "paymentDate" : "2019-07-01" + } } }, "required" : true @@ -15364,7 +15557,81 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PaySlip" }, - "example" : "{ \"earningsLines\": [ { \"earningsLineID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\", \"earningsRateID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\", \"displayName\": \"Ordinary Time\", \"ratePerUnit\": 25, \"numberOfUnits\": 0, \"amount\": 0, \"isLinkedToTimesheet\": false, \"isSystemGenerated\": true }, { \"earningsLineID\": \"65b83d94-f20f-45e1-85ae-387fcf460c26\", \"earningsRateID\": \"65b83d94-f20f-45e1-85ae-387fcf460c26\", \"displayName\": \"Salary\", \"ratePerUnit\": 0, \"numberOfUnits\": 8, \"amount\": 0, \"isLinkedToTimesheet\": false, \"isSystemGenerated\": false } ], \"leaveEarningsLines\": [ { \"earningsLineID\": \"0441497f-5dc7-4cd3-a90d-f2e07e21b2a6\", \"earningsRateID\": \"39b3560a-5d2f-4538-924a-4349dc86396e\", \"displayName\": \"Holiday Pay\", \"fixedAmount\": 268.8, \"amount\": 268.8, \"isLinkedToTimesheet\": false, \"isSystemGenerated\": true } ], \"deductionLines\": [ { \"deductionTypeID\": \"a3760fe4-68a4-4e38-8326-fe616af7dc74\", \"amount\": 100 } ], \"leaveAccrualLines\": [ { \"leaveTypeID\": \"0441497f-5dc7-4cd3-a90d-f2e07e21b2a6\", \"numberOfUnits\": 268.8 }, { \"leaveTypeID\": \"b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4\", \"numberOfUnits\": 0 }, { \"leaveTypeID\": \"f2f994cf-1899-46f3-ad4f-5d92d78c3719\", \"numberOfUnits\": 0 }, { \"leaveTypeID\": \"34129765-11cb-4d8c-b568-84a2219beda3\", \"numberOfUnits\": 0 } ], \"superannuationLines\": [ { \"superannuationTypeID\": \"563273ea-0dae-4f82-86a4-e0db77c008ea\", \"displayName\": \"KiwiSaver\", \"amount\": 108.86, \"fixedAmount\": 3, \"percentage\": 3, \"manualAdjustment\": false } ], \"employeeTaxLines\": [ { \"taxLineID\": \"1084146b-e890-489c-aed3-06de80f63d84\", \"amount\": 1057.22, \"globalTaxTypeID\": \"11\", \"manualAdjustment\": false } ], \"employerTaxLines\": [ { \"taxLineID\": \"6f9eb8cd-0f4a-440b-939c-bdb0f6ad694c\", \"amount\": 18.9, \"globalTaxTypeID\": \"10\", \"manualAdjustment\": false } ], \"statutoryDeductionLines\": [ { \"statutoryDeductionTypeID\": \"b5efd8d1-0c93-4a14-a314-b5cba4a4e6b3\", \"amount\": 108.86 } ], \"grossEarningsHistory\": { \"daysPaid\": 3, \"unpaidWeeks\": 0 } }" + "example" : { + "earningsLines" : [ { + "earningsLineID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5", + "earningsRateID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5", + "displayName" : "Ordinary Time", + "ratePerUnit" : 25, + "numberOfUnits" : 0, + "amount" : 0, + "isLinkedToTimesheet" : false, + "isSystemGenerated" : true + }, { + "earningsLineID" : "65b83d94-f20f-45e1-85ae-387fcf460c26", + "earningsRateID" : "65b83d94-f20f-45e1-85ae-387fcf460c26", + "displayName" : "Salary", + "ratePerUnit" : 0, + "numberOfUnits" : 8, + "amount" : 0, + "isLinkedToTimesheet" : false, + "isSystemGenerated" : false + } ], + "leaveEarningsLines" : [ { + "earningsLineID" : "0441497f-5dc7-4cd3-a90d-f2e07e21b2a6", + "earningsRateID" : "39b3560a-5d2f-4538-924a-4349dc86396e", + "displayName" : "Holiday Pay", + "fixedAmount" : 268.8, + "amount" : 268.8, + "isLinkedToTimesheet" : false, + "isSystemGenerated" : true + } ], + "deductionLines" : [ { + "deductionTypeID" : "a3760fe4-68a4-4e38-8326-fe616af7dc74", + "amount" : 100 + } ], + "leaveAccrualLines" : [ { + "leaveTypeID" : "0441497f-5dc7-4cd3-a90d-f2e07e21b2a6", + "numberOfUnits" : 268.8 + }, { + "leaveTypeID" : "b0b1b79e-2a25-46c2-ad08-ca25ef48d7e4", + "numberOfUnits" : 0 + }, { + "leaveTypeID" : "f2f994cf-1899-46f3-ad4f-5d92d78c3719", + "numberOfUnits" : 0 + }, { + "leaveTypeID" : "34129765-11cb-4d8c-b568-84a2219beda3", + "numberOfUnits" : 0 + } ], + "superannuationLines" : [ { + "superannuationTypeID" : "563273ea-0dae-4f82-86a4-e0db77c008ea", + "displayName" : "KiwiSaver", + "amount" : 108.86, + "fixedAmount" : 3, + "percentage" : 3, + "manualAdjustment" : false + } ], + "employeeTaxLines" : [ { + "taxLineID" : "1084146b-e890-489c-aed3-06de80f63d84", + "amount" : 1057.22, + "globalTaxTypeID" : "11", + "manualAdjustment" : false + } ], + "employerTaxLines" : [ { + "taxLineID" : "6f9eb8cd-0f4a-440b-939c-bdb0f6ad694c", + "amount" : 18.9, + "globalTaxTypeID" : "10", + "manualAdjustment" : false + } ], + "statutoryDeductionLines" : [ { + "statutoryDeductionTypeID" : "b5efd8d1-0c93-4a14-a314-b5cba4a4e6b3", + "amount" : 108.86 + } ], + "grossEarningsHistory" : { + "daysPaid" : 3, + "unpaidWeeks" : 0 + } + } } }, "required" : true @@ -15584,7 +15851,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TimesheetLine" }, - "example" : "{ \"date\": \"2020-08-04\", \"earningsRateID\": \"f9d8f5b5-9049-47f4-8541-35e200f750a5\", \"numberOfUnits\": 2 }" + "example" : { + "date" : "2020-08-04", + "earningsRateID" : "f9d8f5b5-9049-47f4-8541-35e200f750a5", + "numberOfUnits" : 2 + } } }, "required" : true diff --git a/docs/v4/payroll-uk/index.html b/docs/v4/payroll-uk/index.html index e55f2b572..525b190f2 100644 --- a/docs/v4/payroll-uk/index.html +++ b/docs/v4/payroll-uk/index.html @@ -1512,7 +1512,7 @@ }; defs["Employee"] = { "title" : "", - "required" : [ "Address", "DateOfBirth", "FirstName", "Gender", "LastName", "Title" ], + "required" : [ "address", "dateOfBirth", "firstName", "gender", "lastName", "title" ], "type" : "object", "properties" : { "employeeID" : { @@ -2260,7 +2260,7 @@ }; defs["Employment"] = { "title" : "", - "required" : [ "EmployeeNumber", "NICategory", "PayrollCalendarID", "StartDate" ], + "required" : [ "employeeNumber", "niCategory", "payrollCalendarID", "startDate" ], "type" : "object", "properties" : { "payrollCalendarID" : { @@ -4036,7 +4036,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Benefit" }, - "example" : "{ \"name\": \"My Big Bennie\", \"category\": \"StakeholderPension\", \"liabilityAccountId\": \"e0faa299-ca0d-4b0a-9e32-0dfabdf9179a\", \"expenseAccountId\": \"4b03500d-32fd-4616-8d70-e1e56e0519c6\", \"standardAmount\": 50, \"percentage\": 25, \"calculationType\": \"PercentageOfGross\" }" + "example" : { + "name" : "My Big Bennie", + "category" : "StakeholderPension", + "liabilityAccountId" : "e0faa299-ca0d-4b0a-9e32-0dfabdf9179a", + "expenseAccountId" : "4b03500d-32fd-4616-8d70-e1e56e0519c6", + "standardAmount" : 50, + "percentage" : 25, + "calculationType" : "PercentageOfGross" + } } }, "required" : true @@ -4191,7 +4199,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Deduction" }, - "example" : "{ \"deductionName\": \"My new deduction\", \"deductionCategory\": \"SalarySacrifice\", \"liabilityAccountId\": \"e0faa299-ca0d-4b0a-9e32-0dfabdf9179a\", \"calculationType\": \"FixedAmount\" }" + "example" : { + "deductionName" : "My new deduction", + "deductionCategory" : "SalarySacrifice", + "liabilityAccountId" : "e0faa299-ca0d-4b0a-9e32-0dfabdf9179a", + "calculationType" : "FixedAmount" + } } }, "required" : true @@ -4346,7 +4359,13 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EarningsRate" }, - "example" : "{ \"name\": \"My Earnings Rate\", \"earningsType\": \"RegularEarnings\", \"rateType\": \"RatePerUnit\", \"typeOfUnits\": \"hours\", \"expenseAccountID\": \"4b03500d-32fd-4616-8d70-e1e56e0519c6\" }" + "example" : { + "name" : "My Earnings Rate", + "earningsType" : "RegularEarnings", + "rateType" : "RatePerUnit", + "typeOfUnits" : "hours", + "expenseAccountID" : "4b03500d-32fd-4616-8d70-e1e56e0519c6" + } } }, "required" : true @@ -4508,7 +4527,20 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Employee" }, - "example" : "{ \"title\":\"Mr\", \"firstName\":\"Mike\", \"lastName\":\"Fancy\", \"dateOfBirth\":\"1999-01-01T00:00:00\", \"gender\":\"M\", \"email\":\"mike@starkindustries.com\", \"isOffPayrollWorker\": false, \"address\": { \"addressLine1\": \"171 Midsummer\", \"city\": \"Milton Keyness\", \"postCode\": \"MK9 1EB\" } }" + "example" : { + "title" : "Mr", + "firstName" : "Mike", + "lastName" : "Fancy", + "dateOfBirth" : "1999-01-01T00:00:00", + "gender" : "M", + "email" : "mike@starkindustries.com", + "isOffPayrollWorker" : false, + "address" : { + "addressLine1" : "171 Midsummer", + "city" : "Milton Keyness", + "postCode" : "MK9 1EB" + } + } } }, "required" : true @@ -4893,7 +4925,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeLeave" }, - "example" : "{ \"leaveTypeID\": \"1d2778ee-86ea-45c0-bbf8-1045485f6b3f\", \"description\": \"Creating a Description\", \"startDate\": \"2020-03-24\", \"endDate\": \"2020-03-26\" }" + "example" : { + "leaveTypeID" : "1d2778ee-86ea-45c0-bbf8-1045485f6b3f", + "description" : "Creating a Description", + "startDate" : "2020-03-24", + "endDate" : "2020-03-26" + } } }, "required" : true @@ -5083,7 +5120,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeLeaveType" }, - "example" : "{ \"leaveTypeID\": \"4918f233-bd31-43f9-9633-bcc6de1178f2\", \"scheduleOfAccrual\": \"BeginningOfCalendarYear\", \"hoursAccruedAnnually\": 10 }" + "example" : { + "leaveTypeID" : "4918f233-bd31-43f9-9633-bcc6de1178f2", + "scheduleOfAccrual" : "BeginningOfCalendarYear", + "hoursAccruedAnnually" : 10 + } } }, "required" : true @@ -5274,7 +5315,14 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeOpeningBalances" }, - "example" : "{ \"statutoryAdoptionPay\": 10, \"statutoryMaternityPay\": 10, \"statutoryPaternityPay\": 10, \"statutorySharedParentalPay\": 10, \"statutorySickPay\": 10, \"priorEmployeeNumber\": 10 }" + "example" : { + "statutoryAdoptionPay" : 10, + "statutoryMaternityPay" : 10, + "statutoryPaternityPay" : 10, + "statutorySharedParentalPay" : 10, + "statutorySickPay" : 10, + "priorEmployeeNumber" : 10 + } } }, "required" : true @@ -5469,7 +5517,14 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PaymentMethod" }, - "example" : "{ \"paymentMethod\": \"Electronically\", \"bankAccounts\": [ { \"accountName\": \"Sid BofA\", \"accountNumber\": \"24987654\", \"sortCode\": \"287654\" } ] }" + "example" : { + "paymentMethod" : "Electronically", + "bankAccounts" : [ { + "accountName" : "Sid BofA", + "accountNumber" : "24987654", + "sortCode" : "287654" + } ] + } } }, "required" : true @@ -5660,7 +5715,16 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/SalaryAndWage" }, - "example" : "{ \"earningsRateID\": \"87f5b43a-cf51-4b74-92de-94c819e82d27\", \"numberOfUnitsPerWeek\": 2, \"ratePerUnit\": 10, \"numberOfUnitsPerDay\": 2, \"effectiveFrom\": \"2020-05-01\", \"annualSalary\": 100, \"status\": \"ACTIVE\", \"paymentType\": \"Salary\" }" + "example" : { + "earningsRateID" : "87f5b43a-cf51-4b74-92de-94c819e82d27", + "numberOfUnitsPerWeek" : 2, + "ratePerUnit" : 10, + "numberOfUnitsPerDay" : 2, + "effectiveFrom" : "2020-05-01", + "annualSalary" : 100, + "status" : "ACTIVE", + "paymentType" : "Salary" + } } }, "required" : true @@ -5817,7 +5881,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeStatutorySickLeave" }, - "example" : "{ \"employeeID\": \"aad6b292-7b94-408b-93f6-e489867e3fb0\", \"leaveTypeID\": \"aab78802-e9d3-4bbd-bc87-df858054988f\", \"startDate\": \"2020-04-21\", \"endDate\": \"2020-04-24\", \"workPattern\": [ \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\" ], \"isPregnancyRelated\": false, \"sufficientNotice\": true }" + "example" : { + "employeeID" : "aad6b292-7b94-408b-93f6-e489867e3fb0", + "leaveTypeID" : "aab78802-e9d3-4bbd-bc87-df858054988f", + "startDate" : "2020-04-21", + "endDate" : "2020-04-24", + "workPattern" : [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" ], + "isPregnancyRelated" : false, + "sufficientNotice" : true + } } }, "required" : true @@ -6006,7 +6078,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Employment" }, - "example" : "{ \"PayrollCalendarID\": \"216d80e6-af55-47b1-b718-9457c3f5d2fe\", \"StartDate\": \"2020-04-01\", \"EmployeeNumber\": \"123ABC\", \"NICategory\": \"A\" }" + "example" : { + "PayrollCalendarID" : "216d80e6-af55-47b1-b718-9457c3f5d2fe", + "StartDate" : "2020-04-01", + "EmployeeNumber" : "123ABC", + "NICategory" : "A" + } } }, "required" : true @@ -6160,7 +6237,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/LeaveType" }, - "example" : "{ \"name\": \"My opebvwbfxf Leave\", \"isPaidLeave\": false, \"showOnPayslip\": true }" + "example" : { + "name" : "My opebvwbfxf Leave", + "isPaidLeave" : false, + "showOnPayslip" : true + } } }, "required" : true @@ -6511,7 +6592,12 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PayRunCalendar" }, - "example" : "{ \"name\": \"My Weekly Cal\", \"calendarType\": \"Weekly\", \"periodStartDate\": \"2020-05-01\", \"paymentDate\": \"2020-05-15\" }" + "example" : { + "name" : "My Weekly Cal", + "calendarType" : "Weekly", + "periodStartDate" : "2020-05-01", + "paymentDate" : "2020-05-15" + } } }, "required" : true @@ -6664,7 +6750,10 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Reimbursement" }, - "example" : "{ \"name\": \"My new Reimburse\", \"accountID\": \"9ee28149-32a9-4661-8eab-a28738696983\" }" + "example" : { + "name" : "My new Reimburse", + "accountID" : "9ee28149-32a9-4661-8eab-a28738696983" + } } }, "required" : true @@ -6821,7 +6910,21 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Timesheet" }, - "example" : "{ \"payrollCalendarID\": \"216d80e6-af55-47b1-b718-9457c3f5d2fe\", \"employeeID\": \"aad6b292-7b94-408b-93f6-e489867e3fb0\", \"startDate\": \"2020-04-13\", \"endDate\": \"2020-04-19\", \"timesheetLines\": [ { \"date\": \"2020-04-13\", \"earningsRateID\": \"87f5b43a-cf51-4b74-92de-94c819e82d27\", \"numberOfUnits\": 8 }, { \"date\": \"2020-04-15\", \"earningsRateID\": \"87f5b43a-cf51-4b74-92de-94c819e82d27\", \"numberOfUnits\": 6 } ] }" + "example" : { + "payrollCalendarID" : "216d80e6-af55-47b1-b718-9457c3f5d2fe", + "employeeID" : "aad6b292-7b94-408b-93f6-e489867e3fb0", + "startDate" : "2020-04-13", + "endDate" : "2020-04-19", + "timesheetLines" : [ { + "date" : "2020-04-13", + "earningsRateID" : "87f5b43a-cf51-4b74-92de-94c819e82d27", + "numberOfUnits" : 8 + }, { + "date" : "2020-04-15", + "earningsRateID" : "87f5b43a-cf51-4b74-92de-94c819e82d27", + "numberOfUnits" : 6 + } ] + } } }, "required" : true @@ -7013,7 +7116,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TimesheetLine" }, - "example" : "{ \"date\": \"2020-04-14\", \"earningsRateID\": \"87f5b43a-cf51-4b74-92de-94c819e82d27\", \"numberOfUnits\": 1 }" + "example" : { + "date" : "2020-04-14", + "earningsRateID" : "87f5b43a-cf51-4b74-92de-94c819e82d27", + "numberOfUnits" : 1 + } } }, "required" : true @@ -13387,7 +13494,21 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/Employee" }, - "example" : "{ \"title\": \"Mr.\", \"firstName\": \"TestDataUK\", \"lastName\": \"Tester\", \"dateOfBirth\": \"1992-11-22T00:00:00\", \"gender\": \"M\", \"email\": \"tester@gmail.com\", \"phoneNumber\": \"0400123456\", \"isOffPayrollWorker\": false, \"address\": { \"addressLine1\": \"171 Midsummer\", \"city\": \"Milton Keyness\", \"postCode\": \"MK9 1EB\" } }" + "example" : { + "title" : "Mr.", + "firstName" : "TestDataUK", + "lastName" : "Tester", + "dateOfBirth" : "1992-11-22T00:00:00", + "gender" : "M", + "email" : "tester@gmail.com", + "phoneNumber" : "0400123456", + "isOffPayrollWorker" : false, + "address" : { + "addressLine1" : "171 Midsummer", + "city" : "Milton Keyness", + "postCode" : "MK9 1EB" + } + } } }, "required" : true @@ -13610,7 +13731,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EarningsTemplate" }, - "example" : "{ \"ratePerUnit\": 30, \"numberOfUnits\": 4, \"earningsRateID\": \"87f5b43a-cf51-4b74-92de-94c819e82d27\" }" + "example" : { + "ratePerUnit" : 30, + "numberOfUnits" : 4, + "earningsRateID" : "87f5b43a-cf51-4b74-92de-94c819e82d27" + } } }, "required" : true @@ -13829,7 +13954,18 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeLeave" }, - "example" : "{ \"leaveTypeID\": \"ed08dffe-788e-4b24-9630-f0fa2f4d164c\", \"description\": \"Creating a Description\", \"startDate\": \"2020-04-24\", \"endDate\": \"2020-04-26\", \"periods\": [ { \"periodStartDate\": \"2020-04-20\", \"periodEndDate\": \"2020-04-26\", \"numberOfUnits\": 1, \"periodStatus\": \"Approved\" } ] }" + "example" : { + "leaveTypeID" : "ed08dffe-788e-4b24-9630-f0fa2f4d164c", + "description" : "Creating a Description", + "startDate" : "2020-04-24", + "endDate" : "2020-04-26", + "periods" : [ { + "periodStartDate" : "2020-04-20", + "periodEndDate" : "2020-04-26", + "numberOfUnits" : 1, + "periodStatus" : "Approved" + } ] + } } }, "required" : true @@ -14020,7 +14156,14 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/EmployeeOpeningBalances" }, - "example" : "{ \"statutoryAdoptionPay\": 20, \"statutoryMaternityPay\": 20, \"statutoryPaternityPay\": 20, \"statutorySharedParentalPay\": 20, \"statutorySickPay\": 20, \"priorEmployeeNumber\": 20 }" + "example" : { + "statutoryAdoptionPay" : 20, + "statutoryMaternityPay" : 20, + "statutoryPaternityPay" : 20, + "statutorySharedParentalPay" : 20, + "statutorySickPay" : 20, + "priorEmployeeNumber" : 20 + } } }, "required" : true @@ -14239,7 +14382,15 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/SalaryAndWage" }, - "example" : "{ \"earningsRateID\": \"87f5b43a-cf51-4b74-92de-94c819e82d27\", \"numberOfUnitsPerWeek\": 3, \"ratePerUnit\": 11, \"effectiveFrom\": \"2020-05-15\", \"annualSalary\": 101, \"status\": \"ACTIVE\", \"paymentType\": \"Salary\" }" + "example" : { + "earningsRateID" : "87f5b43a-cf51-4b74-92de-94c819e82d27", + "numberOfUnitsPerWeek" : 3, + "ratePerUnit" : 11, + "effectiveFrom" : "2020-05-15", + "annualSalary" : 101, + "status" : "ACTIVE", + "paymentType" : "Salary" + } } }, "required" : true @@ -14430,7 +14581,9 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/PayRun" }, - "example" : "{ \"paymentDate\": \"2020-05-01\" }" + "example" : { + "paymentDate" : "2020-05-01" + } } }, "required" : true @@ -14650,7 +14803,11 @@

Parameters

"schema" : { "$ref" : "#/components/schemas/TimesheetLine" }, - "example" : "{ \"date\": \"2020-04-14\", \"earningsRateID\": \"87f5b43a-cf51-4b74-92de-94c819e82d27\", \"numberOfUnits\": 2 }" + "example" : { + "date" : "2020-04-14", + "earningsRateID" : "87f5b43a-cf51-4b74-92de-94c819e82d27", + "numberOfUnits" : 2 + } } }, "required" : true diff --git a/src/main/java/com/xero/api/client/AccountingApi.java b/src/main/java/com/xero/api/client/AccountingApi.java index e4d8488ea..79d49f7cf 100644 --- a/src/main/java/com/xero/api/client/AccountingApi.java +++ b/src/main/java/com/xero/api/client/AccountingApi.java @@ -15,8 +15,6 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.google.api.client.auth.oauth2.BearerToken; import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.http.ByteArrayContent; -import com.google.api.client.http.FileContent; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpHeaders; @@ -279,144 +277,6 @@ public HttpResponse createAccountForHttpResponse( .execute(); } - // Overload params for createAccountAttachmentByFileName to allow byte[] or File type to be passed - // as body - /** - * Creates an attachment on a specific account - * - *

200 - Success - return response of type Attachments array of Attachment - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param mimeType The type of file being attached - * @param accessToken Authorization token for user set in header of each request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - */ - public Attachments createAccountAttachmentByFileName( - String accessToken, - String xeroTenantId, - UUID accountID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createAccountAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, accountID, fileName, body, idempotencyKey, mimeType); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createAccountAttachmentByFileName -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Creates an attachment on a specific account - * - *

200 - Success - return response of type Attachments array of Attachment - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param mimeType The type of file being attached - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public HttpResponse createAccountAttachmentByFileNameForHttpResponse( - String accessToken, - String xeroTenantId, - UUID accountID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createAccountAttachmentByFileName"); - } // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accountID' when calling" - + " createAccountAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createAccountAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling createAccountAttachmentByFileName"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createAccountAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - ByteArrayContent content = null; - - content = new ByteArrayContent(mimeType, body); - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - /** * Creates an attachment on a specific account * @@ -544,10 +404,10 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(body); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -560,8 +420,6 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( .execute(); } - // Overload params for createBankTransactionAttachmentByFileName to allow byte[] or File type to - // be passed as body /** * Creates an attachment for a specific bank transaction by filename * @@ -575,31 +433,23 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments createBankTransactionAttachmentByFileName( String accessToken, String xeroTenantId, UUID bankTransactionID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createBankTransactionAttachmentByFileNameForHttpResponse( - accessToken, - xeroTenantId, - bankTransactionID, - fileName, - body, - idempotencyKey, - mimeType); + accessToken, xeroTenantId, bankTransactionID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -610,7 +460,18 @@ public Attachments createBankTransactionAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -630,19 +491,17 @@ public Attachments createBankTransactionAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID bankTransactionID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -691,9 +550,9 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -707,42 +566,41 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( } /** - * Creates an attachment for a specific bank transaction by filename + * Creates a history record for a specific bank transactions * - *

200 - Success - return response of Attachments array of Attachment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createBankTransactionAttachmentByFileName( + public HistoryRecords createBankTransactionHistoryRecord( String accessToken, String xeroTenantId, UUID bankTransactionID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createBankTransactionAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, bankTransactionID, fileName, body, idempotencyKey); + createBankTransactionHistoryRecordForHttpResponse( + accessToken, xeroTenantId, bankTransactionID, historyRecords, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createBankTransactionAttachmentByFileName -------------------"); + + " : createBankTransactionHistoryRecord -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -752,9 +610,9 @@ public Attachments createBankTransactionAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("HistoryRecords", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("HistoryRecords", object, e); } else { handler.execute(e); } @@ -765,80 +623,72 @@ public Attachments createBankTransactionAttachmentByFileName( } /** - * Creates an attachment for a specific bank transaction by filename + * Creates a history record for a specific bank transactions * - *

200 - Success - return response of Attachments array of Attachment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( + public HttpResponse createBankTransactionHistoryRecordForHttpResponse( String accessToken, String xeroTenantId, UUID bankTransactionID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " createBankTransactionAttachmentByFileName"); + + " createBankTransactionHistoryRecord"); } // verify the required parameter 'bankTransactionID' is set if (bankTransactionID == null) { throw new IllegalArgumentException( "Missing the required parameter 'bankTransactionID' when calling" - + " createBankTransactionAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createBankTransactionAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + + " createBankTransactionHistoryRecord"); + } // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " createBankTransactionAttachmentByFileName"); + "Missing the required parameter 'historyRecords' when calling" + + " createBankTransactionHistoryRecord"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " createBankTransactionAttachmentByFileName"); + + " createBankTransactionHistoryRecord"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransactionID", bankTransactionID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri( - apiClient.getBasePath() - + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -852,41 +702,46 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse( } /** - * Creates a history record for a specific bank transactions + * Creates one or more spent or received money transaction * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

200 - Success - return response of type BankTransactions array with new + * BankTransaction * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * @param bankTransactions BankTransactions with an array of BankTransaction objects in body of * request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords + * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API * */ - public HistoryRecords createBankTransactionHistoryRecord( + public BankTransactions createBankTransactions( String accessToken, String xeroTenantId, - UUID bankTransactionID, - HistoryRecords historyRecords, + BankTransactions bankTransactions, + Boolean summarizeErrors, + Integer unitdp, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createBankTransactionHistoryRecordForHttpResponse( - accessToken, xeroTenantId, bankTransactionID, historyRecords, idempotencyKey); + createBankTransactionsForHttpResponse( + accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createBankTransactionHistoryRecord -------------------"); + + " : createBankTransactions -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -896,150 +751,9 @@ public HistoryRecords createBankTransactionHistoryRecord( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("HistoryRecords", object.getMessage(), e); + handler.validationError("BankTransactions", object.getMessage(), e); } - handler.validationError("HistoryRecords", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Creates a history record for a specific bank transactions - * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createBankTransactionHistoryRecordForHttpResponse( - String accessToken, - String xeroTenantId, - UUID bankTransactionID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createBankTransactionHistoryRecord"); - } // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'bankTransactionID' when calling" - + " createBankTransactionHistoryRecord"); - } // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'historyRecords' when calling" - + " createBankTransactionHistoryRecord"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createBankTransactionHistoryRecord"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}/History"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Creates one or more spent or received money transaction - * - *

200 - Success - return response of type BankTransactions array with new - * BankTransaction - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactions BankTransactions with an array of BankTransaction objects in body of - * request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public BankTransactions createBankTransactions( - String accessToken, - String xeroTenantId, - BankTransactions bankTransactions, - Boolean summarizeErrors, - Integer unitdp, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createBankTransactionsForHttpResponse( - accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createBankTransactions -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("BankTransactions", object.getMessage(), e); - } - handler.validationError("BankTransactions", object, e); + handler.validationError("BankTransactions", object, e); } else { handler.execute(e); } @@ -1269,8 +983,6 @@ public HttpResponse createBankTransferForHttpResponse( .execute(); } - // Overload params for createBankTransferAttachmentByFileName to allow byte[] or File type to be - // passed as body /** * 200 - Success - return response of Attachments array of 0 to N Attachment for a Bank * Transfer @@ -1283,25 +995,23 @@ public HttpResponse createBankTransferForHttpResponse( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments createBankTransferAttachmentByFileName( String accessToken, String xeroTenantId, UUID bankTransferID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createBankTransferAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey, mimeType); + accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -1312,7 +1022,18 @@ public Attachments createBankTransferAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -1331,19 +1052,17 @@ public Attachments createBankTransferAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID bankTransferID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -1391,9 +1110,9 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -1407,41 +1126,41 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( } /** - * 200 - Success - return response of Attachments array of 0 to N Attachment for a Bank - * Transfer + * Creates a history record for a specific bank transfer + * + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createBankTransferAttachmentByFileName( + public HistoryRecords createBankTransferHistoryRecord( String accessToken, String xeroTenantId, UUID bankTransferID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createBankTransferAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey); + createBankTransferHistoryRecordForHttpResponse( + accessToken, xeroTenantId, bankTransferID, historyRecords, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createBankTransferAttachmentByFileName -------------------"); + + " : createBankTransferHistoryRecord -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -1451,9 +1170,9 @@ public Attachments createBankTransferAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("HistoryRecords", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("HistoryRecords", object, e); } else { handler.execute(e); } @@ -1464,78 +1183,71 @@ public Attachments createBankTransferAttachmentByFileName( } /** - * 200 - Success - return response of Attachments array of 0 to N Attachment for a Bank - * Transfer + * Creates a history record for a specific bank transfer + * + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( + public HttpResponse createBankTransferHistoryRecordForHttpResponse( String accessToken, String xeroTenantId, UUID bankTransferID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " createBankTransferAttachmentByFileName"); + + " createBankTransferHistoryRecord"); } // verify the required parameter 'bankTransferID' is set if (bankTransferID == null) { throw new IllegalArgumentException( "Missing the required parameter 'bankTransferID' when calling" - + " createBankTransferAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createBankTransferAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + + " createBankTransferHistoryRecord"); + } // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " createBankTransferAttachmentByFileName"); + "Missing the required parameter 'historyRecords' when calling" + + " createBankTransferHistoryRecord"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " createBankTransferAttachmentByFileName"); + + " createBankTransferHistoryRecord"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -1549,166 +1261,31 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse( } /** - * Creates a history record for a specific bank transfer + * Creates one or many batch payments for invoices * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

200 - Success - return response of type BatchPayments array of BatchPayment objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request + * @param batchPayments BatchPayments with an array of Payments in body of request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords + * @return BatchPayments * @throws IOException if an error occurs while attempting to invoke the API * */ - public HistoryRecords createBankTransferHistoryRecord( + public BatchPayments createBatchPayment( String accessToken, String xeroTenantId, - UUID bankTransferID, - HistoryRecords historyRecords, + BatchPayments batchPayments, + Boolean summarizeErrors, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createBankTransferHistoryRecordForHttpResponse( - accessToken, xeroTenantId, bankTransferID, historyRecords, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createBankTransferHistoryRecord -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("HistoryRecords", object.getMessage(), e); - } - handler.validationError("HistoryRecords", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Creates a history record for a specific bank transfer - * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createBankTransferHistoryRecordForHttpResponse( - String accessToken, - String xeroTenantId, - UUID bankTransferID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createBankTransferHistoryRecord"); - } // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'bankTransferID' when calling" - + " createBankTransferHistoryRecord"); - } // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'historyRecords' when calling" - + " createBankTransferHistoryRecord"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createBankTransferHistoryRecord"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/History"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Creates one or many batch payments for invoices - * - *

200 - Success - return response of type BatchPayments array of BatchPayment objects - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param batchPayments BatchPayments with an array of Payments in body of request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return BatchPayments - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public BatchPayments createBatchPayment( - String accessToken, - String xeroTenantId, - BatchPayments batchPayments, - Boolean summarizeErrors, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = createBatchPaymentForHttpResponse( accessToken, xeroTenantId, batchPayments, summarizeErrors, idempotencyKey); @@ -2096,8 +1673,6 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( .execute(); } - // Overload params for createContactAttachmentByFileName to allow byte[] or File type to be passed - // as body /** * 200 - Success - return response of type Attachments array with an newly created * Attachment @@ -2110,25 +1685,23 @@ public HttpResponse createBrandingThemePaymentServicesForHttpResponse( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments createContactAttachmentByFileName( String accessToken, String xeroTenantId, UUID contactID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createContactAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey, mimeType); + accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -2139,7 +1712,18 @@ public Attachments createContactAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -2158,19 +1742,17 @@ public Attachments createContactAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createContactAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID contactID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -2217,9 +1799,9 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -2233,41 +1815,36 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( } /** - * 200 - Success - return response of type Attachments array with an newly created - * Attachment + * Creates a contact group * - *

400 - A failed request due to validation error + *

200 - Success - return response of type Contact Groups array of newly created Contact + * Group + * + *

400 - Validation Error - some data was incorrect returns response of type Error * * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param contactGroups ContactGroups with an array of names in request body * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createContactAttachmentByFileName( - String accessToken, - String xeroTenantId, - UUID contactID, - String fileName, - File body, - String idempotencyKey) + public ContactGroups createContactGroup( + String accessToken, String xeroTenantId, ContactGroups contactGroups, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createContactAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey); + createContactGroupForHttpResponse( + accessToken, xeroTenantId, contactGroups, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createContactAttachmentByFileName -------------------"); + + " : createContactGroup -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -2277,9 +1854,9 @@ public Attachments createContactAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("ContactGroups", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("ContactGroups", object, e); } else { handler.execute(e); } @@ -2290,77 +1867,53 @@ public Attachments createContactAttachmentByFileName( } /** - * 200 - Success - return response of type Attachments array with an newly created - * Attachment + * Creates a contact group * - *

400 - A failed request due to validation error + *

200 - Success - return response of type Contact Groups array of newly created Contact + * Group + * + *

400 - Validation Error - some data was incorrect returns response of type Error * * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param contactGroups ContactGroups with an array of names in request body * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createContactAttachmentByFileNameForHttpResponse( - String accessToken, - String xeroTenantId, - UUID contactID, - String fileName, - File body, - String idempotencyKey) + public HttpResponse createContactGroupForHttpResponse( + String accessToken, String xeroTenantId, ContactGroups contactGroups, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createContactAttachmentByFileName"); - } // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'contactID' when calling" - + " createContactAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createContactAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'xeroTenantId' when calling createContactGroup"); + } // verify the required parameter 'contactGroups' is set + if (contactGroups == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling createContactAttachmentByFileName"); + "Missing the required parameter 'contactGroups' when calling createContactGroup"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createContactAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling createContactGroup"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(contactGroups); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -2374,121 +1927,9 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse( } /** - * Creates a contact group + * Creates contacts to a specific contact group * - *

200 - Success - return response of type Contact Groups array of newly created Contact - * Group - * - *

400 - Validation Error - some data was incorrect returns response of type Error - * - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroups ContactGroups with an array of names in request body - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return ContactGroups - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public ContactGroups createContactGroup( - String accessToken, String xeroTenantId, ContactGroups contactGroups, String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createContactGroupForHttpResponse( - accessToken, xeroTenantId, contactGroups, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createContactGroup -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("ContactGroups", object.getMessage(), e); - } - handler.validationError("ContactGroups", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Creates a contact group - * - *

200 - Success - return response of type Contact Groups array of newly created Contact - * Group - * - *

400 - Validation Error - some data was incorrect returns response of type Error - * - * @param xeroTenantId Xero identifier for Tenant - * @param contactGroups ContactGroups with an array of names in request body - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createContactGroupForHttpResponse( - String accessToken, String xeroTenantId, ContactGroups contactGroups, String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling createContactGroup"); - } // verify the required parameter 'contactGroups' is set - if (contactGroups == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'contactGroups' when calling createContactGroup"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling createContactGroup"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups"); - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contactGroups); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Creates contacts to a specific contact group - * - *

200 - Success - return response of type Contacts array of added Contacts + *

200 - Success - return response of type Contacts array of added Contacts * *

400 - A failed request due to validation error * @@ -3052,8 +2493,6 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( .execute(); } - // Overload params for createCreditNoteAttachmentByFileName to allow byte[] or File type to be - // passed as body /** * Creates an attachment for a specific credit note * @@ -3070,20 +2509,18 @@ public HttpResponse createCreditNoteAllocationForHttpResponse( * invoice * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments createCreditNoteAttachmentByFileName( String accessToken, String xeroTenantId, UUID creditNoteID, String fileName, - byte[] body, + File body, Boolean includeOnline, - String idempotencyKey, - String mimeType) + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; @@ -3095,8 +2532,7 @@ public Attachments createCreditNoteAttachmentByFileName( fileName, body, includeOnline, - idempotencyKey, - mimeType); + idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -3107,7 +2543,18 @@ public Attachments createCreditNoteAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -3130,20 +2577,18 @@ public Attachments createCreditNoteAttachmentByFileName( * invoice * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID creditNoteID, String fileName, - byte[] body, + File body, Boolean includeOnline, - String idempotencyKey, - String mimeType) + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -3211,9 +2656,9 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -3227,52 +2672,41 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( } /** - * Creates an attachment for a specific credit note + * Retrieves history records of a specific credit note * - *

200 - Success - return response of type Attachments array with newly created - * Attachment for specific Credit Note + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param includeOnline Allows an attachment to be seen by the end customer within their online - * invoice + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createCreditNoteAttachmentByFileName( + public HistoryRecords createCreditNoteHistory( String accessToken, String xeroTenantId, UUID creditNoteID, - String fileName, - File body, - Boolean includeOnline, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createCreditNoteAttachmentByFileNameForHttpResponse( - accessToken, - xeroTenantId, - creditNoteID, - fileName, - body, - includeOnline, - idempotencyKey); + createCreditNoteHistoryForHttpResponse( + accessToken, xeroTenantId, creditNoteID, historyRecords, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createCreditNoteAttachmentByFileName -------------------"); + + " : createCreditNoteHistory -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -3282,9 +2716,9 @@ public Attachments createCreditNoteAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("HistoryRecords", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("HistoryRecords", object, e); } else { handler.execute(e); } @@ -3295,103 +2729,67 @@ public Attachments createCreditNoteAttachmentByFileName( } /** - * Creates an attachment for a specific credit note + * Retrieves history records of a specific credit note * - *

200 - Success - return response of type Attachments array with newly created - * Attachment for specific Credit Note + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param includeOnline Allows an attachment to be seen by the end customer within their online - * invoice + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( + public HttpResponse createCreditNoteHistoryForHttpResponse( String accessToken, String xeroTenantId, UUID creditNoteID, - String fileName, - File body, - Boolean includeOnline, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createCreditNoteAttachmentByFileName"); + "Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); } // verify the required parameter 'creditNoteID' is set if (creditNoteID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'creditNoteID' when calling" - + " createCreditNoteAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createCreditNoteAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); + } // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " createCreditNoteAttachmentByFileName"); + "Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createCreditNoteAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling createCreditNoteHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); - if (includeOnline != null) { - String key = "IncludeOnline"; - Object value = includeOnline; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } + UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -3405,157 +2803,26 @@ public HttpResponse createCreditNoteAttachmentByFileNameForHttpResponse( } /** - * Retrieves history records of a specific credit note + * Creates a new credit note * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

200 - Success - return response of type Credit Notes array of newly created + * CreditNote * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request + * @param creditNotes Credit Notes with array of CreditNote object in body of request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords + * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API * */ - public HistoryRecords createCreditNoteHistory( - String accessToken, - String xeroTenantId, - UUID creditNoteID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createCreditNoteHistoryForHttpResponse( - accessToken, xeroTenantId, creditNoteID, historyRecords, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createCreditNoteHistory -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("HistoryRecords", object.getMessage(), e); - } - handler.validationError("HistoryRecords", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Retrieves history records of a specific credit note - * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createCreditNoteHistoryForHttpResponse( - String accessToken, - String xeroTenantId, - UUID creditNoteID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling createCreditNoteHistory"); - } // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'creditNoteID' when calling createCreditNoteHistory"); - } // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'historyRecords' when calling createCreditNoteHistory"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling createCreditNoteHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/History"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Creates a new credit note - * - *

200 - Success - return response of type Credit Notes array of newly created - * CreditNote - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param creditNotes Credit Notes with array of CreditNote object in body of request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public CreditNotes createCreditNotes( + public CreditNotes createCreditNotes( String accessToken, String xeroTenantId, CreditNotes creditNotes, @@ -4193,8 +3460,6 @@ public HttpResponse createExpenseClaimsForHttpResponse( .execute(); } - // Overload params for createInvoiceAttachmentByFileName to allow byte[] or File type to be passed - // as body /** * Creates an attachment for a specific invoice or purchase bill by filename * @@ -4211,33 +3476,24 @@ public HttpResponse createExpenseClaimsForHttpResponse( * invoice * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments createInvoiceAttachmentByFileName( String accessToken, String xeroTenantId, UUID invoiceID, String fileName, - byte[] body, + File body, Boolean includeOnline, - String idempotencyKey, - String mimeType) + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createInvoiceAttachmentByFileNameForHttpResponse( - accessToken, - xeroTenantId, - invoiceID, - fileName, - body, - includeOnline, - idempotencyKey, - mimeType); + accessToken, xeroTenantId, invoiceID, fileName, body, includeOnline, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -4248,7 +3504,18 @@ public Attachments createInvoiceAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -4271,20 +3538,18 @@ public Attachments createInvoiceAttachmentByFileName( * invoice * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID invoiceID, String fileName, - byte[] body, + File body, Boolean includeOnline, - String idempotencyKey, - String mimeType) + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -4351,9 +3616,9 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -4367,46 +3632,41 @@ public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( } /** - * Creates an attachment for a specific invoice or purchase bill by filename + * Creates a history record for a specific invoice * - *

200 - Success - return response of type Attachments array with newly created - * Attachment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param includeOnline Allows an attachment to be seen by the end customer within their online - * invoice + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createInvoiceAttachmentByFileName( + public HistoryRecords createInvoiceHistory( String accessToken, String xeroTenantId, UUID invoiceID, - String fileName, - File body, - Boolean includeOnline, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createInvoiceAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, invoiceID, fileName, body, includeOnline, idempotencyKey); + createInvoiceHistoryForHttpResponse( + accessToken, xeroTenantId, invoiceID, historyRecords, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createInvoiceAttachmentByFileName -------------------"); + + " : createInvoiceHistory -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -4416,9 +3676,9 @@ public Attachments createInvoiceAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("HistoryRecords", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("HistoryRecords", object, e); } else { handler.execute(e); } @@ -4429,230 +3689,64 @@ public Attachments createInvoiceAttachmentByFileName( } /** - * Creates an attachment for a specific invoice or purchase bill by filename + * Creates a history record for a specific invoice * - *

200 - Success - return response of type Attachments array with newly created - * Attachment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param includeOnline Allows an attachment to be seen by the end customer within their online - * invoice + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createInvoiceAttachmentByFileNameForHttpResponse( + public HttpResponse createInvoiceHistoryForHttpResponse( String accessToken, String xeroTenantId, UUID invoiceID, - String fileName, - File body, - Boolean includeOnline, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createInvoiceAttachmentByFileName"); + "Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); } // verify the required parameter 'invoiceID' is set if (invoiceID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'invoiceID' when calling" - + " createInvoiceAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createInvoiceAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); + } // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling createInvoiceAttachmentByFileName"); + "Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createInvoiceAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling createInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - if (includeOnline != null) { - String key = "IncludeOnline"; - Object value = includeOnline; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } + UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Creates a history record for a specific invoice - * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public HistoryRecords createInvoiceHistory( - String accessToken, - String xeroTenantId, - UUID invoiceID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createInvoiceHistoryForHttpResponse( - accessToken, xeroTenantId, invoiceID, historyRecords, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createInvoiceHistory -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("HistoryRecords", object.getMessage(), e); - } - handler.validationError("HistoryRecords", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Creates a history record for a specific invoice - * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createInvoiceHistoryForHttpResponse( - String accessToken, - String xeroTenantId, - UUID invoiceID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling createInvoiceHistory"); - } // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'invoiceID' when calling createInvoiceHistory"); - } // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'historyRecords' when calling createInvoiceHistory"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling createInvoiceHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}/History"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - + HttpContent content = null; content = apiClient.new JacksonJsonHttpContent(historyRecords); @@ -5249,8 +4343,6 @@ public HttpResponse createLinkedTransactionForHttpResponse( .execute(); } - // Overload params for createManualJournalAttachmentByFileName to allow byte[] or File type to be - // passed as body /** * Creates a specific attachment for a specific manual journal by file name * @@ -5265,25 +4357,23 @@ public HttpResponse createLinkedTransactionForHttpResponse( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments createManualJournalAttachmentByFileName( String accessToken, String xeroTenantId, UUID manualJournalID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createManualJournalAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey, mimeType); + accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -5294,7 +4384,18 @@ public Attachments createManualJournalAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -5315,19 +4416,17 @@ public Attachments createManualJournalAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID manualJournalID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -5375,9 +4474,9 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -5391,43 +4490,41 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( } /** - * Creates a specific attachment for a specific manual journal by file name + * Creates a history record for a specific manual journal * - *

200 - Success - return response of type Attachments array with a newly created - * Attachment for a ManualJournals + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createManualJournalAttachmentByFileName( + public HistoryRecords createManualJournalHistoryRecord( String accessToken, String xeroTenantId, UUID manualJournalID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createManualJournalAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey); + createManualJournalHistoryRecordForHttpResponse( + accessToken, xeroTenantId, manualJournalID, historyRecords, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createManualJournalAttachmentByFileName -------------------"); + + " : createManualJournalHistoryRecord -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -5437,9 +4534,9 @@ public Attachments createManualJournalAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("HistoryRecords", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("HistoryRecords", object, e); } else { handler.execute(e); } @@ -5450,80 +4547,71 @@ public Attachments createManualJournalAttachmentByFileName( } /** - * Creates a specific attachment for a specific manual journal by file name + * Creates a history record for a specific manual journal * - *

200 - Success - return response of type Attachments array with a newly created - * Attachment for a ManualJournals + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( + public HttpResponse createManualJournalHistoryRecordForHttpResponse( String accessToken, String xeroTenantId, UUID manualJournalID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " createManualJournalAttachmentByFileName"); + + " createManualJournalHistoryRecord"); } // verify the required parameter 'manualJournalID' is set if (manualJournalID == null) { throw new IllegalArgumentException( "Missing the required parameter 'manualJournalID' when calling" - + " createManualJournalAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createManualJournalAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + + " createManualJournalHistoryRecord"); + } // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " createManualJournalAttachmentByFileName"); + "Missing the required parameter 'historyRecords' when calling" + + " createManualJournalHistoryRecord"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " createManualJournalAttachmentByFileName"); + + " createManualJournalHistoryRecord"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); + UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/History"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -5537,41 +4625,42 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse( } /** - * Creates a history record for a specific manual journal + * Creates one or more manual journals * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

200 - Success - return response of type ManualJournals array with newly created + * ManualJournal * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request + * @param manualJournals ManualJournals array with ManualJournal object in body of request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords + * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API * */ - public HistoryRecords createManualJournalHistoryRecord( + public ManualJournals createManualJournals( String accessToken, String xeroTenantId, - UUID manualJournalID, - HistoryRecords historyRecords, + ManualJournals manualJournals, + Boolean summarizeErrors, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createManualJournalHistoryRecordForHttpResponse( - accessToken, xeroTenantId, manualJournalID, historyRecords, idempotencyKey); + createManualJournalsForHttpResponse( + accessToken, xeroTenantId, manualJournals, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createManualJournalHistoryRecord -------------------"); + + " : createManualJournals -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -5581,9 +4670,9 @@ public HistoryRecords createManualJournalHistoryRecord( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("HistoryRecords", object.getMessage(), e); + handler.validationError("ManualJournals", object.getMessage(), e); } - handler.validationError("HistoryRecords", object, e); + handler.validationError("ManualJournals", object, e); } else { handler.execute(e); } @@ -5594,143 +4683,7 @@ public HistoryRecords createManualJournalHistoryRecord( } /** - * Creates a history record for a specific manual journal - * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createManualJournalHistoryRecordForHttpResponse( - String accessToken, - String xeroTenantId, - UUID manualJournalID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createManualJournalHistoryRecord"); - } // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'manualJournalID' when calling" - + " createManualJournalHistoryRecord"); - } // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'historyRecords' when calling" - + " createManualJournalHistoryRecord"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createManualJournalHistoryRecord"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/History"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Creates one or more manual journals - * - *

200 - Success - return response of type ManualJournals array with newly created - * ManualJournal - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournals ManualJournals array with ManualJournal object in body of request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public ManualJournals createManualJournals( - String accessToken, - String xeroTenantId, - ManualJournals manualJournals, - Boolean summarizeErrors, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createManualJournalsForHttpResponse( - accessToken, xeroTenantId, manualJournals, summarizeErrors, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createManualJournals -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("ManualJournals", object.getMessage(), e); - } - handler.validationError("ManualJournals", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Creates one or more manual journals + * Creates one or more manual journals * *

200 - Success - return response of type ManualJournals array with newly created * ManualJournal @@ -6909,8 +5862,6 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( .execute(); } - // Overload params for createPurchaseOrderAttachmentByFileName to allow byte[] or File type to be - // passed as body /** * Creates attachment for a specific purchase order * @@ -6924,25 +5875,23 @@ public HttpResponse createPrepaymentHistoryForHttpResponse( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments createPurchaseOrderAttachmentByFileName( String accessToken, String xeroTenantId, UUID purchaseOrderID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createPurchaseOrderAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey, mimeType); + accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -6953,7 +5902,18 @@ public Attachments createPurchaseOrderAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -6973,19 +5933,17 @@ public Attachments createPurchaseOrderAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createPurchaseOrderAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID purchaseOrderID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -7033,9 +5991,9 @@ public HttpResponse createPurchaseOrderAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -7049,42 +6007,41 @@ public HttpResponse createPurchaseOrderAttachmentByFileNameForHttpResponse( } /** - * Creates attachment for a specific purchase order + * Creates a history record for a specific purchase orders * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for an Purchase Order - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createPurchaseOrderAttachmentByFileName( + public HistoryRecords createPurchaseOrderHistory( String accessToken, String xeroTenantId, UUID purchaseOrderID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createPurchaseOrderAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey); + createPurchaseOrderHistoryForHttpResponse( + accessToken, xeroTenantId, purchaseOrderID, historyRecords, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createPurchaseOrderAttachmentByFileName -------------------"); + + " : createPurchaseOrderHistory -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -7094,9 +6051,9 @@ public Attachments createPurchaseOrderAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("HistoryRecords", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("HistoryRecords", object, e); } else { handler.execute(e); } @@ -7107,79 +6064,69 @@ public Attachments createPurchaseOrderAttachmentByFileName( } /** - * Creates attachment for a specific purchase order + * Creates a history record for a specific purchase orders * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param purchaseOrderID Unique identifier for an Purchase Order - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createPurchaseOrderAttachmentByFileNameForHttpResponse( + public HttpResponse createPurchaseOrderHistoryForHttpResponse( String accessToken, String xeroTenantId, UUID purchaseOrderID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createPurchaseOrderAttachmentByFileName"); + "Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); } // verify the required parameter 'purchaseOrderID' is set if (purchaseOrderID == null) { throw new IllegalArgumentException( "Missing the required parameter 'purchaseOrderID' when calling" - + " createPurchaseOrderAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createPurchaseOrderAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + + " createPurchaseOrderHistory"); + } // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " createPurchaseOrderAttachmentByFileName"); + "Missing the required parameter 'historyRecords' when calling" + + " createPurchaseOrderHistory"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createPurchaseOrderAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling createPurchaseOrderHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("PurchaseOrderID", purchaseOrderID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"); + UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -7193,41 +6140,42 @@ public HttpResponse createPurchaseOrderAttachmentByFileNameForHttpResponse( } /** - * Creates a history record for a specific purchase orders + * Creates one or more purchase orders * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

200 - Success - return response of type PurchaseOrder array for specified + * PurchaseOrder * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request + * @param purchaseOrders PurchaseOrders with an array of PurchaseOrder object in body of request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords + * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API * */ - public HistoryRecords createPurchaseOrderHistory( + public PurchaseOrders createPurchaseOrders( String accessToken, String xeroTenantId, - UUID purchaseOrderID, - HistoryRecords historyRecords, + PurchaseOrders purchaseOrders, + Boolean summarizeErrors, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createPurchaseOrderHistoryForHttpResponse( - accessToken, xeroTenantId, purchaseOrderID, historyRecords, idempotencyKey); + createPurchaseOrdersForHttpResponse( + accessToken, xeroTenantId, purchaseOrders, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createPurchaseOrderHistory -------------------"); + + " : createPurchaseOrders -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -7237,141 +6185,7 @@ public HistoryRecords createPurchaseOrderHistory( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("HistoryRecords", object.getMessage(), e); - } - handler.validationError("HistoryRecords", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Creates a history record for a specific purchase orders - * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createPurchaseOrderHistoryForHttpResponse( - String accessToken, - String xeroTenantId, - UUID purchaseOrderID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling createPurchaseOrderHistory"); - } // verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'purchaseOrderID' when calling" - + " createPurchaseOrderHistory"); - } // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'historyRecords' when calling" - + " createPurchaseOrderHistory"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling createPurchaseOrderHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/History"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Creates one or more purchase orders - * - *

200 - Success - return response of type PurchaseOrder array for specified - * PurchaseOrder - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrders PurchaseOrders with an array of PurchaseOrder object in body of request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return PurchaseOrders - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public PurchaseOrders createPurchaseOrders( - String accessToken, - String xeroTenantId, - PurchaseOrders purchaseOrders, - Boolean summarizeErrors, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createPurchaseOrdersForHttpResponse( - accessToken, xeroTenantId, purchaseOrders, summarizeErrors, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createPurchaseOrders -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("PurchaseOrders", object.getMessage(), e); + handler.validationError("PurchaseOrders", object.getMessage(), e); } handler.validationError("PurchaseOrders", object, e); } else { @@ -7469,8 +6283,6 @@ public HttpResponse createPurchaseOrdersForHttpResponse( .execute(); } - // Overload params for createQuoteAttachmentByFileName to allow byte[] or File type to be passed - // as body /** * Creates attachment for a specific quote * @@ -7484,25 +6296,23 @@ public HttpResponse createPurchaseOrdersForHttpResponse( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments createQuoteAttachmentByFileName( String accessToken, String xeroTenantId, UUID quoteID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createQuoteAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey, mimeType); + accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -7513,7 +6323,18 @@ public Attachments createQuoteAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -7533,19 +6354,17 @@ public Attachments createQuoteAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createQuoteAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID quoteID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -7589,9 +6408,9 @@ public HttpResponse createQuoteAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -7605,42 +6424,41 @@ public HttpResponse createQuoteAttachmentByFileNameForHttpResponse( } /** - * Creates attachment for a specific quote + * Creates a history record for a specific quote * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param quoteID Unique identifier for an Quote - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createQuoteAttachmentByFileName( + public HistoryRecords createQuoteHistory( String accessToken, String xeroTenantId, UUID quoteID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createQuoteAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey); + createQuoteHistoryForHttpResponse( + accessToken, xeroTenantId, quoteID, historyRecords, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createQuoteAttachmentByFileName -------------------"); + + " : createQuoteHistory -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -7650,9 +6468,9 @@ public Attachments createQuoteAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("HistoryRecords", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("HistoryRecords", object, e); } else { handler.execute(e); } @@ -7663,75 +6481,67 @@ public Attachments createQuoteAttachmentByFileName( } /** - * Creates attachment for a specific quote + * Creates a history record for a specific quote * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param quoteID Unique identifier for an Quote - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createQuoteAttachmentByFileNameForHttpResponse( + public HttpResponse createQuoteHistoryForHttpResponse( String accessToken, String xeroTenantId, UUID quoteID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createQuoteAttachmentByFileName"); + "Missing the required parameter 'xeroTenantId' when calling createQuoteHistory"); } // verify the required parameter 'quoteID' is set if (quoteID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'quoteID' when calling createQuoteAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling createQuoteAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'quoteID' when calling createQuoteHistory"); + } // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling createQuoteAttachmentByFileName"); + "Missing the required parameter 'historyRecords' when calling createQuoteHistory"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createQuoteAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling createQuoteHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("QuoteID", quoteID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes/{QuoteID}/Attachments/{FileName}"); + UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes/{QuoteID}/History"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -7745,41 +6555,41 @@ public HttpResponse createQuoteAttachmentByFileNameForHttpResponse( } /** - * Creates a history record for a specific quote + * Create one or more quotes * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

200 - Success - return response of type Quotes with array with newly created Quote * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param quoteID Unique identifier for an Quote - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request + * @param quotes Quotes with an array of Quote object in body of request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords + * @return Quotes * @throws IOException if an error occurs while attempting to invoke the API * */ - public HistoryRecords createQuoteHistory( + public Quotes createQuotes( String accessToken, String xeroTenantId, - UUID quoteID, - HistoryRecords historyRecords, + Quotes quotes, + Boolean summarizeErrors, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createQuoteHistoryForHttpResponse( - accessToken, xeroTenantId, quoteID, historyRecords, idempotencyKey); + createQuotesForHttpResponse( + accessToken, xeroTenantId, quotes, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createQuoteHistory -------------------"); + + " : createQuotes -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -7789,9 +6599,9 @@ public HistoryRecords createQuoteHistory( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("HistoryRecords", object.getMessage(), e); + handler.validationError("Quotes", object.getMessage(), e); } - handler.validationError("HistoryRecords", object, e); + handler.validationError("Quotes", object, e); } else { handler.execute(e); } @@ -7802,138 +6612,7 @@ public HistoryRecords createQuoteHistory( } /** - * Creates a history record for a specific quote - * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param quoteID Unique identifier for an Quote - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createQuoteHistoryForHttpResponse( - String accessToken, - String xeroTenantId, - UUID quoteID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling createQuoteHistory"); - } // verify the required parameter 'quoteID' is set - if (quoteID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'quoteID' when calling createQuoteHistory"); - } // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'historyRecords' when calling createQuoteHistory"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling createQuoteHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("QuoteID", quoteID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes/{QuoteID}/History"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Create one or more quotes - * - *

200 - Success - return response of type Quotes with array with newly created Quote - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param quotes Quotes with an array of Quote object in body of request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return Quotes - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public Quotes createQuotes( - String accessToken, - String xeroTenantId, - Quotes quotes, - Boolean summarizeErrors, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createQuotesForHttpResponse( - accessToken, xeroTenantId, quotes, summarizeErrors, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createQuotes -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Quotes", object.getMessage(), e); - } - handler.validationError("Quotes", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Create one or more quotes + * Create one or more quotes * *

200 - Success - return response of type Quotes with array with newly created Quote * @@ -8158,8 +6837,6 @@ public HttpResponse createReceiptForHttpResponse( .execute(); } - // Overload params for createReceiptAttachmentByFileName to allow byte[] or File type to be passed - // as body /** * Creates an attachment on a specific expense claim receipts by file name * @@ -8174,25 +6851,23 @@ public HttpResponse createReceiptForHttpResponse( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments createReceiptAttachmentByFileName( String accessToken, String xeroTenantId, UUID receiptID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createReceiptAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, receiptID, fileName, body, idempotencyKey, mimeType); + accessToken, xeroTenantId, receiptID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -8203,7 +6878,18 @@ public Attachments createReceiptAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -8224,19 +6910,17 @@ public Attachments createReceiptAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID receiptID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -8283,9 +6967,9 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -8299,43 +6983,42 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( } /** - * Creates an attachment on a specific expense claim receipts by file name + * Creates a history record for a specific receipt * - *

200 - Success - return response of type Attachments array with newly created - * Attachment for a specified Receipt + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * - *

400 - A failed request due to validation error + *

400 - Unsupported - return response incorrect exception, API is not able to create + * HistoryRecord for Receipts * * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createReceiptAttachmentByFileName( + public HistoryRecords createReceiptHistory( String accessToken, String xeroTenantId, UUID receiptID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createReceiptAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, receiptID, fileName, body, idempotencyKey); + createReceiptHistoryForHttpResponse( + accessToken, xeroTenantId, receiptID, historyRecords, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createReceiptAttachmentByFileName -------------------"); + + " : createReceiptHistory -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -8345,9 +7028,9 @@ public Attachments createReceiptAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("HistoryRecords", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("HistoryRecords", object, e); } else { handler.execute(e); } @@ -8358,79 +7041,68 @@ public Attachments createReceiptAttachmentByFileName( } /** - * Creates an attachment on a specific expense claim receipts by file name + * Creates a history record for a specific receipt * - *

200 - Success - return response of type Attachments array with newly created - * Attachment for a specified Receipt + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * - *

400 - A failed request due to validation error + *

400 - Unsupported - return response incorrect exception, API is not able to create + * HistoryRecord for Receipts * * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( + public HttpResponse createReceiptHistoryForHttpResponse( String accessToken, String xeroTenantId, UUID receiptID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createReceiptAttachmentByFileName"); + "Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); } // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'receiptID' when calling" - + " createReceiptAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createReceiptAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'receiptID' when calling createReceiptHistory"); + } // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling createReceiptAttachmentByFileName"); + "Missing the required parameter 'historyRecords' when calling createReceiptHistory"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createReceiptAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling createReceiptHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -8444,42 +7116,43 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse( } /** - * Creates a history record for a specific receipt + * Creates an attachment from a specific repeating invoices by file name * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

200 - Success - return response of type Attachments array with updated Attachment for + * a specified Repeating Invoice * - *

400 - Unsupported - return response incorrect exception, API is not able to create - * HistoryRecord for Receipts + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request + * @param repeatingInvoiceID Unique identifier for a Repeating Invoice + * @param fileName Name of the attachment + * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords + * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API * */ - public HistoryRecords createReceiptHistory( + public Attachments createRepeatingInvoiceAttachmentByFileName( String accessToken, String xeroTenantId, - UUID receiptID, - HistoryRecords historyRecords, + UUID repeatingInvoiceID, + String fileName, + File body, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createReceiptHistoryForHttpResponse( - accessToken, xeroTenantId, receiptID, historyRecords, idempotencyKey); + createRepeatingInvoiceAttachmentByFileNameForHttpResponse( + accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createReceiptHistory -------------------"); + + " : createRepeatingInvoiceAttachmentByFileName -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -8489,9 +7162,9 @@ public HistoryRecords createReceiptHistory( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("HistoryRecords", object.getMessage(), e); + handler.validationError("Attachments", object.getMessage(), e); } - handler.validationError("HistoryRecords", object, e); + handler.validationError("Attachments", object, e); } else { handler.execute(e); } @@ -8501,139 +7174,6 @@ public HistoryRecords createReceiptHistory( return null; } - /** - * Creates a history record for a specific receipt - * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects - * - *

400 - Unsupported - return response incorrect exception, API is not able to create - * HistoryRecord for Receipts - * - * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createReceiptHistoryForHttpResponse( - String accessToken, - String xeroTenantId, - UUID receiptID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling createReceiptHistory"); - } // verify the required parameter 'receiptID' is set - if (receiptID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'receiptID' when calling createReceiptHistory"); - } // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'historyRecords' when calling createReceiptHistory"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling createReceiptHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}/History"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - // Overload params for createRepeatingInvoiceAttachmentByFileName to allow byte[] or File type to - // be passed as body - /** - * Creates an attachment from a specific repeating invoices by file name - * - *

200 - Success - return response of type Attachments array with updated Attachment for - * a specified Repeating Invoice - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param mimeType The type of file being attached - * @param accessToken Authorization token for user set in header of each request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - */ - public Attachments createRepeatingInvoiceAttachmentByFileName( - String accessToken, - String xeroTenantId, - UUID repeatingInvoiceID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createRepeatingInvoiceAttachmentByFileNameForHttpResponse( - accessToken, - xeroTenantId, - repeatingInvoiceID, - fileName, - body, - idempotencyKey, - mimeType); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createRepeatingInvoiceAttachmentByFileName -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); - } catch (IOException ioe) { - throw ioe; - } - return null; - } - /** * Creates an attachment from a specific repeating invoices by file name * @@ -8648,19 +7188,17 @@ public Attachments createRepeatingInvoiceAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID repeatingInvoiceID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -8709,9 +7247,9 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( logger.debug("PUT " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -8725,43 +7263,41 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( } /** - * Creates an attachment from a specific repeating invoices by file name + * Creates a history record for a specific repeating invoice * - *

200 - Success - return response of type Attachments array with updated Attachment for - * a specified Repeating Invoice + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return HistoryRecords * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments createRepeatingInvoiceAttachmentByFileName( + public HistoryRecords createRepeatingInvoiceHistory( String accessToken, String xeroTenantId, UUID repeatingInvoiceID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createRepeatingInvoiceAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, idempotencyKey); + createRepeatingInvoiceHistoryForHttpResponse( + accessToken, xeroTenantId, repeatingInvoiceID, historyRecords, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createRepeatingInvoiceAttachmentByFileName -------------------"); + + " : createRepeatingInvoiceHistory -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -8771,9 +7307,9 @@ public Attachments createRepeatingInvoiceAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("HistoryRecords", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("HistoryRecords", object, e); } else { handler.execute(e); } @@ -8784,81 +7320,72 @@ public Attachments createRepeatingInvoiceAttachmentByFileName( } /** - * Creates an attachment from a specific repeating invoices by file name + * Creates a history record for a specific repeating invoice * - *

200 - Success - return response of type Attachments array with updated Attachment for - * a specified Repeating Invoice + *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of + * request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( + public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( String accessToken, String xeroTenantId, UUID repeatingInvoiceID, - String fileName, - File body, + HistoryRecords historyRecords, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " createRepeatingInvoiceAttachmentByFileName"); + + " createRepeatingInvoiceHistory"); } // verify the required parameter 'repeatingInvoiceID' is set if (repeatingInvoiceID == null) { throw new IllegalArgumentException( "Missing the required parameter 'repeatingInvoiceID' when calling" - + " createRepeatingInvoiceAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " createRepeatingInvoiceAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + + " createRepeatingInvoiceHistory"); + } // verify the required parameter 'historyRecords' is set + if (historyRecords == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " createRepeatingInvoiceAttachmentByFileName"); + "Missing the required parameter 'historyRecords' when calling" + + " createRepeatingInvoiceHistory"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " createRepeatingInvoiceAttachmentByFileName"); + + " createRepeatingInvoiceHistory"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri( - apiClient.getBasePath() - + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); + apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(historyRecords); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -8872,41 +7399,43 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse( } /** - * Creates a history record for a specific repeating invoice + * Creates one or more repeating invoice templates * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

200 - Success - return response of type RepeatingInvoices array with newly created + * RepeatingInvoice * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request + * @param repeatingInvoices RepeatingInvoices with an array of repeating invoice objects in body + * of request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return HistoryRecords + * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API * */ - public HistoryRecords createRepeatingInvoiceHistory( + public RepeatingInvoices createRepeatingInvoices( String accessToken, String xeroTenantId, - UUID repeatingInvoiceID, - HistoryRecords historyRecords, + RepeatingInvoices repeatingInvoices, + Boolean summarizeErrors, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - createRepeatingInvoiceHistoryForHttpResponse( - accessToken, xeroTenantId, repeatingInvoiceID, historyRecords, idempotencyKey); + createRepeatingInvoicesForHttpResponse( + accessToken, xeroTenantId, repeatingInvoices, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : createRepeatingInvoiceHistory -------------------"); + + " : createRepeatingInvoices -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -8916,9 +7445,9 @@ public HistoryRecords createRepeatingInvoiceHistory( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("HistoryRecords", object.getMessage(), e); + handler.validationError("RepeatingInvoices", object.getMessage(), e); } - handler.validationError("HistoryRecords", object, e); + handler.validationError("RepeatingInvoices", object, e); } else { handler.execute(e); } @@ -8929,163 +7458,25 @@ public HistoryRecords createRepeatingInvoiceHistory( } /** - * Creates a history record for a specific repeating invoice + * Creates one or more repeating invoice templates * - *

200 - Success - return response of type HistoryRecords array of HistoryRecord objects + *

200 - Success - return response of type RepeatingInvoices array with newly created + * RepeatingInvoice * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param historyRecords HistoryRecords containing an array of HistoryRecord objects in body of - * request + * @param repeatingInvoices RepeatingInvoices with an array of repeating invoice objects in body + * of request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse createRepeatingInvoiceHistoryForHttpResponse( - String accessToken, - String xeroTenantId, - UUID repeatingInvoiceID, - HistoryRecords historyRecords, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " createRepeatingInvoiceHistory"); - } // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'repeatingInvoiceID' when calling" - + " createRepeatingInvoiceHistory"); - } // verify the required parameter 'historyRecords' is set - if (historyRecords == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'historyRecords' when calling" - + " createRepeatingInvoiceHistory"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " createRepeatingInvoiceHistory"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/RepeatingInvoices/{RepeatingInvoiceID}/History"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("PUT " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(historyRecords); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.PUT, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Creates one or more repeating invoice templates - * - *

200 - Success - return response of type RepeatingInvoices array with newly created - * RepeatingInvoice - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoices RepeatingInvoices with an array of repeating invoice objects in body - * of request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return RepeatingInvoices - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public RepeatingInvoices createRepeatingInvoices( - String accessToken, - String xeroTenantId, - RepeatingInvoices repeatingInvoices, - Boolean summarizeErrors, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - createRepeatingInvoicesForHttpResponse( - accessToken, xeroTenantId, repeatingInvoices, summarizeErrors, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : createRepeatingInvoices -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("RepeatingInvoices", object.getMessage(), e); - } - handler.validationError("RepeatingInvoices", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Creates one or more repeating invoice templates - * - *

200 - Success - return response of type RepeatingInvoices array with newly created - * RepeatingInvoice - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoices RepeatingInvoices with an array of repeating invoice objects in body - * of request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse createRepeatingInvoicesForHttpResponse( + public HttpResponse createRepeatingInvoicesForHttpResponse( String accessToken, String xeroTenantId, RepeatingInvoices repeatingInvoices, @@ -26749,8 +25140,6 @@ public HttpResponse updateAccountForHttpResponse( .execute(); } - // Overload params for updateAccountAttachmentByFileName to allow byte[] or File type to be passed - // as body /** * Updates attachment on a specific account by filename * @@ -26764,25 +25153,23 @@ public HttpResponse updateAccountForHttpResponse( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments updateAccountAttachmentByFileName( String accessToken, String xeroTenantId, UUID accountID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = updateAccountAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, accountID, fileName, body, idempotencyKey, mimeType); + accessToken, xeroTenantId, accountID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -26793,7 +25180,18 @@ public Attachments updateAccountAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -26813,19 +25211,17 @@ public Attachments updateAccountAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID accountID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -26872,9 +25268,9 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( logger.debug("POST " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -26888,42 +25284,49 @@ public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( } /** - * Updates attachment on a specific account by filename + * Updates a single spent or received money transaction * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type BankTransactions array with updated + * BankTransaction * - *

400 - Validation Error - some data was incorrect returns response of type Error + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param bankTransactions The bankTransactions parameter + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateAccountAttachmentByFileName( + public BankTransactions updateBankTransaction( String accessToken, String xeroTenantId, - UUID accountID, - String fileName, - File body, + UUID bankTransactionID, + BankTransactions bankTransactions, + Integer unitdp, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateAccountAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, accountID, fileName, body, idempotencyKey); + updateBankTransactionForHttpResponse( + accessToken, + xeroTenantId, + bankTransactionID, + bankTransactions, + unitdp, + idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateAccountAttachmentByFileName -------------------"); + + " : updateBankTransaction -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -26933,9 +25336,9 @@ public Attachments updateAccountAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("BankTransactions", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("BankTransactions", object, e); } else { handler.execute(e); } @@ -26946,208 +25349,58 @@ public Attachments updateAccountAttachmentByFileName( } /** - * Updates attachment on a specific account by filename + * Updates a single spent or received money transaction * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type BankTransactions array with updated + * BankTransaction * - *

400 - Validation Error - some data was incorrect returns response of type Error + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param accountID Unique identifier for Account object - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param bankTransactions The bankTransactions parameter + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateAccountAttachmentByFileNameForHttpResponse( + public HttpResponse updateBankTransactionForHttpResponse( String accessToken, String xeroTenantId, - UUID accountID, - String fileName, - File body, + UUID bankTransactionID, + BankTransactions bankTransactions, + Integer unitdp, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateAccountAttachmentByFileName"); - } // verify the required parameter 'accountID' is set - if (accountID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accountID' when calling" - + " updateAccountAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { + "Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); + } // verify the required parameter 'bankTransactionID' is set + if (bankTransactionID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updateAccountAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); + } // verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling updateAccountAttachmentByFileName"); + "Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateAccountAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling updateBankTransaction"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("AccountID", accountID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/Accounts/{AccountID}/Attachments/{FileName}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Updates a single spent or received money transaction - * - *

200 - Success - return response of type BankTransactions array with updated - * BankTransaction - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param bankTransactions The bankTransactions parameter - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public BankTransactions updateBankTransaction( - String accessToken, - String xeroTenantId, - UUID bankTransactionID, - BankTransactions bankTransactions, - Integer unitdp, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateBankTransactionForHttpResponse( - accessToken, - xeroTenantId, - bankTransactionID, - bankTransactions, - unitdp, - idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateBankTransaction -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("BankTransactions", object.getMessage(), e); - } - handler.validationError("BankTransactions", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates a single spent or received money transaction - * - *

200 - Success - return response of type BankTransactions array with updated - * BankTransaction - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction - * @param bankTransactions The bankTransactions parameter - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse updateBankTransactionForHttpResponse( - String accessToken, - String xeroTenantId, - UUID bankTransactionID, - BankTransactions bankTransactions, - Integer unitdp, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateBankTransaction"); - } // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'bankTransactionID' when calling updateBankTransaction"); - } // verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'bankTransactions' when calling updateBankTransaction"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateBankTransaction"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("BankTransactionID", bankTransactionID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions/{BankTransactionID}"); @@ -27192,8 +25445,6 @@ public HttpResponse updateBankTransactionForHttpResponse( .execute(); } - // Overload params for updateBankTransactionAttachmentByFileName to allow byte[] or File type to - // be passed as body /** * Updates a specific attachment from a specific bank transaction by filename * @@ -27207,31 +25458,23 @@ public HttpResponse updateBankTransactionForHttpResponse( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ public Attachments updateBankTransactionAttachmentByFileName( String accessToken, String xeroTenantId, UUID bankTransactionID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = updateBankTransactionAttachmentByFileNameForHttpResponse( - accessToken, - xeroTenantId, - bankTransactionID, - fileName, - body, - idempotencyKey, - mimeType); + accessToken, xeroTenantId, bankTransactionID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { @@ -27242,7 +25485,18 @@ public Attachments updateBankTransactionAttachmentByFileName( logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -27262,19 +25516,17 @@ public Attachments updateBankTransactionAttachmentByFileName( * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, UUID bankTransactionID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { @@ -27323,9 +25575,9 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( logger.debug("POST " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -27339,14 +25591,13 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( } /** - * Updates a specific attachment from a specific bank transaction by filename - * - *

200 - Success - return response of Attachments array of Attachment + * 200 - Success - return response of Attachments array of 0 to N Attachment for a Bank + * Transfer * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate @@ -27355,10 +25606,10 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateBankTransactionAttachmentByFileName( + public Attachments updateBankTransferAttachmentByFileName( String accessToken, String xeroTenantId, - UUID bankTransactionID, + UUID bankTransferID, String fileName, File body, String idempotencyKey) @@ -27366,15 +25617,15 @@ public Attachments updateBankTransactionAttachmentByFileName( try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateBankTransactionAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, bankTransactionID, fileName, body, idempotencyKey); + updateBankTransferAttachmentByFileNameForHttpResponse( + accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateBankTransactionAttachmentByFileName -------------------"); + + " : updateBankTransferAttachmentByFileName -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -27397,14 +25648,13 @@ public Attachments updateBankTransactionAttachmentByFileName( } /** - * Updates a specific attachment from a specific bank transaction by filename - * - *

200 - Success - return response of Attachments array of Attachment + * 200 - Success - return response of Attachments array of 0 to N Attachment for a Bank + * Transfer * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactionID Xero generated unique identifier for a bank transaction + * @param bankTransferID Xero generated unique identifier for a bank transfer * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate @@ -27413,10 +25663,10 @@ public Attachments updateBankTransactionAttachmentByFileName( * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( + public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, - UUID bankTransactionID, + UUID bankTransferID, String fileName, File body, String idempotencyKey) @@ -27425,27 +25675,27 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " updateBankTransactionAttachmentByFileName"); - } // verify the required parameter 'bankTransactionID' is set - if (bankTransactionID == null) { + + " updateBankTransferAttachmentByFileName"); + } // verify the required parameter 'bankTransferID' is set + if (bankTransferID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'bankTransactionID' when calling" - + " updateBankTransactionAttachmentByFileName"); + "Missing the required parameter 'bankTransferID' when calling" + + " updateBankTransferAttachmentByFileName"); } // verify the required parameter 'fileName' is set if (fileName == null) { throw new IllegalArgumentException( "Missing the required parameter 'fileName' when calling" - + " updateBankTransactionAttachmentByFileName"); + + " updateBankTransferAttachmentByFileName"); } // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException( "Missing the required parameter 'body' when calling" - + " updateBankTransactionAttachmentByFileName"); + + " updateBankTransferAttachmentByFileName"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " updateBankTransactionAttachmentByFileName"); + + " updateBankTransferAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -27455,22 +25705,21 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransactionID", bankTransactionID); + uriVariables.put("BankTransferID", bankTransferID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri( - apiClient.getBasePath() - + "/BankTransactions/{BankTransactionID}/Attachments/{FileName}"); + apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(body); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -27483,131 +25732,122 @@ public HttpResponse updateBankTransactionAttachmentByFileNameForHttpResponse( .execute(); } - // Overload params for updateBankTransferAttachmentByFileName to allow byte[] or File type to be - // passed as body /** - * 200 - Success - return response of Attachments array of 0 to N Attachment for a Bank - * Transfer + * Updates a specific contact in a Xero organisation + * + *

200 - Success - return response of type Contacts array with an updated Contact * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param contactID Unique identifier for a Contact + * @param contacts an array of Contacts containing single Contact object with properties to update * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @return Contacts + * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateBankTransferAttachmentByFileName( + public Contacts updateContact( String accessToken, String xeroTenantId, - UUID bankTransferID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + UUID contactID, + Contacts contacts, + String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateBankTransferAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey, mimeType); + updateContactForHttpResponse( + accessToken, xeroTenantId, contactID, contacts, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateBankTransferAttachmentByFileName -------------------"); + + " : updateContact -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * 200 - Success - return response of Attachments array of 0 to N Attachment for a Bank - * Transfer - * - *

400 - A failed request due to validation error + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Contacts", object.getMessage(), e); + } + handler.validationError("Contacts", object, e); + } else { + handler.execute(e); + } + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + /** + * Updates a specific contact in a Xero organisation + * + *

200 - Success - return response of type Contacts array with an updated Contact + * + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param contactID Unique identifier for a Contact + * @param contacts an array of Contacts containing single Contact object with properties to update * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( + public HttpResponse updateContactForHttpResponse( String accessToken, String xeroTenantId, - UUID bankTransferID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + UUID contactID, + Contacts contacts, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateBankTransferAttachmentByFileName"); - } // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'bankTransferID' when calling" - + " updateBankTransferAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { + "Missing the required parameter 'xeroTenantId' when calling updateContact"); + } // verify the required parameter 'contactID' is set + if (contactID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updateBankTransferAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'contactID' when calling updateContact"); + } // verify the required parameter 'contacts' is set + if (contacts == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " updateBankTransferAttachmentByFileName"); + "Missing the required parameter 'contacts' when calling updateContact"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateBankTransferAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling updateContact"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); - uriVariables.put("FileName", fileName); + uriVariables.put("ContactID", contactID); - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(contacts); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -27621,13 +25861,12 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( } /** - * 200 - Success - return response of Attachments array of 0 to N Attachment for a Bank - * Transfer + * 200 - Success - return response of type Attachments array with an updated Attachment * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param contactID Unique identifier for a Contact * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate @@ -27636,10 +25875,10 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateBankTransferAttachmentByFileName( + public Attachments updateContactAttachmentByFileName( String accessToken, String xeroTenantId, - UUID bankTransferID, + UUID contactID, String fileName, File body, String idempotencyKey) @@ -27647,15 +25886,15 @@ public Attachments updateBankTransferAttachmentByFileName( try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateBankTransferAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, bankTransferID, fileName, body, idempotencyKey); + updateContactAttachmentByFileNameForHttpResponse( + accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateBankTransferAttachmentByFileName -------------------"); + + " : updateContactAttachmentByFileName -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -27678,13 +25917,12 @@ public Attachments updateBankTransferAttachmentByFileName( } /** - * 200 - Success - return response of Attachments array of 0 to N Attachment for a Bank - * Transfer + * 200 - Success - return response of type Attachments array with an updated Attachment * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param bankTransferID Xero generated unique identifier for a bank transfer + * @param contactID Unique identifier for a Contact * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate @@ -27693,10 +25931,10 @@ public Attachments updateBankTransferAttachmentByFileName( * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( + public HttpResponse updateContactAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, - UUID bankTransferID, + UUID contactID, String fileName, File body, String idempotencyKey) @@ -27705,27 +25943,26 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " updateBankTransferAttachmentByFileName"); - } // verify the required parameter 'bankTransferID' is set - if (bankTransferID == null) { + + " updateContactAttachmentByFileName"); + } // verify the required parameter 'contactID' is set + if (contactID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'bankTransferID' when calling" - + " updateBankTransferAttachmentByFileName"); + "Missing the required parameter 'contactID' when calling" + + " updateContactAttachmentByFileName"); } // verify the required parameter 'fileName' is set if (fileName == null) { throw new IllegalArgumentException( "Missing the required parameter 'fileName' when calling" - + " updateBankTransferAttachmentByFileName"); + + " updateContactAttachmentByFileName"); } // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " updateBankTransferAttachmentByFileName"); + "Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " updateBankTransferAttachmentByFileName"); + + " updateContactAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -27735,21 +25972,21 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("BankTransferID", bankTransferID); + uriVariables.put("ContactID", contactID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri( - apiClient.getBasePath() + "/BankTransfers/{BankTransferID}/Attachments/{FileName}"); + apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(body); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -27763,40 +26000,40 @@ public HttpResponse updateBankTransferAttachmentByFileNameForHttpResponse( } /** - * Updates a specific contact in a Xero organisation + * Updates a specific contact group * - *

200 - Success - return response of type Contacts array with an updated Contact + *

200 - Success - return response of type Contact Groups array of updated Contact Group * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param contacts an array of Contacts containing single Contact object with properties to update + * @param contactGroupID Unique identifier for a Contact Group + * @param contactGroups an array of Contact groups with Name of specific group to update * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Contacts + * @return ContactGroups * @throws IOException if an error occurs while attempting to invoke the API * */ - public Contacts updateContact( + public ContactGroups updateContactGroup( String accessToken, String xeroTenantId, - UUID contactID, - Contacts contacts, + UUID contactGroupID, + ContactGroups contactGroups, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateContactForHttpResponse( - accessToken, xeroTenantId, contactID, contacts, idempotencyKey); + updateContactGroupForHttpResponse( + accessToken, xeroTenantId, contactGroupID, contactGroups, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateContact -------------------"); + + " : updateContactGroup -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -27806,9 +26043,9 @@ public Contacts updateContact( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Contacts", object.getMessage(), e); + handler.validationError("ContactGroups", object.getMessage(), e); } - handler.validationError("Contacts", object, e); + handler.validationError("ContactGroups", object, e); } else { handler.execute(e); } @@ -27819,44 +26056,44 @@ public Contacts updateContact( } /** - * Updates a specific contact in a Xero organisation + * Updates a specific contact group * - *

200 - Success - return response of type Contacts array with an updated Contact + *

200 - Success - return response of type Contact Groups array of updated Contact Group * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param contacts an array of Contacts containing single Contact object with properties to update + * @param contactGroupID Unique identifier for a Contact Group + * @param contactGroups an array of Contact groups with Name of specific group to update * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateContactForHttpResponse( + public HttpResponse updateContactGroupForHttpResponse( String accessToken, String xeroTenantId, - UUID contactID, - Contacts contacts, + UUID contactGroupID, + ContactGroups contactGroups, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateContact"); - } // verify the required parameter 'contactID' is set - if (contactID == null) { + "Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); + } // verify the required parameter 'contactGroupID' is set + if (contactGroupID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'contactID' when calling updateContact"); - } // verify the required parameter 'contacts' is set - if (contacts == null) { + "Missing the required parameter 'contactGroupID' when calling updateContactGroup"); + } // verify the required parameter 'contactGroups' is set + if (contactGroups == null) { throw new IllegalArgumentException( - "Missing the required parameter 'contacts' when calling updateContact"); + "Missing the required parameter 'contactGroups' when calling updateContactGroup"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateContact"); + "Missing the required parameter 'accessToken' when calling updateContactGroup"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -27866,9 +26103,10 @@ public HttpResponse updateContactForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("ContactGroupID", contactGroupID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts/{ContactID}"); + UriBuilder uriBuilder = + UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { @@ -27876,7 +26114,7 @@ public HttpResponse updateContactForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contacts); + content = apiClient.new JacksonJsonHttpContent(contactGroups); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -27890,49 +26128,59 @@ public HttpResponse updateContactForHttpResponse( .execute(); } - // Overload params for updateContactAttachmentByFileName to allow byte[] or File type to be passed - // as body /** - * 200 - Success - return response of type Attachments array with an updated Attachment + * Updates a specific credit note + * + *

200 - Success - return response of type Credit Notes array with updated CreditNote * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param creditNoteID Unique identifier for a Credit Note + * @param creditNotes an array of Credit Notes containing credit note details to update + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @return CreditNotes + * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateContactAttachmentByFileName( + public CreditNotes updateCreditNote( String accessToken, String xeroTenantId, - UUID contactID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + UUID creditNoteID, + CreditNotes creditNotes, + Integer unitdp, + String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateContactAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey, mimeType); + updateCreditNoteForHttpResponse( + accessToken, xeroTenantId, creditNoteID, creditNotes, unitdp, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateContactAttachmentByFileName -------------------"); + + " : updateCreditNote -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("CreditNotes", object.getMessage(), e); + } + handler.validationError("CreditNotes", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -27940,78 +26188,89 @@ public Attachments updateContactAttachmentByFileName( } /** - * 200 - Success - return response of type Attachments array with an updated Attachment + * Updates a specific credit note + * + *

200 - Success - return response of type Credit Notes array with updated CreditNote * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param creditNoteID Unique identifier for a Credit Note + * @param creditNotes an array of Credit Notes containing credit note details to update + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateContactAttachmentByFileNameForHttpResponse( + public HttpResponse updateCreditNoteForHttpResponse( String accessToken, String xeroTenantId, - UUID contactID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + UUID creditNoteID, + CreditNotes creditNotes, + Integer unitdp, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateContactAttachmentByFileName"); - } // verify the required parameter 'contactID' is set - if (contactID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'contactID' when calling" - + " updateContactAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { + "Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); + } // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updateContactAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'creditNoteID' when calling updateCreditNote"); + } // verify the required parameter 'creditNotes' is set + if (creditNotes == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); + "Missing the required parameter 'creditNotes' when calling updateCreditNote"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateContactAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling updateCreditNote"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); - uriVariables.put("FileName", fileName); + uriVariables.put("CreditNoteID", creditNoteID); UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + List valueList = new ArrayList<>((Collection) value); + if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { + List list = new ArrayList(); + for (int i = 0; i < valueList.size(); i++) { + list.add(valueList.get(i).toString()); + } + uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); + } else { + uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); + } + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(creditNotes); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -28025,12 +26284,15 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( } /** - * 200 - Success - return response of type Attachments array with an updated Attachment + * Updates attachments on a specific credit note by file name + * + *

200 - Success - return response of type Attachments array with updated Attachment for + * specific Credit Note * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact + * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate @@ -28039,10 +26301,10 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateContactAttachmentByFileName( + public Attachments updateCreditNoteAttachmentByFileName( String accessToken, String xeroTenantId, - UUID contactID, + UUID creditNoteID, String fileName, File body, String idempotencyKey) @@ -28050,15 +26312,15 @@ public Attachments updateContactAttachmentByFileName( try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateContactAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, contactID, fileName, body, idempotencyKey); + updateCreditNoteAttachmentByFileNameForHttpResponse( + accessToken, xeroTenantId, creditNoteID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateContactAttachmentByFileName -------------------"); + + " : updateCreditNoteAttachmentByFileName -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -28081,12 +26343,15 @@ public Attachments updateContactAttachmentByFileName( } /** - * 200 - Success - return response of type Attachments array with an updated Attachment + * Updates attachments on a specific credit note by file name + * + *

200 - Success - return response of type Attachments array with updated Attachment for + * specific Credit Note * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param contactID Unique identifier for a Contact + * @param creditNoteID Unique identifier for a Credit Note * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate @@ -28095,10 +26360,10 @@ public Attachments updateContactAttachmentByFileName( * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateContactAttachmentByFileNameForHttpResponse( + public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, - UUID contactID, + UUID creditNoteID, String fileName, File body, String idempotencyKey) @@ -28107,26 +26372,27 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " updateContactAttachmentByFileName"); - } // verify the required parameter 'contactID' is set - if (contactID == null) { + + " updateCreditNoteAttachmentByFileName"); + } // verify the required parameter 'creditNoteID' is set + if (creditNoteID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'contactID' when calling" - + " updateContactAttachmentByFileName"); + "Missing the required parameter 'creditNoteID' when calling" + + " updateCreditNoteAttachmentByFileName"); } // verify the required parameter 'fileName' is set if (fileName == null) { throw new IllegalArgumentException( "Missing the required parameter 'fileName' when calling" - + " updateContactAttachmentByFileName"); + + " updateCreditNoteAttachmentByFileName"); } // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling updateContactAttachmentByFileName"); + "Missing the required parameter 'body' when calling" + + " updateCreditNoteAttachmentByFileName"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " updateContactAttachmentByFileName"); + + " updateCreditNoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -28136,21 +26402,21 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactID", contactID); + uriVariables.put("CreditNoteID", creditNoteID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri( - apiClient.getBasePath() + "/Contacts/{ContactID}/Attachments/{FileName}"); + apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(body); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -28164,40 +26430,40 @@ public HttpResponse updateContactAttachmentByFileNameForHttpResponse( } /** - * Updates a specific contact group + * Updates a specific expense claims * - *

200 - Success - return response of type Contact Groups array of updated Contact Group + *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contactGroups an array of Contact groups with Name of specific group to update + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param expenseClaims The expenseClaims parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return ContactGroups + * @return ExpenseClaims * @throws IOException if an error occurs while attempting to invoke the API * */ - public ContactGroups updateContactGroup( + public ExpenseClaims updateExpenseClaim( String accessToken, String xeroTenantId, - UUID contactGroupID, - ContactGroups contactGroups, + UUID expenseClaimID, + ExpenseClaims expenseClaims, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateContactGroupForHttpResponse( - accessToken, xeroTenantId, contactGroupID, contactGroups, idempotencyKey); + updateExpenseClaimForHttpResponse( + accessToken, xeroTenantId, expenseClaimID, expenseClaims, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateContactGroup -------------------"); + + " : updateExpenseClaim -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -28207,9 +26473,9 @@ public ContactGroups updateContactGroup( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("ContactGroups", object.getMessage(), e); + handler.validationError("ExpenseClaims", object.getMessage(), e); } - handler.validationError("ContactGroups", object, e); + handler.validationError("ExpenseClaims", object, e); } else { handler.execute(e); } @@ -28220,44 +26486,44 @@ public ContactGroups updateContactGroup( } /** - * Updates a specific contact group + * Updates a specific expense claims * - *

200 - Success - return response of type Contact Groups array of updated Contact Group + *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param contactGroupID Unique identifier for a Contact Group - * @param contactGroups an array of Contact groups with Name of specific group to update + * @param expenseClaimID Unique identifier for a ExpenseClaim + * @param expenseClaims The expenseClaims parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateContactGroupForHttpResponse( + public HttpResponse updateExpenseClaimForHttpResponse( String accessToken, String xeroTenantId, - UUID contactGroupID, - ContactGroups contactGroups, + UUID expenseClaimID, + ExpenseClaims expenseClaims, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateContactGroup"); - } // verify the required parameter 'contactGroupID' is set - if (contactGroupID == null) { + "Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); + } // verify the required parameter 'expenseClaimID' is set + if (expenseClaimID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'contactGroupID' when calling updateContactGroup"); - } // verify the required parameter 'contactGroups' is set - if (contactGroups == null) { + "Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); + } // verify the required parameter 'expenseClaims' is set + if (expenseClaims == null) { throw new IllegalArgumentException( - "Missing the required parameter 'contactGroups' when calling updateContactGroup"); + "Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateContactGroup"); + "Missing the required parameter 'accessToken' when calling updateExpenseClaim"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -28267,10 +26533,10 @@ public HttpResponse updateContactGroupForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ContactGroupID", contactGroupID); + uriVariables.put("ExpenseClaimID", expenseClaimID); UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/ContactGroups/{ContactGroupID}"); + UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { @@ -28278,7 +26544,7 @@ public HttpResponse updateContactGroupForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contactGroups); + content = apiClient.new JacksonJsonHttpContent(expenseClaims); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -28293,43 +26559,43 @@ public HttpResponse updateContactGroupForHttpResponse( } /** - * Updates a specific credit note + * Updates a specific sales invoices or purchase bills * - *

200 - Success - return response of type Credit Notes array with updated CreditNote + *

200 - Success - return response of type Invoices array with updated Invoice * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param creditNotes an array of Credit Notes containing credit note details to update + * @param invoiceID Unique identifier for an Invoice + * @param invoices The invoices parameter * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return CreditNotes + * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API * */ - public CreditNotes updateCreditNote( + public Invoices updateInvoice( String accessToken, String xeroTenantId, - UUID creditNoteID, - CreditNotes creditNotes, + UUID invoiceID, + Invoices invoices, Integer unitdp, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateCreditNoteForHttpResponse( - accessToken, xeroTenantId, creditNoteID, creditNotes, unitdp, idempotencyKey); + updateInvoiceForHttpResponse( + accessToken, xeroTenantId, invoiceID, invoices, unitdp, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateCreditNote -------------------"); + + " : updateInvoice -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -28339,9 +26605,9 @@ public CreditNotes updateCreditNote( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("CreditNotes", object.getMessage(), e); + handler.validationError("Invoices", object.getMessage(), e); } - handler.validationError("CreditNotes", object, e); + handler.validationError("Invoices", object, e); } else { handler.execute(e); } @@ -28352,15 +26618,15 @@ public CreditNotes updateCreditNote( } /** - * Updates a specific credit note + * Updates a specific sales invoices or purchase bills * - *

200 - Success - return response of type Credit Notes array with updated CreditNote + *

200 - Success - return response of type Invoices array with updated Invoice * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param creditNotes an array of Credit Notes containing credit note details to update + * @param invoiceID Unique identifier for an Invoice + * @param invoices The invoices parameter * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate @@ -28369,30 +26635,30 @@ public CreditNotes updateCreditNote( * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateCreditNoteForHttpResponse( + public HttpResponse updateInvoiceForHttpResponse( String accessToken, String xeroTenantId, - UUID creditNoteID, - CreditNotes creditNotes, + UUID invoiceID, + Invoices invoices, Integer unitdp, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateCreditNote"); - } // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { + "Missing the required parameter 'xeroTenantId' when calling updateInvoice"); + } // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'creditNoteID' when calling updateCreditNote"); - } // verify the required parameter 'creditNotes' is set - if (creditNotes == null) { + "Missing the required parameter 'invoiceID' when calling updateInvoice"); + } // verify the required parameter 'invoices' is set + if (invoices == null) { throw new IllegalArgumentException( - "Missing the required parameter 'creditNotes' when calling updateCreditNote"); + "Missing the required parameter 'invoices' when calling updateInvoice"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateCreditNote"); + "Missing the required parameter 'accessToken' when calling updateInvoice"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -28402,10 +26668,9 @@ public HttpResponse updateCreditNoteForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("InvoiceID", invoiceID); - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); if (unitdp != null) { String key = "unitdp"; Object value = unitdp; @@ -28433,7 +26698,7 @@ public HttpResponse updateCreditNoteForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(creditNotes); + content = apiClient.new JacksonJsonHttpContent(invoices); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -28447,111 +26712,113 @@ public HttpResponse updateCreditNoteForHttpResponse( .execute(); } - // Overload params for updateCreditNoteAttachmentByFileName to allow byte[] or File type to be - // passed as body /** - * Updates attachments on a specific credit note by file name + * Updates an attachment from a specific invoices or purchase bill by filename * - *

200 - Success - return response of type Attachments array with updated Attachment for - * specific Credit Note + *

200 - Success - return response of type Attachments array with updated Attachment * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note + * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateCreditNoteAttachmentByFileName( + public Attachments updateInvoiceAttachmentByFileName( String accessToken, String xeroTenantId, - UUID creditNoteID, + UUID invoiceID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateCreditNoteAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, creditNoteID, fileName, body, idempotencyKey, mimeType); + updateInvoiceAttachmentByFileNameForHttpResponse( + accessToken, xeroTenantId, invoiceID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateCreditNoteAttachmentByFileName -------------------"); + + " : updateInvoiceAttachmentByFileName -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates attachments on a specific credit note by file name + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } + } catch (IOException ioe) { + throw ioe; + } + return null; + } + + /** + * Updates an attachment from a specific invoices or purchase bill by filename * - *

200 - Success - return response of type Attachments array with updated Attachment for - * specific Credit Note + *

200 - Success - return response of type Attachments array with updated Attachment * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note + * @param invoiceID Unique identifier for an Invoice * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( + public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, - UUID creditNoteID, + UUID invoiceID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " updateCreditNoteAttachmentByFileName"); - } // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { + + " updateInvoiceAttachmentByFileName"); + } // verify the required parameter 'invoiceID' is set + if (invoiceID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'creditNoteID' when calling" - + " updateCreditNoteAttachmentByFileName"); + "Missing the required parameter 'invoiceID' when calling" + + " updateInvoiceAttachmentByFileName"); } // verify the required parameter 'fileName' is set if (fileName == null) { throw new IllegalArgumentException( "Missing the required parameter 'fileName' when calling" - + " updateCreditNoteAttachmentByFileName"); + + " updateInvoiceAttachmentByFileName"); } // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " updateCreditNoteAttachmentByFileName"); + "Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " updateCreditNoteAttachmentByFileName"); + + " updateInvoiceAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -28561,21 +26828,21 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); + uriVariables.put("InvoiceID", invoiceID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri( - apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -28589,43 +26856,43 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( } /** - * Updates attachments on a specific credit note by file name + * Updates a specific item * - *

200 - Success - return response of type Attachments array with updated Attachment for - * specific Credit Note + *

200 - Success - return response of type Items array with updated Item * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param itemID Unique identifier for an Item + * @param items The items parameter + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return Items * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateCreditNoteAttachmentByFileName( + public Items updateItem( String accessToken, String xeroTenantId, - UUID creditNoteID, - String fileName, - File body, + UUID itemID, + Items items, + Integer unitdp, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateCreditNoteAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, creditNoteID, fileName, body, idempotencyKey); + updateItemForHttpResponse( + accessToken, xeroTenantId, itemID, items, unitdp, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateCreditNoteAttachmentByFileName -------------------"); + + " : updateItem -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -28635,9 +26902,9 @@ public Attachments updateCreditNoteAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("Items", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("Items", object, e); } else { handler.execute(e); } @@ -28648,80 +26915,88 @@ public Attachments updateCreditNoteAttachmentByFileName( } /** - * Updates attachments on a specific credit note by file name + * Updates a specific item * - *

200 - Success - return response of type Attachments array with updated Attachment for - * specific Credit Note + *

200 - Success - return response of type Items array with updated Item * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param creditNoteID Unique identifier for a Credit Note - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param itemID Unique identifier for an Item + * @param items The items parameter + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( + public HttpResponse updateItemForHttpResponse( String accessToken, String xeroTenantId, - UUID creditNoteID, - String fileName, - File body, + UUID itemID, + Items items, + Integer unitdp, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateCreditNoteAttachmentByFileName"); - } // verify the required parameter 'creditNoteID' is set - if (creditNoteID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'creditNoteID' when calling" - + " updateCreditNoteAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { + "Missing the required parameter 'xeroTenantId' when calling updateItem"); + } // verify the required parameter 'itemID' is set + if (itemID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updateCreditNoteAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'itemID' when calling updateItem"); + } // verify the required parameter 'items' is set + if (items == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " updateCreditNoteAttachmentByFileName"); + "Missing the required parameter 'items' when calling updateItem"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateCreditNoteAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling updateItem"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("CreditNoteID", creditNoteID); - uriVariables.put("FileName", fileName); + uriVariables.put("ItemID", itemID); - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/CreditNotes/{CreditNoteID}/Attachments/{FileName}"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); + if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + List valueList = new ArrayList<>((Collection) value); + if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { + List list = new ArrayList(); + for (int i = 0; i < valueList.size(); i++) { + list.add(valueList.get(i).toString()); + } + uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); + } else { + uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); + } + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(items); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -28735,40 +27010,42 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse( } /** - * Updates a specific expense claims + * Updates a specific linked transactions (billable expenses) * - *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim + *

200 - Success - return response of type LinkedTransactions array with updated + * LinkedTransaction * - *

400 - A failed request due to validation error + *

400 - Success - return response of type LinkedTransactions array with updated + * LinkedTransaction * * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param expenseClaims The expenseClaims parameter + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @param linkedTransactions The linkedTransactions parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return ExpenseClaims + * @return LinkedTransactions * @throws IOException if an error occurs while attempting to invoke the API * */ - public ExpenseClaims updateExpenseClaim( + public LinkedTransactions updateLinkedTransaction( String accessToken, String xeroTenantId, - UUID expenseClaimID, - ExpenseClaims expenseClaims, + UUID linkedTransactionID, + LinkedTransactions linkedTransactions, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateExpenseClaimForHttpResponse( - accessToken, xeroTenantId, expenseClaimID, expenseClaims, idempotencyKey); + updateLinkedTransactionForHttpResponse( + accessToken, xeroTenantId, linkedTransactionID, linkedTransactions, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateExpenseClaim -------------------"); + + " : updateLinkedTransaction -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -28778,9 +27055,9 @@ public ExpenseClaims updateExpenseClaim( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("ExpenseClaims", object.getMessage(), e); + handler.validationError("LinkedTransactions", object.getMessage(), e); } - handler.validationError("ExpenseClaims", object, e); + handler.validationError("LinkedTransactions", object, e); } else { handler.execute(e); } @@ -28791,44 +27068,48 @@ public ExpenseClaims updateExpenseClaim( } /** - * Updates a specific expense claims + * Updates a specific linked transactions (billable expenses) * - *

200 - Success - return response of type ExpenseClaims array with updated ExpenseClaim + *

200 - Success - return response of type LinkedTransactions array with updated + * LinkedTransaction * - *

400 - A failed request due to validation error + *

400 - Success - return response of type LinkedTransactions array with updated + * LinkedTransaction * * @param xeroTenantId Xero identifier for Tenant - * @param expenseClaimID Unique identifier for a ExpenseClaim - * @param expenseClaims The expenseClaims parameter + * @param linkedTransactionID Unique identifier for a LinkedTransaction + * @param linkedTransactions The linkedTransactions parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateExpenseClaimForHttpResponse( + public HttpResponse updateLinkedTransactionForHttpResponse( String accessToken, String xeroTenantId, - UUID expenseClaimID, - ExpenseClaims expenseClaims, + UUID linkedTransactionID, + LinkedTransactions linkedTransactions, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateExpenseClaim"); - } // verify the required parameter 'expenseClaimID' is set - if (expenseClaimID == null) { + "Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); + } // verify the required parameter 'linkedTransactionID' is set + if (linkedTransactionID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'expenseClaimID' when calling updateExpenseClaim"); - } // verify the required parameter 'expenseClaims' is set - if (expenseClaims == null) { + "Missing the required parameter 'linkedTransactionID' when calling" + + " updateLinkedTransaction"); + } // verify the required parameter 'linkedTransactions' is set + if (linkedTransactions == null) { throw new IllegalArgumentException( - "Missing the required parameter 'expenseClaims' when calling updateExpenseClaim"); + "Missing the required parameter 'linkedTransactions' when calling" + + " updateLinkedTransaction"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateExpenseClaim"); + "Missing the required parameter 'accessToken' when calling updateLinkedTransaction"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -28838,10 +27119,10 @@ public HttpResponse updateExpenseClaimForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("ExpenseClaimID", expenseClaimID); + uriVariables.put("LinkedTransactionID", linkedTransactionID); UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/ExpenseClaims/{ExpenseClaimID}"); + UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { @@ -28849,7 +27130,7 @@ public HttpResponse updateExpenseClaimForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(expenseClaims); + content = apiClient.new JacksonJsonHttpContent(linkedTransactions); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -28864,43 +27145,41 @@ public HttpResponse updateExpenseClaimForHttpResponse( } /** - * Updates a specific sales invoices or purchase bills + * Updates a specific manual journal * - *

200 - Success - return response of type Invoices array with updated Invoice + *

200 - Success - return response of type ManualJournals array with an updated + * ManualJournal * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param invoices The invoices parameter - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts + * @param manualJournalID Unique identifier for a ManualJournal + * @param manualJournals The manualJournals parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Invoices + * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API * */ - public Invoices updateInvoice( + public ManualJournals updateManualJournal( String accessToken, String xeroTenantId, - UUID invoiceID, - Invoices invoices, - Integer unitdp, + UUID manualJournalID, + ManualJournals manualJournals, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateInvoiceForHttpResponse( - accessToken, xeroTenantId, invoiceID, invoices, unitdp, idempotencyKey); + updateManualJournalForHttpResponse( + accessToken, xeroTenantId, manualJournalID, manualJournals, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateInvoice -------------------"); + + " : updateManualJournal -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -28910,9 +27189,9 @@ public Invoices updateInvoice( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Invoices", object.getMessage(), e); + handler.validationError("ManualJournals", object.getMessage(), e); } - handler.validationError("Invoices", object, e); + handler.validationError("ManualJournals", object, e); } else { handler.execute(e); } @@ -28923,47 +27202,45 @@ public Invoices updateInvoice( } /** - * Updates a specific sales invoices or purchase bills + * Updates a specific manual journal * - *

200 - Success - return response of type Invoices array with updated Invoice + *

200 - Success - return response of type ManualJournals array with an updated + * ManualJournal * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param invoices The invoices parameter - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts + * @param manualJournalID Unique identifier for a ManualJournal + * @param manualJournals The manualJournals parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateInvoiceForHttpResponse( + public HttpResponse updateManualJournalForHttpResponse( String accessToken, String xeroTenantId, - UUID invoiceID, - Invoices invoices, - Integer unitdp, + UUID manualJournalID, + ManualJournals manualJournals, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateInvoice"); - } // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { + "Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); + } // verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'invoiceID' when calling updateInvoice"); - } // verify the required parameter 'invoices' is set - if (invoices == null) { + "Missing the required parameter 'manualJournalID' when calling updateManualJournal"); + } // verify the required parameter 'manualJournals' is set + if (manualJournals == null) { throw new IllegalArgumentException( - "Missing the required parameter 'invoices' when calling updateInvoice"); + "Missing the required parameter 'manualJournals' when calling updateManualJournal"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateInvoice"); + "Missing the required parameter 'accessToken' when calling updateManualJournal"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -28973,29 +27250,10 @@ public HttpResponse updateInvoiceForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("ManualJournalID", manualJournalID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices/{InvoiceID}"); - if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } + UriBuilder uriBuilder = + UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { @@ -29003,7 +27261,7 @@ public HttpResponse updateInvoiceForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(invoices); + content = apiClient.new JacksonJsonHttpContent(manualJournals); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -29017,51 +27275,59 @@ public HttpResponse updateInvoiceForHttpResponse( .execute(); } - // Overload params for updateInvoiceAttachmentByFileName to allow byte[] or File type to be passed - // as body /** - * Updates an attachment from a specific invoices or purchase bill by filename + * Updates a specific attachment from a specific manual journal by file name * - *

200 - Success - return response of type Attachments array with updated Attachment + *

200 - Success - return response of type Attachments array with an update Attachment + * for a ManualJournals * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice + * @param manualJournalID Unique identifier for a ManualJournal * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateInvoiceAttachmentByFileName( + public Attachments updateManualJournalAttachmentByFileName( String accessToken, String xeroTenantId, - UUID invoiceID, + UUID manualJournalID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateInvoiceAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, invoiceID, fileName, body, idempotencyKey, mimeType); + updateManualJournalAttachmentByFileNameForHttpResponse( + accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateInvoiceAttachmentByFileName -------------------"); + + " : updateManualJournalAttachmentByFileName -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -29069,56 +27335,56 @@ public Attachments updateInvoiceAttachmentByFileName( } /** - * Updates an attachment from a specific invoices or purchase bill by filename + * Updates a specific attachment from a specific manual journal by file name * - *

200 - Success - return response of type Attachments array with updated Attachment + *

200 - Success - return response of type Attachments array with an update Attachment + * for a ManualJournals * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice + * @param manualJournalID Unique identifier for a ManualJournal * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( + public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, - UUID invoiceID, + UUID manualJournalID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " updateInvoiceAttachmentByFileName"); - } // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { + + " updateManualJournalAttachmentByFileName"); + } // verify the required parameter 'manualJournalID' is set + if (manualJournalID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'invoiceID' when calling" - + " updateInvoiceAttachmentByFileName"); + "Missing the required parameter 'manualJournalID' when calling" + + " updateManualJournalAttachmentByFileName"); } // verify the required parameter 'fileName' is set if (fileName == null) { throw new IllegalArgumentException( "Missing the required parameter 'fileName' when calling" - + " updateInvoiceAttachmentByFileName"); + + " updateManualJournalAttachmentByFileName"); } // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); + "Missing the required parameter 'body' when calling" + + " updateManualJournalAttachmentByFileName"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " updateInvoiceAttachmentByFileName"); + + " updateManualJournalAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -29128,21 +27394,21 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); + uriVariables.put("ManualJournalID", manualJournalID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = UriBuilder.fromUri( - apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); + apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -29156,42 +27422,45 @@ public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( } /** - * Updates an attachment from a specific invoices or purchase bill by filename + * Updates or creates one or more spent or received money transaction * - *

200 - Success - return response of type Attachments array with updated Attachment + *

200 - Success - return response of type BankTransactions array with new + * BankTransaction * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param bankTransactions The bankTransactions parameter + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return BankTransactions * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateInvoiceAttachmentByFileName( + public BankTransactions updateOrCreateBankTransactions( String accessToken, String xeroTenantId, - UUID invoiceID, - String fileName, - File body, + BankTransactions bankTransactions, + Boolean summarizeErrors, + Integer unitdp, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateInvoiceAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, invoiceID, fileName, body, idempotencyKey); + updateOrCreateBankTransactionsForHttpResponse( + accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateInvoiceAttachmentByFileName -------------------"); + + " : updateOrCreateBankTransactions -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -29201,9 +27470,9 @@ public Attachments updateInvoiceAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("BankTransactions", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("BankTransactions", object, e); } else { handler.execute(e); } @@ -29214,1221 +27483,56 @@ public Attachments updateInvoiceAttachmentByFileName( } /** - * Updates an attachment from a specific invoices or purchase bill by filename + * Updates or creates one or more spent or received money transaction * - *

200 - Success - return response of type Attachments array with updated Attachment + *

200 - Success - return response of type BankTransactions array with new + * BankTransaction * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param invoiceID Unique identifier for an Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param bankTransactions The bankTransactions parameter + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateInvoiceAttachmentByFileNameForHttpResponse( + public HttpResponse updateOrCreateBankTransactionsForHttpResponse( String accessToken, String xeroTenantId, - UUID invoiceID, - String fileName, - File body, + BankTransactions bankTransactions, + Boolean summarizeErrors, + Integer unitdp, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " updateInvoiceAttachmentByFileName"); - } // verify the required parameter 'invoiceID' is set - if (invoiceID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'invoiceID' when calling" - + " updateInvoiceAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updateInvoiceAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + + " updateOrCreateBankTransactions"); + } // verify the required parameter 'bankTransactions' is set + if (bankTransactions == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling updateInvoiceAttachmentByFileName"); + "Missing the required parameter 'bankTransactions' when calling" + + " updateOrCreateBankTransactions"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " updateInvoiceAttachmentByFileName"); + + " updateOrCreateBankTransactions"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("InvoiceID", invoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/Invoices/{InvoiceID}/Attachments/{FileName}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Updates a specific item - * - *

200 - Success - return response of type Items array with updated Item - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param items The items parameter - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return Items - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public Items updateItem( - String accessToken, - String xeroTenantId, - UUID itemID, - Items items, - Integer unitdp, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateItemForHttpResponse( - accessToken, xeroTenantId, itemID, items, unitdp, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateItem -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Items", object.getMessage(), e); - } - handler.validationError("Items", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates a specific item - * - *

200 - Success - return response of type Items array with updated Item - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param itemID Unique identifier for an Item - * @param items The items parameter - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse updateItemForHttpResponse( - String accessToken, - String xeroTenantId, - UUID itemID, - Items items, - Integer unitdp, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateItem"); - } // verify the required parameter 'itemID' is set - if (itemID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'itemID' when calling updateItem"); - } // verify the required parameter 'items' is set - if (items == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'items' when calling updateItem"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateItem"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ItemID", itemID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items/{ItemID}"); - if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(items); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Updates a specific linked transactions (billable expenses) - * - *

200 - Success - return response of type LinkedTransactions array with updated - * LinkedTransaction - * - *

400 - Success - return response of type LinkedTransactions array with updated - * LinkedTransaction - * - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @param linkedTransactions The linkedTransactions parameter - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return LinkedTransactions - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public LinkedTransactions updateLinkedTransaction( - String accessToken, - String xeroTenantId, - UUID linkedTransactionID, - LinkedTransactions linkedTransactions, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateLinkedTransactionForHttpResponse( - accessToken, xeroTenantId, linkedTransactionID, linkedTransactions, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateLinkedTransaction -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("LinkedTransactions", object.getMessage(), e); - } - handler.validationError("LinkedTransactions", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates a specific linked transactions (billable expenses) - * - *

200 - Success - return response of type LinkedTransactions array with updated - * LinkedTransaction - * - *

400 - Success - return response of type LinkedTransactions array with updated - * LinkedTransaction - * - * @param xeroTenantId Xero identifier for Tenant - * @param linkedTransactionID Unique identifier for a LinkedTransaction - * @param linkedTransactions The linkedTransactions parameter - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse updateLinkedTransactionForHttpResponse( - String accessToken, - String xeroTenantId, - UUID linkedTransactionID, - LinkedTransactions linkedTransactions, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateLinkedTransaction"); - } // verify the required parameter 'linkedTransactionID' is set - if (linkedTransactionID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'linkedTransactionID' when calling" - + " updateLinkedTransaction"); - } // verify the required parameter 'linkedTransactions' is set - if (linkedTransactions == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'linkedTransactions' when calling" - + " updateLinkedTransaction"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateLinkedTransaction"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("LinkedTransactionID", linkedTransactionID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/LinkedTransactions/{LinkedTransactionID}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(linkedTransactions); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Updates a specific manual journal - * - *

200 - Success - return response of type ManualJournals array with an updated - * ManualJournal - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param manualJournals The manualJournals parameter - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return ManualJournals - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public ManualJournals updateManualJournal( - String accessToken, - String xeroTenantId, - UUID manualJournalID, - ManualJournals manualJournals, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateManualJournalForHttpResponse( - accessToken, xeroTenantId, manualJournalID, manualJournals, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateManualJournal -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("ManualJournals", object.getMessage(), e); - } - handler.validationError("ManualJournals", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates a specific manual journal - * - *

200 - Success - return response of type ManualJournals array with an updated - * ManualJournal - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param manualJournals The manualJournals parameter - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse updateManualJournalForHttpResponse( - String accessToken, - String xeroTenantId, - UUID manualJournalID, - ManualJournals manualJournals, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateManualJournal"); - } // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'manualJournalID' when calling updateManualJournal"); - } // verify the required parameter 'manualJournals' is set - if (manualJournals == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'manualJournals' when calling updateManualJournal"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateManualJournal"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(manualJournals); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - // Overload params for updateManualJournalAttachmentByFileName to allow byte[] or File type to be - // passed as body - /** - * Updates a specific attachment from a specific manual journal by file name - * - *

200 - Success - return response of type Attachments array with an update Attachment - * for a ManualJournals - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param mimeType The type of file being attached - * @param accessToken Authorization token for user set in header of each request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - */ - public Attachments updateManualJournalAttachmentByFileName( - String accessToken, - String xeroTenantId, - UUID manualJournalID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateManualJournalAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey, mimeType); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateManualJournalAttachmentByFileName -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates a specific attachment from a specific manual journal by file name - * - *

200 - Success - return response of type Attachments array with an update Attachment - * for a ManualJournals - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param mimeType The type of file being attached - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( - String accessToken, - String xeroTenantId, - UUID manualJournalID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateManualJournalAttachmentByFileName"); - } // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'manualJournalID' when calling" - + " updateManualJournalAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updateManualJournalAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " updateManualJournalAttachmentByFileName"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateManualJournalAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - - ByteArrayContent content = null; - - content = new ByteArrayContent(mimeType, body); - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Updates a specific attachment from a specific manual journal by file name - * - *

200 - Success - return response of type Attachments array with an update Attachment - * for a ManualJournals - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public Attachments updateManualJournalAttachmentByFileName( - String accessToken, - String xeroTenantId, - UUID manualJournalID, - String fileName, - File body, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateManualJournalAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, manualJournalID, fileName, body, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateManualJournalAttachmentByFileName -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); - } - handler.validationError("Attachments", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates a specific attachment from a specific manual journal by file name - * - *

200 - Success - return response of type Attachments array with an update Attachment - * for a ManualJournals - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param manualJournalID Unique identifier for a ManualJournal - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse updateManualJournalAttachmentByFileNameForHttpResponse( - String accessToken, - String xeroTenantId, - UUID manualJournalID, - String fileName, - File body, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateManualJournalAttachmentByFileName"); - } // verify the required parameter 'manualJournalID' is set - if (manualJournalID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'manualJournalID' when calling" - + " updateManualJournalAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updateManualJournalAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " updateManualJournalAttachmentByFileName"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateManualJournalAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ManualJournalID", manualJournalID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/ManualJournals/{ManualJournalID}/Attachments/{FileName}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); - HttpContent content = null; - content = new FileContent(mimeType, body); - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Updates or creates one or more spent or received money transaction - * - *

200 - Success - return response of type BankTransactions array with new - * BankTransaction - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactions The bankTransactions parameter - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return BankTransactions - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public BankTransactions updateOrCreateBankTransactions( - String accessToken, - String xeroTenantId, - BankTransactions bankTransactions, - Boolean summarizeErrors, - Integer unitdp, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateOrCreateBankTransactionsForHttpResponse( - accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateOrCreateBankTransactions -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("BankTransactions", object.getMessage(), e); - } - handler.validationError("BankTransactions", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates or creates one or more spent or received money transaction - * - *

200 - Success - return response of type BankTransactions array with new - * BankTransaction - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param bankTransactions The bankTransactions parameter - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse updateOrCreateBankTransactionsForHttpResponse( - String accessToken, - String xeroTenantId, - BankTransactions bankTransactions, - Boolean summarizeErrors, - Integer unitdp, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateOrCreateBankTransactions"); - } // verify the required parameter 'bankTransactions' is set - if (bankTransactions == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'bankTransactions' when calling" - + " updateOrCreateBankTransactions"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateOrCreateBankTransactions"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); - if (summarizeErrors != null) { - String key = "summarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(bankTransactions); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Updates or creates one or more contacts in a Xero organisation - * - *

200 - Success - return response of type Contacts array with newly created Contact - * - *

400 - Validation Error - some data was incorrect returns response of type Error - * - * @param xeroTenantId Xero identifier for Tenant - * @param contacts The contacts parameter - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return Contacts - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public Contacts updateOrCreateContacts( - String accessToken, - String xeroTenantId, - Contacts contacts, - Boolean summarizeErrors, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateOrCreateContactsForHttpResponse( - accessToken, xeroTenantId, contacts, summarizeErrors, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateOrCreateContacts -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Contacts", object.getMessage(), e); - } - handler.validationError("Contacts", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates or creates one or more contacts in a Xero organisation - * - *

200 - Success - return response of type Contacts array with newly created Contact - * - *

400 - Validation Error - some data was incorrect returns response of type Error - * - * @param xeroTenantId Xero identifier for Tenant - * @param contacts The contacts parameter - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse updateOrCreateContactsForHttpResponse( - String accessToken, - String xeroTenantId, - Contacts contacts, - Boolean summarizeErrors, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateOrCreateContacts"); - } // verify the required parameter 'contacts' is set - if (contacts == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'contacts' when calling updateOrCreateContacts"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateOrCreateContacts"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); - if (summarizeErrors != null) { - String key = "summarizeErrors"; - Object value = summarizeErrors; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(contacts); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Updates or creates one or more credit notes - * - *

200 - Success - return response of type Credit Notes array of newly created - * CreditNote - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param creditNotes an array of Credit Notes with a single CreditNote object. - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return CreditNotes - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public CreditNotes updateOrCreateCreditNotes( - String accessToken, - String xeroTenantId, - CreditNotes creditNotes, - Boolean summarizeErrors, - Integer unitdp, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateOrCreateCreditNotesForHttpResponse( - accessToken, xeroTenantId, creditNotes, summarizeErrors, unitdp, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateOrCreateCreditNotes -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("CreditNotes", object.getMessage(), e); - } - handler.validationError("CreditNotes", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates or creates one or more credit notes - * - *

200 - Success - return response of type Credit Notes array of newly created - * CreditNote - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param creditNotes an array of Credit Notes with a single CreditNote object. - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse updateOrCreateCreditNotesForHttpResponse( - String accessToken, - String xeroTenantId, - CreditNotes creditNotes, - Boolean summarizeErrors, - Integer unitdp, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateOrCreateCreditNotes"); - } // verify the required parameter 'creditNotes' is set - if (creditNotes == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'creditNotes' when calling updateOrCreateCreditNotes"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateOrCreateCreditNotes"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/BankTransactions"); if (summarizeErrors != null) { String key = "summarizeErrors"; Object value = summarizeErrors; @@ -30444,156 +27548,14 @@ public HttpResponse updateOrCreateCreditNotesForHttpResponse( uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); } } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } - String url = uriBuilder.build().toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - - HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(creditNotes); - - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - - /** - * Creates a single new employees used in Xero payrun - * - *

200 - Success - return response of type Employees array with new Employee - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param employees Employees with array of Employee object in body of request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return Employees - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public Employees updateOrCreateEmployees( - String accessToken, - String xeroTenantId, - Employees employees, - Boolean summarizeErrors, - String idempotencyKey) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateOrCreateEmployeesForHttpResponse( - accessToken, xeroTenantId, employees, summarizeErrors, idempotencyKey); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateOrCreateEmployees -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - if (e.getStatusCode() == 400) { - TypeReference errorTypeRef = - new TypeReference() {}; - com.xero.models.accounting.Error object = - apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); - if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Employees", object.getMessage(), e); - } - handler.validationError("Employees", object, e); - } else { - handler.execute(e); - } - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Creates a single new employees used in Xero payrun - * - *

200 - Success - return response of type Employees array with new Employee - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param employees Employees with array of Employee object in body of request - * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any - * with validation errors - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API - */ - public HttpResponse updateOrCreateEmployeesForHttpResponse( - String accessToken, - String xeroTenantId, - Employees employees, - Boolean summarizeErrors, - String idempotencyKey) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateOrCreateEmployees"); - } // verify the required parameter 'employees' is set - if (employees == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'employees' when calling updateOrCreateEmployees"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateOrCreateEmployees"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); - if (summarizeErrors != null) { - String key = "summarizeErrors"; - Object value = summarizeErrors; + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; if (value instanceof Collection) { List valueList = new ArrayList<>((Collection) value); if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { @@ -30618,7 +27580,7 @@ public HttpResponse updateOrCreateEmployeesForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(employees); + content = apiClient.new JacksonJsonHttpContent(bankTransactions); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -30633,44 +27595,41 @@ public HttpResponse updateOrCreateEmployeesForHttpResponse( } /** - * Updates or creates one or more sales invoices or purchase bills + * Updates or creates one or more contacts in a Xero organisation * - *

200 - Success - return response of type Invoices array with newly created Invoice + *

200 - Success - return response of type Contacts array with newly created Contact * - *

400 - A failed request due to validation error + *

400 - Validation Error - some data was incorrect returns response of type Error * * @param xeroTenantId Xero identifier for Tenant - * @param invoices The invoices parameter + * @param contacts The contacts parameter * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Invoices + * @return Contacts * @throws IOException if an error occurs while attempting to invoke the API * */ - public Invoices updateOrCreateInvoices( + public Contacts updateOrCreateContacts( String accessToken, String xeroTenantId, - Invoices invoices, + Contacts contacts, Boolean summarizeErrors, - Integer unitdp, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateOrCreateInvoicesForHttpResponse( - accessToken, xeroTenantId, invoices, summarizeErrors, unitdp, idempotencyKey); + updateOrCreateContactsForHttpResponse( + accessToken, xeroTenantId, contacts, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateOrCreateInvoices -------------------"); + + " : updateOrCreateContacts -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -30680,9 +27639,9 @@ public Invoices updateOrCreateInvoices( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Invoices", object.getMessage(), e); + handler.validationError("Contacts", object.getMessage(), e); } - handler.validationError("Invoices", object, e); + handler.validationError("Contacts", object, e); } else { handler.execute(e); } @@ -30693,44 +27652,41 @@ public Invoices updateOrCreateInvoices( } /** - * Updates or creates one or more sales invoices or purchase bills + * Updates or creates one or more contacts in a Xero organisation * - *

200 - Success - return response of type Invoices array with newly created Invoice + *

200 - Success - return response of type Contacts array with newly created Contact * - *

400 - A failed request due to validation error + *

400 - Validation Error - some data was incorrect returns response of type Error * * @param xeroTenantId Xero identifier for Tenant - * @param invoices The invoices parameter + * @param contacts The contacts parameter * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateOrCreateInvoicesForHttpResponse( + public HttpResponse updateOrCreateContactsForHttpResponse( String accessToken, String xeroTenantId, - Invoices invoices, + Contacts contacts, Boolean summarizeErrors, - Integer unitdp, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateOrCreateInvoices"); - } // verify the required parameter 'invoices' is set - if (invoices == null) { + "Missing the required parameter 'xeroTenantId' when calling updateOrCreateContacts"); + } // verify the required parameter 'contacts' is set + if (contacts == null) { throw new IllegalArgumentException( - "Missing the required parameter 'invoices' when calling updateOrCreateInvoices"); + "Missing the required parameter 'contacts' when calling updateOrCreateContacts"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateOrCreateInvoices"); + "Missing the required parameter 'accessToken' when calling updateOrCreateContacts"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -30738,7 +27694,7 @@ public HttpResponse updateOrCreateInvoicesForHttpResponse( headers.setAccept("application/json"); headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Contacts"); if (summarizeErrors != null) { String key = "summarizeErrors"; Object value = summarizeErrors; @@ -30759,26 +27715,6 @@ public HttpResponse updateOrCreateInvoicesForHttpResponse( uriBuilder = uriBuilder.queryParam(key, value); } } - if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { @@ -30786,7 +27722,7 @@ public HttpResponse updateOrCreateInvoicesForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(invoices); + content = apiClient.new JacksonJsonHttpContent(contacts); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -30801,14 +27737,15 @@ public HttpResponse updateOrCreateInvoicesForHttpResponse( } /** - * Updates or creates one or more items + * Updates or creates one or more credit notes * - *

200 - Success - return response of type Items array with newly created Item + *

200 - Success - return response of type Credit Notes array of newly created + * CreditNote * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param items The items parameter + * @param creditNotes an array of Credit Notes with a single CreditNote object. * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal @@ -30816,29 +27753,29 @@ public HttpResponse updateOrCreateInvoicesForHttpResponse( * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Items + * @return CreditNotes * @throws IOException if an error occurs while attempting to invoke the API * */ - public Items updateOrCreateItems( + public CreditNotes updateOrCreateCreditNotes( String accessToken, String xeroTenantId, - Items items, + CreditNotes creditNotes, Boolean summarizeErrors, Integer unitdp, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateOrCreateItemsForHttpResponse( - accessToken, xeroTenantId, items, summarizeErrors, unitdp, idempotencyKey); + updateOrCreateCreditNotesForHttpResponse( + accessToken, xeroTenantId, creditNotes, summarizeErrors, unitdp, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateOrCreateItems -------------------"); + + " : updateOrCreateCreditNotes -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -30848,9 +27785,9 @@ public Items updateOrCreateItems( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Items", object.getMessage(), e); + handler.validationError("CreditNotes", object.getMessage(), e); } - handler.validationError("Items", object, e); + handler.validationError("CreditNotes", object, e); } else { handler.execute(e); } @@ -30861,14 +27798,15 @@ public Items updateOrCreateItems( } /** - * Updates or creates one or more items + * Updates or creates one or more credit notes * - *

200 - Success - return response of type Items array with newly created Item + *

200 - Success - return response of type Credit Notes array of newly created + * CreditNote * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param items The items parameter + * @param creditNotes an array of Credit Notes with a single CreditNote object. * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal @@ -30879,10 +27817,10 @@ public Items updateOrCreateItems( * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateOrCreateItemsForHttpResponse( + public HttpResponse updateOrCreateCreditNotesForHttpResponse( String accessToken, String xeroTenantId, - Items items, + CreditNotes creditNotes, Boolean summarizeErrors, Integer unitdp, String idempotencyKey) @@ -30890,15 +27828,15 @@ public HttpResponse updateOrCreateItemsForHttpResponse( // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateOrCreateItems"); - } // verify the required parameter 'items' is set - if (items == null) { + "Missing the required parameter 'xeroTenantId' when calling updateOrCreateCreditNotes"); + } // verify the required parameter 'creditNotes' is set + if (creditNotes == null) { throw new IllegalArgumentException( - "Missing the required parameter 'items' when calling updateOrCreateItems"); + "Missing the required parameter 'creditNotes' when calling updateOrCreateCreditNotes"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateOrCreateItems"); + "Missing the required parameter 'accessToken' when calling updateOrCreateCreditNotes"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -30906,7 +27844,7 @@ public HttpResponse updateOrCreateItemsForHttpResponse( headers.setAccept("application/json"); headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CreditNotes"); if (summarizeErrors != null) { String key = "summarizeErrors"; Object value = summarizeErrors; @@ -30954,7 +27892,7 @@ public HttpResponse updateOrCreateItemsForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(items); + content = apiClient.new JacksonJsonHttpContent(creditNotes); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -30969,42 +27907,41 @@ public HttpResponse updateOrCreateItemsForHttpResponse( } /** - * Updates or creates a single manual journal + * Creates a single new employees used in Xero payrun * - *

200 - Success - return response of type ManualJournals array with newly created - * ManualJournal + *

200 - Success - return response of type Employees array with new Employee * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param manualJournals ManualJournals array with ManualJournal object in body of request + * @param employees Employees with array of Employee object in body of request * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return ManualJournals + * @return Employees * @throws IOException if an error occurs while attempting to invoke the API * */ - public ManualJournals updateOrCreateManualJournals( + public Employees updateOrCreateEmployees( String accessToken, String xeroTenantId, - ManualJournals manualJournals, + Employees employees, Boolean summarizeErrors, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateOrCreateManualJournalsForHttpResponse( - accessToken, xeroTenantId, manualJournals, summarizeErrors, idempotencyKey); + updateOrCreateEmployeesForHttpResponse( + accessToken, xeroTenantId, employees, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateOrCreateManualJournals -------------------"); + + " : updateOrCreateEmployees -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -31014,9 +27951,9 @@ public ManualJournals updateOrCreateManualJournals( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("ManualJournals", object.getMessage(), e); + handler.validationError("Employees", object.getMessage(), e); } - handler.validationError("ManualJournals", object, e); + handler.validationError("Employees", object, e); } else { handler.execute(e); } @@ -31027,15 +27964,14 @@ public ManualJournals updateOrCreateManualJournals( } /** - * Updates or creates a single manual journal + * Creates a single new employees used in Xero payrun * - *

200 - Success - return response of type ManualJournals array with newly created - * ManualJournal + *

200 - Success - return response of type Employees array with new Employee * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param manualJournals ManualJournals array with ManualJournal object in body of request + * @param employees Employees with array of Employee object in body of request * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate @@ -31044,27 +27980,25 @@ public ManualJournals updateOrCreateManualJournals( * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateOrCreateManualJournalsForHttpResponse( + public HttpResponse updateOrCreateEmployeesForHttpResponse( String accessToken, String xeroTenantId, - ManualJournals manualJournals, + Employees employees, Boolean summarizeErrors, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateOrCreateManualJournals"); - } // verify the required parameter 'manualJournals' is set - if (manualJournals == null) { + "Missing the required parameter 'xeroTenantId' when calling updateOrCreateEmployees"); + } // verify the required parameter 'employees' is set + if (employees == null) { throw new IllegalArgumentException( - "Missing the required parameter 'manualJournals' when calling" - + " updateOrCreateManualJournals"); + "Missing the required parameter 'employees' when calling updateOrCreateEmployees"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateOrCreateManualJournals"); + "Missing the required parameter 'accessToken' when calling updateOrCreateEmployees"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -31072,7 +28006,7 @@ public HttpResponse updateOrCreateManualJournalsForHttpResponse( headers.setAccept("application/json"); headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (summarizeErrors != null) { String key = "summarizeErrors"; Object value = summarizeErrors; @@ -31100,7 +28034,7 @@ public HttpResponse updateOrCreateManualJournalsForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(manualJournals); + content = apiClient.new JacksonJsonHttpContent(employees); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -31115,42 +28049,44 @@ public HttpResponse updateOrCreateManualJournalsForHttpResponse( } /** - * Updates or creates one or more purchase orders + * Updates or creates one or more sales invoices or purchase bills * - *

200 - Success - return response of type PurchaseOrder array for specified - * PurchaseOrder + *

200 - Success - return response of type Invoices array with newly created Invoice * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrders The purchaseOrders parameter + * @param invoices The invoices parameter * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return PurchaseOrders + * @return Invoices * @throws IOException if an error occurs while attempting to invoke the API * */ - public PurchaseOrders updateOrCreatePurchaseOrders( + public Invoices updateOrCreateInvoices( String accessToken, String xeroTenantId, - PurchaseOrders purchaseOrders, + Invoices invoices, Boolean summarizeErrors, + Integer unitdp, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateOrCreatePurchaseOrdersForHttpResponse( - accessToken, xeroTenantId, purchaseOrders, summarizeErrors, idempotencyKey); + updateOrCreateInvoicesForHttpResponse( + accessToken, xeroTenantId, invoices, summarizeErrors, unitdp, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateOrCreatePurchaseOrders -------------------"); + + " : updateOrCreateInvoices -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -31160,9 +28096,9 @@ public PurchaseOrders updateOrCreatePurchaseOrders( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("PurchaseOrders", object.getMessage(), e); + handler.validationError("Invoices", object.getMessage(), e); } - handler.validationError("PurchaseOrders", object, e); + handler.validationError("Invoices", object, e); } else { handler.execute(e); } @@ -31173,44 +28109,44 @@ public PurchaseOrders updateOrCreatePurchaseOrders( } /** - * Updates or creates one or more purchase orders + * Updates or creates one or more sales invoices or purchase bills * - *

200 - Success - return response of type PurchaseOrder array for specified - * PurchaseOrder + *

200 - Success - return response of type Invoices array with newly created Invoice * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrders The purchaseOrders parameter + * @param invoices The invoices parameter * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateOrCreatePurchaseOrdersForHttpResponse( + public HttpResponse updateOrCreateInvoicesForHttpResponse( String accessToken, String xeroTenantId, - PurchaseOrders purchaseOrders, + Invoices invoices, Boolean summarizeErrors, + Integer unitdp, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateOrCreatePurchaseOrders"); - } // verify the required parameter 'purchaseOrders' is set - if (purchaseOrders == null) { + "Missing the required parameter 'xeroTenantId' when calling updateOrCreateInvoices"); + } // verify the required parameter 'invoices' is set + if (invoices == null) { throw new IllegalArgumentException( - "Missing the required parameter 'purchaseOrders' when calling" - + " updateOrCreatePurchaseOrders"); + "Missing the required parameter 'invoices' when calling updateOrCreateInvoices"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateOrCreatePurchaseOrders"); + "Missing the required parameter 'accessToken' when calling updateOrCreateInvoices"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -31218,7 +28154,7 @@ public HttpResponse updateOrCreatePurchaseOrdersForHttpResponse( headers.setAccept("application/json"); headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Invoices"); if (summarizeErrors != null) { String key = "summarizeErrors"; Object value = summarizeErrors; @@ -31239,6 +28175,26 @@ public HttpResponse updateOrCreatePurchaseOrdersForHttpResponse( uriBuilder = uriBuilder.queryParam(key, value); } } + if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + List valueList = new ArrayList<>((Collection) value); + if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { + List list = new ArrayList(); + for (int i = 0; i < valueList.size(); i++) { + list.add(valueList.get(i).toString()); + } + uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); + } else { + uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); + } + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { @@ -31246,7 +28202,7 @@ public HttpResponse updateOrCreatePurchaseOrdersForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(purchaseOrders); + content = apiClient.new JacksonJsonHttpContent(invoices); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -31261,41 +28217,44 @@ public HttpResponse updateOrCreatePurchaseOrdersForHttpResponse( } /** - * Updates or creates one or more quotes + * Updates or creates one or more items * - *

200 - Success - return response of type Quotes array with updated or created Quote + *

200 - Success - return response of type Items array with newly created Item * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param quotes The quotes parameter + * @param items The items parameter * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Quotes + * @return Items * @throws IOException if an error occurs while attempting to invoke the API * */ - public Quotes updateOrCreateQuotes( + public Items updateOrCreateItems( String accessToken, String xeroTenantId, - Quotes quotes, + Items items, Boolean summarizeErrors, + Integer unitdp, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateOrCreateQuotesForHttpResponse( - accessToken, xeroTenantId, quotes, summarizeErrors, idempotencyKey); + updateOrCreateItemsForHttpResponse( + accessToken, xeroTenantId, items, summarizeErrors, unitdp, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateOrCreateQuotes -------------------"); + + " : updateOrCreateItems -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -31305,9 +28264,9 @@ public Quotes updateOrCreateQuotes( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Quotes", object.getMessage(), e); + handler.validationError("Items", object.getMessage(), e); } - handler.validationError("Quotes", object, e); + handler.validationError("Items", object, e); } else { handler.execute(e); } @@ -31318,41 +28277,44 @@ public Quotes updateOrCreateQuotes( } /** - * Updates or creates one or more quotes + * Updates or creates one or more items * - *

200 - Success - return response of type Quotes array with updated or created Quote + *

200 - Success - return response of type Items array with newly created Item * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param quotes The quotes parameter + * @param items The items parameter * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateOrCreateQuotesForHttpResponse( + public HttpResponse updateOrCreateItemsForHttpResponse( String accessToken, String xeroTenantId, - Quotes quotes, + Items items, Boolean summarizeErrors, + Integer unitdp, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateOrCreateQuotes"); - } // verify the required parameter 'quotes' is set - if (quotes == null) { + "Missing the required parameter 'xeroTenantId' when calling updateOrCreateItems"); + } // verify the required parameter 'items' is set + if (items == null) { throw new IllegalArgumentException( - "Missing the required parameter 'quotes' when calling updateOrCreateQuotes"); + "Missing the required parameter 'items' when calling updateOrCreateItems"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateOrCreateQuotes"); + "Missing the required parameter 'accessToken' when calling updateOrCreateItems"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -31360,7 +28322,7 @@ public HttpResponse updateOrCreateQuotesForHttpResponse( headers.setAccept("application/json"); headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Items"); if (summarizeErrors != null) { String key = "summarizeErrors"; Object value = summarizeErrors; @@ -31381,6 +28343,26 @@ public HttpResponse updateOrCreateQuotesForHttpResponse( uriBuilder = uriBuilder.queryParam(key, value); } } + if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + List valueList = new ArrayList<>((Collection) value); + if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { + List list = new ArrayList(); + for (int i = 0; i < valueList.size(); i++) { + list.add(valueList.get(i).toString()); + } + uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); + } else { + uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); + } + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { @@ -31388,7 +28370,7 @@ public HttpResponse updateOrCreateQuotesForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(quotes); + content = apiClient.new JacksonJsonHttpContent(items); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -31403,43 +28385,42 @@ public HttpResponse updateOrCreateQuotesForHttpResponse( } /** - * Creates or deletes one or more repeating invoice templates + * Updates or creates a single manual journal * - *

200 - Success - return response of type RepeatingInvoices array with newly created - * RepeatingInvoice + *

200 - Success - return response of type ManualJournals array with newly created + * ManualJournal * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoices RepeatingInvoices with an array of repeating invoice objects in body - * of request + * @param manualJournals ManualJournals array with ManualJournal object in body of request * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return RepeatingInvoices + * @return ManualJournals * @throws IOException if an error occurs while attempting to invoke the API * */ - public RepeatingInvoices updateOrCreateRepeatingInvoices( + public ManualJournals updateOrCreateManualJournals( String accessToken, String xeroTenantId, - RepeatingInvoices repeatingInvoices, + ManualJournals manualJournals, Boolean summarizeErrors, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateOrCreateRepeatingInvoicesForHttpResponse( - accessToken, xeroTenantId, repeatingInvoices, summarizeErrors, idempotencyKey); + updateOrCreateManualJournalsForHttpResponse( + accessToken, xeroTenantId, manualJournals, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateOrCreateRepeatingInvoices -------------------"); + + " : updateOrCreateManualJournals -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -31449,9 +28430,9 @@ public RepeatingInvoices updateOrCreateRepeatingInvoices( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("RepeatingInvoices", object.getMessage(), e); + handler.validationError("ManualJournals", object.getMessage(), e); } - handler.validationError("RepeatingInvoices", object, e); + handler.validationError("ManualJournals", object, e); } else { handler.execute(e); } @@ -31462,16 +28443,15 @@ public RepeatingInvoices updateOrCreateRepeatingInvoices( } /** - * Creates or deletes one or more repeating invoice templates + * Updates or creates a single manual journal * - *

200 - Success - return response of type RepeatingInvoices array with newly created - * RepeatingInvoice + *

200 - Success - return response of type ManualJournals array with newly created + * ManualJournal * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoices RepeatingInvoices with an array of repeating invoice objects in body - * of request + * @param manualJournals ManualJournals array with ManualJournal object in body of request * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate @@ -31480,10 +28460,10 @@ public RepeatingInvoices updateOrCreateRepeatingInvoices( * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateOrCreateRepeatingInvoicesForHttpResponse( + public HttpResponse updateOrCreateManualJournalsForHttpResponse( String accessToken, String xeroTenantId, - RepeatingInvoices repeatingInvoices, + ManualJournals manualJournals, Boolean summarizeErrors, String idempotencyKey) throws IOException { @@ -31491,17 +28471,16 @@ public HttpResponse updateOrCreateRepeatingInvoicesForHttpResponse( if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " updateOrCreateRepeatingInvoices"); - } // verify the required parameter 'repeatingInvoices' is set - if (repeatingInvoices == null) { + + " updateOrCreateManualJournals"); + } // verify the required parameter 'manualJournals' is set + if (manualJournals == null) { throw new IllegalArgumentException( - "Missing the required parameter 'repeatingInvoices' when calling" - + " updateOrCreateRepeatingInvoices"); + "Missing the required parameter 'manualJournals' when calling" + + " updateOrCreateManualJournals"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateOrCreateRepeatingInvoices"); + "Missing the required parameter 'accessToken' when calling updateOrCreateManualJournals"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -31509,7 +28488,7 @@ public HttpResponse updateOrCreateRepeatingInvoicesForHttpResponse( headers.setAccept("application/json"); headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/ManualJournals"); if (summarizeErrors != null) { String key = "summarizeErrors"; Object value = summarizeErrors; @@ -31537,7 +28516,7 @@ public HttpResponse updateOrCreateRepeatingInvoicesForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(repeatingInvoices); + content = apiClient.new JacksonJsonHttpContent(manualJournals); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -31552,40 +28531,42 @@ public HttpResponse updateOrCreateRepeatingInvoicesForHttpResponse( } /** - * Updates a specific purchase order + * Updates or creates one or more purchase orders * - *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder + *

200 - Success - return response of type PurchaseOrder array for specified + * PurchaseOrder * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order * @param purchaseOrders The purchaseOrders parameter + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API * */ - public PurchaseOrders updatePurchaseOrder( + public PurchaseOrders updateOrCreatePurchaseOrders( String accessToken, String xeroTenantId, - UUID purchaseOrderID, PurchaseOrders purchaseOrders, + Boolean summarizeErrors, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updatePurchaseOrderForHttpResponse( - accessToken, xeroTenantId, purchaseOrderID, purchaseOrders, idempotencyKey); + updateOrCreatePurchaseOrdersForHttpResponse( + accessToken, xeroTenantId, purchaseOrders, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updatePurchaseOrder -------------------"); + + " : updateOrCreatePurchaseOrders -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -31608,44 +28589,44 @@ public PurchaseOrders updatePurchaseOrder( } /** - * Updates a specific purchase order + * Updates or creates one or more purchase orders * - *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder + *

200 - Success - return response of type PurchaseOrder array for specified + * PurchaseOrder * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order * @param purchaseOrders The purchaseOrders parameter + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updatePurchaseOrderForHttpResponse( + public HttpResponse updateOrCreatePurchaseOrdersForHttpResponse( String accessToken, String xeroTenantId, - UUID purchaseOrderID, PurchaseOrders purchaseOrders, + Boolean summarizeErrors, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); - } // verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); + "Missing the required parameter 'xeroTenantId' when calling" + + " updateOrCreatePurchaseOrders"); } // verify the required parameter 'purchaseOrders' is set if (purchaseOrders == null) { throw new IllegalArgumentException( - "Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); + "Missing the required parameter 'purchaseOrders' when calling" + + " updateOrCreatePurchaseOrders"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updatePurchaseOrder"); + "Missing the required parameter 'accessToken' when calling updateOrCreatePurchaseOrders"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -31653,13 +28634,28 @@ public HttpResponse updatePurchaseOrderForHttpResponse( headers.setAccept("application/json"); headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders"); + if (summarizeErrors != null) { + String key = "summarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + List valueList = new ArrayList<>((Collection) value); + if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { + List list = new ArrayList(); + for (int i = 0; i < valueList.size(); i++) { + list.add(valueList.get(i).toString()); + } + uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); + } else { + uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); + } + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); @@ -31680,51 +28676,57 @@ public HttpResponse updatePurchaseOrderForHttpResponse( .execute(); } - // Overload params for updatePurchaseOrderAttachmentByFileName to allow byte[] or File type to be - // passed as body /** - * Updates a specific attachment for a specific purchase order by filename + * Updates or creates one or more quotes * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type Quotes array with updated or created Quote * - *

400 - Validation Error - some data was incorrect returns response of type Error + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param quotes The quotes parameter + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @return Quotes + * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updatePurchaseOrderAttachmentByFileName( + public Quotes updateOrCreateQuotes( String accessToken, String xeroTenantId, - UUID purchaseOrderID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + Quotes quotes, + Boolean summarizeErrors, + String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updatePurchaseOrderAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey, mimeType); + updateOrCreateQuotesForHttpResponse( + accessToken, xeroTenantId, quotes, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updatePurchaseOrderAttachmentByFileName -------------------"); + + " : updateOrCreateQuotes -------------------"); logger.debug(e.toString()); } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Quotes", object.getMessage(), e); + } + handler.validationError("Quotes", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -31732,81 +28734,78 @@ public Attachments updatePurchaseOrderAttachmentByFileName( } /** - * Updates a specific attachment for a specific purchase order by filename + * Updates or creates one or more quotes * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type Quotes array with updated or created Quote * - *

400 - Validation Error - some data was incorrect returns response of type Error + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param quotes The quotes parameter + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updatePurchaseOrderAttachmentByFileNameForHttpResponse( + public HttpResponse updateOrCreateQuotesForHttpResponse( String accessToken, String xeroTenantId, - UUID purchaseOrderID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + Quotes quotes, + Boolean summarizeErrors, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updatePurchaseOrderAttachmentByFileName"); - } // verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'purchaseOrderID' when calling" - + " updatePurchaseOrderAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updatePurchaseOrderAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'xeroTenantId' when calling updateOrCreateQuotes"); + } // verify the required parameter 'quotes' is set + if (quotes == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " updatePurchaseOrderAttachmentByFileName"); + "Missing the required parameter 'quotes' when calling updateOrCreateQuotes"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updatePurchaseOrderAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling updateOrCreateQuotes"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes"); + if (summarizeErrors != null) { + String key = "summarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + List valueList = new ArrayList<>((Collection) value); + if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { + List list = new ArrayList(); + for (int i = 0; i < valueList.size(); i++) { + list.add(valueList.get(i).toString()); + } + uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); + } else { + uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); + } + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(quotes); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -31820,42 +28819,43 @@ public HttpResponse updatePurchaseOrderAttachmentByFileNameForHttpResponse( } /** - * Updates a specific attachment for a specific purchase order by filename + * Creates or deletes one or more repeating invoice templates * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type RepeatingInvoices array with newly created + * RepeatingInvoice * - *

400 - Validation Error - some data was incorrect returns response of type Error + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param repeatingInvoices RepeatingInvoices with an array of repeating invoice objects in body + * of request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return RepeatingInvoices * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updatePurchaseOrderAttachmentByFileName( + public RepeatingInvoices updateOrCreateRepeatingInvoices( String accessToken, String xeroTenantId, - UUID purchaseOrderID, - String fileName, - File body, + RepeatingInvoices repeatingInvoices, + Boolean summarizeErrors, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updatePurchaseOrderAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey); + updateOrCreateRepeatingInvoicesForHttpResponse( + accessToken, xeroTenantId, repeatingInvoices, summarizeErrors, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updatePurchaseOrderAttachmentByFileName -------------------"); + + " : updateOrCreateRepeatingInvoices -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -31865,9 +28865,9 @@ public Attachments updatePurchaseOrderAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("RepeatingInvoices", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("RepeatingInvoices", object, e); } else { handler.execute(e); } @@ -31878,79 +28878,83 @@ public Attachments updatePurchaseOrderAttachmentByFileName( } /** - * Updates a specific attachment for a specific purchase order by filename + * Creates or deletes one or more repeating invoice templates * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type RepeatingInvoices array with newly created + * RepeatingInvoice * - *

400 - Validation Error - some data was incorrect returns response of type Error + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param purchaseOrderID Unique identifier for an Purchase Order - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param repeatingInvoices RepeatingInvoices with an array of repeating invoice objects in body + * of request + * @param summarizeErrors If false return 200 OK and mix of successfully created objects and any + * with validation errors * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updatePurchaseOrderAttachmentByFileNameForHttpResponse( + public HttpResponse updateOrCreateRepeatingInvoicesForHttpResponse( String accessToken, String xeroTenantId, - UUID purchaseOrderID, - String fileName, - File body, + RepeatingInvoices repeatingInvoices, + Boolean summarizeErrors, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " updatePurchaseOrderAttachmentByFileName"); - } // verify the required parameter 'purchaseOrderID' is set - if (purchaseOrderID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'purchaseOrderID' when calling" - + " updatePurchaseOrderAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updatePurchaseOrderAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + + " updateOrCreateRepeatingInvoices"); + } // verify the required parameter 'repeatingInvoices' is set + if (repeatingInvoices == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " updatePurchaseOrderAttachmentByFileName"); + "Missing the required parameter 'repeatingInvoices' when calling" + + " updateOrCreateRepeatingInvoices"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " updatePurchaseOrderAttachmentByFileName"); + + " updateOrCreateRepeatingInvoices"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("PurchaseOrderID", purchaseOrderID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/RepeatingInvoices"); + if (summarizeErrors != null) { + String key = "summarizeErrors"; + Object value = summarizeErrors; + if (value instanceof Collection) { + List valueList = new ArrayList<>((Collection) value); + if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { + List list = new ArrayList(); + for (int i = 0; i < valueList.size(); i++) { + list.add(valueList.get(i).toString()); + } + uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); + } else { + uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); + } + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + String url = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(repeatingInvoices); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -31964,35 +28968,40 @@ public HttpResponse updatePurchaseOrderAttachmentByFileNameForHttpResponse( } /** - * Updates a specific quote + * Updates a specific purchase order * - *

200 - Success - return response of type Quotes array with updated Quote + *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param quoteID Unique identifier for an Quote - * @param quotes The quotes parameter + * @param purchaseOrderID Unique identifier for an Purchase Order + * @param purchaseOrders The purchaseOrders parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Quotes + * @return PurchaseOrders * @throws IOException if an error occurs while attempting to invoke the API * */ - public Quotes updateQuote( - String accessToken, String xeroTenantId, UUID quoteID, Quotes quotes, String idempotencyKey) + public PurchaseOrders updatePurchaseOrder( + String accessToken, + String xeroTenantId, + UUID purchaseOrderID, + PurchaseOrders purchaseOrders, + String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateQuoteForHttpResponse(accessToken, xeroTenantId, quoteID, quotes, idempotencyKey); + updatePurchaseOrderForHttpResponse( + accessToken, xeroTenantId, purchaseOrderID, purchaseOrders, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateQuote -------------------"); + + " : updatePurchaseOrder -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -32002,9 +29011,9 @@ public Quotes updateQuote( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Quotes", object.getMessage(), e); + handler.validationError("PurchaseOrders", object.getMessage(), e); } - handler.validationError("Quotes", object, e); + handler.validationError("PurchaseOrders", object, e); } else { handler.execute(e); } @@ -32015,40 +29024,44 @@ public Quotes updateQuote( } /** - * Updates a specific quote + * Updates a specific purchase order * - *

200 - Success - return response of type Quotes array with updated Quote + *

200 - Success - return response of type PurchaseOrder array for updated PurchaseOrder * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant - * @param quoteID Unique identifier for an Quote - * @param quotes The quotes parameter + * @param purchaseOrderID Unique identifier for an Purchase Order + * @param purchaseOrders The purchaseOrders parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateQuoteForHttpResponse( - String accessToken, String xeroTenantId, UUID quoteID, Quotes quotes, String idempotencyKey) + public HttpResponse updatePurchaseOrderForHttpResponse( + String accessToken, + String xeroTenantId, + UUID purchaseOrderID, + PurchaseOrders purchaseOrders, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateQuote"); - } // verify the required parameter 'quoteID' is set - if (quoteID == null) { + "Missing the required parameter 'xeroTenantId' when calling updatePurchaseOrder"); + } // verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'quoteID' when calling updateQuote"); - } // verify the required parameter 'quotes' is set - if (quotes == null) { + "Missing the required parameter 'purchaseOrderID' when calling updatePurchaseOrder"); + } // verify the required parameter 'purchaseOrders' is set + if (purchaseOrders == null) { throw new IllegalArgumentException( - "Missing the required parameter 'quotes' when calling updateQuote"); + "Missing the required parameter 'purchaseOrders' when calling updatePurchaseOrder"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateQuote"); + "Missing the required parameter 'accessToken' when calling updatePurchaseOrder"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -32058,9 +29071,10 @@ public HttpResponse updateQuoteForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("QuoteID", quoteID); + uriVariables.put("PurchaseOrderID", purchaseOrderID); - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes/{QuoteID}"); + UriBuilder uriBuilder = + UriBuilder.fromUri(apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { @@ -32068,7 +29082,7 @@ public HttpResponse updateQuoteForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(quotes); + content = apiClient.new JacksonJsonHttpContent(purchaseOrders); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -32082,51 +29096,58 @@ public HttpResponse updateQuoteForHttpResponse( .execute(); } - // Overload params for updateQuoteAttachmentByFileName to allow byte[] or File type to be passed - // as body /** - * Updates a specific attachment from a specific quote by filename + * Updates a specific attachment for a specific purchase order by filename * *

200 - Success - return response of type Attachments array of Attachment * *

400 - Validation Error - some data was incorrect returns response of type Error * * @param xeroTenantId Xero identifier for Tenant - * @param quoteID Unique identifier for an Quote + * @param purchaseOrderID Unique identifier for an Purchase Order * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateQuoteAttachmentByFileName( + public Attachments updatePurchaseOrderAttachmentByFileName( String accessToken, String xeroTenantId, - UUID quoteID, + UUID purchaseOrderID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateQuoteAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey, mimeType); + updatePurchaseOrderAttachmentByFileNameForHttpResponse( + accessToken, xeroTenantId, purchaseOrderID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateQuoteAttachmentByFileName -------------------"); + + " : updatePurchaseOrderAttachmentByFileName -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Attachments", object.getMessage(), e); + } + handler.validationError("Attachments", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -32134,54 +29155,55 @@ public Attachments updateQuoteAttachmentByFileName( } /** - * Updates a specific attachment from a specific quote by filename + * Updates a specific attachment for a specific purchase order by filename * *

200 - Success - return response of type Attachments array of Attachment * *

400 - Validation Error - some data was incorrect returns response of type Error * * @param xeroTenantId Xero identifier for Tenant - * @param quoteID Unique identifier for an Quote + * @param purchaseOrderID Unique identifier for an Purchase Order * @param fileName Name of the attachment * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateQuoteAttachmentByFileNameForHttpResponse( + public HttpResponse updatePurchaseOrderAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, - UUID quoteID, + UUID purchaseOrderID, String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + File body, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" - + " updateQuoteAttachmentByFileName"); - } // verify the required parameter 'quoteID' is set - if (quoteID == null) { + + " updatePurchaseOrderAttachmentByFileName"); + } // verify the required parameter 'purchaseOrderID' is set + if (purchaseOrderID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'quoteID' when calling updateQuoteAttachmentByFileName"); + "Missing the required parameter 'purchaseOrderID' when calling" + + " updatePurchaseOrderAttachmentByFileName"); } // verify the required parameter 'fileName' is set if (fileName == null) { throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling updateQuoteAttachmentByFileName"); + "Missing the required parameter 'fileName' when calling" + + " updatePurchaseOrderAttachmentByFileName"); } // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling updateQuoteAttachmentByFileName"); + "Missing the required parameter 'body' when calling" + + " updatePurchaseOrderAttachmentByFileName"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" - + " updateQuoteAttachmentByFileName"); + + " updatePurchaseOrderAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); @@ -32191,20 +29213,21 @@ public HttpResponse updateQuoteAttachmentByFileNameForHttpResponse( headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); - uriVariables.put("QuoteID", quoteID); + uriVariables.put("PurchaseOrderID", purchaseOrderID); uriVariables.put("FileName", fileName); UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes/{QuoteID}/Attachments/{FileName}"); + UriBuilder.fromUri( + apiClient.getBasePath() + "/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(body); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -32218,42 +29241,35 @@ public HttpResponse updateQuoteAttachmentByFileNameForHttpResponse( } /** - * Updates a specific attachment from a specific quote by filename + * Updates a specific quote * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type Quotes array with updated Quote * - *

400 - Validation Error - some data was incorrect returns response of type Error + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param quoteID Unique identifier for an Quote - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param quotes The quotes parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Attachments + * @return Quotes * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateQuoteAttachmentByFileName( - String accessToken, - String xeroTenantId, - UUID quoteID, - String fileName, - File body, - String idempotencyKey) + public Quotes updateQuote( + String accessToken, String xeroTenantId, UUID quoteID, Quotes quotes, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateQuoteAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey); + updateQuoteForHttpResponse(accessToken, xeroTenantId, quoteID, quotes, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateQuoteAttachmentByFileName -------------------"); + + " : updateQuote -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -32263,9 +29279,9 @@ public Attachments updateQuoteAttachmentByFileName( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Attachments", object.getMessage(), e); + handler.validationError("Quotes", object.getMessage(), e); } - handler.validationError("Attachments", object, e); + handler.validationError("Quotes", object, e); } else { handler.execute(e); } @@ -32276,75 +29292,61 @@ public Attachments updateQuoteAttachmentByFileName( } /** - * Updates a specific attachment from a specific quote by filename + * Updates a specific quote * - *

200 - Success - return response of type Attachments array of Attachment + *

200 - Success - return response of type Quotes array with updated Quote * - *

400 - Validation Error - some data was incorrect returns response of type Error + *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param quoteID Unique identifier for an Quote - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param quotes The quotes parameter * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateQuoteAttachmentByFileNameForHttpResponse( - String accessToken, - String xeroTenantId, - UUID quoteID, - String fileName, - File body, - String idempotencyKey) + public HttpResponse updateQuoteForHttpResponse( + String accessToken, String xeroTenantId, UUID quoteID, Quotes quotes, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateQuoteAttachmentByFileName"); + "Missing the required parameter 'xeroTenantId' when calling updateQuote"); } // verify the required parameter 'quoteID' is set if (quoteID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'quoteID' when calling updateQuoteAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling updateQuoteAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'quoteID' when calling updateQuote"); + } // verify the required parameter 'quotes' is set + if (quotes == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling updateQuoteAttachmentByFileName"); + "Missing the required parameter 'quotes' when calling updateQuote"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateQuoteAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling updateQuote"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("QuoteID", quoteID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = - UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes/{QuoteID}/Attachments/{FileName}"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes/{QuoteID}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(quotes); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -32358,43 +29360,42 @@ public HttpResponse updateQuoteAttachmentByFileNameForHttpResponse( } /** - * Updates a specific draft expense claim receipts + * Updates a specific attachment from a specific quote by filename * - *

200 - Success - return response of type Receipts array for updated Receipt + *

200 - Success - return response of type Attachments array of Attachment * - *

400 - A failed request due to validation error + *

400 - Validation Error - some data was incorrect returns response of type Error * * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param receipts The receipts parameter - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts + * @param quoteID Unique identifier for an Quote + * @param fileName Name of the attachment + * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request - * @return Receipts + * @return Attachments * @throws IOException if an error occurs while attempting to invoke the API * */ - public Receipts updateReceipt( + public Attachments updateQuoteAttachmentByFileName( String accessToken, String xeroTenantId, - UUID receiptID, - Receipts receipts, - Integer unitdp, + UUID quoteID, + String fileName, + File body, String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateReceiptForHttpResponse( - accessToken, xeroTenantId, receiptID, receipts, unitdp, idempotencyKey); + updateQuoteAttachmentByFileNameForHttpResponse( + accessToken, xeroTenantId, quoteID, fileName, body, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateReceipt -------------------"); + + " : updateQuoteAttachmentByFileName -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); @@ -32404,9 +29405,9 @@ public Receipts updateReceipt( com.xero.models.accounting.Error object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); if (object.getElements() == null || object.getElements().isEmpty()) { - handler.validationError("Receipts", object.getMessage(), e); + handler.validationError("Attachments", object.getMessage(), e); } - handler.validationError("Receipts", object, e); + handler.validationError("Attachments", object, e); } else { handler.execute(e); } @@ -32417,79 +29418,66 @@ public Receipts updateReceipt( } /** - * Updates a specific draft expense claim receipts + * Updates a specific attachment from a specific quote by filename * - *

200 - Success - return response of type Receipts array for updated Receipt + *

200 - Success - return response of type Attachments array of Attachment * - *

400 - A failed request due to validation error + *

400 - Validation Error - some data was incorrect returns response of type Error * * @param xeroTenantId Xero identifier for Tenant - * @param receiptID Unique identifier for a Receipt - * @param receipts The receipts parameter - * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal - * places for unit amounts + * @param quoteID Unique identifier for an Quote + * @param fileName Name of the attachment + * @param body Byte array of file in body of request * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. * @param accessToken Authorization token for user set in header of each request * @return HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateReceiptForHttpResponse( + public HttpResponse updateQuoteAttachmentByFileNameForHttpResponse( String accessToken, String xeroTenantId, - UUID receiptID, - Receipts receipts, - Integer unitdp, + UUID quoteID, + String fileName, + File body, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling updateReceipt"); - } // verify the required parameter 'receiptID' is set - if (receiptID == null) { + "Missing the required parameter 'xeroTenantId' when calling" + + " updateQuoteAttachmentByFileName"); + } // verify the required parameter 'quoteID' is set + if (quoteID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'receiptID' when calling updateReceipt"); - } // verify the required parameter 'receipts' is set - if (receipts == null) { + "Missing the required parameter 'quoteID' when calling updateQuoteAttachmentByFileName"); + } // verify the required parameter 'fileName' is set + if (fileName == null) { throw new IllegalArgumentException( - "Missing the required parameter 'receipts' when calling updateReceipt"); + "Missing the required parameter 'fileName' when calling updateQuoteAttachmentByFileName"); + } // verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException( + "Missing the required parameter 'body' when calling updateQuoteAttachmentByFileName"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling updateReceipt"); + "Missing the required parameter 'accessToken' when calling" + + " updateQuoteAttachmentByFileName"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/json"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("ReceiptID", receiptID); - - UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); - if (unitdp != null) { - String key = "unitdp"; - Object value = unitdp; - if (value instanceof Collection) { - List valueList = new ArrayList<>((Collection) value); - if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { - List list = new ArrayList(); - for (int i = 0; i < valueList.size(); i++) { - list.add(valueList.get(i).toString()); - } - uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); - } else { - uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); - } - } else if (value instanceof Object[]) { - uriBuilder = uriBuilder.queryParam(key, (Object[]) value); - } else { - uriBuilder = uriBuilder.queryParam(key, value); - } - } + headers.set("Idempotency-Key", idempotencyKey); + headers.setAccept("application/json"); + headers.setContentType("application/octet-stream"); + headers.setUserAgent(this.getUserAgent()); + // create a map of path variables + final Map uriVariables = new HashMap(); + uriVariables.put("QuoteID", quoteID); + uriVariables.put("FileName", fileName); + + UriBuilder uriBuilder = + UriBuilder.fromUri(apiClient.getBasePath() + "/Quotes/{QuoteID}/Attachments/{FileName}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { @@ -32497,7 +29485,7 @@ public HttpResponse updateReceiptForHttpResponse( } HttpContent content = null; - content = apiClient.new JacksonJsonHttpContent(receipts); + content = apiClient.new JacksonJsonHttpContent(body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); @@ -32511,52 +29499,59 @@ public HttpResponse updateReceiptForHttpResponse( .execute(); } - // Overload params for updateReceiptAttachmentByFileName to allow byte[] or File type to be passed - // as body /** - * Updates a specific attachment on a specific expense claim receipts by file name + * Updates a specific draft expense claim receipts * - *

200 - Success - return response of type Attachments array with updated Attachment for - * a specified Receipt + *

200 - Success - return response of type Receipts array for updated Receipt * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param receipts The receipts parameter + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API + * @return Receipts + * @throws IOException if an error occurs while attempting to invoke the API * */ - public Attachments updateReceiptAttachmentByFileName( + public Receipts updateReceipt( String accessToken, String xeroTenantId, UUID receiptID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + Receipts receipts, + Integer unitdp, + String idempotencyKey) throws IOException { try { - TypeReference typeRef = new TypeReference() {}; + TypeReference typeRef = new TypeReference() {}; HttpResponse response = - updateReceiptAttachmentByFileNameForHttpResponse( - accessToken, xeroTenantId, receiptID, fileName, body, idempotencyKey, mimeType); + updateReceiptForHttpResponse( + accessToken, xeroTenantId, receiptID, receipts, unitdp, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() - + " : updateReceiptAttachmentByFileName -------------------"); + + " : updateReceipt -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); + if (e.getStatusCode() == 400) { + TypeReference errorTypeRef = + new TypeReference() {}; + com.xero.models.accounting.Error object = + apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); + if (object.getElements() == null || object.getElements().isEmpty()) { + handler.validationError("Receipts", object.getMessage(), e); + } + handler.validationError("Receipts", object, e); + } else { + handler.execute(e); + } } catch (IOException ioe) { throw ioe; } @@ -32564,81 +29559,88 @@ public Attachments updateReceiptAttachmentByFileName( } /** - * Updates a specific attachment on a specific expense claim receipts by file name + * Updates a specific draft expense claim receipts * - *

200 - Success - return response of type Attachments array with updated Attachment for - * a specified Receipt + *

200 - Success - return response of type Receipts array for updated Receipt * *

400 - A failed request due to validation error * * @param xeroTenantId Xero identifier for Tenant * @param receiptID Unique identifier for a Receipt - * @param fileName Name of the attachment - * @param body Byte array of file in body of request + * @param receipts The receipts parameter + * @param unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal + * places for unit amounts * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate * processing. 128 character max. - * @param mimeType The type of file being attached * @param accessToken Authorization token for user set in header of each request * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * + * @throws IOException if an error occurs while attempting to invoke the API */ - public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( + public HttpResponse updateReceiptForHttpResponse( String accessToken, String xeroTenantId, UUID receiptID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) + Receipts receipts, + Integer unitdp, + String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateReceiptAttachmentByFileName"); + "Missing the required parameter 'xeroTenantId' when calling updateReceipt"); } // verify the required parameter 'receiptID' is set if (receiptID == null) { throw new IllegalArgumentException( - "Missing the required parameter 'receiptID' when calling" - + " updateReceiptAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updateReceiptAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { + "Missing the required parameter 'receiptID' when calling updateReceipt"); + } // verify the required parameter 'receipts' is set + if (receipts == null) { throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling updateReceiptAttachmentByFileName"); + "Missing the required parameter 'receipts' when calling updateReceipt"); } if (accessToken == null) { throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateReceiptAttachmentByFileName"); + "Missing the required parameter 'accessToken' when calling updateReceipt"); } HttpHeaders headers = new HttpHeaders(); headers.set("xero-tenant-id", xeroTenantId); headers.set("Idempotency-Key", idempotencyKey); headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); + headers.setContentType("application/json"); headers.setUserAgent(this.getUserAgent()); // create a map of path variables final Map uriVariables = new HashMap(); uriVariables.put("ReceiptID", receiptID); - uriVariables.put("FileName", fileName); - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() + "/Receipts/{ReceiptID}/Attachments/{FileName}"); + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Receipts/{ReceiptID}"); + if (unitdp != null) { + String key = "unitdp"; + Object value = unitdp; + if (value instanceof Collection) { + List valueList = new ArrayList<>((Collection) value); + if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) { + List list = new ArrayList(); + for (int i = 0; i < valueList.size(); i++) { + list.add(valueList.get(i).toString()); + } + uriBuilder = uriBuilder.queryParam(key, String.join(",", list)); + } else { + uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList)); + } + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - ByteArrayContent content = null; + HttpContent content = null; + content = apiClient.new JacksonJsonHttpContent(receipts); - content = new ByteArrayContent(mimeType, body); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -32780,10 +29782,10 @@ public HttpResponse updateReceiptAttachmentByFileNameForHttpResponse( if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(body); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); @@ -32926,154 +29928,6 @@ public HttpResponse updateRepeatingInvoiceForHttpResponse( .execute(); } - // Overload params for updateRepeatingInvoiceAttachmentByFileName to allow byte[] or File type to - // be passed as body - /** - * Updates a specific attachment from a specific repeating invoices by file name - * - *

200 - Success - return response of type Attachments array with specified Attachment - * for a specified Repeating Invoice - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param mimeType The type of file being attached - * @param accessToken Authorization token for user set in header of each request - * @return Attachments - * @throws IOException if an error occurs while attempting to invoke the API - */ - public Attachments updateRepeatingInvoiceAttachmentByFileName( - String accessToken, - String xeroTenantId, - UUID repeatingInvoiceID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) - throws IOException { - try { - TypeReference typeRef = new TypeReference() {}; - HttpResponse response = - updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( - accessToken, - xeroTenantId, - repeatingInvoiceID, - fileName, - body, - idempotencyKey, - mimeType); - return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); - } catch (HttpResponseException e) { - if (logger.isDebugEnabled()) { - logger.debug( - "------------------ HttpResponseException " - + e.getStatusCode() - + " : updateRepeatingInvoiceAttachmentByFileName -------------------"); - logger.debug(e.toString()); - } - XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); - handler.execute(e); - } catch (IOException ioe) { - throw ioe; - } - return null; - } - - /** - * Updates a specific attachment from a specific repeating invoices by file name - * - *

200 - Success - return response of type Attachments array with specified Attachment - * for a specified Repeating Invoice - * - *

400 - A failed request due to validation error - * - * @param xeroTenantId Xero identifier for Tenant - * @param repeatingInvoiceID Unique identifier for a Repeating Invoice - * @param fileName Name of the attachment - * @param body Byte array of file in body of request - * @param idempotencyKey This allows you to safely retry requests without the risk of duplicate - * processing. 128 character max. - * @param mimeType The type of file being attached - * @param accessToken Authorization token for user set in header of each request - * @return HttpResponse - * @throws IOException if an error occurs while attempting to invoke the API * - */ - public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( - String accessToken, - String xeroTenantId, - UUID repeatingInvoiceID, - String fileName, - byte[] body, - String idempotencyKey, - String mimeType) - throws IOException { - // verify the required parameter 'xeroTenantId' is set - if (xeroTenantId == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'xeroTenantId' when calling" - + " updateRepeatingInvoiceAttachmentByFileName"); - } // verify the required parameter 'repeatingInvoiceID' is set - if (repeatingInvoiceID == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'repeatingInvoiceID' when calling" - + " updateRepeatingInvoiceAttachmentByFileName"); - } // verify the required parameter 'fileName' is set - if (fileName == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'fileName' when calling" - + " updateRepeatingInvoiceAttachmentByFileName"); - } // verify the required parameter 'body' is set - if (body == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'body' when calling" - + " updateRepeatingInvoiceAttachmentByFileName"); - } - if (accessToken == null) { - throw new IllegalArgumentException( - "Missing the required parameter 'accessToken' when calling" - + " updateRepeatingInvoiceAttachmentByFileName"); - } - HttpHeaders headers = new HttpHeaders(); - headers.set("xero-tenant-id", xeroTenantId); - headers.set("Idempotency-Key", idempotencyKey); - headers.setAccept("application/json"); - headers.setContentType("application/octet-stream"); - headers.setUserAgent(this.getUserAgent()); - // create a map of path variables - final Map uriVariables = new HashMap(); - uriVariables.put("RepeatingInvoiceID", repeatingInvoiceID); - uriVariables.put("FileName", fileName); - - UriBuilder uriBuilder = - UriBuilder.fromUri( - apiClient.getBasePath() - + "/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"); - String url = uriBuilder.buildFromMap(uriVariables).toString(); - GenericUrl genericUrl = new GenericUrl(url); - if (logger.isDebugEnabled()) { - logger.debug("POST " + genericUrl.toString()); - } - - ByteArrayContent content = null; - - content = new ByteArrayContent(mimeType, body); - Credential credential = - new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); - HttpTransport transport = apiClient.getHttpTransport(); - HttpRequestFactory requestFactory = transport.createRequestFactory(credential); - return requestFactory - .buildRequest(HttpMethods.POST, genericUrl, content) - .setHeaders(headers) - .setConnectTimeout(apiClient.getConnectionTimeout()) - .setReadTimeout(apiClient.getReadTimeout()) - .execute(); - } - /** * Updates a specific attachment from a specific repeating invoices by file name * @@ -33205,10 +30059,10 @@ public HttpResponse updateRepeatingInvoiceAttachmentByFileNameForHttpResponse( if (logger.isDebugEnabled()) { logger.debug("POST " + genericUrl.toString()); } - java.nio.file.Path bodyPath = body.toPath(); - String mimeType = java.nio.file.Files.probeContentType(bodyPath); + HttpContent content = null; - content = new FileContent(mimeType, body); + content = apiClient.new JacksonJsonHttpContent(body); + Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); diff --git a/src/main/java/com/xero/models/payrollnz/Employee.java b/src/main/java/com/xero/models/payrollnz/Employee.java index 50d4c3cc3..551bd7aaf 100644 --- a/src/main/java/com/xero/models/payrollnz/Employee.java +++ b/src/main/java/com/xero/models/payrollnz/Employee.java @@ -212,7 +212,7 @@ public Employee firstName(String firstName) { * * @return firstName */ - @ApiModelProperty(example = "Karen", value = "First name of employee") + @ApiModelProperty(example = "Karen", required = true, value = "First name of employee") /** * First name of employee * @@ -247,7 +247,7 @@ public Employee lastName(String lastName) { * * @return lastName */ - @ApiModelProperty(example = "Jones", value = "Last name of employee") + @ApiModelProperty(example = "Jones", required = true, value = "Last name of employee") /** * Last name of employee * @@ -284,6 +284,7 @@ public Employee dateOfBirth(LocalDate dateOfBirth) { */ @ApiModelProperty( example = "Wed Jan 02 00:00:00 UTC 2019", + required = true, value = "Date of birth of the employee (YYYY-MM-DD)") /** * Date of birth of the employee (YYYY-MM-DD) @@ -319,7 +320,7 @@ public Employee address(Address address) { * * @return address */ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") /** * address * diff --git a/src/main/java/com/xero/models/payrollnz/Employment.java b/src/main/java/com/xero/models/payrollnz/Employment.java index 073a135aa..60f641ace 100644 --- a/src/main/java/com/xero/models/payrollnz/Employment.java +++ b/src/main/java/com/xero/models/payrollnz/Employment.java @@ -52,7 +52,9 @@ public Employment payrollCalendarID(UUID payrollCalendarID) { * * @return payrollCalendarID */ - @ApiModelProperty(value = "Xero unique identifier for the payroll calendar of the employee") + @ApiModelProperty( + required = true, + value = "Xero unique identifier for the payroll calendar of the employee") /** * Xero unique identifier for the payroll calendar of the employee * @@ -125,7 +127,7 @@ public Employment startDate(LocalDate startDate) { * * @return startDate */ - @ApiModelProperty(value = "Start date of the employment (YYYY-MM-DD)") + @ApiModelProperty(required = true, value = "Start date of the employment (YYYY-MM-DD)") /** * Start date of the employment (YYYY-MM-DD) * @@ -160,7 +162,10 @@ public Employment engagementType(String engagementType) { * * @return engagementType */ - @ApiModelProperty(example = "Permanent", value = "Engagement type of the employee") + @ApiModelProperty( + example = "Permanent", + required = true, + value = "Engagement type of the employee") /** * Engagement type of the employee * diff --git a/src/main/java/com/xero/models/payrolluk/Employee.java b/src/main/java/com/xero/models/payrolluk/Employee.java index 392b266e8..7a4199058 100644 --- a/src/main/java/com/xero/models/payrolluk/Employee.java +++ b/src/main/java/com/xero/models/payrolluk/Employee.java @@ -174,7 +174,7 @@ public Employee title(String title) { * * @return title */ - @ApiModelProperty(example = "Mrs", value = "Title of the employee") + @ApiModelProperty(example = "Mrs", required = true, value = "Title of the employee") /** * Title of the employee * @@ -209,7 +209,7 @@ public Employee firstName(String firstName) { * * @return firstName */ - @ApiModelProperty(example = "Karen", value = "First name of employee") + @ApiModelProperty(example = "Karen", required = true, value = "First name of employee") /** * First name of employee * @@ -244,7 +244,7 @@ public Employee lastName(String lastName) { * * @return lastName */ - @ApiModelProperty(example = "Jones", value = "Last name of employee") + @ApiModelProperty(example = "Jones", required = true, value = "Last name of employee") /** * Last name of employee * @@ -281,6 +281,7 @@ public Employee dateOfBirth(LocalDate dateOfBirth) { */ @ApiModelProperty( example = "Wed Jan 02 00:00:00 UTC 2019", + required = true, value = "Date of birth of the employee (YYYY-MM-DD)") /** * Date of birth of the employee (YYYY-MM-DD) @@ -316,7 +317,7 @@ public Employee address(Address address) { * * @return address */ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") /** * address * @@ -386,7 +387,7 @@ public Employee gender(GenderEnum gender) { * * @return gender */ - @ApiModelProperty(example = "F", value = "The employee’s gender") + @ApiModelProperty(example = "F", required = true, value = "The employee’s gender") /** * The employee’s gender * diff --git a/src/main/java/com/xero/models/payrolluk/Employment.java b/src/main/java/com/xero/models/payrolluk/Employment.java index a4861f9bc..d96155afc 100644 --- a/src/main/java/com/xero/models/payrolluk/Employment.java +++ b/src/main/java/com/xero/models/payrolluk/Employment.java @@ -133,7 +133,9 @@ public Employment payrollCalendarID(UUID payrollCalendarID) { * * @return payrollCalendarID */ - @ApiModelProperty(value = "Xero unique identifier for the payroll calendar of the employee") + @ApiModelProperty( + required = true, + value = "Xero unique identifier for the payroll calendar of the employee") /** * Xero unique identifier for the payroll calendar of the employee * @@ -168,7 +170,7 @@ public Employment startDate(LocalDate startDate) { * * @return startDate */ - @ApiModelProperty(value = "Start date of the employment (YYYY-MM-DD)") + @ApiModelProperty(required = true, value = "Start date of the employment (YYYY-MM-DD)") /** * Start date of the employment (YYYY-MM-DD) * @@ -203,7 +205,7 @@ public Employment employeeNumber(String employeeNumber) { * * @return employeeNumber */ - @ApiModelProperty(example = "7", value = "The employment number of the employee") + @ApiModelProperty(example = "7", required = true, value = "The employment number of the employee") /** * The employment number of the employee * @@ -238,7 +240,7 @@ public Employment niCategory(NiCategoryEnum niCategory) { * * @return niCategory */ - @ApiModelProperty(example = "A", value = "The NI Category of the employee") + @ApiModelProperty(example = "A", required = true, value = "The NI Category of the employee") /** * The NI Category of the employee * From 89328907d8e174ca56f3ba368d43f30202975f0b Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:08:28 +0530 Subject: [PATCH 22/45] initial commit --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ pom.xml | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..c020c8614 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Java Build, Lint and Test + +on: + push: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout Xero-Java repo + uses: actions/checkout@v4 + with: + repository: XeroAPI/Xero-Java + path: Xero-Java + + - name: Set up JDK environment + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '11' + cache: maven + + - name: Import GPG Key + run: | + echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} + + - name: Publish to Maven + run: mvn clean deploy -P release -DskipTests=true -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} + working-directory: Xero-Java diff --git a/pom.xml b/pom.xml index 73939d89b..a8d5f4f7d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0 + 8.3.0-alpha.1 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From 86faf0abe66ed47a63b296106517b33e0621a2b9 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:10:37 +0530 Subject: [PATCH 23/45] export gpg key --- .github/workflows/publish.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c020c8614..835e7ce35 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,4 @@ -name: Java Build, Lint and Test - +name: Publish on: push: release: @@ -30,5 +29,7 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} - name: Publish to Maven - run: mvn clean deploy -P release -DskipTests=true -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} + run: | + export GPG_TTY=$(tty) + mvn clean deploy -P release -DskipTests=true -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} working-directory: Xero-Java From ac44e53a9947141261e599361104cc2d907bebcc Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:12:09 +0530 Subject: [PATCH 24/45] adds gpg passphrase as one input --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 835e7ce35..f32c14cfd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,5 +31,5 @@ jobs: - name: Publish to Maven run: | export GPG_TTY=$(tty) - mvn clean deploy -P release -DskipTests=true -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} + mvn clean deploy -P release -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} working-directory: Xero-Java From d1936283fe70fd064379aef1e3780cd56f10668f Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:15:34 +0530 Subject: [PATCH 25/45] adds a step to configure maven settings --- .github/workflows/publish.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f32c14cfd..274209521 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,8 +28,21 @@ jobs: env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} + - name: Configure Maven settings + run: | + mkdir -p ~/.m2 + echo " + + + ossrh + ${{ secrets.MAVEN_USERNAME }} + ${{ secrets.MAVEN_TOKEN }} + + + " > ~/.m2/settings.xml + - name: Publish to Maven run: | export GPG_TTY=$(tty) - mvn clean deploy -P release -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Dusername=${{ secrets.MAVEN_USERNAME }} -Dpassword=${{ secrets.MAVEN_TOKEN }} + mvn clean deploy -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java From 70e8fda681940d5e25a7f39eaa1450bcfdc4223b Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:23:31 +0530 Subject: [PATCH 26/45] simplified by having a separate settings.xml file --- .github/settings.xml | 9 +++++++++ .github/workflows/publish.yml | 10 +--------- pom.xml | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 .github/settings.xml diff --git a/.github/settings.xml b/.github/settings.xml new file mode 100644 index 000000000..291fc1756 --- /dev/null +++ b/.github/settings.xml @@ -0,0 +1,9 @@ + + + + ossrh + ${env.MAVEN_USERNAME} + ${env.MAVEN_TOKEN} + + + diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 274209521..f8ab2051b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,15 +31,7 @@ jobs: - name: Configure Maven settings run: | mkdir -p ~/.m2 - echo " - - - ossrh - ${{ secrets.MAVEN_USERNAME }} - ${{ secrets.MAVEN_TOKEN }} - - - " > ~/.m2/settings.xml + cp .github/settings.xml ~/.m2/settings.xml - name: Publish to Maven run: | diff --git a/pom.xml b/pom.xml index a8d5f4f7d..0bc553b47 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0-alpha.1 + 8.3.0-alpha.2 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From a15f876cb01f6fb55e37a459917c1808f1eb9cf2 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 13:24:19 +0530 Subject: [PATCH 27/45] adds working directory --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f8ab2051b..9ea3cb040 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,6 +32,7 @@ jobs: run: | mkdir -p ~/.m2 cp .github/settings.xml ~/.m2/settings.xml + working-directory: Xero-Java - name: Publish to Maven run: | From 3c846889f8a3843140e81d32d0b888d86b03cdce Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:11:40 +0530 Subject: [PATCH 28/45] make the pipeline run only when release is created --- .github/workflows/publish.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9ea3cb040..35a18d45d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,5 @@ name: Publish on: - push: release: types: [published] @@ -31,8 +30,15 @@ jobs: - name: Configure Maven settings run: | mkdir -p ~/.m2 - cp .github/settings.xml ~/.m2/settings.xml - working-directory: Xero-Java + echo " + + + ossrh + ${{ secrets.MAVEN_USERNAME }} + ${{ secrets.MAVEN_TOKEN }} + + + " > ~/.m2/settings.xml - name: Publish to Maven run: | From f3bfe77fde95ba80cc8eecab0e7685a64589083a Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:25:24 +0530 Subject: [PATCH 29/45] final commit --- .github/settings.xml | 9 --------- pom.xml | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 .github/settings.xml diff --git a/.github/settings.xml b/.github/settings.xml deleted file mode 100644 index 291fc1756..000000000 --- a/.github/settings.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - ossrh - ${env.MAVEN_USERNAME} - ${env.MAVEN_TOKEN} - - - diff --git a/pom.xml b/pom.xml index 0bc553b47..73939d89b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0-alpha.2 + 8.3.0 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From d2bc4eb0c89f3765828a677a4405a664989ab93b Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:49:35 +0530 Subject: [PATCH 30/45] corrected review comments --- .github/workflows/publish.yml | 17 ++++------------- pom.xml | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 35a18d45d..42fc0834c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,6 @@ name: Publish on: + push: release: types: [published] @@ -20,6 +21,9 @@ jobs: distribution: 'temurin' java-version: '11' cache: maven + server-id: ossrh + server-username: ${{ secrets.MAVEN_USERNAME }} + server-password: ${{ secrets.MAVEN_TOKEN }} - name: Import GPG Key run: | @@ -27,19 +31,6 @@ jobs: env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} - - name: Configure Maven settings - run: | - mkdir -p ~/.m2 - echo " - - - ossrh - ${{ secrets.MAVEN_USERNAME }} - ${{ secrets.MAVEN_TOKEN }} - - - " > ~/.m2/settings.xml - - name: Publish to Maven run: | export GPG_TTY=$(tty) diff --git a/pom.xml b/pom.xml index 73939d89b..6f79c699c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0 + 8.3.0-alpha.3 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From 516515d3be81bb8ffecc29413bad72bf807217a7 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:52:20 +0530 Subject: [PATCH 31/45] corrected getting secrets --- .github/workflows/publish.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 42fc0834c..5af893986 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,8 +22,8 @@ jobs: java-version: '11' cache: maven server-id: ossrh - server-username: ${{ secrets.MAVEN_USERNAME }} - server-password: ${{ secrets.MAVEN_TOKEN }} + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD - name: Import GPG Key run: | @@ -35,4 +35,7 @@ jobs: run: | export GPG_TTY=$(tty) mvn clean deploy -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} working-directory: Xero-Java From b2240114a16caff3de466dd3533763dc2986cc73 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 15:59:33 +0530 Subject: [PATCH 32/45] adds gpg passphrase in secret --- .github/workflows/publish.yml | 4 +++- pom.xml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5af893986..851de1c63 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,6 +24,7 @@ jobs: server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD + gpg-passphrase: GPG_PASSPHRASE - name: Import GPG Key run: | @@ -34,8 +35,9 @@ jobs: - name: Publish to Maven run: | export GPG_TTY=$(tty) - mvn clean deploy -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} + mvn clean deploy -DskipTests=true env: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java diff --git a/pom.xml b/pom.xml index 6f79c699c..da6b5ba0f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0-alpha.3 + 8.3.0-alpha.4 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From ab0cad3e6fc523cfa7afd218eeaa59dfc78f1f70 Mon Sep 17 00:00:00 2001 From: Vignesh Kennadi Date: Mon, 30 Sep 2024 16:02:28 +0530 Subject: [PATCH 33/45] corrected build pipeline --- .github/workflows/build-lint-test.yml | 5 ++++- .github/workflows/publish.yml | 1 - pom.xml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index ab8afd94b..bebbff41d 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -20,6 +20,7 @@ jobs: distribution: 'temurin' java-version: '11' cache: maven + gpg-passphrase: GPG_PASSPHRASE - name: Import GPG Key run: | @@ -30,5 +31,7 @@ jobs: - name: Build and test post generation run: | export GPG_TTY=$(tty) - mvn clean verify -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} + mvn clean verify -DskipTests=true + env: + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 851de1c63..abc3ab09c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,5 @@ name: Publish on: - push: release: types: [published] diff --git a/pom.xml b/pom.xml index da6b5ba0f..73939d89b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ xero-java jar xero-java - 8.3.0-alpha.4 + 8.3.0 https://github.com/XeroAPI/Xero-Java This is the official Java SDK for Xero API From b603234590601eaac7cfb42017b118411f1a0b2b Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Fri, 4 Oct 2024 13:35:26 +0530 Subject: [PATCH 34/45] initial commit --- pom.xml | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 73939d89b..f7e599593 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ com.auth0 java-jwt - 3.19.4 + 4.4.0 com.auth0 @@ -68,17 +68,17 @@ commons-io commons-io - 2.7 + 2.17.0 jakarta.servlet jakarta.servlet-api - 6.0.0 + 6.1.0 org.mockito mockito-core - 5.10.0 + 5.14.1 test @@ -92,7 +92,7 @@ org.slf4j slf4j-api - 1.7.30 + 2.0.16 @@ -159,7 +159,7 @@ maven-deploy-plugin - 2.8.2 + 3.1.3 org.apache.maven.plugins @@ -208,12 +208,12 @@ org.codehaus.mojo findbugs-maven-plugin - 3.0.4 + 3.0.5 org.apache.maven.plugins maven-war-plugin - 3.1.0 + 3.4.0 example/src/main/webapp/WEB-INF/web.xml @@ -232,7 +232,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.2 + 3.10.1 8 @@ -248,7 +248,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.2.7 sign-artifacts @@ -261,7 +261,6 @@ --pinentry-mode loopback - gpg.passphrase @@ -269,7 +268,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.13 + 1.7.0 true ossrh @@ -280,7 +279,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.5.0 -Duser.timezone=GMT-08:00 @@ -292,12 +291,12 @@ org.apache.maven.plugins maven-pmd-plugin - 3.8 + 3.25.0 org.codehaus.mojo findbugs-maven-plugin - 3.0.4 + 3.0.5 @@ -317,11 +316,11 @@ UTF-8 11 1.6.3 - 2.3.0 + 2.7.0 2.25.1 - 2.16.1 - 2.16.1 - 2.12.5 + 2.18.0 + 2.18.0 + 2.15.2 4.13.2 4.5.3 3.1.5 From 8d914c822db496c54f2c89ed14b1936a5bf1b599 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Fri, 4 Oct 2024 13:42:39 +0530 Subject: [PATCH 35/45] removed passphrase variable from java installation --- .github/workflows/build-lint-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index bebbff41d..89fc65d69 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -20,7 +20,6 @@ jobs: distribution: 'temurin' java-version: '11' cache: maven - gpg-passphrase: GPG_PASSPHRASE - name: Import GPG Key run: | From b8a2f23cb283a487a970605a7dcf1b14693d74df Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Fri, 4 Oct 2024 13:44:13 +0530 Subject: [PATCH 36/45] corrected the environment variable name for gpg passphrase --- .github/workflows/build-lint-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 89fc65d69..747615429 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -32,5 +32,5 @@ jobs: export GPG_TTY=$(tty) mvn clean verify -DskipTests=true env: - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java From 9481ae05c8deb1bbcdece96abd4e2ea09e29314c Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Fri, 4 Oct 2024 15:28:12 +0530 Subject: [PATCH 37/45] fixed some other dependencies --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index f7e599593..cf0c3dcab 100644 --- a/pom.xml +++ b/pom.xml @@ -173,7 +173,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.3.1 attach-sources @@ -203,7 +203,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.8 + 3.25.0 org.codehaus.mojo @@ -315,7 +315,7 @@ UTF-8 UTF-8 11 - 1.6.3 + 1.6.14 2.7.0 2.25.1 2.18.0 From 78bbe0a86f0f9a11da871855947b97122e81ee01 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 21 Oct 2024 15:12:37 +0530 Subject: [PATCH 38/45] ci: Added slack alert --- .github/actions/notify-slack/action.yml | 103 ++++++++++++++++++++++++ .github/workflows/publish.yml | 73 ++++++++++++++++- 2 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 .github/actions/notify-slack/action.yml diff --git a/.github/actions/notify-slack/action.yml b/.github/actions/notify-slack/action.yml new file mode 100644 index 000000000..add9673f1 --- /dev/null +++ b/.github/actions/notify-slack/action.yml @@ -0,0 +1,103 @@ +name: slack-alert-action +description: "Action to send slack payload to public-sdk-events channel" + +inputs: + heading_text: + required: true + description: "Heading of the slack payload" + alert_type: + required: true + description: "type of the slack alert" + job_status: + required: true + description: "status of the job" + XERO_SLACK_WEBHOOK_URL: + required: true + description: "webhook url for channel - public-sdk-events" + job_url: + required: true + description: "job run id link" + button_type: + required: true + description: "color for the check logs button" + package_version: + required: true + description: "released package version" + repo_link: + required: true + description: "link of the repo" + + +runs: + using: "composite" + + steps: + + - name: Send slack notification + id: slack + uses: slackapi/slack-github-action@v1.27.0 + env: + SLACK_WEBHOOK_URL: ${{inputs.XERO_SLACK_WEBHOOK_URL}} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + with: + payload: | + { + "blocks": [ + { + "type": "rich_text", + "elements": [ + { + "type": "rich_text_section", + "elements": [ + { + "type": "text", + "text": "${{inputs.heading_text}} ", + "style": { + "bold": true + } + }, + { + "type": "emoji", + "name": "${{inputs.alert_type}}" + } + ] + } + ] + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Repository:* \n ${{inputs.repo_link}}" + }, + { + "type": "mrkdwn", + "text": "*Status:*\n ${{inputs.job_status}}" + }, + { + "type": "mrkdwn", + "text": "*Package Version:*\n ${{inputs.package_version}}" + } + ] + }, + { + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Check the logs", + "emoji": true + }, + "style": "${{inputs.button_type}}", + "url": "${{inputs.job_url}}" + } + ] + } + ] + } diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index abc3ab09c..be8dd3cf7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,10 +3,20 @@ on: release: types: [published] + pull_request: + branches: + - master + jobs: publish: runs-on: ubuntu-latest + outputs: + release_number: ${{steps.get_latest_release_number.outputs.release_tag}} + permissions: + contents: write + pull-requests: write + steps: - name: Checkout Xero-Java repo uses: actions/checkout@v4 @@ -25,6 +35,16 @@ jobs: server-password: MAVEN_PASSWORD gpg-passphrase: GPG_PASSPHRASE + - name: Fetch Latest release number + id: get_latest_release_number + run: | + latest_version=$(gh release view --json tagName --jq '.tagName') + echo "Latest release version is - $latest_version" + echo "::set-output name=release_tag::$latest_version" + working-directory: Xero-Java + env: + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Import GPG Key run: | echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import @@ -36,7 +56,54 @@ jobs: export GPG_TTY=$(tty) mvn clean deploy -DskipTests=true env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + test: test + # MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + # MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java + + notify-slack-on-success: + runs-on: ubuntu-latest + needs: publish + if: success() + steps: + - name: Checkout Xero-Java repo + uses: actions/checkout@v4 + with: + repository: XeroAPI/Xero-Java + path: Xero-Java + + - name: Send slack notification on success + uses: ./Xero-Java/.github/actions/notify-slack + with: + heading_text: "Publish job has succeeded !" + alert_type: "thumbsup" + job_status: "Success" + XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} + job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" + button_type: "primary" + package_version: ${{needs.publish.outputs.release_number}} + repo_link: ${{github.server_url}}/${{github.repository}} + + notify-slack-on-failure: + runs-on: ubuntu-latest + needs: publish + if: failure() + steps: + - name: Checkout Xero-Java repo + uses: actions/checkout@v4 + with: + repository: XeroAPI/Xero-Java + path: Xero-Java + + - name: Send slack notification on failure + uses: ./Xero-Java/.github/actions/notify-slack + with: + heading_text: "Publish job has failed !" + alert_type: "alert" + job_status: "Failed" + XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} + job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" + button_type: "danger" + package_version: ${{needs.publish.outputs.release_number}} + repo_link: ${{github.server_url}}/${{github.repository}} From d7187c14a19a2e5cce0a4c831221d7c54dfa49f8 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 21 Oct 2024 15:15:04 +0530 Subject: [PATCH 39/45] ci: clean up --- .github/workflows/publish.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index be8dd3cf7..2f1cede93 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,10 +3,6 @@ on: release: types: [published] - pull_request: - branches: - - master - jobs: publish: runs-on: ubuntu-latest @@ -56,10 +52,9 @@ jobs: export GPG_TTY=$(tty) mvn clean deploy -DskipTests=true env: - test: test - # MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - # MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} - # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java notify-slack-on-success: From 4e112c482351c5cdd949acd15c12904e472f520e Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 12:26:00 +0530 Subject: [PATCH 40/45] initial commit --- .github/workflows/build-lint-test.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 747615429..808b0592c 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -27,10 +27,27 @@ jobs: env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} + - name: Set up Node environment + uses: actions/setup-node@v2 + with: + node-version: 20 + + - name: Install Prism + run: npm install -g @stoplight/prism-cli + + - name: Start PRISM Server + run: ./start-prism.sh & sleep 15 + working-directory: Xero-Java/src/test/java/com/xero/api/util + - name: Build and test post generation run: | export GPG_TTY=$(tty) - mvn clean verify -DskipTests=true + mvn clean verify -DskipTests=false env: MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java + + - name: Stop PRISM + if: success() || failure() + run: pkill -f prism + working-directory: Xero-Java From f085eff885fb07cfa560d9efa742eab5758e4b0f Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 12:28:42 +0530 Subject: [PATCH 41/45] skip running tests --- .github/workflows/build-lint-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 808b0592c..81ab2baf8 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -42,7 +42,7 @@ jobs: - name: Build and test post generation run: | export GPG_TTY=$(tty) - mvn clean verify -DskipTests=false + mvn clean verify -DskipTests=true env: MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java From 4505f9398edc8a9a1130700e1db62e5544441eed Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Wed, 23 Oct 2024 13:16:08 +0530 Subject: [PATCH 42/45] ci: testing the successflow --- .github/workflows/publish.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2f1cede93..991942932 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,6 +2,9 @@ name: Publish on: release: types: [published] + pull_request: + branches: + - master jobs: publish: @@ -41,21 +44,21 @@ jobs: env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Import GPG Key - run: | - echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import - env: - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} + # - name: Import GPG Key + # run: | + # echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + # env: + # GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} - - name: Publish to Maven - run: | - export GPG_TTY=$(tty) - mvn clean deploy -DskipTests=true - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - working-directory: Xero-Java + # - name: Publish to Maven + # run: | + # export GPG_TTY=$(tty) + # mvn clean deploy -DskipTests=true + # env: + # MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + # MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + # working-directory: Xero-Java notify-slack-on-success: runs-on: ubuntu-latest From 3940e8092c7e9d5cde4ef3c868512635882eb7a7 Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Wed, 23 Oct 2024 13:17:15 +0530 Subject: [PATCH 43/45] ci: reverted the testing changes --- .github/workflows/publish.yml | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 991942932..2f1cede93 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,9 +2,6 @@ name: Publish on: release: types: [published] - pull_request: - branches: - - master jobs: publish: @@ -44,21 +41,21 @@ jobs: env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - # - name: Import GPG Key - # run: | - # echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import - # env: - # GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} + - name: Import GPG Key + run: | + echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}} - # - name: Publish to Maven - # run: | - # export GPG_TTY=$(tty) - # mvn clean deploy -DskipTests=true - # env: - # MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - # MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} - # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - # working-directory: Xero-Java + - name: Publish to Maven + run: | + export GPG_TTY=$(tty) + mvn clean deploy -DskipTests=true + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + working-directory: Xero-Java notify-slack-on-success: runs-on: ubuntu-latest From 7d098b9741cac2b6c2562b4878c0e1a57f867750 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Fri, 25 Oct 2024 13:30:09 +0530 Subject: [PATCH 44/45] remove skipping tests --- .github/workflows/build-lint-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 81ab2baf8..f5c79fb10 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -42,7 +42,7 @@ jobs: - name: Build and test post generation run: | export GPG_TTY=$(tty) - mvn clean verify -DskipTests=true + mvn clean verify env: MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} working-directory: Xero-Java From 139cee2a19946f5d941b0d3a2fa8f189e09d0b58 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Mon, 28 Oct 2024 10:51:56 +0530 Subject: [PATCH 45/45] remove check for prism kill --- .github/workflows/build-lint-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index f5c79fb10..e455115a3 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -48,6 +48,5 @@ jobs: working-directory: Xero-Java - name: Stop PRISM - if: success() || failure() run: pkill -f prism working-directory: Xero-Java