maxio-advanced-billing-sdk 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
+ # FailedPaymentEvent Model.
9
+ class FailedPaymentEvent < 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 `failed_payment` event
30
+ # @return [FailedPaymentEventData]
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::FAILED_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::FAILED_PAYMENT
83
+ event_data = FailedPaymentEventData.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
+ FailedPaymentEvent.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 [FailedPaymentEvent | 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) { FailedPaymentEventData.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) { FailedPaymentEventData.validate(val) },
135
+ is_model_hash: true)
136
+ )
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,132 @@
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 `failed_payment` event
8
+ class FailedPaymentEventData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The monetary value of the payment, expressed in cents.
13
+ # @return [Integer]
14
+ attr_accessor :amount_in_cents
15
+
16
+ # The monetary value of the payment, expressed in dollars.
17
+ # @return [Integer]
18
+ attr_accessor :applied_amount
19
+
20
+ # The memo passed when the payment was created.
21
+ # @return [String]
22
+ attr_accessor :memo
23
+
24
+ # The memo passed when the payment was created.
25
+ # @return [InvoicePaymentMethodType]
26
+ attr_accessor :payment_method
27
+
28
+ # The transaction ID of the failed payment.
29
+ # @return [Integer]
30
+ attr_accessor :transaction_id
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['amount_in_cents'] = 'amount_in_cents'
36
+ @_hash['applied_amount'] = 'applied_amount'
37
+ @_hash['memo'] = 'memo'
38
+ @_hash['payment_method'] = 'payment_method'
39
+ @_hash['transaction_id'] = 'transaction_id'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ memo
47
+ ]
48
+ end
49
+
50
+ # An array for nullable fields
51
+ def self.nullables
52
+ %w[
53
+ memo
54
+ ]
55
+ end
56
+
57
+ def initialize(amount_in_cents = nil,
58
+ applied_amount = nil,
59
+ payment_method = nil,
60
+ transaction_id = nil,
61
+ memo = SKIP,
62
+ additional_properties = {})
63
+ @amount_in_cents = amount_in_cents
64
+ @applied_amount = applied_amount
65
+ @memo = memo unless memo == SKIP
66
+ @payment_method = payment_method
67
+ @transaction_id = transaction_id
68
+
69
+ # Add additional model properties to the instance.
70
+ additional_properties.each do |_name, _value|
71
+ instance_variable_set("@#{_name}", _value)
72
+ end
73
+ end
74
+
75
+ # Creates an instance of the object from a hash.
76
+ def self.from_hash(hash)
77
+ return nil unless hash
78
+
79
+ # Extract variables from the hash.
80
+ amount_in_cents =
81
+ hash.key?('amount_in_cents') ? hash['amount_in_cents'] : nil
82
+ applied_amount =
83
+ hash.key?('applied_amount') ? hash['applied_amount'] : nil
84
+ payment_method =
85
+ hash.key?('payment_method') ? hash['payment_method'] : nil
86
+ transaction_id =
87
+ hash.key?('transaction_id') ? hash['transaction_id'] : nil
88
+ memo = hash.key?('memo') ? hash['memo'] : SKIP
89
+
90
+ # Clean out expected properties from Hash.
91
+ names.each_value { |k| hash.delete(k) }
92
+
93
+ # Create object from extracted values.
94
+ FailedPaymentEventData.new(amount_in_cents,
95
+ applied_amount,
96
+ payment_method,
97
+ transaction_id,
98
+ memo,
99
+ hash)
100
+ end
101
+
102
+ # Validates an instance of the object from a given value.
103
+ # @param [FailedPaymentEventData | Hash] The value against the validation is performed.
104
+ def self.validate(value)
105
+ if value.instance_of? self
106
+ return (
107
+ APIHelper.valid_type?(value.amount_in_cents,
108
+ ->(val) { val.instance_of? Integer }) and
109
+ APIHelper.valid_type?(value.applied_amount,
110
+ ->(val) { val.instance_of? Integer }) and
111
+ APIHelper.valid_type?(value.payment_method,
112
+ ->(val) { InvoicePaymentMethodType.validate(val) }) and
113
+ APIHelper.valid_type?(value.transaction_id,
114
+ ->(val) { val.instance_of? Integer })
115
+ )
116
+ end
117
+
118
+ return false unless value.instance_of? Hash
119
+
120
+ (
121
+ APIHelper.valid_type?(value['amount_in_cents'],
122
+ ->(val) { val.instance_of? Integer }) and
123
+ APIHelper.valid_type?(value['applied_amount'],
124
+ ->(val) { val.instance_of? Integer }) and
125
+ APIHelper.valid_type?(value['payment_method'],
126
+ ->(val) { InvoicePaymentMethodType.validate(val) }) and
127
+ APIHelper.valid_type?(value['transaction_id'],
128
+ ->(val) { val.instance_of? Integer })
129
+ )
130
+ end
131
+ end
132
+ end
@@ -83,5 +83,15 @@ module AdvancedBilling
83
83
  prorate,
