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.
- checksums.yaml +4 -4
- data/README.md +101 -43
- data/bin/console +15 -0
- data/lib/advanced_billing/client.rb +14 -3
- data/lib/advanced_billing/configuration.rb +82 -5
- data/lib/advanced_billing/controllers/advance_invoice_controller.rb +2 -2
- data/lib/advanced_billing/controllers/base_controller.rb +1 -1
- data/lib/advanced_billing/controllers/billing_portal_controller.rb +2 -2
- data/lib/advanced_billing/controllers/component_price_points_controller.rb +3 -4
- data/lib/advanced_billing/controllers/components_controller.rb +7 -8
- data/lib/advanced_billing/controllers/coupons_controller.rb +5 -11
- data/lib/advanced_billing/controllers/custom_fields_controller.rb +102 -128
- data/lib/advanced_billing/controllers/customers_controller.rb +6 -6
- data/lib/advanced_billing/controllers/invoices_controller.rb +48 -11
- data/lib/advanced_billing/controllers/payment_profiles_controller.rb +76 -250
- data/lib/advanced_billing/controllers/product_families_controller.rb +7 -8
- data/lib/advanced_billing/controllers/product_price_points_controller.rb +15 -17
- data/lib/advanced_billing/controllers/products_controller.rb +7 -8
- data/lib/advanced_billing/controllers/proforma_invoices_controller.rb +1 -1
- data/lib/advanced_billing/controllers/sales_commissions_controller.rb +3 -3
- data/lib/advanced_billing/controllers/subscription_components_controller.rb +53 -44
- data/lib/advanced_billing/controllers/subscription_group_status_controller.rb +9 -9
- data/lib/advanced_billing/controllers/subscription_groups_controller.rb +10 -5
- data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +1 -1
- data/lib/advanced_billing/controllers/subscription_products_controller.rb +6 -7
- data/lib/advanced_billing/controllers/subscription_status_controller.rb +6 -7
- data/lib/advanced_billing/controllers/subscriptions_controller.rb +87 -810
- data/lib/advanced_billing/controllers/webhooks_controller.rb +23 -48
- data/lib/advanced_billing/http/auth/basic_auth.rb +12 -0
- data/lib/advanced_billing/http/proxy_settings.rb +22 -0
- data/lib/advanced_billing/models/activate_event_based_component.rb +1 -2
- data/lib/advanced_billing/models/all_vaults.rb +45 -0
- data/lib/advanced_billing/models/allocation_preview_direction.rb +13 -0
- data/lib/advanced_billing/models/allocation_preview_line_item_kind.rb +15 -0
- data/lib/advanced_billing/models/apple_pay_vault.rb +6 -0
- data/lib/advanced_billing/models/auto_invite.rb +19 -0
- data/lib/advanced_billing/models/bank_account_holder_type.rb +13 -0
- data/lib/advanced_billing/models/bank_account_type.rb +13 -0
- data/lib/advanced_billing/models/bank_account_vault.rb +19 -0
- data/lib/advanced_billing/models/basic_date_field.rb +13 -0
- data/lib/advanced_billing/models/billing_manifest_line_item_kind.rb +17 -0
- data/lib/advanced_billing/models/billing_schedule.rb +2 -2
- data/lib/advanced_billing/models/calendar_billing.rb +3 -1
- data/lib/advanced_billing/models/cancellation_method.rb +17 -0
- data/lib/advanced_billing/models/card_type.rb +47 -0
- data/lib/advanced_billing/models/chargeback_status.rb +15 -0
- data/lib/advanced_billing/models/chargify_ebb.rb +4 -4
- data/lib/advanced_billing/models/cleanup_scope.rb +13 -0
- data/lib/advanced_billing/models/collection_method.rb +15 -0
- data/lib/advanced_billing/models/component.rb +31 -31
- data/lib/advanced_billing/models/component_custom_price.rb +61 -3
- data/lib/advanced_billing/models/component_kind.rb +16 -0
- data/lib/advanced_billing/models/compounding_strategy.rb +13 -0
- data/lib/advanced_billing/models/create_allocation.rb +1 -2
- data/lib/advanced_billing/models/create_invoice_coupon.rb +16 -7
- data/lib/advanced_billing/models/create_invoice_item.rb +5 -5
- data/lib/advanced_billing/models/create_invoice_status.rb +13 -0
- data/lib/advanced_billing/models/create_metafield.rb +3 -5
- data/lib/advanced_billing/models/create_or_update_product.rb +12 -7
- data/lib/advanced_billing/models/create_payment_profile.rb +6 -6
- data/lib/advanced_billing/models/create_prepayment_method.rb +19 -0
- data/lib/advanced_billing/models/create_product_price_point.rb +8 -3
- data/lib/advanced_billing/models/create_signup_proforma_preview_include.rb +6 -0
- data/lib/advanced_billing/models/create_usage.rb +17 -7
- data/lib/advanced_billing/models/credit_card_vault.rb +44 -0
- data/lib/advanced_billing/models/credit_note_status.rb +13 -0
- data/lib/advanced_billing/models/credit_scheme.rb +14 -0
- data/lib/advanced_billing/models/credit_type.rb +14 -0
- data/lib/advanced_billing/models/currency_price_role.rb +14 -0
- data/lib/advanced_billing/models/custom_field_owner.rb +13 -0
- data/lib/advanced_billing/models/debit_note_role.rb +13 -0
- data/lib/advanced_billing/models/debit_note_status.rb +15 -0
- data/lib/advanced_billing/models/direction.rb +13 -0
- data/lib/advanced_billing/models/discount_type.rb +13 -0
- data/lib/advanced_billing/models/ebb_component.rb +2 -2
- data/lib/advanced_billing/models/event_key.rb +91 -0
- data/lib/advanced_billing/models/expiration_interval_unit.rb +14 -0
- data/lib/advanced_billing/models/failed_payment_action.rb +14 -0
- data/lib/advanced_billing/models/first_charge_type.rb +14 -0
- data/lib/advanced_billing/models/group_target_type.rb +16 -0
- data/lib/advanced_billing/models/group_type.rb +13 -0
- data/lib/advanced_billing/models/include_not_null.rb +6 -0
- data/lib/advanced_billing/models/include_null_or_not_null.rb +13 -0
- data/lib/advanced_billing/models/include_option.rb +13 -0
- data/lib/advanced_billing/models/interval_unit.rb +13 -0
- data/lib/advanced_billing/models/invoice_consolidation_level.rb +14 -0
- data/lib/advanced_billing/models/invoice_date_field.rb +16 -0
- data/lib/advanced_billing/models/invoice_discount_source_type.rb +14 -0
- data/lib/advanced_billing/models/invoice_discount_type.rb +14 -0
- data/lib/advanced_billing/models/invoice_event_payment_method.rb +16 -0
- data/lib/advanced_billing/models/invoice_event_type.rb +26 -0
- data/lib/advanced_billing/models/invoice_payment_method_type.rb +17 -0
- data/lib/advanced_billing/models/invoice_payment_type.rb +15 -0
- data/lib/advanced_billing/models/invoice_role.rb +21 -0
- data/lib/advanced_billing/models/invoice_sort_field.rb +19 -0
- data/lib/advanced_billing/models/invoice_status.rb +18 -0
- data/lib/advanced_billing/models/item_category.rb +16 -0
- data/lib/advanced_billing/models/line_item_kind.rb +21 -0
- data/lib/advanced_billing/models/line_item_transaction_type.rb +18 -0
- data/lib/advanced_billing/models/list_components_price_points_include.rb +6 -0
- data/lib/advanced_billing/models/list_coupons_filter.rb +22 -6
- data/lib/advanced_billing/models/list_events_date_field.rb +6 -0
- data/lib/advanced_billing/models/list_prepayment_date_field.rb +13 -0
- data/lib/advanced_billing/models/list_products_include.rb +6 -0
- data/lib/advanced_billing/models/list_products_price_points_include.rb +6 -0
- data/lib/advanced_billing/models/list_subscription_components_include.rb +13 -0
- data/lib/advanced_billing/models/list_subscription_components_sort.rb +13 -0
- data/lib/advanced_billing/models/metafield.rb +8 -11
- data/lib/advanced_billing/models/metafield_input.rb +18 -5
- data/lib/advanced_billing/models/metafield_scope.rb +9 -4
- data/lib/advanced_billing/models/metered_component.rb +2 -2
- data/lib/advanced_billing/models/nested_subscription_group.rb +10 -0
- data/lib/advanced_billing/models/on_off_component.rb +2 -2
- data/lib/advanced_billing/models/pay_pal_vault.rb +15 -0
- data/lib/advanced_billing/models/payment_profile_attributes.rb +3 -3
- data/lib/advanced_billing/models/payment_type.rb +15 -0
- data/lib/advanced_billing/models/prepaid_configuration.rb +10 -0
- data/lib/advanced_billing/models/prepaid_usage_component.rb +2 -2
- data/lib/advanced_billing/models/prepayment_method.rb +18 -0
- data/lib/advanced_billing/models/price_point_type.rb +14 -0
- data/lib/advanced_billing/models/pricing_scheme.rb +15 -0
- data/lib/advanced_billing/models/product.rb +18 -8
- data/lib/advanced_billing/models/product_family.rb +10 -0
- data/lib/advanced_billing/models/product_price_point.rb +8 -3
- data/lib/advanced_billing/models/proforma_invoice_discount_source_type.rb +13 -0
- data/lib/advanced_billing/models/proforma_invoice_role.rb +15 -0
- data/lib/advanced_billing/models/proforma_invoice_status.rb +14 -0
- data/lib/advanced_billing/models/proforma_invoice_tax_source_type.rb +13 -0
- data/lib/advanced_billing/models/public_signup_page.rb +10 -0
- data/lib/advanced_billing/models/quantity_based_component.rb +2 -2
- data/lib/advanced_billing/models/reactivation_charge.rb +14 -0
- data/lib/advanced_billing/models/recurring_scheme.rb +14 -0
- data/lib/advanced_billing/models/resource_type.rb +13 -0
- data/lib/advanced_billing/models/restriction_type.rb +13 -0
- data/lib/advanced_billing/models/resume_options.rb +1 -1
- data/lib/advanced_billing/models/resumption_charge.rb +14 -0
- data/lib/advanced_billing/models/service_credit_type.rb +13 -0
- data/lib/advanced_billing/models/snap_day.rb +7 -2
- data/lib/advanced_billing/models/sorting_direction.rb +13 -0
- data/lib/advanced_billing/models/subscription.rb +16 -3
- data/lib/advanced_billing/models/subscription_custom_price.rb +23 -7
- data/lib/advanced_billing/models/subscription_date_field.rb +20 -0
- data/lib/advanced_billing/models/subscription_group_include.rb +6 -0
- data/lib/advanced_billing/models/subscription_group_prepayment_method.rb +17 -0
- data/lib/advanced_billing/models/subscription_groups_list_include.rb +6 -0
- data/lib/advanced_billing/models/subscription_include.rb +13 -0
- data/lib/advanced_billing/models/subscription_included_coupon.rb +10 -0
- data/lib/advanced_billing/models/subscription_list_date_field.rb +6 -0
- data/lib/advanced_billing/models/subscription_list_include.rb +6 -0
- data/lib/advanced_billing/models/subscription_purge_type.rb +13 -0
- data/lib/advanced_billing/models/subscription_sort.rb +17 -0
- data/lib/advanced_billing/models/subscription_state.rb +26 -0
- data/lib/advanced_billing/models/subscription_state_filter.rb +23 -0
- data/lib/advanced_billing/models/tax_configuration_kind.rb +15 -0
- data/lib/advanced_billing/models/tax_destination_address.rb +15 -0
- data/lib/advanced_billing/models/trial_type.rb +41 -0
- data/lib/advanced_billing/models/update_component.rb +2 -2
- data/lib/advanced_billing/models/update_metafield.rb +4 -6
- data/lib/advanced_billing/models/update_payment_profile.rb +3 -3
- data/lib/advanced_billing/models/update_subscription.rb +1 -0
- data/lib/advanced_billing/models/webhook_order.rb +13 -0
- data/lib/advanced_billing/models/webhook_status.rb +15 -0
- data/lib/advanced_billing/models/webhook_subscription.rb +46 -0
- data/lib/advanced_billing/utilities/union_type_lookup.rb +32 -5
- data/lib/advanced_billing.rb +2 -0
- metadata +11 -8
|
@@ -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
|
|
82
|
-
#
|
|
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,
|
|
35
|
-
#
|
|
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
|
|
171
|
-
#
|
|
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
|
|
177
|
-
#
|
|
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
|
|
183
|
-
#
|
|
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
|
|
@@ -52,9 +52,13 @@ module AdvancedBilling
|
|
|
52
52
|
# @return [IntervalUnit]
|
|
53
53
|
attr_accessor :trial_interval_unit
|
|
54
54
|
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
55
|
+
# Indicates how a trial is handled when the trail period ends and there is
|
|
56
|
+
# no credit card on file. For `no_obligation`, the subscription transitions
|
|
57
|
+
# to a Trial Ended state. Maxio will not send any emails or statements. For
|
|
58
|
+
# `payment_expected`, the subscription transitions to a Past Due state.
|
|
59
|
+
# Maxio will send normal dunning emails and statements according to your
|
|
60
|
+
# other settings.
|
|
61
|
+
# @return [TrialType]
|
|
58
62
|
attr_accessor :trial_type
|
|
59
63
|
|
|
60
64
|
# reserved for future use
|
|
@@ -188,6 +192,7 @@ module AdvancedBilling
|
|
|
188
192
|
trial_price_in_cents
|
|
189
193
|
trial_interval
|
|
190
194
|
trial_interval_unit
|
|
195
|
+
trial_type
|
|
191
196
|
introductory_offer
|
|
192
197
|
initial_charge_in_cents
|
|
193
198
|
initial_charge_after_trial
|
|
@@ -19,5 +19,18 @@ module AdvancedBilling
|
|
|
19
19
|
|
|
20
20
|
PROFORMA_INVOICE_DISCOUNT_SOURCE_TYPE.include?(value)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def self.from_value(value, default_value = COUPON)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'coupon' then COUPON
|
|
30
|
+
when 'referral' then REFERRAL
|
|
31
|
+
else
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
22
35
|
end
|
|
23
36
|
end
|
|
@@ -26,5 +26,20 @@ module AdvancedBilling
|
|
|
26
26
|
|
|
27
27
|
PROFORMA_INVOICE_ROLE.include?(value)
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
def self.from_value(value, default_value = UNSET)
|
|
31
|
+
return default_value if value.nil?
|
|
32
|
+
|
|
33
|
+
str = value.to_s.strip
|
|
34
|
+
|
|
35
|
+
case str.downcase
|
|
36
|
+
when 'unset' then UNSET
|
|
37
|
+
when 'proforma' then PROFORMA
|
|
38
|
+
when 'proforma_adhoc' then PROFORMA_ADHOC
|
|
39
|
+
when 'proforma_automatic' then PROFORMA_AUTOMATIC
|
|
40
|
+
else
|
|
41
|
+
default_value
|
|
42
|
+
end
|
|
43
|
+
end
|
|
29
44
|
end
|
|
30
45
|
end
|
|
@@ -22,5 +22,19 @@ module AdvancedBilling
|
|
|
22
22
|
|
|
23
23
|
PROFORMA_INVOICE_STATUS.include?(value)
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
def self.from_value(value, default_value = DRAFT)
|
|
27
|
+
return default_value if value.nil?
|
|
28
|
+
|
|
29
|
+
str = value.to_s.strip
|
|
30
|
+
|
|
31
|
+
case str.downcase
|
|
32
|
+
when 'draft' then DRAFT
|
|
33
|
+
when 'voided' then VOIDED
|
|
34
|
+
when 'archived' then ARCHIVED
|
|
35
|
+
else
|
|
36
|
+
default_value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
25
39
|
end
|
|
26
40
|
end
|
|
@@ -19,5 +19,18 @@ module AdvancedBilling
|
|
|
19
19
|
|
|
20
20
|
PROFORMA_INVOICE_TAX_SOURCE_TYPE.include?(value)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def self.from_value(value, default_value = TAX)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'tax' then TAX
|
|
30
|
+
when 'avalara' then AVALARA
|
|
31
|
+
else
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
22
35
|
end
|
|
23
36
|
end
|
|
@@ -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 [PublicSignupPage | 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
|
|
@@ -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
|
|
82
|
-
#
|
|
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
|
|
|
@@ -26,5 +26,19 @@ module AdvancedBilling
|
|
|
26
26
|
|
|
27
27
|
REACTIVATION_CHARGE.include?(value)
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
def self.from_value(value, default_value = PRORATED)
|
|
31
|
+
return default_value if value.nil?
|
|
32
|
+
|
|
33
|
+
str = value.to_s.strip
|
|
34
|
+
|
|
35
|
+
case str.downcase
|
|
36
|
+
when 'prorated' then PRORATED
|
|
37
|
+
when 'immediate' then IMMEDIATE
|
|
38
|
+
when 'delayed' then DELAYED
|
|
39
|
+
else
|
|
40
|
+
default_value
|
|
41
|
+
end
|
|
42
|
+
end
|
|
29
43
|
end
|
|
30
44
|
end
|
|
@@ -22,5 +22,19 @@ module AdvancedBilling
|
|
|
22
22
|
|
|
23
23
|
RECURRING_SCHEME.include?(value)
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
def self.from_value(value, default_value = DO_NOT_RECUR)
|
|
27
|
+
return default_value if value.nil?
|
|
28
|
+
|
|
29
|
+
str = value.to_s.strip
|
|
30
|
+
|
|
31
|
+
case str.downcase
|
|
32
|
+
when 'do_not_recur' then DO_NOT_RECUR
|
|
33
|
+
when 'recur_indefinitely' then RECUR_INDEFINITELY
|
|
34
|
+
when 'recur_with_duration' then RECUR_WITH_DURATION
|
|
35
|
+
else
|
|
36
|
+
default_value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
25
39
|
end
|
|
26
40
|
end
|
|
@@ -19,5 +19,18 @@ module AdvancedBilling
|
|
|
19
19
|
|
|
20
20
|
RESOURCE_TYPE.include?(value)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def self.from_value(value, default_value = SUBSCRIPTIONS)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'subscriptions' then SUBSCRIPTIONS
|
|
30
|
+
when 'customers' then CUSTOMERS
|
|
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
|
RESTRICTION_TYPE.include?(value)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def self.from_value(value, default_value = COMPONENT)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'component' then COMPONENT
|
|
30
|
+
when 'product' then PRODUCT
|
|
31
|
+
else
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
22
35
|
end
|
|
23
36
|
end
|
|
@@ -10,7 +10,7 @@ module AdvancedBilling
|
|
|
10
10
|
private_constant :SKIP
|
|
11
11
|
|
|
12
12
|
# Chargify will only attempt to resume the subscription's billing period. If
|
|
13
|
-
# not resumable, the subscription will be left in
|
|
13
|
+
# not resumable, the subscription will be left in its current state.
|
|
14
14
|
# @return [TrueClass | FalseClass]
|
|
15
15
|
attr_accessor :require_resume
|
|
16
16
|
|
|
@@ -23,5 +23,19 @@ module AdvancedBilling
|
|
|
23
23
|
|
|
24
24
|
RESUMPTION_CHARGE.include?(value)
|
|
25
25
|
end
|
|
26
|
+
|
|
27
|
+
def self.from_value(value, default_value = PRORATED)
|
|
28
|
+
return default_value if value.nil?
|
|
29
|
+
|
|
30
|
+
str = value.to_s.strip
|
|
31
|
+
|
|
32
|
+
case str.downcase
|
|
33
|
+
when 'prorated' then PRORATED
|
|
34
|
+
when 'immediate' then IMMEDIATE
|
|
35
|
+
when 'delayed' then DELAYED
|
|
36
|
+
else
|
|
37
|
+
default_value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
26
40
|
end
|
|
27
41
|
end
|
|
@@ -19,5 +19,18 @@ module AdvancedBilling
|
|
|
19
19
|
|
|
20
20
|
SERVICE_CREDIT_TYPE.include?(value)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def self.from_value(value, default_value = CREDIT)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'credit' then CREDIT
|
|
30
|
+
when 'debit' then DEBIT
|
|
31
|
+
else
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
22
35
|
end
|
|
23
36
|
end
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
6
|
module AdvancedBilling
|
|
7
|
-
#
|
|
8
|
-
# can be 1-28 or 'end'.
|
|
7
|
+
# SnapDay.
|
|
9
8
|
class SnapDay
|
|
10
9
|
SNAP_DAY = [
|
|
11
10
|
# TODO: Write general description for ENUM_END
|
|
@@ -17,5 +16,11 @@ module AdvancedBilling
|
|
|
17
16
|
|
|
18
17
|
SNAP_DAY.include?(value)
|
|
19
18
|
end
|
|
19
|
+
|
|
20
|
+
def self.from_value(value, default_value = ENUM_END)
|
|
21
|
+
return default_value if value.nil?
|
|
22
|
+
|
|
23
|
+
default_value
|
|
24
|
+
end
|
|
20
25
|
end
|
|
21
26
|
end
|
|
@@ -19,5 +19,18 @@ module AdvancedBilling
|
|
|
19
19
|
|
|
20
20
|
SORTING_DIRECTION.include?(value)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def self.from_value(value, default_value = ASC)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'asc' then ASC
|
|
30
|
+
when 'desc' then DESC
|
|
31
|
+
else
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
22
35
|
end
|
|
23
36
|
end
|
|
@@ -198,7 +198,7 @@ module AdvancedBilling
|
|
|
198
198
|
|
|
199
199
|
# The day of the month that the subscription will charge according to
|
|
200
200
|
# calendar billing rules, if used.
|
|
201
|
-
# @return [
|
|
201
|
+
# @return [Object]
|
|
202
202
|
attr_accessor :snap_day
|
|
203
203
|
|
|
204
204
|
# The type of payment collection to be used in the subscription. For legacy
|
|
@@ -295,7 +295,8 @@ module AdvancedBilling
|
|
|
295
295
|
attr_accessor :payer_id
|
|
296
296
|
|
|
297
297
|
# The balance in cents plus the estimated renewal amount in cents. Returned
|
|
298
|
-
# ONLY for readSubscription operation as it's compute intensive
|
|
298
|
+
# ONLY for the readSubscription operation as it's a compute intensive
|
|
299
|
+
# operation.
|
|
299
300
|
# @return [Integer]
|
|
300
301
|
attr_accessor :current_billing_amount_in_cents
|
|
301
302
|
|
|
@@ -782,7 +783,9 @@ module AdvancedBilling
|
|
|
782
783
|
SKIP
|
|
783
784
|
end
|
|
784
785
|
coupon_code = hash.key?('coupon_code') ? hash['coupon_code'] : SKIP
|
|
785
|
-
snap_day = hash.key?('snap_day') ?
|
|
786
|
+
snap_day = hash.key?('snap_day') ? APIHelper.deserialize_union_type(
|
|
787
|
+
UnionTypeLookUp.get(:SubscriptionSnapDay), hash['snap_day']
|
|
788
|
+
) : SKIP
|
|
786
789
|
payment_collection_method =
|
|
787
790
|
hash.key?('payment_collection_method') ? hash['payment_collection_method'] : SKIP
|
|
788
791
|
customer = Customer.from_hash(hash['customer']) if hash['customer']
|
|
@@ -986,6 +989,16 @@ module AdvancedBilling
|
|
|
986
989
|
DateTimeHelper.to_rfc3339(scheduled_cancellation_at)
|
|
987
990
|
end
|
|
988
991
|
|
|
992
|
+
# Validates an instance of the object from a given value.
|
|
993
|
+
# @param [Subscription | Hash] The value against the validation is performed.
|
|
994
|
+
def self.validate(value)
|
|
995
|
+
return true if value.instance_of? self
|
|
996
|
+
|
|
997
|
+
return false unless value.instance_of? Hash
|
|
998
|
+
|
|
999
|
+
true
|
|
1000
|
+
end
|
|
1001
|
+
|
|
989
1002
|
# Provides a human-readable string representation of the object.
|
|
990
1003
|
def to_s
|
|
991
1004
|
class_name = self.class.name.split('::').last
|
|
@@ -42,6 +42,15 @@ module AdvancedBilling
|
|
|
42
42
|
# @return [IntervalUnit]
|
|
43
43
|
attr_accessor :trial_interval_unit
|
|
44
44
|
|
|
45
|
+
# Indicates how a trial is handled when the trail period ends and there is
|
|
46
|
+
# no credit card on file. For `no_obligation`, the subscription transitions
|
|
47
|
+
# to a Trial Ended state. Maxio will not send any emails or statements. For
|
|
48
|
+
# `payment_expected`, the subscription transitions to a Past Due state.
|
|
49
|
+
# Maxio will send normal dunning emails and statements according to your
|
|
50
|
+
# other settings.
|
|
51
|
+
# @return [TrialType]
|
|
52
|
+
attr_accessor :trial_type
|
|
53
|
+
|
|
45
54
|
# (Optional)
|
|
46
55
|
# @return [Object]
|
|
47
56
|
attr_accessor :initial_charge_in_cents
|
|
@@ -73,6 +82,7 @@ module AdvancedBilling
|
|
|
73
82
|
@_hash['trial_price_in_cents'] = 'trial_price_in_cents'
|
|
74
83
|
@_hash['trial_interval'] = 'trial_interval'
|
|
75
84
|
@_hash['trial_interval_unit'] = 'trial_interval_unit'
|
|
85
|
+
@_hash['trial_type'] = 'trial_type'
|
|
76
86
|
@_hash['initial_charge_in_cents'] = 'initial_charge_in_cents'
|
|
77
87
|
@_hash['initial_charge_after_trial'] = 'initial_charge_after_trial'
|
|
78
88
|
@_hash['expiration_interval'] = 'expiration_interval'
|
|
@@ -89,6 +99,7 @@ module AdvancedBilling
|
|
|
89
99
|
trial_price_in_cents
|
|
90
100
|
trial_interval
|
|
91
101
|
trial_interval_unit
|
|
102
|
+
trial_type
|
|
92
103
|
initial_charge_in_cents
|
|
93
104
|
initial_charge_after_trial
|
|
94
105
|
expiration_interval
|
|
@@ -101,6 +112,7 @@ module AdvancedBilling
|
|
|
101
112
|
def self.nullables
|
|
102
113
|
%w[
|
|
103
114
|
interval_unit
|
|
115
|
+
trial_type
|
|
104
116
|
expiration_interval_unit
|
|
105
117
|
]
|
|
106
118
|
end
|
|
@@ -108,7 +120,7 @@ module AdvancedBilling
|
|
|
108
120
|
def initialize(price_in_cents:, interval:, interval_unit:, name: SKIP,
|
|
109
121
|
handle: SKIP, trial_price_in_cents: SKIP,
|
|
110
122
|
trial_interval: SKIP, trial_interval_unit: SKIP,
|
|
111
|
-
initial_charge_in_cents: SKIP,
|
|
123
|
+
trial_type: SKIP, initial_charge_in_cents: SKIP,
|
|
112
124
|
initial_charge_after_trial: SKIP, expiration_interval: SKIP,
|
|
113
125
|
expiration_interval_unit: SKIP, tax_included: SKIP,
|
|
114
126
|
additional_properties: {})
|
|
@@ -125,6 +137,7 @@ module AdvancedBilling
|
|
|
125
137
|
@trial_price_in_cents = trial_price_in_cents unless trial_price_in_cents == SKIP
|
|
126
138
|
@trial_interval = trial_interval unless trial_interval == SKIP
|
|
127
139
|
@trial_interval_unit = trial_interval_unit unless trial_interval_unit == SKIP
|
|
140
|
+
@trial_type = trial_type unless trial_type == SKIP
|
|
128
141
|
@initial_charge_in_cents = initial_charge_in_cents unless initial_charge_in_cents == SKIP
|
|
129
142
|
unless initial_charge_after_trial == SKIP
|
|
130
143
|
@initial_charge_after_trial =
|
|
@@ -157,6 +170,7 @@ module AdvancedBilling
|
|
|
157
170
|
) : SKIP
|
|
158
171
|
trial_interval_unit =
|
|
159
172
|
hash.key?('trial_interval_unit') ? hash['trial_interval_unit'] : SKIP
|
|
173
|
+
trial_type = hash.key?('trial_type') ? hash['trial_type'] : SKIP
|
|
160
174
|
initial_charge_in_cents = hash.key?('initial_charge_in_cents') ? APIHelper.deserialize_union_type(
|
|
161
175
|
UnionTypeLookUp.get(:SubscriptionCustomPriceInitialChargeInCents), hash['initial_charge_in_cents']
|
|
162
176
|
) : SKIP
|
|
@@ -181,6 +195,7 @@ module AdvancedBilling
|
|
|
181
195
|
trial_price_in_cents: trial_price_in_cents,
|
|
182
196
|
trial_interval: trial_interval,
|
|
183
197
|
trial_interval_unit: trial_interval_unit,
|
|
198
|
+
trial_type: trial_type,
|
|
184
199
|
initial_charge_in_cents: initial_charge_in_cents,
|
|
185
200
|
initial_charge_after_trial: initial_charge_after_trial,
|
|
186
201
|
expiration_interval: expiration_interval,
|
|
@@ -221,10 +236,11 @@ module AdvancedBilling
|
|
|
221
236
|
"<#{class_name} name: #{@name}, handle: #{@handle}, price_in_cents: #{@price_in_cents},"\
|
|
222
237
|
" interval: #{@interval}, interval_unit: #{@interval_unit}, trial_price_in_cents:"\
|
|
223
238
|
" #{@trial_price_in_cents}, trial_interval: #{@trial_interval}, trial_interval_unit:"\
|
|
224
|
-
" #{@trial_interval_unit},
|
|
225
|
-
" initial_charge_after_trial: #{@initial_charge_after_trial},
|
|
226
|
-
" #{@expiration_interval}, expiration_interval_unit:
|
|
227
|
-
" tax_included: #{@tax_included}, additional_properties:
|
|
239
|
+
" #{@trial_interval_unit}, trial_type: #{@trial_type}, initial_charge_in_cents:"\
|
|
240
|
+
" #{@initial_charge_in_cents}, initial_charge_after_trial: #{@initial_charge_after_trial},"\
|
|
241
|
+
" expiration_interval: #{@expiration_interval}, expiration_interval_unit:"\
|
|
242
|
+
" #{@expiration_interval_unit}, tax_included: #{@tax_included}, additional_properties:"\
|
|
243
|
+
" #{get_additional_properties}>"
|
|
228
244
|
end
|
|
229
245
|
|
|
230
246
|
# Provides a debugging-friendly string with detailed object information.
|
|
@@ -234,8 +250,8 @@ module AdvancedBilling
|
|
|
234
250
|
" #{@price_in_cents.inspect}, interval: #{@interval.inspect}, interval_unit:"\
|
|
235
251
|
" #{@interval_unit.inspect}, trial_price_in_cents: #{@trial_price_in_cents.inspect},"\
|
|
236
252
|
" trial_interval: #{@trial_interval.inspect}, trial_interval_unit:"\
|
|
237
|
-
" #{@trial_interval_unit.inspect},
|
|
238
|
-
" #{@initial_charge_in_cents.inspect}, initial_charge_after_trial:"\
|
|
253
|
+
" #{@trial_interval_unit.inspect}, trial_type: #{@trial_type.inspect},"\
|
|
254
|
+
" initial_charge_in_cents: #{@initial_charge_in_cents.inspect}, initial_charge_after_trial:"\
|
|
239
255
|
" #{@initial_charge_after_trial.inspect}, expiration_interval:"\
|
|
240
256
|
" #{@expiration_interval.inspect}, expiration_interval_unit:"\
|
|
241
257
|
" #{@expiration_interval_unit.inspect}, tax_included: #{@tax_included.inspect},"\
|
|
@@ -40,5 +40,25 @@ module AdvancedBilling
|
|
|
40
40
|
|
|
41
41
|
SUBSCRIPTION_DATE_FIELD.include?(value)
|
|
42
42
|
end
|
|
43
|
+
|
|
44
|
+
def self.from_value(value, default_value = CURRENT_PERIOD_ENDS_AT)
|
|
45
|
+
return default_value if value.nil?
|
|
46
|
+
|
|
47
|
+
str = value.to_s.strip
|
|
48
|
+
|
|
49
|
+
case str.downcase
|
|
50
|
+
when 'current_period_ends_at' then CURRENT_PERIOD_ENDS_AT
|
|
51
|
+
when 'current_period_starts_at' then CURRENT_PERIOD_STARTS_AT
|
|
52
|
+
when 'created_at' then CREATED_AT
|
|
53
|
+
when 'activated_at' then ACTIVATED_AT
|
|
54
|
+
when 'canceled_at' then CANCELED_AT
|
|
55
|
+
when 'expires_at' then EXPIRES_AT
|
|
56
|
+
when 'trial_started_at' then TRIAL_STARTED_AT
|
|
57
|
+
when 'trial_ended_at' then TRIAL_ENDED_AT
|
|
58
|
+
when 'updated_at' then UPDATED_AT
|
|
59
|
+
else
|
|
60
|
+
default_value
|
|
61
|
+
end
|
|
62
|
+
end
|
|
43
63
|
end
|
|
44
64
|
end
|