recurly 3.3.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.bumpversion.cfg +5 -1
  3. data/.github/ISSUE_TEMPLATE/bug-report.md +1 -1
  4. data/.github/workflows/docs.yml +28 -0
  5. data/.github_changelog_generator +8 -0
  6. data/.travis.yml +1 -0
  7. data/CHANGELOG.md +209 -0
  8. data/GETTING_STARTED.md +61 -1
  9. data/README.md +1 -1
  10. data/lib/data/ca-certificates.crt +3464 -29
  11. data/lib/recurly.rb +1 -0
  12. data/lib/recurly/client.rb +215 -111
  13. data/lib/recurly/client/operations.rb +263 -0
  14. data/lib/recurly/connection_pool.rb +40 -0
  15. data/lib/recurly/errors.rb +30 -0
  16. data/lib/recurly/errors/network_errors.rb +2 -0
  17. data/lib/recurly/http.rb +13 -8
  18. data/lib/recurly/pager.rb +31 -12
  19. data/lib/recurly/requests/add_on_create.rb +22 -6
  20. data/lib/recurly/requests/add_on_update.rb +13 -1
  21. data/lib/recurly/requests/billing_info_create.rb +21 -1
  22. data/lib/recurly/requests/external_transaction.rb +26 -0
  23. data/lib/recurly/requests/invoice_refund.rb +2 -2
  24. data/lib/recurly/requests/line_item_create.rb +2 -2
  25. data/lib/recurly/requests/plan_create.rb +8 -0
  26. data/lib/recurly/requests/plan_update.rb +8 -0
  27. data/lib/recurly/requests/subscription_add_on_create.rb +9 -1
  28. data/lib/recurly/requests/subscription_add_on_tier.rb +18 -0
  29. data/lib/recurly/requests/subscription_add_on_update.rb +10 -2
  30. data/lib/recurly/requests/subscription_change_create.rb +5 -1
  31. data/lib/recurly/requests/subscription_create.rb +4 -0
  32. data/lib/recurly/requests/subscription_purchase.rb +4 -0
  33. data/lib/recurly/requests/subscription_update.rb +4 -0
  34. data/lib/recurly/requests/tier.rb +18 -0
  35. data/lib/recurly/resources/add_on.rb +12 -0
  36. data/lib/recurly/resources/coupon.rb +4 -0
  37. data/lib/recurly/resources/line_item.rb +4 -4
  38. data/lib/recurly/resources/payment_method.rb +4 -0
  39. data/lib/recurly/resources/plan.rb +8 -0
  40. data/lib/recurly/resources/shipping_method.rb +4 -0
  41. data/lib/recurly/resources/subscription.rb +4 -0
  42. data/lib/recurly/resources/subscription_add_on.rb +12 -0
  43. data/lib/recurly/resources/subscription_add_on_tier.rb +18 -0
  44. data/lib/recurly/resources/subscription_change.rb +8 -0
  45. data/lib/recurly/resources/tier.rb +18 -0
  46. data/lib/recurly/version.rb +1 -1
  47. data/openapi/api.yaml +5973 -3092
  48. data/recurly.gemspec +9 -4
  49. data/scripts/bump +8 -1
  50. data/scripts/changelog +14 -0
  51. data/scripts/format +5 -1
  52. data/scripts/prepare-release +36 -0
  53. data/scripts/release +25 -4
  54. metadata +22 -41
  55. data/lib/recurly/client/adapter.rb +0 -39
