maxio-advanced-billing-sdk 7.0.1 → 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 (165) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +94 -44
  3. data/bin/console +15 -0
  4. data/lib/advanced_billing/client.rb +11 -0
  5. data/lib/advanced_billing/configuration.rb +73 -0
  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 +2 -2
  10. data/lib/advanced_billing/controllers/components_controller.rb +5 -5
  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 +4 -4
  14. data/lib/advanced_billing/controllers/invoices_controller.rb +48 -11
  15. data/lib/advanced_billing/controllers/payment_profiles_controller.rb +70 -243
  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 +24 -33
  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 +86 -808
  28. data/lib/advanced_billing/http/auth/basic_auth.rb +12 -0
  29. data/lib/advanced_billing/http/proxy_settings.rb +9 -0
  30. data/lib/advanced_billing/models/activate_event_based_component.rb +1 -2
  31. data/lib/advanced_billing/models/all_vaults.rb +45 -0
  32. data/lib/advanced_billing/models/allocation_preview_direction.rb +13 -0
  33. data/lib/advanced_billing/models/allocation_preview_line_item_kind.rb +15 -0
  34. data/lib/advanced_billing/models/apple_pay_vault.rb +6 -0
  35. data/lib/advanced_billing/models/auto_invite.rb +19 -0
  36. data/lib/advanced_billing/models/bank_account_holder_type.rb +13 -0
  37. data/lib/advanced_billing/models/bank_account_type.rb +13 -0
  38. data/lib/advanced_billing/models/bank_account_vault.rb +19 -0
  39. data/lib/advanced_billing/models/basic_date_field.rb +13 -0
  40. data/lib/advanced_billing/models/billing_manifest_line_item_kind.rb +17 -0
  41. data/lib/advanced_billing/models/billing_schedule.rb +2 -2
  42. data/lib/advanced_billing/models/calendar_billing.rb +3 -1
  43. data/lib/advanced_billing/models/cancellation_method.rb +17 -0
  44. data/lib/advanced_billing/models/card_type.rb +47 -0
  45. data/lib/advanced_billing/models/chargeback_status.rb +15 -0
  46. data/lib/advanced_billing/models/chargify_ebb.rb +4 -4
  47. data/lib/advanced_billing/models/cleanup_scope.rb +13 -0
  48. data/lib/advanced_billing/models/collection_method.rb +15 -0
  49. data/lib/advanced_billing/models/component.rb +31 -31
  50. data/lib/advanced_billing/models/component_custom_price.rb +61 -3
  51. data/lib/advanced_billing/models/component_kind.rb +16 -0
  52. data/lib/advanced_billing/models/compounding_strategy.rb +13 -0
  53. data/lib/advanced_billing/models/create_allocation.rb +1 -2
  54. data/lib/advanced_billing/models/create_invoice_coupon.rb +16 -7
  55. data/lib/advanced_billing/models/create_invoice_item.rb +5 -5
  56. data/lib/advanced_billing/models/create_invoice_status.rb +13 -0
  57. data/lib/advanced_billing/models/create_metafield.rb +3 -5
  58. data/lib/advanced_billing/models/create_or_update_product.rb +12 -7
  59. data/lib/advanced_billing/models/create_payment_profile.rb +6 -6
  60. data/lib/advanced_billing/models/create_prepayment_method.rb +19 -0
  61. data/lib/advanced_billing/models/create_product_price_point.rb +8 -3
  62. data/lib/advanced_billing/models/create_signup_proforma_preview_include.rb +6 -0
  63. data/lib/advanced_billing/models/create_usage.rb +17 -7
  64. data/lib/advanced_billing/models/credit_card_vault.rb +44 -0
  65. data/lib/advanced_billing/models/credit_note_status.rb +13 -0
  66. data/lib/advanced_billing/models/credit_scheme.rb +14 -0
  67. data/lib/advanced_billing/models/credit_type.rb +14 -0
  68. data/lib/advanced_billing/models/currency_price_role.rb +14 -0
  69. data/lib/advanced_billing/models/custom_field_owner.rb +13 -0
  70. data/lib/advanced_billing/models/debit_note_role.rb +13 -0
  71. data/lib/advanced_billing/models/debit_note_status.rb +15 -0
  72. data/lib/advanced_billing/models/direction.rb +13 -0
  73. data/lib/advanced_billing/models/discount_type.rb +13 -0
  74. data/lib/advanced_billing/models/ebb_component.rb +2 -2
  75. data/lib/advanced_billing/models/event_key.rb +91 -0
  76. data/lib/advanced_billing/models/expiration_interval_unit.rb +14 -0
  77. data/lib/advanced_billing/models/failed_payment_action.rb +14 -0
  78. data/lib/advanced_billing/models/first_charge_type.rb +14 -0
  79. data/lib/advanced_billing/models/group_target_type.rb +16 -0
  80. data/lib/advanced_billing/models/group_type.rb +13 -0
  81. data/lib/advanced_billing/models/include_not_null.rb +6 -0
  82. data/lib/advanced_billing/models/include_null_or_not_null.rb +13 -0
  83. data/lib/advanced_billing/models/include_option.rb +13 -0
  84. data/lib/advanced_billing/models/interval_unit.rb +13 -0
  85. data/lib/advanced_billing/models/invoice_consolidation_level.rb +14 -0
  86. data/lib/advanced_billing/models/invoice_date_field.rb +16 -0
  87. data/lib/advanced_billing/models/invoice_discount_source_type.rb +14 -0
  88. data/lib/advanced_billing/models/invoice_discount_type.rb +14 -0
  89. data/lib/advanced_billing/models/invoice_event_payment_method.rb +16 -0
  90. data/lib/advanced_billing/models/invoice_event_type.rb +26 -0
  91. data/lib/advanced_billing/models/invoice_payment_method_type.rb +17 -0
  92. data/lib/advanced_billing/models/invoice_payment_type.rb +15 -0
  93. data/lib/advanced_billing/models/invoice_role.rb +21 -0
  94. data/lib/advanced_billing/models/invoice_sort_field.rb +19 -0
  95. data/lib/advanced_billing/models/invoice_status.rb +18 -0
  96. data/lib/advanced_billing/models/item_category.rb +16 -0
  97. data/lib/advanced_billing/models/line_item_kind.rb +21 -0
  98. data/lib/advanced_billing/models/line_item_transaction_type.rb +18 -0
  99. data/lib/advanced_billing/models/list_components_price_points_include.rb +6 -0
  100. data/lib/advanced_billing/models/list_coupons_filter.rb +22 -6
  101. data/lib/advanced_billing/models/list_events_date_field.rb +6 -0
  102. data/lib/advanced_billing/models/list_prepayment_date_field.rb +13 -0
  103. data/lib/advanced_billing/models/list_products_include.rb +6 -0
  104. data/lib/advanced_billing/models/list_products_price_points_include.rb +6 -0
  105. data/lib/advanced_billing/models/list_subscription_components_include.rb +13 -0
  106. data/lib/advanced_billing/models/list_subscription_components_sort.rb +13 -0
  107. data/lib/advanced_billing/models/metafield.rb +8 -11
  108. data/lib/advanced_billing/models/metafield_input.rb +18 -5
  109. data/lib/advanced_billing/models/metafield_scope.rb +9 -4
  110. data/lib/advanced_billing/models/metered_component.rb +2 -2
  111. data/lib/advanced_billing/models/nested_subscription_group.rb +10 -0
  112. data/lib/advanced_billing/models/on_off_component.rb +2 -2
  113. data/lib/advanced_billing/models/pay_pal_vault.rb +15 -0
  114. data/lib/advanced_billing/models/payment_profile_attributes.rb +3 -3
  115. data/lib/advanced_billing/models/payment_type.rb +15 -0
  116. data/lib/advanced_billing/models/prepaid_configuration.rb +10 -0
  117. data/lib/advanced_billing/models/prepaid_usage_component.rb +2 -2
  118. data/lib/advanced_billing/models/prepayment_method.rb +18 -0
  119. data/lib/advanced_billing/models/price_point_type.rb +14 -0
  120. data/lib/advanced_billing/models/pricing_scheme.rb +15 -0
  121. data/lib/advanced_billing/models/product.rb +18 -8
  122. data/lib/advanced_billing/models/product_family.rb +10 -0
  123. data/lib/advanced_billing/models/product_price_point.rb +8 -3
  124. data/lib/advanced_billing/models/proforma_invoice_discount_source_type.rb +13 -0
  125. data/lib/advanced_billing/models/proforma_invoice_role.rb +15 -0
  126. data/lib/advanced_billing/models/proforma_invoice_status.rb +14 -0
  127. data/lib/advanced_billing/models/proforma_invoice_tax_source_type.rb +13 -0
  128. data/lib/advanced_billing/models/public_signup_page.rb +10 -0
  129. data/lib/advanced_billing/models/quantity_based_component.rb +2 -2
  130. data/lib/advanced_billing/models/reactivation_charge.rb +14 -0
  131. data/lib/advanced_billing/models/recurring_scheme.rb +14 -0
  132. data/lib/advanced_billing/models/resource_type.rb +13 -0
  133. data/lib/advanced_billing/models/restriction_type.rb +13 -0
  134. data/lib/advanced_billing/models/resume_options.rb +1 -1
  135. data/lib/advanced_billing/models/resumption_charge.rb +14 -0
  136. data/lib/advanced_billing/models/service_credit_type.rb +13 -0
  137. data/lib/advanced_billing/models/snap_day.rb +7 -2
  138. data/lib/advanced_billing/models/sorting_direction.rb +13 -0
  139. data/lib/advanced_billing/models/subscription.rb +16 -3
  140. data/lib/advanced_billing/models/subscription_custom_price.rb +23 -7
  141. data/lib/advanced_billing/models/subscription_date_field.rb +20 -0
  142. data/lib/advanced_billing/models/subscription_group_include.rb +6 -0
  143. data/lib/advanced_billing/models/subscription_group_prepayment_method.rb +17 -0
  144. data/lib/advanced_billing/models/subscription_groups_list_include.rb +6 -0
  145. data/lib/advanced_billing/models/subscription_include.rb +13 -0
  146. data/lib/advanced_billing/models/subscription_included_coupon.rb +10 -0
  147. data/lib/advanced_billing/models/subscription_list_date_field.rb +6 -0
  148. data/lib/advanced_billing/models/subscription_list_include.rb +6 -0
  149. data/lib/advanced_billing/models/subscription_purge_type.rb +13 -0
  150. data/lib/advanced_billing/models/subscription_sort.rb +17 -0
  151. data/lib/advanced_billing/models/subscription_state.rb +26 -0
  152. data/lib/advanced_billing/models/subscription_state_filter.rb +23 -0
  153. data/lib/advanced_billing/models/tax_configuration_kind.rb +15 -0
  154. data/lib/advanced_billing/models/tax_destination_address.rb +15 -0
  155. data/lib/advanced_billing/models/trial_type.rb +41 -0
  156. data/lib/advanced_billing/models/update_component.rb +2 -2
  157. data/lib/advanced_billing/models/update_metafield.rb +4 -6
  158. data/lib/advanced_billing/models/update_payment_profile.rb +3 -3
  159. data/lib/advanced_billing/models/update_subscription.rb +1 -0
  160. data/lib/advanced_billing/models/webhook_order.rb +13 -0
  161. data/lib/advanced_billing/models/webhook_status.rb +15 -0
  162. data/lib/advanced_billing/models/webhook_subscription.rb +46 -0
  163. data/lib/advanced_billing/utilities/union_type_lookup.rb +18 -5
  164. data/lib/advanced_billing.rb +1 -0
  165. metadata +8 -6
