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
@@ -22,5 +22,19 @@ module AdvancedBilling
22
22
 
23
23
  INVOICE_DISCOUNT_TYPE.include?(value)
24
24
  end
25
+
26
+ def self.from_value(value, default_value = PERCENTAGE)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'percentage' then PERCENTAGE
33
+ when 'flat_amount' then FLAT_AMOUNT
34
+ when 'rollover' then ROLLOVER
35
+ else
36
+ default_value
37
+ end
38
+ end
25
39
  end
26
40
  end
@@ -28,5 +28,21 @@ module AdvancedBilling
28
28
 
29
29
  INVOICE_EVENT_PAYMENT_METHOD.include?(value)
30
30
  end
31
+
32
+ def self.from_value(value, default_value = APPLE_PAY)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'apple_pay' then APPLE_PAY
39
+ when 'bank_account' then BANK_ACCOUNT
40
+ when 'credit_card' then CREDIT_CARD
41
+ when 'external' then EXTERNAL
42
+ when 'paypal_account' then PAYPAL_ACCOUNT
43
+ else
44
+ default_value
45
+ end
46
+ end
31
47
  end
32
48
  end
@@ -58,5 +58,31 @@ module AdvancedBilling
58
58
 
59
59
  INVOICE_EVENT_TYPE.include?(value)
60
60
  end
61
+
62
+ def self.from_value(value, default_value = ISSUE_INVOICE)
63
+ return default_value if value.nil?
64
+
65
+ str = value.to_s.strip
66
+
67
+ case str.downcase
68
+ when 'issue_invoice' then ISSUE_INVOICE
69
+ when 'apply_credit_note' then APPLY_CREDIT_NOTE
70
+ when 'create_credit_note' then CREATE_CREDIT_NOTE
71
+ when 'apply_payment' then APPLY_PAYMENT
72
+ when 'apply_debit_note' then APPLY_DEBIT_NOTE
73
+ when 'create_debit_note' then CREATE_DEBIT_NOTE
74
+ when 'refund_invoice' then REFUND_INVOICE
75
+ when 'void_invoice' then VOID_INVOICE
76
+ when 'void_remainder' then VOID_REMAINDER
77
+ when 'backport_invoice' then BACKPORT_INVOICE
78
+ when 'change_invoice_status' then CHANGE_INVOICE_STATUS
79
+ when 'change_invoice_collection_method' then CHANGE_INVOICE_COLLECTION_METHOD
80
+ when 'remove_payment' then REMOVE_PAYMENT
81
+ when 'failed_payment' then FAILED_PAYMENT
82
+ when 'change_chargeback_status' then CHANGE_CHARGEBACK_STATUS
83
+ else
84
+ default_value
85
+ end
86
+ end
61
87
  end
62
88
  end
@@ -31,5 +31,22 @@ module AdvancedBilling
31
31
 
32
32
  INVOICE_PAYMENT_METHOD_TYPE.include?(value)
33
33
  end
34
+
35
+ def self.from_value(value, default_value = CREDIT_CARD)
36
+ return default_value if value.nil?
37
+
38
+ str = value.to_s.strip
39
+
40
+ case str.downcase
41
+ when 'credit_card' then CREDIT_CARD
42
+ when 'check' then CHECK
43
+ when 'cash' then CASH
44
+ when 'money_order' then MONEY_ORDER
45
+ when 'ach' then ACH
46
+ when 'other' then OTHER
47
+ else
48
+ default_value
49
+ end
50
+ end
34
51
  end
35
52
  end
@@ -25,5 +25,20 @@ module AdvancedBilling
25
25
 
26
26
  INVOICE_PAYMENT_TYPE.include?(value)
27
27
  end
28
+
29
+ def self.from_value(value, default_value = EXTERNAL)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'external' then EXTERNAL
36
+ when 'prepayment' then PREPAYMENT
37
+ when 'service_credit' then SERVICE_CREDIT
38
+ when 'payment' then PAYMENT
39
+ else
40
+ default_value
41
+ end
42
+ end
28
43
  end
29
44
  end
