license_manager 0.2.0 → 0.3.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -0
  3. data/README.md +1 -1
  4. data/docs/BillingPortalSession.md +18 -0
  5. data/docs/CreateBillingPortalSession.md +18 -0
  6. data/docs/CreateIntegrationMapping.md +1 -1
  7. data/docs/Integration.md +6 -0
  8. data/docs/IntegrationMapping.md +2 -0
  9. data/docs/IntegrationMappingRecurring.md +20 -0
  10. data/docs/License.md +2 -0
  11. data/docs/LicenseSubscription.md +34 -0
  12. data/docs/LicensesApi.md +1 -1
  13. data/docs/Mrr.md +26 -0
  14. data/docs/MrrByIntervalInner.md +24 -0
  15. data/docs/MrrByPolicyInner.md +22 -0
  16. data/docs/PortalApi.md +79 -0
  17. data/docs/ProductStats.md +2 -0
  18. data/docs/Revenue.md +8 -4
  19. data/docs/StripePermission.md +3 -1
  20. data/docs/StripePrice.md +2 -0
  21. data/docs/StripePriceRecurring.md +20 -0
  22. data/docs/SubscriptionStats.md +38 -0
  23. data/docs/UpdateIntegration.md +3 -1
  24. data/lib/license_manager/api/licenses_api.rb +2 -2
  25. data/lib/license_manager/api/portal_api.rb +70 -0
  26. data/lib/license_manager/models/billing_portal_session.rb +178 -0
  27. data/lib/license_manager/models/create_billing_portal_session.rb +161 -0
  28. data/lib/license_manager/models/create_integration_mapping.rb +1 -1
  29. data/lib/license_manager/models/event_type.rb +4 -1
  30. data/lib/license_manager/models/integration.rb +82 -1
  31. data/lib/license_manager/models/integration_mapping.rb +13 -1
  32. data/lib/license_manager/models/integration_mapping_recurring.rb +228 -0
  33. data/lib/license_manager/models/license.rb +13 -1
  34. data/lib/license_manager/models/license_subscription.rb +388 -0
  35. data/lib/license_manager/models/mrr.rb +291 -0
  36. data/lib/license_manager/models/mrr_by_interval_inner.rb +279 -0
  37. data/lib/license_manager/models/mrr_by_policy_inner.rb +229 -0
  38. data/lib/license_manager/models/product_stats.rb +14 -1
  39. data/lib/license_manager/models/revenue.rb +60 -6
  40. data/lib/license_manager/models/stripe_permission.rb +31 -4
  41. data/lib/license_manager/models/stripe_price.rb +13 -1
  42. data/lib/license_manager/models/stripe_price_recurring.rb +228 -0
  43. data/lib/license_manager/models/subscription_stats.rb +456 -0
  44. data/lib/license_manager/models/update_integration.rb +42 -4
  45. data/lib/license_manager/version.rb +1 -1
  46. data/lib/license_manager.rb +9 -0
  47. data/openapi.json +563 -10
  48. data/spec/api/licenses_api_spec.rb +1 -1
  49. data/spec/api/portal_api_spec.rb +13 -0
  50. data/spec/models/billing_portal_session_spec.rb +36 -0
  51. data/spec/models/create_billing_portal_session_spec.rb +36 -0
  52. data/spec/models/create_token_spec.rb +1 -1
  53. data/spec/models/integration_mapping_recurring_spec.rb +46 -0
  54. data/spec/models/integration_mapping_spec.rb +6 -0
  55. data/spec/models/integration_spec.rb +18 -0
  56. data/spec/models/license_spec.rb +6 -0
  57. data/spec/models/license_subscription_spec.rb +88 -0
  58. data/spec/models/mrr_by_interval_inner_spec.rb +58 -0
  59. data/spec/models/mrr_by_policy_inner_spec.rb +48 -0
  60. data/spec/models/mrr_spec.rb +60 -0
  61. data/spec/models/product_stats_spec.rb +6 -0
  62. data/spec/models/revenue_spec.rb +12 -0
  63. data/spec/models/stripe_permission_spec.rb +6 -0
  64. data/spec/models/stripe_price_recurring_spec.rb +46 -0
  65. data/spec/models/stripe_price_spec.rb +6 -0
  66. data/spec/models/subscription_stats_spec.rb +96 -0
  67. data/spec/models/token_spec.rb +1 -1
  68. data/spec/models/update_integration_spec.rb +6 -0
  69. metadata +37 -1