@@ -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
 
@@ -25,5 +25,20 @@ module AdvancedBilling
25
25
 
26
26
  PAYMENT_TYPE.include?(value)
27
27
  end
28
+
29
+ def self.from_value(value, default_value = CREDIT_CARD)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'credit_card' then CREDIT_CARD
36
+ when 'bank_account' then BANK_ACCOUNT
37
+ when 'paypal_account' then PAYPAL_ACCOUNT
38
+ when 'apple_pay' then APPLE_PAY
39
+ else
40
+ default_value
41
+ end
42
+ end
28
43
  end
29
44
  end
@@ -110,6 +110,16 @@ module AdvancedBilling
110
110
  additional_properties: additional_properties)
111
111
  end
112
112
 
113
+ # Validates an instance of the object from a given value.
114
+ # @param [PrepaidConfiguration | Hash] The value against the validation is performed.
115
+ def self.validate(value)
116
+ return true if value.instance_of? self
117
+
118
+ return false unless value.instance_of? Hash
119
+
120
+ true
121
+ end
122
+
113
123
  # Provides a human-readable string representation of the object.
114
124
  def to_s
115
125
  class_name = self.class.name.split('::').last
@@ -78,8 +78,8 @@ module AdvancedBilling
78
78
  attr_accessor :unit_price
