@ikonintegration/mod-license-client 0.4.8 → 2.0.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.
- package/README.md +5 -9
- package/lib/Client.js +4 -6
- package/lib/operations/Order.js +3 -0
- package/lib/operations/Product.js +1 -1
- package/lib/operations/Vault.js +11 -0
- package/package.json +1 -1
- package/lib/operations/Client.js +0 -32
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ const API = new SMLicense({
|
|
|
20
20
|
apiKey: config.examProvider.key, //API token on IDM.AppID format (generate from APIKey at https://runkit.com/gwdp/idm-appid-v1)
|
|
21
21
|
//Must be specified when using admin or user routes
|
|
22
22
|
authorizationToken: '', -- optional, IDM JWT for shared module admins and user routes -- Accepts a function to be called async and return the token
|
|
23
|
-
|
|
23
|
+
tenantID: ''
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
//Revoke License
|
|
@@ -82,13 +82,9 @@ The following header must be specified in every request!
|
|
|
82
82
|
- API.voucher.verifyVoucher(voucherID) - Admin, users and services
|
|
83
83
|
- API.voucher.getVouchers() - Admin only
|
|
84
84
|
|
|
85
|
-
**Client:**
|
|
86
|
-
- API.client.createClient(clientName) - Admin only
|
|
87
|
-
- API.client.updateClient(clientName, clientID) - Admin only
|
|
88
|
-
- API.client.deleteClient(clientID) - Admin only
|
|
89
|
-
- API.client.getClient(clientID) - Admin only
|
|
90
|
-
- API.client.getAllClient() - Admin only
|
|
91
|
-
|
|
92
85
|
**Key:**
|
|
93
86
|
- API.key.getAvailableKeys(externalID, numberOfLicenses) - Admin, users and services
|
|
94
|
-
- API.key.getKey(activationKey) - Service only
|
|
87
|
+
- API.key.getKey(activationKey) - Service only
|
|
88
|
+
|
|
89
|
+
**Vault**
|
|
90
|
+
- API.vault.getVaultNonce(externalID, userInfo) - Sysadmins, Admins and users (no services here)
|
package/lib/Client.js
CHANGED
|
@@ -5,10 +5,10 @@ import APIRequest from './core/Request';
|
|
|
5
5
|
import OperationProduct from './operations/Product';
|
|
6
6
|
import OperationLicense from './operations/License';
|
|
7
7
|
import OperationLicenseConsumption from './operations/LicenseConsumption';
|
|
8
|
-
import OperationClient from './operations/Client';
|
|
9
8
|
import OperationOrder from './operations/Order';
|
|
10
9
|
import OperationVoucher from './operations/Voucher';
|
|
11
10
|
import OperationKey from './operations/Key';
|
|
11
|
+
import OperationVault from './operations/Vault';
|
|
12
12
|
//
|
|
13
13
|
export default class Client {
|
|
14
14
|
/* config structure
|
|
@@ -16,20 +16,20 @@ export default class Client {
|
|
|
16
16
|
endpoint: 'https://localhost',
|
|
17
17
|
port: 9998,
|
|
18
18
|
apiKey: '',
|
|
19
|
-
|
|
19
|
+
tenantID: '',
|
|
20
20
|
authorizationToken: '' -- optional
|
|
21
21
|
}
|
|
22
22
|
*/
|
|
23
23
|
constructor(config) {
|
|
24
24
|
this.config = config;
|
|
25
25
|
// api operations
|
|
26
|
-
this.client = new OperationClient(this);
|
|
27
26
|
this.license = new OperationLicense(this);
|
|
28
27
|
this.licenseConsumption = new OperationLicenseConsumption(this);
|
|
29
28
|
this.product = new OperationProduct(this);
|
|
30
29
|
this.order = new OperationOrder(this);
|
|
31
30
|
this.voucher = new OperationVoucher(this);
|
|
32
31
|
this.key = new OperationKey(this);
|
|
32
|
+
this.vault = new OperationVault(this);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
async newBaseRequest(method) {
|
|
@@ -46,9 +46,7 @@ export default class Client {
|
|
|
46
46
|
}
|
|
47
47
|
req.appendHeader('Authorization', token);
|
|
48
48
|
}
|
|
49
|
-
if (this.config.
|
|
50
|
-
req.appendHeader('Namespace', this.config.namespace);
|
|
51
|
-
}
|
|
49
|
+
if (this.config.tenantID) req.appendHeader('tenantID', this.config.tenantID);
|
|
52
50
|
//
|
|
53
51
|
req.baseURL = this.config.endpoint;
|
|
54
52
|
if (this.config.port) req.baseURL += `:${this.config.port}`;
|
package/lib/operations/Order.js
CHANGED
|
@@ -8,6 +8,9 @@ export default class Order {
|
|
|
8
8
|
isMonerisEnabledForProduct(product) {
|
|
9
9
|
return (this.getProviderFromProduct(product).indexOf('moneris') != -1);
|
|
10
10
|
}
|
|
11
|
+
isBraintreeEnabledForProduct(product) {
|
|
12
|
+
return (this.getProviderFromProduct(product).indexOf('braintree') != -1);
|
|
13
|
+
}
|
|
11
14
|
//CC/Skip order
|
|
12
15
|
async preOrder(orderObj) {
|
|
13
16
|
const req = await this.api.newBaseRequest('POST');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default class Vault {
|
|
2
|
+
constructor(API) {
|
|
3
|
+
this.api = API;
|
|
4
|
+
}
|
|
5
|
+
async getVaultNonce(externalID, userInfo) {
|
|
6
|
+
const req = await this.api.newBaseRequest('POST');
|
|
7
|
+
req.path = '/vault/nonce/' + (externalID || '');
|
|
8
|
+
req.body = { ...userInfo };
|
|
9
|
+
return await req.exec();
|
|
10
|
+
}
|
|
11
|
+
}
|
package/package.json
CHANGED
package/lib/operations/Client.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export default class Client {
|
|
2
|
-
constructor(API) {
|
|
3
|
-
this.api = API;
|
|
4
|
-
}
|
|
5
|
-
async createClient(clientName) {
|
|
6
|
-
const req = await this.api.newBaseRequest('POST');
|
|
7
|
-
req.path = '/client/new';
|
|
8
|
-
req.body = { name: clientName };
|
|
9
|
-
return await req.exec();
|
|
10
|
-
}
|
|
11
|
-
async updateClient(clientName, clientID) {
|
|
12
|
-
const req = await this.api.newBaseRequest('PUT');
|
|
13
|
-
req.path = '/client/' + clientID;
|
|
14
|
-
req.body = { name: clientName };
|
|
15
|
-
return await req.exec();
|
|
16
|
-
}
|
|
17
|
-
async deleteClient(clientID) {
|
|
18
|
-
const req = await this.api.newBaseRequest('DELETE');
|
|
19
|
-
req.path = '/client/' + clientID;
|
|
20
|
-
return await req.exec();
|
|
21
|
-
}
|
|
22
|
-
async getClient(clientID) {
|
|
23
|
-
const req = await this.api.newBaseRequest('GET');
|
|
24
|
-
req.path = '/client/' + clientID;
|
|
25
|
-
return await req.exec();
|
|
26
|
-
}
|
|
27
|
-
async getAllClient() {
|
|
28
|
-
const req = await this.api.newBaseRequest('GET');
|
|
29
|
-
req.path = '/clients';
|
|
30
|
-
return await req.exec();
|
|
31
|
-
}
|
|
32
|
-
}
|