-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathToken.js
More file actions
168 lines (141 loc) · 3.89 KB
/
Token.js
File metadata and controls
168 lines (141 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/**
* @author Labs64 <netlicensing@labs64.com>
* @license Apache-2.0
* @link https://netlicensing.io
* @copyright 2017 Labs64 NetLicensing
*/
import BaseEntity from './BaseEntity';
/**
* Product module entity used internally by NetLicensing.
*
* Properties visible via NetLicensing API:
*
* Unique number
* @property string number
*
* If set to false, the token is disabled.
* @property boolean active
*
* Expiration Time
* @property string expirationTime
*
* @property string vendorNumber
*
* Token type to be generated.
* DEFAULT - default one-time token (will be expired after first request)
* SHOP - shop token is used to redirect customer to the netlicensingShop(licenseeNumber is mandatory)
* APIKEY - APIKey-token
* @property string tokenType
*
* @property string licenseeNumber
*
* @constructor
*/
export default class Token extends BaseEntity {
constructor(properties) {
super({
properties,
// The attributes that should be cast to native types.
casts: {
number: 'string',
active: 'boolean',
expirationTime: 'date',
vendorNumber: 'string',
tokenType: 'string',
licenseeNumber: 'string',
successURL: 'string',
successURLTitle: 'string',
cancelURL: 'string',
cancelURLTitle: 'string',
shopURL: 'string',
},
});
}
setNumber(number) {
return this.setProperty('number', number);
}
getNumber(def) {
return this.getProperty('number', def);
}
setActive(active) {
return this.setProperty('active', active);
}
getActive(def) {
return this.getProperty('active', def);
}
setExpirationTime(expirationTime) {
return this.setProperty('expirationTime', expirationTime);
}
getExpirationTime(def) {
return this.getProperty('expirationTime', def);
}
setVendorNumber(vendorNumber) {
return this.setProperty('vendorNumber', vendorNumber);
}
getVendorNumber(def) {
return this.getProperty('vendorNumber', def);
}
setTokenType(tokenType) {
return this.setProperty('tokenType', tokenType);
}
getTokenType(def) {
return this.getProperty('tokenType', def);
}
setLicenseeNumber(licenseeNumber) {
return this.setProperty('licenseeNumber', licenseeNumber);
}
getLicenseeNumber(def) {
return this.getProperty('licenseeNumber', def);
}
setSuccessURL(successURL) {
return this.setProperty('successURL', successURL);
}
getSuccessURL(def) {
return this.getProperty('successURL', def);
}
setSuccessURLTitle(successURLTitle) {
return this.setProperty('successURLTitle', successURLTitle);
}
getSuccessURLTitle(def) {
return this.getProperty('successURLTitle', def);
}
setCancelURL(cancelURL) {
return this.setProperty('cancelURL', cancelURL);
}
getCancelURL(def) {
return this.getProperty('cancelURL', def);
}
setCancelURLTitle(cancelURLTitle) {
return this.setProperty('cancelURLTitle', cancelURLTitle);
}
getCancelURLTitle(def) {
return this.getProperty('cancelURLTitle', def);
}
getShopURL(def) {
return this.getProperty('shopURL', def);
}
/**
* @deprecated
* @alias setApiKeyRole
* @param role
* @returns {*}
*/
setRole(role) {
return this.setApiKeyRole(role);
}
/**
* @deprecated
* @alias getApiKeyRole
* @param def
* @returns {*}
*/
getRole(def) {
return this.getApiKeyRole(def);
}
setApiKeyRole(apiKeyRole) {
return this.setProperty('apiKeyRole', apiKeyRole);
}
getApiKeyRole(def) {
return this.getProperty('apiKeyRole', def);
}
}