79
79
 
80
80
  # A string representing the tax code related to the component type. This is
81
- # especially important when using the Avalara service to tax based on
82
- # locale. This attribute has a max length of 10 characters.
81
+ # especially important when using AvaTax to tax based on locale. This
82
+ # attribute has a max length of 25 characters.
83
83
  # @return [String]
84
84
  attr_accessor :tax_code
85
85
 
@@ -34,5 +34,23 @@ module AdvancedBilling
34
34
 
35
35
  PREPAYMENT_METHOD.include?(value)
36
36
  end
37
+
38
+ def self.from_value(value, default_value = CHECK)
39
+ return default_value if value.nil?
40
+
41
+ str = value.to_s.strip
42
+
43
+ case str.downcase
44
+ when 'check' then CHECK
45
+ when 'cash' then CASH
46
+ when 'money_order' then MONEY_ORDER
47
+ when 'ach' then ACH
48
+ when 'paypal_account' then PAYPAL_ACCOUNT
49
+ when 'credit_card' then CREDIT_CARD
50
+ when 'other' then OTHER
51
+ else
52
+ default_value
53
+ end
54
+ end
37
55
  end
38
56
  end
@@ -26,5 +26,19 @@ module AdvancedBilling
26
26
 
27
27
  PRICE_POINT_TYPE.include?(value)