@@ -43,5 +43,26 @@ module AdvancedBilling
43
43
 
44
44
  INVOICE_ROLE.include?(value)
45
45
  end
46
+
47
+ def self.from_value(value, default_value = UNSET)
48
+ return default_value if value.nil?
49
+
50
+ str = value.to_s.strip
51
+
52
+ case str.downcase
53
+ when 'unset' then UNSET
54
+ when 'signup' then SIGNUP
55
+ when 'renewal' then RENEWAL
56
+ when 'usage' then USAGE
57
+ when 'reactivation' then REACTIVATION
58
+ when 'proration' then PRORATION
59
+ when 'migration' then MIGRATION
60
+ when 'adhoc' then ADHOC
61
+ when 'backport' then BACKPORT
62
+ when 'backportbalancereconciliation' then BACKPORTBALANCERECONCILIATION
63
+ else
64
+ default_value
65
+ end
66
+ end
46
67
  end
47
68
  end
@@ -37,5 +37,24 @@ module AdvancedBilling
37
37
 
38
38
  INVOICE_SORT_FIELD.include?(value)
39
39
  end
40
+
41
+ def self.from_value(value, default_value = STATUS)
42
+ return default_value if value.nil?
43
+
44
+ str = value.to_s.strip
45
+
46
+ case str.downcase
47
+ when 'status' then STATUS
48
+ when 'total_amount' then TOTAL_AMOUNT
49
+ when 'due_amount' then DUE_AMOUNT
50
+ when 'created_at' then CREATED_AT
51
+ when 'updated_at' then UPDATED_AT
52
+ when 'issue_date' then ISSUE_DATE
53
+ when 'due_date' then DUE_DATE
54
+ when 'number' then NUMBER
55
+ else
56
+ default_value
57
+ end
58
+ end
40
59
  end
41
60
  end
@@ -36,5 +36,23 @@ module AdvancedBilling
36
36
 
37
37
  INVOICE_STATUS.include?(value)
38
38
  end
39
+
40
+ def self.from_value(value, default_value = DRAFT)
41
+ return default_value if value.nil?
42
+
43
+ str = value.to_s.strip
44
+
45
+ case str.downcase
46
+ when 'draft' then DRAFT
47
+ when 'open' then OPEN
48
+ when 'paid' then PAID
49
+ when 'pending' then PENDING
50
+ when 'voided' then VOIDED
51
+ when 'canceled' then CANCELED
52
+ when 'processing' then PROCESSING
53
+ else
54
+ default_value
55
+ end
56
+ end
39
57
  end
40
58
  end
@@ -29,5 +29,21 @@ module AdvancedBilling
29
29
 
30
30
  ITEM_CATEGORY.include?(value)
31
31
  end
32
+
33
+ def self.from_value(value, default_value = ENUM_BUSINESS_SOFTWARE)
34
+ return default_value if value.nil?
35
+
36
+ str = value.to_s.strip
37
+
38
+ case str.downcase
39
+ when 'enum_business_software' then ENUM_BUSINESS_SOFTWARE
40
+ when 'enum_consumer_software' then ENUM_CONSUMER_SOFTWARE
41
+ when 'enum_digital_services' then ENUM_DIGITAL_SERVICES
42
+ when 'enum_physical_goods' then ENUM_PHYSICAL_GOODS
43
+ when 'other' then OTHER
44
+ else
45
+ default_value
46
+ end
47
+ end
32
48
  end
33
49
  end
@@ -43,5 +43,26 @@ module AdvancedBilling
43
43
 
44
44
  LINE_ITEM_KIND.include?(value)
45
45
  end
46
+
47
+ def self.from_value(value, default_value = BASELINE)
48
+ return default_value if value.nil?
49
+
50
+ str = value.to_s.strip
51
+
52
+ case str.downcase
53
+ when 'baseline' then BASELINE
54
+ when 'initial' then INITIAL
55
+ when 'trial' then TRIAL
56
+ when 'quantity_based_component' then QUANTITY_BASED_COMPONENT
57
+ when 'prepaid_usage_component' then PREPAID_USAGE_COMPONENT
58
+ when 'on_off_component' then ON_OFF_COMPONENT
59
+ when 'metered_component' then METERED_COMPONENT
60
+ when 'event_based_component' then EVENT_BASED_COMPONENT
61
+ when 'coupon' then COUPON
62
+ when 'tax' then TAX
63
+ else
64
+ default_value
65
+ end
66
+ end
46
67
  end
