maxio-advanced-billing-sdk 7.0.0 → 8.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 (166) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +101 -43
  3. data/bin/console +15 -0
  4. data/lib/advanced_billing/client.rb +14 -3
  5. data/lib/advanced_billing/configuration.rb +82 -5
  6. data/lib/advanced_billing/controllers/advance_invoice_controller.rb +2 -2
  7. data/lib/advanced_billing/controllers/base_controller.rb +1 -1
  8. data/lib/advanced_billing/controllers/billing_portal_controller.rb +2 -2
  9. data/lib/advanced_billing/controllers/component_price_points_controller.rb +3 -4
  10. data/lib/advanced_billing/controllers/components_controller.rb +7 -8
  11. data/lib/advanced_billing/controllers/coupons_controller.rb +5 -11
  12. data/lib/advanced_billing/controllers/custom_fields_controller.rb +102 -128
  13. data/lib/advanced_billing/controllers/customers_controller.rb +6 -6
  14. data/lib/advanced_billing/controllers/invoices_controller.rb +48 -11
  15. data/lib/advanced_billing/controllers/payment_profiles_controller.rb +76 -250
  16. data/lib/advanced_billing/controllers/product_families_controller.rb +7 -8
  17. data/lib/advanced_billing/controllers/product_price_points_controller.rb +15 -17
  18. data/lib/advanced_billing/controllers/products_controller.rb +7 -8
  19. data/lib/advanced_billing/controllers/proforma_invoices_controller.rb +1 -1
  20. data/lib/advanced_billing/controllers/sales_commissions_controller.rb +3 -3
  21. data/lib/advanced_billing/controllers/subscription_components_controller.rb +53 -44
  22. data/lib/advanced_billing/controllers/subscription_group_status_controller.rb +9 -9
  23. data/lib/advanced_billing/controllers/subscription_groups_controller.rb +10 -5
  24. data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +1 -1
  25. data/lib/advanced_billing/controllers/subscription_products_controller.rb +6 -7
  26. data/lib/advanced_billing/controllers/subscription_status_controller.rb +6 -7
  27. data/lib/advanced_billing/controllers/subscriptions_controller.rb +87 -810
  28. data/lib/advanced_billing/controllers/webhooks_controller.rb +23 -48
  29. data/lib/advanced_billing/http/auth/basic_auth.rb +12 -0
  30. data/lib/advanced_billing/http/proxy_settings.rb +22 -0
  31. data/lib/advanced_billing/models/activate_event_based_component.rb +1 -2
  32. data/lib/advanced_billing/models/all_vaults.rb +45 -0
  33. data/lib/advanced_billing/models/allocation_preview_direction.rb +13 -0
  34. data/lib/advanced_billing/models/allocation_preview_line_item_kind.rb +15 -0
  35. data/lib/advanced_billing/models/apple_pay_vault.rb +6 -0
  36. data/lib/advanced_billing/models/auto_invite.rb +19 -0
  37. data/lib/advanced_billing/models/bank_account_holder_type.rb +13 -0
  38. data/lib/advanced_billing/models/bank_account_type.rb +13 -0
  39. data/lib/advanced_billing/models/bank_account_vault.rb +19 -0
  40. data/lib/advanced_billing/models/basic_date_field.rb +13 -0
  41. data/lib/advanced_billing/models/billing_manifest_line_item_kind.rb +17 -0
  42. data/lib/advanced_billing/models/billing_schedule.rb +2 -2
  43. data/lib/advanced_billing/models/calendar_billing.rb +3 -1
  44. data/lib/advanced_billing/models/cancellation_method.rb +17 -0
  45. data/lib/advanced_billing/models/card_type.rb +47 -0
  46. data/lib/advanced_billing/models/chargeback_status.rb +15 -0
  47. data/lib/advanced_billing/models/chargify_ebb.rb +4 -4
  48. data/lib/advanced_billing/models/cleanup_scope.rb +13 -0
  49. data/lib/advanced_billing/models/collection_method.rb +15 -0
  50. data/lib/advanced_billing/models/component.rb +31 -31
  51. data/lib/advanced_billing/models/component_custom_price.rb +61 -3
  52. data/lib/advanced_billing/models/component_kind.rb +16 -0
  53. data/lib/advanced_billing/models/compounding_strategy.rb +13 -0
  54. data/lib/advanced_billing/models/create_allocation.rb +1 -2
  55. data/lib/advanced_billing/models/create_invoice_coupon.rb +16 -7
  56. data/lib/advanced_billing/models/create_invoice_item.rb +5 -5
  57. data/lib/advanced_billing/models/create_invoice_status.rb +13 -0
  58. data/lib/advanced_billing/models/create_metafield.rb +3 -5
  59. data/lib/advanced_billing/models/create_or_update_product.rb +12 -7
  60. data/lib/advanced_billing/models/create_payment_profile.rb +6 -6
  61. data/lib/advanced_billing/models/create_prepayment_method.rb +19 -0
  62. data/lib/advanced_billing/models/create_product_price_point.rb +8 -3
  63. data/lib/advanced_billing/models/create_signup_proforma_preview_include.rb +6 -0
  64. data/lib/advanced_billing/models/create_usage.rb +17 -7
  65. data/lib/advanced_billing/models/credit_card_vault.rb +44 -0
  66. data/lib/advanced_billing/models/credit_note_status.rb +13 -0
  67. data/lib/advanced_billing/models/credit_scheme.rb +14 -0
  68. data/lib/advanced_billing/models/credit_type.rb +14 -0
  69. data/lib/advanced_billing/models/currency_price_role.rb +14 -0
  70. data/lib/advanced_billing/models/custom_field_owner.rb +13 -0
  71. data/lib/advanced_billing/models/debit_note_role.rb +13 -0
  72. data/lib/advanced_billing/models/debit_note_status.rb +15 -0
  73. data/lib/advanced_billing/models/direction.rb +13 -0
  74. data/lib/advanced_billing/models/discount_type.rb +13 -0
  75. data/lib/advanced_billing/models/ebb_component.rb +2 -2
  76. data/lib/advanced_billing/models/event_key.rb +91 -0
  77. data/lib/advanced_billing/models/expiration_interval_unit.rb +14 -0
  78. data/lib/advanced_billing/models/failed_payment_action.rb +14 -0
  79. data/lib/advanced_billing/models/first_charge_type.rb +14 -0
  80. data/lib/advanced_billing/models/group_target_type.rb +16 -0
  81. data/lib/advanced_billing/models/group_type.rb +13 -0
  82. data/lib/advanced_billing/models/include_not_null.rb +6 -0
  83. data/lib/advanced_billing/models/include_null_or_not_null.rb +13 -0
  84. data/lib/advanced_billing/models/include_option.rb +13 -0
  85. data/lib/advanced_billing/models/interval_unit.rb +13 -0
  86. data/lib/advanced_billing/models/invoice_consolidation_level.rb +14 -0
  87. data/lib/advanced_billing/models/invoice_date_field.rb +16 -0
  88. data/lib/advanced_billing/models/invoice_discount_source_type.rb +14 -0
  89. data/lib/advanced_billing/models/invoice_discount_type.rb +14 -0
  90. data/lib/advanced_billing/models/invoice_event_payment_method.rb +16 -0
  91. data/lib/advanced_billing/models/invoice_event_type.rb +26 -0
  92. data/lib/advanced_billing/models/invoice_payment_method_type.rb +17 -0
  93. data/lib/advanced_billing/models/invoice_payment_type.rb +15 -0
  94. data/lib/advanced_billing/models/invoice_role.rb +21 -0
  95. data/lib/advanced_billing/models/invoice_sort_field.rb +19 -0
  96. data/lib/advanced_billing/models/invoice_status.rb +18 -0
  97. data/lib/advanced_billing/models/item_category.rb +16 -0
  98. data/lib/advanced_billing/models/line_item_kind.rb +21 -0
  99. data/lib/advanced_billing/models/line_item_transaction_type.rb +18 -0
  100. data/lib/advanced_billing/models/list_components_price_points_include.rb +6 -0
  101. data/lib/advanced_billing/models/list_coupons_filter.rb +22 -6
  102. data/lib/advanced_billing/models/list_events_date_field.rb +6 -0
  103. data/lib/advanced_billing/models/list_prepayment_date_field.rb +13 -0
  104. data/lib/advanced_billing/models/list_products_include.rb +6 -0
  105. data/lib/advanced_billing/models/list_products_price_points_include.rb +6 -0
  106. data/lib/advanced_billing/models/list_subscription_components_include.rb +13 -0
  107. data/lib/advanced_billing/models/list_subscription_components_sort.rb +13 -0
  108. data/lib/advanced_billing/models/metafield.rb +8 -11
  109. data/lib/advanced_billing/models/metafield_input.rb +18 -5
  110. data/lib/advanced_billing/models/metafield_scope.rb +9 -4
  111. data/lib/advanced_billing/models/metered_component.rb +2 -2
  112. data/lib/advanced_billing/models/nested_subscription_group.rb +10 -0
  113. data/lib/advanced_billing/models/on_off_component.rb +2 -2
  114. data/lib/advanced_billing/models/pay_pal_vault.rb +15 -0
  115. data/lib/advanced_billing/models/payment_profile_attributes.rb +3 -3
  116. data/lib/advanced_billing/models/payment_type.rb +15 -0
  117. data/lib/advanced_billing/models/prepaid_configuration.rb +10 -0
  118. data/lib/advanced_billing/models/prepaid_usage_component.rb +2 -2
  119. data/lib/advanced_billing/models/prepayment_method.rb +18 -0
  120. data/lib/advanced_billing/models/price_point_type.rb +14 -0
  121. data/lib/advanced_billing/models/pricing_scheme.rb +15 -0
  122. data/lib/advanced_billing/models/product.rb +18 -8
  123. data/lib/advanced_billing/models/product_family.rb +10 -0
  124. data/lib/advanced_billing/models/product_price_point.rb +8 -3
  125. data/lib/advanced_billing/models/proforma_invoice_discount_source_type.rb +13 -0
  126. data/lib/advanced_billing/models/proforma_invoice_role.rb +15 -0
  127. data/lib/advanced_billing/models/proforma_invoice_status.rb +14 -0
  128. data/lib/advanced_billing/models/proforma_invoice_tax_source_type.rb +13 -0
  129. data/lib/advanced_billing/models/public_signup_page.rb +10 -0
  130. data/lib/advanced_billing/models/quantity_based_component.rb +2 -2
  131. data/lib/advanced_billing/models/reactivation_charge.rb +14 -0
  132. data/lib/advanced_billing/models/recurring_scheme.rb +14 -0
  133. data/lib/advanced_billing/models/resource_type.rb +13 -0
  134. data/lib/advanced_billing/models/restriction_type.rb +13 -0
  135. data/lib/advanced_billing/models/resume_options.rb +1 -1
  136. data/lib/advanced_billing/models/resumption_charge.rb +14 -0
  137. data/lib/advanced_billing/models/service_credit_type.rb +13 -0
  138. data/lib/advanced_billing/models/snap_day.rb +7 -2
  139. data/lib/advanced_billing/models/sorting_direction.rb +13 -0
  140. data/lib/advanced_billing/models/subscription.rb +16 -3
  141. data/lib/advanced_billing/models/subscription_custom_price.rb +23 -7
  142. data/lib/advanced_billing/models/subscription_date_field.rb +20 -0
  143. data/lib/advanced_billing/models/subscription_group_include.rb +6 -0
  144. data/lib/advanced_billing/models/subscription_group_prepayment_method.rb +17 -0
  145. data/lib/advanced_billing/models/subscription_groups_list_include.rb +6 -0
  146. data/lib/advanced_billing/models/subscription_include.rb +13 -0
  147. data/lib/advanced_billing/models/subscription_included_coupon.rb +10 -0
  148. data/lib/advanced_billing/models/subscription_list_date_field.rb +6 -0
  149. data/lib/advanced_billing/models/subscription_list_include.rb +6 -0
  150. data/lib/advanced_billing/models/subscription_purge_type.rb +13 -0
  151. data/lib/advanced_billing/models/subscription_sort.rb +17 -0
  152. data/lib/advanced_billing/models/subscription_state.rb +26 -0
  153. data/lib/advanced_billing/models/subscription_state_filter.rb +23 -0
  154. data/lib/advanced_billing/models/tax_configuration_kind.rb +15 -0
  155. data/lib/advanced_billing/models/tax_destination_address.rb +15 -0
  156. data/lib/advanced_billing/models/trial_type.rb +41 -0
  157. data/lib/advanced_billing/models/update_component.rb +2 -2
  158. data/lib/advanced_billing/models/update_metafield.rb +4 -6
  159. data/lib/advanced_billing/models/update_payment_profile.rb +3 -3
  160. data/lib/advanced_billing/models/update_subscription.rb +1 -0
  161. data/lib/advanced_billing/models/webhook_order.rb +13 -0
  162. data/lib/advanced_billing/models/webhook_status.rb +15 -0
  163. data/lib/advanced_billing/models/webhook_subscription.rb +46 -0
  164. data/lib/advanced_billing/utilities/union_type_lookup.rb +32 -5
  165. data/lib/advanced_billing.rb +2 -0
  166. metadata +11 -8