@@ -19,6 +19,76 @@ module LicenseManager
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Open the Stripe customer portal of a customer
23
+ # Link to the Stripe customer portal of the customer's Stripe customer, where they manage their subscriptions: change their plan or payment method, see their invoices, cancel. Needs the Stripe integration's `canBillingPortal`, and the customer portal configured in the Stripe account's settings. The changes come back through the integration's webhook, keeping the subscription licenses in line. **Token access**: customer tokens with the `customer:billing` permission (or the matching write one). A customer token reaches its own customer. **Required role permission**: `portalLink:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
24
+ # @param id [String]
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [CreateBillingPortalSession] :create_billing_portal_session
27
+ # @return [BillingPortalSession]
28
+ def create_billing_portal_session(id, opts = {})
29
+ data, _status_code, _headers = create_billing_portal_session_with_http_info(id, opts)
30
+ data
31
+ end
32
+
33
+ # Open the Stripe customer portal of a customer
34
+ # Link to the Stripe customer portal of the customer's Stripe customer, where they manage their subscriptions: change their plan or payment method, see their invoices, cancel. Needs the Stripe integration's `canBillingPortal`, and the customer portal configured in the Stripe account's settings. The changes come back through the integration's webhook, keeping the subscription licenses in line. **Token access**: customer tokens with the `customer:billing` permission (or the matching write one). A customer token reaches its own customer. **Required role permission**: `portalLink:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
35
+ # @param id [String]
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [CreateBillingPortalSession] :create_billing_portal_session
38
+ # @return [Array<(BillingPortalSession, Integer, Hash)>] BillingPortalSession data, response status code and response headers
39
+ def create_billing_portal_session_with_http_info(id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: PortalApi.create_billing_portal_session ...'
42
+ end
43
+ # verify the required parameter 'id' is set
44
+ if @api_client.config.client_side_validation && id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'id' when calling PortalApi.create_billing_portal_session"
46
+ end
47
+ # resource path
48
+ local_var_path = '/v1/customers/{id}/billing-portal-sessions'.sub('{id}', CGI.escape(id.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
+ # HTTP header 'Content-Type'
58
+ content_type = @api_client.select_header_content_type(['application/json'])
59
+ if !content_type.nil?
60
+ header_params['Content-Type'] = content_type
61
+ end
62
+
63
+ # form parameters
64
+ form_params = opts[:form_params] || {}
65
+
66
+ # http body (model)
67
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_billing_portal_session'])
68
+
69
+ # return_type
70
+ return_type = opts[:debug_return_type] || 'BillingPortalSession'
71
+
72
+ # auth_names
73
+ auth_names = opts[:debug_auth_names] || ['apiKey', 'token']
74
+
75
+ new_options = opts.merge(
76
+ :operation => :"PortalApi.create_billing_portal_session",
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => return_type
83
+ )
84
+
85
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
86
+ if @api_client.config.debugging
87
+ @api_client.config.logger.debug "API called: PortalApi#create_billing_portal_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+
22
92
  # Create a link to the customer portal
23
93
  # Link letting the customer see their licenses, cancel them during their money back guarantee, and deactivate their machines in the customer portal, without signing in. Anyone with the link can, until it expires or the customer is deleted: it can't be revoked otherwise. The token also works with the API endpoints that accept customer tokens. Links can be created while the product's customer portal is disabled, but the portal answers `404` until it's enabled, and `sendPortalLink` refuses to email them. **Required role permission**: `portalLink:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
24
94
  # @param id [String]
@@ -0,0 +1,178 @@
1
+ =begin
2
+ #LicenseManager API
3
+
4
+ #Public API. Authenticate with an organization API key, or with a token scoped to a customer, license or machine on the endpoints that accept one. ## Conventions - **Errors** answer `{ \"error\": { \"code\", \"message\" } }`. Branch on `code`, which is stable, not on `message`. Each response lists the codes it can return, except `404`, which answers `not_found` unless it says otherwise. Unexpected errors answer `500` with `internal_error`. - **Validation** errors answer `422`, not `400`, with the `validation_error` code and an `issues` array giving the `path` and `message` of each invalid value. - **Unknown body fields are ignored**, not rejected: sending a field an endpoint doesn't accept, like `policyId` to `updateLicense`, changes nothing and doesn't fail. - **Strings** are trimmed before they're validated and stored. Emails are stored lower cased. - **Updates** only change the fields that are sent. A field sent as `null` is cleared, when it can be. - **Dates** can be sent with any offset, and are always returned in UTC, like `2026-01-15T09:30:00.000Z`. Calendar months and days are counted in UTC. - **Ids** are 8 letters and digits, after `test_` for test products and their resources. - **Lists** are paginated with `page` and `pageSize`. Items with the same value for the `sort` field are ordered by id, so pages are stable, but items created or deleted between two requests shift the pages. Items without a value for the `sort` field come last in ascending order, and first in descending order, unless the endpoint says otherwise. - **Test products** are sandboxes of a live product. Test API keys only reach test products, live API keys only live ones: the others answer `404`, as if they didn't exist. Sessions and tokens reach both.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LicenseManager
17
+ class BillingPortalSession < ApiModelBase
18
+ # Link to the Stripe customer portal, to open right away: it expires shortly.
19
+ attr_accessor :url
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'url' => :'url'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'url' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Returns attribute type mapping
52
+ def self.acceptable_openapi_types
53
+ openapi_types
54
+ end
55
+
56
+ # Returns the nullable attributes
57
+ def self.acceptable_openapi_nullable
58
+ openapi_nullable
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::BillingPortalSession` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::BillingPortalSession`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'url')
78
+ self.url = attributes[:'url']
79
+ else
80
+ self.url = nil
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ if @url.nil?
90
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ warn '[DEPRECATED] the `valid?` method is obsolete'
100
+ return false if @url.nil?
101
+ true
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] url Value to be assigned
106
+ def url=(url)
107
+ if url.nil?
108
+ fail ArgumentError, 'url cannot be nil'
109
+ end
110
+
111
+ @url = url
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ url == o.url
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [url].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ attributes = attributes.transform_keys(&:to_sym)
140
+ # include attributes inherited from allOf parents (the nearest declaration wins)
141
+ map = acceptable_attribute_map
142
+ transformed_hash = {}
143
+ acceptable_openapi_types.each_pair do |key, type|
144
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
151
+ end
152
+ elsif !attributes[map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
154
+ end
155
+ end
156
+ new(transformed_hash)
157
+ end
158
+
159
+ # Returns the object in the form of hash
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_hash
162
+ hash = {}
163
+ # include attributes inherited from allOf parents (the nearest declaration wins)
164
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
165
+ value = self.send(attr)
166
+ if value.nil?
167
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
168
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
169
+ end
170
+
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ end
177
+
178
+ end
@@ -0,0 +1,161 @@
1
+ =begin
2
+ #LicenseManager API
3
+
4
+ #Public API. Authenticate with an organization API key, or with a token scoped to a customer, license or machine on the endpoints that accept one. ## Conventions - **Errors** answer `{ \"error\": { \"code\", \"message\" } }`. Branch on `code`, which is stable, not on `message`. Each response lists the codes it can return, except `404`, which answers `not_found` unless it says otherwise. Unexpected errors answer `500` with `internal_error`. - **Validation** errors answer `422`, not `400`, with the `validation_error` code and an `issues` array giving the `path` and `message` of each invalid value. - **Unknown body fields are ignored**, not rejected: sending a field an endpoint doesn't accept, like `policyId` to `updateLicense`, changes nothing and doesn't fail. - **Strings** are trimmed before they're validated and stored. Emails are stored lower cased. - **Updates** only change the fields that are sent. A field sent as `null` is cleared, when it can be. - **Dates** can be sent with any offset, and are always returned in UTC, like `2026-01-15T09:30:00.000Z`. Calendar months and days are counted in UTC. - **Ids** are 8 letters and digits, after `test_` for test products and their resources. - **Lists** are paginated with `page` and `pageSize`. Items with the same value for the `sort` field are ordered by id, so pages are stable, but items created or deleted between two requests shift the pages. Items without a value for the `sort` field come last in ascending order, and first in descending order, unless the endpoint says otherwise. - **Test products** are sandboxes of a live product. Test API keys only reach test products, live API keys only live ones: the others answer `404`, as if they didn't exist. Sessions and tokens reach both.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LicenseManager
17
+ class CreateBillingPortalSession < ApiModelBase
18
+ # Where the Stripe customer portal links back to: a page of the customer portal, or of one of the product's `returnDomains`. The customer portal of the product by default.
19
+ attr_accessor :return_url
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'return_url' => :'returnUrl'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'return_url' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Returns attribute type mapping
52
+ def self.acceptable_openapi_types
53
+ openapi_types
54
+ end
55
+
56
+ # Returns the nullable attributes
57
+ def self.acceptable_openapi_nullable
58
+ openapi_nullable
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::CreateBillingPortalSession` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::CreateBillingPortalSession`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'return_url')
78
+ self.return_url = attributes[:'return_url']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ return_url == o.return_url
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [return_url].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ attributes = attributes.transform_keys(&:to_sym)
123
+ # include attributes inherited from allOf parents (the nearest declaration wins)
124
+ map = acceptable_attribute_map
125
+ transformed_hash = {}
126
+ acceptable_openapi_types.each_pair do |key, type|
127
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
128
+ transformed_hash["#{key}"] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[map[key]].is_a?(Array)
133
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
134
+ end
135
+ elsif !attributes[map[key]].nil?
136
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
137
+ end
138
+ end
139
+ new(transformed_hash)
140
+ end
141
+
142
+ # Returns the object in the form of hash
143
+ # @return [Hash] Returns the object in the form of hash
144
+ def to_hash
145
+ hash = {}
146
+ # include attributes inherited from allOf parents (the nearest declaration wins)
147
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
148
+ value = self.send(attr)
149
+ if value.nil?
150
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
151
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
152
+ end
153
+
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ end
160
+
161
+ end
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module LicenseManager
17
17
  class CreateIntegrationMapping < ApiModelBase
18
- # Active one-time price of the Stripe account.
18
+ # Active one-time or licensed recurring price of the Stripe account.
19
19
  attr_accessor :stripe_price_id
20
20
 
21
21
  attr_accessor :policy_id
@@ -24,11 +24,14 @@ module LicenseManager
24
24
  LICENSE_CANCELED = "license.canceled".freeze
25
25
  LICENSE_REFUNDED = "license.refunded".freeze
26
26
  LICENSE_REFUND_FAILED = "license.refund_failed".freeze
27
+ LICENSE_PAYMENT_SUCCEEDED = "license.payment_succeeded".freeze
28
+ LICENSE_PAYMENT_FAILED = "license.payment_failed".freeze
29
+ LICENSE_SUBSCRIPTION_ENDED = "license.subscription_ended".freeze
27
30
  MACHINE_DEACTIVATED = "machine.deactivated".freeze
28
31
  UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
29
32
 
30
33
  def self.all_vars
31
- @all_vars ||= [POLICY_CREATED, POLICY_UPDATED, LICENSE_CREATED, LICENSE_UPDATED, LICENSE_VALIDATED, LICENSE_VALIDATION_FAILED, LICENSE_CANCELED, LICENSE_REFUNDED, LICENSE_REFUND_FAILED, MACHINE_DEACTIVATED, UNKNOWN_DEFAULT_OPEN_API].freeze
34
+ @all_vars ||= [POLICY_CREATED, POLICY_UPDATED, LICENSE_CREATED, LICENSE_UPDATED, LICENSE_VALIDATED, LICENSE_VALIDATION_FAILED, LICENSE_CANCELED, LICENSE_REFUNDED, LICENSE_REFUND_FAILED, LICENSE_PAYMENT_SUCCEEDED, LICENSE_PAYMENT_FAILED, LICENSE_SUBSCRIPTION_ENDED, MACHINE_DEACTIVATED, UNKNOWN_DEFAULT_OPEN_API].freeze
32
35
  end
33
36
 
34
37
  # Builds the enum from string
@@ -48,6 +48,15 @@ module LicenseManager
48
48
  # Whether the API key has the optional Refunds: Write permission, checked when connecting and every day. Without it, canceled licenses aren't refunded: refund their payments from Stripe.
49
49
  attr_accessor :can_refund
50
50
 
51
+ # Whether the API key has the optional Subscriptions: Write permission, checked when connecting and every day. Without it, subscription licenses can't be canceled from the app: cancel their subscriptions from Stripe.
52
+ attr_accessor :can_manage_subscriptions
53
+
54
+ # Whether the API key has the optional Customer portal: Write permission, checked when connecting and every day. Without it, the license portal doesn't link to the Stripe customer portal.
55
+ attr_accessor :can_billing_portal
56
+
57
+ # Days a subscription license stays valid after its period ends while its renewal is unpaid, as Stripe retries the payment. 7 by default.
58
+ attr_accessor :subscription_grace_days
59
+
51
60
  attr_accessor :created_at
52
61
 
53
62
  class EnumAttributeValidator
@@ -87,6 +96,9 @@ module LicenseManager
87
96
  :'last_event_at' => :'lastEventAt',
88
97
  :'auto_refund' => :'autoRefund',
89
98
  :'can_refund' => :'canRefund',
99
+ :'can_manage_subscriptions' => :'canManageSubscriptions',
100
+ :'can_billing_portal' => :'canBillingPortal',
101
+ :'subscription_grace_days' => :'subscriptionGraceDays',
90
102
  :'created_at' => :'createdAt'
91
103
  }