47
68
  end
@@ -34,5 +34,23 @@ module AdvancedBilling
34
34
 
35
35
  LINE_ITEM_TRANSACTION_TYPE.include?(value)
36
36
  end
37
+
38
+ def self.from_value(value, default_value = CHARGE)
39
+ return default_value if value.nil?
40
+
41
+ str = value.to_s.strip
42
+
43
+ case str.downcase
44
+ when 'charge' then CHARGE
45
+ when 'credit' then CREDIT
46
+ when 'adjustment' then ADJUSTMENT
47
+ when 'payment' then PAYMENT
48
+ when 'refund' then REFUND
49
+ when 'info_transaction' then INFO_TRANSACTION
50
+ when 'payment_authorization' then PAYMENT_AUTHORIZATION
51
+ else
52
+ default_value
53
+ end
54
+ end
37
55
  end
38
56
  end
@@ -16,5 +16,11 @@ module AdvancedBilling
16
16
 
17
17
  LIST_COMPONENTS_PRICE_POINTS_INCLUDE.include?(value)
18
18
  end
19
+
20
+ def self.from_value(value, default_value = CURRENCY_PRICES)
21
+ return default_value if value.nil?
22
+
23
+ default_value
24
+ end
19
25
  end
20
26
  end
@@ -57,11 +57,20 @@ module AdvancedBilling
57
57
  # @return [Array[String]]
58
58
  attr_accessor :codes
59
59
 
60
- # Allows fetching coupons with matching use_site_exchange_rate based on
61
- # provided value. Use in query `filter[use_site_exchange_rate]=true`.
60
+ # If true, restricts the list to coupons whose pricing is recalculated from
61
+ # the site’s current exchange rates, so their currency_prices array contains
62
+ # on-the-fly conversions rather than stored price records. If false,
63
+ # restricts the list to coupons that have manually defined amounts for each
64
+ # currency, ensuring the response includes the saved currency_prices entries
65
+ # instead of exchange-rate-derived values. Use in query
66
+ # `filter[use_site_exchange_rate]=true`.
62
67
  # @return [TrueClass | FalseClass]
63
68
  attr_accessor :use_site_exchange_rate
64
69
 
70
+ # Controls returning archived coupons.
71
+ # @return [TrueClass | FalseClass]
72
+ attr_accessor :include_archived
73
+
65
74
  # A mapping from model property names to API property names.
66
75
  def self.names
67
76
  @_hash = {} if @_hash.nil?
@@ -73,6 +82,7 @@ module AdvancedBilling
73
82
  @_hash['ids'] = 'ids'
74
83
  @_hash['codes'] = 'codes'
75
84
  @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate'
85
+ @_hash['include_archived'] = 'include_archived'
76
86
  @_hash
77
87
  end
78
88
 
@@ -87,6 +97,7 @@ module AdvancedBilling
87
97
  ids
88
98
  codes
89
99
  use_site_exchange_rate
100
+ include_archived
90
101
  ]
91
102
  end
92
103
 
@@ -98,7 +109,7 @@ module AdvancedBilling
98
109
  def initialize(date_field: SKIP, start_date: SKIP, end_date: SKIP,
99
110
  start_datetime: SKIP, end_datetime: SKIP, ids: SKIP,
100
111
  codes: SKIP, use_site_exchange_rate: SKIP,
101
- additional_properties: {})
112
+ include_archived: SKIP, additional_properties: {})
102
113
  # Add additional model properties to the instance.
103
114
  additional_properties.each do |_name, _value|
104
115
  instance_variable_set("@#{_name}", _value)
@@ -112,6 +123,7 @@ module AdvancedBilling
112
123
  @ids = ids unless ids == SKIP