@@ -62,10 +62,6 @@ module AdvancedBilling
62
62
  # @return [TrueClass | FalseClass]
63
63
  attr_accessor :archived
64
64
 
65
- # Boolean flag describing whether a component is taxable or not.
66
- # @return [TrueClass | FalseClass]
67
- attr_accessor :taxable
68
-
69
65
  # The description of the component.
70
66
  # @return [String]
71
67
  attr_accessor :description
@@ -98,15 +94,19 @@ module AdvancedBilling
98
94
  # @return [String]
99
95
  attr_accessor :default_price_point_name
100
96
 
97
+ # Boolean flag describing whether a component is taxable or not.
98
+ # @return [TrueClass | FalseClass]
99
+ attr_accessor :taxable
100
+
101
101
  # A string representing the tax code related to the component type. This is
102
- # especially important when using the Avalara service to tax based on
103
- # locale. This attribute has a max length of 10 characters.
102
+ # especially important when using AvaTax to tax based on locale. This
103
+ # attribute has a max length of 25 characters.
104
104
  # @return [String]
105
105
  attr_accessor :tax_code
106
106
 
107
107
  # A string representing the tax code related to the component type. This is
108
- # especially important when using the Avalara service to tax based on
109
- # locale. This attribute has a max length of 10 characters.
108
+ # especially important when using AvaTax to tax based on locale. This
109
+ # attribute has a max length of 25 characters.
110
110
  # @return [TrueClass | FalseClass]
