Skip to content

Commit f2f6dc1

Browse files
committed
Fix tracking on line item object
Tracking category option needs to be a string not array on line items for invoices and other objects using line items with tracking support.
1 parent 10a430d commit f2f6dc1

6 files changed

Lines changed: 156 additions & 13 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Add the dependency to your pom.xml. Gradle, sbt and other build tools can be fo
7979
<dependency>
8080
<groupId>com.github.xeroapi</groupId>
8181
<artifactId>xero-java</artifactId>
82-
<version>2.2.13</version>
82+
<version>2.2.14</version>
8383
</dependency>
8484

8585

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.github.xeroapi</groupId>
55
<artifactId>xero-java</artifactId>
66
<packaging>jar</packaging>
7-
<version>2.2.13</version>
7+
<version>2.2.14</version>
88
<name>Xero-Java SDK</name>
99
<description>This is the official Java SDK for Xero API</description>
1010
<url>https://github.com/XeroAPI/Xero-Java</url>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
public class JsonConfig implements Config {
1717

18-
18+
private String SDK_VERSION = "2.2.14"
1919
private String APP_TYPE = "Public";
2020
private String USER_AGENT = "Xero-Java-SDK";
2121
private String ACCEPT = "application/xml";
@@ -132,7 +132,7 @@ public String getAccessTokenUrl() {
132132

133133
@Override
134134
public String getUserAgent() {
135-
return USER_AGENT + " " + CONSUMER_KEY + " [Xero-Java-2.2.13]";
135+
return USER_AGENT + " " + CONSUMER_KEY + " [Xero-Java-" + SDK_VERSION + "]";
136136
}
137137

138138
@Override

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,10 +2413,10 @@ public ByteArrayInputStream getAccountAttachmentByFileName(UUID accountID, Strin
24132413
}
24142414
/**
24152415
* Allows you to retrieve Attachments on Account
2416-
* <p><b>200</b> - A successful request
2416+
* <p><b>200</b> - Returns a binary string (ByteArray)
24172417
* @param accountID The accountID parameter
24182418
* @param attachmentID The attachmentID parameter
2419-
* @param contentType The contentType parameter
2419+
* @param contentType The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
24202420
* @return File
24212421
* @throws IOException if an error occurs while attempting to invoke the API
24222422
**/

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import com.fasterxml.jackson.annotation.JsonProperty;
1919
import com.fasterxml.jackson.annotation.JsonCreator;
2020
import com.fasterxml.jackson.annotation.JsonValue;
21+
import com.xero.models.accounting.LineItemTracking;
2122
import com.xero.models.accounting.TaxType;
22-
import com.xero.models.accounting.TrackingCategory;
2323
import io.swagger.annotations.ApiModel;
2424
import io.swagger.annotations.ApiModelProperty;
2525
import java.util.ArrayList;
@@ -71,7 +71,7 @@ public class LineItem {
7171

7272

7373
@JsonProperty("Tracking")
74-
private List<TrackingCategory> tracking = null;
74+
private List<LineItemTracking> tracking = null;
7575

7676

7777
@JsonProperty("DiscountRate")
@@ -243,14 +243,14 @@ public void setLineAmount(Float lineAmount) {
243243
this.lineAmount = lineAmount;
244244
}
245245

246-
public LineItem tracking(List<TrackingCategory> tracking) {
246+
public LineItem tracking(List<LineItemTracking> tracking) {
247247
this.tracking = tracking;
248248
return this;
249249
}
250250

251-
public LineItem addTrackingItem(TrackingCategory trackingItem) {
251+
public LineItem addTrackingItem(LineItemTracking trackingItem) {
252252
if (this.tracking == null) {
253-
this.tracking = new ArrayList<TrackingCategory>();
253+
this.tracking = new ArrayList<LineItemTracking>();
254254
}
255255
this.tracking.add(trackingItem);
256256
return this;
@@ -261,11 +261,11 @@ public LineItem addTrackingItem(TrackingCategory trackingItem) {
261261
* @return tracking
262262
**/
263263
@ApiModelProperty(value = "Optional Tracking Category – see Tracking. Any LineItem can have a maximum of 2 <TrackingCategory> elements.")
264-
public List<TrackingCategory> getTracking() {
264+
public List<LineItemTracking> getTracking() {
265265
return tracking;
266266
}
267267

268-
public void setTracking(List<TrackingCategory> tracking) {
268+
public void setTracking(List<LineItemTracking> tracking) {
269269
this.tracking = tracking;
270270
}
271271

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*
2+
* Accounting API
3+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4+
*
5+
* OpenAPI spec version: 2.0.0
6+
* Contact: api@xero.com
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
package com.xero.models.accounting;
15+
16+
import java.util.Objects;
17+
import java.util.Arrays;
18+
import com.fasterxml.jackson.annotation.JsonProperty;
19+
import com.fasterxml.jackson.annotation.JsonCreator;
20+
import com.fasterxml.jackson.annotation.JsonValue;
21+
import io.swagger.annotations.ApiModel;
22+
import io.swagger.annotations.ApiModelProperty;
23+
import java.util.UUID;
24+
25+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
26+
27+
/**
28+
* LineItemTracking
29+
*/
30+
31+
public class LineItemTracking {
32+
33+
@JsonProperty("TrackingCategoryID")
34+
private UUID trackingCategoryID;
35+
36+
37+
@JsonProperty("Name")
38+
private String name;
39+
40+
41+
@JsonProperty("Option")
42+
private String option;
43+
44+
public LineItemTracking trackingCategoryID(UUID trackingCategoryID) {
45+
this.trackingCategoryID = trackingCategoryID;
46+
return this;
47+
}
48+
49+
/**
50+
* The Xero identifier for a tracking category
51+
* @return trackingCategoryID
52+
**/
53+
@ApiModelProperty(example = "297c2dc5-cc47-4afd-8ec8-74990b8761e9", value = "The Xero identifier for a tracking category")
54+
public UUID getTrackingCategoryID() {
55+
return trackingCategoryID;
56+
}
57+
58+
public void setTrackingCategoryID(UUID trackingCategoryID) {
59+
this.trackingCategoryID = trackingCategoryID;
60+
}
61+
62+
public LineItemTracking name(String name) {
63+
this.name = name;
64+
return this;
65+
}
66+
67+
/**
68+
* The name of the tracking category
69+
* @return name
70+
**/
71+
@ApiModelProperty(example = "Region", value = "The name of the tracking category")
72+
public String getName() {
73+
return name;
74+
}
75+
76+
public void setName(String name) {
77+
this.name = name;
78+
}
79+
80+
public LineItemTracking option(String option) {
81+
this.option = option;
82+
return this;
83+
}
84+
85+
/**
86+
* See Tracking Options
87+
* @return option
88+
**/
89+
@ApiModelProperty(example = "North", value = "See Tracking Options")
90+
public String getOption() {
91+
return option;
92+
}
93+
94+
public void setOption(String option) {
95+
this.option = option;
96+
}
97+
98+
99+
@Override
100+
public boolean equals(java.lang.Object o) {
101+
if (this == o) {
102+
return true;
103+
}
104+
if (o == null || getClass() != o.getClass()) {
105+
return false;
106+
}
107+
LineItemTracking lineItemTracking = (LineItemTracking) o;
108+
return Objects.equals(this.trackingCategoryID, lineItemTracking.trackingCategoryID) &&
109+
Objects.equals(this.name, lineItemTracking.name) &&
110+
Objects.equals(this.option, lineItemTracking.option);
111+
}
112+
113+
@Override
114+
public int hashCode() {
115+
return Objects.hash(trackingCategoryID, name, option);
116+
}
117+
118+
119+
@Override
120+
public String toString() {
121+
StringBuilder sb = new StringBuilder();
122+
sb.append("class LineItemTracking {\n");
123+
124+
sb.append(" trackingCategoryID: ").append(toIndentedString(trackingCategoryID)).append("\n");
125+
sb.append(" name: ").append(toIndentedString(name)).append("\n");
126+
sb.append(" option: ").append(toIndentedString(option)).append("\n");
127+
sb.append("}");
128+
return sb.toString();
129+
}
130+
131+
/**
132+
* Convert the given object to string with each line indented by 4 spaces
133+
* (except the first line).
134+
*/
135+
private String toIndentedString(java.lang.Object o) {
136+
if (o == null) {
137+
return "null";
138+
}
139+
return o.toString().replace("\n", "\n ");
140+
}
141+
142+
}
143+

0 commit comments

Comments
 (0)