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,131 @@
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_invoice_status` event
8
+ class ChangeInvoiceStatusEventData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Identifier for the transaction within the payment gateway.
13
+ # @return [String]
14
+ attr_accessor :gateway_trans_id
15
+
16
+ # The monetary value associated with the linked payment, expressed in
17
+ # dollars.
18
+ # @return [String]
19
+ attr_accessor :amount
20
+
21
+ # The status of the invoice before any changes occurred. See [Invoice
22
+ # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
23
+ # 53-Introduction-to-Invoices#invoice-statuses) for more.
24
+ # @return [InvoiceStatus]
25
+ attr_accessor :from_status
26
+
27
+ # The updated status of the invoice after changes have been made. See
28
+ # [Invoice
29
+ # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
30
+ # 53-Introduction-to-Invoices#invoice-statuses) for more.
31
+ # @return [InvoiceStatus]
32
+ attr_accessor :to_status
33
+
34
+ # The updated status of the invoice after changes have been made. See
35
+ # [Invoice
36
+ # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
37
+ # 53-Introduction-to-Invoices#invoice-statuses) for more.
38
+ # @return [InvoiceConsolidationLevel]
39
+ attr_accessor :consolidation_level
40
+
41
+ # A mapping from model property names to API property names.
42
+ def self.names
43
+ @_hash = {} if @_hash.nil?
44
+ @_hash['gateway_trans_id'] = 'gateway_trans_id'
45
+ @_hash['amount'] = 'amount'
46
+ @_hash['from_status'] = 'from_status'
47
+ @_hash['to_status'] = 'to_status'
48
+ @_hash['consolidation_level'] = 'consolidation_level'
49
+ @_hash
50
+ end
51
+
52
+ # An array for optional fields
53
+ def self.optionals
54
+ %w[
55
+ gateway_trans_id
56
+ amount
57
+ consolidation_level
58
+ ]
59
+ end
60
+
61
+ # An array for nullable fields
62
+ def self.nullables
63
+ []
64
+ end
65
+
66
+ def initialize(from_status = nil,
67
+ to_status = nil,
68
+ gateway_trans_id = SKIP,
69
+ amount = SKIP,
70
+ consolidation_level = SKIP,
71
+ additional_properties = {})
72
+ @gateway_trans_id = gateway_trans_id unless gateway_trans_id == SKIP
73
+ @amount = amount unless amount == SKIP
74
+ @from_status = from_status
75
+ @to_status = to_status
76
+ @consolidation_level = consolidation_level unless consolidation_level == SKIP
77
+
78
+ # Add additional model properties to the instance.
79
+ additional_properties.each do |_name, _value|
80
+ instance_variable_set("@#{_name}", _value)
81
+ end
82
+ end
83
+
84
+ # Creates an instance of the object from a hash.
85
+ def self.from_hash(hash)
86
+ return nil unless hash
87
+
88
+ # Extract variables from the hash.
89
+ from_status = hash.key?('from_status') ? hash['from_status'] : nil
90
+ to_status = hash.key?('to_status') ? hash['to_status'] : nil
91
+ gateway_trans_id =
92
+ hash.key?('gateway_trans_id') ? hash['gateway_trans_id'] : SKIP
93
+ amount = hash.key?('amount') ? hash['amount'] : SKIP
94
+ consolidation_level =
95
+ hash.key?('consolidation_level') ? hash['consolidation_level'] : SKIP
96
+
97
+ # Clean out expected properties from Hash.
98
+ names.each_value { |k| hash.delete(k) }
99
+
100
+ # Create object from extracted values.
101
+ ChangeInvoiceStatusEventData.new(from_status,
102
+ to_status,
103
+ gateway_trans_id,
104
+ amount,
105
+ consolidation_level,
106
+ hash)
107
+ end
108
+
109
+ # Validates an instance of the object from a given value.
110
+ # @param [ChangeInvoiceStatusEventData | Hash] The value against the validation is performed.
111
+ def self.validate(value)
112
+ if value.instance_of? self
113
+ return (
114
+ APIHelper.valid_type?(value.from_status,
115
+ ->(val) { InvoiceStatus.validate(val) }) and
116
+ APIHelper.valid_type?(value.to_status,
117
+ ->(val) { InvoiceStatus.validate(val) })
118
+ )
119
+ end
120
+
121
+ return false unless value.instance_of? Hash
122
+
123
+ (
124
+ APIHelper.valid_type?(value['from_status'],
125
+ ->(val) { InvoiceStatus.validate(val) }) and
126
+ APIHelper.valid_type?(value['to_status'],
127
+ ->(val) { InvoiceStatus.validate(val) })
128
+ )
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,29 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module AdvancedBilling
7
+ # The current chargeback status.
8
+ class ChargebackStatus
9
+ CHARGEBACK_STATUS = [
10
+ # TODO: Write general description for OPEN
11
+ OPEN = 'open'.freeze,
12
+
13
+ # TODO: Write general description for LOST
14
+ LOST = 'lost'.freeze,
15
+
16
+ # TODO: Write general description for WON
17
+ WON = 'won'.freeze,
18
+
19
+ # TODO: Write general description for CLOSED
20
+ CLOSED = 'closed'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ CHARGEBACK_STATUS.include?(value)
27
+ end
28
+ end
29
+ end
@@ -266,6 +266,7 @@ module AdvancedBilling
266
266
  default_price_point_id
267
267
  overage_prices
268
268
  prices
269
+ price_points_url
269
270
  tax_code
270
271
  upgrade_charge
271
272
  downgrade_credit
@@ -369,9 +370,8 @@ module AdvancedBilling
369
370
  id = hash.key?('id') ? hash['id'] : SKIP
370
371
  name = hash.key?('name') ? hash['name'] : SKIP
371
372
  handle = hash.key?('handle') ? hash['handle'] : SKIP
372
- pricing_scheme = hash.key?('pricing_scheme') ? APIHelper.deserialize_union_type(
373
- UnionTypeLookUp.get(:ComponentPricingScheme), hash['pricing_scheme']
374
- ) : SKIP
373
+ pricing_scheme =
374
+ hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP
375
375
  unit_name = hash.key?('unit_name') ? hash['unit_name'] : SKIP
376
376
  unit_price = hash.key?('unit_price') ? hash['unit_price'] : SKIP
377
377
  product_family_id =
@@ -499,15 +499,5 @@ module AdvancedBilling
499
499
  def to_custom_archived_at
500
500
  DateTimeHelper.to_rfc3339(archived_at)
501
501
  end
502
-
503
- # Validates an instance of the object from a given value.
504
- # @param [Component | Hash] The value against the validation is performed.
505
- def self.validate(value)
506
- return true if value.instance_of? self
507
-
508
- return false unless value.instance_of? Hash
509
-
510
- true
511
- end
512
502
  end
513
503
  end
@@ -134,5 +134,15 @@ module AdvancedBilling
134
134
  tiers,
135
135
  hash)
136
136
  end
137
+
138
+ # Validates an instance of the object from a given value.
139
+ # @param [ComponentCostData | Hash] The value against the validation is performed.
140
+ def self.validate(value)
141
+ return true if value.instance_of? self
142
+
143
+ return false unless value.instance_of? Hash
144
+
145
+ true
146
+ end
137
147
  end
138
148
  end
@@ -100,5 +100,15 @@ module AdvancedBilling
100
100
  amount,
101
101
  hash)
102
102
  end
103
+
104
+ # Validates an instance of the object from a given value.
105
+ # @param [ComponentCostDataRateTier | Hash] The value against the validation is performed.
106
+ def self.validate(value)
107
+ return true if value.instance_of? self
108
+
109
+ return false unless value.instance_of? Hash
110
+
111
+ true
112
+ end
103
113
  end
104
114
  end
@@ -102,5 +102,15 @@ module AdvancedBilling
102
102
  prices,
103
103
  hash)
104
104
  end
105
+
106
+ # Validates an instance of the object from a given value.
107
+ # @param [ComponentCustomPrice | Hash] The value against the validation is performed.
108
+ def self.validate(value)
109
+ return true if value.instance_of? self
110
+
111
+ return false unless value.instance_of? Hash
112
+
113
+ true
114
+ end
105
115
  end
106
116
  end
@@ -159,6 +159,7 @@ module AdvancedBilling
159
159
  # An array for nullable fields
160
160
  def self.nullables
161
161
  %w[
162
+ handle
162
163
  archived_at
163
164
  interval
164
165
  interval_unit
@@ -251,9 +252,7 @@ module AdvancedBilling
251
252
  hash.key?('subscription_id') ? hash['subscription_id'] : SKIP
252
253
  tax_included = hash.key?('tax_included') ? hash['tax_included'] : SKIP
253
254
  interval = hash.key?('interval') ? hash['interval'] : SKIP
254
- interval_unit = hash.key?('interval_unit') ? APIHelper.deserialize_union_type(
255
- UnionTypeLookUp.get(:ComponentPricePointIntervalUnit), hash['interval_unit']
256
- ) : SKIP
255
+ interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : SKIP
257
256
  # Parameter is an array, so we need to iterate through it
258
257
  currency_prices = nil
259
258
  unless hash['currency_prices'].nil?
@@ -300,15 +299,5 @@ module AdvancedBilling
300
299
  def to_custom_updated_at
301
300
  DateTimeHelper.to_rfc3339(updated_at)
302
301
  end
303
-
304
- # Validates an instance of the object from a given value.
305
- # @param [ComponentPricePoint | Hash] The value against the validation is performed.
306
- def self.validate(value)
307
- return true if value.instance_of? self
308
-
309
- return false unless value.instance_of? Hash
310
-
311
- true
312
- end
313
302
  end
314
303
  end
@@ -125,5 +125,15 @@ module AdvancedBilling
125
125
  prices,
126
126
  hash)
127
127
  end
128
+
129
+ # Validates an instance of the object from a given value.
130
+ # @param [ComponentPricePointItem | Hash] The value against the validation is performed.
131
+ def self.validate(value)
132
+ return true if value.instance_of? self
133
+
134
+ return false unless value.instance_of? Hash
135
+
136
+ true
137
+ end
128
138
  end
129
139
  end
@@ -95,7 +95,7 @@ module AdvancedBilling
95
95
  attr_accessor :stackable
96
96
 
97
97
  # TODO: Write general description for this method
98
- # @return [Object]
98
+ # @return [CompoundingStrategy]
99
99
  attr_accessor :compounding_strategy
100
100
 
101
101
  # TODO: Write general description for this method
@@ -219,6 +219,7 @@ module AdvancedBilling
219
219
  duration_interval_span
220
220
  archived_at
221
221
  conversion_limit
222
+ compounding_strategy
222
223
  ]
223
224
  end
224
225
 
@@ -347,9 +348,8 @@ module AdvancedBilling
347
348
  conversion_limit =
348
349
  hash.key?('conversion_limit') ? hash['conversion_limit'] : SKIP
349
350
  stackable = hash.key?('stackable') ? hash['stackable'] : SKIP
350
- compounding_strategy = hash.key?('compounding_strategy') ? APIHelper.deserialize_union_type(
351
- UnionTypeLookUp.get(:CouponCompoundingStrategy), hash['compounding_strategy']
352
- ) : SKIP
351
+ compounding_strategy =
352
+ hash.key?('compounding_strategy') ? hash['compounding_strategy'] : SKIP
353
353
  use_site_exchange_rate =
354
354
  hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP
355
355
  created_at = if hash.key?('created_at')
@@ -436,15 +436,5 @@ module AdvancedBilling
436
436
  def to_custom_updated_at
437
437
  DateTimeHelper.to_rfc3339(updated_at)
438
438
  end
439
-
440
- # Validates an instance of the object from a given value.
441
- # @param [Coupon | Hash] The value against the validation is performed.
442
- def self.validate(value)
443
- return true if value.instance_of? self
444
-
445
- return false unless value.instance_of? Hash
446
-
447
- true
448
- end
449
439
  end
450
440
  end
@@ -154,7 +154,9 @@ module AdvancedBilling
154
154
  APIHelper.valid_type?(value.pricing_scheme,
155
155
  ->(val) { PricingScheme.validate(val) }) and
156
156
  APIHelper.valid_type?(value.prices,
157
- ->(val) { Price.validate(val) })
157
+ ->(val) { Price.validate(val) },
158
+ is_model_hash: true,
159
+ is_inner_model_hash: true)
158
160
  )
159
161
  end
160
162
 
@@ -166,7 +168,9 @@ module AdvancedBilling
166
168
  APIHelper.valid_type?(value['pricing_scheme'],
167
169
  ->(val) { PricingScheme.validate(val) }) and
168
170
  APIHelper.valid_type?(value['prices'],
169
- ->(val) { Price.validate(val) })
171
+ ->(val) { Price.validate(val) },
172
+ is_model_hash: true,
173
+ is_inner_model_hash: true)
170
174
  )
171
175
  end
172
176
  end
@@ -10,7 +10,7 @@ module AdvancedBilling
10
10
  private_constant :SKIP
11
11
 
12
12
  # TODO: Write general description for this method
13
- # @return [PricePoint]
13
+ # @return [Object]
14
14
  attr_accessor :price_point
15
15
 
16
16
  # A mapping from model property names to API property names.
@@ -10,7 +10,7 @@ module AdvancedBilling
10
10
  private_constant :SKIP
11
11
 
12
12
  # TODO: Write general description for this method
13
- # @return [Array[PricePoint]]
13
+ # @return [Array[Object]]
14
14
  attr_accessor :price_points
15
15
 
16
16
  # A mapping from model property names to API property names.
@@ -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
+ # CreateCreditNoteEvent Model.
9
+ class CreateCreditNoteEvent < 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 `create_credit_note` event
30
+ # @return [CreditNote]
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::CREATE_CREDIT_NOTE,
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::CREATE_CREDIT_NOTE
83
+ event_data = CreditNote.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
+ CreateCreditNoteEvent.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 [CreateCreditNoteEvent | 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) { CreditNote.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) { CreditNote.validate(val) },
135
+ is_model_hash: true)
136
+ )
137
+ end
138
+ end
139
+ end
@@ -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
+ # CreateDebitNoteEvent Model.
9
+ class CreateDebitNoteEvent < 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 `create_debit_note` event
30
+ # @return [DebitNote]
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::CREATE_DEBIT_NOTE,
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::CREATE_DEBIT_NOTE
83
+ event_data = DebitNote.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
+ CreateDebitNoteEvent.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 [CreateDebitNoteEvent | 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) { DebitNote.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) { DebitNote.validate(val) },
135
+ is_model_hash: true)
136
+ )
137
+ end
138
+ end
139
+ end