xeroizer 2.17.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +246 -213
- data/lib/xeroizer/connection.rb +49 -0
- data/lib/xeroizer/exceptions.rb +4 -0
- data/lib/xeroizer/generic_application.rb +13 -5
- data/lib/xeroizer/http.rb +7 -80
- data/lib/xeroizer/http_response.rb +154 -0
- data/lib/xeroizer/models/bank_account.rb +1 -0
- data/lib/xeroizer/models/bank_transaction.rb +1 -0
- data/lib/xeroizer/models/batch_payment.rb +27 -0
- data/lib/xeroizer/models/branding_theme.rb +49 -9
- data/lib/xeroizer/models/contact.rb +12 -6
- data/lib/xeroizer/models/contact_group.rb +45 -0
- data/lib/xeroizer/models/credit_note.rb +24 -22
- data/lib/xeroizer/models/currency.rb +14 -2
- data/lib/xeroizer/models/from_bank_account.rb +1 -0
- data/lib/xeroizer/models/history_record.rb +72 -0
- data/lib/xeroizer/models/invoice.rb +17 -3
- data/lib/xeroizer/models/item.rb +2 -1
- data/lib/xeroizer/models/item_purchase_details.rb +1 -1
- data/lib/xeroizer/models/line_item.rb +17 -5
- data/lib/xeroizer/models/manual_journal.rb +2 -1
- data/lib/xeroizer/models/online_invoice.rb +37 -0
- data/lib/xeroizer/models/option.rb +1 -1
- data/lib/xeroizer/models/organisation.rb +2 -0
- data/lib/xeroizer/models/payment_service.rb +22 -0
- data/lib/xeroizer/models/payroll/address.rb +53 -0
- data/lib/xeroizer/models/payroll/bank_account.rb +18 -6
- data/lib/xeroizer/models/payroll/benefit_line.rb +26 -0
- data/lib/xeroizer/models/payroll/benefit_type.rb +45 -0
- data/lib/xeroizer/models/payroll/deduction_line.rb +32 -0
- data/lib/xeroizer/models/payroll/deduction_type.rb +49 -0
- data/lib/xeroizer/models/payroll/earnings_line.rb +39 -0
- data/lib/xeroizer/models/payroll/earnings_type.rb +53 -0
- data/lib/xeroizer/models/payroll/employee.rb +30 -8
- data/lib/xeroizer/models/payroll/leave_application.rb +27 -0
- data/lib/xeroizer/models/payroll/leave_line.rb +30 -0
- data/lib/xeroizer/models/payroll/leave_period.rb +15 -0
- data/lib/xeroizer/models/payroll/pay_items.rb +22 -0
- data/lib/xeroizer/models/payroll/pay_run.rb +33 -0
- data/lib/xeroizer/models/payroll/pay_schedule.rb +40 -0
- data/lib/xeroizer/models/payroll/pay_template.rb +24 -0
- data/lib/xeroizer/models/payroll/payment_method.rb +24 -0
- data/lib/xeroizer/models/payroll/paystub.rb +44 -0
- data/lib/xeroizer/models/payroll/reimbursement_line.rb +21 -0
- data/lib/xeroizer/models/payroll/reimbursement_type.rb +22 -0
- data/lib/xeroizer/models/payroll/salary_and_wage.rb +29 -0
- data/lib/xeroizer/models/payroll/super_line.rb +40 -0
- data/lib/xeroizer/models/payroll/tax_declaration.rb +50 -0
- data/lib/xeroizer/models/payroll/time_off_line.rb +20 -0
- data/lib/xeroizer/models/payroll/time_off_type.rb +32 -0
- data/lib/xeroizer/models/payroll/work_location.rb +25 -0
- data/lib/xeroizer/models/prepayment.rb +1 -0
- data/lib/xeroizer/models/purchase_order.rb +6 -6
- data/lib/xeroizer/models/quote.rb +76 -0
- data/lib/xeroizer/models/schedule.rb +1 -0
- data/lib/xeroizer/models/tax_component.rb +1 -0
- data/lib/xeroizer/models/to_bank_account.rb +1 -0
- data/lib/xeroizer/oauth.rb +12 -1
- data/lib/xeroizer/oauth2.rb +82 -0
- data/lib/xeroizer/oauth2_application.rb +49 -0
- data/lib/xeroizer/payroll_application.rb +8 -3
- data/lib/xeroizer/record/base.rb +11 -2
- data/lib/xeroizer/record/base_model.rb +1 -1
- data/lib/xeroizer/record/base_model_http_proxy.rb +37 -17
- data/lib/xeroizer/record/model_definition_helper.rb +1 -1
- data/lib/xeroizer/record/payroll_base.rb +4 -0
- data/lib/xeroizer/record/record_association_helper.rb +4 -4
- data/lib/xeroizer/record/validators/associated_validator.rb +1 -0
- data/lib/xeroizer/record/xml_helper.rb +18 -18
- data/lib/xeroizer/report/aged_receivables_by_contact.rb +1 -1
- data/lib/xeroizer/report/cell_xml_helper.rb +13 -13
- data/lib/xeroizer/response.rb +22 -17
- data/lib/xeroizer/version.rb +1 -1
- data/lib/xeroizer.rb +34 -4
- data/test/acceptance/about_creating_bank_transactions_test.rb +89 -81
- data/test/acceptance/about_creating_prepayment_test.rb +25 -30
- data/test/acceptance/about_fetching_bank_transactions_test.rb +12 -12
- data/test/acceptance/about_online_invoice_test.rb +25 -0
- data/test/acceptance/acceptance_test.rb +28 -26
- data/test/acceptance/bank_transfer_test.rb +12 -17
- data/test/acceptance/bulk_operations_test.rb +18 -16
- data/test/acceptance/connections_test.rb +11 -0
- data/test/stub_responses/bad_request.json +6 -0
- data/test/stub_responses/connections.json +16 -0
- data/test/stub_responses/expired_oauth2_token.json +6 -0
- data/test/stub_responses/generic_response_error.json +6 -0
- data/test/stub_responses/invalid_oauth2_request_token.json +6 -0
- data/test/stub_responses/invalid_tenant_header.json +6 -0
- data/test/stub_responses/object_not_found.json +6 -0
- data/test/stub_responses/organisations.xml +10 -0
- data/test/stub_responses/payment_service.xml +15 -0
- data/test/test_helper.rb +17 -12
- data/test/unit/generic_application_test.rb +21 -10
- data/test/unit/http_test.rb +282 -10
- data/test/unit/models/address_test.rb +2 -2
- data/test/unit/models/bank_transaction_model_parsing_test.rb +2 -2
- data/test/unit/models/bank_transaction_test.rb +1 -1
- data/test/unit/models/bank_transaction_validation_test.rb +1 -1
- data/test/unit/models/contact_test.rb +20 -11
- data/test/unit/models/credit_note_test.rb +8 -8
- data/test/unit/models/employee_test.rb +4 -4
- data/test/unit/models/invoice_test.rb +12 -12
- data/test/unit/models/journal_line_test.rb +6 -6
- data/test/unit/models/journal_test.rb +4 -4
- data/test/unit/models/line_item_sum_test.rb +1 -1
- data/test/unit/models/line_item_test.rb +29 -37
- data/test/unit/models/manual_journal_test.rb +3 -3
- data/test/unit/models/organisation_test.rb +16 -2
- data/test/unit/models/payment_service_test.rb +29 -0
- data/test/unit/models/phone_test.rb +7 -7
- data/test/unit/models/prepayment_test.rb +4 -4
- data/test/unit/models/repeating_invoice_test.rb +3 -3
- data/test/unit/models/tax_rate_test.rb +2 -2
- data/test/unit/oauth2_test.rb +171 -0
- data/test/unit/oauth_config_test.rb +1 -1
- data/test/unit/record/base_model_test.rb +13 -13
- data/test/unit/record/base_test.rb +73 -4
- data/test/unit/record/block_validator_test.rb +1 -1
- data/test/unit/record/connection_test.rb +60 -0
- data/test/unit/record/model_definition_test.rb +36 -36
- data/test/unit/record/parse_params_test.rb +59 -0
- data/test/unit/record/parse_where_hash_test.rb +13 -13
- data/test/unit/record/record_association_test.rb +14 -14
- data/test/unit/record/validators_test.rb +43 -43
- data/test/unit/record_definition_test.rb +7 -7
- data/test/unit/report_definition_test.rb +7 -7
- data/test/unit/report_test.rb +20 -20
- data/test/unit_test_helper.rb +16 -0
- metadata +117 -27
- data/lib/xeroizer/models/payroll/home_address.rb +0 -24
- data/lib/xeroizer/partner_application.rb +0 -51
- data/lib/xeroizer/private_application.rb +0 -25
- data/lib/xeroizer/public_application.rb +0 -21
- data/test/unit/oauth_test.rb +0 -118
- data/test/unit/private_application_test.rb +0 -20
@@ -0,0 +1,49 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class DeductionTypeModel < PayrollBaseModel
|
6
|
+
|
7
|
+
set_permissions :read
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class DeductionType < PayrollBase
|
12
|
+
|
13
|
+
DEDUCTION_CATEGORIES = {
|
14
|
+
'AFTERTAXDEDUCTION' => '',
|
15
|
+
'DEPENDENTCARE' => '',
|
16
|
+
'FLEXIBLESPENDINGACCOUNT' => '',
|
17
|
+
'HEALTHSAVINGSACCOUNTSINGLEPLAN' => '',
|
18
|
+
'HEALTHSAVINGSACCOUNTFAMILYPLAN' => '',
|
19
|
+
'ROTH401KREITREMENTPLAN' => '',
|
20
|
+
'ROTH403BRETIREMENTPLAN' => '',
|
21
|
+
'SECTION125PLAN' => '',
|
22
|
+
'SIMPLEIRARETIREMENTPLAN' => '',
|
23
|
+
'401KRETIREMENTPLAN' => '',
|
24
|
+
'403BRETIREMENTPLAN' => '',
|
25
|
+
'457RETIREMENTPLAN' => ''
|
26
|
+
} unless defined?(DEDUCTION_CATEGORIES)
|
27
|
+
|
28
|
+
CALCULATION_TYPES = {
|
29
|
+
'CATCHUPPLAN' => '',
|
30
|
+
'STANDARDPLAN' => ''
|
31
|
+
} unless defined?(CALCULATION_TYPES)
|
32
|
+
|
33
|
+
set_primary_key :deduction_type_id
|
34
|
+
|
35
|
+
guid :deduction_type_id
|
36
|
+
string :deduction_type
|
37
|
+
string :deduction_category
|
38
|
+
string :calculation_type
|
39
|
+
string :liability_account_code
|
40
|
+
decimal :standard_amount
|
41
|
+
decimal :company_max
|
42
|
+
|
43
|
+
validates_inclusion_of :deduction_category, :in => DEDUCTION_CATEGORIES
|
44
|
+
validates_inclusion_of :calculation_type, :in => CALCULATION_TYPES
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class EarningsLineModel < PayrollBaseModel
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
class EarningsLine < PayrollBase
|
10
|
+
|
11
|
+
EARNINGS_RATE_CALCULATION_TYPE = {
|
12
|
+
'USEEARNINGSRATE' => 'Use the rate per unit recorded for the earnings rate under Settings',
|
13
|
+
'ENTEREARNINGSRATE' => 'The rate per unit is be added manually to the earnings line',
|
14
|
+
'ANNUALSALARY' => 'If the employee receives a salary, the annual salary amount and units of work per week are added to the earnings line'
|
15
|
+
} unless defined?(EARNINGS_RATE_CALCULATION_TYPE)
|
16
|
+
|
17
|
+
guid :earning_rate_id, :api_name => 'EarningsRateID'
|
18
|
+
string :calculation_type
|
19
|
+
|
20
|
+
decimal :number_of_units_per_week
|
21
|
+
decimal :annual_salary
|
22
|
+
decimal :rate_per_unit
|
23
|
+
decimal :normal_number_of_units
|
24
|
+
|
25
|
+
# US Payroll fields
|
26
|
+
guid :earnings_type_id
|
27
|
+
decimal :units_or_hours
|
28
|
+
decimal :amount
|
29
|
+
decimal :fixed_amount
|
30
|
+
decimal :number_of_units
|
31
|
+
|
32
|
+
validates_presence_of :earning_rate_id, :if => Proc.new { |el| el.earnings_type_id.blank? }
|
33
|
+
validates_presence_of :earnings_type_id, :if => Proc.new { |el| el.earning_rate_id.blank? }
|
34
|
+
validates_inclusion_of :calculation_type, :in => EARNINGS_RATE_CALCULATION_TYPE, :unless => :new_record?
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class EarningsTypeModel < PayrollBaseModel
|
6
|
+
|
7
|
+
set_permissions :read
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class EarningsType < PayrollBase
|
12
|
+
|
13
|
+
EARNINGS_CATEGORIES = {
|
14
|
+
'REGULAREARNINGS' => '',
|
15
|
+
'OVERTIMEEARNINGS' => '',
|
16
|
+
'ALLOWANCE' => '',
|
17
|
+
'COMMISSION' => '',
|
18
|
+
'BONUS' => '',
|
19
|
+
'CASHTIPS' => '',
|
20
|
+
'NONCASHTIPS' => '',
|
21
|
+
'ADDITIONALEARNINGS' => '',
|
22
|
+
'RETROACTIVEPAY' => '',
|
23
|
+
'CLERGYHOUSINGALLOWANCE' => '',
|
24
|
+
'CLERGYHOUSINGINKIND' => ''
|
25
|
+
} unless defined?(EARNINGS_CATEGORIES)
|
26
|
+
|
27
|
+
RATE_TYPES = {
|
28
|
+
'FIXEDAMOUNT' => '',
|
29
|
+
'MULTIPLE' => '',
|
30
|
+
'RATEPERUNIT' => ''
|
31
|
+
} unless defined?(RATE_TYPES)
|
32
|
+
|
33
|
+
set_primary_key :earnings_type_id
|
34
|
+
|
35
|
+
guid :earnings_type_id
|
36
|
+
guid :earnings_rate_id
|
37
|
+
string :earnings_type
|
38
|
+
string :expense_account_code
|
39
|
+
string :earnings_category
|
40
|
+
string :rate_type
|
41
|
+
string :type_of_units
|
42
|
+
decimal :multiple
|
43
|
+
boolean :do_not_accrue_time_off
|
44
|
+
boolean :is_supplemental
|
45
|
+
decimal :amount
|
46
|
+
|
47
|
+
validates_inclusion_of :earnings_category, :in => EARNINGS_CATEGORIES
|
48
|
+
validates_inclusion_of :rate_type, :in => RATE_TYPES
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,15 +1,18 @@
|
|
1
1
|
module Xeroizer
|
2
2
|
module Record
|
3
3
|
module Payroll
|
4
|
-
|
4
|
+
|
5
5
|
class EmployeeModel < PayrollBaseModel
|
6
|
-
|
6
|
+
|
7
7
|
set_permissions :read, :write, :update
|
8
|
-
|
8
|
+
|
9
|
+
def create_method
|
10
|
+
:http_post
|
11
|
+
end
|
9
12
|
end
|
10
|
-
|
13
|
+
|
11
14
|
class Employee < PayrollBase
|
12
|
-
|
15
|
+
|
13
16
|
set_primary_key :employee_id
|
14
17
|
|
15
18
|
guid :employee_id
|
@@ -34,12 +37,31 @@ module Xeroizer
|
|
34
37
|
string :employee_group_name
|
35
38
|
date :termination_date
|
36
39
|
datetime_utc :updated_date_utc, :api_name => 'UpdatedDateUTC'
|
37
|
-
|
38
|
-
|
40
|
+
|
41
|
+
has_one :home_address, :internal_name_singular => "home_address", :model_name => "HomeAddress"
|
42
|
+
has_one :tax_declaration, :internal_name_singular => "tax_declaration", :model_name => "TaxDeclaration"
|
43
|
+
has_one :pay_template, :internal_name_singular => "pay_template", :model_name => "PayTemplate"
|
39
44
|
has_many :bank_accounts
|
40
45
|
|
46
|
+
# US Payroll fields
|
47
|
+
string :job_title
|
48
|
+
string :employee_number
|
49
|
+
string :social_security_number
|
50
|
+
guid :pay_schedule_id
|
51
|
+
string :employment_basis
|
52
|
+
guid :holiday_group_id
|
53
|
+
boolean :is_authorised_to_approve_time_off
|
54
|
+
|
55
|
+
has_many :salary_and_wages
|
56
|
+
has_many :work_locations
|
57
|
+
has_one :payment_method, :model_name => "PaymentMethod"
|
58
|
+
has_one :mailing_address, :internal_name_singular => "mailing_address", :model_name => "MailingAddress"
|
59
|
+
|
60
|
+
validates_presence_of :first_name, :last_name, :unless => :new_record?
|
61
|
+
validates_presence_of :date_of_birth
|
62
|
+
validates_presence_of :pay_schedule_id, :if => Proc.new { | record | !record.salary_and_wages.blank? }
|
41
63
|
end
|
42
64
|
|
43
|
-
end
|
65
|
+
end
|
44
66
|
end
|
45
67
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
class LeaveApplicationModel < PayrollBaseModel
|
5
|
+
set_permissions :read, :write, :update
|
6
|
+
end
|
7
|
+
|
8
|
+
class LeaveApplication < PayrollBase
|
9
|
+
set_primary_key :leave_application_id
|
10
|
+
|
11
|
+
guid :leave_application_id
|
12
|
+
guid :employee_id
|
13
|
+
guid :leave_type_id
|
14
|
+
|
15
|
+
string :title
|
16
|
+
date :start_date
|
17
|
+
date :end_date
|
18
|
+
|
19
|
+
string :description
|
20
|
+
|
21
|
+
has_many :leave_periods
|
22
|
+
|
23
|
+
validates_presence_of :employee_id, :leave_type_id, :title, :start_date, :end_date
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class LeaveLineModel < PayrollBaseModel
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
class LeaveLine < PayrollBase
|
10
|
+
|
11
|
+
LEAVE_TYPE_CALCULATION_TYPE = {
|
12
|
+
'FIXEDAMOUNTEACHPERIOD' => 'You can enter a manually calculated rate for the accrual, accrue a fixed amount of leave each pay period based on an annual entitlement (for example, if you pay your employees monthly, you would accrue 1/12th of their annual entitlement each month), or accrue an amount relative to the number of hours an employee worked in the pay period',
|
13
|
+
'ENTERRATEINPAYTEMPLATE' => '',
|
14
|
+
'BASEDONORDINARYEARNINGS' => ''
|
15
|
+
} unless defined?(LEAVE_TYPE_CALCULATION_TYPE)
|
16
|
+
|
17
|
+
guid :leave_type_id, :api_name => 'LeaveTypeID'
|
18
|
+
string :calculation_type
|
19
|
+
|
20
|
+
decimal :annual_number_of_units
|
21
|
+
decimal :full_time_number_of_units_per_period
|
22
|
+
decimal :number_of_units
|
23
|
+
|
24
|
+
validates_presence_of :leave_type_id, :calculation_type, :unless => :new_record?
|
25
|
+
validates_inclusion_of :calculation_type, :in => LEAVE_TYPE_CALCULATION_TYPE
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
class LeavePeriodModel < PayrollBaseModel
|
5
|
+
end
|
6
|
+
|
7
|
+
class LeavePeriod < PayrollBase
|
8
|
+
decimal :number_of_units
|
9
|
+
date :pay_period_start_date
|
10
|
+
date :pay_period_end_date
|
11
|
+
string :leave_period_status
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class PayItemsModel < PayrollBaseModel
|
6
|
+
|
7
|
+
set_permissions :read
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class PayItems < PayrollBase
|
12
|
+
|
13
|
+
has_many :earnings_types
|
14
|
+
has_many :benefit_types
|
15
|
+
has_many :deduction_types
|
16
|
+
has_many :reimbursement_types
|
17
|
+
has_many :time_off_types
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class PayRunModel < PayrollBaseModel
|
6
|
+
|
7
|
+
set_permissions :read, :write, :update
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class PayRun < PayrollBase
|
12
|
+
|
13
|
+
set_primary_key :pay_run_id
|
14
|
+
|
15
|
+
guid :pay_run_id
|
16
|
+
guid :pay_schedule_id
|
17
|
+
date :pay_run_period_end_date
|
18
|
+
string :pay_run_status
|
19
|
+
date :pay_run_period_start_date
|
20
|
+
date :payment_date
|
21
|
+
decimal :earnings
|
22
|
+
decimal :deductions
|
23
|
+
decimal :reimbursement
|
24
|
+
decimal :net_pay
|
25
|
+
decimal :tax
|
26
|
+
datetime_utc :updated_date_utc, :api_name => 'UpdatedDateUTC'
|
27
|
+
|
28
|
+
has_many :paystubs
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class PayScheduleModel < PayrollBaseModel
|
6
|
+
|
7
|
+
set_permissions :read, :write, :update
|
8
|
+
|
9
|
+
def create_method
|
10
|
+
:http_post
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class PaySchedule < PayrollBase
|
15
|
+
|
16
|
+
SCHEDULE_TYPES = {
|
17
|
+
'WEEKLY' => 'Once per week on the same Day each week',
|
18
|
+
'MONTHLY' => 'Once a month on the same Day each month',
|
19
|
+
'BIWEEKLY' => 'Every 14 days on the same Day each period',
|
20
|
+
'QUARTERLY' => 'Once a quarter on the same Day',
|
21
|
+
'SEMIMONTHLY' => 'Twice a month on the same 2 Days each period',
|
22
|
+
'FOURWEEKLY' => '',
|
23
|
+
'YEARLY' => ''
|
24
|
+
} unless defined?(SCHEDULE_TYPES)
|
25
|
+
|
26
|
+
set_primary_key :pay_schedule_id
|
27
|
+
|
28
|
+
guid :pay_schedule_id
|
29
|
+
string :pay_schedule_name
|
30
|
+
date :payment_date
|
31
|
+
date :start_date
|
32
|
+
string :schedule_type
|
33
|
+
|
34
|
+
validates_presence_of :pay_schedule_name, :payment_date,
|
35
|
+
:start_date, :schedule_type, :unless => :new_record?
|
36
|
+
validates_inclusion_of :schedule_type, :in => SCHEDULE_TYPES
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class PayTemplateModel < PayrollBaseModel
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
class PayTemplate < PayrollBase
|
10
|
+
|
11
|
+
has_many :earnings_lines
|
12
|
+
has_many :deduction_lines
|
13
|
+
has_many :super_lines
|
14
|
+
has_many :reimbursement_lines
|
15
|
+
has_many :leave_lines
|
16
|
+
|
17
|
+
# US Payroll fields
|
18
|
+
has_many :benefit_lines
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class PaymentMethodModel < PayrollBaseModel
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
class PaymentMethod < PayrollBase
|
10
|
+
|
11
|
+
PAYMENT_METHOD_TYPE = {
|
12
|
+
'CHECK' => '',
|
13
|
+
'MANUAL' => '',
|
14
|
+
'DIRECTDEPOSIT' => ''
|
15
|
+
} unless defined?(PAYMENT_METHOD_TYPE)
|
16
|
+
|
17
|
+
string :payment_method_type
|
18
|
+
has_many :bank_accounts
|
19
|
+
|
20
|
+
validates_inclusion_of :payment_method_type, :in => PAYMENT_METHOD_TYPE
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class PaystubModel < PayrollBaseModel
|
6
|
+
|
7
|
+
set_permissions :read, :write, :update
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class Paystub < PayrollBase
|
12
|
+
|
13
|
+
set_primary_key :paystub_id
|
14
|
+
|
15
|
+
guid :paystub_id
|
16
|
+
guid :employee_id
|
17
|
+
guid :pay_run_id
|
18
|
+
string :first_name
|
19
|
+
string :last_name
|
20
|
+
datetime :last_edited
|
21
|
+
decimal :earnings
|
22
|
+
decimal :deductions
|
23
|
+
decimal :tax
|
24
|
+
decimal :reimbursements
|
25
|
+
decimal :net_pay
|
26
|
+
datetime_utc :updated_date_utc, :api_name => 'UpdatedDateUTC'
|
27
|
+
date :payment_date
|
28
|
+
|
29
|
+
has_many :earnings_lines
|
30
|
+
has_many :leave_earnings_lines, :model_name => 'EarningsLine'
|
31
|
+
has_many :timesheet_earnings_lines, :model_name => 'EarningsLine'
|
32
|
+
has_many :deduction_lines
|
33
|
+
has_many :reimbursement_lines
|
34
|
+
has_many :benefit_lines
|
35
|
+
has_many :time_off_lines
|
36
|
+
|
37
|
+
belongs_to :pay_run
|
38
|
+
|
39
|
+
validates_presence_of :paystub_id, :unless => :new_record?
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class ReimbursementLineModel < PayrollBaseModel
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
class ReimbursementLine < PayrollBase
|
10
|
+
|
11
|
+
guid :reimbursement_type_id, :api_name => 'ReimbursementTypeID'
|
12
|
+
|
13
|
+
string :description
|
14
|
+
decimal :amount
|
15
|
+
|
16
|
+
validates_presence_of :reimbursement_type_id, :unless => :new_record?
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class ReimbursementTypeModel < PayrollBaseModel
|
6
|
+
|
7
|
+
set_permissions :read
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class ReimbursementType < PayrollBase
|
12
|
+
|
13
|
+
set_primary_key :reimbursement_type_id
|
14
|
+
|
15
|
+
guid :reimbursement_type_id
|
16
|
+
string :reimbursement_type
|
17
|
+
string :expense_or_liability_account_code
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class SalaryAndWageModel < PayrollBaseModel
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
class SalaryAndWage < PayrollBase
|
10
|
+
|
11
|
+
SALARY_AND_WAGE_TYPE = {
|
12
|
+
'HOURLY' => '',
|
13
|
+
'SALARY' => ''
|
14
|
+
} unless defined?(SALARY_AND_WAGE_TYPE)
|
15
|
+
|
16
|
+
guid :salary_and_wages_id
|
17
|
+
guid :earnings_type_id
|
18
|
+
string :salary_wages_type
|
19
|
+
decimal :hourly_rate
|
20
|
+
decimal :annual_salary
|
21
|
+
decimal :standard_hours_per_week
|
22
|
+
datetime :effective_date
|
23
|
+
|
24
|
+
validates_presence_of :salary_and_wage_id, :unless => :new_record?
|
25
|
+
validates_inclusion_of :salary_wages_type, :in => SALARY_AND_WAGE_TYPE
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class SuperLineModel < PayrollBaseModel
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
class SuperLine < PayrollBase
|
10
|
+
|
11
|
+
SUPERANNUATION_CONTRIBUTION_TYPE = {
|
12
|
+
'SGC' => 'Mandatory 9% contribution',
|
13
|
+
'SALARYSACRIFICE' => 'Pre-tax reportable employer superannuation contribution, which is displayed separately on payment summaries',
|
14
|
+
'EMPLOYERADDITIONAL' => 'Additional employer superannuation contribution, which is displayed as RESC on payment summaries',
|
15
|
+
'EMPLOYEE' => 'Post-tax employee superannuation contribution'
|
16
|
+
} unless defined?(SUPERANNUATION_CONTRIBUTION_TYPE)
|
17
|
+
|
18
|
+
SUPERANNUATION_CALCULATION_TYPE = {
|
19
|
+
'FIXEDAMOUNT' => 'For voluntary superannuation, the contribution amount can be a fixed rate or a percentage of earnings. For SGC contributions it must be a percentage',
|
20
|
+
'PERCENTAGEOFEARNINGS' => '',
|
21
|
+
'STATUTORY' => ''
|
22
|
+
} unless defined?(SUPERANNUATION_CALCULATION_TYPE)
|
23
|
+
|
24
|
+
guid :super_membership_id, :api_name => 'SuperMembershipID'
|
25
|
+
string :contribution_type
|
26
|
+
string :calculation_type
|
27
|
+
integer :expense_account_code
|
28
|
+
integer :liability_account_code
|
29
|
+
|
30
|
+
decimal :minimum_monthly_earnings
|
31
|
+
decimal :percentage
|
32
|
+
|
33
|
+
validates_presence_of :super_membership_id, :contribution_type, :calculation_type, :expense_account_code, :liability_account_code, :unless => :new_record?
|
34
|
+
validates_inclusion_of :contribution_type, :in => SUPERANNUATION_CONTRIBUTION_TYPE
|
35
|
+
validates_inclusion_of :calculation_type, :in => SUPERANNUATION_CALCULATION_TYPE
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class TaxDeclarationModel < PayrollBaseModel
|
6
|
+
set_xml_node_name 'TaxDeclaration'
|
7
|
+
end
|
8
|
+
|
9
|
+
class TaxDeclaration < PayrollBase
|
10
|
+
|
11
|
+
EMPLOYMENT_BASIS = {
|
12
|
+
'FULLTIME' => '',
|
13
|
+
'PARTTIME' => '',
|
14
|
+
'CASUAL' => '',
|
15
|
+
'LABOURHIRE' => '',
|
16
|
+
'SUPERINCOMESTREAM' => ''
|
17
|
+
|
18
|
+
} unless defined?(EMPLOYMENT_BASIS)
|
19
|
+
|
20
|
+
TFN_EXEMPTION_TYPE = {
|
21
|
+
'NOTQUOTED' => 'Employee has not provided a TFN.',
|
22
|
+
'PENDING' => 'Employee has made a separate application or Enquiry to the ATO for a new or existing TFN.',
|
23
|
+
'PENSIONER' => 'Employee is claiming that they are in receipt of a pension, benefit or allowance.',
|
24
|
+
'UNDER18' => 'Employee is claiming an exemption as they are under the age of 18 and do not earn enough to pay tax.'
|
25
|
+
} unless defined?(TFN_EXEMPTION_TYPE)
|
26
|
+
|
27
|
+
string :tax_file_number
|
28
|
+
|
29
|
+
string :tfn_exemption_type, :api_name => 'TFNExemptionType'
|
30
|
+
string :employment_basis
|
31
|
+
|
32
|
+
boolean :australian_resident_for_tax_purposes
|
33
|
+
boolean :tax_free_threshold_claimed
|
34
|
+
boolean :has_help_debt, :api_name => 'HasHELPDebt'
|
35
|
+
boolean :has_sfss_debt, :api_name => 'HasSFSSDebt'
|
36
|
+
boolean :eligible_to_receive_leave_loading
|
37
|
+
|
38
|
+
decimal :tax_offset_estimated_amount
|
39
|
+
decimal :upward_variation_tax_withholding_amount
|
40
|
+
decimal :approved_withholding_variation_percentage
|
41
|
+
|
42
|
+
datetime_utc :updated_date_utc, :api_name => 'UpdatedDateUTC'
|
43
|
+
|
44
|
+
validates_inclusion_of :employment_basis, :in => EMPLOYMENT_BASIS
|
45
|
+
validates_inclusion_of :tfn_exemption_type, :in => EMPLOYMENT_BASIS
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Xeroizer
|
2
|
+
module Record
|
3
|
+
module Payroll
|
4
|
+
|
5
|
+
class TimeOffLineModel < PayrollBaseModel
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
class TimeOffLine < PayrollBase
|
10
|
+
|
11
|
+
guid :time_off_type_id, :api_name => 'TimeOffTypeID'
|
12
|
+
decimal :hours
|
13
|
+
decimal :balance
|
14
|
+
|
15
|
+
validates_presence_of :time_off_type_id, :unless => :new_record?
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|