@@ -0,0 +1,40 @@
1
+ require "net/https"
2
+
3
+ module Recurly
4
+ class ConnectionPool
5
+ def initialize
6
+ @mutex = Mutex.new
7
+ @pool = []
8
+ end
9
+
10
+ def with_connection
11
+ http = nil
12
+ @mutex.synchronize do
13
+ http = @pool.pop
14
+ end
15
+
16
+ # create connection if the pool was empty
17
+ http ||= init_http_connection
18
+
19
+ response = yield http
20
+
21
+ if http.started?
22
+ @mutex.synchronize do
23
+ @pool.push(http)
24
+ end
25
+ end
26
+
27
+ response
28
+ end
29
+
30
+ def init_http_connection
31
+ http = Net::HTTP.new(Client::BASE_HOST, Client::BASE_PORT)
32
+ http.use_ssl = true
33
+ http.ca_file = Client::CA_FILE
34
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
35
+ http.keep_alive_timeout = 600
36
+
37
+ http
38
+ end
39
+ end
40
+ end
@@ -17,6 +17,36 @@ module Recurly
17
17
  Errors.const_get(class_name)
18
18
  end
19
19
 
20
+ # When the response does not have a JSON body, this determines the appropriate
21
+ # Error class based on the response code. This may occur when a load balancer
22
+ # returns an error before it reaches Recurly's API.
23
+ # @param response [Net::Response]
24
+ # @return [Errors::APIError,Errors::NetworkError]
25
+ # rubocop:disable Metrics/CyclomaticComplexity
26
+ def self.from_response(response)
27
+ case response
28
+ when Net::HTTPBadRequest # 400
29
+ Recurly::Errors::BadRequestError
30
+ when Net::HTTPUnauthorized, Net::HTTPForbidden # 401, 403
31
+ Recurly::Errors::UnauthorizedError
32
+ when Net::HTTPRequestTimeOut # 408
33
+ Recurly::Errors::TimeoutError
34
+ when Net::HTTPTooManyRequests # 429
35
+ Recurly::Errors::RateLimitedError
36
+ when Net::HTTPInternalServerError # 500
37
+ Recurly::Errors::InternalServerError
38
+ when Net::HTTPServiceUnavailable # 503
39
+ Recurly::Errors::UnavailableError
40
+ when Net::HTTPGatewayTimeOut # 504
41
+ Recurly::Errors::TimeoutError
42
+ when Net::HTTPServerError # 5xx
43
+ Recurly::Errors::UnavailableError
44
+ else
45
+ Recurly::Errors::APIError
46
+ end
47
+ end
48
+ # rubocop:enable Metrics/CyclomaticComplexity
49
+
20
50
  def initialize(response, error)
21
51
  super(error.message)
22
52
  @response = response
@@ -1,8 +1,10 @@
1
1
  module Recurly
2
2
  module Errors
3
3
  class NetworkError < StandardError; end
4
+ class InvalidResponseError < NetworkError; end
4
5
  class TimeoutError < NetworkError; end
5
6
  class ConnectionFailedError < NetworkError; end
6
7
  class SSLError < NetworkError; end
8
+ class UnavailableError < NetworkError; end
7
9
  end
8
10
  end
@@ -4,16 +4,21 @@ module Recurly
4
4
  attr_accessor :status, :body, :request,
5
5
  :request_id, :rate_limit, :rate_limit_remaining,
6
6
  :rate_limit_reset, :date, :proxy_metadata,
7
- :content_type
7
+ :content_type, :total_records
8
8
 
9
9
  def initialize(resp, request)
10
- @request = request
11
- @status = resp.status
12
- @request_id = resp.headers["x-request-id"]
13
- @rate_limit = resp.headers["x-ratelimit-limit"].to_i
14
- @rate_limit_remaining = resp.headers["x-ratelimit-remaining"].to_i
15
- @rate_limit_reset = Time.at(resp.headers["x-ratelimit-reset"].to_i).to_datetime
16
- @content_type = resp.headers["content-type"].split(";").first if resp.headers["content-type"]
10
+ @request = Request.new(request.method, request.path, request.body)
11
+ @status = resp.code.to_i
12
+ @request_id = resp["x-request-id"]
13
+ @rate_limit = resp["x-ratelimit-limit"].to_i
14
+ @rate_limit_remaining = resp["x-ratelimit-remaining"].to_i
15
+ @rate_limit_reset = Time.at(resp["x-ratelimit-reset"].to_i).to_datetime
16
+ @total_records = resp["recurly-total-records"]&.to_i
17
+ if resp["content-type"]
18
+ @content_type = resp["content-type"].split(";").first
19
+ else
20
+ @content_type = resp.content_type
21
+ end
17
22
  if resp.body && !resp.body.empty?
