xeroizer 2.20.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +126 -185
  3. data/lib/xeroizer/connection.rb +49 -0
  4. data/lib/xeroizer/exceptions.rb +2 -0
  5. data/lib/xeroizer/generic_application.rb +8 -3
  6. data/lib/xeroizer/http.rb +5 -80
  7. data/lib/xeroizer/http_response.rb +154 -0
  8. data/lib/xeroizer/models/bank_transaction.rb +1 -0
  9. data/lib/xeroizer/models/batch_payment.rb +4 -1
  10. data/lib/xeroizer/models/contact.rb +10 -4
  11. data/lib/xeroizer/models/credit_note.rb +20 -20
  12. data/lib/xeroizer/models/history_record.rb +72 -0
  13. data/lib/xeroizer/models/invoice.rb +5 -1
  14. data/lib/xeroizer/models/line_item.rb +4 -2
  15. data/lib/xeroizer/models/manual_journal.rb +2 -1
  16. data/lib/xeroizer/models/option.rb +1 -1
  17. data/lib/xeroizer/models/payroll/address.rb +53 -0
  18. data/lib/xeroizer/models/payroll/bank_account.rb +18 -6
  19. data/lib/xeroizer/models/payroll/benefit_line.rb +26 -0
  20. data/lib/xeroizer/models/payroll/benefit_type.rb +45 -0
  21. data/lib/xeroizer/models/payroll/deduction_line.rb +32 -0
  22. data/lib/xeroizer/models/payroll/deduction_type.rb +49 -0
  23. data/lib/xeroizer/models/payroll/earnings_line.rb +39 -0
  24. data/lib/xeroizer/models/payroll/earnings_type.rb +53 -0
  25. data/lib/xeroizer/models/payroll/employee.rb +30 -8
  26. data/lib/xeroizer/models/payroll/leave_application.rb +27 -0
  27. data/lib/xeroizer/models/payroll/leave_line.rb +30 -0
  28. data/lib/xeroizer/models/payroll/leave_period.rb +15 -0
  29. data/lib/xeroizer/models/payroll/pay_items.rb +22 -0
  30. data/lib/xeroizer/models/payroll/pay_run.rb +33 -0
  31. data/lib/xeroizer/models/payroll/pay_schedule.rb +40 -0
  32. data/lib/xeroizer/models/payroll/pay_template.rb +24 -0
  33. data/lib/xeroizer/models/payroll/payment_method.rb +24 -0
  34. data/lib/xeroizer/models/payroll/paystub.rb +44 -0
  35. data/lib/xeroizer/models/payroll/reimbursement_line.rb +21 -0
  36. data/lib/xeroizer/models/payroll/reimbursement_type.rb +22 -0
  37. data/lib/xeroizer/models/payroll/salary_and_wage.rb +29 -0
  38. data/lib/xeroizer/models/payroll/super_line.rb +40 -0
  39. data/lib/xeroizer/models/payroll/tax_declaration.rb +50 -0
  40. data/lib/xeroizer/models/payroll/time_off_line.rb +20 -0
  41. data/lib/xeroizer/models/payroll/time_off_type.rb +32 -0
  42. data/lib/xeroizer/models/payroll/work_location.rb +25 -0
  43. data/lib/xeroizer/models/quote.rb +76 -0
  44. data/lib/xeroizer/models/tax_component.rb +1 -0
  45. data/lib/xeroizer/oauth.rb +12 -1
  46. data/lib/xeroizer/oauth2.rb +82 -0
  47. data/lib/xeroizer/oauth2_application.rb +49 -0
  48. data/lib/xeroizer/payroll_application.rb +8 -3
  49. data/lib/xeroizer/record/base_model.rb +1 -1
  50. data/lib/xeroizer/record/base_model_http_proxy.rb +1 -0
  51. data/lib/xeroizer/record/payroll_base.rb +4 -0
  52. data/lib/xeroizer/record/record_association_helper.rb +4 -4
  53. data/lib/xeroizer/record/validators/associated_validator.rb +1 -0
  54. data/lib/xeroizer/record/xml_helper.rb +16 -16
  55. data/lib/xeroizer/response.rb +22 -17
  56. data/lib/xeroizer/version.rb +1 -1
  57. data/lib/xeroizer.rb +31 -4
  58. data/test/acceptance/about_creating_bank_transactions_test.rb +80 -82
  59. data/test/acceptance/about_creating_prepayment_test.rb +25 -30
  60. data/test/acceptance/about_fetching_bank_transactions_test.rb +10 -10
  61. data/test/acceptance/about_online_invoice_test.rb +6 -10
  62. data/test/acceptance/acceptance_test.rb +28 -26
  63. data/test/acceptance/bank_transfer_test.rb +12 -17
  64. data/test/acceptance/bulk_operations_test.rb +18 -16
  65. data/test/acceptance/connections_test.rb +11 -0
  66. data/test/stub_responses/bad_request.json +6 -0
  67. data/test/stub_responses/connections.json +16 -0
  68. data/test/stub_responses/expired_oauth2_token.json +6 -0
  69. data/test/stub_responses/generic_response_error.json +6 -0
  70. data/test/stub_responses/invalid_oauth2_request_token.json +6 -0
  71. data/test/stub_responses/invalid_tenant_header.json +6 -0
  72. data/test/stub_responses/object_not_found.json +6 -0
  73. data/test/test_helper.rb +16 -11
  74. data/test/unit/generic_application_test.rb +21 -10
  75. data/test/unit/http_test.rb +281 -9
  76. data/test/unit/models/address_test.rb +2 -2
  77. data/test/unit/models/bank_transaction_model_parsing_test.rb +2 -2
  78. data/test/unit/models/bank_transaction_test.rb +1 -1
  79. data/test/unit/models/bank_transaction_validation_test.rb +1 -1
  80. data/test/unit/models/contact_test.rb +2 -2
  81. data/test/unit/models/credit_note_test.rb +8 -8
  82. data/test/unit/models/employee_test.rb +4 -4
  83. data/test/unit/models/invoice_test.rb +12 -12
  84. data/test/unit/models/journal_line_test.rb +6 -6
  85. data/test/unit/models/journal_test.rb +4 -4
  86. data/test/unit/models/line_item_sum_test.rb +1 -1
  87. data/test/unit/models/line_item_test.rb +19 -2
  88. data/test/unit/models/manual_journal_test.rb +3 -3
  89. data/test/unit/models/organisation_test.rb +2 -2
  90. data/test/unit/models/payment_service_test.rb +2 -2
  91. data/test/unit/models/phone_test.rb +7 -7
  92. data/test/unit/models/prepayment_test.rb +4 -4
  93. data/test/unit/models/repeating_invoice_test.rb +2 -2
  94. data/test/unit/models/tax_rate_test.rb +2 -2
  95. data/test/unit/oauth2_test.rb +171 -0
  96. data/test/unit/oauth_config_test.rb +1 -1
  97. data/test/unit/record/base_model_test.rb +13 -13
  98. data/test/unit/record/base_test.rb +5 -4
  99. data/test/unit/record/block_validator_test.rb +1 -1
  100. data/test/unit/record/connection_test.rb +60 -0
  101. data/test/unit/record/model_definition_test.rb +36 -36
  102. data/test/unit/record/parse_params_test.rb +2 -2
  103. data/test/unit/record/parse_where_hash_test.rb +13 -13
  104. data/test/unit/record/record_association_test.rb +14 -14
  105. data/test/unit/record/validators_test.rb +43 -43
  106. data/test/unit/record_definition_test.rb +7 -7
  107. data/test/unit/report_definition_test.rb +7 -7
  108. data/test/unit/report_test.rb +20 -20
  109. data/test/unit_test_helper.rb +16 -0
  110. metadata +106 -23
  111. data/lib/xeroizer/models/payroll/home_address.rb +0 -24
  112. data/lib/xeroizer/partner_application.rb +0 -51
  113. data/lib/xeroizer/private_application.rb +0 -25
  114. data/lib/xeroizer/public_application.rb +0 -21
  115. data/test/unit/http_tsl_12_upgrade_test.rb +0 -31
  116. data/test/unit/oauth_test.rb +0 -118
  117. data/test/unit/private_application_test.rb +0 -20
