Skip to content

Commit 08e5436

Browse files
authored
Merge pull request #228 from XeroAPI/payrollnz
Payrollnz
2 parents fc84f9c + adfe39b commit 08e5436

File tree

455 files changed

+29347
-331
lines changed

Some content is hidden

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

455 files changed

+29347
-331
lines changed

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
<groupId>com.googlecode.json-simple</groupId>
5353
<artifactId>json-simple</artifactId>
5454
<version>1.1.1</version>
55+
<exclusions>
56+
<!-- json-simple incorrectly includes junit in compile scope -->
57+
<exclusion>
58+
<groupId>junit</groupId>
59+
<artifactId>junit</artifactId>
60+
</exclusion>
61+
</exclusions>
5562
</dependency>
5663
<dependency>
5764
<groupId>commons-io</groupId>

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ public void validationError(Integer statusCode, String objectType, com.xero.mode
4848
}
4949
}
5050

51+
// PAYROLL NZ Validation Errors
52+
public void validationError(Integer statusCode, String objectType, com.xero.models.payrollnz.Problem error) {
53+
if (statusCode == 400 ) {
54+
throw new XeroBadRequestException(objectType, error);
55+
} else if(statusCode == 405) {
56+
throw new XeroMethodNotAllowedException(objectType, error);
57+
} else if(statusCode == 409) {
58+
throw new XeroConflictException(objectType, error);
59+
}
60+
}
61+
5162
// PAYROLL AU Employees Validation Errors (400)
5263
public void validationError(String objectType, com.xero.models.payrollau.Employees employees) {
5364
throw new XeroBadRequestException(objectType, employees);

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class XeroBadRequestException extends XeroException {
2424
private List<FeedConnection> feedConnectionItems = new ArrayList<FeedConnection>();
2525
private List<FieldValidationErrorsElement> fieldValidationErrorsElements = new ArrayList<FieldValidationErrorsElement>();
2626
private com.xero.models.payrolluk.Problem payrollUkProblem = new com.xero.models.payrolluk.Problem();
27+
private com.xero.models.payrollnz.Problem payrollNzProblem = new com.xero.models.payrollnz.Problem();
2728
private List<com.xero.models.payrollau.Employee> employeeItems = new ArrayList<com.xero.models.payrollau.Employee>();
2829

2930
private List<com.xero.models.payrollau.LeaveApplication> leaveApplicationItems = new ArrayList<com.xero.models.payrollau.LeaveApplication>();
@@ -63,6 +64,12 @@ public XeroBadRequestException(String objectType, com.xero.models.payrolluk.Prob
6364
this.payrollUkProblem = problem;
6465
}
6566

67+
public XeroBadRequestException(String objectType, com.xero.models.payrollnz.Problem problem) {
68+
this.statusCode = 400;
69+
this.type = objectType;
70+
this.payrollNzProblem = problem;
71+
}
72+
6673
public XeroBadRequestException(String objectType, com.xero.models.payrollau.Employees employees) {
6774
this.statusCode = 400;
6875
this.type = objectType;
@@ -292,7 +299,24 @@ public void setPayrollUkProblem(com.xero.models.payrolluk.Problem problem) {
292299
}
293300

294301

302+
// NZ Payroll Problems Errors
303+
public XeroBadRequestException payrollNzProblem(com.xero.models.payrollnz.Problem problem) {
304+
this.payrollNzProblem = problem;
305+
return this;
306+
}
307+
308+
/**
309+
* Exception type
310+
* @return com.xero.models.payrollnz.Problem
311+
**/
312+
@ApiModelProperty(value = "NZ Payroll problem")
313+
public com.xero.models.payrollnz.Problem getPayrollNzProblem() {
314+
return payrollNzProblem;
315+
}
295316

317+
public void setPayrollNzProblem(com.xero.models.payrollnz.Problem problem) {
318+
this.payrollNzProblem = problem;
319+
}
296320

297321

298322
// Payroll AU Employees
Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,317 @@
1+
package com.xero.api;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
import java.util.Objects;
6+
7+
import com.fasterxml.jackson.annotation.JsonProperty;
8+
import com.xero.models.accounting.Element;
9+
import com.xero.models.assets.FieldValidationErrorsElement;
10+
import com.xero.models.bankfeeds.FeedConnection;
11+
import com.xero.models.bankfeeds.FeedConnections;
12+
import com.xero.models.bankfeeds.Statement;
13+
import com.xero.models.bankfeeds.Statements;
14+
15+
import io.swagger.annotations.ApiModelProperty;
16+
17+
public class XeroConflictException extends XeroException {
18+
19+
private static final long serialVersionUID = 1L;
20+
private Integer statusCode;
21+
private String type;
22+
private String message;
23+
private List<Element> elements = new ArrayList<Element>();
24+
private List<Statement> statementItems = new ArrayList<Statement>();
25+
private List<FeedConnection> feedConnectionItems = new ArrayList<FeedConnection>();
26+
private List<FieldValidationErrorsElement> fieldValidationErrorsElements = new ArrayList<FieldValidationErrorsElement>();
27+
private com.xero.models.payrolluk.Problem payrollUkProblem = new com.xero.models.payrolluk.Problem();
28+
private com.xero.models.payrollnz.Problem payrollNzProblem = new com.xero.models.payrollnz.Problem();
29+
30+
31+
public XeroConflictException(String objectType, com.xero.models.accounting.Error error) {
32+
this.statusCode = 409;
33+
this.type(objectType);
34+
this.elements(error.getElements());
35+
}
36+
37+
public XeroConflictException(String objectType, com.xero.models.assets.Error error) {
38+
this.statusCode = 409;
39+
this.type = objectType;
40+
this.fieldValidationErrorsElements = error.getFieldValidationErrors();
41+
}
42+
43+
public XeroConflictException(String objectType, Statements error) {
44+
this.statusCode = 409;
45+
this.type = objectType;
46+
this.statementItems = error.getItems();
47+
}
48+
49+
public XeroConflictException(String objectType, FeedConnections error) {
50+
this.statusCode = 409;
51+
this.type = objectType;
52+
this.feedConnectionItems = error.getItems();
53+
}
54+
55+
public XeroConflictException(String objectType, com.xero.models.payrolluk.Problem problem) {
56+
this.statusCode = 409;
57+
this.type = objectType;
58+
this.payrollUkProblem = problem;
59+
}
60+
61+
public XeroConflictException(String objectType, com.xero.models.payrollnz.Problem problem) {
62+
this.statusCode = 409;
63+
this.type = objectType;
64+
this.payrollNzProblem = problem;
65+
}
66+
67+
public XeroConflictException(Integer statusCode, String message) {
68+
this.statusCode = statusCode;
69+
this.message = message;
70+
}
71+
72+
public XeroConflictException statusCode(Integer statusCode) {
73+
this.statusCode = statusCode;
74+
return this;
75+
}
76+
77+
/**
78+
* Exception number
79+
* @return statusCode
80+
**/
81+
@ApiModelProperty(value = "Status Code")
82+
public Integer getStatusCode() {
83+
return statusCode;
84+
}
85+
86+
public void setStatusCode(Integer statusCode) {
87+
this.statusCode = statusCode;
88+
}
89+
90+
public XeroConflictException type(String type) {
91+
this.type = type;
92+
return this;
93+
}
94+
95+
/**
96+
* Exception type
97+
* @return type
98+
**/
99+
@ApiModelProperty(value = "API set type")
100+
public String getType() {
101+
return type;
102+
}
103+
104+
public void setType(String type) {
105+
this.type = type;
106+
}
107+
108+
public XeroConflictException message(String message) {
109+
this.message = message;
110+
return this;
111+
}
112+
113+
/**
114+
* Exception message
115+
* @return message
116+
**/
117+
@ApiModelProperty(value = "Exception message")
118+
public String getMessage() {
119+
return message;
120+
}
121+
122+
public void setMessage(String message) {
123+
this.message = message;
124+
}
125+
126+
public XeroConflictException elements(List<Element> elements) {
127+
this.elements = elements;
128+
return this;
129+
}
130+
131+
public XeroConflictException addElementsItem(Element elementsItem) {
132+
if (this.elements == null) {
133+
this.elements = new ArrayList<Element>();
134+
}
135+
this.elements.add(elementsItem);
136+
return this;
137+
}
138+
139+
/**
140+
* Array of Elements of validation Errors
141+
* @return elements
142+
**/
143+
@ApiModelProperty(value = "Array of Elements of validation Errors")
144+
public List<Element> getElements() {
145+
return elements;
146+
}
147+
148+
public void setElements(List<Element> elements) {
149+
this.elements = elements;
150+
}
151+
152+
// Bank Feed Statement items
153+
public XeroConflictException statementItems(List<Statement> statementItems) {
154+
this.statementItems = statementItems;
155+
return this;
156+
}
157+
158+
public XeroConflictException addStatementItem(Statement item) {
159+
if (this.statementItems == null) {
160+
this.statementItems = new ArrayList<Statement>();
161+
}
162+
this.statementItems.add(item);
163+
return this;
164+
}
165+
166+
/**
167+
* Array of Statements Items of Errors Array
168+
* @return statementItems
169+
**/
170+
@ApiModelProperty(value = "Array of Statement Items with Errors Array")
171+
public List<Statement> getStatementItems() {
172+
return statementItems;
173+
}
174+
175+
public void setStatementItems(List<Statement> statementItems) {
176+
this.statementItems = statementItems;
177+
}
178+
179+
// Bank Feed FeedConnection items
180+
public XeroConflictException feedConnectionItems(List<FeedConnection> feedConnectionItems) {
181+
this.feedConnectionItems = feedConnectionItems;
182+
return this;
183+
}
184+
185+
public XeroConflictException addFeedConnectionItems(FeedConnection item) {
186+
if (this.feedConnectionItems == null) {
187+
this.feedConnectionItems = new ArrayList<FeedConnection>();
188+
}
189+
this.feedConnectionItems.add(item);
190+
return this;
191+
}
192+
193+
/**
194+
* Array of FeedConnection of Errors Array
195+
* @return statementItems
196+
**/
197+
@ApiModelProperty(value = "Array of FeedConnection Items with Errors Array")
198+
public List<FeedConnection> getFeedConnectionItems() {
199+
return feedConnectionItems;
200+
}
201+
202+
public void setFeedConnectionItems(List<FeedConnection> feedConnectionItems) {
203+
this.feedConnectionItems = feedConnectionItems;
204+
}
205+
206+
// Assets field Validation Errors
207+
public XeroConflictException fieldValidationErrorsElements(List<FieldValidationErrorsElement> fieldValidationErrorsElements) {
208+
this.fieldValidationErrorsElements = fieldValidationErrorsElements;
209+
return this;
210+
}
211+
212+
public XeroConflictException addFieldValidationErrorsElement(FieldValidationErrorsElement element) {
213+
if (this.fieldValidationErrorsElements == null) {
214+
this.fieldValidationErrorsElements = new ArrayList<FieldValidationErrorsElement>();
215+
}
216+
this.fieldValidationErrorsElements.add(element);
217+
return this;
218+
}
219+
220+
/**
221+
* Array of Assets Errors Array
222+
* @return statementItems
223+
**/
224+
@ApiModelProperty(value = "Array of FieldValidationErrorElement")
225+
public List<FieldValidationErrorsElement> getFieldValidationErrorsElements() {
226+
return fieldValidationErrorsElements;
227+
}
228+
229+
public void setFieldValidationErrorsElements(List<FieldValidationErrorsElement> fieldValidationErrorsElements) {
230+
this.fieldValidationErrorsElements = fieldValidationErrorsElements;
231+
}
232+
233+
234+
// NZ Payroll Problems Errors
235+
public XeroConflictException payrollNzProblem(com.xero.models.payrollnz.Problem problem) {
236+
this.payrollNzProblem = problem;
237+
return this;
238+
}
239+
240+
/**
241+
* Exception type
242+
* @return com.xero.models.payrolluk.Problem
243+
**/
244+
@ApiModelProperty(value = "NZ Payroll problem")
245+
public com.xero.models.payrollnz.Problem getPayrollNzProblem() {
246+
return payrollNzProblem;
247+
}
248+
249+
public void setPayrollNzProblem(com.xero.models.payrollnz.Problem problem) {
250+
this.payrollNzProblem = problem;
251+
}
252+
253+
254+
// UK Payroll Problems Errors
255+
public XeroConflictException payrollUkProblem(com.xero.models.payrolluk.Problem problem) {
256+
this.payrollUkProblem = problem;
257+
return this;
258+
}
259+
260+
/**
261+
* Exception type
262+
* @return com.xero.models.payrolluk.Problem
263+
**/
264+
@ApiModelProperty(value = "UK Payroll problem")
265+
public com.xero.models.payrolluk.Problem getPayrollUkProblem() {
266+
return payrollUkProblem;
267+
}
268+
269+
public void setPayrollUkProblem(com.xero.models.payrolluk.Problem problem) {
270+
this.payrollUkProblem = problem;
271+
}
272+
273+
@Override
274+
public boolean equals(java.lang.Object o) {
275+
if (this == o) {
276+
return true;
277+
}
278+
if (o == null || getClass() != o.getClass()) {
279+
return false;
280+
}
281+
XeroConflictException error = (XeroConflictException) o;
282+
return Objects.equals(this.statusCode, error.statusCode) &&
283+
Objects.equals(this.type, error.type) &&
284+
Objects.equals(this.message, error.message) &&
285+
Objects.equals(this.elements, error.elements);
286+
}
287+
288+
@Override
289+
public int hashCode() {
290+
return Objects.hash(statusCode, type, message); //, elements
291+
}
292+
293+
294+
@Override
295+
public String toString() {
296+
StringBuilder sb = new StringBuilder();
297+
sb.append("class Error {\n");
298+
sb.append(" statusCode: ").append(toIndentedString(statusCode)).append("\n");
299+
sb.append(" type: ").append(toIndentedString(type)).append("\n");
300+
sb.append(" message: ").append(toIndentedString(message)).append("\n");
301+
sb.append(" elements: ").append(toIndentedString(elements)).append("\n");
302+
sb.append("}");
303+
return sb.toString();
304+
}
305+
306+
/**
307+
* Convert the given object to string with each line indented by 4 spaces
308+
* (except the first line).
309+
*/
310+
private String toIndentedString(java.lang.Object o) {
311+
if (o == null) {
312+
return "null";
313+
}
314+
return o.toString().replace("\n", "\n ");
315+
}
316+
317+
}

0 commit comments

Comments
 (0)