Skip to content

Commit d5ffda3

Browse files
committed
Support automatic customer creation in CreateKey
1 parent 99e7367 commit d5ffda3

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

licensing/methods.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ def create_key(token, product_id, period = 0,\
161161
add_or_use_existing_customer=False,\
162162
trial_activation=False,\
163163
max_no_of_machines=0,\
164-
no_of_keys=1):
164+
no_of_keys=1,\
165+
name = None,\
166+
email = None,\
167+
company_name=None,\
168+
enable_customer_association = False,\
169+
allow_activation_management = False ):
165170
"""
166171
This method allows you to create a new license key. The license can
167172
either be standalone or associated to a specific customer. It is also
@@ -170,6 +175,12 @@ def create_key(token, product_id, period = 0,\
170175
duplicates based on the email, you can use the AddOrUseExistingCustomer
171176
parameter.
172177
178+
The parameters "name", "email", "company_name", "enable_customer_association"
179+
and "allow_activation_management" are used to create a new customer (or update an existing one)
180+
and automatically associate it with the newly created license. Please note that you need to use an
181+
access token with both "CreateKey" and "AddCustomer" permissions. Moreover, either
182+
the parameter "new_customer" or "add_or_use_existing_customer" need to be set to True.
183+
173184
More docs: https://app.cryptolens.io/docs/api/v3/CreateKey/
174185
"""
175186

@@ -194,7 +205,12 @@ def create_key(token, product_id, period = 0,\
194205
"AddOrUseExistingCustomer": add_or_use_existing_customer,\
195206
"TrialActivation": trial_activation,\
196207
"MaxNoOfMachines": max_no_of_machines,\
197-
"NoOfKeys":no_of_keys})
208+
"NoOfKeys":no_of_keys,\
209+
"Name": name,\
210+
"Email": email,\
211+
"CompanyName": company_name,\
212+
"EnableCustomerAssociation": enable_customer_association,\
213+
"AllowActivationManagement": allow_activation_management})
198214
except HTTPError as e:
199215
response = e.read()
200216
except URLError as e:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
setup(
33
name = 'licensing', # How you named your package folder (MyLib)
44
packages = ['licensing'], # Chose the same as "name"
5-
version = '0.29', # Start with a small number and increase it with every change you make
5+
version = '0.30', # Start with a small number and increase it with every change you make
66
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
77
description = 'Client library for Cryptolens licensing Web API.', # Give a short description about your library
88
author = 'Cryptolens AB', # Type in your name
99
author_email = '[email protected]', # Type in your E-Mail
1010
url = 'https://cryptolens.io', # Provide either the link to your github or to your website
11-
download_url = 'https://github.com/Cryptolens/cryptolens-python/archive/v_29.tar.gz', # I explain this later on
11+
download_url = 'https://github.com/Cryptolens/cryptolens-python/archive/v_30.tar.gz', # I explain this later on
1212
keywords = ['software licensing', 'licensing library', 'cryptolens'], # Keywords that define your package best
1313
classifiers=[
1414
#'Development Status :: 5 - Stable', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package

0 commit comments

Comments
 (0)