Skip to content

Commit c4ec4c5

Browse files
author
sangeet-joy_xero
committed
PETOSS-712 | NI category update from openAPI
1 parent 7e74dc6 commit c4ec4c5

File tree

15 files changed

+1109
-62
lines changed

15 files changed

+1109
-62
lines changed

docs/payroll_uk/Employee.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Name | Type | Description | Notes
1818
**payroll_calendar_id** | **String** | Xero unique identifier for the payroll calendar of the employee | [optional]
1919
**updated_date_utc** | **DateTime** | UTC timestamp of last update to the employee | [optional]
2020
**created_date_utc** | **DateTime** | UTC timestamp when the employee was created in Xero | [optional]
21+
**ni_category** | [**NICategoryLetter**](NICategoryLetter.md) | | [optional]
22+
**ni_categories** | [**Array<NICategory>**](NICategory.md) | The employee's NI categories | [optional]
2123
**national_insurance_number** | **String** | National insurance number of the employee | [optional]
2224
**is_off_payroll_worker** | **Boolean** | Whether the employee is an off payroll worker | [optional]
2325

@@ -40,6 +42,8 @@ instance = XeroRuby::PayrollUk::Employee.new(employee_id: d90457c4-f1be-4f2e-b4e
4042
payroll_calendar_id: null,
4143
updated_date_utc: null,
4244
created_date_utc: null,
45+
ni_category: null,
46+
ni_categories: null,
4347
national_insurance_number: AB123456C,
4448
is_off_payroll_worker: null)
4549
```

docs/payroll_uk/Employment.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Name | Type | Description | Notes
77
**payroll_calendar_id** | **String** | Xero unique identifier for the payroll calendar of the employee | [optional]
88
**start_date** | **Date** | Start date of the employment (YYYY-MM-DD) | [optional]
99
**employee_number** | **String** | The employment number of the employee | [optional]
10-
**ni_category** | **String** | The NI Category of the employee | [optional]
10+
**ni_category** | [**NICategoryLetter**](NICategoryLetter.md) | | [optional]
11+
**ni_categories** | [**Array<NICategory>**](NICategory.md) | The employee's NI categories | [optional]
1112

1213
## Code Sample
1314

@@ -17,7 +18,8 @@ require 'XeroRuby::PayrollUk'
1718
instance = XeroRuby::PayrollUk::Employment.new(payroll_calendar_id: null,
1819
start_date: null,
1920
employee_number: 7,
20-
ni_category: A)
21+
ni_category: null,
22+
ni_categories: null)
2123
```
2224

2325

docs/payroll_uk/NICategory.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# XeroRuby::PayrollUk::NICategory
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**start_date** | **Date** | The start date of the NI category (YYYY-MM-DD) | [optional]
8+
**ni_category** | [**NICategoryLetter**](NICategoryLetter.md) | |
9+
**ni_category_id** | **Float** | Xero unique identifier for the NI category | [optional]
10+
**date_first_employed_as_civilian** | **Date** | The date in which the employee was first employed as a civilian (YYYY-MM-DD) | [optional]
11+
**workplace_postcode** | **String** | The workplace postcode |
12+
13+
## Code Sample
14+
15+
```ruby
16+
require 'XeroRuby::PayrollUk'
17+
18+
instance = XeroRuby::PayrollUk::NICategory.new(start_date: Mon Dec 02 00:00:00 GMT 2024,
19+
ni_category: null,
20+
ni_category_id: 15,
21+
date_first_employed_as_civilian: Mon Dec 02 00:00:00 GMT 2024,
22+
workplace_postcode: SW1A 1AA)
23+
```
24+
25+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# XeroRuby::PayrollUk::NICategoryLetter
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
8+
## Code Sample
9+
10+
```ruby
11+
require 'XeroRuby::PayrollUk'
12+
13+
instance = XeroRuby::PayrollUk::NICategoryLetter.new()
14+
```
15+
16+

docs/payroll_uk/NICategoryOneOf.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# XeroRuby::PayrollUk::NICategoryOneOf
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**ni_category** | **String** | | [optional]
8+
9+
## Code Sample
10+
11+
```ruby
12+
require 'XeroRuby::PayrollUk'
13+
14+
instance = XeroRuby::PayrollUk::NICategoryOneOf.new(ni_category: null)
15+
```
16+
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# XeroRuby::PayrollUk::NICategoryOneOf1
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**ni_category** | **String** | | [optional]
8+
9+
## Code Sample
10+
11+
```ruby
12+
require 'XeroRuby::PayrollUk'
13+
14+
instance = XeroRuby::PayrollUk::NICategoryOneOf1.new(ni_category: null)
15+
```
16+
17+

docs/payroll_uk/PayrollUkApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ api_instance = xero_client.<api_set>
950950