84
84
  hash)
85
85
  end
86
+
87
+ # Validates an instance of the object from a given value.
88
+ # @param [GroupBilling | Hash] The value against the validation is performed.
89
+ def self.validate(value)
90
+ return true if value.instance_of? self
91
+
92
+ return false unless value.instance_of? Hash
93
+
94
+ true
95
+ end
86
96
  end
87
97
  end
@@ -73,13 +73,15 @@ module AdvancedBilling
73
73
  def self.validate(value)
74
74
  if value.instance_of? self
75
75
  return APIHelper.valid_type?(value.target,
76
- ->(val) { GroupTarget.validate(val) })
76
+ ->(val) { GroupTarget.validate(val) },
77
+ is_model_hash: true)
77
78
  end
78
79
 
79
80
  return false unless value.instance_of? Hash
80
81
 
81
82
  APIHelper.valid_type?(value['target'],
82
- ->(val) { GroupTarget.validate(val) })
83
+ ->(val) { GroupTarget.validate(val) },
84
+ is_model_hash: true)
83
85
  end
84
86
  end
85
87
  end
@@ -68,5 +68,19 @@ module AdvancedBilling
68
68
  id,
69
69
  hash)
70
70
  end
71
+
72
+ # Validates an instance of the object from a given value.
73
+ # @param [GroupTarget | Hash] The value against the validation is performed.
74
+ def self.validate(value)
75
+ if value.instance_of? self
76
+ return APIHelper.valid_type?(value.type,
77
+ ->(val) { GroupTargetType.validate(val) })
78
+ end
79
+
80
+ return false unless value.instance_of? Hash
81
+
82
+ APIHelper.valid_type?(value['type'],
83
+ ->(val) { GroupTargetType.validate(val) })
84
+ end
71
85
  end
72
86
  end