113
124
  @codes = codes unless codes == SKIP
114
125
  @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP
126
+ @include_archived = include_archived unless include_archived == SKIP
115
127
  end
116
128
 
117
129
  # Creates an instance of the object from a hash.
@@ -136,6 +148,8 @@ module AdvancedBilling
136
148
  codes = hash.key?('codes') ? hash['codes'] : SKIP
137
149
  use_site_exchange_rate =
138
150
  hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP
151
+ include_archived =
152
+ hash.key?('include_archived') ? hash['include_archived'] : SKIP
139
153
 
140
154
  # Clean out expected properties from Hash.
141
155
  additional_properties = hash.reject { |k, _| names.value?(k) }
@@ -149,6 +163,7 @@ module AdvancedBilling
149
163
  ids: ids,
150
164
  codes: codes,
151
165
  use_site_exchange_rate: use_site_exchange_rate,
166
+ include_archived: include_archived,
152
167
  additional_properties: additional_properties)
153
168
  end
154
169
 
@@ -166,7 +181,8 @@ module AdvancedBilling
166
181
  "<#{class_name} date_field: #{@date_field}, start_date: #{@start_date}, end_date:"\
167
182
  " #{@end_date}, start_datetime: #{@start_datetime}, end_datetime: #{@end_datetime}, ids:"\
168
183
  " #{@ids}, codes: #{@codes}, use_site_exchange_rate: #{@use_site_exchange_rate},"\
169
- " additional_properties: #{get_additional_properties}>"
184
+ " include_archived: #{@include_archived}, additional_properties:"\
185
+ " #{get_additional_properties}>"
170
186
  end
171
187
 
172
188
  # Provides a debugging-friendly string with detailed object information.
@@ -175,8 +191,8 @@ module AdvancedBilling
175
191
  "<#{class_name} date_field: #{@date_field.inspect}, start_date: #{@start_date.inspect},"\
176
192
  " end_date: #{@end_date.inspect}, start_datetime: #{@start_datetime.inspect}, end_datetime:"\
177
193
  " #{@end_datetime.inspect}, ids: #{@ids.inspect}, codes: #{@codes.inspect},"\
178
- " use_site_exchange_rate: #{@use_site_exchange_rate.inspect}, additional_properties:"\
179
- " #{get_additional_properties}>"
194
+ " use_site_exchange_rate: #{@use_site_exchange_rate.inspect}, include_archived:"\
195
+ " #{@include_archived.inspect}, additional_properties: #{get_additional_properties}>"
180
196
  end
181
197
  end
182
198
  end
@@ -16,5 +16,11 @@ module AdvancedBilling
16
16
 
17
17
  LIST_EVENTS_DATE_FIELD.include?(value)
18
18
  end
19
+
20
+ def self.from_value(value, default_value = CREATED_AT)
21
+ return default_value if value.nil?
22
+
23
+ default_value
24
+ end
19
25
  end
20
26
  end
@@ -19,5 +19,18 @@ module AdvancedBilling
19
19
 
20
20
  LIST_PREPAYMENT_DATE_FIELD.include?(value)
21
21
  end
22
+
23
+ def self.from_value(value, default_value = CREATED_AT)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'created_at' then CREATED_AT
30
+ when 'application_at' then APPLICATION_AT
31
+ else
32
+ default_value
33
+ end
34
+ end
22
35
  end
23
36
  end
@@ -16,5 +16,11 @@ module AdvancedBilling
16
16
 
17
17
  LIST_PRODUCTS_INCLUDE.include?(value)
18
18
  end
19
+
20
+ def self.from_value(value, default_value = PREPAID_PRODUCT_PRICE_POINT)
21
+ return default_value if value.nil?
22
+
23
+ default_value
24
+ end
19
25
  end
20
26
  end
@@ -16,5 +16,11 @@ module AdvancedBilling
16
16
 
17
17
  LIST_PRODUCTS_PRICE_POINTS_INCLUDE.include?(value)
18
18
  end
