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
@@ -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
@@ -26,11 +26,15 @@ module AdvancedBilling
26
26
 
27
27
  # This attribute is particularly useful when you need to align billing
28
28
  # events for different components on distinct schedules within a
29
- # subscription. Please note this only works for site with Multifrequency
30
- # enabled
29
+ # subscription. This only works for site with Multifrequency enabled.
31
30
  # @return [BillingSchedule]
32
31
  attr_accessor :billing_schedule
33
32
 
33
+ # Create or update custom pricing unique to the subscription. Used in place
34
+ # of `price_point_id`.
35
+ # @return [ComponentCustomPrice]
36
+ attr_accessor :custom_price
37
+
34
38
  # A mapping from model property names to API property names.
35
39
  def self.names
36
40
  @_hash = {} if @_hash.nil?
@@ -38,6 +42,7 @@ module AdvancedBilling
38
42
  @_hash['price_point_id'] = 'price_point_id'
39
43
  @_hash['memo'] = 'memo'
40
44
  @_hash['billing_schedule'] = 'billing_schedule'
45
+ @_hash['custom_price'] = 'custom_price'
41
46
  @_hash
42
47
  end
43
48
 
@@ -48,6 +53,7 @@ module AdvancedBilling
48
53
  price_point_id
49
54
  memo
50
55
  billing_schedule
56
+ custom_price
51
57
  ]
52
58
  end
53
59
 
@@ -57,7 +63,8 @@ module AdvancedBilling
57
63
  end
58
64
 
59
65
  def initialize(quantity: SKIP, price_point_id: SKIP, memo: SKIP,
60
- billing_schedule: SKIP, additional_properties: {})
66
+ billing_schedule: SKIP, custom_price: SKIP,
67
+ additional_properties: {})
61
68
  # Add additional model properties to the instance.
62
69
  additional_properties.each do |_name, _value|
63
70
  instance_variable_set("@#{_name}", _value)
@@ -67,6 +74,7 @@ module AdvancedBilling
67
74
  @price_point_id = price_point_id unless price_point_id == SKIP
68
75
  @memo = memo unless memo == SKIP
69
76
  @billing_schedule = billing_schedule unless billing_schedule == SKIP
77
+ @custom_price = custom_price unless custom_price == SKIP
70
78
  end
71
79
 
72
80
  # Creates an instance of the object from a hash.
@@ -80,6 +88,7 @@ module AdvancedBilling
80
88
  memo = hash.key?('memo') ? hash['memo'] : SKIP
81
89
  billing_schedule = BillingSchedule.from_hash(hash['billing_schedule']) if
82
90
  hash['billing_schedule']
91
+ custom_price = ComponentCustomPrice.from_hash(hash['custom_price']) if hash['custom_price']
83
92
 
84
93
  # Clean out expected properties from Hash.
85
94
  additional_properties = hash.reject { |k, _| names.value?(k) }
@@ -89,6 +98,7 @@ module AdvancedBilling
89
98
  price_point_id: price_point_id,
90
99
  memo: memo,
91
100
  billing_schedule: billing_schedule,
101
+ custom_price: custom_price,
92
102
  additional_properties: additional_properties)
93
103
  end
94
104
 
@@ -96,16 +106,16 @@ module AdvancedBilling
96
106
  def to_s
97
107
  class_name = self.class.name.split('::').last
98
108
  "<#{class_name} quantity: #{@quantity}, price_point_id: #{@price_point_id}, memo: #{@memo},"\
99
- " billing_schedule: #{@billing_schedule}, additional_properties:"\
100
- " #{get_additional_properties}>"
109
+ " billing_schedule: #{@billing_schedule}, custom_price: #{@custom_price},"\
110
+ " additional_properties: #{get_additional_properties}>"
101
111
  end
102
112
 
103
113
  # Provides a debugging-friendly string with detailed object information.
104
114
  def inspect
105
115
  class_name = self.class.name.split('::').last
106
116
  "<#{class_name} quantity: #{@quantity.inspect}, price_point_id: #{@price_point_id.inspect},"\