18
23
  @body = resp.body
19
24
  else
@@ -7,7 +7,25 @@ module Recurly
7
7
  @client = client
8
8
  @path = path
9
9
  @options = map_array_params(options)
10
- @next = build_path(@path, @options)
10
+ rewind!
11
+ end
12
+
13
+ # Performs a request with the pager `limit` set to 1 and only returns the first
14
+ # result in the response.
15
+ def first
16
+ # Modify the @next url to set the :limit to 1
17
+ original_next = @next
18
+ @next = @path
19
+ fetch_next!(@options.merge(limit: 1))
20
+ # Restore the @next url to the original
21
+ @next = original_next
22
+ @data.first
23
+ end
24
+
25
+ # Makes a HEAD request to the API to determine how many total records exist.
26
+ def count
27
+ resource = @client.send(:head, self.next, @options)
28
+ resource.get_response.total_records
11
29
  end
12
30
 
13
31
  # Enumerates each "page" from the server.
@@ -84,7 +102,9 @@ module Recurly
84
102
  def page_enumerator
85
103
  Enumerator.new do |yielder|
86
104
  loop do
87
- fetch_next!
105
+ # Pass in @options when requesting the first page (@data.empty?)
106
+ next_options = @data.empty? ? @options : {}
107
+ fetch_next!(next_options)
88
108
  yielder << data
89
109
  unless has_more?
90
110
  rewind!
@@ -94,8 +114,9 @@ module Recurly
94
114
  end
95
115
  end
96
116
 
97
- def fetch_next!
98
- page = @client.next_page(self)
117
+ def fetch_next!(options)
118
+ path = extract_path(self.next)
119
+ page = @client.send(:get, path, options)
99
120
  @data = page.data.map { |d| JSONParser.from_json(d) }
100
121
  @has_more = page.has_more
101
122
  @next = page.next
@@ -103,15 +124,13 @@ module Recurly
103
124
 
104
125
  def rewind!
105
126
  @data = []
106
- @next = build_path(@path, @options)
127
+ @next = @path
107
128
  end
108
129
 
109
- def build_path(path, options)
110
- if options.empty?
111
- path
112
- else
113
- "#{path}?#{URI.encode_www_form(options)}"
114
- end
130
+ # Returns just the path and parameters so we can safely reuse the connection
131
+ def extract_path(uri_or_path)
132
+ uri = URI(uri_or_path)
133
+ uri.kind_of?(URI::HTTP) ? uri.request_uri : uri_or_path
115
134
  end
116
135
 
117
136
  # Converts array parameters to CSV strings to maintain consistency with
@@ -121,7 +140,7 @@ module Recurly
121
140
  @options = params.map do |key, param|
122
141
  new_param = param.is_a?(Array) ? param.join(",") : param
123
142
  [key, new_param]
124
- end
143
+ end.to_h
125
144
  end
126
145
  end
127
146
  end
@@ -7,7 +7,7 @@ module Recurly
7
7
  class AddOnCreate < Request
8
8
 
9
9
  # @!attribute accounting_code
10
- # @return [String] Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If `item_code`/`item_id` is part of the request then `code` must be absent.
10
+ # @return [String] Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent.
11
11
  define_attribute :accounting_code, String
12
12
 
13
13
  # @!attribute code
@@ -15,7 +15,7 @@ module Recurly
15
15
  define_attribute :code, String
16
16
 
17
17
  # @!attribute currencies
