recurly 3.6.0 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ac32fad822fa602a4eae953b306b78bac66aea6a7bc67f1161df49fe72f813f
4
- data.tar.gz: c5ae0c45581474a6f1ff9d996e0af49140073b5282585fb0af8daf34cde549c8
3
+ metadata.gz: 4030ed5d0b3caab223006348f1f47342e2bf331fa5dcdc13f4679ac7b3b58b45
4
+ data.tar.gz: 65a37eab661fdb72b9bb42720ba81c07cafd10c0a48c1d8d2cc51baf01a8e979
5
5
  SHA512:
6
- metadata.gz: 4bb163f9b5db0561aa52875398b33c1751608321cddf49c4337205175fb08f40f448853f7c1815f147a2c0a433692b4065993c9fadb6f61c0f1ce528887c1e5d
7
- data.tar.gz: 2d2449562b1e0fdea4dfcd5d5eac1885bcff3f3bc3d1333fa0bc855eddcf584b8527807d6954bde7cfc2b10c151216e5bbcc79851c42842870a2de1aa61d402b
6
+ metadata.gz: 8569f9f4a8f3bc5722603036cfd16aa90fcbf8a48a14725f7d520d894de505c01b16a6ea2005fa1f43e24f58101f21159ee972ada8bd2390ed4ad901a3310cc8
7
+ data.tar.gz: 4eb5ec05dabac2b015aea206c59c9eb1ae3c06b8e56b660dd1417d9349cb6be02db179fa423a9cc841800c5b4b33dd8528c31ec342e2331d66c122bed173b032
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 3.6.0
2
+ current_version = 3.7.0
3
3
  parse = (?P<major>\d+)
4
4
  \.(?P<minor>\d+)
5
5
  \.(?P<patch>\d+)
@@ -1,8 +1,25 @@
1
1
  # Changelog
2
2
 