@@ -0,0 +1,109 @@
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
+ # Optional for Event Based Components. If the `include=historic_usages` query
9
+ # param is provided, the last ten billing periods will be returned.
10
+ class HistoricUsage < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # Total usage of a component for billing period
15
+ # @return [Float]
16
+ attr_accessor :total_usage_quantity
17
+
18
+ # Start date of billing period
19
+ # @return [DateTime]
20
+ attr_accessor :billing_period_starts_at
21
+
22
+ # End date of billing period
23
+ # @return [DateTime]
24
+ attr_accessor :billing_period_ends_at
25
+
26
+ # A mapping from model property names to API property names.
27
+ def self.names
28
+ @_hash = {} if @_hash.nil?
29
+ @_hash['total_usage_quantity'] = 'total_usage_quantity'
30
+ @_hash['billing_period_starts_at'] = 'billing_period_starts_at'
31
+ @_hash['billing_period_ends_at'] = 'billing_period_ends_at'
32
+ @_hash
33
+ end
34
+
35
+ # An array for optional fields
36
+ def self.optionals
37
+ %w[
38
+ total_usage_quantity
39
+ billing_period_starts_at
40
+ billing_period_ends_at
41
+ ]
42
+ end
43
+
44
+ # An array for nullable fields
45
+ def self.nullables
46
+ []
47
+ end
48
+
49
+ def initialize(total_usage_quantity = SKIP,
50
+ billing_period_starts_at = SKIP,
51
+ billing_period_ends_at = SKIP,
52
+ additional_properties = {})
53
+ @total_usage_quantity = total_usage_quantity unless total_usage_quantity == SKIP
54
+ @billing_period_starts_at = billing_period_starts_at unless billing_period_starts_at == SKIP
55
+ @billing_period_ends_at = billing_period_ends_at unless billing_period_ends_at == SKIP
56
+
57
+ # Add additional model properties to the instance.
58
+ additional_properties.each do |_name, _value|
59
+ instance_variable_set("@#{_name}", _value)
60
+ end
61
+ end
62
+
63
+ # Creates an instance of the object from a hash.
64
+ def self.from_hash(hash)
65
+ return nil unless hash
66
+
67
+ # Extract variables from the hash.
68
+ total_usage_quantity =
69
+ hash.key?('total_usage_quantity') ? hash['total_usage_quantity'] : SKIP
70
+ billing_period_starts_at = if hash.key?('billing_period_starts_at')
71
+ (DateTimeHelper.from_rfc3339(hash['billing_period_starts_at']) if hash['billing_period_starts_at'])
72
+ else
73
+ SKIP
74
+ end
75
+ billing_period_ends_at = if hash.key?('billing_period_ends_at')
76
+ (DateTimeHelper.from_rfc3339(hash['billing_period_ends_at']) if hash['billing_period_ends_at'])
77
+ else
78
+ SKIP
79
+ end
80
+
81
+ # Clean out expected properties from Hash.
82
+ names.each_value { |k| hash.delete(k) }
83
+
84
+ # Create object from extracted values.
85
+ HistoricUsage.new(total_usage_quantity,
86
+ billing_period_starts_at,
87
+ billing_period_ends_at,
88
+ hash)
89
+ end
90
+
91
+ def to_custom_billing_period_starts_at
92
+ DateTimeHelper.to_rfc3339(billing_period_starts_at)
93
+ end
94
+
95
+ def to_custom_billing_period_ends_at
96
+ DateTimeHelper.to_rfc3339(billing_period_ends_at)
97
+ end
98
+
99
+ # Validates an instance of the object from a given value.
100
+ # @param [HistoricUsage | Hash] The value against the validation is performed.
101
+ def self.validate(value)
102
+ return true if value.instance_of? self
103
+
104
+ return false unless value.instance_of? Hash
105
+
106
+ true
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,23 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module AdvancedBilling
7
+ # Allows to filter by `not_null` or `null`.
8
+ class IncludeNullOrNotNull
9
+ INCLUDE_NULL_OR_NOT_NULL = [
10
+ # TODO: Write general description for NOT_NULL
11
+ NOT_NULL = 'not_null'.freeze,
12
+
13
+ # TODO: Write general description for NULL
14
+ NULL = 'null'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ INCLUDE_NULL_OR_NOT_NULL.include?(value)
21
+ end
22
+ end
23
+ end
@@ -81,20 +81,20 @@ module AdvancedBilling
81
81
  attr_accessor :paid_date
82
82
 
83
83
  # The current status of the invoice. See [Invoice
84
- # Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#lin
85
- # e-item-breakdowns) for more.
84
+ # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
85
+ # 53-Introduction-to-Invoices#invoice-statuses) for more.
86
86
  # @return [InvoiceStatus]
87
87
  attr_accessor :status
88
88
 
89
89
  # The current status of the invoice. See [Invoice
90
- # Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#lin
91
- # e-item-breakdowns) for more.
90
+ # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
91
+ # 53-Introduction-to-Invoices#invoice-statuses) for more.
92
92
  # @return [InvoiceRole]
93
93
  attr_accessor :role
94
94
 
95
95
  # The current status of the invoice. See [Invoice
96
- # Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#lin
97
- # e-item-breakdowns) for more.
96
+ # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
97
+ # 53-Introduction-to-Invoices#invoice-statuses) for more.
98
98
  # @return [Integer]
99
99
  attr_accessor :parent_invoice_id
100
100
 
@@ -420,7 +420,7 @@ module AdvancedBilling
420
420
  status = SKIP,
421
421
  role = SKIP,
422
422
  parent_invoice_id = SKIP,
423
- collection_method = CollectionMethod::AUTOMATIC,
423
+ collection_method = SKIP,
424
424
  payment_instructions = SKIP,
425
425
  currency = SKIP,
426
426
  consolidation_level = SKIP,
@@ -556,7 +556,7 @@ module AdvancedBilling
556
556
  parent_invoice_id =
557
557
  hash.key?('parent_invoice_id') ? hash['parent_invoice_id'] : SKIP
558
558
  collection_method =
559
- hash['collection_method'] ||= CollectionMethod::AUTOMATIC
559
+ hash.key?('collection_method') ? hash['collection_method'] : SKIP
560
560
  payment_instructions =
561
561
  hash.key?('payment_instructions') ? hash['payment_instructions'] : SKIP
562
562
  currency = hash.key?('currency') ? hash['currency'] : SKIP
@@ -740,5 +740,15 @@ module AdvancedBilling
740
740
  def to_custom_updated_at
741
741
  DateTimeHelper.to_rfc3339(updated_at)
742
742
  end
743
+
744
+ # Validates an instance of the object from a given value.
745
+ # @param [Invoice | Hash] The value against the validation is performed.
746
+ def self.validate(value)
747
+ return true if value.instance_of? self
748
+
749
+ return false unless value.instance_of? Hash
750
+
751
+ true
752
+ end
743
753
  end
744
754
  end
@@ -113,5 +113,15 @@ module AdvancedBilling
113
113
  country,
114
114
  hash)
