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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cbox_billing/api/checkout_portal_api.rb +214 -0
  3. data/lib/cbox_billing/api/coupons_api.rb +55 -55
  4. data/lib/cbox_billing/api/experiments_api.rb +526 -0
  5. data/lib/cbox_billing/api/organizations_api.rb +554 -0
  6. data/lib/cbox_billing/api/pricing_tables_api.rb +519 -0
  7. data/lib/cbox_billing/api/retention_api.rb +884 -0
  8. data/lib/cbox_billing/api/sellers_api.rb +590 -0
  9. data/lib/cbox_billing/models/checkout_link.rb +283 -0
  10. data/lib/cbox_billing/models/conclude_experiment_request.rb +161 -0
  11. data/lib/cbox_billing/models/create_checkout_link_request.rb +178 -0
  12. data/lib/cbox_billing/models/customer_lifecycle_refusal.rb +238 -0
  13. data/lib/cbox_billing/models/customer_lifecycle_state.rb +268 -0
  14. data/lib/cbox_billing/models/delete_experiment200_response.rb +227 -0
  15. data/lib/cbox_billing/models/delete_organization200_response.rb +227 -0
  16. data/lib/cbox_billing/models/experiment.rb +387 -0
  17. data/lib/cbox_billing/models/experiment_input.rb +410 -0
  18. data/lib/cbox_billing/models/experiment_input_variants_inner.rb +233 -0
  19. data/lib/cbox_billing/models/experiment_variant.rb +266 -0
  20. data/lib/cbox_billing/models/list_checkout_links200_response.rb +179 -0
  21. data/lib/cbox_billing/models/list_checkout_links200_response_data_inner.rb +223 -0
  22. data/lib/cbox_billing/models/list_experiments200_response.rb +179 -0
  23. data/lib/cbox_billing/models/list_pricing_tables200_response.rb +179 -0
  24. data/lib/cbox_billing/models/list_retention_offers200_response.rb +179 -0
  25. data/lib/cbox_billing/models/list_retention_reasons200_response.rb +179 -0
  26. data/lib/cbox_billing/models/list_sellers200_response.rb +179 -0
  27. data/lib/cbox_billing/models/merge_organization_request.rb +221 -0
  28. data/lib/cbox_billing/models/merge_organization_request_fields.rb +279 -0
  29. data/lib/cbox_billing/models/preview_organization_merge200_response.rb +343 -0
  30. data/lib/cbox_billing/models/preview_organization_merge_request.rb +177 -0
  31. data/lib/cbox_billing/models/pricing_table.rb +426 -0
  32. data/lib/cbox_billing/models/pricing_table_column.rb +248 -0
  33. data/lib/cbox_billing/models/pricing_table_input.rb +388 -0
  34. data/lib/cbox_billing/models/retention_offer.rb +389 -0
  35. data/lib/cbox_billing/models/retention_offer_input.rb +447 -0
  36. data/lib/cbox_billing/models/retention_reason.rb +282 -0
  37. data/lib/cbox_billing/models/retention_reason_input.rb +195 -0
  38. data/lib/cbox_billing/models/revoke_checkout_link200_response.rb +227 -0
  39. data/lib/cbox_billing/models/seller.rb +551 -0
  40. data/lib/cbox_billing/models/seller_address.rb +201 -0
  41. data/lib/cbox_billing/models/seller_bank.rb +191 -0
  42. data/lib/cbox_billing/models/seller_input.rb +633 -0
  43. data/lib/cbox_billing/models/seller_input_registrations_inner.rb +188 -0
  44. data/lib/cbox_billing/models/seller_registrations_inner.rb +189 -0
  45. data/lib/cbox_billing/models/suspend_organization_request.rb +179 -0
  46. data/lib/cbox_billing/version.rb +1 -1
  47. data/lib/cbox_billing.rb +41 -0
  48. metadata +42 -1
