maxio-advanced-billing-sdk 2.0.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 (185) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +40 -40
  3. data/lib/advanced_billing/controllers/advance_invoice_controller.rb +6 -4
  4. data/lib/advanced_billing/controllers/base_controller.rb +1 -1
  5. data/lib/advanced_billing/controllers/components_controller.rb +9 -58
  6. data/lib/advanced_billing/controllers/coupons_controller.rb +6 -115
  7. data/lib/advanced_billing/controllers/custom_fields_controller.rb +4 -4
  8. data/lib/advanced_billing/controllers/events_based_billing_segments_controller.rb +5 -22
  9. data/lib/advanced_billing/controllers/insights_controller.rb +3 -4
  10. data/lib/advanced_billing/controllers/invoices_controller.rb +11 -0
  11. data/lib/advanced_billing/controllers/payment_profiles_controller.rb +26 -0
  12. data/lib/advanced_billing/controllers/product_families_controller.rb +5 -14
  13. data/lib/advanced_billing/controllers/product_price_points_controller.rb +3 -40
  14. data/lib/advanced_billing/controllers/products_controller.rb +5 -14
  15. data/lib/advanced_billing/controllers/subscription_components_controller.rb +16 -66
  16. data/lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb +5 -15
  17. data/lib/advanced_billing/controllers/subscription_groups_controller.rb +6 -6
  18. data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +13 -20
  19. data/lib/advanced_billing/controllers/subscriptions_controller.rb +49 -14
  20. data/lib/advanced_billing/models/ach_agreement.rb +10 -0
  21. data/lib/advanced_billing/models/address_change.rb +0 -22
  22. data/lib/advanced_billing/models/agreement_acceptance.rb +10 -0
  23. data/lib/advanced_billing/models/allocation.rb +1 -3
  24. data/lib/advanced_billing/models/applied_credit_note_data.rb +10 -0
  25. data/lib/advanced_billing/models/apply_credit_note_event.rb +139 -0
  26. data/lib/advanced_billing/models/apply_credit_note_event_data.rb +3 -1
  27. data/lib/advanced_billing/models/apply_debit_note_event.rb +139 -0
  28. data/lib/advanced_billing/models/apply_debit_note_event_data.rb +36 -2
  29. data/lib/advanced_billing/models/apply_payment_event.rb +139 -0
  30. data/lib/advanced_billing/models/apply_payment_event_data.rb +21 -7
  31. data/lib/advanced_billing/models/backport_invoice_event.rb +139 -0
  32. data/lib/advanced_billing/models/bank_account_attributes.rb +10 -0
  33. data/lib/advanced_billing/models/billing_manifest.rb +5 -1
  34. data/lib/advanced_billing/models/billing_schedule.rb +10 -0
  35. data/lib/advanced_billing/models/change_chargeback_status_event.rb +141 -0
  36. data/lib/advanced_billing/models/change_chargeback_status_event_data.rb +73 -0
  37. data/lib/advanced_billing/models/change_invoice_collection_method_event.rb +141 -0
  38. data/lib/advanced_billing/models/change_invoice_status_event.rb +141 -0
  39. data/lib/advanced_billing/models/change_invoice_status_event_data.rb +131 -0
  40. data/lib/advanced_billing/models/chargeback_status.rb +29 -0
  41. data/lib/advanced_billing/models/component.rb +3 -13
  42. data/lib/advanced_billing/models/component_cost_data.rb +10 -0
  43. data/lib/advanced_billing/models/component_cost_data_rate_tier.rb +10 -0
  44. data/lib/advanced_billing/models/component_custom_price.rb +10 -0
  45. data/lib/advanced_billing/models/component_price_point.rb +2 -13
  46. data/lib/advanced_billing/models/component_price_point_item.rb +10 -0
  47. data/lib/advanced_billing/models/coupon.rb +4 -14
  48. data/lib/advanced_billing/models/create_component_price_point.rb +6 -2
  49. data/lib/advanced_billing/models/create_component_price_point_request.rb +1 -1
  50. data/lib/advanced_billing/models/create_component_price_points_request.rb +1 -1
  51. data/lib/advanced_billing/models/create_credit_note_event.rb +139 -0
  52. data/lib/advanced_billing/models/create_debit_note_event.rb +139 -0
  53. data/lib/advanced_billing/models/create_invoice_payment_application.rb +22 -0
  54. data/lib/advanced_billing/models/create_multi_invoice_payment.rb +6 -2
  55. data/lib/advanced_billing/models/create_offer_component.rb +11 -0
  56. data/lib/advanced_billing/models/create_payment_profile.rb +4 -4
  57. data/lib/advanced_billing/models/create_prepaid_usage_component_price_point.rb +10 -4
  58. data/lib/advanced_billing/models/create_product_family.rb +14 -4
  59. data/lib/advanced_billing/models/create_subscription.rb +2 -2
  60. data/lib/advanced_billing/models/credit_card_attributes.rb +10 -0
  61. data/lib/advanced_billing/models/credit_note_application.rb +10 -0
  62. data/lib/advanced_billing/models/credit_note_line_item.rb +10 -0
  63. data/lib/advanced_billing/models/customer.rb +13 -1
  64. data/lib/advanced_billing/models/customer_attributes.rb +10 -0
  65. data/lib/advanced_billing/models/customer_change.rb +7 -22
  66. data/lib/advanced_billing/models/customer_custom_fields_change.rb +0 -22
  67. data/lib/advanced_billing/models/customer_payer_change.rb +0 -22
  68. data/lib/advanced_billing/models/debit_note.rb +351 -0
  69. data/lib/advanced_billing/models/debit_note_role.rb +23 -0
  70. data/lib/advanced_billing/models/debit_note_status.rb +29 -0
  71. data/lib/advanced_billing/models/deduct_service_credit.rb +10 -16
  72. data/lib/advanced_billing/models/dunner_data.rb +38 -0
  73. data/lib/advanced_billing/models/dunning_step_data.rb +34 -0
  74. data/lib/advanced_billing/models/dunning_step_reached.rb +12 -6
  75. data/lib/advanced_billing/models/failed_payment_event.rb +139 -0
  76. data/lib/advanced_billing/models/failed_payment_event_data.rb +132 -0
  77. data/lib/advanced_billing/models/group_billing.rb +10 -0
  78. data/lib/advanced_billing/models/group_settings.rb +4 -2
  79. data/lib/advanced_billing/models/group_target.rb +14 -0
  80. data/lib/advanced_billing/models/historic_usage.rb +109 -0
  81. data/lib/advanced_billing/models/include_null_or_not_null.rb +23 -0
  82. data/lib/advanced_billing/models/invoice.rb +18 -8
  83. data/lib/advanced_billing/models/invoice_address.rb +10 -0
  84. data/lib/advanced_billing/models/invoice_balance_item.rb +10 -0
  85. data/lib/advanced_billing/models/invoice_credit.rb +10 -0
  86. data/lib/advanced_billing/models/invoice_custom_field.rb +10 -0
  87. data/lib/advanced_billing/models/invoice_customer.rb +10 -0
  88. data/lib/advanced_billing/models/invoice_discount.rb +10 -0
  89. data/lib/advanced_billing/models/invoice_discount_breakout.rb +10 -0
  90. data/lib/advanced_billing/models/invoice_display_settings.rb +10 -0
  91. data/lib/advanced_billing/models/invoice_event_type.rb +3 -0
  92. data/lib/advanced_billing/models/invoice_issued.rb +6 -2
  93. data/lib/advanced_billing/models/invoice_line_item.rb +3 -3
  94. data/lib/advanced_billing/models/invoice_line_item_event_data.rb +10 -0
  95. data/lib/advanced_billing/models/invoice_line_item_pricing_detail.rb +10 -0
  96. data/lib/advanced_billing/models/invoice_payer.rb +10 -0
  97. data/lib/advanced_billing/models/invoice_payment.rb +10 -0
  98. data/lib/advanced_billing/models/invoice_payment_method.rb +10 -0
  99. data/lib/advanced_billing/models/invoice_pre_payment.rb +0 -10
  100. data/lib/advanced_billing/models/invoice_previous_balance.rb +10 -0
  101. data/lib/advanced_billing/models/invoice_refund.rb +10 -0
  102. data/lib/advanced_billing/models/invoice_seller.rb +10 -0
  103. data/lib/advanced_billing/models/invoice_status.rb +2 -2
  104. data/lib/advanced_billing/models/invoice_tax.rb +10 -0
  105. data/lib/advanced_billing/models/invoice_tax_breakout.rb +10 -0
  106. data/lib/advanced_billing/models/invoice_tax_component_breakout.rb +10 -0
  107. data/lib/advanced_billing/models/issue_invoice_event.rb +139 -0
  108. data/lib/advanced_billing/models/issue_invoice_event_data.rb +6 -6
  109. data/lib/advanced_billing/models/issue_service_credit.rb +10 -16
  110. data/lib/advanced_billing/models/item_price_point_changed.rb +8 -4
  111. data/lib/advanced_billing/models/item_price_point_data.rb +10 -0
  112. data/lib/advanced_billing/models/list_components_filter.rb +74 -0
  113. data/lib/advanced_billing/models/list_coupons_filter.rb +168 -0
  114. data/lib/advanced_billing/models/list_invoice_events_response.rb +14 -11
  115. data/lib/advanced_billing/models/{refund_prepayment_aggregated_error.rb → list_mrr_filter.rb} +14 -12
  116. data/lib/advanced_billing/models/{list_subscription_group_prepayment_date_field.rb → list_prepayment_date_field.rb} +4 -4
  117. data/lib/advanced_billing/models/list_prepayments_filter.rb +88 -0
  118. data/lib/advanced_billing/models/list_price_points_filter.rb +163 -0
  119. data/lib/advanced_billing/models/list_products_filter.rb +81 -0
  120. data/lib/advanced_billing/models/list_segments_filter.rb +103 -0
  121. data/lib/advanced_billing/models/list_subscription_components_filter.rb +74 -0
  122. data/lib/advanced_billing/models/list_subscription_components_for_site_filter.rb +84 -0
  123. data/lib/advanced_billing/models/list_subscription_components_include.rb +4 -1
  124. data/lib/advanced_billing/models/metafield_scope.rb +10 -0
  125. data/lib/advanced_billing/models/nested_subscription_group.rb +0 -10
  126. data/lib/advanced_billing/models/origin_invoice.rb +10 -0
  127. data/lib/advanced_billing/models/overage_pricing.rb +14 -0
  128. data/lib/advanced_billing/models/paid_invoice.rb +2 -2
  129. data/lib/advanced_billing/models/payer_attributes.rb +10 -0
  130. data/lib/advanced_billing/models/prepaid_component_price_point.rb +10 -0
  131. data/lib/advanced_billing/models/prepaid_product_price_point_filter.rb +56 -0
  132. data/lib/advanced_billing/models/prepaid_usage.rb +6 -2
  133. data/lib/advanced_billing/models/prepaid_usage_allocation_detail.rb +10 -0
  134. data/lib/advanced_billing/models/product.rb +5 -16
  135. data/lib/advanced_billing/models/product_price_point.rb +9 -0
  136. data/lib/advanced_billing/models/proforma_invoice.rb +2 -2
  137. data/lib/advanced_billing/models/proforma_invoice_issued.rb +6 -2
  138. data/lib/advanced_billing/models/reactivation_billing.rb +10 -0
  139. data/lib/advanced_billing/models/record_payment_response.rb +1 -13
  140. data/lib/advanced_billing/models/refund_invoice_event.rb +139 -0
  141. data/lib/advanced_billing/models/refund_invoice_event_data.rb +4 -2
  142. data/lib/advanced_billing/models/refund_invoice_request.rb +1 -1
  143. data/lib/advanced_billing/models/refund_prepayment.rb +3 -1
  144. data/lib/advanced_billing/models/remove_payment_event.rb +139 -0
  145. data/lib/advanced_billing/models/remove_payment_event_data.rb +1 -1
  146. data/lib/advanced_billing/models/segment_price.rb +10 -0
  147. data/lib/advanced_billing/models/subscription.rb +10 -16
  148. data/lib/advanced_billing/models/subscription_component.rb +26 -7
  149. data/lib/advanced_billing/models/subscription_component_subscription.rb +10 -0
  150. data/lib/advanced_billing/models/subscription_filter.rb +153 -0
  151. data/lib/advanced_billing/models/subscription_group.rb +2 -2
  152. data/lib/advanced_billing/models/subscription_group_bank_account.rb +10 -0
  153. data/lib/advanced_billing/models/subscription_group_component_custom_price.rb +10 -0
  154. data/lib/advanced_billing/models/subscription_group_prepayment_response.rb +3 -1
  155. data/lib/advanced_billing/models/subscription_group_signup.rb +2 -2
  156. data/lib/advanced_billing/models/subscription_group_signup_failure.rb +4 -2
  157. data/lib/advanced_billing/models/subscription_group_signup_failure_data.rb +10 -0
  158. data/lib/advanced_billing/models/subscription_group_signup_item.rb +10 -0
  159. data/lib/advanced_billing/models/subscription_group_signup_response.rb +2 -2
  160. data/lib/advanced_billing/models/subscription_group_signup_success.rb +8 -4
  161. data/lib/advanced_billing/models/subscription_group_signup_success_data.rb +50 -0
  162. data/lib/advanced_billing/models/update_customer.rb +12 -0
  163. data/lib/advanced_billing/models/update_subscription_component.rb +10 -0
  164. data/lib/advanced_billing/models/upsert_prepaid_configuration.rb +10 -0
  165. data/lib/advanced_billing/models/usage.rb +3 -1
  166. data/lib/advanced_billing/models/void_invoice_event.rb +139 -0
  167. data/lib/advanced_billing/models/void_invoice_event_data.rb +8 -7
  168. data/lib/advanced_billing/models/void_remainder_event.rb +139 -0
  169. data/lib/advanced_billing/models/void_remainder_event_data.rb +4 -2
  170. data/lib/advanced_billing/utilities/union_type_lookup.rb +69 -199
  171. data/lib/advanced_billing.rb +42 -18
  172. metadata +38 -17
  173. data/lib/advanced_billing/exceptions/refund_prepayment_aggregated_errors_response_exception.rb +0 -33
  174. data/lib/advanced_billing/models/billing_address.rb +0 -117
  175. data/lib/advanced_billing/models/credit_note1.rb +0 -419
  176. data/lib/advanced_billing/models/customer1.rb +0 -125
  177. data/lib/advanced_billing/models/invoice_event.rb +0 -124
  178. data/lib/advanced_billing/models/invoice_event_data.rb +0 -447
  179. data/lib/advanced_billing/models/invoice_event_payment.rb +0 -168
  180. data/lib/advanced_billing/models/invoice_event_payment1.rb +0 -160
  181. data/lib/advanced_billing/models/prepayment_aggregated_error.rb +0 -81
  182. data/lib/advanced_billing/models/price_point.rb +0 -216
  183. data/lib/advanced_billing/models/refund.rb +0 -138
  184. data/lib/advanced_billing/models/seller.rb +0 -92
  185. data/lib/advanced_billing/models/shipping_address.rb +0 -117