111
111
  attr_accessor :recurring
112
112
 
@@ -193,7 +193,6 @@ module AdvancedBilling
193
193
  @_hash['price_per_unit_in_cents'] = 'price_per_unit_in_cents'
194
194
  @_hash['kind'] = 'kind'
195
195
  @_hash['archived'] = 'archived'
196
- @_hash['taxable'] = 'taxable'
197
196
  @_hash['description'] = 'description'
198
197
  @_hash['default_price_point_id'] = 'default_price_point_id'
199
198
  @_hash['overage_prices'] = 'overage_prices'
@@ -201,6 +200,7 @@ module AdvancedBilling
201
200
  @_hash['price_point_count'] = 'price_point_count'
202
201
  @_hash['price_points_url'] = 'price_points_url'
203
202
  @_hash['default_price_point_name'] = 'default_price_point_name'
203
+ @_hash['taxable'] = 'taxable'
204
204
  @_hash['tax_code'] = 'tax_code'
205
205
  @_hash['recurring'] = 'recurring'
206
206
  @_hash['upgrade_charge'] = 'upgrade_charge'
@@ -235,7 +235,6 @@ module AdvancedBilling
235
235
  price_per_unit_in_cents
236
236
  kind
237
237
  archived
238
- taxable
239
238
  description
240
239
  default_price_point_id
241
240
  overage_prices
@@ -243,6 +242,7 @@ module AdvancedBilling
243
242
  price_point_count
244
243
  price_points_url
245
244
  default_price_point_name
245
+ taxable
246
246
  tax_code
247
247
  recurring
248
248
  upgrade_charge
@@ -288,13 +288,13 @@ module AdvancedBilling
288
288
  unit_name: SKIP, unit_price: SKIP, product_family_id: SKIP,
289
289
  product_family_name: SKIP, product_family_handle: SKIP,
290
290
  price_per_unit_in_cents: SKIP, kind: SKIP, archived: SKIP,
291
- taxable: SKIP, description: SKIP,
292
- default_price_point_id: SKIP, overage_prices: SKIP,
293
- prices: SKIP, price_point_count: SKIP,
291
+ description: SKIP, default_price_point_id: SKIP,
292
+ overage_prices: SKIP, prices: SKIP, price_point_count: SKIP,
294
293
  price_points_url: SKIP, default_price_point_name: SKIP,