3
- ## [3.6.0](https://github.com/recurly/recurly-client-ruby/tree/HEAD)
3
+ ## [3.7.0](https://github.com/recurly/recurly-client-ruby/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.5.0...HEAD)
5
+ [Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.6.0...HEAD)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Mon Jun 29 17:01:25 UTC 2020 Upgrade API version v2019-10-10 [\#601](https://github.com/recurly/recurly-client-ruby/pull/601) ([douglasmiller](https://github.com/douglasmiller))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - Allow :headers to be included in operations [\#597](https://github.com/recurly/recurly-client-ruby/pull/597) ([douglasmiller](https://github.com/douglasmiller))
14
+
15
+ **Merged pull requests:**
16
+
17
+ - Release 3.7.0 [\#602](https://github.com/recurly/recurly-client-ruby/pull/602) ([douglasmiller](https://github.com/douglasmiller))
18
+ - Fix doc link [\#596](https://github.com/recurly/recurly-client-ruby/pull/596) ([bhelx](https://github.com/bhelx))
19
+
20
+ ## [3.6.0](https://github.com/recurly/recurly-client-ruby/tree/3.6.0) (2020-06-01)
21
+
22
+ [Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.5.0...3.6.0)
6
23
 
7
24
  **Implemented enhancements:**
8
25
 
@@ -5,7 +5,7 @@ This repository houses the official ruby client for Recurly's V3 API.
5
5
  In your Gemfile, add `recurly` as a dependency.
6
6
 
7
7
  ```ruby
8
- gem 'recurly', '~> 3.6'
8
+ gem 'recurly', '~> 3.7'
9
9
  ```
10
10
 
11
11
  > *Note*: We try to follow [semantic versioning](https://semver.org/) and will only apply breaking changes to major versions.
@@ -20,6 +20,7 @@ module Recurly
20
20
  MAX_RETRIES = 3
21
21
  LOG_LEVELS = %i(debug info warn error fatal).freeze
22
22
  BASE36_ALPHABET = (("0".."9").to_a + ("a".."z").to_a).freeze
23
+ REQUEST_OPTIONS = [:headers].freeze
23
24
 
24
25
  # Initialize a client. It requires an API key.
25
26
  #
@@ -204,6 +205,9 @@ module Recurly
204
205
  end
205
206
 
206
207
  def set_headers(request, additional_headers = {})
208
+ # TODO this is undocumented until we finalize it
209
+ additional_headers.each { |header, v| request[header] = v } if additional_headers
210
+
207
211
  request["Accept"] = "application/vnd.recurly.#{api_version}".chomp # got this method from operations.rb
208
212
  request["Authorization"] = "Basic #{Base64.encode64(@api_key)}".chomp
209
213
  request["User-Agent"] = "Recurly/#{VERSION}; #{RUBY_DESCRIPTION}"
@@ -211,9 +215,6 @@ module Recurly
211
215
  unless request.is_a?(Net::HTTP::Get) || request.is_a?(Net::HTTP::Head)
212
216
  request["Idempotency-Key"] ||= generate_idempotency_key
213
217
  end
214
-
215
- # TODO this is undocumented until we finalize it
216
- additional_headers.each { |header, v| request[header] = v } if additional_headers
217
218
  end
218
219
 
219
220
  # from https://github.com/rails/rails/blob/6-0-stable/activesupport/lib/active_support/core_ext/securerandom.rb
@@ -316,8 +317,9 @@ module Recurly
316
317
 
317
318
  def build_url(path, options)
318
319
  path = scope_by_site(path, options)
319
- if options.any?
320
- "#{path}?#{URI.encode_www_form(options)}"
320
+ query_params = options.reject { |k, _| REQUEST_OPTIONS.include?(k.to_sym) }
321
+ if query_params.any?
322
+ "#{path}?#{URI.encode_www_form(query_params)}"
321
323
  else
322
324
  path
323
325
  end
@@ -2539,18 +2539,55 @@ module Recurly
2539
2539
  pager(path, **options)
2540
2540
  end
2541
2541
 
2542
+ # Create a new shipping method
2543
+ #
2544
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_shipping_method create_shipping_method api documenation}
2545
+ #
2546
+ # @param body [Requests::ShippingMethodCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingMethodCreate}
2547
+ # @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
2548
+ # @return [Resources::ShippingMethod] A new shipping method.
2549
+ def create_shipping_method(body:, **options)
2550
+ path = interpolate_path("/shipping_methods")
2551
+ post(path, body, Requests::ShippingMethodCreate, **options)
2552
+ end
2553
+
2542
2554
  # Fetch a shipping method
2543
2555
  #
2544
2556
  # {https://developers.recurly.com/api/v2019-10-10#operation/get_shipping_method get_shipping_method api documenation}
2545
2557
  #
2546
2558
  # @param id [String] Shipping Method ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-usps_2-day+.
2547
2559
  # @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
2548
- # @return [Resources::ShippingMethod] A shipping_method.
2560
+ # @return [Resources::ShippingMethod] A shipping method.
2549
2561
  def get_shipping_method(id:, **options)
2550
2562
  path = interpolate_path("/shipping_methods/{id}", id: id)
2551
2563
  get(path, **options)
2552
2564
  end
2553
2565
 
2566
+ # Update an active Shipping Method
2567
+ #
2568
+ # {https://developers.recurly.com/api/v2019-10-10#operation/update_shipping_method update_shipping_method api documenation}
2569
+ #
2570
+ # @param shipping_method_id [String] Shipping Method ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-usps_2-day+.
2571
+ # @param body [Requests::ShippingMethodUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingMethodUpdate}
2572
+ # @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
2573
+ # @return [Resources::ShippingMethod] The updated shipping method.
2574
+ def update_shipping_method(shipping_method_id:, body:, **options)
2575
+ path = interpolate_path("/shipping_methods/{shipping_method_id}", shipping_method_id: shipping_method_id)
2576
+ put(path, body, Requests::ShippingMethodUpdate, **options)
2577
+ end
2578
+
2579
+ # Deactivate a shipping method
2580
+ #
2581
+ # {https://developers.recurly.com/api/v2019-10-10#operation/deactivate_shipping_method deactivate_shipping_method api documenation}
2582
+ #
2583
+ # @param shipping_method_id [String] Shipping Method ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-usps_2-day+.
2584
+ # @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
2585
+ # @return [Resources::ShippingMethod] A shipping method.
2586
+ def deactivate_shipping_method(shipping_method_id:, **options)
2587
+ path = interpolate_path("/shipping_methods/{shipping_method_id}", shipping_method_id: shipping_method_id)
2588
+ delete(path, **options)
2589
+ end
2590
+
2554
2591
  # List a site's subscriptions
2555
2592
  #
2556
2593
  # {https://developers.recurly.com/api/v2019-10-10#operation/list_subscriptions list_subscriptions api documenation}
@@ -55,11 +55,11 @@ module Recurly
55
55
  define_attribute :tax_code, String
56
56
 
57
57
  # @!attribute tier_type
58
- # @return [String] The type of tiering used by the Add-on.
58
+ # @return [String] The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based).
59
59
  define_attribute :tier_type, String
60
60
 
61
61
  # @!attribute tiers
62
- # @return [Array[Tier]] At least one tier is required if `tier_type` is not 'flat'.
62
+ # @return [Array[Tier]] If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier with an `ending_quantity` of 999999999 which is the default if not provided.
63
63
  define_attribute :tiers, Array, { :item_type => :Tier }
64
64
  end
65
65
  end
@@ -47,7 +47,7 @@ module Recurly
47
47
  define_attribute :tax_code, String
48
48
 
49
49
  # @!attribute tiers
50
- # @return [Array[Tier]] If tiers are provided in the request, all existing tiers on the Add-on will be removed and replaced by the tiers in the request.
50
+ # @return [Array[Tier]] If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier with an `ending_quantity` of 999999999 which is the default if not provided.
51
51
  define_attribute :tiers, Array, { :item_type => :Tier }
52
52
  end
53
53
  end
@@ -7,7 +7,7 @@ module Recurly
7
7
  class BillingInfoCreate < Request
8
8
 
9
9
  # @!attribute account_number
10
- # @return [String] The bank account number. (ACH only)
10
+ # @return [String] The bank account number. (ACH, Bacs only)
11
11
  define_attribute :account_number, String
12
12
 
13
13
  # @!attribute account_type
@@ -63,7 +63,7 @@ module Recurly
63
63
  define_attribute :month, String
64
64
 
65
65
  # @!attribute name_on_account
66
- # @return [String] The name associated with the bank account.
66
+ # @return [String] The name associated with the bank account (ACH, SEPA, Bacs only)
67
67
  define_attribute :name_on_account, String
68
68
 
69
69
  # @!attribute number
@@ -78,6 +78,10 @@ module Recurly
78
78
  # @return [String] The bank's rounting number. (ACH only)
79
79
  define_attribute :routing_number, String
80
80
 
81
+ # @!attribute sort_code
82
+ # @return [String] Bank identifier code for UK based banks. Required for Bacs based billing infos. (Bacs only)
83
+ define_attribute :sort_code, String
84
+
81
85
  # @!attribute three_d_secure_action_result_token_id
82
86
  # @return [String] A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge.
83
87
  define_attribute :three_d_secure_action_result_token_id, String
@@ -90,6 +94,10 @@ module Recurly
90
94
  # @return [String] An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions.
91
95
  define_attribute :transaction_type, String
92
96
 
97
+ # @!attribute type
98
+ # @return [String] The payment method type for a non-credit card based billing info. The value of `bacs` is the only accepted value (Bacs only)
99
+ define_attribute :type, String
100
+
93
101
  # @!attribute vat_number
94
102
  # @return [String] VAT number
95
103
  define_attribute :vat_number, String
@@ -14,6 +14,10 @@ module Recurly
14
14
  # @return [Array[AddOnCreate]] Add Ons
15
15
  define_attribute :add_ons, Array, { :item_type => :AddOnCreate }
16
16
 
17
+ # @!attribute allow_any_item_on_subscriptions
18
+ # @return [Boolean] Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used.
19
+ define_attribute :allow_any_item_on_subscriptions, :Boolean
20
+
17
21
  # @!attribute auto_renew
18
22
  # @return [Boolean] Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself.
19
23
  define_attribute :auto_renew, :Boolean
@@ -74,6 +78,10 @@ module Recurly
74
78
  # @return [Integer] Length of plan's trial period in `trial_units`. `0` means `no trial`.
75
79
  define_attribute :trial_length, Integer
76
80
 
81
+ # @!attribute trial_requires_billing_info
82
+ # @return [Boolean] Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee.
83
+ define_attribute :trial_requires_billing_info, :Boolean
84
+
77
85
  # @!attribute trial_unit
78
86
  # @return [String] Units for the plan's trial period.
79
87
  define_attribute :trial_unit, String
@@ -14,6 +14,10 @@ module Recurly
14
14
  # @return [Array[AddOnCreate]] Add Ons
15
15
  define_attribute :add_ons, Array, { :item_type => :AddOnCreate }
16
16
 
17
+ # @!attribute allow_any_item_on_subscriptions
18
+ # @return [Boolean] Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used.
19
+ define_attribute :allow_any_item_on_subscriptions, :Boolean
20
+
17
21
  # @!attribute auto_renew
18
22
  # @return [Boolean] Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself.
19
23
  define_attribute :auto_renew, :Boolean
@@ -70,6 +74,10 @@ module Recurly
70
74
  # @return [Integer] Length of plan's trial period in `trial_units`. `0` means `no trial`.
71
75
  define_attribute :trial_length, Integer
72
76
 
77
+ # @!attribute trial_requires_billing_info
78
+ # @return [Boolean] Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee.
79
+ define_attribute :trial_requires_billing_info, :Boolean
80
+
73
81
  # @!attribute trial_unit
74
82
  # @return [String] Units for the plan's trial period.
75
83
  define_attribute :trial_unit, String
@@ -0,0 +1,26 @@
1
+ # This file is automatically created by Recurly's OpenAPI generation process
2
+ # and thus any edits you make by hand will be lost. If you wish to make a
3
+ # change to this file, please create a Github issue explaining the changes you
4
+ # need and we will usher them to the appropriate places.
5
+ module Recurly
6
+ module Requests
7
+ class ShippingMethodCreate < Request
8
+
9
+ # @!attribute accounting_code
10
+ # @return [String] Accounting code for shipping method.
11
+ define_attribute :accounting_code, String
12
+
13
+ # @!attribute code
14
+ # @return [String] The internal name used identify the shipping method.
15
+ define_attribute :code, String
16
+
17
+ # @!attribute name
18
+ # @return [String] The name of the shipping method displayed to customers.
19
+ define_attribute :name, String
20
+
21
+ # @!attribute tax_code
22
+ # @return [String] Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable
23
+ define_attribute :tax_code, String
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # This file is automatically created by Recurly's OpenAPI generation process
2
+ # and thus any edits you make by hand will be lost. If you wish to make a
3
+ # change to this file, please create a Github issue explaining the changes you
4
+ # need and we will usher them to the appropriate places.
5
+ module Recurly
6
+ module Requests
7
+ class ShippingMethodUpdate < Request
8
+
9
+ # @!attribute accounting_code
10
+ # @return [String] Accounting code for shipping method.
11
+ define_attribute :accounting_code, String
12
+
13
+ # @!attribute code
14
+ # @return [String] The internal name used identify the shipping method.
15
+ define_attribute :code, String
16
+
17
+ # @!attribute name
18
+ # @return [String] The name of the shipping method displayed to customers.
19
+ define_attribute :name, String
20
+
21
+ # @!attribute tax_code
22
+ # @return [String] Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable
23
+ define_attribute :tax_code, String
24
+ end
25
+ end
26
+ end
@@ -19,7 +19,7 @@ module Recurly
19
19
  define_attribute :revenue_schedule_type, String
20
20
 
21
21
  # @!attribute tiers
22
- # @return [Array[SubscriptionAddOnTier]] If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent.
22
+ # @return [Array[SubscriptionAddOnTier]] If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier with an `ending_quantity` of 999999999 which is the default if not provided.
23
23
  define_attribute :tiers, Array, { :item_type => :SubscriptionAddOnTier }
24
24
 
25
25
  # @!attribute unit_amount
@@ -23,7 +23,7 @@ module Recurly
23
23
  define_attribute :revenue_schedule_type, String
24
24
 
25
25
  # @!attribute tiers
26
- # @return [Array[SubscriptionAddOnTier]] If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent.
26
+ # @return [Array[SubscriptionAddOnTier]] If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier with an `ending_quantity` of 999999999 which is the default if not provided.
27
27
  define_attribute :tiers, Array, { :item_type => :SubscriptionAddOnTier }
28
28
 
29
29
  # @!attribute unit_amount
@@ -10,6 +10,10 @@ module Recurly
10
10
  # @return [String] Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code.
11
11
  define_attribute :accounting_code, String
12
12
 
13
+ # @!attribute allow_any_item_on_subscriptions
14
+ # @return [Boolean] Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used.
15
+ define_attribute :allow_any_item_on_subscriptions, :Boolean
16
+
13
17
  # @!attribute auto_renew
14
18
  # @return [Boolean] Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself.
15
19
  define_attribute :auto_renew, :Boolean
@@ -90,6 +94,10 @@ module Recurly
90
94
  # @return [Integer] Length of plan's trial period in `trial_units`. `0` means `no trial`.
91
95
  define_attribute :trial_length, Integer
92
96
 
97
+ # @!attribute trial_requires_billing_info
98
+ # @return [Boolean] Allow free trial subscriptions to be created without billing info.
99
+ define_attribute :trial_requires_billing_info, :Boolean
100
+
93
101
  # @!attribute trial_unit
94
102
  # @return [String] Units for the plan's trial period.
95
103
  define_attribute :trial_unit, String
@@ -138,6 +138,10 @@ module Recurly
138
138
  # @return [String] - `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided.
139
139
  define_attribute :type, String
140
140
 
141
+ # @!attribute updated_at
142
+ # @return [DateTime] Updated at
143
+ define_attribute :updated_at, DateTime
144
+
141
145
  # @!attribute uuid
142
146
  # @return [String] The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI.
143
147
  define_attribute :uuid, String
@@ -1,3 +1,3 @@
1
1
  module Recurly
2
- VERSION = "3.6.0"
2
+ VERSION = "3.7.0"
3
3
  end
@@ -381,6 +381,22 @@ paths:
381
381
  schema:
382
382
  "$ref": "#/components/schemas/Error"
383
383
  x-code-samples:
384
+ - lang: Node.js
385
+ source: |
386
+ try {
387
+ const site = await client.getSite(siteId)
388
+ console.log('Fetched site: ', site)
389
+ } catch (err) {
390
+ if (err instanceof recurly.errors.NotFoundError) {
391
+ // If the request was not found, you may want to alert the user or
392
+ // just return null
393
+ console.log('Resource Not Found')
394
+ } else {
395
+ // If we don't know what to do with the err, we should
396
+ // probably re-raise and let our web framework and logger handle it
397
+ console.log('Unknown Error: ', err)
398
+ }
399
+ }
384
400
  - lang: Python
385
401
  source: |
386
402
  try:
@@ -418,6 +434,19 @@ paths:
418
434
  # just return nil
419
435
  puts "Resource Not Found"
420
436
  end
437
+ - lang: Java
438
+ source: |
439
+ try {
440
+ final Site site = client.getSite(siteId);
441
+ System.out.println("Fetched site: " + site.getId());
442
+ } catch (NotFoundException e) {
443
+ // If the resource was not found
444
+ // we may want to alert the user or just return null
445
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
446
+ } catch (ApiException e) {
447
+ // Use ApiException to catch a generic error from the API
448
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
449
+ }
421
450
  - lang: PHP
422
451
  source: |
423
452
  try {
@@ -2235,6 +2264,13 @@ paths:
2235
2264
  schema:
2236
2265
  "$ref": "#/components/schemas/Error"
2237
2266
  x-code-samples:
2267
+ - lang: Node.js
2268
+ source: |
2269
+ const redemptions = client.listAccountCouponRedemptions(accountId, { limit: 200 })
2270
+
2271
+ for await (const redemption of redemptions.each()) {
2272
+ console.log(redemption.id)
2273
+ }
2238
2274
  - lang: Python
2239
2275
  source: |
2240
2276
  redemptions = client.list_account_coupon_redemptions(account_id, limit=200).items()
@@ -2560,6 +2596,22 @@ paths:
2560
2596
  schema:
2561
2597
  "$ref": "#/components/schemas/Error"
2562
2598
  x-code-samples:
2599
+ - lang: Node.js
2600
+ source: |
2601
+ try {
2602
+ const redemption = await client.removeCouponRedemption(accountId)
2603
+ console.log('Removed coupon redemption: ', redemption.id)
2604
+ } catch (err) {
2605
+ if (err instanceof recurly.errors.NotFoundError) {
2606
+ // If the request was not found, you may want to alert the user or
2607
+ // just return null
2608
+ console.log('Resource Not Found')
2609
+ } else {
2610
+ // If we don't know what to do with the err, we should
2611
+ // probably re-raise and let our web framework and logger handle it
2612
+ console.log('Unknown Error: ', err)
2613
+ }
2614
+ }
2563
2615
  - lang: Python
2564
2616
  source: |
2565
2617
  try:
@@ -2767,6 +2819,13 @@ paths:
2767
2819
  schema:
2768
2820
  "$ref": "#/components/schemas/Error"
2769
2821
  x-code-samples:
2822
+ - lang: Node.js
2823
+ source: |
2824
+ const invoices = client.listAccountInvoices(accountId, { limit: 200 })
2825
+
2826
+ for await (const invoice of invoices.each()) {
2827
+ console.log(invoice.number)
2828
+ }
2770
2829
  - lang: Python
2771
2830
  source: |
2772
2831
  invoices = client.list_account_invoices(account_id, limit=200).items()
@@ -3199,6 +3258,13 @@ paths:
3199
3258
  schema:
3200
3259
  "$ref": "#/components/schemas/Error"
3201
3260
  x-code-samples:
3261
+ - lang: Node.js
3262
+ source: |
3263
+ const lineItems = client.listAccountLineItems(accountId, { limit: 200 })
3264
+
3265
+ for await (const lineItem of lineItems.each()) {
3266
+ console.log(lineItem.id)
3267
+ }
3202
3268
  - lang: Python
3203
3269
  source: |
3204
3270
  line_items = client.list_account_line_items(account_id, limit=200).items()
@@ -4347,6 +4413,13 @@ paths:
4347
4413
  schema:
4348
4414
  "$ref": "#/components/schemas/Error"
4349
4415
  x-code-samples:
4416
+ - lang: Node.js
4417
+ source: |
4418
+ const subscriptions = client.listAccountSubscriptions(accountId, { limit: 200 })
4419
+
4420
+ for await (const subscription of subscriptions.each()) {
4421
+ console.log(subscription.uuid)
4422
+ }
4350
4423
  - lang: Python
4351
4424
  source: |
4352
4425
  subscriptions = client.list_account_subscriptions(account.id, limit=200).items()
@@ -4436,6 +4509,13 @@ paths:
4436
4509
  schema:
4437
4510
  "$ref": "#/components/schemas/Error"
4438
4511
  x-code-samples:
4512
+ - lang: Node.js
4513
+ source: |
4514
+ const transactions = client.listAccountTransactions(accountId, { limit: 200 })
4515
+
4516
+ for await (const transaction of transactions.each()) {
4517
+ console.log(transaction.uuid)
4518
+ }
4439
4519
  - lang: Python
4440
4520
  source: |
4441
4521
  transactions = client.list_account_transactions(account_id, limit=200).items()
@@ -4595,6 +4675,13 @@ paths:
4595
4675
  schema:
4596
4676
  "$ref": "#/components/schemas/Error"
4597
4677
  x-code-samples:
4678
+ - lang: Node.js
4679
+ source: |
4680
+ const acquisitions = client.listAccountAcquisition({ limit: 200 })
4681
+
4682
+ for await (const acquisition of acquisitions.each()) {
4683
+ console.log(acquisition.id)
4684
+ }
4598
4685
  - lang: Python
4599
4686
  source: |
4600
4687
  acquisitions = client.list_account_acquisition(limit=200).items()
@@ -4613,6 +4700,15 @@ paths:
4613
4700
  acquisitions.each do |acquisition|
4614
4701
  puts "AccountAcquisition: #{acquisition.cost}"
4615
4702
  end
4703
+ - lang: Java
4704
+ source: |
4705
+ QueryParams params = new QueryParams();
4706
+ params.setLimit(200); // Pull 200 records at a time
4707
+ final Pager<AccountAcquisition> acquisitions = client.listAccountAcquisition(params);
4708
+
4709
+ for (AccountAcquisition acquisition : acquisitions) {
4710
+ System.out.println(acquisition.getId());
4711
+ }
4616
4712
  - lang: PHP
4617
4713
  source: |
4618
4714
  $params = ['limit' => 200];
@@ -4762,6 +4858,28 @@ paths:
4762
4858
  schema:
4763
4859
  "$ref": "#/components/schemas/Error"
4764
4860
  x-code-samples:
4861
+ - lang: Node.js
4862
+ source: |
4863
+ try {
4864
+ const couponCreate = {
4865
+ name: "Promotional Coupon",
4866
+ code: couponCode,
4867
+ discount_type: "fixed",
4868
+ currencies: [{"currency": "USD", "discount": 10}],
4869
+ }
4870
+ const coupon = await client.createCoupon(couponCreate)
4871
+ console.log('Created coupon: ', coupon.id)
4872
+ } catch (err) {
4873
+ if (err instanceof recurly.errors.ValidationError) {
4874
+ // If the request was not valid, you may want to tell your user
4875
+ // why. You can find the invalid params and reasons in err.params
4876
+ console.log('Failed validation', err.params)
4877
+ } else {
4878
+ // If we don't know what to do with the err, we should
4879
+ // probably re-raise and let our web framework and logger handle it
4880
+ console.log('Unknown Error: ', err)
4881
+ }
4882
+ }
4765
4883
  - lang: Python
4766
4884
  source: |
4767
4885
  try:
@@ -5056,6 +5174,25 @@ paths:
5056
5174
  schema:
5057
5175
  "$ref": "#/components/schemas/Error"
5058
5176
  x-code-samples:
5177
+ - lang: Node.js
5178
+ source: |
5179
+ try {
5180
+ const couponUpdate = {
5181
+ name: "New Coupon Name"
5182
+ }
5183
+ const coupon = await client.updateCoupon(couponId, couponUpdate)
5184
+ console.log('Updated coupon: ', coupon)
5185
+ } catch (err) {
5186
+ if (err instanceof recurly.errors.ValidationError) {
5187
+ // If the request was not valid, you may want to tell your user
5188
+ // why. You can find the invalid params and reasons in err.params
5189
+ console.log('Failed validation', err.params)
5190
+ } else {
5191
+ // If we don't know what to do with the err, we should
5192
+ // probably re-raise and let our web framework and logger handle it
5193
+ console.log('Unknown Error: ', err)
5194
+ }
5195
+ }
5059
5196
  - lang: Python
5060
5197
  source: |
5061
5198
  try:
@@ -5102,6 +5239,23 @@ paths:
5102
5239
  # just return nil
5103
5240
  puts "Resource Not Found"
5104
5241
  end
5242
+ - lang: Java
5243
+ source: |
5244
+ try {
5245
+ final CouponUpdate couponUpdate = new CouponUpdate();
5246
+ couponUpdate.setName("New Coupon Name");
5247
+
5248
+ final Coupon coupon = client.updateCoupon(couponId, couponUpdate);
5249
+ System.out.println("Updated coupon: " + coupon.getCode());
5250
+ System.out.println(coupon.getName());
5251
+ } catch (ValidationException e) {
5252
+ // If the request was not valid, you may want to tell your user
5253
+ // why. You can find the invalid params and reasons in e.getError().getParams()
5254
+ System.out.println("Failed validation: " + e.getError().getMessage());
5255
+ } catch (ApiException e) {
5256
+ // Use ApiException to catch a generic error from the API
5257
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
5258
+ }
5105
5259
  - lang: PHP
5106
5260
  source: |
5107
5261
  try {
@@ -7521,6 +7675,22 @@ paths:
7521
7675
  schema:
7522
7676
  "$ref": "#/components/schemas/Error"
7523
7677
  x-code-samples:
7678
+ - lang: Node.js
7679
+ source: |
7680
+ try {
7681
+ const invoice = await client.voidInvoice(invoiceId)
7682
+ console.log('Voided invoice: ', invoice)
7683
+ } catch (err) {
7684
+ if (err instanceof recurly.errors.ValidationError) {
7685
+ // If the request was not valid, you may want to tell your user
7686
+ // why. You can find the invalid params and reasons in err.params
7687
+ console.log('Failed validation', err.params)
7688
+ } else {
7689
+ // If we don't know what to do with the err, we should
7690
+ // probably re-raise and let our web framework and logger handle it
7691
+ console.log('Unknown Error: ', err)
7692
+ }
7693
+ }
7524
7694
  - lang: Python
7525
7695
  source: |
7526
7696
  try:
@@ -7540,6 +7710,19 @@ paths:
7540
7710
  # just return nil
7541
7711
  puts "Resource Not Found"
7542
7712
  end
7713
+ - lang: Java
7714
+ source: |
7715
+ try {
7716
+ final Invoice invoice = client.voidInvoice(invoiceId);
7717
+ System.out.println("Voided invoice " + invoice.getId());
7718
+ } catch (final ValidationException e) {
7719
+ // If the request was not valid, you may want to tell your user
7720
+ // why. You can find the invalid params and reasons in e.getError().getParams()
7721
+ System.out.println("Failed validation: " + e.getError().getMessage());
7722
+ } catch (final ApiException e) {
7723
+ // Use ApiException to catch a generic error from the API
7724
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
7725
+ }
7543
7726
  - lang: PHP
7544
7727
  source: |
7545
7728
  try {
@@ -7672,6 +7855,13 @@ paths:
7672
7855
  schema:
7673
7856
  "$ref": "#/components/schemas/Error"
7674
7857
  x-code-samples:
7858
+ - lang: Node.js
7859
+ source: |
7860
+ const lineItems = client.listInvoiceLineItems(invoiceId, { limit: 200 })
7861
+
7862
+ for await (const lineItem of lineItems.each()) {
7863
+ console.log(lineItem.id)
7864
+ }
7675
7865
  - lang: Python
7676
7866
  source: |
7677
7867
  try:
@@ -7698,6 +7888,15 @@ paths:
7698
7888
  line_items.each do |line_item|
7699
7889
  puts "Line Item: #{line_item.id}"
7700
7890
  end
7891
+ - lang: Java
7892
+ source: |
7893
+ QueryParams params = new QueryParams();
7894
+ params.setLimit(200);
7895
+ Pager<LineItem> lineItems = client.listInvoiceLineItems(invoiceId, params);
7896
+
7897
+ for (LineItem lineItem : lineItems) {
7898
+ System.out.println(lineItem.getId());
7899
+ }
7701
7900
  - lang: PHP
7702
7901
  source: |
7703
7902
  $params = ['limit' => 200];
@@ -7746,6 +7945,13 @@ paths:
7746
7945
  schema:
7747
7946
  "$ref": "#/components/schemas/Error"
7748
7947
  x-code-samples:
7948
+ - lang: Node.js
7949
+ source: |
7950
+ const redemptions = client.listInvoiceCouponRedemptions(invoiceId, { limit: 200 })
7951
+
7952
+ for await (const redemption of redemptions.each()) {
7953
+ console.log(redemption.id)
7954
+ }
7749
7955
  - lang: Python
7750
7956
  source: |
7751
7957
  try:
@@ -9079,6 +9285,13 @@ paths:
9079
9285
  schema:
9080
9286
  "$ref": "#/components/schemas/Error"
9081
9287
  x-code-samples:
9288
+ - lang: Node.js
9289
+ source: |
9290
+ const addOns = client.listPlanAddOns(planId, { limit: 200 })
9291
+
9292
+ for await (const addOn of addOns.each()) {
9293
+ console.log(addOn.code)
9294
+ }
9082
9295
  - lang: Python
9083
9296
  source: |
9084
9297
  add_ons = client.list_plan_add_ons(plan_id).items()
@@ -9165,6 +9378,34 @@ paths:
9165
9378
  schema:
9166
9379
  "$ref": "#/components/schemas/Error"
9167
9380
  x-code-samples:
9381
+ - lang: Node.js
9382
+ source: |
9383
+ try {
9384
+ const addOnCreate = {
9385
+ code: 'coffee_grinder',
9386
+ name: 'A quality grinder for your beans',
9387
+ defaultQuantity: 1,
9388
+ currencies: [
9389
+ {
9390
+ currency: 'USD',
9391
+ unitAmount: 10000
9392
+ }
9393
+ ]
9394
+ }
9395
+
9396
+ const addOn = await client.createPlanAddOn(planId, addOnCreate)
9397
+ console.log('Created add-on: ', addOn.code)
9398
+ } catch (err) {
9399
+ if (err instanceof recurly.errors.ValidationError) {
9400
+ // If the request was not valid, you may want to tell your user
9401
+ // why. You can find the invalid params and reasons in err.params
9402
+ console.log('Failed validation', err.params)
9403
+ } else {
9404
+ // If we don't know what to do with the err, we should
9405
+ // probably re-raise and let our web framework and logger handle it
9406
+ console.log('Unknown Error: ', err)
9407
+ }
9408
+ }
9168
9409
  - lang: Python
9169
9410
  source: |
9170
9411
  try:
@@ -9325,6 +9566,22 @@ paths:
9325
9566
  schema:
9326
9567
  "$ref": "#/components/schemas/Error"
9327
9568
  x-code-samples:
9569
+ - lang: Node.js
9570
+ source: |
9571
+ try {
9572
+ const addOn = await client.getPlanAddOn(planId, addOnId)
9573
+ console.log('Fetched add-on: ', addOn.code)
9574
+ } catch (err) {
9575
+ if (err instanceof recurly.errors.NotFoundError) {
9576
+ // If the request was not found, you may want to alert the user or
9577
+ // just return null
9578
+ console.log('Resource Not Found')
9579
+ } else {
9580
+ // If we don't know what to do with the err, we should
9581
+ // probably re-raise and let our web framework and logger handle it
9582
+ console.log('Unknown Error: ', err)
9583
+ }
9584
+ }
9328
9585
  - lang: Python
9329
9586
  source: |
9330
9587
  try:
@@ -9441,6 +9698,25 @@ paths:
9441
9698
  schema:
9442
9699
  "$ref": "#/components/schemas/Error"
9443
9700
  x-code-samples:
9701
+ - lang: Node.js
9702
+ source: |
9703
+ try {
9704
+ const addOnUpdate = {
9705
+ name: 'New AddOn Name',
9706
+ }
9707
+ const addOn = await client.updatePlanAddOn(planId, addOnId, addOnUpdate)
9708
+ console.log('Updated add-on: ', addOn)
9709
+ } catch (err) {
9710
+ if (err instanceof recurly.errors.ValidationError) {
9711
+ // If the request was not valid, you may want to tell your user
9712
+ // why. You can find the invalid params and reasons in err.params
9713
+ console.log('Failed validation', err.params)
9714
+ } else {
9715
+ // If we don't know what to do with the err, we should
9716
+ // probably re-raise and let our web framework and logger handle it
9717
+ console.log('Unknown Error: ', err)
9718
+ }
9719
+ }
9444
9720
  - lang: Python
9445
9721
  source: |
9446
9722
  try:
@@ -9481,6 +9757,23 @@ paths:
9481
9757
  \"Updated add-on #{add_on}\"\nrescue Recurly::Errors::NotFoundError\n #
9482
9758
  If the resource was not found, you may want to alert the user or\n # just
9483
9759
  return nil\n puts \"Resource Not Found\"\nend\n"
9760
+ - lang: Java
9761
+ source: |
9762
+ try {
9763
+ final AddOnUpdate addOnUpdate = new AddOnUpdate();
9764
+ addOnUpdate.setName("New Add-On Name");
9765
+
9766
+ final AddOn addOn = client.updatePlanAddOn(planId, addOnId, addOnUpdate);
9767
+ System.out.println("Updated add-on " + addOn.getCode());
9768
+ System.out.println(addOn.getName());
9769
+ } catch (NotFoundException e) {
9770
+ // If the resource was not found
9771
+ // we may want to alert the user or just return null
9772
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
9773
+ } catch (ApiException e) {
9774
+ // Use ApiException to catch a generic error from the API
9775
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
9776
+ }
9484
9777
  - lang: PHP
9485
9778
  source: |
9486
9779
  try {
@@ -9531,6 +9824,22 @@ paths:
9531
9824
  schema:
9532
9825
  "$ref": "#/components/schemas/Error"
9533
9826
  x-code-samples:
9827
+ - lang: Node.js
9828
+ source: |
9829
+ try {
9830
+ const addOn = await client.removePlanAddOn(planId, addOnId)
9831
+ console.log('Removed plan add-on: ', addOn)
9832
+ } catch (err) {
9833
+ if (err instanceof recurly.errors.NotFoundError) {
9834
+ // If the request was not found, you may want to alert the user or
9835
+ // just return null
9836
+ console.log('Resource Not Found')
9837
+ } else {
9838
+ // If we don't know what to do with the err, we should
9839
+ // probably re-raise and let our web framework and logger handle it
9840
+ console.log('Unknown Error: ', err)
9841
+ }
9842
+ }
9534
9843
  - lang: Python
9535
9844
  source: |
9536
9845
  try:
@@ -9563,6 +9872,19 @@ paths:
9563
9872
  \n add_on_id: add_on_id\n )\n puts \"Removed add-on #{add_on}\"\nrescue
9564
9873
  Recurly::Errors::NotFoundError\n # If the resource was not found, you may
9565
9874
  want to alert the user or\n # just return nil\n puts \"Resource Not Found\"\nend\n"
9875
+ - lang: Java
9876
+ source: |-
9877
+ try {
9878
+ final AddOn addOn = client.removePlanAddOn(planId, addOnId);
9879
+ System.out.println("Removed add-on " + addOn.getCode());
9880
+ } catch (ValidationException e) {
9881
+ // If the request was not valid, you may want to tell your user
9882
+ // why. You can find the invalid params and reasons in e.getError().getParams()
9883
+ System.out.println("Failed validation: " + e.getError().getMessage());
9884
+ } catch (ApiException e) {
9885
+ // Use ApiException to catch a generic error from the API
9886
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
9887
+ }
9566
9888
  - lang: PHP
9567
9889
  source: |
9568
9890
  try {
@@ -9626,6 +9948,13 @@ paths:
9626
9948
  schema:
9627
9949
  "$ref": "#/components/schemas/Error"
9628
9950
  x-code-samples:
9951
+ - lang: Node.js
9952
+ source: |
9953
+ const addOns = client.listAddOns({ limit: 200 })
9954
+
9955
+ for await (const addOn of addOns.each()) {
9956
+ console.log(addOn.code)
9957
+ }
9629
9958
  - lang: Python
9630
9959
  source: |
9631
9960
  add_ons = client.list_add_ons().items()
@@ -9698,12 +10027,28 @@ paths:
9698
10027
  schema:
9699
10028
  "$ref": "#/components/schemas/Error"
9700
10029
  x-code-samples:
9701
- - lang: Python
10030
+ - lang: Node.js
9702
10031
  source: |
9703
- try:
9704
- add_on = client.get_add_on(add_on_id)
9705
- print("Got Add-On %s" % add_on)
9706
- except recurly.errors.NotFoundError:
10032
+ try {
10033
+ const addOn = await client.getAddOn(addOnId)
10034
+ console.log('Fetched add-on: ', addOn)
10035
+ } catch (err) {
10036
+ if (err instanceof recurly.errors.NotFoundError) {
10037
+ // If the request was not found, you may want to alert the user or
10038
+ // just return null
10039
+ console.log('Resource Not Found')
10040
+ } else {
10041
+ // If we don't know what to do with the err, we should
10042
+ // probably re-raise and let our web framework and logger handle it
10043
+ console.log('Unknown Error: ', err)
10044
+ }
10045
+ }
10046
+ - lang: Python
10047
+ source: |
10048
+ try:
10049
+ add_on = client.get_add_on(add_on_id)
10050
+ print("Got Add-On %s" % add_on)
10051
+ except recurly.errors.NotFoundError:
9707
10052
  # If the resource was not found, you may want to alert the user or
9708
10053
  # just return nil
9709
10054
  print("Resource Not Found")
@@ -9735,6 +10080,19 @@ paths:
9735
10080
  # just return nil
9736
10081
  puts "Resource Not Found"
9737
10082
  end
10083
+ - lang: Java
10084
+ source: |
10085
+ try {
10086
+ final AddOn addOn = client.getAddOn(addOnId);
10087
+ System.out.println("Fetched add-on " + addOn.getCode());
10088
+ } catch (NotFoundException e) {
10089
+ // If the resource was not found
10090
+ // we may want to alert the user or just return null
10091
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
10092
+ } catch (ApiException e) {
10093
+ // Use ApiException to catch a generic error from the API
10094
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
10095
+ }
9738
10096
  - lang: PHP
9739
10097
  source: |
9740
10098
  try {
@@ -9797,6 +10155,13 @@ paths:
9797
10155
  schema:
9798
10156
  "$ref": "#/components/schemas/Error"
9799
10157
  x-code-samples:
10158
+ - lang: Node.js
10159
+ source: |
10160
+ const methods = client.listShippingMethods({ limit: 200 })
10161
+
10162
+ for await (const method of methods.each()) {
10163
+ console.log(method.code)
10164
+ }
9800
10165
  - lang: Python
9801
10166
  source: |
9802
10167
  shipping_methods = client.list_shipping_methods(limit=200).items()
@@ -9817,6 +10182,15 @@ paths:
9817
10182
  shipping_methods.each do |shipping_method|
9818
10183
  puts "Shipping Method: #{shipping_method.code}"
9819
10184
  end
10185
+ - lang: Java
10186
+ source: |
10187
+ QueryParams params = new QueryParams();
10188
+ params.setLimit(200); // Pull 200 records at a time
10189
+ final Pager<ShippingMethod> shippingMethods = client.listShippingMethods(params);
10190
+
10191
+ for (ShippingMethod shippingMethod : shippingMethods) {
10192
+ System.out.println(shippingMethod.getCode());
10193
+ }
9820
10194
  - lang: PHP
9821
10195
  source: |
9822
10196
  $params = ['limit' => 200];
@@ -9833,6 +10207,51 @@ paths:
9833
10207
  ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor
9834
10208
  i, method := range shippingMethods.Data {\n\t\tfmt.Printf(\"Shipping Method
9835
10209
  %3d: %s, %s\\n\",\n\t\t\ti,\n\t\t\tmethod.Id,\n\t\t\tmethod.Code,\n\t\t)\n\t}\n}"
10210
+ post:
10211
+ tags:
10212
+ - shipping_method
10213
+ operationId: create_shipping_method
10214
+ summary: Create a new shipping method
10215
+ parameters:
10216
+ - "$ref": "#/components/parameters/site_id"
10217
+ requestBody:
10218
+ content:
10219
+ application/json:
10220
+ schema:
10221
+ "$ref": "#/components/schemas/ShippingMethodCreate"
10222
+ required: true
10223
+ responses:
10224
+ '201':
10225
+ description: A new shipping method.
10226
+ content:
10227
+ application/json:
10228
+ schema:
10229
+ "$ref": "#/components/schemas/ShippingMethod"
10230
+ '400':
10231
+ description: Bad request, perhaps invalid JSON?
10232
+ content:
10233
+ application/json:
10234
+ schema:
10235
+ "$ref": "#/components/schemas/Error"
10236
+ '404':
10237
+ description: Incorrect site ID.
10238
+ content:
10239
+ application/json:
10240
+ schema:
10241
+ "$ref": "#/components/schemas/Error"
10242
+ '422':
10243
+ description: Invalid request parameters.
10244
+ content:
10245
+ application/json:
10246
+ schema:
10247
+ "$ref": "#/components/schemas/Error"
10248
+ default:
10249
+ description: Unexpected error.
10250
+ content:
10251
+ application/json:
10252
+ schema:
10253
+ "$ref": "#/components/schemas/Error"
10254
+ x-code-samples: []
9836
10255
  "/sites/{site_id}/shipping_methods/{id}":
9837
10256
  get:
9838
10257
  tags:
@@ -9850,19 +10269,96 @@ paths:
9850
10269
  type: string
9851
10270
  responses:
9852
10271
  '200':
9853
- description: A shipping_method.
10272
+ description: A shipping method.
9854
10273
  content:
9855
10274
  application/json:
9856
10275
  schema:
9857
10276
  "$ref": "#/components/schemas/ShippingMethod"
9858
10277
  '404':
9859
- description: Incorrect site or shipping_method ID.
10278
+ description: Incorrect site or shipping method ID.
9860
10279
  content:
9861
10280
  application/json:
9862
10281
  schema:
9863
10282
  "$ref": "#/components/schemas/Error"
9864
10283
  default:
9865
- description: Unexpected error
10284
+ description: Unexpected error.
10285
+ content:
10286
+ application/json:
10287
+ schema:
10288
+ "$ref": "#/components/schemas/Error"
10289
+ x-code-samples: []
10290
+ "/sites/{site_id}/shipping_methods/{shipping_method_id}":
10291
+ put:
10292
+ tags:
10293
+ - shipping_method
10294
+ operationId: update_shipping_method
10295
+ summary: Update an active Shipping Method
10296
+ parameters:
10297
+ - "$ref": "#/components/parameters/site_id"
10298
+ - "$ref": "#/components/parameters/shipping_method_id"
10299
+ requestBody:
10300
+ content:
10301
+ application/json:
10302
+ schema:
10303
+ "$ref": "#/components/schemas/ShippingMethodUpdate"
10304
+ required: true
10305
+ responses:
10306
+ '200':
10307
+ description: The updated shipping method.
10308
+ content:
10309
+ application/json:
10310
+ schema:
10311
+ "$ref": "#/components/schemas/ShippingMethod"
10312
+ '400':
10313
+ description: Bad request, perhaps invalid JSON?
10314
+ content:
10315
+ application/json:
10316
+ schema:
10317
+ "$ref": "#/components/schemas/Error"
10318
+ '404':
10319
+ description: Incorrect site or shipping method ID.
10320
+ content:
10321
+ application/json:
10322
+ schema:
10323
+ "$ref": "#/components/schemas/Error"
10324
+ '422':
10325
+ description: Invalid request parameters
10326
+ content:
10327
+ application/json:
10328
+ schema:
10329
+ "$ref": "#/components/schemas/Error"
10330
+ default:
10331
+ description: Unexpected error.
10332
+ content:
10333
+ application/json:
10334
+ schema:
10335
+ "$ref": "#/components/schemas/Error"
10336
+ x-code-samples: []
10337
+ delete:
10338
+ tags:
10339
+ - shipping_method
10340
+ operationId: deactivate_shipping_method
10341
+ summary: Deactivate a shipping method
10342
+ parameters:
10343
+ - "$ref": "#/components/parameters/site_id"
10344
+ - "$ref": "#/components/parameters/shipping_method_id"
10345
+ description: Deactivating a shipping method makes it unavailable for new subscriptions
10346
+ or purchases. It will not affect existing subscriptions.
10347
+ responses:
10348
+ '200':
10349
+ description: A shipping method.
10350
+ content:
10351
+ application/json:
10352
+ schema:
10353
+ "$ref": "#/components/schemas/ShippingMethod"
10354
+ '422':
10355
+ description: Shipping method may already be inactive.
10356
+ content:
10357
+ application/json:
10358
+ schema:
10359
+ "$ref": "#/components/schemas/Error"
10360
+ default:
10361
+ description: Unexpected error.
9866
10362
  content:
9867
10363
  application/json:
9868
10364
  schema:
@@ -10872,6 +11368,25 @@ paths:
10872
11368
  schema:
10873
11369
  "$ref": "#/components/schemas/Error"
10874
11370
  x-code-samples:
11371
+ - lang: Node.js
11372
+ source: |
11373
+ try {
11374
+ let pauseReq = {
11375
+ remaining_pause_cycles: 2,
11376
+ }
11377
+ const subscription = await client.pauseSubscription(subscriptionId, pauseReq)
11378
+ console.log('Paused subscription: ', subscription.id)
11379
+ } catch (err) {
11380
+ if (err instanceof recurly.errors.ValidationError) {
11381
+ // If the request was not valid, you may want to tell your user
11382
+ // why. You can find the invalid params and reasons in err.params
11383
+ console.log('Failed validation', err.params)
11384
+ } else {
11385
+ // If we don't know what to do with the err, we should
11386
+ // probably re-raise and let our web framework and logger handle it
11387
+ console.log('Unknown Error: ', err)
11388
+ }
11389
+ }
10875
11390
  - lang: Python
10876
11391
  source: |
10877
11392
  try:
@@ -11001,6 +11516,22 @@ paths:
11001
11516
  schema:
11002
11517
  "$ref": "#/components/schemas/Error"
11003
11518
  x-code-samples:
11519
+ - lang: Node.js
11520
+ source: |
11521
+ try {
11522
+ const subscription = await client.resumeSubscription(subscriptionId)
11523
+ console.log('Resumed subscription: ', subscription.id)
11524
+ } catch (err) {
11525
+ if (err instanceof recurly.errors.ValidationError) {
11526
+ // If the request was not valid, you may want to tell your user
11527
+ // why. You can find the invalid params and reasons in err.params
11528
+ console.log('Failed validation', err.params)
11529
+ } else {
11530
+ // If we don't know what to do with the err, we should
11531
+ // probably re-raise and let our web framework and logger handle it
11532
+ console.log('Unknown Error: ', err)
11533
+ }
11534
+ }
11004
11535
  - lang: Python
11005
11536
  source: |
11006
11537
  try:
@@ -11041,6 +11572,19 @@ paths:
11041
11572
  # just return nil
11042
11573
  puts "Resource Not Found"
11043
11574
  end
11575
+ - lang: Java
11576
+ source: |
11577
+ try {
11578
+ final Subscription subscription = client.resumeSubscription(subscriptionId);
11579
+ System.out.println("Resumed Subscription: " + subscription.getUuid());
11580
+ } catch (ValidationException e) {
11581
+ // If the request was not valid, you may want to tell your user
11582
+ // why. You can find the invalid params and reasons in e.getError().getParams()
11583
+ System.out.println("Failed validation: " + e.getError().getMessage());
11584
+ } catch (ApiException e) {
11585
+ // Use ApiException to catch a generic error from the API
11586
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
11587
+ }
11044
11588
  - lang: PHP
11045
11589
  source: |
11046
11590
  try {
@@ -11555,6 +12099,13 @@ paths:
11555
12099
  schema:
11556
12100
  "$ref": "#/components/schemas/Error"
11557
12101
  x-code-samples:
12102
+ - lang: Node.js
12103
+ source: |
12104
+ const invoices = client.listSubscriptionInvoices(subscriptionId, { limit: 200 })
12105
+
12106
+ for await (const invoice of invoices.each()) {
12107
+ console.log(invoice.number)
12108
+ }
11558
12109
  - lang: Python
11559
12110
  source: |
11560
12111
  invoices = client.list_subscription_invoices(subscription_id).items()
@@ -11645,6 +12196,13 @@ paths:
11645
12196
  schema:
11646
12197
  "$ref": "#/components/schemas/Error"
11647
12198
  x-code-samples:
12199
+ - lang: Node.js
12200
+ source: |
12201
+ const lineItems = client.listSubscriptionLineItems(subscriptionId, { limit: 200 })
12202
+
12203
+ for await (const lineItem of lineItems.each()) {
12204
+ console.log(lineItem.id)
12205
+ }
11648
12206
  - lang: Python
11649
12207
  source: |
11650
12208
  line_items = client.list_subscription_line_items(subscription_id).items()
@@ -11725,6 +12283,13 @@ paths:
11725
12283
  schema:
11726
12284
  "$ref": "#/components/schemas/Error"
11727
12285
  x-code-samples:
12286
+ - lang: Node.js
12287
+ source: |
12288
+ const redemptions = client.listSubscriptionCouponRedemptions(subscriptionId, { limit: 200 })
12289
+
12290
+ for await (const redemption of redemptions.each()) {
12291
+ console.log(redemption.id)
12292
+ }
11728
12293
  - lang: Python
11729
12294
  source: |
11730
12295
  redemptions = client.list_subscription_coupon_redemptions(subscription_id).items()
@@ -12240,7 +12805,7 @@ paths:
12240
12805
  AccountPurchase account = new AccountPurchase();
12241
12806
  account.setCode(accountCode);
12242
12807
  account.setFirstName("Benjamin");
12243
- account.setLastName("Eckel");
12808
+ account.setLastName("DuMonde");
12244
12809
 
12245
12810
  BillingInfoCreate billing = new BillingInfoCreate();
12246
12811
  billing.setTokenId(rjsTokenId);
@@ -12467,6 +13032,42 @@ paths:
12467
13032
  # why. You can find the invalid params and reasons in e.recurly_error.params
12468
13033
  puts "ValidationError: #{e.recurly_error.params}"
12469
13034
  end
13035
+ - lang: Java
13036
+ source: |
13037
+ try {
13038
+
13039
+ AccountPurchase account = new AccountPurchase();
13040
+ account.setCode(accountCode);
13041
+ account.setFirstName("Joanna");
13042
+ account.setLastName("DuMonde");
13043
+
13044
+ BillingInfoCreate billing = new BillingInfoCreate();
13045
+ billing.setTokenId(rjsTokenId);
13046
+ account.setBillingInfo(billing);
13047
+
13048
+ List<SubscriptionPurchase> subscriptions = new ArrayList<SubscriptionPurchase>();
13049
+ SubscriptionPurchase sub = new SubscriptionPurchase();
13050
+ sub.setPlanCode(planCode);
13051
+ subscriptions.add(sub);
13052
+
13053
+ PurchaseCreate purchase = new PurchaseCreate();
13054
+ purchase.setCurrency("USD");
13055
+ purchase.setAccount(account);
13056
+ purchase.setSubscriptions(subscriptions);
13057
+
13058
+ InvoiceCollection collection = client.previewPurchase(purchase);
13059
+ System.out.println("Preview Charge Invoice:" + collection.getChargeInvoice());
13060
+ System.out.println("Preview Credit Invoices: " + collection.getCreditInvoices());
13061
+
13062
+ } catch (ValidationException e) {
13063
+ // If the request was not valid, you may want to tell your user
13064
+ // why. You can find the invalid params and reasons in e.getError().getParams()
13065
+ System.out.println("Failed validation: " + e.getError().getMessage());
13066
+ System.out.println("Params: " + e.getError().getParams());
13067
+ } catch (ApiException e) {
13068
+ // Use ApiException to catch a generic error from the API
13069
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
13070
+ }
12470
13071
  - lang: PHP
12471
13072
  source: |
12472
13073
  try {
@@ -12593,6 +13194,14 @@ components:
12593
13194
  required: true
12594
13195
  schema:
12595
13196
  type: string
13197
+ shipping_method_id:
13198
+ name: shipping_method_id
13199
+ in: path
13200
+ description: Shipping Method ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`.
13201
+ For code use prefix `code-`, e.g. `code-usps_2-day`.
13202
+ required: true
13203
+ schema:
13204
+ type: string
12596
13205
  subscription_id:
12597
13206
  name: subscription_id
12598
13207
  in: path
@@ -13885,7 +14494,9 @@ components:
13885
14494
  tier_type:
13886
14495
  type: string
13887
14496
  title: Tier type
13888
- description: The type of tiering used by the Add-on.
14497
+ description: |
14498
+ The pricing model for the add-on. For more information,
14499
+ [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based).
13889
14500
  default: flat
13890
14501
  enum:
13891
14502
  - flat
@@ -13897,7 +14508,11 @@ components:
13897
14508
  title: Tiers
13898
14509
  items:
13899
14510
  "$ref": "#/components/schemas/Tier"
13900
- description: At least one tier is required if `tier_type` is not 'flat'.
14511
+ description: |
14512
+ If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object
14513
+ must include one to many tiers with `ending_quantity` and `unit_amount` for
14514
+ the desired `currencies`. There must be one tier with an `ending_quantity` of
14515
+ 999999999 which is the default if not provided.
13901
14516
  required:
13902
14517
  - code
13903
14518
  - name
@@ -13987,8 +14602,10 @@ components:
13987
14602
  items:
13988
14603
  "$ref": "#/components/schemas/Tier"
13989
14604
  description: |
13990
- If tiers are provided in the request, all existing tiers on the Add-on will be
13991
- removed and replaced by the tiers in the request.
14605
+ If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object
14606
+ must include one to many tiers with `ending_quantity` and `unit_amount` for
14607
+ the desired `currencies`. There must be one tier with an `ending_quantity` of
14608
+ 999999999 which is the default if not provided.
13992
14609
  BillingInfo:
13993
14610
  type: object
13994
14611
  properties:
@@ -14161,15 +14778,27 @@ components:
14161
14778
  name_on_account:
14162
14779
  type: string
14163
14780
  maxLength: 255
14164
- description: The name associated with the bank account.
14781
+ description: The name associated with the bank account (ACH, SEPA, Bacs
14782
+ only)
14165
14783
  account_number:
14166
14784
  type: string
14167
14785
  maxLength: 255
14168
- description: The bank account number. (ACH only)
14786
+ description: The bank account number. (ACH, Bacs only)
14169
14787
  routing_number:
14170
14788
  type: string
14171
14789
  maxLength: 15
14172
14790
  description: The bank's rounting number. (ACH only)
14791
+ sort_code:
14792
+ type: string
14793
+ maxLength: 15
14794
+ description: Bank identifier code for UK based banks. Required for Bacs
14795
+ based billing infos. (Bacs only)
14796
+ type:
14797
+ type: string
14798
+ enum:
14799
+ - bacs
14800
+ description: The payment method type for a non-credit card based billing
14801
+ info. The value of `bacs` is the only accepted value (Bacs only)
14173
14802
  account_type:
14174
14803
  type: string
14175
14804
  enum:
@@ -16130,6 +16759,11 @@ components:
16130
16759
  trial`.
16131
16760
  default: 0
16132
16761
  minimum: 0
16762
+ trial_requires_billing_info:
16763
+ type: boolean
16764
+ title: Trial Requires BillingInfo
16765
+ description: Allow free trial subscriptions to be created without billing
16766
+ info.
16133
16767
  total_billing_cycles:
16134
16768
  type: integer
16135
16769
  title: Total billing cycles
@@ -16198,6 +16832,13 @@ components:
16198
16832
  type: object
16199
16833
  title: Hosted pages settings
16200
16834
  "$ref": "#/components/schemas/PlanHostedPages"
16835
+ allow_any_item_on_subscriptions:
16836
+ type: boolean
16837
+ title: Allow any item on subscriptions
16838
+ description: |
16839
+ Used to determine whether items can be assigned as add-ons to individual subscriptions.
16840
+ If `true`, items can be assigned as add-ons to individual subscription add-ons.
16841
+ If `false`, only plan add-ons can be used.
16201
16842
  created_at:
16202
16843
  type: string
16203
16844
  format: date-time
@@ -16272,6 +16913,13 @@ components:
16272
16913
  trial`.
16273
16914
  default: 0
16274
16915
  minimum: 0
16916
+ trial_requires_billing_info:
16917
+ type: boolean
16918
+ title: Trial Requires BillingInfo
16919
+ description: Allow free trial subscriptions to be created without billing
16920
+ info. Should not be used if billing info is needed for initial invoice
16921
+ due to existing uninvoiced charges or setup fee.
16922
+ default: true
16275
16923
  total_billing_cycles:
16276
16924
  type: integer
16277
16925
  title: Total billing cycles
@@ -16339,6 +16987,14 @@ components:
16339
16987
  title: Add Ons
16340
16988
  items:
16341
16989
  "$ref": "#/components/schemas/AddOnCreate"
16990
+ allow_any_item_on_subscriptions:
16991
+ type: boolean
16992
+ title: Allow any item on subscriptions
16993
+ default: false
16994
+ description: |
16995
+ Used to determine whether items can be assigned as add-ons to individual subscriptions.
16996
+ If `true`, items can be assigned as add-ons to individual subscription add-ons.
16997
+ If `false`, only plan add-ons can be used.
16342
16998
  required:
16343
16999
  - code
16344
17000
  - name
@@ -16436,6 +17092,13 @@ components:
16436
17092
  trial`.
16437
17093
  default: 0
16438
17094
  minimum: 0
17095
+ trial_requires_billing_info:
17096
+ type: boolean
17097
+ title: Trial Requires BillingInfo
17098
+ description: Allow free trial subscriptions to be created without billing
17099
+ info. Should not be used if billing info is needed for initial invoice
17100
+ due to existing uninvoiced charges or setup fee.
17101
+ default: true
16439
17102
  total_billing_cycles:
16440
17103
  type: integer
16441
17104
  title: Total billing cycles
@@ -16503,6 +17166,13 @@ components:
16503
17166
  title: Add Ons
16504
17167
  items:
16505
17168
  "$ref": "#/components/schemas/AddOnCreate"
17169
+ allow_any_item_on_subscriptions:
17170
+ type: boolean
17171
+ title: Allow any item on subscriptions
17172
+ description: |
17173
+ Used to determine whether items can be assigned as add-ons to individual subscriptions.
17174
+ If `true`, items can be assigned as add-ons to individual subscription add-ons.
17175
+ If `false`, only plan add-ons can be used.
16506
17176
  AddOnPricing:
16507
17177
  type: object
16508
17178
  properties:
@@ -16798,6 +17468,79 @@ components:
16798
17468
  title: Name
16799
17469
  description: The name of the shipping method displayed to customers.
16800
17470
  maxLength: 100
17471
+ ShippingMethodCreate:
17472
+ type: object
17473
+ properties:
17474
+ code:
17475
+ type: string
17476
+ title: Code
17477
+ description: The internal name used identify the shipping method.
17478
+ pattern: "/^[a-z0-9_+-]+$/i"
17479
+ maxLength: 50
17480
+ name:
17481
+ type: string
17482
+ title: Name
17483
+ description: The name of the shipping method displayed to customers.
17484
+ maxLength: 100
17485
+ accounting_code:
17486
+ type: string
17487
+ title: Accounting Code
17488
+ description: Accounting code for shipping method.
17489
+ maxLength: 20
17490
+ tax_code:
17491
+ type: string
17492
+ title: Tax code
17493
+ description: |
17494
+ Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax
17495
+ code values are specific to each tax system. If you are using Recurly’s
17496
+ built-in taxes the values are:
17497
+
17498
+ - `FR` – Common Carrier FOB Destination
17499
+ - `FR022000` – Common Carrier FOB Origin
17500
+ - `FR020400` – Non Common Carrier FOB Destination
17501
+ - `FR020500` – Non Common Carrier FOB Origin
17502
+ - `FR010100` – Delivery by Company Vehicle Before Passage of Title
17503
+ - `FR010200` – Delivery by Company Vehicle After Passage of Title
17504
+ - `NT` – Non-Taxable
17505
+ maxLength: 50
17506
+ required:
17507
+ - code
17508
+ - name
17509
+ ShippingMethodUpdate:
17510
+ type: object
17511
+ properties:
17512
+ code:
17513
+ type: string
17514
+ title: Code
17515
+ description: The internal name used identify the shipping method.
17516
+ pattern: "/^[a-z0-9_+-]+$/i"
17517
+ maxLength: 50
17518
+ name:
17519
+ type: string
17520
+ title: Name
17521
+ description: The name of the shipping method displayed to customers.
17522
+ maxLength: 100
17523
+ accounting_code:
17524
+ type: string
17525
+ title: Accounting Code
17526
+ description: Accounting code for shipping method.
17527
+ maxLength: 20
17528
+ tax_code:
17529
+ type: string
17530
+ title: Tax code
17531
+ description: |
17532
+ Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax
17533
+ code values are specific to each tax system. If you are using Recurly’s
17534
+ built-in taxes the values are:
17535
+
17536
+ - `FR` – Common Carrier FOB Destination
17537
+ - `FR022000` – Common Carrier FOB Origin
17538
+ - `FR020400` – Non Common Carrier FOB Destination
17539
+ - `FR020500` – Non Common Carrier FOB Origin
17540
+ - `FR010100` – Delivery by Company Vehicle Before Passage of Title
17541
+ - `FR010200` – Delivery by Company Vehicle After Passage of Title
17542
+ - `NT` – Non-Taxable
17543
+ maxLength: 50
16801
17544
  ShippingFeeCreate:
16802
17545
  type: object
16803
17546
  properties:
@@ -17223,8 +17966,11 @@ components:
17223
17966
  items:
17224
17967
  "$ref": "#/components/schemas/SubscriptionAddOnTier"
17225
17968
  minItems: 1
17226
- description: If the plan add-on's `tier_type` is `flat`, then `tiers` must
17227
- be absent.
17969
+ description: |
17970
+ If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object
17971
+ must include one to many tiers with `ending_quantity` and `unit_amount`.
17972
+ There must be one tier with an `ending_quantity` of 999999999 which is the
17973
+ default if not provided.
17228
17974
  revenue_schedule_type:
17229
17975
  type: string
17230
17976
  title: Revenue schedule type
@@ -17269,8 +18015,11 @@ components:
17269
18015
  items:
17270
18016
  "$ref": "#/components/schemas/SubscriptionAddOnTier"
17271
18017
  minItems: 1
17272
- description: If the plan add-on's `tier_type` is `flat`, then `tiers` must
17273
- be absent.
18018
+ description: |
18019
+ If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object
18020
+ must include one to many tiers with `ending_quantity` and `unit_amount`.
18021
+ There must be one tier with an `ending_quantity` of 999999999 which is the
18022
+ default if not provided.
17274
18023
  revenue_schedule_type:
17275
18024
  type: string
17276
18025
  title: Revenue schedule type
@@ -18173,6 +18922,10 @@ components:
18173
18922
  type: string
18174
18923
  format: date-time
18175
18924
  title: Created at
18925
+ updated_at:
18926
+ type: string
18927
+ format: date-time
18928
+ title: Updated at
18176
18929
  voided_at:
18177
18930
  type: string
18178
18931
  format: date-time