19
+
20
+ def self.from_value(value, default_value = CURRENCY_PRICES)
21
+ return default_value if value.nil?
22
+
23
+ default_value
24
+ end
19
25
  end
20
26
  end
@@ -19,5 +19,18 @@ module AdvancedBilling
19
19
 
20
20
  LIST_SUBSCRIPTION_COMPONENTS_INCLUDE.include?(value)
21
21
  end
22
+
23
+ def self.from_value(value, default_value = SUBSCRIPTION)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'subscription' then SUBSCRIPTION
30
+ when 'historic_usages' then HISTORIC_USAGES
31
+ else
32
+ default_value
33
+ end
34
+ end
22
35
  end
23
36
  end
@@ -19,5 +19,18 @@ module AdvancedBilling
19
19
 
20
20
  LIST_SUBSCRIPTION_COMPONENTS_SORT.include?(value)
21
21
  end
22
+
23
+ def self.from_value(value, default_value = ID)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'id' then ID
30
+ when 'updated_at' then UPDATED_AT
31
+ else
32
+ default_value
33
+ end
34
+ end
22
35
  end
23
36
  end
@@ -23,23 +23,20 @@ module AdvancedBilling
23
23
  # @return [MetafieldScope]
24
24
  attr_accessor :scope
25
25
 
26
- # the amount of subscriptions this metafield has been applied to in Chargify
26
+ # The amount of subscriptions this metafield has been applied to in Advanced
27
+ # Billing.
27
28
  # @return [Integer]
28
29
  attr_accessor :data_count
29
30
 
30
- # Indicates how data should be added to the metafield. For example, a text
31
- # type is just a string, so a given metafield of this type can have any
32
- # value attached. On the other hand, dropdown and radio have a set of
33
- # allowed values that can be input, and appear differently on a Public
34
- # Signup Page. Defaults to 'text'
31
+ # Indicates the type of metafield. A text metafield allows any string value.
32
+ # Dropdown and radio metafields have a set of values that can be selected.
33
+ # Defaults to 'text'.
35
34
  # @return [MetafieldInput]
36
35
  attr_accessor :input_type
37
36
 
38
- # Indicates how data should be added to the metafield. For example, a text
39
- # type is just a string, so a given metafield of this type can have any
40
- # value attached. On the other hand, dropdown and radio have a set of
41
- # allowed values that can be input, and appear differently on a Public
42
- # Signup Page. Defaults to 'text'
37
+ # Indicates the type of metafield. A text metafield allows any string value.
38
+ # Dropdown and radio metafields have a set of values that can be selected.
39
+ # Defaults to 'text'.
43
40
  # @return [Object]
44
41
  attr_accessor :enum
45
42
 
@@ -4,11 +4,9 @@
4
4
  # APIMATIC v3.0 ( https://www.apimatic.io ).
5
5
 
6
6
  module AdvancedBilling
7
- # Indicates how data should be added to the metafield. For example, a text
8
- # type is just a string, so a given metafield of this type can have any value
9
- # attached. On the other hand, dropdown and radio have a set of allowed values
10
- # that can be input, and appear differently on a Public Signup Page. Defaults
11
- # to 'text'
7
+ # Indicates the type of metafield. A text metafield allows any string value.
8
+ # Dropdown and radio metafields have a set of values that can be selected.
9
+ # Defaults to 'text'.
12
10
  class MetafieldInput