@@ -0,0 +1,139 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module AdvancedBilling
8
+ # BackportInvoiceEvent Model.
9
+ class BackportInvoiceEvent < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Integer]
15
+ attr_accessor :id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [DateTime]
19
+ attr_accessor :timestamp
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Invoice]
23
+ attr_accessor :invoice
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [InvoiceEventType]
27
+ attr_accessor :event_type
28
+
29
+ # Example schema for an `backport_invoice` event
30
+ # @return [Invoice]
31
+ attr_accessor :event_data
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['id'] = 'id'
37
+ @_hash['timestamp'] = 'timestamp'
38
+ @_hash['invoice'] = 'invoice'
39
+ @_hash['event_type'] = 'event_type'
40
+ @_hash['event_data'] = 'event_data'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ []
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(id = nil,
55
+ timestamp = nil,
56
+ invoice = nil,
57
+ event_type = InvoiceEventType::BACKPORT_INVOICE,
58
+ event_data = nil,
59
+ additional_properties = {})
60
+ @id = id
61
+ @timestamp = timestamp
62
+ @invoice = invoice
63
+ @event_type = event_type
64
+ @event_data = event_data
65
+
66
+ # Add additional model properties to the instance.
67
+ additional_properties.each do |_name, _value|
68
+ instance_variable_set("@#{_name}", _value)
69
+ end
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ id = hash.key?('id') ? hash['id'] : nil
78
+ timestamp = if hash.key?('timestamp')
79
+ (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
80
+ end
81
+ invoice = Invoice.from_hash(hash['invoice']) if hash['invoice']
82
+ event_type = hash['event_type'] ||= InvoiceEventType::BACKPORT_INVOICE
83
+ event_data = Invoice.from_hash(hash['event_data']) if hash['event_data']
84
+
85
+ # Clean out expected properties from Hash.
86
+ names.each_value { |k| hash.delete(k) }
87
+
88
+ # Create object from extracted values.
89
+ BackportInvoiceEvent.new(id,
90
+ timestamp,
91
+ invoice,
92
+ event_type,
93
+ event_data,
94
+ hash)
95
+ end
96
+
97
+ def to_custom_timestamp
98
+ DateTimeHelper.to_rfc3339(timestamp)
99
+ end
100
+
101
+ # Validates an instance of the object from a given value.
102
+ # @param [BackportInvoiceEvent | Hash] The value against the validation is performed.
103
+ def self.validate(value)
104
+ if value.instance_of? self
105
+ return (
106
+ APIHelper.valid_type?(value.id,
107
+ ->(val) { val.instance_of? Integer }) and
108
+ APIHelper.valid_type?(value.timestamp,
109
+ ->(val) { val.instance_of? DateTime }) and
110
+ APIHelper.valid_type?(value.invoice,
111
+ ->(val) { Invoice.validate(val) },
112
+ is_model_hash: true) and
113
+ APIHelper.valid_type?(value.event_type,
114
+ ->(val) { InvoiceEventType.validate(val) }) and
115
+ APIHelper.valid_type?(value.event_data,
116
+ ->(val) { Invoice.validate(val) },
117
+ is_model_hash: true)
118
+ )
119
+ end
120
+
121
+ return false unless value.instance_of? Hash
122
+
123
+ (
124
+ APIHelper.valid_type?(value['id'],
125
+ ->(val) { val.instance_of? Integer }) and
126
+ APIHelper.valid_type?(value['timestamp'],
127
+ ->(val) { val.instance_of? String }) and
128
+ APIHelper.valid_type?(value['invoice'],
129
+ ->(val) { Invoice.validate(val) },
130
+ is_model_hash: true) and
131
+ APIHelper.valid_type?(value['event_type'],
132
+ ->(val) { InvoiceEventType.validate(val) }) and
133
+ APIHelper.valid_type?(value['event_data'],
134
+ ->(val) { Invoice.validate(val) },
135
+ is_model_hash: true)
136
+ )
137
+ end
138
+ end
139
+ end
@@ -181,5 +181,15 @@ module AdvancedBilling
181
181
  customer_vault_token,
182
182
  hash)