92
104
  end
@@ -116,6 +128,9 @@ module LicenseManager
116
128
  :'last_event_at' => :'Time',
117
129
  :'auto_refund' => :'Boolean',
118
130
  :'can_refund' => :'Boolean',
131
+ :'can_manage_subscriptions' => :'Boolean',
132
+ :'can_billing_portal' => :'Boolean',
133
+ :'subscription_grace_days' => :'Integer',
119
134
  :'created_at' => :'Time'
120
135
  }
121
136
  end
@@ -228,6 +243,24 @@ module LicenseManager
228
243
  self.can_refund = nil
229
244
  end
230
245
 
246
+ if attributes.key?(:'can_manage_subscriptions')
247
+ self.can_manage_subscriptions = attributes[:'can_manage_subscriptions']
248
+ else
249
+ self.can_manage_subscriptions = nil
250
+ end
251
+
252
+ if attributes.key?(:'can_billing_portal')
253
+ self.can_billing_portal = attributes[:'can_billing_portal']
254
+ else
255
+ self.can_billing_portal = nil
256
+ end
257
+
258
+ if attributes.key?(:'subscription_grace_days')
259
+ self.subscription_grace_days = attributes[:'subscription_grace_days']
260
+ else
261
+ self.subscription_grace_days = nil
262
+ end
263
+
231
264
  if attributes.key?(:'created_at')