295
- tax_code: SKIP, recurring: SKIP, upgrade_charge: SKIP,
296
- downgrade_credit: SKIP, created_at: SKIP, updated_at: SKIP,
297
- archived_at: SKIP, hide_date_range_on_invoice: SKIP,
294
+ taxable: SKIP, tax_code: SKIP, recurring: SKIP,
295
+ upgrade_charge: SKIP, downgrade_credit: SKIP,
296
+ created_at: SKIP, updated_at: SKIP, archived_at: SKIP,
297
+ hide_date_range_on_invoice: SKIP,
298
298
  allow_fractional_quantities: SKIP, item_category: SKIP,
299
299
  use_site_exchange_rate: SKIP, accounting_code: SKIP,
300
300
  event_based_billing_metric_id: SKIP, interval: SKIP,
@@ -316,7 +316,6 @@ module AdvancedBilling
316
316
  @price_per_unit_in_cents = price_per_unit_in_cents unless price_per_unit_in_cents == SKIP
317
317
  @kind = kind unless kind == SKIP
318
318
  @archived = archived unless archived == SKIP
319
- @taxable = taxable unless taxable == SKIP
320
319
  @description = description unless description == SKIP
321
320
  @default_price_point_id = default_price_point_id unless default_price_point_id == SKIP
322
321
  @overage_prices = overage_prices unless overage_prices == SKIP
@@ -324,6 +323,7 @@ module AdvancedBilling
324
323
  @price_point_count = price_point_count unless price_point_count == SKIP
325
324
  @price_points_url = price_points_url unless price_points_url == SKIP
326
325
  @default_price_point_name = default_price_point_name unless default_price_point_name == SKIP
326
+ @taxable = taxable unless taxable == SKIP
327
327
  @tax_code = tax_code unless tax_code == SKIP
328
328
  @recurring = recurring unless recurring == SKIP
329
329
  @upgrade_charge = upgrade_charge unless upgrade_charge == SKIP
@@ -372,7 +372,6 @@ module AdvancedBilling
372
372
  hash.key?('price_per_unit_in_cents') ? hash['price_per_unit_in_cents'] : SKIP
373
373
  kind = hash.key?('kind') ? hash['kind'] : SKIP
374
374
  archived = hash.key?('archived') ? hash['archived'] : SKIP
375
- taxable = hash.key?('taxable') ? hash['taxable'] : SKIP
376
375
  description = hash.key?('description') ? hash['description'] : SKIP
377
376
  default_price_point_id =
378
377
  hash.key?('default_price_point_id') ? hash['default_price_point_id'] : SKIP
@@ -402,6 +401,7 @@ module AdvancedBilling
402
401
  hash.key?('price_points_url') ? hash['price_points_url'] : SKIP
403
402
  default_price_point_name =
404
403
  hash.key?('default_price_point_name') ? hash['default_price_point_name'] : SKIP
404
+ taxable = hash.key?('taxable') ? hash['taxable'] : SKIP
405
405
  tax_code = hash.key?('tax_code') ? hash['tax_code'] : SKIP
406
406
  recurring = hash.key?('recurring') ? hash['recurring'] : SKIP
407
407
  upgrade_charge =
@@ -453,7 +453,6 @@ module AdvancedBilling
453
453
  price_per_unit_in_cents: price_per_unit_in_cents,
454
454
  kind: kind,
455
455
  archived: archived,
456
- taxable: taxable,
457
456
  description: description,
458
457
  default_price_point_id: default_price_point_id,
459
458
  overage_prices: overage_prices,
@@ -461,6 +460,7 @@ module AdvancedBilling
461
460
  price_point_count: price_point_count,
462
461
  price_points_url: price_points_url,
463
462
  default_price_point_name: default_price_point_name,
463
+ taxable: taxable,
464
464
  tax_code: tax_code,
465
465
  recurring: recurring,
466
466
  upgrade_charge: upgrade_charge,
@@ -498,13 +498,13 @@ module AdvancedBilling
498
498
  " #{@pricing_scheme}, unit_name: #{@unit_name}, unit_price: #{@unit_price},"\
499
499
  " product_family_id: #{@product_family_id}, product_family_name: #{@product_family_name},"\
500
500
  " product_family_handle: #{@product_family_handle}, price_per_unit_in_cents:"\
501
- " #{@price_per_unit_in_cents}, kind: #{@kind}, archived: #{@archived}, taxable: #{@taxable},"\
502
- " description: #{@description}, default_price_point_id: #{@default_price_point_id},"\
503
- " overage_prices: #{@overage_prices}, prices: #{@prices}, price_point_count:"\
504
- " #{@price_point_count}, price_points_url: #{@price_points_url}, default_price_point_name:"\
505
- " #{@default_price_point_name}, tax_code: #{@tax_code}, recurring: #{@recurring},"\
506
- " upgrade_charge: #{@upgrade_charge}, downgrade_credit: #{@downgrade_credit}, created_at:"\
507
- " #{@created_at}, updated_at: #{@updated_at}, archived_at: #{@archived_at},"\
501
+ " #{@price_per_unit_in_cents}, kind: #{@kind}, archived: #{@archived}, description:"\
502
+ " #{@description}, default_price_point_id: #{@default_price_point_id}, overage_prices:"\
503
+ " #{@overage_prices}, prices: #{@prices}, price_point_count: #{@price_point_count},"\
504
+ " price_points_url: #{@price_points_url}, default_price_point_name:"\
505
+ " #{@default_price_point_name}, taxable: #{@taxable}, tax_code: #{@tax_code}, recurring:"\
506
+ " #{@recurring}, upgrade_charge: #{@upgrade_charge}, downgrade_credit: #{@downgrade_credit},"\
507
+ " created_at: #{@created_at}, updated_at: #{@updated_at}, archived_at: #{@archived_at},"\
508
508
  " hide_date_range_on_invoice: #{@hide_date_range_on_invoice}, allow_fractional_quantities:"\