18
- # @return [Array[AddOnPricing]] If `item_code`/`item_id` is part of the request and the item has a default currency then `currencies` is optional. If the item does not have a default currency, then `currencies` is required. If `item_code`/`item_id` is not present `currencies` is required.
18
+ # @return [Array[AddOnPricing]] * If `item_code`/`item_id` is part of the request and the item has a default currency then `currencies` is optional. If the item does not have a default currency, then `currencies` is required. If `item_code`/`item_id` is not present `currencies` is required. * If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `currencies` must be absent.
19
19
  define_attribute :currencies, Array, { :item_type => :AddOnPricing }
20
20
 
21
21
  # @!attribute default_quantity
@@ -27,24 +27,40 @@ module Recurly
27
27
  define_attribute :display_quantity, :Boolean
28
28
 
29
29
  # @!attribute item_code
30
- # @return [String] Unique code to identify an item, when the `Catalog: Item Add-Ons` feature is enabled. If `item_id` and `item_code` are both present, `item_id` will be used.
30
+ # @return [String] Unique code to identify an item. Avaliable when the `Credit Invoices` and `Subscription Billing Terms` features are enabled. If `item_id` and `item_code` are both present, `item_id` will be used.
31
31
  define_attribute :item_code, String
32
32
 
33
33
  # @!attribute item_id
34
- # @return [String] Available when the `Catalog: Item Add-Ons` feature is enabled. If `item_id` and `item_code` are both present, `item_id` will be used.
34
+ # @return [String] System-generated unique identifier for an item. Available when the `Credit Invoices` and `Subscription Billing Terms` features are enabled. If `item_id` and `item_code` are both present, `item_id` will be used.
35
35
  define_attribute :item_id, String
36
36
 
37
37
  # @!attribute name
38
- # @return [String] Describes your add-on and will appear in subscribers' invoices. If `item_code`/`item_id` is part of the request then `code` must be absent. If `item_code`/`item_id` is not present `code` is required.
38
+ # @return [String] Describes your add-on and will appear in subscribers' invoices. If `item_code`/`item_id` is part of the request then `name` must be absent. If `item_code`/`item_id` is not present `name` is required.
39
39
  define_attribute :name, String
40
40
 
41
+ # @!attribute optional
42
+ # @return [Boolean] Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API.
43
+ define_attribute :optional, :Boolean
44
+
41
45
  # @!attribute plan_id
42
46
  # @return [String] Plan ID
43
47
  define_attribute :plan_id, String
44
48
 
49
+ # @!attribute revenue_schedule_type
50
+ # @return [String] When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item.
51
+ define_attribute :revenue_schedule_type, String
52
+
45
53
  # @!attribute tax_code
46
- # @return [String] Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If `item_code`/`item_id` is part of the request then `code` must be absent.
54
+ # @return [String] Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If `item_code`/`item_id` is part of the request then `tax_code` must be absent.
47
55
  define_attribute :tax_code, String
56
+
57
+ # @!attribute tier_type
58
+ # @return [String] The type of tiering used by the Add-on.
59
+ define_attribute :tier_type, String
60
+
61
+ # @!attribute tiers
62
+ # @return [Array[Tier]] At least one tier is required if `tier_type` is not 'flat'.
63
+ define_attribute :tiers, Array, { :item_type => :Tier }
48
64
  end
49
65
  end
50
66
  end
@@ -15,7 +15,7 @@ module Recurly
15
15
  define_attribute :code, String
16
16
 
17
17
  # @!attribute currencies
18
- # @return [Array[AddOnPricing]] Add-on pricing
18
+ # @return [Array[AddOnPricing]] If the add-on's `tier_type` is `tiered`, `volume` or `stairstep`, then `currencies` must be absent.
19
19
  define_attribute :currencies, Array, { :item_type => :AddOnPricing }
20
20
 
21
21
  # @!attribute default_quantity
@@ -34,9 +34,21 @@ module Recurly
34
34
  # @return [String] Describes your add-on and will appear in subscribers' invoices. If an `Item` is associated to the `AddOn` then `name` must be absent.
35
35
  define_attribute :name, String
36
36
 