@@ -19,6 +19,72 @@ module CboxBilling
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Archive a customer
23
+ # Takes the customer out of the lists and pickers; its history stays. Refused (409) while it has a live subscription or an open balance. Takes an operator token.
24
+ # @param org [String] The organization id (the merchant platform's own tenant key).
25
+ # @param [Hash] opts the optional parameters
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
+ # @return [CustomerLifecycleState]
28
+ def archive_organization(org, opts = {})
29
+ data, _status_code, _headers = archive_organization_with_http_info(org, opts)
30
+ data
31
+ end
32
+
33
+ # Archive a customer
34
+ # Takes the customer out of the lists and pickers; its history stays. Refused (409) while it has a live subscription or an open balance. Takes an operator token.
35
+ # @param org [String] The organization id (the merchant platform's own tenant key).
36
+ # @param [Hash] opts the optional parameters
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
+ # @return [Array<(CustomerLifecycleState, Integer, Hash)>] CustomerLifecycleState data, response status code and response headers
39
+ def archive_organization_with_http_info(org, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: OrganizationsApi.archive_organization ...'
42
+ end
43
+ # verify the required parameter 'org' is set
44
+ if @api_client.config.client_side_validation && org.nil?
45
+ fail ArgumentError, "Missing the required parameter 'org' when calling OrganizationsApi.archive_organization"
46
+ end
47
+ # resource path
48
+ local_var_path = '/organizations/{org}/archive'.sub('{org}', CGI.escape(org.to_s))
49
+
50
+ # query parameters
51
+ query_params = opts[:query_params] || {}
52
+
53
+ # header parameters
54
+ header_params = opts[:header_params] || {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
57
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
58
+
59
+ # form parameters
60
+ form_params = opts[:form_params] || {}
61
+
62
+ # http body (model)
63
+ post_body = opts[:debug_body]
64
+
65
+ # return_type
66
+ return_type = opts[:debug_return_type] || 'CustomerLifecycleState'
67
+
68
+ # auth_names
69
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
70
+
71
+ new_options = opts.merge(
72
+ :operation => :"OrganizationsApi.archive_organization",
73
+ :header_params => header_params,
74
+ :query_params => query_params,
75
+ :form_params => form_params,
76
+ :body => post_body,
77
+ :auth_names => auth_names,
78
+ :return_type => return_type
79
+ )
80
+
81
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
82
+ if @api_client.config.debugging
83
+ @api_client.config.logger.debug "API called: OrganizationsApi#archive_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
84
+ end
85
+ return data, status_code, headers
86
+ end
87
+
22
88
  # Cancel a pending increase request
23
89
  # Product-scoped resource ceilings. No price, invoice or monetary credit limit changes. Name product or use a product-bound token. Review and revocation require an operator token. See the management guide for replay, expiry and admission requirements.
24
90
  # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
@@ -246,6 +312,72 @@ module CboxBilling
246
312
  return data, status_code, headers
247
313
  end
248
314
 
315
+ # Delete a customer with no history
316
+ # Deletes the customer, as the console's Delete does. Only a customer with no financial or legal history (invoices, payments, credit, subscriptions, agreements, usage) can be deleted; otherwise 409 with the reasons, and archive it instead. Takes an operator token.
317
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
318
+ # @param [Hash] opts the optional parameters
319
+ # @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 &#x60;409&#x60;.
320
+ # @return [DeleteOrganization200Response]
321
+ def delete_organization(org, opts = {})
322
+ data, _status_code, _headers = delete_organization_with_http_info(org, opts)
323
+ data
324
+ end
325
+
326
+ # Delete a customer with no history
327
+ # Deletes the customer, as the console&#39;s Delete does. Only a customer with no financial or legal history (invoices, payments, credit, subscriptions, agreements, usage) can be deleted; otherwise 409 with the reasons, and archive it instead. Takes an operator token.
328
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
329
+ # @param [Hash] opts the optional parameters
330
+ # @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 &#x60;409&#x60;.
331
+ # @return [Array<(DeleteOrganization200Response, Integer, Hash)>] DeleteOrganization200Response data, response status code and response headers
332
+ def delete_organization_with_http_info(org, opts = {})
333
+ if @api_client.config.debugging
334
+ @api_client.config.logger.debug 'Calling API: OrganizationsApi.delete_organization ...'
335
+ end
336
+ # verify the required parameter 'org' is set
337
+ if @api_client.config.client_side_validation && org.nil?
338
+ fail ArgumentError, "Missing the required parameter 'org' when calling OrganizationsApi.delete_organization"
339
+ end
340
+ # resource path
341
+ local_var_path = '/organizations/{org}'.sub('{org}', CGI.escape(org.to_s))
342
+
343
+ # query parameters
344
+ query_params = opts[:query_params] || {}
345
+
346
+ # header parameters
347
+ header_params = opts[:header_params] || {}
348
+ # HTTP header 'Accept' (if needed)
349
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
350
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
351
+
352
+ # form parameters
353
+ form_params = opts[:form_params] || {}
354
+
355
+ # http body (model)
356
+ post_body = opts[:debug_body]
357
+
358
+ # return_type
359
+ return_type = opts[:debug_return_type] || 'DeleteOrganization200Response'
360
+
361
+ # auth_names
362
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
363
+
364
+ new_options = opts.merge(
365
+ :operation => :"OrganizationsApi.delete_organization",
366
+ :header_params => header_params,
367
+ :query_params => query_params,
368
+ :form_params => form_params,
369
+ :body => post_body,
370
+ :auth_names => auth_names,
371
+ :return_type => return_type
372
+ )
373
+
374
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
375
+ if @api_client.config.debugging
376
+ @api_client.config.logger.debug "API called: OrganizationsApi#delete_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
377
+ end
378
+ return data, status_code, headers
379
+ end
380
+
249
381
  # Who pays for this organization, and who it pays for
250
382
  # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
251
383
  # @param [Hash] opts the optional parameters
@@ -565,6 +697,223 @@ module CboxBilling
565
697
  return data, status_code, headers
566
698
  end
567
699
 
700
+ # Merge this customer into another
701
+ # This customer goes into `into`: its subscriptions, invoices, payment methods and keys move, and its old ids and keys lead to the one that stays. Run `previewOrganizationMerge` first. Refused (409) by the preview's `blockers`, such as different currencies with live subscriptions. Undo with `undoOrganizationMerge` while nothing new happened on the one that stays. Takes an operator token.
702
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
703
+ # @param merge_organization_request [MergeOrganizationRequest]
704
+ # @param [Hash] opts the optional parameters
705
+ # @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 &#x60;409&#x60;.
706
+ # @return [CustomerLifecycleState]
707
+ def merge_organization(org, merge_organization_request, opts = {})
708
+ data, _status_code, _headers = merge_organization_with_http_info(org, merge_organization_request, opts)
709
+ data
710
+ end
711
+
712
+ # Merge this customer into another
713
+ # This customer goes into &#x60;into&#x60;: its subscriptions, invoices, payment methods and keys move, and its old ids and keys lead to the one that stays. Run &#x60;previewOrganizationMerge&#x60; first. Refused (409) by the preview&#39;s &#x60;blockers&#x60;, such as different currencies with live subscriptions. Undo with &#x60;undoOrganizationMerge&#x60; while nothing new happened on the one that stays. Takes an operator token.
714
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
715
+ # @param merge_organization_request [MergeOrganizationRequest]
716
+ # @param [Hash] opts the optional parameters
717
+ # @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 &#x60;409&#x60;.
718
+ # @return [Array<(CustomerLifecycleState, Integer, Hash)>] CustomerLifecycleState data, response status code and response headers
719
+ def merge_organization_with_http_info(org, merge_organization_request, opts = {})
720
+ if @api_client.config.debugging
721
+ @api_client.config.logger.debug 'Calling API: OrganizationsApi.merge_organization ...'
722
+ end
723
+ # verify the required parameter 'org' is set
724
+ if @api_client.config.client_side_validation && org.nil?
725
+ fail ArgumentError, "Missing the required parameter 'org' when calling OrganizationsApi.merge_organization"
726
+ end
727
+ # verify the required parameter 'merge_organization_request' is set
728
+ if @api_client.config.client_side_validation && merge_organization_request.nil?
729
+ fail ArgumentError, "Missing the required parameter 'merge_organization_request' when calling OrganizationsApi.merge_organization"
730
+ end
731
+ # resource path
732
+ local_var_path = '/organizations/{org}/merge'.sub('{org}', CGI.escape(org.to_s))
733
+
734
+ # query parameters
735
+ query_params = opts[:query_params] || {}
736
+
737
+ # header parameters
738
+ header_params = opts[:header_params] || {}
739
+ # HTTP header 'Accept' (if needed)
740
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
741
+ # HTTP header 'Content-Type'
742
+ content_type = @api_client.select_header_content_type(['application/json'])
743
+ if !content_type.nil?
744
+ header_params['Content-Type'] = content_type
745
+ end
746
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
747
+
748
+ # form parameters
749
+ form_params = opts[:form_params] || {}
750
+
751
+ # http body (model)
752
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(merge_organization_request)
753
+
754
+ # return_type
755
+ return_type = opts[:debug_return_type] || 'CustomerLifecycleState'
756
+
757
+ # auth_names
758
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
759
+
760
+ new_options = opts.merge(
761
+ :operation => :"OrganizationsApi.merge_organization",
762
+ :header_params => header_params,
763
+ :query_params => query_params,
764
+ :form_params => form_params,
765
+ :body => post_body,
766
+ :auth_names => auth_names,
767
+ :return_type => return_type
768
+ )
769
+
770
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
771
+ if @api_client.config.debugging
772
+ @api_client.config.logger.debug "API called: OrganizationsApi#merge_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
773
+ end
774
+ return data, status_code, headers
775
+ end
776
+
777
+ # Preview merging this customer into another
778
+ # What a merge would do, changing nothing: each field on both customers with the suggested value, the products both have live (`conflicts`, to choose with `keep`), what moves, what stays, and the `blockers` that would refuse it. Takes an operator token.
779
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
780
+ # @param preview_organization_merge_request [PreviewOrganizationMergeRequest]
781
+ # @param [Hash] opts the optional parameters
782
+ # @return [PreviewOrganizationMerge200Response]
783
+ def preview_organization_merge(org, preview_organization_merge_request, opts = {})
784
+ data, _status_code, _headers = preview_organization_merge_with_http_info(org, preview_organization_merge_request, opts)
785
+ data
786
+ end
787
+
788
+ # Preview merging this customer into another
789
+ # What a merge would do, changing nothing: each field on both customers with the suggested value, the products both have live (&#x60;conflicts&#x60;, to choose with &#x60;keep&#x60;), what moves, what stays, and the &#x60;blockers&#x60; that would refuse it. Takes an operator token.
790
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
791
+ # @param preview_organization_merge_request [PreviewOrganizationMergeRequest]
792
+ # @param [Hash] opts the optional parameters
793
+ # @return [Array<(PreviewOrganizationMerge200Response, Integer, Hash)>] PreviewOrganizationMerge200Response data, response status code and response headers
794
+ def preview_organization_merge_with_http_info(org, preview_organization_merge_request, opts = {})
795
+ if @api_client.config.debugging
796
+ @api_client.config.logger.debug 'Calling API: OrganizationsApi.preview_organization_merge ...'
797
+ end
798
+ # verify the required parameter 'org' is set
799
+ if @api_client.config.client_side_validation && org.nil?
800
+ fail ArgumentError, "Missing the required parameter 'org' when calling OrganizationsApi.preview_organization_merge"
801
+ end
802
+ # verify the required parameter 'preview_organization_merge_request' is set
803
+ if @api_client.config.client_side_validation && preview_organization_merge_request.nil?
804
+ fail ArgumentError, "Missing the required parameter 'preview_organization_merge_request' when calling OrganizationsApi.preview_organization_merge"
805
+ end
806
+ # resource path
807
+ local_var_path = '/organizations/{org}/merge/preview'.sub('{org}', CGI.escape(org.to_s))
808
+
809
+ # query parameters
810
+ query_params = opts[:query_params] || {}
811
+
812
+ # header parameters
813
+ header_params = opts[:header_params] || {}
814
+ # HTTP header 'Accept' (if needed)
815
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
816
+ # HTTP header 'Content-Type'
817
+ content_type = @api_client.select_header_content_type(['application/json'])
818
+ if !content_type.nil?
819
+ header_params['Content-Type'] = content_type
820
+ end
821
+
822
+ # form parameters
823
+ form_params = opts[:form_params] || {}
824
+
825
+ # http body (model)
826
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(preview_organization_merge_request)
827
+
828
+ # return_type
829
+ return_type = opts[:debug_return_type] || 'PreviewOrganizationMerge200Response'
830
+
831
+ # auth_names
832
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
833
+
834
+ new_options = opts.merge(
835
+ :operation => :"OrganizationsApi.preview_organization_merge",
836
+ :header_params => header_params,
837
+ :query_params => query_params,
838
+ :form_params => form_params,
839
+ :body => post_body,
840
+ :auth_names => auth_names,
841
+ :return_type => return_type
842
+ )
843
+
844
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
845
+ if @api_client.config.debugging
846
+ @api_client.config.logger.debug "API called: OrganizationsApi#preview_organization_merge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
847
+ end
848
+ return data, status_code, headers
849
+ end
850
+
851
+ # Reactivate a suspended customer
852
+ # Lifts an operator suspension. Takes an operator token.
853
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
854
+ # @param [Hash] opts the optional parameters
855
+ # @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 &#x60;409&#x60;.
856
+ # @return [CustomerLifecycleState]
857
+ def reactivate_organization(org, opts = {})
858
+ data, _status_code, _headers = reactivate_organization_with_http_info(org, opts)
859
+ data
860
+ end
861
+
862
+ # Reactivate a suspended customer
863
+ # Lifts an operator suspension. Takes an operator token.
864
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
865
+ # @param [Hash] opts the optional parameters
866
+ # @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 &#x60;409&#x60;.
867
+ # @return [Array<(CustomerLifecycleState, Integer, Hash)>] CustomerLifecycleState data, response status code and response headers
868
+ def reactivate_organization_with_http_info(org, opts = {})
869
+ if @api_client.config.debugging
870
+ @api_client.config.logger.debug 'Calling API: OrganizationsApi.reactivate_organization ...'
871
+ end
872
+ # verify the required parameter 'org' is set
873
+ if @api_client.config.client_side_validation && org.nil?
874
+ fail ArgumentError, "Missing the required parameter 'org' when calling OrganizationsApi.reactivate_organization"
875
+ end
876
+ # resource path
877
+ local_var_path = '/organizations/{org}/reactivate'.sub('{org}', CGI.escape(org.to_s))
878
+
879
+ # query parameters
880
+ query_params = opts[:query_params] || {}
881
+
882
+ # header parameters
883
+ header_params = opts[:header_params] || {}
884
+ # HTTP header 'Accept' (if needed)
885
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
886
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
887
+
888
+ # form parameters
889
+ form_params = opts[:form_params] || {}
890
+
891
+ # http body (model)
892
+ post_body = opts[:debug_body]
893
+
894
+ # return_type
895
+ return_type = opts[:debug_return_type] || 'CustomerLifecycleState'
896
+
897
+ # auth_names
898
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
899
+
900
+ new_options = opts.merge(
901
+ :operation => :"OrganizationsApi.reactivate_organization",
902
+ :header_params => header_params,
903
+ :query_params => query_params,
904
+ :form_params => form_params,
905
+ :body => post_body,
906
+ :auth_names => auth_names,
907
+ :return_type => return_type
908
+ )
909
+
910
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
911
+ if @api_client.config.debugging
912
+ @api_client.config.logger.debug "API called: OrganizationsApi#reactivate_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
913
+ end
914
+ return data, status_code, headers
915
+ end
916
+
568
917
  # This organization pays for itself again
569
918
  # Applies from its next invoice. Takes an operator token.
570
919
  # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
@@ -950,6 +1299,211 @@ module CboxBilling
950
1299
  return data, status_code, headers
951
1300
  end
952
1301
 
1302
+ # Suspend a customer
1303
+ # Withholds paid features and stops renewals; what is owed stays payable. Goes through the same approval policy as the console's Suspend: when the policy holds it, the answer is `202 { status: pending_approval, approval }` and nothing is suspended yet. An internal organization is never suspended (409 `internal`). Takes an operator token.
1304
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1305
+ # @param [Hash] opts the optional parameters
1306
+ # @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 &#x60;409&#x60;.
1307
+ # @option opts [SuspendOrganizationRequest] :suspend_organization_request
1308
+ # @return [CustomerLifecycleState]
1309
+ def suspend_organization(org, opts = {})
1310
+ data, _status_code, _headers = suspend_organization_with_http_info(org, opts)
1311
+ data
1312
+ end
1313
+
1314
+ # Suspend a customer
1315
+ # Withholds paid features and stops renewals; what is owed stays payable. Goes through the same approval policy as the console&#39;s Suspend: when the policy holds it, the answer is &#x60;202 { status: pending_approval, approval }&#x60; and nothing is suspended yet. An internal organization is never suspended (409 &#x60;internal&#x60;). Takes an operator token.
1316
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1317
+ # @param [Hash] opts the optional parameters
1318
+ # @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 &#x60;409&#x60;.
1319
+ # @option opts [SuspendOrganizationRequest] :suspend_organization_request
1320
+ # @return [Array<(CustomerLifecycleState, Integer, Hash)>] CustomerLifecycleState data, response status code and response headers
1321
+ def suspend_organization_with_http_info(org, opts = {})
1322
+ if @api_client.config.debugging
1323
+ @api_client.config.logger.debug 'Calling API: OrganizationsApi.suspend_organization ...'
1324
+ end
1325
+ # verify the required parameter 'org' is set
1326
+ if @api_client.config.client_side_validation && org.nil?
1327
+ fail ArgumentError, "Missing the required parameter 'org' when calling OrganizationsApi.suspend_organization"
1328
+ end
1329
+ # resource path
1330
+ local_var_path = '/organizations/{org}/suspend'.sub('{org}', CGI.escape(org.to_s))
1331
+
1332
+ # query parameters
1333
+ query_params = opts[:query_params] || {}
1334
+
1335
+ # header parameters
1336
+ header_params = opts[:header_params] || {}
1337
+ # HTTP header 'Accept' (if needed)
1338
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1339
+ # HTTP header 'Content-Type'
1340
+ content_type = @api_client.select_header_content_type(['application/json'])
1341
+ if !content_type.nil?
1342
+ header_params['Content-Type'] = content_type
1343
+ end
1344
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1345
+
1346
+ # form parameters
1347
+ form_params = opts[:form_params] || {}
1348
+
1349
+ # http body (model)
1350
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'suspend_organization_request'])
1351
+
1352
+ # return_type
1353
+ return_type = opts[:debug_return_type] || 'CustomerLifecycleState'
1354
+
1355
+ # auth_names
1356
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1357
+
1358
+ new_options = opts.merge(
1359
+ :operation => :"OrganizationsApi.suspend_organization",
1360
+ :header_params => header_params,
1361
+ :query_params => query_params,
1362
+ :form_params => form_params,
1363
+ :body => post_body,
1364
+ :auth_names => auth_names,
1365
+ :return_type => return_type
1366
+ )
1367
+
1368
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1369
+ if @api_client.config.debugging
1370
+ @api_client.config.logger.debug "API called: OrganizationsApi#suspend_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1371
+ end
1372
+ return data, status_code, headers
1373
+ end
1374
+
1375
+ # Bring an archived customer back
1376
+ # Puts the customer back in the lists. Takes an operator token.
1377
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1378
+ # @param [Hash] opts the optional parameters
1379
+ # @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 &#x60;409&#x60;.
1380
+ # @return [CustomerLifecycleState]
1381
+ def unarchive_organization(org, opts = {})
1382
+ data, _status_code, _headers = unarchive_organization_with_http_info(org, opts)
1383
+ data
1384
+ end
1385
+
1386
+ # Bring an archived customer back
1387
+ # Puts the customer back in the lists. Takes an operator token.
1388
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1389
+ # @param [Hash] opts the optional parameters
1390
+ # @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 &#x60;409&#x60;.
1391
+ # @return [Array<(CustomerLifecycleState, Integer, Hash)>] CustomerLifecycleState data, response status code and response headers
1392
+ def unarchive_organization_with_http_info(org, opts = {})
1393
+ if @api_client.config.debugging
1394
+ @api_client.config.logger.debug 'Calling API: OrganizationsApi.unarchive_organization ...'
1395
+ end
1396
+ # verify the required parameter 'org' is set
1397
+ if @api_client.config.client_side_validation && org.nil?
1398
+ fail ArgumentError, "Missing the required parameter 'org' when calling OrganizationsApi.unarchive_organization"
1399
+ end
1400
+ # resource path
1401
+ local_var_path = '/organizations/{org}/unarchive'.sub('{org}', CGI.escape(org.to_s))
1402
+
1403
+ # query parameters
1404
+ query_params = opts[:query_params] || {}
1405
+
1406
+ # header parameters
1407
+ header_params = opts[:header_params] || {}
1408
+ # HTTP header 'Accept' (if needed)
1409
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1410
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1411
+
1412
+ # form parameters
1413
+ form_params = opts[:form_params] || {}
1414
+
1415
+ # http body (model)
1416
+ post_body = opts[:debug_body]
1417
+
1418
+ # return_type
1419
+ return_type = opts[:debug_return_type] || 'CustomerLifecycleState'
1420
+
1421
+ # auth_names
1422
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1423
+
1424
+ new_options = opts.merge(
1425
+ :operation => :"OrganizationsApi.unarchive_organization",
1426
+ :header_params => header_params,
1427
+ :query_params => query_params,
1428
+ :form_params => form_params,
1429
+ :body => post_body,
1430
+ :auth_names => auth_names,
1431
+ :return_type => return_type
1432
+ )
1433
+
1434
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1435
+ if @api_client.config.debugging
1436
+ @api_client.config.logger.debug "API called: OrganizationsApi#unarchive_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1437
+ end
1438
+ return data, status_code, headers
1439
+ end
1440
+
1441
+ # Undo a customer merge
1442
+ # Makes this merged customer a customer of its own again, while nothing new has happened on the one it was merged into (409 otherwise, or `not_merged`). Takes an operator token.
1443
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1444
+ # @param [Hash] opts the optional parameters
1445
+ # @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 &#x60;409&#x60;.
1446
+ # @return [CustomerLifecycleState]
1447
+ def undo_organization_merge(org, opts = {})
1448
+ data, _status_code, _headers = undo_organization_merge_with_http_info(org, opts)
1449
+ data
1450
+ end
1451
+
1452
+ # Undo a customer merge
1453
+ # Makes this merged customer a customer of its own again, while nothing new has happened on the one it was merged into (409 otherwise, or &#x60;not_merged&#x60;). Takes an operator token.
1454
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1455
+ # @param [Hash] opts the optional parameters
1456
+ # @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 &#x60;409&#x60;.
1457
+ # @return [Array<(CustomerLifecycleState, Integer, Hash)>] CustomerLifecycleState data, response status code and response headers
1458
+ def undo_organization_merge_with_http_info(org, opts = {})
1459
+ if @api_client.config.debugging
1460
+ @api_client.config.logger.debug 'Calling API: OrganizationsApi.undo_organization_merge ...'
1461
+ end
1462
+ # verify the required parameter 'org' is set
1463
+ if @api_client.config.client_side_validation && org.nil?
1464
+ fail ArgumentError, "Missing the required parameter 'org' when calling OrganizationsApi.undo_organization_merge"
1465
+ end
1466
+ # resource path
1467
+ local_var_path = '/organizations/{org}/merge/undo'.sub('{org}', CGI.escape(org.to_s))
1468
+
1469
+ # query parameters
1470
+ query_params = opts[:query_params] || {}
1471
+
1472
+ # header parameters
1473
+ header_params = opts[:header_params] || {}
1474
+ # HTTP header 'Accept' (if needed)
1475
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1476
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1477
+
1478
+ # form parameters
1479
+ form_params = opts[:form_params] || {}
1480
+
1481
+ # http body (model)
1482
+ post_body = opts[:debug_body]
1483
+
1484
+ # return_type
1485
+ return_type = opts[:debug_return_type] || 'CustomerLifecycleState'
1486
+
1487
+ # auth_names
1488
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1489
+
1490
+ new_options = opts.merge(
1491
+ :operation => :"OrganizationsApi.undo_organization_merge",
1492
+ :header_params => header_params,
1493
+ :query_params => query_params,
1494
+ :form_params => form_params,
1495
+ :body => post_body,
1496
+ :auth_names => auth_names,
1497
+ :return_type => return_type
1498
+ )
1499
+
1500
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1501
+ if @api_client.config.debugging
1502
+ @api_client.config.logger.debug "API called: OrganizationsApi#undo_organization_merge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1503
+ end
1504
+ return data, status_code, headers
1505
+ end
1506
+
953
1507
  # Change, turn off or turn on an entitlement override
954
1508
  # Send only what changes. `meter` and `subscription_id` cannot change: save a new override for another scope or meter. `status: disabled` keeps the override but stops it applying; `status: active` turns it back on, unless it has expired. An expired override cannot be turned on again: save a new one. **Operator tokens only.** Audited, and sends `entitlements.changed`.
955
1509
  # @param org [String] The organization id (the merchant platform&#39;s own tenant key).