509
509
  " #{@allow_fractional_quantities}, item_category: #{@item_category}, use_site_exchange_rate:"\
510
510
  " #{@use_site_exchange_rate}, accounting_code: #{@accounting_code},"\
@@ -521,11 +521,11 @@ module AdvancedBilling
521
521
  " product_family_name: #{@product_family_name.inspect}, product_family_handle:"\
522
522
  " #{@product_family_handle.inspect}, price_per_unit_in_cents:"\
523
523
  " #{@price_per_unit_in_cents.inspect}, kind: #{@kind.inspect}, archived:"\
524
- " #{@archived.inspect}, taxable: #{@taxable.inspect}, description: #{@description.inspect},"\
525
- " default_price_point_id: #{@default_price_point_id.inspect}, overage_prices:"\
526
- " #{@overage_prices.inspect}, prices: #{@prices.inspect}, price_point_count:"\
527
- " #{@price_point_count.inspect}, price_points_url: #{@price_points_url.inspect},"\
528
- " default_price_point_name: #{@default_price_point_name.inspect}, tax_code:"\
524
+ " #{@archived.inspect}, description: #{@description.inspect}, default_price_point_id:"\
525
+ " #{@default_price_point_id.inspect}, overage_prices: #{@overage_prices.inspect}, prices:"\
526
+ " #{@prices.inspect}, price_point_count: #{@price_point_count.inspect}, price_points_url:"\
527
+ " #{@price_points_url.inspect}, default_price_point_name:"\
528
+ " #{@default_price_point_name.inspect}, taxable: #{@taxable.inspect}, tax_code:"\
529
529
  " #{@tax_code.inspect}, recurring: #{@recurring.inspect}, upgrade_charge:"\
530
530
  " #{@upgrade_charge.inspect}, downgrade_credit: #{@downgrade_credit.inspect}, created_at:"\
531
531
  " #{@created_at.inspect}, updated_at: #{@updated_at.inspect}, archived_at:"\
@@ -35,6 +35,26 @@ module AdvancedBilling
35
35
  # @return [Array[Price]]
36
36
  attr_accessor :prices
37
37
 
38
+ # Applicable only to prepaid usage components. Controls whether the
39
+ # allocated quantity renews each period.
40
+ # @return [TrueClass | FalseClass]
41
+ attr_accessor :renew_prepaid_allocation
42
+
43
+ # Applicable only to prepaid usage components. Controls whether remaining
44
+ # units roll over to the next period.
45
+ # @return [TrueClass | FalseClass]
46
+ attr_accessor :rollover_prepaid_remainder
47
+
48
+ # Applicable only when rollover is enabled. Number of
49
+ # `expiration_interval_unit`s after which rollover amounts expire.
50
+ # @return [Integer]
51
+ attr_accessor :expiration_interval
52
+
53
+ # Applicable only when rollover is enabled. Interval unit for rollover
54
+ # expiration (month or day).
55
+ # @return [ExpirationIntervalUnit]
56
+ attr_accessor :expiration_interval_unit
57
+
38
58
  # A mapping from model property names to API property names.
39
59
  def self.names
40
60
  @_hash = {} if @_hash.nil?
@@ -43,6 +63,10 @@ module AdvancedBilling
43
63
  @_hash['interval'] = 'interval'
44
64
  @_hash['interval_unit'] = 'interval_unit'
45
65
  @_hash['prices'] = 'prices'
66
+ @_hash['renew_prepaid_allocation'] = 'renew_prepaid_allocation'
67
+ @_hash['rollover_prepaid_remainder'] = 'rollover_prepaid_remainder'
68
+ @_hash['expiration_interval'] = 'expiration_interval'
69
+ @_hash['expiration_interval_unit'] = 'expiration_interval_unit'
46
70
  @_hash
47
71
  end
48
72
 
@@ -53,6 +77,10 @@ module AdvancedBilling
53
77
  pricing_scheme
54
78
  interval
55
79
  interval_unit
80
+ renew_prepaid_allocation
81
+ rollover_prepaid_remainder
82
+ expiration_interval
83
+ expiration_interval_unit
56
84
  ]
57
85
  end
58
86
 
@@ -60,12 +88,16 @@ module AdvancedBilling
60
88
  def self.nullables
61
89
  %w[
62
90
  interval_unit
91
+ expiration_interval
92
+ expiration_interval_unit
63
93
  ]
64
94
  end
65
95
 
66
96
  def initialize(prices:, tax_included: SKIP, pricing_scheme: SKIP,
67
97
  interval: SKIP, interval_unit: SKIP,
68
- additional_properties: {})
98
+ renew_prepaid_allocation: SKIP,
99
+ rollover_prepaid_remainder: SKIP, expiration_interval: SKIP,
100
+ expiration_interval_unit: SKIP, additional_properties: {})
69
101
  # Add additional model properties to the instance.
70
102
  additional_properties.each do |_name, _value|
71
103
  instance_variable_set("@#{_name}", _value)
@@ -76,6 +108,13 @@ module AdvancedBilling
76
108
  @interval = interval unless interval == SKIP
77
109
  @interval_unit = interval_unit unless interval_unit == SKIP
78
110
  @prices = prices
111
+ @renew_prepaid_allocation = renew_prepaid_allocation unless renew_prepaid_allocation == SKIP
112
+ unless rollover_prepaid_remainder == SKIP
113
+ @rollover_prepaid_remainder =
114
+ rollover_prepaid_remainder
115
+ end
116
+ @expiration_interval = expiration_interval unless expiration_interval == SKIP
117
+ @expiration_interval_unit = expiration_interval_unit unless expiration_interval_unit == SKIP
79
118
  end
80
119
 