951951
xero_tenant_id = 'xero_tenant_id_example' # String | Xero identifier for Tenant
952952
employee_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # String | Employee id for single object
953-
employment = { "PayrollCalendarID": "216d80e6-af55-47b1-b718-9457c3f5d2fe", "StartDate": "2020-04-01", "EmployeeNumber": "123ABC", "NICategory": "A" } # Employment |
953+
employment = { "PayrollCalendarID": "216d80e6-af55-47b1-b718-9457c3f5d2fe", "StartDate": "2020-04-01", "NICategories": [ { "NICategory": "A", "StartDate": "2020-05-01" } ], "EmployeeNumber": "123ABC" } # Employment |
954954
opts = {
955955
idempotency_key: 'KEY_VALUE' # String | This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
956956
}

docs/payroll_uk/index.html

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,16 @@
15951595
"format" : "date-time",
15961596
"x-is-datetime" : true
15971597
},
1598+
"niCategory" : {
1599+
"$ref" : "#/components/schemas/NICategoryLetter"
1600+
},
1601+
"niCategories" : {
1602+
"type" : "array",
1603+
"description" : "The employee's NI categories",
1604+
"items" : {
1605+
"$ref" : "#/components/schemas/NICategory"
1606+
}
1607+
},
15981608
"nationalInsuranceNumber" : {
15991609
"type" : "string",
16001610
"description" : "National insurance number of the employee",
@@ -2262,7 +2272,7 @@
22622272
};
22632273
defs["Employment"] = {
22642274
"title" : "",
2265-
"required" : [ "EmployeeNumber", "NICategory", "PayrollCalendarID", "StartDate" ],
2275+
"required" : [ "EmployeeNumber", "NICategories", "PayrollCalendarID", "StartDate" ],
22662276
"type" : "object",
22672277
"properties" : {
22682278
"payrollCalendarID" : {
@@ -2282,10 +2292,14 @@
22822292
"example" : "7"
22832293
},
22842294
"niCategory" : {
2285-
"type" : "string",
2286-
"description" : "The NI Category of the employee",
2287-
"example" : "A",
2288-
"enum" : [ "A", "B", "C", "F", "H", "I", "J", "L", "M", "S", "V", "X", "Z" ]
2295+
"$ref" : "#/components/schemas/NICategoryLetter"
2296+
},
2297+
"niCategories" : {
2298+
"type" : "array",
2299+
"description" : "The employee's NI categories",
2300+
"items" : {
2301+
"$ref" : "#/components/schemas/NICategory"
2302+
}
22892303
}
22902304
},
22912305
"description" : ""
@@ -2502,6 +2516,75 @@
25022516
}
25032517
},
25042518
"description" : ""
2519+
};
2520+
defs["NICategory"] = {
2521+
"title" : "",
2522+
"required" : [ "niCategory", "workplacePostcode" ],
2523+
"type" : "object",
2524+
"properties" : {
2525+
"startDate" : {
2526+
"type" : "string",
2527+
"description" : "The start date of the NI category (YYYY-MM-DD)",
2528+
"format" : "date",
2529+
"example" : "2024-12-02",
2530+
"x-is-date" : true
2531+
},
2532+
"niCategory" : {
2533+
"$ref" : "#/components/schemas/NICategoryLetter"
2534+
},
2535+
"niCategoryID" : {
2536+
"type" : "number",
2537+
"description" : "Xero unique identifier for the NI category",
2538+
"example" : 15
2539+
},
2540+
"dateFirstEmployedAsCivilian" : {
2541+
"type" : "string",
2542+
"description" : "The date in which the employee was first employed as a civilian (YYYY-MM-DD)",
2543+
"format" : "date",
2544+
"example" : "2024-12-02",
2545+
"x-is-date" : true
2546+
},
2547+
"workplacePostcode" : {
2548+
"type" : "string",
2549+
"description" : "The workplace postcode",
2550+
"example" : "SW1A 1AA"
2551+
}
2552+
},
2553+
"description" : "",
2554+
"oneOf" : [ {
2555+
"$ref" : "#/components/schemas/NICategory_oneOf"
2556+
}, {
2557+
"$ref" : "#/components/schemas/NICategory_oneOf_1"
2558+
} ]
2559+
};
2560+
defs["NICategoryLetter"] = {
2561+
"title" : "",
2562+
"type" : "string",
2563+
"description" : "The employee's NI Category letter.",
2564+
"example" : "I",
2565+
"enum" : [ "A", "B", "C", "D", "E", "F", "H", "I", "J", "K", "L", "M", "N", "S", "V", "X", "Z" ]
2566+
};
2567+
defs["NICategory_oneOf"] = {
2568+
"title" : "",
2569+
"required" : [ "workplacePostcode" ],
2570+
"properties" : {
2571+
"niCategory" : {
2572+
"type" : "string",
2573+
"enum" : [ "F", "I", "L", "S", "N", "E", "D", "K" ]
2574+
}
2575+
},
2576+
"description" : ""
2577+
};
2578+
defs["NICategory_oneOf_1"] = {
2579+
"title" : "",
2580+
"required" : [ "dateFirstEmployedAsCivilian" ],
2581+
"properties" : {
2582+
"niCategory" : {
2583+
"type" : "string",
2584+
"enum" : [ "V" ]
2585+
}
2586+
},
2587+
"description" : ""
25052588
};
25062589
defs["Pagination"] = {
25072590
"title" : "",
@@ -5714,6 +5797,8 @@ <h3>Usage and SDK Samples</h3>
57145797
start_date: start_date
57155798
}
57165799