@@ -1,23 +1,35 @@
1
1
  module Xeroizer
2
2
  module Record
3
3
  module Payroll
4
-
4
+
5
5
  class BankAccountModel < PayrollBaseModel
6
-
6
+
7
7
  end
8
-
8
+
9
9
  class BankAccount < PayrollBase
10
-
10
+
11
11
  string :statement_text
12
12
  string :account_name
13
- string :bsb
13
+ string :bsb, :api_name => 'BSB'
14
14
  string :account_number
15
15
  boolean :remainder
16
16
  string :percentage
17
17
  decimal :amount
18
18
 
19
+ # US Payroll fields
20
+
21
+ BANK_ACCOUNT_TYPE = {
22
+ 'CHECKING' => '',
23
+ 'SAVINGS' => ''
24
+ } unless defined?(BANK_ACCOUNT_TYPE)
25
+
26
+ string :account_holder_name
27
+ string :account_type
28
+ string :routing_number
29
+
30
+ validates_inclusion_of :account_type, :in => BANK_ACCOUNT_TYPE
19
31
  end
20
32
 
21
- end
33
+ end
22
34
  end
23
35
  end
@@ -0,0 +1,26 @@
1
+ module Xeroizer
2
+ module Record
3
+ module Payroll
4
+
5
+ class BenefitLineModel < PayrollBaseModel
6
+
7
+ end
8
+
9
+ class BenefitLine < PayrollBase
10
+
11
+ BENEFIT_TYPE_CALCULATION_TYPE = {
12
+ 'FIXEDAMOUNT' => '',
13
+ 'STANDARDAMOUNT' => ''
14
+ } unless defined?(BENEFIT_TYPE_CALCULATION_TYPE)
15
+
16
+ guid :benefit_type_id, :api_name => 'BenefitTypeID'
17
+ string :calculation_type
18
+ decimal :amount
19
+
20
+ validates_presence_of :benefit_type_id, :calculation_type, :unless => :new_record?
21
+ validates_inclusion_of :calculation_type, :in => BENEFIT_TYPE_CALCULATION_TYPE
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,45 @@
1
+ module Xeroizer
2
+ module Record
3
+ module Payroll
4
+
5
+ class BenefitTypeModel < PayrollBaseModel
6
+
7
+ set_permissions :read
8
+
9
+ end
10
+
11
+ class BenefitType < PayrollBase
12
+
13
+ BENEFIT_CATEGORIES = {
14
+ 'AFTERTAXBENEFIT' => '',
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?(BENEFIT_CATEGORIES)
27
+
28
+ set_primary_key :benefit_type_id
29
+
30
+ guid :benefit_type_id
31
+ string :benefit_type
32
+ string :benefit_category
33
+ string :liability_account_code
34
+ string :expense_account_code
35
+ decimal :standard_amount
36
+ decimal :company_max
37
+ decimal :percentage
38
+ boolean :show_balance_on_paystub
39
+
40
+ validates_inclusion_of :benefit_category, :in => BENEFIT_CATEGORIES
41
+
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,32 @@
1
+ module Xeroizer
2
+ module Record
3
+ module Payroll
4
+
5
+ class DeductionLineModel < PayrollBaseModel
6
+
7
+ end
8
+
9
+ class DeductionLine < PayrollBase
10
+
11
+ DEDUCTION_TYPE_CALCULATION_TYPE = {
12
+ 'FIXEDAMOUNT' => '',
13
+ 'PRETAX' => '',
14
+ 'POSTTAX' => ''
15
+ } unless defined?(DEDUCTION_TYPE_CALCULATION_TYPE)
16
+
17
+ guid :deduction_type_id, :api_name => 'DeductionTypeID'
18
+ string :calculation_type
19
+
20
+ decimal :percentage
21
+ decimal :amount
22
+
23
+ # US Payroll fields
24
+ decimal :employee_max
25
+
26
+ validates_presence_of :earning_rate_id, :calculation_type, :unless => :new_record?
27
+ validates_inclusion_of :calculation_type, :in => DEDUCTION_TYPE_CALCULATION_TYPE
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -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
- 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