37
+ # @!attribute optional
38
+ # @return [Boolean] Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API.
39
+ define_attribute :optional, :Boolean
40
+
41
+ # @!attribute revenue_schedule_type
42
+ # @return [String] When this add-on is invoiced, the line item will use this revenue schedule. If an `Item` is associated to the `AddOn` then `revenue_schedule_type` must be absent in the request as the value will be set from the item.
43
+ define_attribute :revenue_schedule_type, String
44
+
37
45
  # @!attribute tax_code
38
46
  # @return [String] Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If an `Item` is associated to the `AddOn` then `tax code` must be absent.
39
47
  define_attribute :tax_code, String
48
+
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.
51
+ define_attribute :tiers, Array, { :item_type => :Tier }
40
52
  end
41
53
  end
42
54
  end
@@ -6,6 +6,14 @@ module Recurly
6
6
  module Requests
7
7
  class BillingInfoCreate < Request
8
8
 
9
+ # @!attribute account_number
10
+ # @return [String] The bank account number. (ACH only)
11
+ define_attribute :account_number, String
12
+
13
+ # @!attribute account_type
14
+ # @return [String] The bank account type. (ACH only)
15
+ define_attribute :account_type, String
16
+
9
17
  # @!attribute address
10
18
  # @return [Address]
11
19
  define_attribute :address, :Address
@@ -38,6 +46,10 @@ module Recurly
38
46
  # @return [String] A token used in place of a credit card in order to perform transactions. Must be used in conjunction with `gateway_code`.
39
47
  define_attribute :gateway_token, String
40
48
 
49
+ # @!attribute iban
50
+ # @return [String] The International Bank Account Number, up to 34 alphanumeric characters comprising a country code; two check digits; and a number that includes the domestic bank account number, branch identifier, and potential routing information. (SEPA only)
51
+ define_attribute :iban, String
52
+
41
53
  # @!attribute ip_address
42
54
  # @return [String] *STRONGLY RECOMMENDED* Customer's IP address when updating their billing information.
43
55
  define_attribute :ip_address, String
@@ -50,6 +62,10 @@ module Recurly
50
62
  # @return [String] Expiration month
51
63
  define_attribute :month, String
52
64
 
65
+ # @!attribute name_on_account
66
+ # @return [String] The name associated with the bank account.
67
+ define_attribute :name_on_account, String
68
+
53
69
  # @!attribute number
54
70
  # @return [String] Credit card number, spaces and dashes are accepted.
55
71
  define_attribute :number, String
@@ -58,12 +74,16 @@ module Recurly
58
74
  # @return [String] PayPal billing agreement ID
59
75
  define_attribute :paypal_billing_agreement_id, String
60
76
 
77
+ # @!attribute routing_number
78
+ # @return [String] The bank's rounting number. (ACH only)
79
+ define_attribute :routing_number, String
80
+
61
81
  # @!attribute three_d_secure_action_result_token_id
62
82
  # @return [String] A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge.
63
83
  define_attribute :three_d_secure_action_result_token_id, String
64
84
 
65
85
  # @!attribute token_id
66
- # @return [String] A token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token).
86
+ # @return [String] A token [generated by Recurly.js](https://developers.recurly.com/reference/recurly-js/#getting-a-token).
67
87
  define_attribute :token_id, String
68
88
 
69
89
  # @!attribute transaction_type
@@ -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 ExternalTransaction < Request
8
+
9
+ # @!attribute amount
10
+ # @return [Float] The total amount of the transcaction. Cannot excceed the invoice total.
11
+ define_attribute :amount, Float
12
+
13
+ # @!attribute collected_at
14
+ # @return [DateTime] Datetime that the external payment was collected. Defaults to current datetime.
15
+ define_attribute :collected_at, DateTime
16
+
17
+ # @!attribute description
18
+ # @return [String] Used as the transaction's description.
19
+ define_attribute :description, String
20
+
21
+ # @!attribute payment_method
22
+ # @return [String] Payment method used for the external transaction.
23
+ define_attribute :payment_method, String
24
+ end
25
+ end
26
+ end
@@ -7,8 +7,8 @@ module Recurly
7
7
  class InvoiceRefund < Request
