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
+ # RefundInvoiceEvent Model.
9
+ class RefundInvoiceEvent < 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 `refund_invoice` event
30
+ # @return [RefundInvoiceEventData]
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::REFUND_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::REFUND_INVOICE
83
+ event_data = RefundInvoiceEventData.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
+ RefundInvoiceEvent.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 [RefundInvoiceEvent | 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) { RefundInvoiceEventData.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) { RefundInvoiceEventData.validate(val) },
135
+ is_model_hash: true)
136
+ )
137
+ end
138
+ end
139
+ end
@@ -172,7 +172,8 @@ module AdvancedBilling
172
172
  APIHelper.valid_type?(value.apply_credit,
173
173
  ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
174
174
  APIHelper.valid_type?(value.credit_note_attributes,
175
- ->(val) { CreditNote.validate(val) }) and
175
+ ->(val) { CreditNote.validate(val) },
176
+ is_model_hash: true) and
176
177
  APIHelper.valid_type?(value.payment_id,
177
178
  ->(val) { val.instance_of? Integer }) and
178
179
  APIHelper.valid_type?(value.refund_amount,
@@ -190,7 +191,8 @@ module AdvancedBilling
190
191
  APIHelper.valid_type?(value['apply_credit'],
191
192
  ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
192
193
  APIHelper.valid_type?(value['credit_note_attributes'],
193
- ->(val) { CreditNote.validate(val) }) and
194
+ ->(val) { CreditNote.validate(val) },
195
+ is_model_hash: true) and
194
196
  APIHelper.valid_type?(value['payment_id'],
195
197
  ->(val) { val.instance_of? Integer }) and
196
198
  APIHelper.valid_type?(value['refund_amount'],
@@ -10,7 +10,7 @@ module AdvancedBilling
10
10
  private_constant :SKIP
11
11
 
12
12
  # TODO: Write general description for this method
13
- # @return [Refund]
13
+ # @return [Object]
14
14
  attr_accessor :refund
15
15
 
16
16
  # A mapping from model property names to API property names.
@@ -46,7 +46,9 @@ module AdvancedBilling
46
46
 
47
47
  # An array for nullable fields
48
48
  def self.nullables
49
- []
49
+ %w[
50
+ amount_in_cents
51
+ ]
50
52
  end
51
53
 
52
54
  def initialize(amount_in_cents = nil,
@@ -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
+ # RemovePaymentEvent Model.
9
+ class RemovePaymentEvent < 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 `remove_payment` event
30
+ # @return [RemovePaymentEventData]
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::REMOVE_PAYMENT,
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::REMOVE_PAYMENT
83
+ event_data = RemovePaymentEventData.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
+ RemovePaymentEvent.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 [RemovePaymentEvent | 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) { RemovePaymentEventData.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) { RemovePaymentEventData.validate(val) },
135
+ is_model_hash: true)
136
+ )
137
+ end
138
+ end
139
+ end
@@ -32,7 +32,7 @@ module AdvancedBilling
32
32
  attr_accessor :transaction_time
33
33
 
34
34
  # A nested data structure detailing the method of payment
35
- # @return [InvoiceEventPayment]
35
+ # @return [Object]
36
36
  attr_accessor :payment_method
37
37
 
38
38
  # The flag that shows whether the original payment was a prepayment or not
@@ -132,5 +132,15 @@ module AdvancedBilling
132
132
  segment_id,
133
133
  hash)
134
134
  end
135
+
136
+ # Validates an instance of the object from a given value.
137
+ # @param [SegmentPrice | Hash] The value against the validation is performed.
138
+ def self.validate(value)
139
+ return true if value.instance_of? self
140
+
141
+ return false unless value.instance_of? Hash
142
+
143
+ true
144
+ end
135
145
  end
136
146
  end
@@ -291,7 +291,8 @@ module AdvancedBilling
291
291
  # @return [Integer]
292
292
  attr_accessor :payer_id
293
293
 
294
- # The balance in cents plus the estimated renewal amount in cents.
294
+ # The balance in cents plus the estimated renewal amount in cents. Returned
295
+ # ONLY for readSubscription operation as it's compute intensive operation.
295
296
  # @return [Integer]
296
297
  attr_accessor :current_billing_amount_in_cents
297
298
 
@@ -530,13 +531,17 @@ module AdvancedBilling
530
531
  # An array for nullable fields
531
532
  def self.nullables