81
120
  # Creates an instance of the object from a hash.
@@ -98,6 +137,14 @@ module AdvancedBilling
98
137
  hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP
99
138
  interval = hash.key?('interval') ? hash['interval'] : SKIP
100
139
  interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : SKIP
140
+ renew_prepaid_allocation =
141
+ hash.key?('renew_prepaid_allocation') ? hash['renew_prepaid_allocation'] : SKIP
142
+ rollover_prepaid_remainder =
143
+ hash.key?('rollover_prepaid_remainder') ? hash['rollover_prepaid_remainder'] : SKIP
144
+ expiration_interval =
145
+ hash.key?('expiration_interval') ? hash['expiration_interval'] : SKIP
146
+ expiration_interval_unit =
147
+ hash.key?('expiration_interval_unit') ? hash['expiration_interval_unit'] : SKIP
101
148
 
102
149
  # Clean out expected properties from Hash.
103
150
  additional_properties = hash.reject { |k, _| names.value?(k) }
@@ -108,6 +155,10 @@ module AdvancedBilling
108
155
  pricing_scheme: pricing_scheme,
109
156
  interval: interval,
110
157
  interval_unit: interval_unit,
158
+ renew_prepaid_allocation: renew_prepaid_allocation,
159
+ rollover_prepaid_remainder: rollover_prepaid_remainder,
160
+ expiration_interval: expiration_interval,
161
+ expiration_interval_unit: expiration_interval_unit,
111
162
  additional_properties: additional_properties)
112
163
  end
113
164
 
@@ -134,7 +185,10 @@ module AdvancedBilling
134
185
  class_name = self.class.name.split('::').last
135
186
  "<#{class_name} tax_included: #{@tax_included}, pricing_scheme: #{@pricing_scheme},"\
136
187
  " interval: #{@interval}, interval_unit: #{@interval_unit}, prices: #{@prices},"\
137
- " additional_properties: #{get_additional_properties}>"
188
+ " renew_prepaid_allocation: #{@renew_prepaid_allocation}, rollover_prepaid_remainder:"\
189
+ " #{@rollover_prepaid_remainder}, expiration_interval: #{@expiration_interval},"\
190
+ " expiration_interval_unit: #{@expiration_interval_unit}, additional_properties:"\
191
+ " #{get_additional_properties}>"
138
192
  end
139
193
 
140
194
  # Provides a debugging-friendly string with detailed object information.
@@ -142,7 +196,11 @@ module AdvancedBilling
142
196
  class_name = self.class.name.split('::').last
143
197
  "<#{class_name} tax_included: #{@tax_included.inspect}, pricing_scheme:"\
144
198
  " #{@pricing_scheme.inspect}, interval: #{@interval.inspect}, interval_unit:"\
145
- " #{@interval_unit.inspect}, prices: #{@prices.inspect}, additional_properties:"\
199
+ " #{@interval_unit.inspect}, prices: #{@prices.inspect}, renew_prepaid_allocation:"\
200
+ " #{@renew_prepaid_allocation.inspect}, rollover_prepaid_remainder:"\
201
+ " #{@rollover_prepaid_remainder.inspect}, expiration_interval:"\
202
+ " #{@expiration_interval.inspect}, expiration_interval_unit:"\
203
+ " #{@expiration_interval_unit.inspect}, additional_properties:"\
146
204
  " #{get_additional_properties}>"
147
205
  end
148
206
  end
@@ -28,5 +28,21 @@ module AdvancedBilling
28
28
 
29
29
  COMPONENT_KIND.include?(value)
30
30
  end
31
+
32
+ def self.from_value(value, default_value = METERED_COMPONENT)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'metered_component' then METERED_COMPONENT
39
+ when 'quantity_based_component' then QUANTITY_BASED_COMPONENT
40
+ when 'on_off_component' then ON_OFF_COMPONENT
41
+ when 'prepaid_usage_component' then PREPAID_USAGE_COMPONENT
42
+ when 'event_based_component' then EVENT_BASED_COMPONENT
43
+ else
44
+ default_value
45
+ end
46
+ end
31
47
  end
32
48
  end
@@ -23,5 +23,18 @@ module AdvancedBilling
23
23
 
24
24
  COMPOUNDING_STRATEGY.include?(value)
25
25
  end
26
+
27
+ def self.from_value(value, default_value = COMPOUND)
28
+ return default_value if value.nil?
29
+
30
+ str = value.to_s.strip
31
+
32
+ case str.downcase
33
+ when 'compound' then COMPOUND
34
+ when 'fullprice' then FULLPRICE
35
+ else
36
+ default_value
37
+ end
38
+ end
26
39
  end
27
40
  end
@@ -68,8 +68,7 @@ module AdvancedBilling
68
68
 
69
69
  # This attribute is particularly useful when you need to align billing
70
70
  # events for different components on distinct schedules within a
71
- # subscription. Please note this only works for site with Multifrequency
72
- # enabled
71
+ # subscription. This only works for site with Multifrequency enabled.
73
72
  # @return [BillingSchedule]
74
73
  attr_accessor :billing_schedule
75
74
 
@@ -13,6 +13,10 @@ module AdvancedBilling
13
13
  # @return [String]
14
14
  attr_accessor :code
15
15
 
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :subcode
19
+
16
20
  # TODO: Write general description for this method
17
21
  # @return [Object]
18
22
  attr_accessor :percentage
@@ -41,6 +45,7 @@ module AdvancedBilling
41
45
  def self.names
42
46
  @_hash = {} if @_hash.nil?
43
47
  @_hash['code'] = 'code'
48
+ @_hash['subcode'] = 'subcode'
44
49
  @_hash['percentage'] = 'percentage'
45
50
  @_hash['amount'] = 'amount'
46
51
  @_hash['description'] = 'description'
