xeroizer 2.18.1 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +199 -223
  3. data/lib/xeroizer/connection.rb +49 -0
  4. data/lib/xeroizer/exceptions.rb +2 -0
  5. data/lib/xeroizer/generic_application.rb +12 -5
  6. data/lib/xeroizer/http.rb +5 -78
  7. data/lib/xeroizer/http_response.rb +157 -0
  8. data/lib/xeroizer/models/bank_account.rb +1 -0
  9. data/lib/xeroizer/models/bank_transaction.rb +1 -0
  10. data/lib/xeroizer/models/batch_payment.rb +27 -0
  11. data/lib/xeroizer/models/branding_theme.rb +49 -9
  12. data/lib/xeroizer/models/contact.rb +10 -4
  13. data/lib/xeroizer/models/contact_group.rb +45 -0
  14. data/lib/xeroizer/models/credit_note.rb +23 -22
  15. data/lib/xeroizer/models/from_bank_account.rb +1 -0
  16. data/lib/xeroizer/models/history_record.rb +72 -0
  17. data/lib/xeroizer/models/invoice.rb +14 -3
  18. data/lib/xeroizer/models/line_item.rb +17 -5
  19. data/lib/xeroizer/models/manual_journal.rb +2 -1
  20. data/lib/xeroizer/models/option.rb +1 -1
  21. data/lib/xeroizer/models/organisation.rb +2 -0
  22. data/lib/xeroizer/models/payment_service.rb +22 -0
  23. data/lib/xeroizer/models/payroll/address.rb +53 -0
  24. data/lib/xeroizer/models/payroll/bank_account.rb +18 -6
  25. data/lib/xeroizer/models/payroll/benefit_line.rb +26 -0
  26. data/lib/xeroizer/models/payroll/benefit_type.rb +45 -0
  27. data/lib/xeroizer/models/payroll/deduction_line.rb +32 -0
  28. data/lib/xeroizer/models/payroll/deduction_type.rb +49 -0
  29. data/lib/xeroizer/models/payroll/earnings_line.rb +39 -0
  30. data/lib/xeroizer/models/payroll/earnings_type.rb +53 -0
  31. data/lib/xeroizer/models/payroll/employee.rb +30 -8
  32. data/lib/xeroizer/models/payroll/leave_application.rb +27 -0
  33. data/lib/xeroizer/models/payroll/leave_line.rb +30 -0
  34. data/lib/xeroizer/models/payroll/leave_period.rb +15 -0
  35. data/lib/xeroizer/models/payroll/pay_items.rb +22 -0
  36. data/lib/xeroizer/models/payroll/pay_run.rb +33 -0
  37. data/lib/xeroizer/models/payroll/pay_schedule.rb +40 -0
  38. data/lib/xeroizer/models/payroll/pay_template.rb +24 -0
  39. data/lib/xeroizer/models/payroll/payment_method.rb +24 -0
  40. data/lib/xeroizer/models/payroll/paystub.rb +44 -0
  41. data/lib/xeroizer/models/payroll/reimbursement_line.rb +21 -0
  42. data/lib/xeroizer/models/payroll/reimbursement_type.rb +22 -0
  43. data/lib/xeroizer/models/payroll/salary_and_wage.rb +29 -0
  44. data/lib/xeroizer/models/payroll/super_line.rb +40 -0
  45. data/lib/xeroizer/models/payroll/tax_declaration.rb +50 -0
  46. data/lib/xeroizer/models/payroll/time_off_line.rb +20 -0
  47. data/lib/xeroizer/models/payroll/time_off_type.rb +32 -0
  48. data/lib/xeroizer/models/payroll/work_location.rb +25 -0
  49. data/lib/xeroizer/models/prepayment.rb +1 -0
  50. data/lib/xeroizer/models/purchase_order.rb +6 -6
  51. data/lib/xeroizer/models/quote.rb +76 -0
  52. data/lib/xeroizer/models/schedule.rb +1 -0
  53. data/lib/xeroizer/models/tax_component.rb +1 -0
  54. data/lib/xeroizer/models/to_bank_account.rb +1 -0
  55. data/lib/xeroizer/oauth.rb +12 -1
  56. data/lib/xeroizer/oauth2.rb +82 -0
  57. data/lib/xeroizer/oauth2_application.rb +49 -0
  58. data/lib/xeroizer/payroll_application.rb +8 -3
  59. data/lib/xeroizer/record/base.rb +1 -1
  60. data/lib/xeroizer/record/base_model.rb +1 -1
  61. data/lib/xeroizer/record/base_model_http_proxy.rb +4 -0
  62. data/lib/xeroizer/record/model_definition_helper.rb +1 -1
  63. data/lib/xeroizer/record/payroll_base.rb +4 -0
  64. data/lib/xeroizer/record/record_association_helper.rb +4 -4
  65. data/lib/xeroizer/record/validators/associated_validator.rb +1 -0
  66. data/lib/xeroizer/record/xml_helper.rb +18 -18
  67. data/lib/xeroizer/report/aged_receivables_by_contact.rb +1 -1
  68. data/lib/xeroizer/report/cell_xml_helper.rb +13 -13
  69. data/lib/xeroizer/response.rb +22 -17
  70. data/lib/xeroizer/version.rb +1 -1
  71. data/lib/xeroizer.rb +33 -4
  72. data/test/acceptance/about_creating_bank_transactions_test.rb +80 -82
  73. data/test/acceptance/about_creating_prepayment_test.rb +25 -30
  74. data/test/acceptance/about_fetching_bank_transactions_test.rb +12 -12
  75. data/test/acceptance/about_online_invoice_test.rb +6 -10
  76. data/test/acceptance/acceptance_test.rb +28 -26
  77. data/test/acceptance/bank_transfer_test.rb +12 -17
  78. data/test/acceptance/bulk_operations_test.rb +18 -16
  79. data/test/acceptance/connections_test.rb +11 -0
  80. data/test/stub_responses/bad_request.json +6 -0
  81. data/test/stub_responses/connections.json +16 -0
  82. data/test/stub_responses/expired_oauth2_token.json +6 -0
  83. data/test/stub_responses/generic_response_error.json +6 -0
  84. data/test/stub_responses/invalid_oauth2_request_token.json +6 -0
  85. data/test/stub_responses/invalid_tenant_header.json +6 -0
  86. data/test/stub_responses/object_not_found.json +6 -0
  87. data/test/stub_responses/organisations.xml +10 -0
  88. data/test/stub_responses/payment_service.xml +15 -0
  89. data/test/test_helper.rb +16 -11
  90. data/test/unit/generic_application_test.rb +21 -10
  91. data/test/unit/http_test.rb +284 -10
  92. data/test/unit/models/address_test.rb +2 -2
  93. data/test/unit/models/bank_transaction_model_parsing_test.rb +2 -2
  94. data/test/unit/models/bank_transaction_test.rb +1 -1
  95. data/test/unit/models/bank_transaction_validation_test.rb +1 -1
  96. data/test/unit/models/contact_test.rb +2 -2
  97. data/test/unit/models/credit_note_test.rb +8 -8
  98. data/test/unit/models/employee_test.rb +4 -4
  99. data/test/unit/models/invoice_test.rb +12 -12
  100. data/test/unit/models/journal_line_test.rb +6 -6
  101. data/test/unit/models/journal_test.rb +4 -4
  102. data/test/unit/models/line_item_sum_test.rb +1 -1
  103. data/test/unit/models/line_item_test.rb +26 -28
  104. data/test/unit/models/manual_journal_test.rb +3 -3
  105. data/test/unit/models/organisation_test.rb +16 -2
  106. data/test/unit/models/payment_service_test.rb +29 -0
  107. data/test/unit/models/phone_test.rb +7 -7
  108. data/test/unit/models/prepayment_test.rb +4 -4
  109. data/test/unit/models/repeating_invoice_test.rb +3 -3
  110. data/test/unit/models/tax_rate_test.rb +2 -2
  111. data/test/unit/oauth2_test.rb +171 -0
  112. data/test/unit/oauth_config_test.rb +1 -1
  113. data/test/unit/record/base_model_test.rb +13 -13
  114. data/test/unit/record/base_test.rb +15 -4
  115. data/test/unit/record/block_validator_test.rb +1 -1
  116. data/test/unit/record/connection_test.rb +60 -0
  117. data/test/unit/record/model_definition_test.rb +36 -36
  118. data/test/unit/record/parse_params_test.rb +2 -2
  119. data/test/unit/record/parse_where_hash_test.rb +13 -13
  120. data/test/unit/record/record_association_test.rb +14 -14
  121. data/test/unit/record/validators_test.rb +43 -43
  122. data/test/unit/record_definition_test.rb +7 -7
  123. data/test/unit/report_definition_test.rb +7 -7
  124. data/test/unit/report_test.rb +20 -20
  125. data/test/unit_test_helper.rb +16 -0
  126. metadata +100 -25
  127. data/lib/xeroizer/models/payroll/home_address.rb +0 -24
  128. data/lib/xeroizer/partner_application.rb +0 -51
  129. data/lib/xeroizer/private_application.rb +0 -25
  130. data/lib/xeroizer/public_application.rb +0 -21
  131. data/test/unit/http_tsl_12_upgrade_test.rb +0 -31
  132. data/test/unit/oauth_test.rb +0 -118
  133. data/test/unit/private_application_test.rb +0 -20