532
533
  %w[
534
+ current_period_ends_at
535
+ next_assessment_at
533
536
  trial_started_at
534
537
  trial_ended_at
538
+ activated_at
535
539
  expires_at
536
540
  cancellation_message
537
541
  cancellation_method
538
542
  cancel_at_end_of_period
539
543
  canceled_at
544
+ current_period_started_at
540
545
  delayed_cancel_at
541
546
  coupon_code
542
547
  snap_day
@@ -560,6 +565,7 @@ module AdvancedBilling
560
565
  receives_invoice_emails
561
566
  locale
562
567
  scheduled_cancellation_at
568
+ prepaid_configuration
563
569
  ]
564
570
  end
565
571
 
@@ -588,7 +594,7 @@ module AdvancedBilling
588
594
  delayed_cancel_at = SKIP,
589
595
  coupon_code = SKIP,
590
596
  snap_day = SKIP,
591
- payment_collection_method = CollectionMethod::AUTOMATIC,
597
+ payment_collection_method = SKIP,
592
598
  customer = SKIP,
593
599
  product = SKIP,
594
600
  credit_card = SKIP,
@@ -807,13 +813,11 @@ module AdvancedBilling
807
813
  coupon_code = hash.key?('coupon_code') ? hash['coupon_code'] : SKIP
808
814
  snap_day = hash.key?('snap_day') ? hash['snap_day'] : SKIP
809
815
  payment_collection_method =
810
- hash['payment_collection_method'] ||= CollectionMethod::AUTOMATIC
816
+ hash.key?('payment_collection_method') ? hash['payment_collection_method'] : SKIP
811
817
  customer = Customer.from_hash(hash['customer']) if hash['customer']
812
818
  product = Product.from_hash(hash['product']) if hash['product']
813
819
  credit_card = CreditCardPaymentProfile.from_hash(hash['credit_card']) if hash['credit_card']
814
- group = hash.key?('group') ? APIHelper.deserialize_union_type(
815
- UnionTypeLookUp.get(:SubscriptionGroup2), hash['group']
816
- ) : SKIP
820
+ group = NestedSubscriptionGroup.from_hash(hash['group']) if hash['group']
817
821
  bank_account = BankAccountPaymentProfile.from_hash(hash['bank_account']) if
818
822
  hash['bank_account']
819
823
  payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP
@@ -1010,15 +1014,5 @@ module AdvancedBilling
1010
1014
  def to_custom_scheduled_cancellation_at
1011
1015
  DateTimeHelper.to_rfc3339(scheduled_cancellation_at)
1012
1016
  end
1013
-
1014
- # Validates an instance of the object from a given value.
1015
- # @param [Subscription | Hash] The value against the validation is performed.
1016
- def self.validate(value)
1017
- return true if value.instance_of? self
1018
-
1019
- return false unless value.instance_of? Hash
1020
-
1021
- true
1022
- end
1023
1017
  end
1024
1018
  end
@@ -110,7 +110,7 @@ module AdvancedBilling
110
110
  # The type of credit to be created when upgrading/downgrading. Defaults to
111
111
  # the component and then site setting if one is not provided.
112
112
  # Available values: `full`, `prorated`, `none`.
113
- # @return [Object]
113
+ # @return [PricePointType]
114
114
  attr_accessor :price_point_type
115
115
 
116
116
  # The type of credit to be created when upgrading/downgrading. Defaults to
@@ -166,6 +166,11 @@ module AdvancedBilling
166
166
  # @return [SubscriptionComponentSubscription]
167
167
  attr_accessor :subscription
168
168
 
169
+ # An optional object, will be returned if provided `include=subscription`
170
+ # query param.
171
+ # @return [Array[HistoricUsage]]
172
+ attr_accessor :historic_usages
173
+
169
174
  # An optional object, will be returned if provided `include=subscription`
170
175
  # query param.
171
176
  # @return [TrueClass | FalseClass]
@@ -215,6 +220,7 @@ module AdvancedBilling
215
220
  @_hash['description'] = 'description'
216
221
  @_hash['allow_fractional_quantities'] = 'allow_fractional_quantities'
217
222
  @_hash['subscription'] = 'subscription'
223
+ @_hash['historic_usages'] = 'historic_usages'
218
224
  @_hash['display_on_hosted_page'] = 'display_on_hosted_page'
219
225
  @_hash['interval'] = 'interval'
220
226
  @_hash['interval_unit'] = 'interval_unit'
@@ -252,6 +258,7 @@ module AdvancedBilling
252
258
  description
253
259
  allow_fractional_quantities
254
260
  subscription
261
+ historic_usages
255
262
  display_on_hosted_page
256
263
  interval