232
265
  self.created_at = attributes[:'created_at']
233
266
  else
@@ -272,6 +305,18 @@ module LicenseManager
272
305
  invalid_properties.push('invalid value for "can_refund", can_refund cannot be nil.')
273
306
  end
274
307
 
308
+ if @can_manage_subscriptions.nil?
309
+ invalid_properties.push('invalid value for "can_manage_subscriptions", can_manage_subscriptions cannot be nil.')
310
+ end
311
+
312
+ if @can_billing_portal.nil?
313
+ invalid_properties.push('invalid value for "can_billing_portal", can_billing_portal cannot be nil.')
314
+ end
315
+
316
+ if @subscription_grace_days.nil?
317
+ invalid_properties.push('invalid value for "subscription_grace_days", subscription_grace_days cannot be nil.')
318
+ end
319
+
275
320
  if @created_at.nil?
276
321
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
277
322
  end
@@ -293,6 +338,9 @@ module LicenseManager
293
338
  return false if @status.nil?
294
339
  return false if @auto_refund.nil?
295
340
  return false if @can_refund.nil?
341
+ return false if @can_manage_subscriptions.nil?
342
+ return false if @can_billing_portal.nil?
343
+ return false if @subscription_grace_days.nil?
296
344
  return false if @created_at.nil?
