Skip to content

Commit 9c2a680

Browse files
author
Vignesh Kennadi
committed
fixed final issue findings
1 parent 1b5bbdd commit 9c2a680

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ public HttpResponse createAccountAttachmentByFileNameForHttpResponse(
526526
HttpHeaders headers = new HttpHeaders();
527527
headers.set("xero-tenant-id", xeroTenantId);
528528
headers.set("Idempotency-Key", idempotencyKey);
529+
headers.setContentType("application/octet-stream");
529530
headers.setAccept("application/json");
530531
headers.setUserAgent(this.getUserAgent());
531532
// create a map of path variables
@@ -815,6 +816,7 @@ public HttpResponse createBankTransactionAttachmentByFileNameForHttpResponse(
815816
headers.set("xero-tenant-id", xeroTenantId);
816817
headers.set("Idempotency-Key", idempotencyKey);
817818
headers.setAccept("application/json");
819+
headers.setContentType("application/octet-stream");
818820
headers.setUserAgent(this.getUserAgent());
819821
// create a map of path variables
820822
final Map<String, Object> uriVariables = new HashMap<String, Object>();
@@ -1508,6 +1510,7 @@ public HttpResponse createBankTransferAttachmentByFileNameForHttpResponse(
15081510
headers.set("xero-tenant-id", xeroTenantId);
15091511
headers.set("Idempotency-Key", idempotencyKey);
15101512
headers.setAccept("application/json");
1513+
headers.setContentType("application/octet-stream");
15111514
headers.setUserAgent(this.getUserAgent());
15121515
// create a map of path variables
15131516
final Map<String, Object> uriVariables = new HashMap<String, Object>();
@@ -2327,6 +2330,7 @@ public HttpResponse createContactAttachmentByFileNameForHttpResponse(
23272330
headers.set("xero-tenant-id", xeroTenantId);
23282331
headers.set("Idempotency-Key", idempotencyKey);
23292332
headers.setAccept("application/json");
2333+
headers.setContentType("application/octet-stream");
23302334
headers.setUserAgent(this.getUserAgent());
23312335
// create a map of path variables
23322336
final Map<String, Object> uriVariables = new HashMap<String, Object>();
@@ -5468,6 +5472,7 @@ public HttpResponse createManualJournalAttachmentByFileNameForHttpResponse(
54685472
headers.set("xero-tenant-id", xeroTenantId);
54695473
headers.set("Idempotency-Key", idempotencyKey);
54705474
headers.setAccept("application/json");
5475+
headers.setContentType("application/octet-stream");
54715476
headers.setUserAgent(this.getUserAgent());
54725477
// create a map of path variables
54735478
final Map<String, Object> uriVariables = new HashMap<String, Object>();
@@ -8354,6 +8359,7 @@ public HttpResponse createReceiptAttachmentByFileNameForHttpResponse(
83548359
headers.set("xero-tenant-id", xeroTenantId);
83558360
headers.set("Idempotency-Key", idempotencyKey);
83568361
headers.setAccept("application/json");
8362+
headers.setContentType("application/octet-stream");
83578363
headers.setUserAgent(this.getUserAgent());
83588364
// create a map of path variables
83598365
final Map<String, Object> uriVariables = new HashMap<String, Object>();
@@ -8778,6 +8784,7 @@ public HttpResponse createRepeatingInvoiceAttachmentByFileNameForHttpResponse(
87788784
headers.set("xero-tenant-id", xeroTenantId);
87798785
headers.set("Idempotency-Key", idempotencyKey);
87808786
headers.setAccept("application/json");
8787+
headers.setContentType("application/octet-stream");
87818788
headers.setUserAgent(this.getUserAgent());
87828789
// create a map of path variables
87838790
final Map<String, Object> uriVariables = new HashMap<String, Object>();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public HttpResponse createStatementsForHttpResponse(
327327
HttpHeaders headers = new HttpHeaders();
328328
headers.set("Xero-Tenant-Id", xeroTenantId);
329329
headers.set("Idempotency-Key", idempotencyKey);
330-
headers.setAccept("application/jsonapplication/problem+json");
330+
headers.setAccept("application/json;application/problem+json");
331331
headers.setUserAgent(this.getUserAgent());
332332
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Statements");
333333
String url = uriBuilder.build().toString();
@@ -872,7 +872,7 @@ public HttpResponse getStatementsForHttpResponse(
872872
headers.set("Xero-Tenant-Id", xeroTenantId);
873873
headers.set("Xero-Application-Id", xeroApplicationId);
874874
headers.set("Xero-User-Id", xeroUserId);
875-
headers.setAccept("application/jsonapplication/problem+json");
875+
headers.setAccept("application/json;application/problem+json");
876876
headers.setUserAgent(this.getUserAgent());
877877
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Statements");
878878
if (page != null) {

src/test/java/com/xero/api/client/AccountingApiAccountsTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,13 @@ public void testGetAccountAttachments() throws Exception {
127127
public void testCreateAccountAttachmentByFileName() throws Exception {
128128

129129
System.out.println("@Test - createAccountAttachmentByFileName");
130-
Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,null, null, null);
131-
UUID accountID = accounts.getAccounts().get(0).getAccountID();
132-
// UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9");
130+
UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9");
133131

134132
ClassLoader classLoader = getClass().getClassLoader();
135133
File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile());
136134

137-
String newFileName = bytes.getName();
138-
String idempotencyKey = null;
139-
// String idempotencyKey = "KEY_VALUE";
140-
Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accessToken,xeroTenantId,accountID, newFileName, bytes, idempotencyKey);
135+
String newFileName = "sample5.jpg";
136+
Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accessToken,xeroTenantId,accountID, newFileName, bytes, null);
141137

142138
assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("ab95b276-9dce-4925-9077-439818ba270f")));
143139
assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg")));

0 commit comments

Comments
 (0)