5800+
ni_categories = {
5801+
57175802
begin
57185803
response = xero_client.accounting_api.create_employment(xero_tenant_id, employee_id, employment, idempotency_key)
57195804
return response
@@ -5845,7 +5930,7 @@ <h2>Parameters</h2>
58455930
"schema" : {
58465931
"$ref" : "#/components/schemas/Employment"
58475932
},
5848-
"example" : "{ \"PayrollCalendarID\": \"216d80e6-af55-47b1-b718-9457c3f5d2fe\", \"StartDate\": \"2020-04-01\", \"EmployeeNumber\": \"123ABC\", \"NICategory\": \"A\" }"
5933+
"example" : "{ \"PayrollCalendarID\": \"216d80e6-af55-47b1-b718-9457c3f5d2fe\", \"StartDate\": \"2020-04-01\", \"NICategories\": [ { \"NICategory\": \"A\", \"StartDate\": \"2020-05-01\" } ], \"EmployeeNumber\": \"123ABC\" }"
58495934
}
58505935
},
58515936
"required" : true

lib/xero-ruby.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@
139139
require 'xero-ruby/models/payroll_uk/leave_type'
140140
require 'xero-ruby/models/payroll_uk/leave_type_object'
141141
require 'xero-ruby/models/payroll_uk/leave_types'
142+
require 'xero-ruby/models/payroll_uk/ni_category'
143+
require 'xero-ruby/models/payroll_uk/ni_category_letter'
144+
require 'xero-ruby/models/payroll_uk/ni_category_one_of'
145+
require 'xero-ruby/models/payroll_uk/ni_category_one_of1'
142146
require 'xero-ruby/models/payroll_uk/pagination'
143147
require 'xero-ruby/models/payroll_uk/pay_run'
144148
require 'xero-ruby/models/payroll_uk/pay_run_calendar'

lib/xero-ruby/models/payroll_uk/employee.rb

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ class Employee
6060
# UTC timestamp when the employee was created in Xero
6161
attr_accessor :created_date_utc
6262

63+
64+
attr_accessor :ni_category
65+
66+
# The employee's NI categories
67+
attr_accessor :ni_categories
68+
6369
# National insurance number of the employee
6470
attr_accessor :national_insurance_number
6571

@@ -105,6 +111,8 @@ def self.attribute_map
105111
:'payroll_calendar_id' => :'payrollCalendarID',
106112
:'updated_date_utc' => :'updatedDateUTC',
107113
:'created_date_utc' => :'createdDateUTC',
114+
:'ni_category' => :'niCategory',
115+
:'ni_categories' => :'niCategories',
108116
:'national_insurance_number' => :'nationalInsuranceNumber',
109117
:'is_off_payroll_worker' => :'isOffPayrollWorker'
110118
}
@@ -127,6 +135,8 @@ def self.openapi_types
127135
:'payroll_calendar_id' => :'String',
128136
:'updated_date_utc' => :'DateTime',
129137
:'created_date_utc' => :'DateTime',
138+
:'ni_category' => :'NICategoryLetter',
139+
:'ni_categories' => :'Array<NICategory>',
130140
:'national_insurance_number' => :'String',
131141
:'is_off_payroll_worker' => :'Boolean'
132142
}
@@ -203,6 +213,16 @@ def initialize(attributes = {})
203213
self.created_date_utc = attributes[:'created_date_utc']
204214
end
205215

216+
if attributes.key?(:'ni_category')
217+
self.ni_category = attributes[:'ni_category']
218+
end
219+
220+
if attributes.key?(:'ni_categories')
221+
if (value = attributes[:'ni_categories']).is_a?(Array)
222+
self.ni_categories = value
223+
end
224+
end
225+
206226
if attributes.key?(:'national_insurance_number')
207227
self.national_insurance_number = attributes[:'national_insurance_number']
208228
end
@@ -256,6 +276,8 @@ def ==(o)
256276
payroll_calendar_id == o.payroll_calendar_id &&
257277
updated_date_utc == o.updated_date_utc &&
258278
created_date_utc == o.created_date_utc &&
279+
ni_category == o.ni_category &&
280+
ni_categories == o.ni_categories &&
259281
national_insurance_number == o.national_insurance_number &&
260282
is_off_payroll_worker == o.is_off_payroll_worker
261283
end
@@ -269,7 +291,7 @@ def eql?(o)
269291
# Calculates hash code according to all attributes.
270292
# @return [Integer] Hash code
271293
def hash
272-
[employee_id, title, first_name, last_name, date_of_birth, address, email, gender, phone_number, start_date, end_date, payroll_calendar_id, updated_date_utc, created_date_utc, national_insurance_number, is_off_payroll_worker].hash
294+
[employee_id, title, first_name, last_name, date_of_birth, address, email, gender, phone_number, start_date, end_date, payroll_calendar_id, updated_date_utc, created_date_utc, ni_category, ni_categories, national_insurance_number, is_off_payroll_worker].hash
273295
end
274296

275297
# Builds the object from hash

0 commit comments

Comments
 (0)