13
11
  METAFIELD_INPUT = [
14
12
  # TODO: Write general description for BALANCE_TRACKER
@@ -29,5 +27,20 @@ module AdvancedBilling
29
27
 
30
28
  METAFIELD_INPUT.include?(value)
31
29
  end
30
+
31
+ def self.from_value(value, default_value = BALANCE_TRACKER)
32
+ return default_value if value.nil?
33
+
34
+ str = value.to_s.strip
35
+
36
+ case str.downcase
37
+ when 'balance_tracker' then BALANCE_TRACKER
38
+ when 'text' then TEXT
39
+ when 'radio' then RADIO
40
+ when 'dropdown' then DROPDOWN
41
+ else
42
+ default_value
43
+ end
44
+ end
32
45
  end
33
46
  end
@@ -27,16 +27,21 @@ module AdvancedBilling
27
27
  # @return [IncludeOption]
28
28
  attr_accessor :portal
29
29
 
30
- # Include (1) or exclude (0) metafields from being viewable by your
31
- # ecosystem.
30
+ # Include (1) or exclude (0) metafields used in [Embeddable
31
+ # Components](page:development-tools/embeddable-components/overview) from
32
+ # being viewable by your ecosystem.
32
33
  # @return [IncludeOption]
33
34
  attr_accessor :public_show
34
35
 
35
- # Include (1) or exclude (0) metafields from being edited by your ecosystem.
36
+ # Include (1) or exclude (0) metafields used in [Embeddable
37
+ # Components](page:development-tools/embeddable-components/overview) from
38
+ # being editable by your ecosystem.
36
39
  # @return [IncludeOption]
37
40
  attr_accessor :public_edit
38
41
 
39
- # Include (1) or exclude (0) metafields from being edited by your ecosystem.
42
+ # Include (1) or exclude (0) metafields used in [Embeddable
43
+ # Components](page:development-tools/embeddable-components/overview) from
44
+ # being editable by your ecosystem.
40
45
  # @return [Array[String]]
41
46
  attr_accessor :hosted
42
47
 
@@ -68,8 +68,8 @@ module AdvancedBilling
68
68
  attr_accessor :unit_price
69
69
 
70
70
  # A string representing the tax code related to the component type. This is
71
- # especially important when using the Avalara service to tax based on
72
- # locale. This attribute has a max length of 10 characters.
71
+ # especially important when using AvaTax to tax based on locale. This
72
+ # attribute has a max length of 25 characters.
73
73
  # @return [String]
74
74
  attr_accessor :tax_code
75
75
 
@@ -88,6 +88,16 @@ module AdvancedBilling
88
88
  additional_properties: additional_properties)
89
89
  end
90
90
 
91
+ # Validates an instance of the object from a given value.
92
+ # @param [NestedSubscriptionGroup | Hash] The value against the validation is performed.
93
+ def self.validate(value)
94
+ return true if value.instance_of? self
95
+
96
+ return false unless value.instance_of? Hash
97
+
98
+ true
99
+ end
100
+
91
101
  # Provides a human-readable string representation of the object.
92
102
  def to_s
93
103
  class_name = self.class.name.split('::').last
@@ -55,8 +55,8 @@ module AdvancedBilling
55
55
  attr_accessor :unit_price
56
56
 
57
57
  # A string representing the tax code related to the component type. This is
58
- # especially important when using the Avalara service to tax based on
59
- # locale. This attribute has a max length of 10 characters.
58
+ # especially important when using AvaTax to tax based on locale. This
59
+ # attribute has a max length of 25 characters.
60
60
  # @return [String]
61
61
  attr_accessor :tax_code
62
62
 
@@ -25,5 +25,20 @@ module AdvancedBilling
25
25
 
26
26
  PAY_PAL_VAULT.include?(value)
27
27
  end
28
+
29
+ def self.from_value(value, default_value = BRAINTREE_BLUE)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'braintree_blue' then BRAINTREE_BLUE
36
+ when 'paypal' then PAYPAL
37
+ when 'moduslink' then MODUSLINK
38
+ when 'paypal_complete' then PAYPAL_COMPLETE
39
+ else
40
+ default_value
41
+ end
42
+ end
28
43
  end
29
44
  end
@@ -94,9 +94,9 @@ module AdvancedBilling
94
94
  # required in [ISO_3166-1
95
95
  # alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e.
96
96
  # “US”). This value is merely passed through to the payment gateway. Some
97
- # gateways require country codes in a specific format. Please check your
98
- # gateway’s documentation. If creating an ACH subscription, only US is
99
- # supported at this time.
97
+ # gateways require country codes in a specific format. Check your gateway’s
98
+ # documentation. If creating an ACH subscription, only US is supported at
99
+ # this time.
100
100
  # @return [String]
101
101
  attr_accessor :billing_country
102
102