maxio-advanced-billing-sdk 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +45 -45
- data/lib/advanced_billing/configuration.rb +2 -2
- data/lib/advanced_billing/controllers/advance_invoice_controller.rb +24 -24
- data/lib/advanced_billing/controllers/api_exports_controller.rb +57 -57
- data/lib/advanced_billing/controllers/base_controller.rb +10 -10
- data/lib/advanced_billing/controllers/billing_portal_controller.rb +33 -32
- data/lib/advanced_billing/controllers/component_price_points_controller.rb +60 -60
- data/lib/advanced_billing/controllers/components_controller.rb +110 -107
- data/lib/advanced_billing/controllers/coupons_controller.rb +89 -89
- data/lib/advanced_billing/controllers/custom_fields_controller.rb +76 -76
- data/lib/advanced_billing/controllers/customers_controller.rb +45 -41
- data/lib/advanced_billing/controllers/events_based_billing_segments_controller.rb +53 -53
- data/lib/advanced_billing/controllers/events_controller.rb +16 -15
- data/lib/advanced_billing/controllers/insights_controller.rb +17 -17
- data/lib/advanced_billing/controllers/invoices_controller.rb +99 -99
- data/lib/advanced_billing/controllers/offers_controller.rb +18 -15
- data/lib/advanced_billing/controllers/payment_profiles_controller.rb +107 -104
- data/lib/advanced_billing/controllers/product_families_controller.rb +26 -26
- data/lib/advanced_billing/controllers/product_price_points_controller.rb +62 -62
- data/lib/advanced_billing/controllers/products_controller.rb +37 -37
- data/lib/advanced_billing/controllers/proforma_invoices_controller.rb +61 -61
- data/lib/advanced_billing/controllers/reason_codes_controller.rb +35 -35
- data/lib/advanced_billing/controllers/referral_codes_controller.rb +9 -8
- data/lib/advanced_billing/controllers/sales_commissions_controller.rb +13 -13
- data/lib/advanced_billing/controllers/sites_controller.rb +11 -10
- data/lib/advanced_billing/controllers/subscription_components_controller.rb +170 -161
- data/lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb +23 -23
- data/lib/advanced_billing/controllers/subscription_group_status_controller.rb +21 -21
- data/lib/advanced_billing/controllers/subscription_groups_controller.rb +54 -54
- data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +37 -37
- data/lib/advanced_billing/controllers/subscription_notes_controller.rb +20 -16
- data/lib/advanced_billing/controllers/subscription_products_controller.rb +20 -18
- data/lib/advanced_billing/controllers/subscription_status_controller.rb +74 -74
- data/lib/advanced_billing/controllers/subscriptions_controller.rb +163 -160
- data/lib/advanced_billing/controllers/webhooks_controller.rb +45 -44
- data/lib/advanced_billing/exceptions/component_allocation_error_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/component_price_point_error_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/customer_error_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/error_array_map_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/error_list_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/error_string_map_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/event_based_billing_list_segments_errors_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/event_based_billing_segment_errors_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/event_based_billing_segment_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/product_price_point_error_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/proforma_bad_request_error_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/refund_prepayment_base_errors_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/single_error_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/single_string_error_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/subscription_component_allocation_error_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/subscription_group_create_error_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/subscription_group_signup_error_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/subscription_group_update_error_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/subscription_remove_coupon_errors_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/subscriptions_mrr_error_response_exception.rb +15 -15
- data/lib/advanced_billing/exceptions/too_many_management_link_requests_error_exception.rb +15 -15
- data/lib/advanced_billing/models/activate_event_based_component.rb +84 -0
- data/lib/advanced_billing/models/{current_vault.rb → all_vaults.rb} +28 -7
- data/lib/advanced_billing/models/allocation.rb +1 -0
- data/lib/advanced_billing/models/allocation_preview_item.rb +1 -0
- data/lib/advanced_billing/models/apple_pay_payment_profile.rb +232 -0
- data/lib/advanced_billing/models/apple_pay_vault.rb +20 -0
- data/lib/advanced_billing/models/bank_account_attributes.rb +2 -0
- data/lib/advanced_billing/models/bank_account_payment_profile.rb +25 -20
- data/lib/advanced_billing/models/bank_account_vault.rb +19 -9
- data/lib/advanced_billing/models/change_invoice_status_event_data.rb +6 -6
- data/lib/advanced_billing/models/component.rb +1 -0
- data/lib/advanced_billing/models/component_custom_price.rb +33 -14
- data/lib/advanced_billing/models/component_price_point_item.rb +3 -1
- data/lib/advanced_billing/models/create_component_price_point.rb +3 -1
- data/lib/advanced_billing/models/create_customer.rb +11 -1
- data/lib/advanced_billing/models/create_metafield.rb +2 -1
- data/lib/advanced_billing/models/create_or_update_product.rb +7 -4
- data/lib/advanced_billing/models/create_payment_profile.rb +1 -1
- data/lib/advanced_billing/models/create_prepaid_usage_component_price_point.rb +6 -5
- data/lib/advanced_billing/models/create_product_price_point.rb +5 -3
- data/lib/advanced_billing/models/create_subscription.rb +27 -25
- data/lib/advanced_billing/models/credit_card_payment_profile.rb +17 -16
- data/lib/advanced_billing/models/credit_card_vault.rb +117 -0
- data/lib/advanced_billing/models/credit_note.rb +2 -2
- data/lib/advanced_billing/models/customer.rb +11 -1
- data/lib/advanced_billing/models/customer_attributes.rb +12 -1
- data/lib/advanced_billing/models/ebb_component.rb +1 -0
- data/lib/advanced_billing/models/{extended_interval_unit.rb → expiration_interval_unit.rb} +4 -4
- data/lib/advanced_billing/models/full_subscription_group_response.rb +65 -50
- data/lib/advanced_billing/models/get_one_time_token_payment_profile.rb +1 -1
- data/lib/advanced_billing/models/invoice.rb +19 -9
- data/lib/advanced_billing/models/invoice_consolidation_level.rb +2 -2
- data/lib/advanced_billing/models/invoice_refund.rb +13 -1
- data/lib/advanced_billing/models/invoice_status.rb +2 -2
- data/lib/advanced_billing/models/invoice_tax.rb +29 -0
- data/lib/advanced_billing/models/invoice_tax_component_breakout.rb +101 -1
- data/lib/advanced_billing/models/issue_invoice_event_data.rb +6 -6
- data/lib/advanced_billing/models/metered_component.rb +4 -3
- data/lib/advanced_billing/models/offer_item.rb +3 -1
- data/lib/advanced_billing/models/on_off_component.rb +3 -2
- data/lib/advanced_billing/models/paid_invoice.rb +2 -2
- data/lib/advanced_billing/models/pay_pal_vault.rb +29 -0
- data/lib/advanced_billing/models/payment_profile_attributes.rb +5 -5
- data/lib/advanced_billing/models/payment_profile_response.rb +3 -3
- data/lib/advanced_billing/models/payment_type.rb +4 -1
- data/lib/advanced_billing/models/paypal_payment_profile.rb +242 -0
- data/lib/advanced_billing/models/prepaid_usage_component.rb +5 -4
- data/lib/advanced_billing/models/product.rb +2 -2
- data/lib/advanced_billing/models/product_price_point.rb +2 -2
- data/lib/advanced_billing/models/proforma_invoice.rb +6 -6
- data/lib/advanced_billing/models/quantity_based_component.rb +4 -3
- data/lib/advanced_billing/models/refund_invoice_event_data.rb +4 -4
- data/lib/advanced_billing/models/resent_invitation.rb +36 -0
- data/lib/advanced_billing/models/subscription.rb +13 -10
- data/lib/advanced_billing/models/subscription_component.rb +1 -0
- data/lib/advanced_billing/models/subscription_component_subscription.rb +26 -20
- data/lib/advanced_billing/models/subscription_custom_price.rb +5 -2
- data/lib/advanced_billing/models/subscription_group_bank_account.rb +2 -0
- data/lib/advanced_billing/models/subscription_group_credit_card.rb +1 -1
- data/lib/advanced_billing/models/subscription_group_signup_response.rb +39 -30
- data/lib/advanced_billing/models/subscription_state.rb +30 -30
- data/lib/advanced_billing/models/tax_configuration.rb +1 -2
- data/lib/advanced_billing/models/update_component_price_point.rb +3 -1
- data/lib/advanced_billing/models/update_customer.rb +12 -1
- data/lib/advanced_billing/models/update_payment_profile.rb +1 -1
- data/lib/advanced_billing/utilities/file_wrapper.rb +9 -9
- data/lib/advanced_billing/utilities/union_type_lookup.rb +17 -3
- data/lib/advanced_billing.rb +10 -4
- metadata +16 -10
@@ -6,37 +6,37 @@
|
|
6
6
|
module AdvancedBilling
|
7
7
|
# SubscriptionsController
|
8
8
|
class SubscriptionsController < BaseController
|
9
|
-
# Full documentation on how subscriptions operate within
|
10
|
-
# located under the following topics:
|
9
|
+
# Full documentation on how subscriptions operate within Advanced Billing
|
10
|
+
# can be located under the following topics:
|
11
11
|
# + [Subscriptions
|
12
|
-
# Reference](https://maxio
|
13
|
-
#
|
12
|
+
# Reference](https://maxio.zendesk.com/hc/en-us/articles/24251526991757-Subs
|
13
|
+
# cription-Overview)
|
14
14
|
# + [Subscriptions
|
15
|
-
# Actions](https://maxio
|
16
|
-
#
|
15
|
+
# Actions](https://maxio.zendesk.com/hc/en-us/articles/24251983024653-Subscr
|
16
|
+
# iption-Actions-Overview)
|
17
17
|
# + [Subscription
|
18
|
-
# Cancellation](https://maxio
|
19
|
-
#
|
18
|
+
# Cancellation](https://maxio.zendesk.com/hc/en-us/articles/24251957778829-C
|
19
|
+
# ancel-Subscriptions)
|
20
20
|
# + [Subscription
|
21
|
-
# Reactivation](https://maxio
|
22
|
-
#
|
21
|
+
# Reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-R
|
22
|
+
# eactivating-and-Resuming)
|
23
23
|
# + [Subscription
|
24
|
-
# Import](https://maxio
|
25
|
-
#
|
24
|
+
# Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports
|
25
|
+
# )
|
26
26
|
# When creating a subscription, you must specify a product and a customer.
|
27
27
|
# Credit card details may be required, depending on the options for the
|
28
28
|
# Product being subscribed ([see Product
|
29
|
-
# Options](https://maxio
|
30
|
-
#
|
29
|
+
# Options](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Produc
|
30
|
+
# t-Editing)).
|
31
31
|
# The product may be specified by `product_id` or by `product_handle` (API
|
32
32
|
# Handle). In similar fashion, to pass a particular product price point, you
|
33
33
|
# may either use `product_price_point_handle` or `product_price_point_id`.
|
34
34
|
# An existing customer may be specified by a `customer_id` (ID within
|
35
|
-
#
|
36
|
-
# have shared with
|
37
|
-
# may also pass in an existing payment profile for that
|
38
|
-
# `payment_profile_id`. A new customer may be created by
|
39
|
-
# `customer_attributes`.
|
35
|
+
# Advanced Billing) or a `customer_reference` (unique value within your app
|
36
|
+
# that you have shared with Advanced Billing via the reference attribute on
|
37
|
+
# a customer). You may also pass in an existing payment profile for that
|
38
|
+
# customer with `payment_profile_id`. A new customer may be created by
|
39
|
+
# providing `customer_attributes`.
|
40
40
|
# Credit card details may be required, depending on the options for the
|
41
41
|
# product being subscribed. The product can be specified by `product_id` or
|
42
42
|
# by `product_handle` (API Handle).
|
@@ -47,28 +47,29 @@ module AdvancedBilling
|
|
47
47
|
# `bank_account`.
|
48
48
|
# ## Taxable Subscriptions
|
49
49
|
# If your intent is to charge your subscribers tax via [Avalara
|
50
|
-
# Taxes](https://maxio
|
51
|
-
#
|
52
|
-
# Taxes](https://maxio
|
53
|
-
#
|
54
|
-
#
|
50
|
+
# Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287043035661-Avalara-
|
51
|
+
# VAT-Tax) or [Custom
|
52
|
+
# Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287044212749-Custom-T
|
53
|
+
# axes), there are a few considerations to be made regarding collecting
|
54
|
+
# subscription data.
|
55
55
|
# For subscribers to be eligible to be taxed, the following information for
|
56
56
|
# the `customer` object or `payment_profile` object must by supplied:
|
57
57
|
# + A subscription to a [taxable
|
58
|
-
# product](https://maxio
|
59
|
-
#
|
58
|
+
# product](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Produc
|
59
|
+
# t-Editing#tax-settings)
|
60
60
|
# + [Full valid billing or shipping
|
61
|
-
# address](https://maxio
|
62
|
-
#
|
63
|
-
# locale
|
61
|
+
# address](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Advanc
|
62
|
+
# ed-Billing-Managed-Sales-Tax#full-address-required-for-taxable-subscriptio
|
63
|
+
# ns) to identify the tax locale
|
64
64
|
# + The portion of the address that houses the [state
|
65
|
-
# information](https://maxio
|
66
|
-
#
|
67
|
-
# must adhere to the ISO standard of a 2-3
|
65
|
+
# information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Ad
|
66
|
+
# vanced-Billing-Managed-Sales-Tax#required-state-format-for-taxable-subscri
|
67
|
+
# ptions) of either adddress must adhere to the ISO standard of a 2-3
|
68
|
+
# character limit/format.
|
68
69
|
# + The portion of the address that houses the [country
|
69
|
-
# information](https://maxio
|
70
|
-
#
|
71
|
-
# the ISO standard of a 2 character limit/format.
|
70
|
+
# information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Ad
|
71
|
+
# vanced-Billing-Managed-Sales-Tax#required-country-format-for-taxable-subsc
|
72
|
+
# riptions) must adhere to the ISO standard of a 2 character limit/format.
|
72
73
|
# ## Subscription Request Examples
|
73
74
|
# The subscription examples below will be split into two sections.
|
74
75
|
# The first section, "Subscription Customization", will focus on passing
|
@@ -76,11 +77,11 @@ module AdvancedBilling
|
|
76
77
|
# billing, and custom fields. These examples will presume you are using a
|
77
78
|
# secure `chargify_token` generated by Chargify.js.
|
78
79
|
# The second section, "Passing Payment Information", will focus on passing
|
79
|
-
# payment information into
|
80
|
-
# sending
|
81
|
-
# these examples are provided as guidance. If
|
82
|
-
# compliant, we recommend using Chargify.js to
|
83
|
-
# accounts.
|
80
|
+
# payment information into Advanced Billing. Please be aware that
|
81
|
+
# <b>collecting and sending Advanced Billing raw card details requires PCI
|
82
|
+
# compliance on your end</b>; these examples are provided as guidance. If
|
83
|
+
# your business is not PCI compliant, we recommend using Chargify.js to
|
84
|
+
# collect credit cards or bank accounts.
|
84
85
|
# # Subscription Customization
|
85
86
|
# ## With Components
|
86
87
|
# Different components require slightly different data. For example,
|
@@ -126,7 +127,7 @@ module AdvancedBilling
|
|
126
127
|
# # Passing Payment Information
|
127
128
|
# ## Subscription with Chargify.js token
|
128
129
|
# The `chargify_token` can be obtained using
|
129
|
-
# [
|
130
|
+
# [Chargify.js](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0
|
130
131
|
# NjAzNDI0-overview). The token represents payment profile attributes that
|
131
132
|
# were provided by the customer in their browser and stored at the payment
|
132
133
|
# gateway.
|
@@ -154,7 +155,7 @@ module AdvancedBilling
|
|
154
155
|
# If you already have a customer and card stored in your payment gateway,
|
155
156
|
# you may create a subscription with a `vault_token`. Providing the
|
156
157
|
# last_four, card type and expiration date will allow the card to be
|
157
|
-
# displayed properly in the
|
158
|
+
# displayed properly in the Advanced Billing UI.
|
158
159
|
# ```json
|
159
160
|
# {
|
160
161
|
# "subscription": {
|
@@ -285,8 +286,8 @@ module AdvancedBilling
|
|
285
286
|
# GoCardless](https://developers.chargify.com/docs/api-docs/1f10a4f170405-cr
|
286
287
|
# eate-payment-profile#gocardless)
|
287
288
|
# + [Full documentation on
|
288
|
-
# GoCardless](https://maxio
|
289
|
-
#
|
289
|
+
# GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoC
|
290
|
+
# ardless)
|
290
291
|
# + [Using Chargify.js with GoCardless - minimal
|
291
292
|
# example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN
|
292
293
|
# DIy-examples#minimal-example-with-direct-debit-gocardless-gateway)
|
@@ -347,8 +348,8 @@ module AdvancedBilling
|
|
347
348
|
# Debit](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-
|
348
349
|
# payment-profile#sepa-direct-debit)
|
349
350
|
# + [Full documentation on Stripe Direct
|
350
|
-
# Debit](https://maxio
|
351
|
-
#
|
351
|
+
# Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S
|
352
|
+
# EPA-and-BECS-Direct-Debit)
|
352
353
|
# + [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal
|
353
354
|
# example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN
|
354
355
|
# DIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway
|
@@ -379,8 +380,8 @@ module AdvancedBilling
|
|
379
380
|
# + [Payment Profiles via API for Stripe BECS Direct
|
380
381
|
# Debit]($e/Payment%20Profiles/createPaymentProfile)
|
381
382
|
# + [Full documentation on Stripe Direct
|
382
|
-
# Debit](https://maxio
|
383
|
-
#
|
383
|
+
# Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S
|
384
|
+
# EPA-and-BECS-Direct-Debit)
|
384
385
|
# + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal
|
385
386
|
# example](page:development-tools/chargify-js/examples#minimal-example-with-
|
386
387
|
# sepa-becs-or-bacs-direct-debit-stripe-gateway)
|
@@ -411,8 +412,8 @@ module AdvancedBilling
|
|
411
412
|
# + [Payment Profiles via API for Stripe BACS Direct
|
412
413
|
# Debit]($e/Payment%20Profiles/createPaymentProfile)
|
413
414
|
# + [Full documentation on Stripe Direct
|
414
|
-
# Debit](https://maxio
|
415
|
-
#
|
415
|
+
# Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S
|
416
|
+
# EPA-and-BECS-Direct-Debit)
|
416
417
|
# + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal
|
417
418
|
# example](page:development-tools/chargify-js/examples#minimal-example-with-
|
418
419
|
# sepa-becs-or-bacs-direct-debit-stripe-gateway)
|
@@ -446,9 +447,10 @@ module AdvancedBilling
|
|
446
447
|
# It may happen that a payment needs 3D Secure Authentication when the
|
447
448
|
# subscription is created; this is referred to in our help docs as a
|
448
449
|
# [post-authentication
|
449
|
-
# flow](https://maxio
|
450
|
-
#
|
451
|
-
# `422 Unprocessable Entity` in this case with the
|
450
|
+
# flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-I
|
451
|
+
# mplementing-3D-Secure#psd2-flows-pre-authentication-and-post-authenticatio
|
452
|
+
# n). The server returns `422 Unprocessable Entity` in this case with the
|
453
|
+
# following response:
|
452
454
|
# ```json
|
453
455
|
# {
|
454
456
|
# "errors": [
|
@@ -496,9 +498,10 @@ module AdvancedBilling
|
|
496
498
|
# It may happen that a payment needs 3D Secure Authentication when the
|
497
499
|
# subscription is created; this is referred to in our help docs as a
|
498
500
|
# [post-authentication
|
499
|
-
# flow](https://maxio
|
500
|
-
#
|
501
|
-
# `422 Unprocessable Entity` in this case with the
|
501
|
+
# flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-I
|
502
|
+
# mplementing-3D-Secure#psd2-flows-pre-authentication-and-post-authenticatio
|
503
|
+
# n). The server returns `422 Unprocessable Entity` in this case with the
|
504
|
+
# following response:
|
502
505
|
# ```json
|
503
506
|
# {
|
504
507
|
# "errors": [
|
@@ -565,22 +568,21 @@ module AdvancedBilling
|
|
565
568
|
# Subscriptions can be “imported” via the API to handle the following
|
566
569
|
# scenarios:
|
567
570
|
# + You already have existing subscriptions with specific start and renewal
|
568
|
-
# dates that you would like to import to
|
571
|
+
# dates that you would like to import to Advanced Billing
|
569
572
|
# + You already have credit cards stored in your provider’s vault and you
|
570
573
|
# would like to create subscriptions using those tokens
|
571
574
|
# Before importing, you should have already set up your products to match
|
572
575
|
# your offerings. Then, you can create Subscriptions via the API just like
|
573
576
|
# you normally would, but using a few special attributes.
|
574
577
|
# Full documentation on how import Subscriptions using the **import tool**
|
575
|
-
# in the
|
576
|
-
# [here](https://maxio
|
577
|
-
#
|
578
|
+
# in the Advanced Billing UI can be located
|
579
|
+
# [here](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports)
|
580
|
+
# .
|
578
581
|
# ### Important Notices and Disclaimers regarding Imports
|
579
582
|
# Before performing a bulk import of subscriptions via the API, we suggest
|
580
583
|
# reading the [Subscriptions
|
581
|
-
# Import](https://maxio
|
582
|
-
#
|
583
|
-
# repurcussions of a large import.
|
584
|
+
# Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports
|
585
|
+
# ) instructions to understand the repurcussions of a large import.
|
584
586
|
# ### Subscription Input Attributes
|
585
587
|
# The following _additional_ attributes to the subscription input attributes
|
586
588
|
# make imports possible: `next_billing_at`, `previous_billing_at`, and
|
@@ -599,9 +601,9 @@ module AdvancedBilling
|
|
599
601
|
# `paypal_account`.
|
600
602
|
# ### Stripe ACH Imports
|
601
603
|
# If the bank account has already been verified, currently you will need to
|
602
|
-
# create the customer, create the payment profile in
|
603
|
-
# verified=true, then create a subscription using the customer_id
|
604
|
-
# payment_profile_id.
|
604
|
+
# create the customer, create the payment profile in Advanced Billing -
|
605
|
+
# setting verified=true, then create a subscription using the customer_id
|
606
|
+
# and payment_profile_id.
|
605
607
|
# ### Webhooks During Import
|
606
608
|
# If no `next_billing_at` is provided, webhooks will be fired as normal. If
|
607
609
|
# you do set a future `next_billing_at`, only a subset of the webhooks are
|
@@ -660,12 +662,12 @@ module AdvancedBilling
|
|
660
662
|
# this time, the `scheme` attribute will always be 1.
|
661
663
|
# ### Subscription in a Customer Hierarchy
|
662
664
|
# For sites making use of the [Relationship
|
663
|
-
# Billing](https://maxio
|
664
|
-
#
|
665
|
-
# Hierarchy](https://maxio
|
666
|
-
#
|
667
|
-
# hierarchy. This can be achieved through the API by
|
668
|
-
# parameters in the **Create Subscription** request.
|
665
|
+
# Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanc
|
666
|
+
# ed-Billing-Invoices-Overview) and [Customer
|
667
|
+
# Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Cust
|
668
|
+
# omer-Hierarchies-WhoPays) features, it is possible to create subscriptions
|
669
|
+
# within a customer hierarchy. This can be achieved through the API by
|
670
|
+
# passing group parameters in the **Create Subscription** request.
|
669
671
|
# + The `group` parameters are optional and consist of the required `target`
|
670
672
|
# and optional `billing` parameters.
|
671
673
|
# When the `target` parameter specifies a customer that is already part of a
|
@@ -698,15 +700,16 @@ module AdvancedBilling
|
|
698
700
|
# the customer hierarchy also.
|
699
701
|
# ### Subscription in a Subscription Group
|
700
702
|
# For sites making use of [Relationship
|
701
|
-
# Billing](https://maxio
|
702
|
-
#
|
703
|
-
# as part of a [subscription
|
704
|
-
# group](https://maxio
|
705
|
-
# in order to rely on [invoice
|
706
|
-
# consolidation](https://maxio
|
707
|
-
#
|
708
|
-
# in the Create Subscription request. The `group`
|
709
|
-
# and consist of the required `target` and optional
|
703
|
+
# Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanc
|
704
|
+
# ed-Billing-Invoices-Overview) it may be desireable to create a
|
705
|
+
# subscription as part of a [subscription
|
706
|
+
# group](https://maxio.zendesk.com/hc/en-us/articles/24252172565005-Subscrip
|
707
|
+
# tion-Groups-Overview) in order to rely on [invoice
|
708
|
+
# consolidation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-
|
709
|
+
# Invoice-Consolidation). This can be achieved through the API by passing
|
710
|
+
# group parameters in the Create Subscription request. The `group`
|
711
|
+
# parameters are optional and consist of the required `target` and optional
|
712
|
+
# `billing` parameters.
|
710
713
|
# The `target` parameters specify an existing subscription with which the
|
711
714
|
# newly created subscription should be grouped. If the target subscription
|
712
715
|
# is already part of a group, the new subscription will become a member of
|
@@ -804,12 +807,12 @@ module AdvancedBilling
|
|
804
807
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
805
808
|
.auth(Single.new('BasicAuth')))
|
806
809
|
.response(new_response_handler
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
810
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
811
|
+
.deserialize_into(SubscriptionResponse.method(:from_hash))
|
812
|
+
.local_error_template('422',
|
813
|
+
'HTTP Response Not OK. Status code: {$statusCode}.'\
|
814
|
+
' Response: \'{$response.body}\'.',
|
815
|
+
ErrorListResponseException))
|
813
816
|
.execute
|
814
817
|
end
|
815
818
|
|
@@ -903,9 +906,9 @@ module AdvancedBilling
|
|
903
906
|
.auth(Single.new('BasicAuth'))
|
904
907
|
.array_serialization_format(ArraySerializationFormat::UN_INDEXED))
|
905
908
|
.response(new_response_handler
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
910
|
+
.deserialize_into(SubscriptionResponse.method(:from_hash))
|
911
|
+
.is_response_array(true))
|
909
912
|
.execute
|
910
913
|
end
|
911
914
|
|
@@ -990,12 +993,12 @@ module AdvancedBilling
|
|
990
993
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
991
994
|
.auth(Single.new('BasicAuth')))
|
992
995
|
.response(new_response_handler
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
996
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
997
|
+
.deserialize_into(SubscriptionResponse.method(:from_hash))
|
998
|
+
.local_error_template('422',
|
999
|
+
'HTTP Response Not OK. Status code: {$statusCode}.'\
|
1000
|
+
' Response: \'{$response.body}\'.',
|
1001
|
+
ErrorListResponseException))
|
999
1002
|
.execute
|
1000
1003
|
end
|
1001
1004
|
|
@@ -1024,8 +1027,8 @@ module AdvancedBilling
|
|
1024
1027
|
.auth(Single.new('BasicAuth'))
|
1025
1028
|
.array_serialization_format(ArraySerializationFormat::UN_INDEXED))
|
1026
1029
|
.response(new_response_handler
|
1027
|
-
|
1028
|
-
|
1030
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
1031
|
+
.deserialize_into(SubscriptionResponse.method(:from_hash)))
|
1029
1032
|
.execute
|
1030
1033
|
end
|
1031
1034
|
|
@@ -1033,17 +1036,17 @@ module AdvancedBilling
|
|
1033
1036
|
# usually managed for you automatically. Some of the fields can be set via
|
1034
1037
|
# the normal Subscriptions Update API, but others can only be set using this
|
1035
1038
|
# endpoint.
|
1036
|
-
# This endpoint is provided for cases where you need to “align”
|
1037
|
-
# data with data that happened in your system, perhaps before you
|
1038
|
-
# using
|
1039
|
-
# subscription data, and would like the activation and
|
1040
|
-
#
|
1041
|
-
# backfill historical events (i.e. from the
|
1042
|
-
# data can be changed via this API.
|
1039
|
+
# This endpoint is provided for cases where you need to “align” Advanced
|
1040
|
+
# Billing data with data that happened in your system, perhaps before you
|
1041
|
+
# started using Advanced Billing. For example, you may choose to import your
|
1042
|
+
# historical subscription data, and would like the activation and
|
1043
|
+
# cancellation dates in Advanced Billing to match your existing historical
|
1044
|
+
# dates. Advanced Billing does not backfill historical events (i.e. from the
|
1045
|
+
# Events API), but some static data can be changed via this API.
|
1043
1046
|
# Why are some fields only settable from this endpoint, and not the normal
|
1044
1047
|
# subscription create and update endpoints? Because we want users of this
|
1045
|
-
# endpoint to be aware that these fields are usually managed by
|
1046
|
-
# and using this API means **you are stepping out on your own.**
|
1048
|
+
# endpoint to be aware that these fields are usually managed by Advanced
|
1049
|
+
# Billing, and using this API means **you are stepping out on your own.**
|
1047
1050
|
# Changing these fields will not affect any other attributes. For example,
|
1048
1051
|
# adding an expiration date will not affect the next assessment date on the
|
1049
1052
|
# subscription.
|
@@ -1080,11 +1083,11 @@ module AdvancedBilling
|
|
1080
1083
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
1081
1084
|
.auth(Single.new('BasicAuth')))
|
1082
1085
|
.response(new_response_handler
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1086
|
+
.is_response_void(true)
|
1087
|
+
.local_error_template('422',
|
1088
|
+
'HTTP Response Not OK. Status code: {$statusCode}.'\
|
1089
|
+
' Response: \'{$response.body}\'.',
|
1090
|
+
SingleErrorResponseException))
|
1088
1091
|
.execute
|
1089
1092
|
end
|
1090
1093
|
|
@@ -1100,8 +1103,8 @@ module AdvancedBilling
|
|
1100
1103
|
.header_param(new_parameter('application/json', key: 'accept'))
|
1101
1104
|
.auth(Single.new('BasicAuth')))
|
1102
1105
|
.response(new_response_handler
|
1103
|
-
|
1104
|
-
|
1106
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
1107
|
+
.deserialize_into(SubscriptionResponse.method(:from_hash)))
|
1105
1108
|
.execute
|
1106
1109
|
end
|
1107
1110
|
|
@@ -1139,7 +1142,7 @@ module AdvancedBilling
|
|
1139
1142
|
.auth(Single.new('BasicAuth'))
|
1140
1143
|
.array_serialization_format(ArraySerializationFormat::CSV))
|
1141
1144
|
.response(new_response_handler
|
1142
|
-
|
1145
|
+
.is_response_void(true))
|
1143
1146
|
.execute
|
1144
1147
|
end
|
1145
1148
|
|
@@ -1164,8 +1167,8 @@ module AdvancedBilling
|
|
1164
1167
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
1165
1168
|
.auth(Single.new('BasicAuth')))
|
1166
1169
|
.response(new_response_handler
|
1167
|
-
|
1168
|
-
|
1170
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
1171
|
+
.deserialize_into(PrepaidConfigurationResponse.method(:from_hash)))
|
1169
1172
|
.execute
|
1170
1173
|
end
|
1171
1174
|
|
@@ -1173,8 +1176,8 @@ module AdvancedBilling
|
|
1173
1176
|
# JSON or XML as for a subscription creation.
|
1174
1177
|
# The "Next Billing" amount and "Next Billing" date are represented in each
|
1175
1178
|
# Subscriber's Summary. For more information, please see our documentation
|
1176
|
-
# [here](https://
|
1177
|
-
#
|
1179
|
+
# [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscrib
|
1180
|
+
# er-Interface-Overview).
|
1178
1181
|
# ## Side effects
|
1179
1182
|
# A subscription will not be created by sending a POST to this endpoint. It
|
1180
1183
|
# is meant to serve as a prediction.
|
@@ -1188,16 +1191,16 @@ module AdvancedBilling
|
|
1188
1191
|
# in order to calculate tax
|
1189
1192
|
# For more information about creating taxable previews, please see our
|
1190
1193
|
# documentation guide on how to create [taxable
|
1191
|
-
# subscriptions.](https://
|
1192
|
-
#
|
1194
|
+
# subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325
|
1195
|
+
# -Taxes)
|
1193
1196
|
# You do **not** need to include a card number to generate tax information
|
1194
1197
|
# when you are previewing a subscription. However, please note that when you
|
1195
1198
|
# actually want to create the subscription, you must include the credit card
|
1196
|
-
# information if you want the billing address to be stored in
|
1197
|
-
# billing address and the credit card information are stored
|
1198
|
-
# the payment profile object. Also, you may not send a
|
1199
|
-
#
|
1200
|
-
# the card.
|
1199
|
+
# information if you want the billing address to be stored in Advanced
|
1200
|
+
# Billing. The billing address and the credit card information are stored
|
1201
|
+
# together within the payment profile object. Also, you may not send a
|
1202
|
+
# billing address to Advanced Billing without payment profile information,
|
1203
|
+
# as the address is stored on the card.
|
1201
1204
|
# You can pass shipping and billing addresses and still decide not to
|
1202
1205
|
# calculate taxes. To do that, pass `skip_billing_manifest_taxes: true`
|
1203
1206
|
# attribute.
|
@@ -1217,16 +1220,16 @@ module AdvancedBilling
|
|
1217
1220
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
1218
1221
|
.auth(Single.new('BasicAuth')))
|
1219
1222
|
.response(new_response_handler
|
1220
|
-
|
1221
|
-
|
1223
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
1224
|
+
.deserialize_into(SubscriptionPreviewResponse.method(:from_hash)))
|
1222
1225
|
.execute
|
1223
1226
|
end
|
1224
1227
|
|
1225
1228
|
# An existing subscription can accommodate multiple discounts/coupon codes.
|
1226
1229
|
# This is only applicable if each coupon is stackable. For more information
|
1227
1230
|
# on stackable coupons, we recommend reviewing our [coupon
|
1228
|
-
# documentation.](https://
|
1229
|
-
#
|
1231
|
+
# documentation.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101
|
1232
|
+
# -Coupons-and-Subscriptions#stackability-rules)
|
1230
1233
|
# ## Query Parameters vs Request Body Parameters
|
1231
1234
|
# Passing in a coupon code as a query parameter will add the code to the
|
1232
1235
|
# subscription, completely replacing all existing coupon codes on the
|
@@ -1258,20 +1261,20 @@ module AdvancedBilling
|
|
1258
1261
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
1259
1262
|
.auth(Single.new('BasicAuth')))
|
1260
1263
|
.response(new_response_handler
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1264
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
1265
|
+
.deserialize_into(SubscriptionResponse.method(:from_hash))
|
1266
|
+
.local_error_template('422',
|
1267
|
+
'HTTP Response Not OK. Status code: {$statusCode}.'\
|
1268
|
+
' Response: \'{$response.body}\'.',
|
1269
|
+
SubscriptionAddCouponErrorException))
|
1267
1270
|
.execute
|
1268
1271
|
end
|
1269
1272
|
|
1270
1273
|
# Use this endpoint to remove a coupon from an existing subscription.
|
1271
1274
|
# For more information on the expected behaviour of removing a coupon from a
|
1272
1275
|
# subscription, please see our documentation
|
1273
|
-
# [here.](https://
|
1274
|
-
#
|
1276
|
+
# [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons
|
1277
|
+
# -and-Subscriptions#removing-a-coupon)
|
1275
1278
|
# @param [Integer] subscription_id Required parameter: The Chargify id of
|
1276
1279
|
# the subscription
|
1277
1280
|
# @param [String] coupon_code Optional parameter: The coupon code
|
@@ -1288,18 +1291,18 @@ module AdvancedBilling
|
|
1288
1291
|
.query_param(new_parameter(coupon_code, key: 'coupon_code'))
|
1289
1292
|
.auth(Single.new('BasicAuth')))
|
1290
1293
|
.response(new_response_handler
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1294
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
1295
|
+
.deserialize_into(proc do |response| response.to_s end)
|
1296
|
+
.is_primitive_response(true)
|
1297
|
+
.local_error_template('422',
|
1298
|
+
'HTTP Response Not OK. Status code: {$statusCode}.'\
|
1299
|
+
' Response: \'{$response.body}\'.',
|
1300
|
+
SubscriptionRemoveCouponErrorsException))
|
1298
1301
|
.execute
|
1299
1302
|
end
|
1300
1303
|
|
1301
|
-
#
|
1302
|
-
# subscriptions. This feature is only available on the Relationship
|
1304
|
+
# Advanced Billing offers the ability to activate awaiting signup and
|
1305
|
+
# trialing subscriptions. This feature is only available on the Relationship
|
1303
1306
|
# Invoicing architecture. Subscriptions in a group may not be activated
|
1304
1307
|
# immediately.
|
1305
1308
|
# For details on how the activation works, and how to activate subscriptions
|
@@ -1307,12 +1310,12 @@ module AdvancedBilling
|
|
1307
1310
|
# The `revert_on_failure` parameter controls the behavior upon activation
|
1308
1311
|
# failure.
|
1309
1312
|
# - If set to `true` and something goes wrong i.e. payment fails, then
|
1310
|
-
#
|
1311
|
-
# billing period will also remain the same.
|
1313
|
+
# Advanced Billing will not change the subscription's state. The
|
1314
|
+
# subscription’s billing period will also remain the same.
|
1312
1315
|
# - If set to `false` and something goes wrong i.e. payment fails, then
|
1313
|
-
#
|
1314
|
-
# life state. For trialing subscriptions, that will either be trial
|
1315
|
-
# (if the trial is no obligation), past due (if the trial has an
|
1316
|
+
# Advanced Billing will continue through with the activation and enter an
|
1317
|
+
# end of life state. For trialing subscriptions, that will either be trial
|
1318
|
+
# ended (if the trial is no obligation), past due (if the trial has an
|
1316
1319
|
# obligation), or canceled (if the site has no dunning strategy, or has a
|
1317
1320
|
# strategy that says to cancel immediately). For awaiting signup
|
1318
1321
|
# subscriptions, that will always be canceled.
|
@@ -1343,8 +1346,8 @@ module AdvancedBilling
|
|
1343
1346
|
# ```
|
1344
1347
|
# ### Activate Trialing subscription
|
1345
1348
|
# You can read more about the behavior of trialing subscriptions
|
1346
|
-
# [here](https://maxio
|
1347
|
-
#
|
1349
|
+
# [here](https://maxio.zendesk.com/hc/en-us/articles/24252155721869-Trialing
|
1350
|
+
# -Subscriptions).
|
1348
1351
|
# When the `revert_on_failure` parameter is set to `true`, the
|
1349
1352
|
# subscription's state will remain as Trialing, we will void the invoice
|
1350
1353
|
# from activation and return any prepayments and credits applied to the
|
@@ -1368,12 +1371,12 @@ module AdvancedBilling
|
|
1368
1371
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
1369
1372
|
.auth(Single.new('BasicAuth')))
|
1370
1373
|
.response(new_response_handler
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1374
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
1375
|
+
.deserialize_into(SubscriptionResponse.method(:from_hash))
|
1376
|
+
.local_error_template('400',
|
1377
|
+
'HTTP Response Not OK. Status code: {$statusCode}.'\
|
1378
|
+
' Response: \'{$response.body}\'.',
|
1379
|
+
ErrorArrayMapResponseException))
|
1377
1380
|
.execute
|
1378
1381
|
end
|
1379
1382
|
end
|