297
345
  true
298
346
  end
@@ -377,6 +425,36 @@ module LicenseManager
377
425
  @can_refund = can_refund
378
426
  end
379
427
 
428
+ # Custom attribute writer method with validation
429
+ # @param [Object] can_manage_subscriptions Value to be assigned
430
+ def can_manage_subscriptions=(can_manage_subscriptions)
431
+ if can_manage_subscriptions.nil?
432
+ fail ArgumentError, 'can_manage_subscriptions cannot be nil'
433
+ end
434
+
435
+ @can_manage_subscriptions = can_manage_subscriptions
436
+ end
437
+
438
+ # Custom attribute writer method with validation
439
+ # @param [Object] can_billing_portal Value to be assigned
440
+ def can_billing_portal=(can_billing_portal)
441
+ if can_billing_portal.nil?
442
+ fail ArgumentError, 'can_billing_portal cannot be nil'
443
+ end
444
+
445
+ @can_billing_portal = can_billing_portal
446
+ end
447
+
448
+ # Custom attribute writer method with validation
449
+ # @param [Object] subscription_grace_days Value to be assigned
450
+ def subscription_grace_days=(subscription_grace_days)
451
+ if subscription_grace_days.nil?
452
+ fail ArgumentError, 'subscription_grace_days cannot be nil'
453
+ end
454
+
455
+ @subscription_grace_days = subscription_grace_days
456
+ end
457
+
380
458
  # Custom attribute writer method with validation