8
8
 
9
9
  # @!attribute amount
10
- # @return [Integer] The amount to be refunded. The amount will be split between the line items. If no amount is specified, it will default to refunding the total refundable amount on the invoice.
11
- define_attribute :amount, Integer
10
+ # @return [Float] The amount to be refunded. The amount will be split between the line items. If no amount is specified, it will default to refunding the total refundable amount on the invoice.
11
+ define_attribute :amount, Float
12
12
 
13
13
  # @!attribute credit_customer_notes
14
14
  # @return [String] Used as the Customer Notes on the credit invoice. This field can only be include when the Credit Invoices feature is enabled.
@@ -27,11 +27,11 @@ module Recurly
27
27
  define_attribute :end_date, DateTime
28
28
 
29
29
  # @!attribute item_code
30
- # @return [String] Unique code to identify an item, when the Catalog feature is enabled.
30
+ # @return [String] Unique code to identify an item. Avaliable when the Credit Invoices and Subscription Billing Terms features are enabled.
31
31
  define_attribute :item_code, String
32
32
 
33
33
  # @!attribute item_id
34
- # @return [String] Available when the Catalog feature is enabled.
34
+ # @return [String] System-generated unique identifier for an item. Available when the Credit Invoices and Subscription Billing Terms features are enabled.
35
35
  define_attribute :item_id, String
36
36
 
37
37
  # @!attribute origin
@@ -46,10 +46,18 @@ module Recurly
46
46
  # @return [String] This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice.
47
47
  define_attribute :name, String
48
48
 
49
+ # @!attribute revenue_schedule_type
50
+ # @return [String] Revenue schedule type
51
+ define_attribute :revenue_schedule_type, String
52
+
49
53
  # @!attribute setup_fee_accounting_code
50
54
  # @return [String] Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code.
51
55
  define_attribute :setup_fee_accounting_code, String
52
56
 
57
+ # @!attribute setup_fee_revenue_schedule_type
58
+ # @return [String] Setup fee revenue schedule type
59
+ define_attribute :setup_fee_revenue_schedule_type, String
60
+
53
61
  # @!attribute tax_code
54
62
  # @return [String] Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`.
55
63
  define_attribute :tax_code, String
@@ -42,10 +42,18 @@ module Recurly
42
42
  # @return [String] This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice.
43
43
  define_attribute :name, String
44
44
 
45
+ # @!attribute revenue_schedule_type
46
+ # @return [String] Revenue schedule type
47
+ define_attribute :revenue_schedule_type, String
48
+
45
49
  # @!attribute setup_fee_accounting_code
46
50
  # @return [String] Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code.
47
51
  define_attribute :setup_fee_accounting_code, String
48
52
 
53
+ # @!attribute setup_fee_revenue_schedule_type
54
+ # @return [String] Setup fee revenue schedule type
55
+ define_attribute :setup_fee_revenue_schedule_type, String
56
+
49
57
  # @!attribute tax_code
50
58
  # @return [String] Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`.
51
59
  define_attribute :tax_code, String
@@ -14,8 +14,16 @@ module Recurly
14
14
  # @return [Integer] Quantity
15
15
  define_attribute :quantity, Integer
16
16
 
17
+ # @!attribute revenue_schedule_type
18
+ # @return [String] Revenue schedule type
19
+ define_attribute :revenue_schedule_type, String
20
+
21
+ # @!attribute tiers
22
+ # @return [Array[SubscriptionAddOnTier]] If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent.
23
+ define_attribute :tiers, Array, { :item_type => :SubscriptionAddOnTier }
24
+
17
25
  # @!attribute unit_amount
18
- # @return [Float] Optionally, override the add-on's default unit amount.
26
+ # @return [Float] * Optionally, override the add-on's default unit amount. * If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` must be absent.
19
27
  define_attribute :unit_amount, Float
20
28
  end
21
29
  end