@@ -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
- belongs_to :home_address, :internal_name_singular => "home_address", :model_name => "HomeAddress"
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
@@ -0,0 +1,32 @@
1
+ module Xeroizer
2
+ module Record
3
+ module Payroll
4
+
5
+ class TimeOffTypeModel < PayrollBaseModel
6
+
7
+ set_permissions :read
8
+
9
+ end
10
+
11
+ class TimeOffType < PayrollBase
12
+
13
+ TIME_OFF_CATEGORIES = {
14
+ 'PAID' => '',
15
+ 'UNPAID' => ''
16
+ } unless defined?(TIME_OFF_CATEGORIES)
17
+
18
+ set_primary_key :time_off_type_id
19
+
20
+ guid :time_off_type_id
21
+ string :time_off_type
22
+ string :time_off_category
23
+ string :expense_account_code
24
+ string :liability_account_code
25
+ boolean :show_balance_to_employee
26
+
27
+ validates_inclusion_of :time_off_category, :in => TIME_OFF_CATEGORIES
28
+
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,25 @@
1
+ module Xeroizer
2
+ module Record
3
+ module Payroll
4
+
5
+ class WorkLocationModel < PayrollBaseModel
6
+
7
+ end
8
+
9
+ class WorkLocation < PayrollBase
10
+
11
+ guid :work_location_id
12
+ boolean :is_primary
13
+ string :street_address
14
+ string :suite_or_apt_or_unit
15
+ string :city
16
+ string :state
17
+ string :zip
18
+ decimal :latitude
19
+ decimal :longitude
20
+
21
+ validates_presence_of :work_location_id, :unless => :new_record?
22
+ end
23
+ end
24
+ end
25
+ end
@@ -25,6 +25,7 @@ module Xeroizer
25
25
  string :reference
26
26
  decimal :currency_rate
27
27
  decimal :remaining_credit
28
+ decimal :applied_amount
28
29
  boolean :has_attachments
29
30
 
30
31
  belongs_to :contact
@@ -30,15 +30,15 @@ module Xeroizer
30
30
  boolean :is_discounted
31
31
  string :reference
32
32
  string :type
33
- string :currency_rate
33
+ decimal :currency_rate
34
34
  string :currency_code
35
- guid :branding_theme_id
35
+ guid :branding_theme_id
36
36
  string :status
37
37
  string :line_amount_types
38
- string :sub_total
39
- string :total_tax
40
- string :total
41
- date :updated_date_UTC
38
+ decimal :sub_total
39
+ decimal :total_tax
40
+ decimal :total
41
+ datetime_utc :updated_date_utc, :api_name => 'UpdatedDateUTC'
42
42
  boolean :has_attachments
43
43
 
44
44
  has_many :line_items