257
264
  interval_unit
@@ -268,6 +275,7 @@ module AdvancedBilling
268
275
  archived_at
269
276
  price_point_id
270
277
  price_point_handle
278
+ price_point_type
271
279
  price_point_name
272
280
  use_site_exchange_rate
273
281
  description
@@ -302,6 +310,7 @@ module AdvancedBilling
302
310
  description = SKIP,
303
311
  allow_fractional_quantities = SKIP,
304
312
  subscription = SKIP,
313
+ historic_usages = SKIP,
305
314
  display_on_hosted_page = SKIP,
306
315
  interval = SKIP,
307
316
  interval_unit = SKIP,
@@ -337,6 +346,7 @@ module AdvancedBilling
337
346
  allow_fractional_quantities
338
347
  end
339
348
  @subscription = subscription unless subscription == SKIP
349
+ @historic_usages = historic_usages unless historic_usages == SKIP
340
350
  @display_on_hosted_page = display_on_hosted_page unless display_on_hosted_page == SKIP
341
351
  @interval = interval unless interval == SKIP
342
352
  @interval_unit = interval_unit unless interval_unit == SKIP
@@ -362,9 +372,8 @@ module AdvancedBilling
362
372
  allocated_quantity = hash.key?('allocated_quantity') ? APIHelper.deserialize_union_type(
363
373
  UnionTypeLookUp.get(:SubscriptionComponentAllocatedQuantity), hash['allocated_quantity']
364
374
  ) : SKIP
365
- pricing_scheme = hash.key?('pricing_scheme') ? APIHelper.deserialize_union_type(
366
- UnionTypeLookUp.get(:SubscriptionComponentPricingScheme), hash['pricing_scheme']
367
- ) : SKIP
375
+ pricing_scheme =
376
+ hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP
368
377
  component_id = hash.key?('component_id') ? hash['component_id'] : SKIP
369
378
  component_handle =
370
379
  hash.key?('component_handle') ? hash['component_handle'] : SKIP
@@ -384,9 +393,8 @@ module AdvancedBilling
384
393
  hash.key?('price_point_id') ? hash['price_point_id'] : SKIP
385
394
  price_point_handle =
386
395
  hash.key?('price_point_handle') ? hash['price_point_handle'] : SKIP
387
- price_point_type = hash.key?('price_point_type') ? APIHelper.deserialize_union_type(
388
- UnionTypeLookUp.get(:SubscriptionComponentPricePointType), hash['price_point_type']
389
- ) : SKIP
396
+ price_point_type =
397
+ hash.key?('price_point_type') ? hash['price_point_type'] : SKIP
390
398
  price_point_name =
391
399
  hash.key?('price_point_name') ? hash['price_point_name'] : SKIP
392
400
  product_family_id =
@@ -410,6 +418,16 @@ module AdvancedBilling
410
418
  hash.key?('allow_fractional_quantities') ? hash['allow_fractional_quantities'] : SKIP
411
419
  subscription = SubscriptionComponentSubscription.from_hash(hash['subscription']) if
412
420
  hash['subscription']
421
+ # Parameter is an array, so we need to iterate through it
422
+ historic_usages = nil
423
+ unless hash['historic_usages'].nil?
424
+ historic_usages = []
425
+ hash['historic_usages'].each do |structure|
426
+ historic_usages << (HistoricUsage.from_hash(structure) if structure)
427
+ end
428
+ end
429
+
430
+ historic_usages = SKIP unless hash.key?('historic_usages')
413
431
  display_on_hosted_page =
414
432
  hash.key?('display_on_hosted_page') ? hash['display_on_hosted_page'] : SKIP
415
433
  interval = hash.key?('interval') ? hash['interval'] : SKIP
@@ -447,6 +465,7 @@ module AdvancedBilling
447
465
  description,
448
466
  allow_fractional_quantities,
449
467
  subscription,
468
+ historic_usages,
450
469
  display_on_hosted_page,
451
470
  interval,
452
471
  interval_unit,
@@ -212,5 +212,15 @@ module AdvancedBilling
212
212
  def to_custom_updated_at
213
213
  DateTimeHelper.to_rfc3339(updated_at)
214
214
  end
215
+
216
+ # Validates an instance of the object from a given value.
217
+ # @param [SubscriptionComponentSubscription | Hash] The value against the validation is performed.
218
+ def self.validate(value)
219
+ return true if value.instance_of? self
220
+
221
+ return false unless value.instance_of? Hash
222
+
223
+ true
224
+ end
215
225
  end
216
226
  end