@@ -53,6 +58,7 @@ module AdvancedBilling
53
58
  def self.optionals
54
59
  %w[
55
60
  code
61
+ subcode
56
62
  percentage
57
63
  amount
58
64
  description
@@ -66,7 +72,7 @@ module AdvancedBilling
66
72
  []
67
73
  end
68
74
 
69
- def initialize(code: SKIP, percentage: SKIP, amount: SKIP,
75
+ def initialize(code: SKIP, subcode: SKIP, percentage: SKIP, amount: SKIP,
70
76
  description: SKIP, product_family_id: SKIP,
71
77
  compounding_strategy: SKIP, additional_properties: {})
72
78
  # Add additional model properties to the instance.
@@ -75,6 +81,7 @@ module AdvancedBilling
75
81
  end
76
82
 
77
83
  @code = code unless code == SKIP
84
+ @subcode = subcode unless subcode == SKIP
78
85
  @percentage = percentage unless percentage == SKIP
79
86
  @amount = amount unless amount == SKIP
80
87
  @description = description unless description == SKIP
@@ -88,6 +95,7 @@ module AdvancedBilling
88
95
 
89
96
  # Extract variables from the hash.
90
97
  code = hash.key?('code') ? hash['code'] : SKIP
98
+ subcode = hash.key?('subcode') ? hash['subcode'] : SKIP
91
99
  percentage = hash.key?('percentage') ? APIHelper.deserialize_union_type(
92
100
  UnionTypeLookUp.get(:CreateInvoiceCouponPercentage), hash['percentage']
93
101
  ) : SKIP
@@ -106,6 +114,7 @@ module AdvancedBilling
106
114
 
107
115
  # Create object from extracted values.
108
116
  CreateInvoiceCoupon.new(code: code,
117
+ subcode: subcode,
109
118
  percentage: percentage,
110
119
  amount: amount,
111
120
  description: description,
@@ -127,8 +136,8 @@ module AdvancedBilling
127
136
  # Provides a human-readable string representation of the object.
128
137
  def to_s
129
138
  class_name = self.class.name.split('::').last
130
- "<#{class_name} code: #{@code}, percentage: #{@percentage}, amount: #{@amount},"\
131
- " description: #{@description}, product_family_id: #{@product_family_id},"\
139
+ "<#{class_name} code: #{@code}, subcode: #{@subcode}, percentage: #{@percentage}, amount:"\
140
+ " #{@amount}, description: #{@description}, product_family_id: #{@product_family_id},"\
132
141
  " compounding_strategy: #{@compounding_strategy}, additional_properties:"\
133
142
  " #{get_additional_properties}>"
134
143
  end
@@ -136,10 +145,10 @@ module AdvancedBilling
136
145
  # Provides a debugging-friendly string with detailed object information.
137
146
  def inspect
138
147
  class_name = self.class.name.split('::').last
139
- "<#{class_name} code: #{@code.inspect}, percentage: #{@percentage.inspect}, amount:"\
140
- " #{@amount.inspect}, description: #{@description.inspect}, product_family_id:"\
141
- " #{@product_family_id.inspect}, compounding_strategy: #{@compounding_strategy.inspect},"\
142
- " additional_properties: #{get_additional_properties}>"
148
+ "<#{class_name} code: #{@code.inspect}, subcode: #{@subcode.inspect}, percentage:"\
149
+ " #{@percentage.inspect}, amount: #{@amount.inspect}, description: #{@description.inspect},"\
150
+ " product_family_id: #{@product_family_id.inspect}, compounding_strategy:"\
151
+ " #{@compounding_strategy.inspect}, additional_properties: #{get_additional_properties}>"
143
152
  end
144
153
  end
145
154
  end
@@ -26,14 +26,14 @@ module AdvancedBilling
26
26
  attr_accessor :unit_price
27
27
 
28
28
  # Set to true to automatically calculate taxes. Site must be configured to
29
- # use and calculate taxes.
30
- # If using Avalara, a tax_code parameter must also be sent.
29
+ # use and calculate taxes. If using AvaTax, a tax_code parameter must also
30
+ # be sent.
31
31
  # @return [TrueClass | FalseClass]
32
32
  attr_accessor :taxable
33
33
 
34
- # Set to true to automatically calculate taxes. Site must be configured to
35
- # use and calculate taxes.
36
- # If using Avalara, a tax_code parameter must also be sent.
34
+ # A string representing the tax code related to the product type. This is
35
+ # especially important when using AvaTax to tax based on locale. This
36
+ # attribute has a max length of 25 characters.
37
37
  # @return [String]
38
38
  attr_accessor :tax_code
39
39
 
@@ -19,5 +19,18 @@ module AdvancedBilling
19
19
 
20
20
  CREATE_INVOICE_STATUS.include?(value)
21
21
  end
22
+
23
+ def self.from_value(value, default_value = DRAFT)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'draft' then DRAFT
30
+ when 'open' then OPEN
31
+ else
32
+ default_value
33
+ end
34
+ end
22
35
  end
23
36
  end
@@ -19,11 +19,9 @@ module AdvancedBilling
19
19
  # @return [MetafieldScope]
20
20
  attr_accessor :scope
21
21
 
22
- # Indicates how data should be added to the metafield. For example, a text
23
- # type is just a string, so a given metafield of this type can have any
24
- # value attached. On the other hand, dropdown and radio have a set of
25
- # allowed values that can be input, and appear differently on a Public
26
- # Signup Page. Defaults to 'text'
22
+ # Indicates the type of metafield. A text metafield allows any string value.
23
+ # Dropdown and radio metafields have a set of values that can be selected.
24
+ # Defaults to 'text'.
27
25
  # @return [MetafieldInput]
28
26
  attr_accessor :input_type
29
27
 
@@ -26,8 +26,8 @@ module AdvancedBilling
26
26
  attr_accessor :accounting_code
27
27
 
28
28
  # Deprecated value that can be ignored unless you have legacy hosted pages.
29
- # For Public Signup Page users, please read this attribute from under the
30
- # signup page.
29
+ # For Public Signup Page users, read this attribute from under the signup
30
+ # page.
31
31
  # @return [TrueClass | FalseClass]
32
32
  attr_accessor :require_credit_card
33
33
 
@@ -60,9 +60,13 @@ module AdvancedBilling
60
60
  # @return [IntervalUnit]
61
61
  attr_accessor :trial_interval_unit
62
62
 
63
- # A string representing the trial interval unit for this product, either
64
- # month or day
65
- # @return [String]
63
+ # Indicates how a trial is handled when the trail period ends and there is
64
+ # no credit card on file. For `no_obligation`, the subscription transitions
65
+ # to a Trial Ended state. Maxio will not send any emails or statements. For
66
+ # `payment_expected`, the subscription transitions to a Past Due state.
67
+ # Maxio will send normal dunning emails and statements according to your
68
+ # other settings.
69
+ # @return [TrialType]
66
70
  attr_accessor :trial_type
67
71
 
68
72
  # The numerical expiration interval. i.e. an expiration_interval of ‘30’
@@ -82,8 +86,8 @@ module AdvancedBilling
82
86
  attr_accessor :auto_create_signup_page
83
87
 
84
88
  # A string representing the tax code related to the product type. This is
85
- # especially important when using the Avalara service to tax based on
86
- # locale. This attribute has a max length of 10 characters.
89
+ # especially important when using AvaTax to tax based on locale. This
90
+ # attribute has a max length of 25 characters.
87
91
  # @return [String]
88
92
  attr_accessor :tax_code
89
93
 
@@ -130,6 +134,7 @@ module AdvancedBilling
130
134
  def self.nullables
131
135
  %w[
132
136
  trial_interval_unit
137
+ trial_type
133
138
  expiration_interval_unit
134
139
  ]
135
140
  end
@@ -9,15 +9,15 @@ module AdvancedBilling
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
11
 
12
- # Token received after sending billing informations using chargify.js.
12
+ # Token received after sending billing information using chargify.js.
13
13
  # @return [String]
14
14
  attr_accessor :chargify_token
15
15
 
16
- # Token received after sending billing informations using chargify.js.
16
+ # Token received after sending billing information using chargify.js.
17
17
  # @return [Integer]
18
18
  attr_accessor :id
19
19
 
20
- # Token received after sending billing informations using chargify.js.
20
+ # Token received after sending billing information using chargify.js.
21
21
  # @return [PaymentType]
22
22
  attr_accessor :payment_type
23
23
 
@@ -81,9 +81,9 @@ module AdvancedBilling
81
81
  # The credit card or bank account billing address country, required in
82
82
  # [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
83
83
  # format (i.e. “US”). This value is merely passed through to the payment
84
- # gateway. Some gateways require country codes in a specific format. Please
85
- # check your gateway’s documentation. If creating an ACH subscription, only
86
- # US is supported at this time.
84
+ # gateway. Some gateways require country codes in a specific format. Check
85
+ # your gateway’s documentation. If creating an ACH subscription, only US is
86
+ # supported at this time.
87
87
  # @return [String]
88
88
  attr_accessor :billing_country
89
89
 
@@ -40,5 +40,24 @@ module AdvancedBilling
40
40
 
41
41
  CREATE_PREPAYMENT_METHOD.include?(value)
42
42
  end
43
+
44
+ def self.from_value(value, default_value = CHECK)
45
+ return default_value if value.nil?
46
+
47
+ str = value.to_s.strip
48
+
49
+ case str.downcase
50
+ when 'check' then CHECK
51
+ when 'cash' then CASH
52
+ when 'money_order' then MONEY_ORDER
53
+ when 'ach' then ACH
54
+ when 'paypal_account' then PAYPAL_ACCOUNT
55
+ when 'credit_card' then CREDIT_CARD
56
+ when 'credit_card_on_file' then CREDIT_CARD_ON_FILE
57
+ when 'other' then OTHER
58
+ else
59
+ default_value
60
+ end
61
+ end
43
62
  end
44
63
  end
@@ -47,9 +47,13 @@ module AdvancedBilling
47
47
  # @return [IntervalUnit]
48
48
  attr_accessor :trial_interval_unit
49
49
 
50
- # A string representing the trial interval unit for this product price
51
- # point, either month or day
52
- # @return [String]
50
+ # Indicates how a trial is handled when the trail period ends and there is
51
+ # no credit card on file. For `no_obligation`, the subscription transitions
52
+ # to a Trial Ended state. Maxio will not send any emails or statements. For
53
+ # `payment_expected`, the subscription transitions to a Past Due state.
54
+ # Maxio will send normal dunning emails and statements according to your
55
+ # other settings.
56
+ # @return [TrialType]
53
57
  attr_accessor :trial_type
54
58
 
55
59
  # The product price point initial charge, in integer cents
@@ -115,6 +119,7 @@ module AdvancedBilling
115
119
  # An array for nullable fields
116
120
  def self.nullables
117
121
  %w[
122
+ trial_type
118
123
  expiration_interval_unit
119
124
  ]
120
125
  end
@@ -16,5 +16,11 @@ module AdvancedBilling
16
16
 
17
17
  CREATE_SIGNUP_PROFORMA_PREVIEW_INCLUDE.include?(value)
18
18
  end
19
+
20
+ def self.from_value(value, default_value = NEXT_PROFORMA_INVOICE)
21
+ return default_value if value.nil?
22
+
23
+ default_value
24
+ end
19
25
  end
20
26
  end