license_manager 0.1.1 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +152 -0
- data/README.md +3 -3
- data/docs/BillingPortalSession.md +18 -0
- data/docs/CancelLicense.md +22 -0
- data/docs/CancellationReason.md +15 -0
- data/docs/CancellationStats.md +30 -0
- data/docs/CancellationStatsByReasonInner.md +20 -0
- data/docs/ConnectStripe.md +1 -1
- data/docs/CreateBillingPortalSession.md +18 -0
- data/docs/CreateIntegrationMapping.md +1 -1
- data/docs/CreateLicense.md +2 -0
- data/docs/CreatePolicy.md +3 -1
- data/docs/CreateProductWithPolicy.md +1 -1
- data/docs/CreateToken.md +1 -1
- data/docs/EventActorOneOf.md +1 -1
- data/docs/Integration.md +11 -1
- data/docs/IntegrationMapping.md +2 -0
- data/docs/IntegrationMappingRecurring.md +20 -0
- data/docs/IntegrationsApi.md +74 -0
- data/docs/License.md +12 -0
- data/docs/LicenseSubscription.md +34 -0
- data/docs/LicensesApi.md +80 -3
- data/docs/Machine.md +3 -1
- data/docs/MachinesApi.md +1 -1
- data/docs/Mrr.md +26 -0
- data/docs/MrrByIntervalInner.md +24 -0
- data/docs/MrrByPolicyInner.md +22 -0
- data/docs/Policy.md +2 -0
- data/docs/PolicySettings.md +3 -1
- data/docs/PortalApi.md +80 -1
- data/docs/PortalLink.md +2 -2
- data/docs/Product.md +2 -0
- data/docs/ProductStats.md +8 -4
- data/docs/ProductsApi.md +2 -2
- data/docs/Revenue.md +10 -2
- data/docs/StripeIntegration.md +1 -1
- data/docs/StripePermission.md +5 -1
- data/docs/StripePrice.md +2 -0
- data/docs/StripePriceRecurring.md +20 -0
- data/docs/SubscriptionStats.md +38 -0
- data/docs/UpdateIntegration.md +20 -0
- data/docs/UpdateLicense.md +3 -1
- data/docs/UpdatePolicy.md +3 -1
- data/docs/UpdateProduct.md +3 -1
- data/lib/license_manager/api/integrations_api.rb +74 -0
- data/lib/license_manager/api/licenses_api.rb +80 -6
- data/lib/license_manager/api/machines_api.rb +3 -3
- data/lib/license_manager/api/portal_api.rb +72 -2
- data/lib/license_manager/api/products_api.rb +4 -4
- data/lib/license_manager/models/billing_portal_session.rb +178 -0
- data/lib/license_manager/models/cancel_license.rb +238 -0
- data/lib/license_manager/models/cancellation_reason.rb +45 -0
- data/lib/license_manager/models/cancellation_stats.rb +347 -0
- data/lib/license_manager/models/cancellation_stats_by_reason_inner.rb +225 -0
- data/lib/license_manager/models/connect_stripe.rb +1 -1
- data/lib/license_manager/models/create_billing_portal_session.rb +161 -0
- data/lib/license_manager/models/create_integration_mapping.rb +1 -1
- data/lib/license_manager/models/create_license.rb +12 -1
- data/lib/license_manager/models/create_policy.rb +40 -5
- data/lib/license_manager/models/create_product_with_policy.rb +1 -1
- data/lib/license_manager/models/create_token.rb +1 -1
- data/lib/license_manager/models/event_type.rb +7 -1
- data/lib/license_manager/models/integration.rb +136 -1
- data/lib/license_manager/models/integration_mapping.rb +13 -1
- data/lib/license_manager/models/integration_mapping_recurring.rb +228 -0
- data/lib/license_manager/models/license.rb +91 -1
- data/lib/license_manager/models/license_status.rb +2 -1
- data/lib/license_manager/models/license_subscription.rb +388 -0
- data/lib/license_manager/models/machine.rb +17 -4
- data/lib/license_manager/models/mrr.rb +291 -0
- data/lib/license_manager/models/mrr_by_interval_inner.rb +279 -0
- data/lib/license_manager/models/mrr_by_policy_inner.rb +229 -0
- data/lib/license_manager/models/policy.rb +14 -1
- data/lib/license_manager/models/policy_settings.rb +40 -5
- data/lib/license_manager/models/portal_link.rb +1 -1
- data/lib/license_manager/models/product.rb +28 -1
- data/lib/license_manager/models/product_stats.rb +31 -5
- data/lib/license_manager/models/revenue.rb +112 -4
- data/lib/license_manager/models/stripe_integration.rb +1 -1
- data/lib/license_manager/models/stripe_permission.rb +58 -4
- data/lib/license_manager/models/stripe_price.rb +13 -1
- data/lib/license_manager/models/stripe_price_recurring.rb +228 -0
- data/lib/license_manager/models/subscription_stats.rb +456 -0
- data/lib/license_manager/models/update_integration.rb +199 -0
- data/lib/license_manager/models/update_license.rb +16 -5
- data/lib/license_manager/models/update_policy.rb +40 -5
- data/lib/license_manager/models/update_product.rb +14 -4
- data/lib/license_manager/version.rb +1 -1
- data/lib/license_manager.rb +14 -0
- data/openapi.json +1146 -59
- data/spec/api/integrations_api_spec.rb +13 -0
- data/spec/api/licenses_api_spec.rb +16 -3
- data/spec/api/machines_api_spec.rb +1 -1
- data/spec/api/portal_api_spec.rb +14 -1
- data/spec/api/products_api_spec.rb +2 -2
- data/spec/models/billing_portal_session_spec.rb +36 -0
- data/spec/models/cancel_license_spec.rb +48 -0
- data/spec/models/cancellation_reason_spec.rb +30 -0
- data/spec/models/cancellation_stats_by_reason_inner_spec.rb +42 -0
- data/spec/models/cancellation_stats_spec.rb +72 -0
- data/spec/models/create_billing_portal_session_spec.rb +36 -0
- data/spec/models/create_license_spec.rb +6 -0
- data/spec/models/create_policy_spec.rb +6 -0
- data/spec/models/create_token_spec.rb +1 -1
- data/spec/models/integration_mapping_recurring_spec.rb +46 -0
- data/spec/models/integration_mapping_spec.rb +6 -0
- data/spec/models/integration_spec.rb +30 -0
- data/spec/models/license_spec.rb +36 -0
- data/spec/models/license_subscription_spec.rb +88 -0
- data/spec/models/machine_spec.rb +7 -1
- data/spec/models/mrr_by_interval_inner_spec.rb +58 -0
- data/spec/models/mrr_by_policy_inner_spec.rb +48 -0
- data/spec/models/mrr_spec.rb +60 -0
- data/spec/models/policy_settings_spec.rb +6 -0
- data/spec/models/policy_spec.rb +6 -0
- data/spec/models/product_spec.rb +6 -0
- data/spec/models/product_stats_spec.rb +12 -0
- data/spec/models/revenue_spec.rb +24 -0
- data/spec/models/stripe_permission_spec.rb +12 -0
- data/spec/models/stripe_price_recurring_spec.rb +46 -0
- data/spec/models/stripe_price_spec.rb +6 -0
- data/spec/models/subscription_stats_spec.rb +96 -0
- data/spec/models/token_spec.rb +1 -1
- data/spec/models/update_integration_spec.rb +42 -0
- data/spec/models/update_license_spec.rb +6 -0
- data/spec/models/update_policy_spec.rb +6 -0
- data/spec/models/update_product_spec.rb +6 -0
- metadata +57 -1
|
@@ -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
|
|
@@ -40,6 +40,9 @@ module LicenseManager
|
|
|
40
40
|
|
|
41
41
|
attr_accessor :max_version
|
|
42
42
|
|
|
43
|
+
# End of the money back guarantee: until then, the customer can cancel the license from the customer portal, or with a token. `null` to not let them. Defaults to the creation date plus the policy's `moneyBackGuaranteeDays`, or `null` when it has none.
|
|
44
|
+
attr_accessor :cancellable_until
|
|
45
|
+
|
|
43
46
|
# `true` emails the key to the customer once the license is created, like `sendLicenseKeys`. Sent in the background: a failed email doesn't fail the creation. In test products, it's only sent when the customer's email is a member's of the organization. Defaults to `false`.
|
|
44
47
|
attr_accessor :send_key
|
|
45
48
|
|
|
@@ -55,6 +58,7 @@ module LicenseManager
|
|
|
55
58
|
:'max_offline_duration_seconds' => :'maxOfflineDurationSeconds',
|
|
56
59
|
:'price' => :'price',
|
|
57
60
|
:'max_version' => :'maxVersion',
|
|
61
|
+
:'cancellable_until' => :'cancellableUntil',
|
|
58
62
|
:'send_key' => :'sendKey'
|
|
59
63
|
}
|
|
60
64
|
end
|
|
@@ -81,6 +85,7 @@ module LicenseManager
|
|
|
81
85
|
:'max_offline_duration_seconds' => :'Integer',
|
|
82
86
|
:'price' => :'PriceInput',
|
|
83
87
|
:'max_version' => :'LicenseMaxVersionInput',
|
|
88
|
+
:'cancellable_until' => :'Time',
|
|
84
89
|
:'send_key' => :'Boolean'
|
|
85
90
|
}
|
|
86
91
|
end
|
|
@@ -92,6 +97,7 @@ module LicenseManager
|
|
|
92
97
|
:'meta',
|
|
93
98
|
:'max_machines',
|
|
94
99
|
:'price',
|
|
100
|
+
:'cancellable_until',
|
|
95
101
|
])
|
|
96
102
|
end
|
|
97
103
|
|
|
@@ -161,6 +167,10 @@ module LicenseManager
|
|
|
161
167
|
self.max_version = attributes[:'max_version']
|
|
162
168
|
end
|
|
163
169
|
|
|
170
|
+
if attributes.key?(:'cancellable_until')
|
|
171
|
+
self.cancellable_until = attributes[:'cancellable_until']
|
|
172
|
+
end
|
|
173
|
+
|
|
164
174
|
if attributes.key?(:'send_key')
|
|
165
175
|
self.send_key = attributes[:'send_key']
|
|
166
176
|
end
|
|
@@ -299,6 +309,7 @@ module LicenseManager
|
|
|
299
309
|
max_offline_duration_seconds == o.max_offline_duration_seconds &&
|
|
300
310
|
price == o.price &&
|
|
301
311
|
max_version == o.max_version &&
|
|
312
|
+
cancellable_until == o.cancellable_until &&
|
|
302
313
|
send_key == o.send_key
|
|
303
314
|
end
|
|
304
315
|
|
|
@@ -311,7 +322,7 @@ module LicenseManager
|
|
|
311
322
|
# Calculates hash code according to all attributes.
|
|
312
323
|
# @return [Integer] Hash code
|
|
313
324
|
def hash
|
|
314
|
-
[email, key, policy_id, expires_at, meta, max_machines, max_offline_duration_seconds, price, max_version, send_key].hash
|
|
325
|
+
[email, key, policy_id, expires_at, meta, max_machines, max_offline_duration_seconds, price, max_version, cancellable_until, send_key].hash
|
|
315
326
|
end
|
|
316
327
|
|
|
317
328
|
# Builds the object from hash
|
|
@@ -33,6 +33,9 @@ module LicenseManager
|
|
|
33
33
|
|
|
34
34
|
attr_accessor :max_version
|
|
35
35
|
|
|
36
|
+
# Number of days after their creation during which customers can cancel the licenses created with this policy, from the customer portal or with `cancelLicense`, which refunds their Stripe payment. Each license keeps the end of its own period as `cancellableUntil`. `null` for no money back guarantee. Defaults to `null`.
|
|
37
|
+
attr_accessor :money_back_guarantee_days
|
|
38
|
+
|
|
36
39
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
40
|
def self.attribute_map
|
|
38
41
|
{
|
|
@@ -42,7 +45,8 @@ module LicenseManager
|
|
|
42
45
|
:'duration' => :'duration',
|
|
43
46
|
:'max_machines' => :'maxMachines',
|
|
44
47
|
:'max_offline_duration_seconds' => :'maxOfflineDurationSeconds',
|
|
45
|
-
:'max_version' => :'maxVersion'
|
|
48
|
+
:'max_version' => :'maxVersion',
|
|
49
|
+
:'money_back_guarantee_days' => :'moneyBackGuaranteeDays'
|
|
46
50
|
}
|
|
47
51
|
end
|
|
48
52
|
|
|
@@ -65,7 +69,8 @@ module LicenseManager
|
|
|
65
69
|
:'duration' => :'PolicySettingsDuration',
|
|
66
70
|
:'max_machines' => :'Integer',
|
|
67
71
|
:'max_offline_duration_seconds' => :'Integer',
|
|
68
|
-
:'max_version' => :'PolicySettingsMaxVersion'
|
|
72
|
+
:'max_version' => :'PolicySettingsMaxVersion',
|
|
73
|
+
:'money_back_guarantee_days' => :'Integer'
|
|
69
74
|
}
|
|
70
75
|
end
|
|
71
76
|
|
|
@@ -74,7 +79,8 @@ module LicenseManager
|
|
|
74
79
|
Set.new([
|
|
75
80
|
:'duration',
|
|
76
81
|
:'max_machines',
|
|
77
|
-
:'max_version'
|
|
82
|
+
:'max_version',
|
|
83
|
+
:'money_back_guarantee_days'
|
|
78
84
|
])
|
|
79
85
|
end
|
|
80
86
|
|
|
@@ -133,6 +139,10 @@ module LicenseManager
|
|
|
133
139
|
if attributes.key?(:'max_version')
|
|
134
140
|
self.max_version = attributes[:'max_version']
|
|
135
141
|
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'money_back_guarantee_days')
|
|
144
|
+
self.money_back_guarantee_days = attributes[:'money_back_guarantee_days']
|
|
145
|
+
end
|
|
136
146
|
end
|
|
137
147
|
|
|
138
148
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -181,6 +191,14 @@ module LicenseManager
|
|
|
181
191
|
invalid_properties.push('invalid value for "max_offline_duration_seconds", must be greater than or equal to 3600.')
|
|
182
192
|
end
|
|
183
193
|
|
|
194
|
+
if !@money_back_guarantee_days.nil? && @money_back_guarantee_days > 3650
|
|
195
|
+
invalid_properties.push('invalid value for "money_back_guarantee_days", must be smaller than or equal to 3650.')
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
if !@money_back_guarantee_days.nil? && @money_back_guarantee_days <= 0
|
|
199
|
+
invalid_properties.push('invalid value for "money_back_guarantee_days", must be greater than 0.')
|
|
200
|
+
end
|
|
201
|
+
|
|
184
202
|
invalid_properties
|
|
185
203
|
end
|
|
186
204
|
|
|
@@ -198,6 +216,8 @@ module LicenseManager
|
|
|
198
216
|
return false if !@max_machines.nil? && @max_machines <= 0
|
|
199
217
|
return false if !@max_offline_duration_seconds.nil? && @max_offline_duration_seconds > 2147483647
|
|
200
218
|
return false if !@max_offline_duration_seconds.nil? && @max_offline_duration_seconds < 3600
|
|
219
|
+
return false if !@money_back_guarantee_days.nil? && @money_back_guarantee_days > 3650
|
|
220
|
+
return false if !@money_back_guarantee_days.nil? && @money_back_guarantee_days <= 0
|
|
201
221
|
true
|
|
202
222
|
end
|
|
203
223
|
|
|
@@ -274,6 +294,20 @@ module LicenseManager
|
|
|
274
294
|
@max_offline_duration_seconds = max_offline_duration_seconds
|
|
275
295
|
end
|
|
276
296
|
|
|
297
|
+
# Custom attribute writer method with validation
|
|
298
|
+
# @param [Object] money_back_guarantee_days Value to be assigned
|
|
299
|
+
def money_back_guarantee_days=(money_back_guarantee_days)
|
|
300
|
+
if !money_back_guarantee_days.nil? && money_back_guarantee_days > 3650
|
|
301
|
+
fail ArgumentError, 'invalid value for "money_back_guarantee_days", must be smaller than or equal to 3650.'
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
if !money_back_guarantee_days.nil? && money_back_guarantee_days <= 0
|
|
305
|
+
fail ArgumentError, 'invalid value for "money_back_guarantee_days", must be greater than 0.'
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
@money_back_guarantee_days = money_back_guarantee_days
|
|
309
|
+
end
|
|
310
|
+
|
|
277
311
|
# Checks equality by comparing each attribute.
|
|
278
312
|
# @param [Object] Object to be compared
|
|
279
313
|
def ==(o)
|
|
@@ -285,7 +319,8 @@ module LicenseManager
|
|
|
285
319
|
duration == o.duration &&
|
|
286
320
|
max_machines == o.max_machines &&
|
|
287
321
|
max_offline_duration_seconds == o.max_offline_duration_seconds &&
|
|
288
|
-
max_version == o.max_version
|
|
322
|
+
max_version == o.max_version &&
|
|
323
|
+
money_back_guarantee_days == o.money_back_guarantee_days
|
|
289
324
|
end
|
|
290
325
|
|
|
291
326
|
# @see the `==` method
|
|
@@ -297,7 +332,7 @@ module LicenseManager
|
|
|
297
332
|
# Calculates hash code according to all attributes.
|
|
298
333
|
# @return [Integer] Hash code
|
|
299
334
|
def hash
|
|
300
|
-
[name, slug, is_default, duration, max_machines, max_offline_duration_seconds, max_version].hash
|
|
335
|
+
[name, slug, is_default, duration, max_machines, max_offline_duration_seconds, max_version, money_back_guarantee_days].hash
|
|
301
336
|
end
|
|
302
337
|
|
|
303
338
|
# Builds the object from hash
|
|
@@ -22,7 +22,7 @@ module LicenseManager
|
|
|
22
22
|
|
|
23
23
|
attr_accessor :default_policy
|
|
24
24
|
|
|
25
|
-
# Creates a test product: a sandbox of this live product of the organization, starting with copies of its policies, releases
|
|
25
|
+
# Creates a test product: a sandbox of this live product of the organization, starting with copies of its policies, releases, portal settings and `autoMachineChange`.
|
|
26
26
|
attr_accessor :is_test_from_product_id
|
|
27
27
|
|
|
28
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module LicenseManager
|
|
17
17
|
class CreateToken < ApiModelBase
|
|
18
|
-
# Permissions of the token. A write permission implies the
|
|
18
|
+
# Permissions of the token. A write permission implies the other ones of its resource, like the read one: `license:write` implies `license:read` and `license:cancel`. A token creating a token can only give the permissions it has.
|
|
19
19
|
attr_accessor :scope
|
|
20
20
|
|
|
21
21
|
# How long the token works, in seconds, from 60 (1 minute) to 31536000 (365 days). Defaults to 900 (15 minutes). A token creating a token can't give it a later expiration than its own: it's shortened to it.
|
|
@@ -21,11 +21,17 @@ module LicenseManager
|
|
|
21
21
|
LICENSE_UPDATED = "license.updated".freeze
|
|
22
22
|
LICENSE_VALIDATED = "license.validated".freeze
|
|
23
23
|
LICENSE_VALIDATION_FAILED = "license.validation_failed".freeze
|
|
24
|
+
LICENSE_CANCELED = "license.canceled".freeze
|
|
25
|
+
LICENSE_REFUNDED = "license.refunded".freeze
|
|
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
|
|
24
30
|
MACHINE_DEACTIVATED = "machine.deactivated".freeze
|
|
25
31
|
UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
|
|
26
32
|
|
|
27
33
|
def self.all_vars
|
|
28
|
-
@all_vars ||= [POLICY_CREATED, POLICY_UPDATED, LICENSE_CREATED, LICENSE_UPDATED, LICENSE_VALIDATED, LICENSE_VALIDATION_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
|
|
29
35
|
end
|
|
30
36
|
|
|
31
37
|
# Builds the enum from string
|
|
@@ -42,6 +42,21 @@ module LicenseManager
|
|
|
42
42
|
# Last time it received an event from the provider.
|
|
43
43
|
attr_accessor :last_event_at
|
|
44
44
|
|
|
45
|
+
# Whether canceling a license bought through Stripe refunds its payment. On by default, always off when `canRefund` is false.
|
|
46
|
+
attr_accessor :auto_refund
|
|
47
|
+
|
|
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
|
+
attr_accessor :can_refund
|
|
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
|
+
|
|
45
60
|
attr_accessor :created_at
|
|
46
61
|
|
|
47
62
|
class EnumAttributeValidator
|
|
@@ -79,6 +94,11 @@ module LicenseManager
|
|
|
79
94
|
:'status_reason' => :'statusReason',
|
|
80
95
|
:'last_checked_at' => :'lastCheckedAt',
|
|
81
96
|
:'last_event_at' => :'lastEventAt',
|
|
97
|
+
:'auto_refund' => :'autoRefund',
|
|
98
|
+
:'can_refund' => :'canRefund',
|
|
99
|
+
:'can_manage_subscriptions' => :'canManageSubscriptions',
|
|
100
|
+
:'can_billing_portal' => :'canBillingPortal',
|
|
101
|
+
:'subscription_grace_days' => :'subscriptionGraceDays',
|
|
82
102
|
:'created_at' => :'createdAt'
|
|
83
103
|
}
|
|
84
104
|
end
|
|
@@ -106,6 +126,11 @@ module LicenseManager
|
|
|
106
126
|
:'status_reason' => :'String',
|
|
107
127
|
:'last_checked_at' => :'Time',
|
|
108
128
|
:'last_event_at' => :'Time',
|
|
129
|
+
:'auto_refund' => :'Boolean',
|
|
130
|
+
:'can_refund' => :'Boolean',
|
|
131
|
+
:'can_manage_subscriptions' => :'Boolean',
|
|
132
|
+
:'can_billing_portal' => :'Boolean',
|
|
133
|
+
:'subscription_grace_days' => :'Integer',
|
|
109
134
|
:'created_at' => :'Time'
|
|
110
135
|
}
|
|
111
136
|
end
|
|
@@ -206,6 +231,36 @@ module LicenseManager
|
|
|
206
231
|
self.last_event_at = nil
|
|
207
232
|
end
|
|
208
233
|
|
|
234
|
+
if attributes.key?(:'auto_refund')
|
|
235
|
+
self.auto_refund = attributes[:'auto_refund']
|
|
236
|
+
else
|
|
237
|
+
self.auto_refund = nil
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
if attributes.key?(:'can_refund')
|
|
241
|
+
self.can_refund = attributes[:'can_refund']
|
|
242
|
+
else
|
|
243
|
+
self.can_refund = nil
|
|
244
|
+
end
|
|
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
|
+
|
|
209
264
|
if attributes.key?(:'created_at')
|
|
210
265
|
self.created_at = attributes[:'created_at']
|
|
211
266
|
else
|
|
@@ -242,6 +297,26 @@ module LicenseManager
|
|
|
242
297
|
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
243
298
|
end
|
|
244
299
|
|
|
300
|
+
if @auto_refund.nil?
|
|
301
|
+
invalid_properties.push('invalid value for "auto_refund", auto_refund cannot be nil.')
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
if @can_refund.nil?
|
|
305
|
+
invalid_properties.push('invalid value for "can_refund", can_refund cannot be nil.')
|
|
306
|
+
end
|
|
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
|
+
|
|
245
320
|
if @created_at.nil?
|
|
246
321
|
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
|
247
322
|
end
|
|
@@ -261,6 +336,11 @@ module LicenseManager
|
|
|
261
336
|
return false if @api_key_hint.nil?
|
|
262
337
|
return false if @webhook_url.nil?
|
|
263
338
|
return false if @status.nil?
|
|
339
|
+
return false if @auto_refund.nil?
|
|
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?
|
|
264
344
|
return false if @created_at.nil?
|
|
265
345
|
true
|
|
266
346
|
end
|
|
@@ -325,6 +405,56 @@ module LicenseManager
|
|
|
325
405
|
@status = status
|
|
326
406
|
end
|
|
327
407
|
|
|
408
|
+
# Custom attribute writer method with validation
|
|
409
|
+
# @param [Object] auto_refund Value to be assigned
|
|
410
|
+
def auto_refund=(auto_refund)
|
|
411
|
+
if auto_refund.nil?
|
|
412
|
+
fail ArgumentError, 'auto_refund cannot be nil'
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
@auto_refund = auto_refund
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# Custom attribute writer method with validation
|
|
419
|
+
# @param [Object] can_refund Value to be assigned
|
|
420
|
+
def can_refund=(can_refund)
|
|
421
|
+
if can_refund.nil?
|
|
422
|
+
fail ArgumentError, 'can_refund cannot be nil'
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
@can_refund = can_refund
|
|
426
|
+
end
|
|
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
|
+
|
|
328
458
|
# Custom attribute writer method with validation
|
|
329
459
|
# @param [Object] created_at Value to be assigned
|
|
330
460
|
def created_at=(created_at)
|
|
@@ -350,6 +480,11 @@ module LicenseManager
|
|
|
350
480
|
status_reason == o.status_reason &&
|
|
351
481
|
last_checked_at == o.last_checked_at &&
|
|
352
482
|
last_event_at == o.last_event_at &&
|
|
483
|
+
auto_refund == o.auto_refund &&
|
|
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 &&
|
|
353
488
|
created_at == o.created_at
|
|
354
489
|
end
|
|
355
490
|
|
|
@@ -362,7 +497,7 @@ module LicenseManager
|
|
|
362
497
|
# Calculates hash code according to all attributes.
|
|
363
498
|
# @return [Integer] Hash code
|
|
364
499
|
def hash
|
|
365
|
-
[id, provider, livemode, account_name, api_key_hint, webhook_url, status, status_reason, last_checked_at, last_event_at, 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
|
|
366
501
|
end
|
|
367
502
|
|
|
368
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
|