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,351 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module AdvancedBilling
7
+ # DebitNote Model.
8
+ class DebitNote < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Unique identifier for the debit note. It is generated automatically by
13
+ # Chargify and has the prefix "db_" followed by alphanumeric characters.
14
+ # @return [String]
15
+ attr_accessor :uid
16
+
17
+ # ID of the site to which the debit note belongs.
18
+ # @return [Integer]
19
+ attr_accessor :site_id
20
+
21
+ # ID of the customer to which the debit note belongs.
22
+ # @return [Integer]
23
+ attr_accessor :customer_id
24
+
25
+ # ID of the subscription that generated the debit note.
26
+ # @return [Integer]
27
+ attr_accessor :subscription_id
28
+
29
+ # A unique, identifier that appears on the debit note and in places it is
30
+ # referenced.
31
+ # @return [Integer]
32
+ attr_accessor :number
33
+
34
+ # A monotonically increasing number assigned to debit notes as they are
35
+ # created.
36
+ # @return [Integer]
37
+ attr_accessor :sequence_number
38
+
39
+ # Unique identifier for the connected credit note. It is generated
40
+ # automatically by Chargify and has the prefix "cn_" followed by
41
+ # alphanumeric characters.
42
+ # While the UID is long and not appropriate to show to customers, the number
43
+ # is usually shorter and consumable by the customer and the merchant alike.
44
+ # @return [String]
45
+ attr_accessor :origin_credit_note_uid
46
+
47
+ # A unique, identifying string of the connected credit note.
48
+ # @return [String]
49
+ attr_accessor :origin_credit_note_number
50
+
51
+ # Date the document was issued to the customer. This is the date that the
52
+ # document was made available for payment.
53
+ # The format is "YYYY-MM-DD".
54
+ # @return [Date]
55
+ attr_accessor :issue_date
56
+
57
+ # Debit notes are applied to invoices to offset invoiced amounts - they
58
+ # adjust the amount due. This field is the date the debit note document
59
+ # became fully applied to the invoice.
60
+ # The format is "YYYY-MM-DD".
61
+ # @return [Date]
62
+ attr_accessor :applied_date
63
+
64
+ # Date the document is due for payment. The format is "YYYY-MM-DD".
65
+ # @return [Date]
66
+ attr_accessor :due_date
67
+
68
+ # Current status of the debit note.
69
+ # @return [DebitNoteStatus]
70
+ attr_accessor :status
71
+
72
+ # The memo printed on debit note, which is a description of the reason for
73
+ # the debit.
74
+ # @return [String]
75
+ attr_accessor :memo
76
+
77
+ # The role of the debit note.
78
+ # @return [DebitNoteRole]
79
+ attr_accessor :role
80
+
81
+ # The ISO 4217 currency code (3 character string) representing the currency
82
+ # of the credit note amount fields.
83
+ # @return [String]
84
+ attr_accessor :currency
85
+
86
+ # Information about the seller (merchant) listed on the masthead of the
87
+ # debit note.
88
+ # @return [InvoiceSeller]
89
+ attr_accessor :seller
90
+
91
+ # Information about the customer who is owner or recipient the debited
92
+ # subscription.
93
+ # @return [InvoiceCustomer]
94
+ attr_accessor :customer
95
+
96
+ # The billing address of the debited subscription.
97
+ # @return [InvoiceAddress]
98
+ attr_accessor :billing_address
99
+
100
+ # The shipping address of the debited subscription.
101
+ # @return [InvoiceAddress]
102
+ attr_accessor :shipping_address
103
+
104
+ # Line items on the debit note.
105
+ # @return [Array[CreditNoteLineItem]]
106
+ attr_accessor :line_items
107
+
108
+ # Line items on the debit note.
109
+ # @return [Array[InvoiceDiscount]]
110
+ attr_accessor :discounts
111
+
112
+ # Line items on the debit note.
113
+ # @return [Array[InvoiceTax]]
114
+ attr_accessor :taxes
115
+
116
+ # Line items on the debit note.
117
+ # @return [Array[InvoiceRefund]]
118
+ attr_accessor :refunds
119
+
120
+ # A mapping from model property names to API property names.
121
+ def self.names
122
+ @_hash = {} if @_hash.nil?
123
+ @_hash['uid'] = 'uid'
124
+ @_hash['site_id'] = 'site_id'
125
+ @_hash['customer_id'] = 'customer_id'
126
+ @_hash['subscription_id'] = 'subscription_id'
127
+ @_hash['number'] = 'number'
128
+ @_hash['sequence_number'] = 'sequence_number'
129
+ @_hash['origin_credit_note_uid'] = 'origin_credit_note_uid'
130
+ @_hash['origin_credit_note_number'] = 'origin_credit_note_number'
131
+ @_hash['issue_date'] = 'issue_date'
132
+ @_hash['applied_date'] = 'applied_date'
133
+ @_hash['due_date'] = 'due_date'
134
+ @_hash['status'] = 'status'
135
+ @_hash['memo'] = 'memo'
136
+ @_hash['role'] = 'role'
137
+ @_hash['currency'] = 'currency'
138
+ @_hash['seller'] = 'seller'
139
+ @_hash['customer'] = 'customer'
140
+ @_hash['billing_address'] = 'billing_address'
141
+ @_hash['shipping_address'] = 'shipping_address'
142
+ @_hash['line_items'] = 'line_items'
143
+ @_hash['discounts'] = 'discounts'
144
+ @_hash['taxes'] = 'taxes'
145
+ @_hash['refunds'] = 'refunds'
146
+ @_hash
147
+ end
148
+
149
+ # An array for optional fields
150
+ def self.optionals
151
+ %w[
152
+ uid
153
+ site_id
154
+ customer_id
155
+ subscription_id
156
+ number
157
+ sequence_number
158
+ origin_credit_note_uid
159
+ origin_credit_note_number
160
+ issue_date
161
+ applied_date
162
+ due_date
163
+ status
164
+ memo
165
+ role
166
+ currency
167
+ seller
168
+ customer
169
+ billing_address
170
+ shipping_address
171
+ line_items
172
+ discounts
173
+ taxes
174
+ refunds
175
+ ]
176
+ end
177
+
178
+ # An array for nullable fields
179
+ def self.nullables
180
+ []
181
+ end
182
+
183
+ def initialize(uid = SKIP,
184
+ site_id = SKIP,
185
+ customer_id = SKIP,
186
+ subscription_id = SKIP,
187
+ number = SKIP,
188
+ sequence_number = SKIP,
189
+ origin_credit_note_uid = SKIP,
190
+ origin_credit_note_number = SKIP,
191
+ issue_date = SKIP,
192
+ applied_date = SKIP,
193
+ due_date = SKIP,
194
+ status = SKIP,
195
+ memo = SKIP,
196
+ role = SKIP,
197
+ currency = SKIP,
198
+ seller = SKIP,
199
+ customer = SKIP,
200
+ billing_address = SKIP,
201
+ shipping_address = SKIP,
202
+ line_items = SKIP,
203
+ discounts = SKIP,
204
+ taxes = SKIP,
205
+ refunds = SKIP,
206
+ additional_properties = {})
207
+ @uid = uid unless uid == SKIP
208
+ @site_id = site_id unless site_id == SKIP
209
+ @customer_id = customer_id unless customer_id == SKIP
210
+ @subscription_id = subscription_id unless subscription_id == SKIP
211
+ @number = number unless number == SKIP
212
+ @sequence_number = sequence_number unless sequence_number == SKIP
213
+ @origin_credit_note_uid = origin_credit_note_uid unless origin_credit_note_uid == SKIP
214
+ unless origin_credit_note_number == SKIP
215
+ @origin_credit_note_number =
216
+ origin_credit_note_number
217
+ end
218
+ @issue_date = issue_date unless issue_date == SKIP
219
+ @applied_date = applied_date unless applied_date == SKIP
220
+ @due_date = due_date unless due_date == SKIP
221
+ @status = status unless status == SKIP
222
+ @memo = memo unless memo == SKIP
223
+ @role = role unless role == SKIP
224
+ @currency = currency unless currency == SKIP
225
+ @seller = seller unless seller == SKIP
226
+ @customer = customer unless customer == SKIP
227
+ @billing_address = billing_address unless billing_address == SKIP
228
+ @shipping_address = shipping_address unless shipping_address == SKIP
229
+ @line_items = line_items unless line_items == SKIP
230
+ @discounts = discounts unless discounts == SKIP
231
+ @taxes = taxes unless taxes == SKIP
232
+ @refunds = refunds unless refunds == SKIP
233
+
234
+ # Add additional model properties to the instance.
235
+ additional_properties.each do |_name, _value|
236
+ instance_variable_set("@#{_name}", _value)
237
+ end
238
+ end
239
+
240
+ # Creates an instance of the object from a hash.
241
+ def self.from_hash(hash)
242
+ return nil unless hash
243
+
244
+ # Extract variables from the hash.
245
+ uid = hash.key?('uid') ? hash['uid'] : SKIP
246
+ site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
247
+ customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP
248
+ subscription_id =
249
+ hash.key?('subscription_id') ? hash['subscription_id'] : SKIP
250
+ number = hash.key?('number') ? hash['number'] : SKIP
251
+ sequence_number =
252
+ hash.key?('sequence_number') ? hash['sequence_number'] : SKIP
253
+ origin_credit_note_uid =
254
+ hash.key?('origin_credit_note_uid') ? hash['origin_credit_note_uid'] : SKIP
255
+ origin_credit_note_number =
256
+ hash.key?('origin_credit_note_number') ? hash['origin_credit_note_number'] : SKIP
257
+ issue_date = hash.key?('issue_date') ? hash['issue_date'] : SKIP
258
+ applied_date = hash.key?('applied_date') ? hash['applied_date'] : SKIP
259
+ due_date = hash.key?('due_date') ? hash['due_date'] : SKIP
260
+ status = hash.key?('status') ? hash['status'] : SKIP
261
+ memo = hash.key?('memo') ? hash['memo'] : SKIP
262
+ role = hash.key?('role') ? hash['role'] : SKIP
263
+ currency = hash.key?('currency') ? hash['currency'] : SKIP
264
+ seller = InvoiceSeller.from_hash(hash['seller']) if hash['seller']
265
+ customer = InvoiceCustomer.from_hash(hash['customer']) if hash['customer']
266
+ billing_address = InvoiceAddress.from_hash(hash['billing_address']) if
267
+ hash['billing_address']
268
+ shipping_address = InvoiceAddress.from_hash(hash['shipping_address']) if
269
+ hash['shipping_address']
270
+ # Parameter is an array, so we need to iterate through it
271
+ line_items = nil
272
+ unless hash['line_items'].nil?
273
+ line_items = []
274
+ hash['line_items'].each do |structure|
275
+ line_items << (CreditNoteLineItem.from_hash(structure) if structure)
276
+ end
277
+ end
278
+
279
+ line_items = SKIP unless hash.key?('line_items')
280
+ # Parameter is an array, so we need to iterate through it
281
+ discounts = nil
282
+ unless hash['discounts'].nil?
283
+ discounts = []
284
+ hash['discounts'].each do |structure|
285
+ discounts << (InvoiceDiscount.from_hash(structure) if structure)
286
+ end
287
+ end
288
+
289
+ discounts = SKIP unless hash.key?('discounts')
290
+ # Parameter is an array, so we need to iterate through it
291
+ taxes = nil
292
+ unless hash['taxes'].nil?
293
+ taxes = []
294
+ hash['taxes'].each do |structure|
295
+ taxes << (InvoiceTax.from_hash(structure) if structure)
296
+ end
297
+ end
298
+
299
+ taxes = SKIP unless hash.key?('taxes')
300
+ # Parameter is an array, so we need to iterate through it
301
+ refunds = nil
302
+ unless hash['refunds'].nil?
303
+ refunds = []
304
+ hash['refunds'].each do |structure|
305
+ refunds << (InvoiceRefund.from_hash(structure) if structure)
306
+ end
307
+ end
308
+
309
+ refunds = SKIP unless hash.key?('refunds')
310
+
311
+ # Clean out expected properties from Hash.
312
+ names.each_value { |k| hash.delete(k) }
313
+
314
+ # Create object from extracted values.
315
+ DebitNote.new(uid,
316
+ site_id,
317
+ customer_id,
318
+ subscription_id,
319
+ number,
320
+ sequence_number,
321
+ origin_credit_note_uid,
322
+ origin_credit_note_number,
323
+ issue_date,
324
+ applied_date,
325
+ due_date,
326
+ status,
327
+ memo,
328
+ role,
329
+ currency,
330
+ seller,
331
+ customer,
332
+ billing_address,
333
+ shipping_address,
334
+ line_items,
335
+ discounts,
336
+ taxes,
337
+ refunds,
338
+ hash)
339
+ end
340
+
341
+ # Validates an instance of the object from a given value.
342
+ # @param [DebitNote | Hash] The value against the validation is performed.
343
+ def self.validate(value)
344
+ return true if value.instance_of? self
345
+
346
+ return false unless value.instance_of? Hash
347
+
348
+ true
349
+ end
350
+ end
351
+ 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
+ # The role of the debit note.
8
+ class DebitNoteRole
9
+ DEBIT_NOTE_ROLE = [
10
+ # TODO: Write general description for CHARGEBACK
11
+ CHARGEBACK = 'chargeback'.freeze,
12
+
13
+ # TODO: Write general description for REFUND
14
+ REFUND = 'refund'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ DEBIT_NOTE_ROLE.include?(value)
21
+ end
22
+ end
23
+ 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
+ # Current status of the debit note.
8
+ class DebitNoteStatus
9
+ DEBIT_NOTE_STATUS = [
10
+ # TODO: Write general description for OPEN
11
+ OPEN = 'open'.freeze,
12
+
13
+ # TODO: Write general description for APPLIED
14
+ APPLIED = 'applied'.freeze,
15
+
16
+ # TODO: Write general description for BANISHED
17
+ BANISHED = 'banished'.freeze,
18
+
19
+ # TODO: Write general description for PAID
20
+ PAID = 'paid'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ DEBIT_NOTE_STATUS.include?(value)
27
+ end
28
+ end
29
+ end
@@ -27,7 +27,9 @@ module AdvancedBilling
27
27
 
28
28
  # An array for optional fields
29
29
  def self.optionals
30
- []
30
+ %w[
31
+ memo
32
+ ]
31
33
  end
32
34
 
33
35
  # An array for nullable fields
@@ -36,10 +38,10 @@ module AdvancedBilling
36
38
  end
37
39
 
38
40
  def initialize(amount = nil,
39
- memo = nil,
41
+ memo = SKIP,
40
42
  additional_properties = {})
41
43
  @amount = amount
42
- @memo = memo
44
+ @memo = memo unless memo == SKIP
43
45
 
44
46
  # Add additional model properties to the instance.
45
47
  additional_properties.each do |_name, _value|
@@ -55,7 +57,7 @@ module AdvancedBilling
55
57
  amount = hash.key?('amount') ? APIHelper.deserialize_union_type(
56
58
  UnionTypeLookUp.get(:DeductServiceCreditAmount), hash['amount']
57
59
  ) : nil
58
- memo = hash.key?('memo') ? hash['memo'] : nil
60
+ memo = hash.key?('memo') ? hash['memo'] : SKIP
59
61
 
60
62
  # Clean out expected properties from Hash.
61
63
  names.each_value { |k| hash.delete(k) }
@@ -70,22 +72,14 @@ module AdvancedBilling
70
72
  # @param [DeductServiceCredit | Hash] The value against the validation is performed.
71
73
  def self.validate(value)
72
74
  if value.instance_of? self
73
- return (
74
- UnionTypeLookUp.get(:DeductServiceCreditAmount)
75
- .validate(value.amount) and
76
- APIHelper.valid_type?(value.memo,
77
- ->(val) { val.instance_of? String })
78
- )
75
+ return UnionTypeLookUp.get(:DeductServiceCreditAmount)
76
+ .validate(value.amount)
79
77
  end
80
78
 
81
79
  return false unless value.instance_of? Hash
82
80
 
83
- (
84
- UnionTypeLookUp.get(:DeductServiceCreditAmount)
85
- .validate(value['amount']) and
86
- APIHelper.valid_type?(value['memo'],
87
- ->(val) { val.instance_of? String })
88
- )
81
+ UnionTypeLookUp.get(:DeductServiceCreditAmount)
82
+ .validate(value['amount'])
89
83
  end
90
84
  end
91
85
  end
@@ -114,5 +114,43 @@ module AdvancedBilling
114
114
  def to_custom_last_attempted_at
115
115
  DateTimeHelper.to_rfc3339(last_attempted_at)
116
116
  end
117
+
118
+ # Validates an instance of the object from a given value.
119
+ # @param [DunnerData | Hash] The value against the validation is performed.
120
+ def self.validate(value)
121
+ if value.instance_of? self
122
+ return (
123
+ APIHelper.valid_type?(value.state,
124
+ ->(val) { val.instance_of? String }) and
125
+ APIHelper.valid_type?(value.subscription_id,
126
+ ->(val) { val.instance_of? Integer }) and
127
+ APIHelper.valid_type?(value.revenue_at_risk_in_cents,
128
+ ->(val) { val.instance_of? Integer }) and
129
+ APIHelper.valid_type?(value.created_at,
130
+ ->(val) { val.instance_of? DateTime }) and
131
+ APIHelper.valid_type?(value.attempts,
132
+ ->(val) { val.instance_of? Integer }) and
133
+ APIHelper.valid_type?(value.last_attempted_at,
134
+ ->(val) { val.instance_of? DateTime })
135
+ )
136
+ end
137
+
138
+ return false unless value.instance_of? Hash
139
+
140
+ (
141
+ APIHelper.valid_type?(value['state'],
142
+ ->(val) { val.instance_of? String }) and
143
+ APIHelper.valid_type?(value['subscription_id'],
144
+ ->(val) { val.instance_of? Integer }) and
145
+ APIHelper.valid_type?(value['revenue_at_risk_in_cents'],
146
+ ->(val) { val.instance_of? Integer }) and
147
+ APIHelper.valid_type?(value['created_at'],
148
+ ->(val) { val.instance_of? String }) and
149
+ APIHelper.valid_type?(value['attempts'],
150
+ ->(val) { val.instance_of? Integer }) and
151
+ APIHelper.valid_type?(value['last_attempted_at'],
152
+ ->(val) { val.instance_of? String })
153
+ )
154
+ end
117
155
  end
118
156
  end
@@ -126,5 +126,39 @@ module AdvancedBilling
126
126
  sms_body,
127
127
  hash)
128
128
  end
129
+
130
+ # Validates an instance of the object from a given value.
131
+ # @param [DunningStepData | Hash] The value against the validation is performed.
132
+ def self.validate(value)
133
+ if value.instance_of? self
134
+ return (
135
+ APIHelper.valid_type?(value.day_threshold,
136
+ ->(val) { val.instance_of? Integer }) and
137
+ APIHelper.valid_type?(value.action,
138
+ ->(val) { val.instance_of? String }) and
139
+ APIHelper.valid_type?(value.send_email,
140
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
141
+ APIHelper.valid_type?(value.send_bcc_email,
142
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
143
+ APIHelper.valid_type?(value.send_sms,
144
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass })
145
+ )
146
+ end
147
+
148
+ return false unless value.instance_of? Hash
149
+
150
+ (
151
+ APIHelper.valid_type?(value['day_threshold'],
152
+ ->(val) { val.instance_of? Integer }) and
153
+ APIHelper.valid_type?(value['action'],
154
+ ->(val) { val.instance_of? String }) and
155
+ APIHelper.valid_type?(value['send_email'],
156
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
157
+ APIHelper.valid_type?(value['send_bcc_email'],
158
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
159
+ APIHelper.valid_type?(value['send_sms'],
160
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass })
161
+ )
162
+ end
129
163
  end
130
164
  end
@@ -79,11 +79,14 @@ module AdvancedBilling
79
79
  if value.instance_of? self
80
80
  return (
81
81
  APIHelper.valid_type?(value.dunner,
82
- ->(val) { DunnerData.validate(val) }) and
82
+ ->(val) { DunnerData.validate(val) },
83
+ is_model_hash: true) and
83
84
  APIHelper.valid_type?(value.current_step,
84
- ->(val) { DunningStepData.validate(val) }) and
85
+ ->(val) { DunningStepData.validate(val) },
86
+ is_model_hash: true) and
85
87
  APIHelper.valid_type?(value.next_step,
86
- ->(val) { DunningStepData.validate(val) })
88
+ ->(val) { DunningStepData.validate(val) },
89
+ is_model_hash: true)
87
90
  )
88
91
  end
89
92
 
@@ -91,11 +94,14 @@ module AdvancedBilling
91
94
 
92
95
  (
93
96
  APIHelper.valid_type?(value['dunner'],
94
- ->(val) { DunnerData.validate(val) }) and
97
+ ->(val) { DunnerData.validate(val) },
98
+ is_model_hash: true) and
95
99
  APIHelper.valid_type?(value['current_step'],
96
- ->(val) { DunningStepData.validate(val) }) and
100
+ ->(val) { DunningStepData.validate(val) },
101
+ is_model_hash: true) and
97
102
  APIHelper.valid_type?(value['next_step'],
98
- ->(val) { DunningStepData.validate(val) })
103
+ ->(val) { DunningStepData.validate(val) },
104
+ is_model_hash: true)
99
105
  )
100
106
  end
101
107
  end