115
115
  end
116
+
117
+ # Validates an instance of the object from a given value.
118
+ # @param [InvoiceAddress | Hash] The value against the validation is performed.
119
+ def self.validate(value)
120
+ return true if value.instance_of? self
121
+
122
+ return false unless value.instance_of? Hash
123
+
124
+ true
125
+ end
116
126
  end
117
127
  end
@@ -77,5 +77,15 @@ module AdvancedBilling
77
77
  outstanding_amount,
78
78
  hash)
79
79
  end
80
+
81
+ # Validates an instance of the object from a given value.
82
+ # @param [InvoiceBalanceItem | Hash] The value against the validation is performed.
83
+ def self.validate(value)
84
+ return true if value.instance_of? self
85
+
86
+ return false unless value.instance_of? Hash
87
+
88
+ true
89
+ end
80
90
  end
81
91
  end
@@ -129,5 +129,15 @@ module AdvancedBilling
129
129
  def to_custom_transaction_time
130
130
  DateTimeHelper.to_rfc3339(transaction_time)
131
131
  end
132
+
133
+ # Validates an instance of the object from a given value.
134
+ # @param [InvoiceCredit | Hash] The value against the validation is performed.
135
+ def self.validate(value)
136
+ return true if value.instance_of? self
137
+
138
+ return false unless value.instance_of? Hash
139
+
140
+ true
141
+ end
132
142
  end
133
143
  end
@@ -96,5 +96,15 @@ module AdvancedBilling
96
96
  metadatum_id,
97
97
  hash)
98
98
  end
99
+
100
+ # Validates an instance of the object from a given value.
101
+ # @param [InvoiceCustomField | Hash] The value against the validation is performed.
102
+ def self.validate(value)
103
+ return true if value.instance_of? self
104
+
105
+ return false unless value.instance_of? Hash
106
+
107
+ true
108
+ end
99
109
  end
100
110
  end
@@ -122,5 +122,15 @@ module AdvancedBilling
122
122
  reference,
123
123
  hash)
124
124
  end
125
+
126
+ # Validates an instance of the object from a given value.
127
+ # @param [InvoiceCustomer | Hash] The value against the validation is performed.
128
+ def self.validate(value)
129
+ return true if value.instance_of? self
130
+
131
+ return false unless value.instance_of? Hash
132
+
133
+ true
134
+ end
125
135
  end
126
136
  end
@@ -180,5 +180,15 @@ module AdvancedBilling
180
180
  line_item_breakouts,
181
181
  hash)
182
182
  end
183
+
184
+ # Validates an instance of the object from a given value.
185
+ # @param [InvoiceDiscount | Hash] The value against the validation is performed.
186
+ def self.validate(value)
187
+ return true if value.instance_of? self
188
+
189
+ return false unless value.instance_of? Hash
190
+
191
+ true
192
+ end
183
193
  end
184
194
  end
@@ -78,5 +78,15 @@ module AdvancedBilling
78
78
  discount_amount,
79
79
  hash)
80
80
  end
81
+
82
+ # Validates an instance of the object from a given value.
83
+ # @param [InvoiceDiscountBreakout | Hash] The value against the validation is performed.
84
+ def self.validate(value)
85
+ return true if value.instance_of? self
86
+
87
+ return false unless value.instance_of? Hash
88
+
89
+ true
90
+ end
81
91
  end
82
92
  end
@@ -71,5 +71,15 @@ module AdvancedBilling
71
71
  include_discounts_on_lines,
72
72
  hash)
73
73
  end
74
+
75
+ # Validates an instance of the object from a given value.
76
+ # @param [InvoiceDisplaySettings | Hash] The value against the validation is performed.
77
+ def self.validate(value)
78
+ return true if value.instance_of? self
79
+
80
+ return false unless value.instance_of? Hash
81
+
82
+ true
83
+ end
74
84
  end
75
85
  end
@@ -22,6 +22,9 @@ module AdvancedBilling
22
22
  # TODO: Write general description for APPLY_DEBIT_NOTE
23
23
  APPLY_DEBIT_NOTE = 'apply_debit_note'.freeze,
24
24
 
25
+ # TODO: Write general description for CREATE_DEBIT_NOTE
26
+ CREATE_DEBIT_NOTE = 'create_debit_note'.freeze,
27
+
25
28
  # TODO: Write general description for REFUND_INVOICE
26
29
  REFUND_INVOICE = 'refund_invoice'.freeze,
27
30