183
183
  end
184
+
185
+ # Validates an instance of the object from a given value.
186
+ # @param [BankAccountAttributes | Hash] The value against the validation is performed.
187
+ def self.validate(value)
188
+ return true if value.instance_of? self
189
+
190
+ return false unless value.instance_of? Hash
191
+
192
+ true
193
+ end
184
194
  end
185
195
  end
@@ -78,7 +78,11 @@ module AdvancedBilling
78
78
 
79
79
  # An array for nullable fields
80
80
  def self.nullables
81
- []
81
+ %w[
82
+ start_date
83
+ end_date
84
+ period_type
85
+ ]
82
86
  end
83
87
 
84
88
  def initialize(line_items = SKIP,
@@ -61,5 +61,15 @@ module AdvancedBilling
61
61
  BillingSchedule.new(initial_billing_at,
62
62
  hash)
63
63
  end
64
+
65
+ # Validates an instance of the object from a given value.
66
+ # @param [BillingSchedule | Hash] The value against the validation is performed.
67
+ def self.validate(value)
68
+ return true if value.instance_of? self
69
+
70
+ return false unless value.instance_of? Hash
71
+
72
+ true
73
+ end
64
74
  end
65
75
  end
@@ -0,0 +1,141 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module AdvancedBilling
8
+ # ChangeChargebackStatusEvent Model.
9
+ class ChangeChargebackStatusEvent < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Integer]
15
+ attr_accessor :id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [DateTime]
19
+ attr_accessor :timestamp
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Invoice]
23
+ attr_accessor :invoice
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [InvoiceEventType]
27
+ attr_accessor :event_type
28
+
29
+ # Example schema for an `change_chargeback_status` event
30
+ # @return [ChangeChargebackStatusEventData]
31
+ attr_accessor :event_data
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['id'] = 'id'
37
+ @_hash['timestamp'] = 'timestamp'
38
+ @_hash['invoice'] = 'invoice'
39
+ @_hash['event_type'] = 'event_type'
40
+ @_hash['event_data'] = 'event_data'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ []
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(id = nil,
55
+ timestamp = nil,
56
+ invoice = nil,
57
+ event_type = InvoiceEventType::CHANGE_CHARGEBACK_STATUS,
58
+ event_data = nil,
59
+ additional_properties = {})
60
+ @id = id
61
+ @timestamp = timestamp
62
+ @invoice = invoice
63
+ @event_type = event_type
64
+ @event_data = event_data
65
+
66
+ # Add additional model properties to the instance.
67
+ additional_properties.each do |_name, _value|
68
+ instance_variable_set("@#{_name}", _value)
69
+ end
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ id = hash.key?('id') ? hash['id'] : nil
78
+ timestamp = if hash.key?('timestamp')
79
+ (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
80
+ end
81
+ invoice = Invoice.from_hash(hash['invoice']) if hash['invoice']
82
+ event_type =
83
+ hash['event_type'] ||= InvoiceEventType::CHANGE_CHARGEBACK_STATUS
84
+ event_data = ChangeChargebackStatusEventData.from_hash(hash['event_data']) if
85
+ hash['event_data']
86
+
87
+ # Clean out expected properties from Hash.
88
+ names.each_value { |k| hash.delete(k) }
89
+
90
+ # Create object from extracted values.
91
+ ChangeChargebackStatusEvent.new(id,
92
+ timestamp,
93
+ invoice,
94
+ event_type,
95
+ event_data,
96
+ hash)
97
+ end
98
+
99
+ def to_custom_timestamp
100
+ DateTimeHelper.to_rfc3339(timestamp)
101
+ end
102
+
103
+ # Validates an instance of the object from a given value.
104
+ # @param [ChangeChargebackStatusEvent | Hash] The value against the validation is performed.
105
+ def self.validate(value)
106
+ if value.instance_of? self
107
+ return (
108
+ APIHelper.valid_type?(value.id,
109
+ ->(val) { val.instance_of? Integer }) and
110
+ APIHelper.valid_type?(value.timestamp,
111
+ ->(val) { val.instance_of? DateTime }) and
112
+ APIHelper.valid_type?(value.invoice,
113
+ ->(val) { Invoice.validate(val) },
114
+ is_model_hash: true) and
115
+ APIHelper.valid_type?(value.event_type,
116
+ ->(val) { InvoiceEventType.validate(val) }) and
117
+ APIHelper.valid_type?(value.event_data,
118
+ ->(val) { ChangeChargebackStatusEventData.validate(val) },
119
+ is_model_hash: true)
120
+ )
121
+ end
122
+
123
+ return false unless value.instance_of? Hash
124
+
125
+ (
126
+ APIHelper.valid_type?(value['id'],
127
+ ->(val) { val.instance_of? Integer }) and
128
+ APIHelper.valid_type?(value['timestamp'],
129
+ ->(val) { val.instance_of? String }) and
130
+ APIHelper.valid_type?(value['invoice'],
131
+ ->(val) { Invoice.validate(val) },
132
+ is_model_hash: true) and
133
+ APIHelper.valid_type?(value['event_type'],
134
+ ->(val) { InvoiceEventType.validate(val) }) and
135
+ APIHelper.valid_type?(value['event_data'],
136
+ ->(val) { ChangeChargebackStatusEventData.validate(val) },
137
+ is_model_hash: true)
138
+ )
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,73 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module AdvancedBilling
7
+ # Example schema for an `change_chargeback_status` event
8
+ class ChangeChargebackStatusEventData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [ChargebackStatus]
14
+ attr_accessor :chargeback_status
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['chargeback_status'] = 'chargeback_status'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(chargeback_status = nil,
34
+ additional_properties = {})
35
+ @chargeback_status = chargeback_status
36
+
37
+ # Add additional model properties to the instance.
38
+ additional_properties.each do |_name, _value|
39
+ instance_variable_set("@#{_name}", _value)
40
+ end
41
+ end
42
+
43
+ # Creates an instance of the object from a hash.
44
+ def self.from_hash(hash)
45
+ return nil unless hash
46
+
47
+ # Extract variables from the hash.
48
+ chargeback_status =
49
+ hash.key?('chargeback_status') ? hash['chargeback_status'] : nil
50
+
51
+ # Clean out expected properties from Hash.
52
+ names.each_value { |k| hash.delete(k) }
53
+
54
+ # Create object from extracted values.
55
+ ChangeChargebackStatusEventData.new(chargeback_status,
56
+ hash)
57
+ end
58
+
59
+ # Validates an instance of the object from a given value.
60
+ # @param [ChangeChargebackStatusEventData | Hash] The value against the validation is performed.
61
+ def self.validate(value)
62
+ if value.instance_of? self
63
+ return APIHelper.valid_type?(value.chargeback_status,
64
+ ->(val) { ChargebackStatus.validate(val) })
65
+ end
66
+
67
+ return false unless value.instance_of? Hash
68
+
69
+ APIHelper.valid_type?(value['chargeback_status'],
70
+ ->(val) { ChargebackStatus.validate(val) })
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,141 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module AdvancedBilling
8
+ # ChangeInvoiceCollectionMethodEvent Model.
9
+ class ChangeInvoiceCollectionMethodEvent < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Integer]
15
+ attr_accessor :id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [DateTime]
19
+ attr_accessor :timestamp
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Invoice]
23
+ attr_accessor :invoice
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [InvoiceEventType]
27
+ attr_accessor :event_type
28
+
29
+ # Example schema for an `change_invoice_collection_method` event
30
+ # @return [ChangeInvoiceCollectionMethodEventData]
31
+ attr_accessor :event_data
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['id'] = 'id'
37
+ @_hash['timestamp'] = 'timestamp'
38
+ @_hash['invoice'] = 'invoice'
39
+ @_hash['event_type'] = 'event_type'
40
+ @_hash['event_data'] = 'event_data'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ []
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(id = nil,
55
+ timestamp = nil,
56
+ invoice = nil,
57
+ event_type = InvoiceEventType::CHANGE_INVOICE_COLLECTION_METHOD,
58
+ event_data = nil,
59
+ additional_properties = {})
60
+ @id = id
61
+ @timestamp = timestamp
62
+ @invoice = invoice
63
+ @event_type = event_type
64
+ @event_data = event_data
65
+
66
+ # Add additional model properties to the instance.
67
+ additional_properties.each do |_name, _value|
68
+ instance_variable_set("@#{_name}", _value)
69
+ end
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ id = hash.key?('id') ? hash['id'] : nil
78
+ timestamp = if hash.key?('timestamp')
79
+ (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
80
+ end
81
+ invoice = Invoice.from_hash(hash['invoice']) if hash['invoice']
82
+ event_type =
83
+ hash['event_type'] ||= InvoiceEventType::CHANGE_INVOICE_COLLECTION_METHOD
84
+ event_data = ChangeInvoiceCollectionMethodEventData.from_hash(hash['event_data']) if
85
+ hash['event_data']
86
+
87
+ # Clean out expected properties from Hash.
88
+ names.each_value { |k| hash.delete(k) }
89
+
90
+ # Create object from extracted values.
91
+ ChangeInvoiceCollectionMethodEvent.new(id,
92
+ timestamp,
93
+ invoice,
94
+ event_type,
95
+ event_data,
96
+ hash)
97
+ end
98
+
99
+ def to_custom_timestamp
100
+ DateTimeHelper.to_rfc3339(timestamp)
101
+ end
102
+
103
+ # Validates an instance of the object from a given value.
104
+ # @param [ChangeInvoiceCollectionMethodEvent | Hash] The value against the validation is performed.
105
+ def self.validate(value)
106
+ if value.instance_of? self
107
+ return (
108
+ APIHelper.valid_type?(value.id,
109
+ ->(val) { val.instance_of? Integer }) and
110
+ APIHelper.valid_type?(value.timestamp,
111
+ ->(val) { val.instance_of? DateTime }) and
112
+ APIHelper.valid_type?(value.invoice,
113
+ ->(val) { Invoice.validate(val) },
114
+ is_model_hash: true) and
115
+ APIHelper.valid_type?(value.event_type,
116
+ ->(val) { InvoiceEventType.validate(val) }) and
117
+ APIHelper.valid_type?(value.event_data,
118
+ ->(val) { ChangeInvoiceCollectionMethodEventData.validate(val) },
119
+ is_model_hash: true)
120
+ )
121
+ end
122
+
123
+ return false unless value.instance_of? Hash
124
+
125
+ (
126
+ APIHelper.valid_type?(value['id'],
127
+ ->(val) { val.instance_of? Integer }) and
128
+ APIHelper.valid_type?(value['timestamp'],
129
+ ->(val) { val.instance_of? String }) and
130
+ APIHelper.valid_type?(value['invoice'],
131
+ ->(val) { Invoice.validate(val) },
132
+ is_model_hash: true) and
133
+ APIHelper.valid_type?(value['event_type'],
134
+ ->(val) { InvoiceEventType.validate(val) }) and
135
+ APIHelper.valid_type?(value['event_data'],
136
+ ->(val) { ChangeInvoiceCollectionMethodEventData.validate(val) },
137
+ is_model_hash: true)
138
+ )
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,141 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module AdvancedBilling
8
+ # ChangeInvoiceStatusEvent Model.
9
+ class ChangeInvoiceStatusEvent < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Integer]
15
+ attr_accessor :id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [DateTime]
19
+ attr_accessor :timestamp
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Invoice]
23
+ attr_accessor :invoice
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [InvoiceEventType]
27
+ attr_accessor :event_type
28
+
29
+ # Example schema for an `change_invoice_status` event
30
+ # @return [ChangeInvoiceStatusEventData]
31
+ attr_accessor :event_data
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['id'] = 'id'
37
+ @_hash['timestamp'] = 'timestamp'
38
+ @_hash['invoice'] = 'invoice'
39
+ @_hash['event_type'] = 'event_type'
40
+ @_hash['event_data'] = 'event_data'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ []
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(id = nil,
55
+ timestamp = nil,
56
+ invoice = nil,
57
+ event_type = InvoiceEventType::CHANGE_INVOICE_STATUS,
58
+ event_data = nil,
59
+ additional_properties = {})
60
+ @id = id
61
+ @timestamp = timestamp
62
+ @invoice = invoice
63
+ @event_type = event_type
64
+ @event_data = event_data
65
+
66
+ # Add additional model properties to the instance.
67
+ additional_properties.each do |_name, _value|
68
+ instance_variable_set("@#{_name}", _value)
69
+ end
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ id = hash.key?('id') ? hash['id'] : nil
78
+ timestamp = if hash.key?('timestamp')
79
+ (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
80
+ end
81
+ invoice = Invoice.from_hash(hash['invoice']) if hash['invoice']
82
+ event_type =
83
+ hash['event_type'] ||= InvoiceEventType::CHANGE_INVOICE_STATUS
84
+ event_data = ChangeInvoiceStatusEventData.from_hash(hash['event_data']) if
85
+ hash['event_data']
86
+
87
+ # Clean out expected properties from Hash.
88
+ names.each_value { |k| hash.delete(k) }
89
+
90
+ # Create object from extracted values.
91
+ ChangeInvoiceStatusEvent.new(id,
92
+ timestamp,
93
+ invoice,
94
+ event_type,
95
+ event_data,
96
+ hash)
97
+ end
98
+
99
+ def to_custom_timestamp
100
+ DateTimeHelper.to_rfc3339(timestamp)
101
+ end
102
+
103
+ # Validates an instance of the object from a given value.
104
+ # @param [ChangeInvoiceStatusEvent | Hash] The value against the validation is performed.
105
+ def self.validate(value)
106
+ if value.instance_of? self
107
+ return (
108
+ APIHelper.valid_type?(value.id,
109
+ ->(val) { val.instance_of? Integer }) and
110
+ APIHelper.valid_type?(value.timestamp,
111
+ ->(val) { val.instance_of? DateTime }) and
112
+ APIHelper.valid_type?(value.invoice,
113
+ ->(val) { Invoice.validate(val) },
114
+ is_model_hash: true) and
115
+ APIHelper.valid_type?(value.event_type,
116
+ ->(val) { InvoiceEventType.validate(val) }) and
117
+ APIHelper.valid_type?(value.event_data,
118
+ ->(val) { ChangeInvoiceStatusEventData.validate(val) },
119
+ is_model_hash: true)
120
+ )
121
+ end
122
+
123
+ return false unless value.instance_of? Hash
124
+
125
+ (
126
+ APIHelper.valid_type?(value['id'],
127
+ ->(val) { val.instance_of? Integer }) and
128
+ APIHelper.valid_type?(value['timestamp'],
129
+ ->(val) { val.instance_of? String }) and
130
+ APIHelper.valid_type?(value['invoice'],
131
+ ->(val) { Invoice.validate(val) },
132
+ is_model_hash: true) and
133
+ APIHelper.valid_type?(value['event_type'],
134
+ ->(val) { InvoiceEventType.validate(val) }) and
135
+ APIHelper.valid_type?(value['event_data'],
136
+ ->(val) { ChangeInvoiceStatusEventData.validate(val) },
137
+ is_model_hash: true)
138
+ )
139
+ end
140
+ end
141
+ end