381
459
  # @param [Object] created_at Value to be assigned
382
460
  def created_at=(created_at)
@@ -404,6 +482,9 @@ module LicenseManager
404
482
  last_event_at == o.last_event_at &&
405
483
  auto_refund == o.auto_refund &&
406
484
  can_refund == o.can_refund &&
485
+ can_manage_subscriptions == o.can_manage_subscriptions &&
486
+ can_billing_portal == o.can_billing_portal &&
487
+ subscription_grace_days == o.subscription_grace_days &&
407
488
  created_at == o.created_at
408
489
  end
409
490
 
@@ -416,7 +497,7 @@ module LicenseManager
416
497
  # Calculates hash code according to all attributes.
417
498
  # @return [Integer] Hash code
418
499
  def hash
419
- [id, provider, livemode, account_name, api_key_hint, webhook_url, status, status_reason, last_checked_at, last_event_at, auto_refund, can_refund, created_at].hash
500
+ [id, provider, livemode, account_name, api_key_hint, webhook_url, status, status_reason, last_checked_at, last_event_at, auto_refund, can_refund, can_manage_subscriptions, can_billing_portal, subscription_grace_days, created_at].hash
420
501
  end
421
502
 
422
503
  # Builds the object from hash
@@ -32,6 +32,8 @@ module LicenseManager
32
32
 
33
33
  attr_accessor :price
34
34
 
35
+ attr_accessor :recurring
36
+
35
37
  # `error` when the price can no longer be paid, explained by `statusReason`.
36
38
  attr_accessor :status
37
39
 
@@ -72,6 +74,7 @@ module LicenseManager
72
74
  :'stripe_price_id' => :'stripePriceId',
73
75
  :'product_name' => :'productName',
74
76
  :'price' => :'price',
77
+ :'recurring' => :'recurring',
75
78
  :'status' => :'status',
76
79
  :'status_reason' => :'statusReason',
77
80
  :'created_at' => :'createdAt'
@@ -99,6 +102,7 @@ module LicenseManager
99
102
  :'stripe_price_id' => :'String',
100
103
  :'product_name' => :'String',
101
104
  :'price' => :'Price',
105
+ :'recurring' => :'IntegrationMappingRecurring',
102
106
  :'status' => :'String',
103
107
  :'status_reason' => :'String',
104
108
  :'created_at' => :'Time'
@@ -109,6 +113,7 @@ module LicenseManager
109
113
  def self.openapi_nullable
110
114
  Set.new([
111
115
  :'price',
116
+ :'recurring',
112
117
  :'status_reason',
113
118
  ])
114
119
  end
@@ -187,6 +192,12 @@ module LicenseManager
187
192
  self.price = nil
188
193
  end
189
194
 
195
+ if attributes.key?(:'recurring')
196
+ self.recurring = attributes[:'recurring']
197
+ else
198
+ self.recurring = nil
199
+ end
200
+
190
201
  if attributes.key?(:'status')
191
202
  self.status = attributes[:'status']
192
203
  else
@@ -371,6 +382,7 @@ module LicenseManager
371
382
  stripe_price_id == o.stripe_price_id &&
372
383
  product_name == o.product_name &&
373
384
  price == o.price &&
385
+ recurring == o.recurring &&
374
386
  status == o.status &&
375
387
  status_reason == o.status_reason &&
376
388
  created_at == o.created_at
@@ -385,7 +397,7 @@ module LicenseManager
385
397
  # Calculates hash code according to all attributes.
386
398
  # @return [Integer] Hash code
387
399
  def hash
388
- [id, integration_id, product_id, policy_id, stripe_product_id, stripe_price_id, product_name, price, status, status_reason, created_at].hash
400
+ [id, integration_id, product_id, policy_id, stripe_product_id, stripe_price_id, product_name, price, recurring, status, status_reason, created_at].hash
389
401
  end
390
402
 
391
403
  # Builds the object from hash