28
28
  end
29
+
30
+ def self.from_value(value, default_value = CATALOG)
31
+ return default_value if value.nil?
32
+
33
+ str = value.to_s.strip
34
+
35
+ case str.downcase
36
+ when 'catalog' then CATALOG
37
+ when 'default' then DEFAULT
38
+ when 'custom' then CUSTOM
39
+ else
40
+ default_value
41
+ end
42
+ end
29
43
  end
30
44
  end
@@ -27,5 +27,20 @@ module AdvancedBilling
27
27
 
28
28
  PRICING_SCHEME.include?(value)
29
29
  end
30
+
31
+ def self.from_value(value, default_value = STAIRSTEP)
32
+ return default_value if value.nil?
33
+
34
+ str = value.to_s.strip
35
+
36
+ case str.downcase
37
+ when 'stairstep' then STAIRSTEP
38
+ when 'volume' then VOLUME
39
+ when 'per_unit' then PER_UNIT
40
+ when 'tiered' then TIERED
41
+ else
42
+ default_value
43
+ end
44
+ end
30
45
  end
31
46
  end
@@ -31,8 +31,8 @@ module AdvancedBilling
31
31
  attr_accessor :accounting_code
32
32
 
33
33
  # Deprecated value that can be ignored unless you have legacy hosted pages.
34
- # For Public Signup Page users, please read this attribute from under the
35
- # signup page.
34
+ # For Public Signup Page users, read this attribute from under the signup
35
+ # page.
36
36
  # @return [TrueClass | FalseClass]
37
37
  attr_accessor :request_credit_card
38
38
 
@@ -167,20 +167,20 @@ module AdvancedBilling
167
167
  attr_accessor :require_shipping_address
168
168
 
169
169
  # A string representing the tax code related to the product type. This is
170
- # especially important when using the Avalara service to tax based on
171
- # locale. This attribute has a max length of 10 characters.
170
+ # especially important when using AvaTax to tax based on locale. This
171
+ # attribute has a max length of 25 characters.
172
172
  # @return [String]
173
173
  attr_accessor :tax_code
174
174
 
175
175
  # A string representing the tax code related to the product type. This is
176
- # especially important when using the Avalara service to tax based on
177
- # locale. This attribute has a max length of 10 characters.
176
+ # especially important when using AvaTax to tax based on locale. This
177
+ # attribute has a max length of 25 characters.
178
178
  # @return [Integer]
179
179
  attr_accessor :default_product_price_point_id
180
180
 
181
181
  # A string representing the tax code related to the product type. This is
182
- # especially important when using the Avalara service to tax based on
183
- # locale. This attribute has a max length of 10 characters.
182
+ # especially important when using AvaTax to tax based on locale. This
183
+ # attribute has a max length of 25 characters.
184
184
  # @return [TrueClass | FalseClass]
185
185
  attr_accessor :use_site_exchange_rate
186
186
 
@@ -523,6 +523,16 @@ module AdvancedBilling
523
523
  DateTimeHelper.to_rfc3339(archived_at)
524
524
  end
525
525
 
526
+ # Validates an instance of the object from a given value.
527
+ # @param [Product | Hash] The value against the validation is performed.
528
+ def self.validate(value)
529
+ return true if value.instance_of? self
530
+
531
+ return false unless value.instance_of? Hash
532
+
533
+ true
534
+ end
535
+
526
536
  # Provides a human-readable string representation of the object.
527
537
  def to_s
528
538
  class_name = self.class.name.split('::').last
@@ -133,6 +133,16 @@ module AdvancedBilling
133
133
  DateTimeHelper.to_rfc3339(updated_at)
134
134
  end
135
135
 
136
+ # Validates an instance of the object from a given value.
137
+ # @param [ProductFamily | Hash] The value against the validation is performed.
138
+ def self.validate(value)
139
+ return true if value.instance_of? self
140
+
141
+ return false unless value.instance_of? Hash
142
+
143
+ true
144
+ end
145
+
136
146
  # Provides a human-readable string representation of the object.
137
147
  def to_s
138
148
  class_name = self.class.name.split('::').last