107
- " memo: #{@memo.inspect}, billing_schedule: #{@billing_schedule.inspect},"\
108
- " additional_properties: #{get_additional_properties}>"
117
+ " memo: #{@memo.inspect}, billing_schedule: #{@billing_schedule.inspect}, custom_price:"\
118
+ " #{@custom_price.inspect}, additional_properties: #{get_additional_properties}>"
109
119
  end
110
120
  end
111
121
  end
@@ -113,5 +113,49 @@ module AdvancedBilling
113
113
 
114
114
  CREDIT_CARD_VAULT.include?(value)
115
115
  end
116
+
117
+ def self.from_value(value, default_value = ADYEN)
118
+ return default_value if value.nil?
119
+
120
+ str = value.to_s.strip
121
+
122
+ case str.downcase
123
+ when 'adyen' then ADYEN
124
+ when 'authorizenet' then AUTHORIZENET
125
+ when 'beanstream' then BEANSTREAM
126
+ when 'blue_snap' then BLUE_SNAP
127
+ when 'bogus' then BOGUS
128
+ when 'braintree1' then BRAINTREE1
129
+ when 'braintree_blue' then BRAINTREE_BLUE
130
+ when 'checkout' then CHECKOUT
131
+ when 'cybersource' then CYBERSOURCE
132
+ when 'elavon' then ELAVON
133
+ when 'eway' then EWAY
134
+ when 'eway_rapid' then EWAY_RAPID
135
+ when 'eway_rapid_std' then EWAY_RAPID_STD
136
+ when 'firstdata' then FIRSTDATA
137
+ when 'forte' then FORTE
138
+ when 'litle' then LITLE
139
+ when 'maxio_payments' then MAXIO_PAYMENTS
140
+ when 'maxp' then MAXP
141
+ when 'moduslink' then MODUSLINK
142
+ when 'moneris' then MONERIS
143
+ when 'nmi' then NMI
144
+ when 'orbital' then ORBITAL
145
+ when 'payment_express' then PAYMENT_EXPRESS
146
+ when 'paymill' then PAYMILL
147
+ when 'paypal' then PAYPAL
148
+ when 'paypal_complete' then PAYPAL_COMPLETE
149
+ when 'pin' then PIN
150
+ when 'square' then SQUARE
151
+ when 'stripe' then STRIPE
152
+ when 'stripe_connect' then STRIPE_CONNECT
153
+ when 'trust_commerce' then TRUST_COMMERCE
154
+ when 'unipaas' then UNIPAAS
155
+ when 'wirecard' then WIRECARD
156
+ else
157
+ default_value
158
+ end
159
+ end
116
160
  end
117
161
  end
@@ -19,5 +19,18 @@ module AdvancedBilling
19
19
 
20
20
  CREDIT_NOTE_STATUS.include?(value)
21
21
  end
22
+
23
+ def self.from_value(value, default_value = OPEN)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'open' then OPEN
30
+ when 'applied' then APPLIED
31
+ else
32
+ default_value
33
+ end
34
+ end
22
35
  end
23
36
  end
@@ -22,5 +22,19 @@ module AdvancedBilling
22
22
 
23
23
  CREDIT_SCHEME.include?(value)
24
24
  end
25
+
26
+ def self.from_value(value, default_value = NONE)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'none' then NONE
33
+ when 'credit' then CREDIT
34
+ when 'refund' then REFUND
35
+ else
36
+ default_value
37
+ end
38
+ end
25
39
  end
26
40
  end
@@ -24,5 +24,19 @@ module AdvancedBilling
24
24
 
25
25
  CREDIT_TYPE.include?(value)
26
26
  end
27
+
28
+ def self.from_value(value, default_value = FULL)
29
+ return default_value if value.nil?
30
+
31
+ str = value.to_s.strip
32
+
33
+ case str.downcase
34
+ when 'full' then FULL
35
+ when 'prorated' then PRORATED
36
+ when 'none' then NONE
37
+ else
38
+ default_value
39
+ end
40
+ end
27
41
  end
28
42
  end