cbox_billing 0.1.0 → 0.2.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/lib/cbox_billing/api/checkout_portal_api.rb +214 -0
- data/lib/cbox_billing/api/coupons_api.rb +55 -55
- data/lib/cbox_billing/api/experiments_api.rb +526 -0
- data/lib/cbox_billing/api/organizations_api.rb +554 -0
- data/lib/cbox_billing/api/pricing_tables_api.rb +519 -0
- data/lib/cbox_billing/api/retention_api.rb +884 -0
- data/lib/cbox_billing/api/sellers_api.rb +590 -0
- data/lib/cbox_billing/models/checkout_link.rb +283 -0
- data/lib/cbox_billing/models/conclude_experiment_request.rb +161 -0
- data/lib/cbox_billing/models/create_checkout_link_request.rb +178 -0
- data/lib/cbox_billing/models/customer_lifecycle_refusal.rb +238 -0
- data/lib/cbox_billing/models/customer_lifecycle_state.rb +268 -0
- data/lib/cbox_billing/models/delete_experiment200_response.rb +227 -0
- data/lib/cbox_billing/models/delete_organization200_response.rb +227 -0
- data/lib/cbox_billing/models/experiment.rb +387 -0
- data/lib/cbox_billing/models/experiment_input.rb +410 -0
- data/lib/cbox_billing/models/experiment_input_variants_inner.rb +233 -0
- data/lib/cbox_billing/models/experiment_variant.rb +266 -0
- data/lib/cbox_billing/models/list_checkout_links200_response.rb +179 -0
- data/lib/cbox_billing/models/list_checkout_links200_response_data_inner.rb +223 -0
- data/lib/cbox_billing/models/list_experiments200_response.rb +179 -0
- data/lib/cbox_billing/models/list_pricing_tables200_response.rb +179 -0
- data/lib/cbox_billing/models/list_retention_offers200_response.rb +179 -0
- data/lib/cbox_billing/models/list_retention_reasons200_response.rb +179 -0
- data/lib/cbox_billing/models/list_sellers200_response.rb +179 -0
- data/lib/cbox_billing/models/merge_organization_request.rb +221 -0
- data/lib/cbox_billing/models/merge_organization_request_fields.rb +279 -0
- data/lib/cbox_billing/models/preview_organization_merge200_response.rb +343 -0
- data/lib/cbox_billing/models/preview_organization_merge_request.rb +177 -0
- data/lib/cbox_billing/models/pricing_table.rb +426 -0
- data/lib/cbox_billing/models/pricing_table_column.rb +248 -0
- data/lib/cbox_billing/models/pricing_table_input.rb +388 -0
- data/lib/cbox_billing/models/retention_offer.rb +389 -0
- data/lib/cbox_billing/models/retention_offer_input.rb +447 -0
- data/lib/cbox_billing/models/retention_reason.rb +282 -0
- data/lib/cbox_billing/models/retention_reason_input.rb +195 -0
- data/lib/cbox_billing/models/revoke_checkout_link200_response.rb +227 -0
- data/lib/cbox_billing/models/seller.rb +551 -0
- data/lib/cbox_billing/models/seller_address.rb +201 -0
- data/lib/cbox_billing/models/seller_bank.rb +191 -0
- data/lib/cbox_billing/models/seller_input.rb +633 -0
- data/lib/cbox_billing/models/seller_input_registrations_inner.rb +188 -0
- data/lib/cbox_billing/models/seller_registrations_inner.rb +189 -0
- data/lib/cbox_billing/models/suspend_organization_request.rb +179 -0
- data/lib/cbox_billing/version.rb +1 -1
- data/lib/cbox_billing.rb +41 -0
- metadata +42 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0cb23747adfbf0a97f45911a25df550ad71abe91f00061692c7e41efbac4b374
|
|
4
|
+
data.tar.gz: 6a88460a3803fe1eddc17dbb6e71eacc5402776bb7fd8d2b89cb47ccacecd834
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d64c20052a912750eb81a6af45f64705aa1bbdff4a9edc5487e423be75be63d600d793c35b5c94350c3aed6ac6c76af60212e7f0b52c7e2cbc071a71a0d797c
|
|
7
|
+
data.tar.gz: a95fa7236fbfc55334b3d8dd146cfd5a3a8307bfa99f049ae3bcf92ccd8519910cf7273c2ad2a5b8fbca36a6edd8fc9e2f1cf50452a4244750dfac5778c57936
|
|
@@ -189,6 +189,91 @@ module CboxBilling
|
|
|
189
189
|
return data, status_code, headers
|
|
190
190
|
end
|
|
191
191
|
|
|
192
|
+
# Create a shareable checkout link
|
|
193
|
+
# A link for one customer on one plan that works for days and opens a fresh checkout session each time it is followed, as the customer page's \"Copy checkout link\" makes it. For one short-lived session, use `createCheckoutSession`. Refused (409) when the plan is not sold to the customer, is not active or not priced in its currency, the customer already subscribes to the product, or was erased. The URL is in this response only. Takes an operator token.
|
|
194
|
+
# @param org [String] The organization id (the merchant platform's own tenant key).
|
|
195
|
+
# @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is `400 idempotency_key_required`. A retry with the same key replays the first response; reusing it with a different body is `409`.
|
|
196
|
+
# @param create_checkout_link_request [CreateCheckoutLinkRequest]
|
|
197
|
+
# @param [Hash] opts the optional parameters
|
|
198
|
+
# @return [CheckoutLink]
|
|
199
|
+
def create_checkout_link(org, idempotency_key, create_checkout_link_request, opts = {})
|
|
200
|
+
data, _status_code, _headers = create_checkout_link_with_http_info(org, idempotency_key, create_checkout_link_request, opts)
|
|
201
|
+
data
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Create a shareable checkout link
|
|
205
|
+
# A link for one customer on one plan that works for days and opens a fresh checkout session each time it is followed, as the customer page's \"Copy checkout link\" makes it. For one short-lived session, use `createCheckoutSession`. Refused (409) when the plan is not sold to the customer, is not active or not priced in its currency, the customer already subscribes to the product, or was erased. The URL is in this response only. Takes an operator token.
|
|
206
|
+
# @param org [String] The organization id (the merchant platform's own tenant key).
|
|
207
|
+
# @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is `400 idempotency_key_required`. A retry with the same key replays the first response; reusing it with a different body is `409`.
|
|
208
|
+
# @param create_checkout_link_request [CreateCheckoutLinkRequest]
|
|
209
|
+
# @param [Hash] opts the optional parameters
|
|
210
|
+
# @return [Array<(CheckoutLink, Integer, Hash)>] CheckoutLink data, response status code and response headers
|
|
211
|
+
def create_checkout_link_with_http_info(org, idempotency_key, create_checkout_link_request, opts = {})
|
|
212
|
+
if @api_client.config.debugging
|
|
213
|
+
@api_client.config.logger.debug 'Calling API: CheckoutPortalApi.create_checkout_link ...'
|
|
214
|
+
end
|
|
215
|
+
# verify the required parameter 'org' is set
|
|
216
|
+
if @api_client.config.client_side_validation && org.nil?
|
|
217
|
+
fail ArgumentError, "Missing the required parameter 'org' when calling CheckoutPortalApi.create_checkout_link"
|
|
218
|
+
end
|
|
219
|
+
# verify the required parameter 'idempotency_key' is set
|
|
220
|
+
if @api_client.config.client_side_validation && idempotency_key.nil?
|
|
221
|
+
fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling CheckoutPortalApi.create_checkout_link"
|
|
222
|
+
end
|
|
223
|
+
if @api_client.config.client_side_validation && idempotency_key.to_s.length > 100
|
|
224
|
+
fail ArgumentError, 'invalid value for "idempotency_key" when calling CheckoutPortalApi.create_checkout_link, the character length must be smaller than or equal to 100.'
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# verify the required parameter 'create_checkout_link_request' is set
|
|
228
|
+
if @api_client.config.client_side_validation && create_checkout_link_request.nil?
|
|
229
|
+
fail ArgumentError, "Missing the required parameter 'create_checkout_link_request' when calling CheckoutPortalApi.create_checkout_link"
|
|
230
|
+
end
|
|
231
|
+
# resource path
|
|
232
|
+
local_var_path = '/organizations/{org}/checkout-links'.sub('{org}', CGI.escape(org.to_s))
|
|
233
|
+
|
|
234
|
+
# query parameters
|
|
235
|
+
query_params = opts[:query_params] || {}
|
|
236
|
+
|
|
237
|
+
# header parameters
|
|
238
|
+
header_params = opts[:header_params] || {}
|
|
239
|
+
# HTTP header 'Accept' (if needed)
|
|
240
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
241
|
+
# HTTP header 'Content-Type'
|
|
242
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
243
|
+
if !content_type.nil?
|
|
244
|
+
header_params['Content-Type'] = content_type
|
|
245
|
+
end
|
|
246
|
+
header_params[:'Idempotency-Key'] = idempotency_key
|
|
247
|
+
|
|
248
|
+
# form parameters
|
|
249
|
+
form_params = opts[:form_params] || {}
|
|
250
|
+
|
|
251
|
+
# http body (model)
|
|
252
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_checkout_link_request)
|
|
253
|
+
|
|
254
|
+
# return_type
|
|
255
|
+
return_type = opts[:debug_return_type] || 'CheckoutLink'
|
|
256
|
+
|
|
257
|
+
# auth_names
|
|
258
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
259
|
+
|
|
260
|
+
new_options = opts.merge(
|
|
261
|
+
:operation => :"CheckoutPortalApi.create_checkout_link",
|
|
262
|
+
:header_params => header_params,
|
|
263
|
+
:query_params => query_params,
|
|
264
|
+
:form_params => form_params,
|
|
265
|
+
:body => post_body,
|
|
266
|
+
:auth_names => auth_names,
|
|
267
|
+
:return_type => return_type
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
271
|
+
if @api_client.config.debugging
|
|
272
|
+
@api_client.config.logger.debug "API called: CheckoutPortalApi#create_checkout_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
273
|
+
end
|
|
274
|
+
return data, status_code, headers
|
|
275
|
+
end
|
|
276
|
+
|
|
192
277
|
# Open a hosted checkout session
|
|
193
278
|
# Open a hosted checkout session and return the `url` the customer completes payment at. The plan must be priced in the resolved currency (deny-by-default → `422`). A `coupon` is validated up front. A checkout for a product the org already holds is a `409`, refused before any payment is taken; the hosted page and its intent refuse it the same way if the org subscribes after the session was opened. When that subscription is a trial paused at its end for want of a billing address, the answer is instead `422 { error: billing_address_required, message, missing, portal_url }`: a plan change cannot reach the paused trial, and the portal's address step resumes it and invoices it once. A hosted checkout opened for that product collects the address the same way. `items` sells one-off products (see `GET /one-off-products`), `[{product, quantity}]`: alone without a `plan`, invoiced on their own when the payment settles; or with a plan, as lines on the subscription's first invoice (a setup fee). Each is priced from the catalog in the checkout's currency and taxed through Cbox Tax with the rest, so the page shows and the gateway charges the invoice's own gross. An unknown, archived or other-plane product, or one a product-bound token may not sell, is a `404` (`code: unknown_product`); one not priced in the currency is a `422` (`code: not_priced`), as is a repeated product or a quantity outside 1–1000. A `coupon` needs a plan. A paid checkout that sold products fires `product.purchased`.
|
|
194
279
|
# @param checkout_session_request [CheckoutSessionRequest]
|
|
@@ -619,6 +704,69 @@ module CboxBilling
|
|
|
619
704
|
return data, status_code, headers
|
|
620
705
|
end
|
|
621
706
|
|
|
707
|
+
# List a customer's live checkout links
|
|
708
|
+
# The shareable checkout links of the customer that still open a checkout, soonest to expire first. The URLs are not stored, so they are not listed. Takes an operator token.
|
|
709
|
+
# @param org [String] The organization id (the merchant platform's own tenant key).
|
|
710
|
+
# @param [Hash] opts the optional parameters
|
|
711
|
+
# @return [ListCheckoutLinks200Response]
|
|
712
|
+
def list_checkout_links(org, opts = {})
|
|
713
|
+
data, _status_code, _headers = list_checkout_links_with_http_info(org, opts)
|
|
714
|
+
data
|
|
715
|
+
end
|
|
716
|
+
|
|
717
|
+
# List a customer's live checkout links
|
|
718
|
+
# The shareable checkout links of the customer that still open a checkout, soonest to expire first. The URLs are not stored, so they are not listed. Takes an operator token.
|
|
719
|
+
# @param org [String] The organization id (the merchant platform's own tenant key).
|
|
720
|
+
# @param [Hash] opts the optional parameters
|
|
721
|
+
# @return [Array<(ListCheckoutLinks200Response, Integer, Hash)>] ListCheckoutLinks200Response data, response status code and response headers
|
|
722
|
+
def list_checkout_links_with_http_info(org, opts = {})
|
|
723
|
+
if @api_client.config.debugging
|
|
724
|
+
@api_client.config.logger.debug 'Calling API: CheckoutPortalApi.list_checkout_links ...'
|
|
725
|
+
end
|
|
726
|
+
# verify the required parameter 'org' is set
|
|
727
|
+
if @api_client.config.client_side_validation && org.nil?
|
|
728
|
+
fail ArgumentError, "Missing the required parameter 'org' when calling CheckoutPortalApi.list_checkout_links"
|
|
729
|
+
end
|
|
730
|
+
# resource path
|
|
731
|
+
local_var_path = '/organizations/{org}/checkout-links'.sub('{org}', CGI.escape(org.to_s))
|
|
732
|
+
|
|
733
|
+
# query parameters
|
|
734
|
+
query_params = opts[:query_params] || {}
|
|
735
|
+
|
|
736
|
+
# header parameters
|
|
737
|
+
header_params = opts[:header_params] || {}
|
|
738
|
+
# HTTP header 'Accept' (if needed)
|
|
739
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
740
|
+
|
|
741
|
+
# form parameters
|
|
742
|
+
form_params = opts[:form_params] || {}
|
|
743
|
+
|
|
744
|
+
# http body (model)
|
|
745
|
+
post_body = opts[:debug_body]
|
|
746
|
+
|
|
747
|
+
# return_type
|
|
748
|
+
return_type = opts[:debug_return_type] || 'ListCheckoutLinks200Response'
|
|
749
|
+
|
|
750
|
+
# auth_names
|
|
751
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
752
|
+
|
|
753
|
+
new_options = opts.merge(
|
|
754
|
+
:operation => :"CheckoutPortalApi.list_checkout_links",
|
|
755
|
+
:header_params => header_params,
|
|
756
|
+
:query_params => query_params,
|
|
757
|
+
:form_params => form_params,
|
|
758
|
+
:body => post_body,
|
|
759
|
+
:auth_names => auth_names,
|
|
760
|
+
:return_type => return_type
|
|
761
|
+
)
|
|
762
|
+
|
|
763
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
764
|
+
if @api_client.config.debugging
|
|
765
|
+
@api_client.config.logger.debug "API called: CheckoutPortalApi#list_checkout_links\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
766
|
+
end
|
|
767
|
+
return data, status_code, headers
|
|
768
|
+
end
|
|
769
|
+
|
|
622
770
|
# Reconcile a payment from its exact gateway intent
|
|
623
771
|
# Scoped to the authenticated API credential, organization and environment. Quotes expire; acceptance refuses changed price or tax. Only invoice settlement authorizes fulfilment. Payment retries recover the same intent, or report payment_reconciliation_required without another charge.
|
|
624
772
|
# @param id [String]
|
|
@@ -692,5 +840,71 @@ module CboxBilling
|
|
|
692
840
|
end
|
|
693
841
|
return data, status_code, headers
|
|
694
842
|
end
|
|
843
|
+
|
|
844
|
+
# Revoke a checkout link
|
|
845
|
+
# Following the link opens nothing from now on. A link already revoked is a 409. Takes an operator token.
|
|
846
|
+
# @param id [String] The link's id, from `createCheckoutLink` or `listCheckoutLinks`.
|
|
847
|
+
# @param [Hash] opts the optional parameters
|
|
848
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
849
|
+
# @return [RevokeCheckoutLink200Response]
|
|
850
|
+
def revoke_checkout_link(id, opts = {})
|
|
851
|
+
data, _status_code, _headers = revoke_checkout_link_with_http_info(id, opts)
|
|
852
|
+
data
|
|
853
|
+
end
|
|
854
|
+
|
|
855
|
+
# Revoke a checkout link
|
|
856
|
+
# Following the link opens nothing from now on. A link already revoked is a 409. Takes an operator token.
|
|
857
|
+
# @param id [String] The link's id, from `createCheckoutLink` or `listCheckoutLinks`.
|
|
858
|
+
# @param [Hash] opts the optional parameters
|
|
859
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
860
|
+
# @return [Array<(RevokeCheckoutLink200Response, Integer, Hash)>] RevokeCheckoutLink200Response data, response status code and response headers
|
|
861
|
+
def revoke_checkout_link_with_http_info(id, opts = {})
|
|
862
|
+
if @api_client.config.debugging
|
|
863
|
+
@api_client.config.logger.debug 'Calling API: CheckoutPortalApi.revoke_checkout_link ...'
|
|
864
|
+
end
|
|
865
|
+
# verify the required parameter 'id' is set
|
|
866
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
867
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling CheckoutPortalApi.revoke_checkout_link"
|
|
868
|
+
end
|
|
869
|
+
# resource path
|
|
870
|
+
local_var_path = '/checkout-links/{id}/revoke'.sub('{id}', CGI.escape(id.to_s))
|
|
871
|
+
|
|
872
|
+
# query parameters
|
|
873
|
+
query_params = opts[:query_params] || {}
|
|
874
|
+
|
|
875
|
+
# header parameters
|
|
876
|
+
header_params = opts[:header_params] || {}
|
|
877
|
+
# HTTP header 'Accept' (if needed)
|
|
878
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
879
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
880
|
+
|
|
881
|
+
# form parameters
|
|
882
|
+
form_params = opts[:form_params] || {}
|
|
883
|
+
|
|
884
|
+
# http body (model)
|
|
885
|
+
post_body = opts[:debug_body]
|
|
886
|
+
|
|
887
|
+
# return_type
|
|
888
|
+
return_type = opts[:debug_return_type] || 'RevokeCheckoutLink200Response'
|
|
889
|
+
|
|
890
|
+
# auth_names
|
|
891
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
892
|
+
|
|
893
|
+
new_options = opts.merge(
|
|
894
|
+
:operation => :"CheckoutPortalApi.revoke_checkout_link",
|
|
895
|
+
:header_params => header_params,
|
|
896
|
+
:query_params => query_params,
|
|
897
|
+
:form_params => form_params,
|
|
898
|
+
:body => post_body,
|
|
899
|
+
:auth_names => auth_names,
|
|
900
|
+
:return_type => return_type
|
|
901
|
+
)
|
|
902
|
+
|
|
903
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
904
|
+
if @api_client.config.debugging
|
|
905
|
+
@api_client.config.logger.debug "API called: CheckoutPortalApi#revoke_checkout_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
906
|
+
end
|
|
907
|
+
return data, status_code, headers
|
|
908
|
+
end
|
|
695
909
|
end
|
|
696
910
|
end
|
|
@@ -21,36 +21,36 @@ module CboxBilling
|
|
|
21
21
|
end
|
|
22
22
|
# Archive a coupon
|
|
23
23
|
# The code stops redeeming. Subscriptions that already carry it keep their discount. **Operator token only**, not bound to a product.
|
|
24
|
-
# @param
|
|
24
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
25
25
|
# @param [Hash] opts the optional parameters
|
|
26
26
|
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
27
27
|
# @return [CouponDefinitionDetail]
|
|
28
|
-
def archive_coupon(
|
|
29
|
-
data, _status_code, _headers = archive_coupon_with_http_info(
|
|
28
|
+
def archive_coupon(coupon, opts = {})
|
|
29
|
+
data, _status_code, _headers = archive_coupon_with_http_info(coupon, opts)
|
|
30
30
|
data
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
# Archive a coupon
|
|
34
34
|
# The code stops redeeming. Subscriptions that already carry it keep their discount. **Operator token only**, not bound to a product.
|
|
35
|
-
# @param
|
|
35
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
36
36
|
# @param [Hash] opts the optional parameters
|
|
37
37
|
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
38
38
|
# @return [Array<(CouponDefinitionDetail, Integer, Hash)>] CouponDefinitionDetail data, response status code and response headers
|
|
39
|
-
def archive_coupon_with_http_info(
|
|
39
|
+
def archive_coupon_with_http_info(coupon, opts = {})
|
|
40
40
|
if @api_client.config.debugging
|
|
41
41
|
@api_client.config.logger.debug 'Calling API: CouponsApi.archive_coupon ...'
|
|
42
42
|
end
|
|
43
|
-
# verify the required parameter '
|
|
44
|
-
if @api_client.config.client_side_validation &&
|
|
45
|
-
fail ArgumentError, "Missing the required parameter '
|
|
43
|
+
# verify the required parameter 'coupon' is set
|
|
44
|
+
if @api_client.config.client_side_validation && coupon.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'coupon' when calling CouponsApi.archive_coupon"
|
|
46
46
|
end
|
|
47
47
|
pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
|
|
48
|
-
if @api_client.config.client_side_validation &&
|
|
49
|
-
fail ArgumentError, "invalid value for '
|
|
48
|
+
if @api_client.config.client_side_validation && coupon !~ pattern
|
|
49
|
+
fail ArgumentError, "invalid value for 'coupon' when calling CouponsApi.archive_coupon, must conform to the pattern #{pattern}."
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# resource path
|
|
53
|
-
local_var_path = '/coupons/{
|
|
53
|
+
local_var_path = '/coupons/{coupon}/archive'.sub('{coupon}', CGI.escape(coupon.to_s))
|
|
54
54
|
|
|
55
55
|
# query parameters
|
|
56
56
|
query_params = opts[:query_params] || {}
|
|
@@ -171,36 +171,36 @@ module CboxBilling
|
|
|
171
171
|
|
|
172
172
|
# Delete a coupon that was never redeemed
|
|
173
173
|
# Hard-delete the coupon. A coupon that was ever redeemed is refused with `409 coupon_refused`, so its redemption history and the discounts it gave are never orphaned. Archive it instead. **Operator token only**, not bound to a product.
|
|
174
|
-
# @param
|
|
174
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
175
175
|
# @param [Hash] opts the optional parameters
|
|
176
176
|
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
177
177
|
# @return [CouponDeleted]
|
|
178
|
-
def delete_coupon(
|
|
179
|
-
data, _status_code, _headers = delete_coupon_with_http_info(
|
|
178
|
+
def delete_coupon(coupon, opts = {})
|
|
179
|
+
data, _status_code, _headers = delete_coupon_with_http_info(coupon, opts)
|
|
180
180
|
data
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
# Delete a coupon that was never redeemed
|
|
184
184
|
# Hard-delete the coupon. A coupon that was ever redeemed is refused with `409 coupon_refused`, so its redemption history and the discounts it gave are never orphaned. Archive it instead. **Operator token only**, not bound to a product.
|
|
185
|
-
# @param
|
|
185
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
186
186
|
# @param [Hash] opts the optional parameters
|
|
187
187
|
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
188
188
|
# @return [Array<(CouponDeleted, Integer, Hash)>] CouponDeleted data, response status code and response headers
|
|
189
|
-
def delete_coupon_with_http_info(
|
|
189
|
+
def delete_coupon_with_http_info(coupon, opts = {})
|
|
190
190
|
if @api_client.config.debugging
|
|
191
191
|
@api_client.config.logger.debug 'Calling API: CouponsApi.delete_coupon ...'
|
|
192
192
|
end
|
|
193
|
-
# verify the required parameter '
|
|
194
|
-
if @api_client.config.client_side_validation &&
|
|
195
|
-
fail ArgumentError, "Missing the required parameter '
|
|
193
|
+
# verify the required parameter 'coupon' is set
|
|
194
|
+
if @api_client.config.client_side_validation && coupon.nil?
|
|
195
|
+
fail ArgumentError, "Missing the required parameter 'coupon' when calling CouponsApi.delete_coupon"
|
|
196
196
|
end
|
|
197
197
|
pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
|
|
198
|
-
if @api_client.config.client_side_validation &&
|
|
199
|
-
fail ArgumentError, "invalid value for '
|
|
198
|
+
if @api_client.config.client_side_validation && coupon !~ pattern
|
|
199
|
+
fail ArgumentError, "invalid value for 'coupon' when calling CouponsApi.delete_coupon, must conform to the pattern #{pattern}."
|
|
200
200
|
end
|
|
201
201
|
|
|
202
202
|
# resource path
|
|
203
|
-
local_var_path = '/coupons/{
|
|
203
|
+
local_var_path = '/coupons/{coupon}'.sub('{coupon}', CGI.escape(coupon.to_s))
|
|
204
204
|
|
|
205
205
|
# query parameters
|
|
206
206
|
query_params = opts[:query_params] || {}
|
|
@@ -242,34 +242,34 @@ module CboxBilling
|
|
|
242
242
|
|
|
243
243
|
# Get a coupon and its latest redemptions
|
|
244
244
|
# One coupon by code (case-insensitive), with its latest 50 redemptions: the organization and the subscription that redeemed it. **Operator token only.** A code that names no coupon in the token's environment is `404`, including a code that exists in another environment or another tenant.
|
|
245
|
-
# @param
|
|
245
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
246
246
|
# @param [Hash] opts the optional parameters
|
|
247
247
|
# @return [CouponDefinitionDetail]
|
|
248
|
-
def get_coupon(
|
|
249
|
-
data, _status_code, _headers = get_coupon_with_http_info(
|
|
248
|
+
def get_coupon(coupon, opts = {})
|
|
249
|
+
data, _status_code, _headers = get_coupon_with_http_info(coupon, opts)
|
|
250
250
|
data
|
|
251
251
|
end
|
|
252
252
|
|
|
253
253
|
# Get a coupon and its latest redemptions
|
|
254
254
|
# One coupon by code (case-insensitive), with its latest 50 redemptions: the organization and the subscription that redeemed it. **Operator token only.** A code that names no coupon in the token's environment is `404`, including a code that exists in another environment or another tenant.
|
|
255
|
-
# @param
|
|
255
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
256
256
|
# @param [Hash] opts the optional parameters
|
|
257
257
|
# @return [Array<(CouponDefinitionDetail, Integer, Hash)>] CouponDefinitionDetail data, response status code and response headers
|
|
258
|
-
def get_coupon_with_http_info(
|
|
258
|
+
def get_coupon_with_http_info(coupon, opts = {})
|
|
259
259
|
if @api_client.config.debugging
|
|
260
260
|
@api_client.config.logger.debug 'Calling API: CouponsApi.get_coupon ...'
|
|
261
261
|
end
|
|
262
|
-
# verify the required parameter '
|
|
263
|
-
if @api_client.config.client_side_validation &&
|
|
264
|
-
fail ArgumentError, "Missing the required parameter '
|
|
262
|
+
# verify the required parameter 'coupon' is set
|
|
263
|
+
if @api_client.config.client_side_validation && coupon.nil?
|
|
264
|
+
fail ArgumentError, "Missing the required parameter 'coupon' when calling CouponsApi.get_coupon"
|
|
265
265
|
end
|
|
266
266
|
pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
|
|
267
|
-
if @api_client.config.client_side_validation &&
|
|
268
|
-
fail ArgumentError, "invalid value for '
|
|
267
|
+
if @api_client.config.client_side_validation && coupon !~ pattern
|
|
268
|
+
fail ArgumentError, "invalid value for 'coupon' when calling CouponsApi.get_coupon, must conform to the pattern #{pattern}."
|
|
269
269
|
end
|
|
270
270
|
|
|
271
271
|
# resource path
|
|
272
|
-
local_var_path = '/coupons/{
|
|
272
|
+
local_var_path = '/coupons/{coupon}'.sub('{coupon}', CGI.escape(coupon.to_s))
|
|
273
273
|
|
|
274
274
|
# query parameters
|
|
275
275
|
query_params = opts[:query_params] || {}
|
|
@@ -384,36 +384,36 @@ module CboxBilling
|
|
|
384
384
|
|
|
385
385
|
# Reinstate an archived coupon
|
|
386
386
|
# The code redeems again. **Operator token only**, not bound to a product.
|
|
387
|
-
# @param
|
|
387
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
388
388
|
# @param [Hash] opts the optional parameters
|
|
389
389
|
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
390
390
|
# @return [CouponDefinitionDetail]
|
|
391
|
-
def unarchive_coupon(
|
|
392
|
-
data, _status_code, _headers = unarchive_coupon_with_http_info(
|
|
391
|
+
def unarchive_coupon(coupon, opts = {})
|
|
392
|
+
data, _status_code, _headers = unarchive_coupon_with_http_info(coupon, opts)
|
|
393
393
|
data
|
|
394
394
|
end
|
|
395
395
|
|
|
396
396
|
# Reinstate an archived coupon
|
|
397
397
|
# The code redeems again. **Operator token only**, not bound to a product.
|
|
398
|
-
# @param
|
|
398
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
399
399
|
# @param [Hash] opts the optional parameters
|
|
400
400
|
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
401
401
|
# @return [Array<(CouponDefinitionDetail, Integer, Hash)>] CouponDefinitionDetail data, response status code and response headers
|
|
402
|
-
def unarchive_coupon_with_http_info(
|
|
402
|
+
def unarchive_coupon_with_http_info(coupon, opts = {})
|
|
403
403
|
if @api_client.config.debugging
|
|
404
404
|
@api_client.config.logger.debug 'Calling API: CouponsApi.unarchive_coupon ...'
|
|
405
405
|
end
|
|
406
|
-
# verify the required parameter '
|
|
407
|
-
if @api_client.config.client_side_validation &&
|
|
408
|
-
fail ArgumentError, "Missing the required parameter '
|
|
406
|
+
# verify the required parameter 'coupon' is set
|
|
407
|
+
if @api_client.config.client_side_validation && coupon.nil?
|
|
408
|
+
fail ArgumentError, "Missing the required parameter 'coupon' when calling CouponsApi.unarchive_coupon"
|
|
409
409
|
end
|
|
410
410
|
pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
|
|
411
|
-
if @api_client.config.client_side_validation &&
|
|
412
|
-
fail ArgumentError, "invalid value for '
|
|
411
|
+
if @api_client.config.client_side_validation && coupon !~ pattern
|
|
412
|
+
fail ArgumentError, "invalid value for 'coupon' when calling CouponsApi.unarchive_coupon, must conform to the pattern #{pattern}."
|
|
413
413
|
end
|
|
414
414
|
|
|
415
415
|
# resource path
|
|
416
|
-
local_var_path = '/coupons/{
|
|
416
|
+
local_var_path = '/coupons/{coupon}/unarchive'.sub('{coupon}', CGI.escape(coupon.to_s))
|
|
417
417
|
|
|
418
418
|
# query parameters
|
|
419
419
|
query_params = opts[:query_params] || {}
|
|
@@ -455,34 +455,34 @@ module CboxBilling
|
|
|
455
455
|
|
|
456
456
|
# Replace a coupon's definition
|
|
457
457
|
# Replace the coupon's definition, as the console's edit form does. The body is the whole coupon, under the same rules as create. When `active` is omitted, the coupon keeps its current state. A subscription that already carries the coupon keeps the terms it was bound with, so an edit never reprices a subscriber. **Operator token only**, not bound to a product. Send an `Idempotency-Key` to make a retry safe.
|
|
458
|
-
# @param
|
|
458
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
459
459
|
# @param coupon_request [CouponRequest]
|
|
460
460
|
# @param [Hash] opts the optional parameters
|
|
461
461
|
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
462
462
|
# @return [CouponDefinitionDetail]
|
|
463
|
-
def update_coupon(
|
|
464
|
-
data, _status_code, _headers = update_coupon_with_http_info(
|
|
463
|
+
def update_coupon(coupon, coupon_request, opts = {})
|
|
464
|
+
data, _status_code, _headers = update_coupon_with_http_info(coupon, coupon_request, opts)
|
|
465
465
|
data
|
|
466
466
|
end
|
|
467
467
|
|
|
468
468
|
# Replace a coupon's definition
|
|
469
469
|
# Replace the coupon's definition, as the console's edit form does. The body is the whole coupon, under the same rules as create. When `active` is omitted, the coupon keeps its current state. A subscription that already carries the coupon keeps the terms it was bound with, so an edit never reprices a subscriber. **Operator token only**, not bound to a product. Send an `Idempotency-Key` to make a retry safe.
|
|
470
|
-
# @param
|
|
470
|
+
# @param coupon [String] The coupon's public id (`cpn_…`) or its code (the promo code), case-insensitive.
|
|
471
471
|
# @param coupon_request [CouponRequest]
|
|
472
472
|
# @param [Hash] opts the optional parameters
|
|
473
473
|
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
474
474
|
# @return [Array<(CouponDefinitionDetail, Integer, Hash)>] CouponDefinitionDetail data, response status code and response headers
|
|
475
|
-
def update_coupon_with_http_info(
|
|
475
|
+
def update_coupon_with_http_info(coupon, coupon_request, opts = {})
|
|
476
476
|
if @api_client.config.debugging
|
|
477
477
|
@api_client.config.logger.debug 'Calling API: CouponsApi.update_coupon ...'
|
|
478
478
|
end
|
|
479
|
-
# verify the required parameter '
|
|
480
|
-
if @api_client.config.client_side_validation &&
|
|
481
|
-
fail ArgumentError, "Missing the required parameter '
|
|
479
|
+
# verify the required parameter 'coupon' is set
|
|
480
|
+
if @api_client.config.client_side_validation && coupon.nil?
|
|
481
|
+
fail ArgumentError, "Missing the required parameter 'coupon' when calling CouponsApi.update_coupon"
|
|
482
482
|
end
|
|
483
483
|
pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
|
|
484
|
-
if @api_client.config.client_side_validation &&
|
|
485
|
-
fail ArgumentError, "invalid value for '
|
|
484
|
+
if @api_client.config.client_side_validation && coupon !~ pattern
|
|
485
|
+
fail ArgumentError, "invalid value for 'coupon' when calling CouponsApi.update_coupon, must conform to the pattern #{pattern}."
|
|
486
486
|
end
|
|
487
487
|
|
|
488
488
|
# verify the required parameter 'coupon_request' is set
|
|
@@ -490,7 +490,7 @@ module CboxBilling
|
|
|
490
490
|
fail ArgumentError, "Missing the required parameter 'coupon_request' when calling CouponsApi.update_coupon"
|
|
491
491
|
end
|
|
492
492
|
# resource path
|
|
493
|
-
local_var_path = '/coupons/{
|
|
493
|
+
local_var_path = '/coupons/{coupon}'.sub('{coupon}', CGI.escape(coupon.to_s))
|
|
494
494
|
|
|
495
495
|
# query parameters
|
|
496
496
|
query_params = opts[:query_params] || {}
|