@voucherify/sdk 2.4.0 → 2.6.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/CHANGELOG.md +145 -0
- package/README.md +239 -5
- package/dist/Categories.d.ts +1 -1
- package/dist/Exports.d.ts +4 -0
- package/dist/Loyalties.d.ts +65 -4
- package/dist/ProductCollections.d.ts +26 -0
- package/dist/Promotions.d.ts +3 -1
- package/dist/PromotionsStacks.d.ts +30 -0
- package/dist/Rewards.d.ts +7 -3
- package/dist/ValidationRules.d.ts +4 -0
- package/dist/VoucherifyServerSide.d.ts +2 -0
- package/dist/Vouchers.d.ts +8 -0
- package/dist/types/Categories.d.ts +13 -0
- package/dist/types/Exports.d.ts +119 -0
- package/dist/types/Loyalties.d.ts +436 -4
- package/dist/types/ProductCollections.d.ts +95 -0
- package/dist/types/PromotionsStacks.d.ts +71 -0
- package/dist/types/Rewards.d.ts +101 -1
- package/dist/types/UtilityTypes.d.ts +3 -0
- package/dist/types/ValidationRules.d.ts +21 -0
- package/dist/types/Vouchers.d.ts +138 -0
- package/dist/voucherifysdk.esm.js +275 -9
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +275 -9
- package/dist/voucherifysdk.umd.development.js.map +1 -1
- package/dist/voucherifysdk.umd.production.min.js +1 -1
- package/dist/voucherifysdk.umd.production.min.js.map +1 -1
- package/package.json +1 -1
package/dist/types/Rewards.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface RewardsResponse {
|
|
|
16
16
|
object: 'reward';
|
|
17
17
|
}
|
|
18
18
|
export declare type RewardsCreateResponse = RewardsResponse & RewardsTypeResponse;
|
|
19
|
+
export declare type RewardsGetResponse = RewardsResponse & RewardsTypeResponse;
|
|
19
20
|
export interface RewardsListResponse {
|
|
20
21
|
object: 'list';
|
|
21
22
|
total: number;
|
|
@@ -69,7 +70,6 @@ interface RewardsTypeCoin {
|
|
|
69
70
|
export declare type RewardsType = RewardsTypeCampaign | RewardsTypeCoin | RewardsTypeMaterial;
|
|
70
71
|
export declare type RewardsTypeResponse = Required<RewardsTypeCampaignResponse> | Required<RewardsTypeCoin> | Required<RewardsTypeMaterial>;
|
|
71
72
|
export declare type RewardsCreate = Rewards & RewardsType;
|
|
72
|
-
export declare type RewardsGetResponse = RewardsCreateResponse;
|
|
73
73
|
export declare type RewardsUpdate = Omit<RewardsCreate, 'type'> & {
|
|
74
74
|
id: string;
|
|
75
75
|
};
|
|
@@ -116,4 +116,104 @@ export interface RewardRedemptionParams {
|
|
|
116
116
|
assignment_id?: string;
|
|
117
117
|
id?: string;
|
|
118
118
|
}
|
|
119
|
+
export declare type Reward = {
|
|
120
|
+
id: string;
|
|
121
|
+
name?: string;
|
|
122
|
+
stock?: string;
|
|
123
|
+
redeemed?: string;
|
|
124
|
+
attributes?: {
|
|
125
|
+
image_url?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
};
|
|
128
|
+
created_at: string;
|
|
129
|
+
updated_at?: string;
|
|
130
|
+
object: 'reward';
|
|
131
|
+
} & RewardType;
|
|
132
|
+
export interface RewardTypeCampaign {
|
|
133
|
+
type: 'CAMPAIGN';
|
|
134
|
+
parameters: {
|
|
135
|
+
campaign: {
|
|
136
|
+
id: string;
|
|
137
|
+
balance?: number;
|
|
138
|
+
type: 'DISCOUNT_COUPONS' | 'PROMOTION' | 'GIFT_VOUCHERS' | 'REFERRAL_PROGRAM';
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export interface RewardTypeCoin {
|
|
143
|
+
type: 'COIN';
|
|
144
|
+
parameters: {
|
|
145
|
+
coin: {
|
|
146
|
+
exchange_ratio: number;
|
|
147
|
+
points_ratio?: number;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export interface RewardTypeMaterial {
|
|
152
|
+
type: 'MATERIAL';
|
|
153
|
+
parameters: {
|
|
154
|
+
product: {
|
|
155
|
+
id: string;
|
|
156
|
+
sku: string | null;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
export declare type RewardType = RewardTypeCampaign | RewardTypeCoin | RewardTypeMaterial;
|
|
161
|
+
export declare type RewardAssignment = RewardsAssignmentCoinReward | RewardsAssignmentCampaignOrMaterialReward;
|
|
162
|
+
export interface RewardsAssignmentCoinReward {
|
|
163
|
+
id: string;
|
|
164
|
+
reward_id: string;
|
|
165
|
+
related_object_id: string;
|
|
166
|
+
related_object_type: 'campaign';
|
|
167
|
+
created_at: string;
|
|
168
|
+
updated_at: string | null;
|
|
169
|
+
object: 'reward-assignment';
|
|
170
|
+
}
|
|
171
|
+
export interface RewardsAssignmentCampaignOrMaterialReward {
|
|
172
|
+
id: string;
|
|
173
|
+
reward_id: string;
|
|
174
|
+
related_object_id: string;
|
|
175
|
+
related_object_type: 'campaign';
|
|
176
|
+
created_at: string;
|
|
177
|
+
updated_at: string | null;
|
|
178
|
+
object: 'reward-assignment';
|
|
179
|
+
parameters: {
|
|
180
|
+
loyalty: {
|
|
181
|
+
points?: number;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export declare type RewardsGetAssignmentResponseBody = RewardAssignment;
|
|
186
|
+
export interface RewardsListAssignmentsRequestQuery {
|
|
187
|
+
limit?: number;
|
|
188
|
+
page?: number;
|
|
189
|
+
}
|
|
190
|
+
export interface RewardsListAssignmentsResponseBody {
|
|
191
|
+
object: 'list';
|
|
192
|
+
data_ref: 'data';
|
|
193
|
+
data: RewardAssignment[];
|
|
194
|
+
total: number;
|
|
195
|
+
}
|
|
196
|
+
export declare type RewardsCreateAssignmentRequestBody = RewardsCreateAssignmentCoinRewardRequestBody | RewardsCreateAssignmentCampaignOrMaterialRewardRequestBody;
|
|
197
|
+
export interface RewardsCreateAssignmentCoinRewardRequestBody {
|
|
198
|
+
campaign: string;
|
|
199
|
+
validation_rules?: string[];
|
|
200
|
+
}
|
|
201
|
+
export interface RewardsCreateAssignmentCampaignOrMaterialRewardRequestBody {
|
|
202
|
+
campaign: string;
|
|
203
|
+
parameters: {
|
|
204
|
+
loyalty: {
|
|
205
|
+
points?: number;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
export declare type RewardsCreateAssignmentResponseBody = RewardAssignment;
|
|
210
|
+
export interface RewardsUpdateAssignmentRequestBody {
|
|
211
|
+
parameters?: {
|
|
212
|
+
loyalty?: {
|
|
213
|
+
points?: number;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
id: string;
|
|
217
|
+
}
|
|
218
|
+
export declare type RewardsUpdateAssignmentResponseBody = RewardAssignment;
|
|
119
219
|
export {};
|
|
@@ -69,3 +69,24 @@ export interface ValidationRulesListAssignmentsResponse {
|
|
|
69
69
|
data_ref: 'data';
|
|
70
70
|
data: ValidationRulesCreateAssignmentResponse[];
|
|
71
71
|
}
|
|
72
|
+
export interface ValidationRulesAssignment {
|
|
73
|
+
id: string;
|
|
74
|
+
rule_id: string;
|
|
75
|
+
related_object_id: string;
|
|
76
|
+
related_object_type: string;
|
|
77
|
+
created_at: string;
|
|
78
|
+
object: 'validation_rules_assignment';
|
|
79
|
+
}
|
|
80
|
+
export interface ValidationRulesListRulesAssignmentsRequestQuery {
|
|
81
|
+
related_object_id?: string;
|
|
82
|
+
rule?: string;
|
|
83
|
+
page?: number;
|
|
84
|
+
limit?: number;
|
|
85
|
+
order?: 'created_at' | '-created_at';
|
|
86
|
+
}
|
|
87
|
+
export interface ValidationRulesListRulesAssignmentsResponseBody {
|
|
88
|
+
object: 'list';
|
|
89
|
+
data_ref: 'data';
|
|
90
|
+
total: number;
|
|
91
|
+
data: ValidationRulesAssignment[];
|
|
92
|
+
}
|
package/dist/types/Vouchers.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OrdersGetResponse } from './Orders';
|
|
2
2
|
import { SimpleCustomer } from './Customers';
|
|
3
3
|
import { DiscountUnit, DiscountAmount, DiscountPercent, DiscountFixed } from './DiscountVoucher';
|
|
4
|
+
import { LoyaltyCardTransaction } from './Loyalties';
|
|
4
5
|
export declare type VoucherType = 'GIFT_VOUCHER' | 'DISCOUNT_VOUCHER' | 'LOYALTY_CARD' | 'LUCKY_DRAW';
|
|
5
6
|
export interface SimpleVoucher {
|
|
6
7
|
code_config?: {
|
|
@@ -214,3 +215,140 @@ export declare type VouchersBulkUpdateMetadataResponse = {
|
|
|
214
215
|
export declare type VouchersBulkUpdateResponse = {
|
|
215
216
|
async_action_id: string;
|
|
216
217
|
};
|
|
218
|
+
export declare type GiftCardTransaction = GiftCardTransactionBase & GiftCardTransactionDetails;
|
|
219
|
+
export interface GiftCardTransactionBase {
|
|
220
|
+
id: string;
|
|
221
|
+
source_id: string | null;
|
|
222
|
+
voucher_id: string;
|
|
223
|
+
campaign_id: string | null;
|
|
224
|
+
related_transaction_id: string | null;
|
|
225
|
+
reason: string | null;
|
|
226
|
+
created_at: string;
|
|
227
|
+
}
|
|
228
|
+
export declare type GiftCardTransactionDetails = GiftCardTransactionRedemptionDetails | GiftCardTransactionRefundDetails | GiftCardTransactionAdditionDetails | GiftCardTransactionRemovalDetails;
|
|
229
|
+
export interface GiftCardTransactionRedemptionDetails {
|
|
230
|
+
source: null;
|
|
231
|
+
type: 'CREDITS_REDEMPTION';
|
|
232
|
+
details: {
|
|
233
|
+
balance: {
|
|
234
|
+
type: 'gift_voucher';
|
|
235
|
+
total: number;
|
|
236
|
+
amount: number;
|
|
237
|
+
object: 'balance';
|
|
238
|
+
balance: number;
|
|
239
|
+
related_object: {
|
|
240
|
+
id: string;
|
|
241
|
+
type: 'voucher';
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
order: {
|
|
245
|
+
id: string;
|
|
246
|
+
source_id: string | null;
|
|
247
|
+
};
|
|
248
|
+
redemption: {
|
|
249
|
+
id: string;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
export interface GiftCardTransactionRefundDetails {
|
|
254
|
+
source: null;
|
|
255
|
+
type: 'CREDITS_REFUND';
|
|
256
|
+
details: {
|
|
257
|
+
balance: {
|
|
258
|
+
type: 'gift_voucher';
|
|
259
|
+
total: number;
|
|
260
|
+
amount: number;
|
|
261
|
+
object: 'balance';
|
|
262
|
+
balance: number;
|
|
263
|
+
related_object: {
|
|
264
|
+
id: string;
|
|
265
|
+
type: 'voucher';
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
order: {
|
|
269
|
+
id: string;
|
|
270
|
+
source_id: string | null;
|
|
271
|
+
};
|
|
272
|
+
redemption: {
|
|
273
|
+
id: string;
|
|
274
|
+
};
|
|
275
|
+
rollback: {
|
|
276
|
+
id: string;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
export interface GiftCardTransactionAdditionDetails {
|
|
281
|
+
source: 'voucherify-web-ui' | 'API';
|
|
282
|
+
type: 'CREDITS_ADDITION';
|
|
283
|
+
details: {
|
|
284
|
+
balance: {
|
|
285
|
+
type: 'gift_voucher';
|
|
286
|
+
total: number;
|
|
287
|
+
amount: number;
|
|
288
|
+
object: 'balance';
|
|
289
|
+
balance: number;
|
|
290
|
+
operation_type: 'MANUAL' | 'AUTOMATIC';
|
|
291
|
+
related_object: {
|
|
292
|
+
id: string;
|
|
293
|
+
type: 'voucher';
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
export interface GiftCardTransactionRemovalDetails {
|
|
299
|
+
source: 'voucherify-web-ui' | 'API';
|
|
300
|
+
type: 'CREDITS_REMOVAL';
|
|
301
|
+
details: {
|
|
302
|
+
balance: {
|
|
303
|
+
type: 'gift_voucher';
|
|
304
|
+
total: number;
|
|
305
|
+
amount: number;
|
|
306
|
+
object: 'balance';
|
|
307
|
+
balance: number;
|
|
308
|
+
operation_type: 'MANUAL' | 'AUTOMATIC';
|
|
309
|
+
related_object: {
|
|
310
|
+
id: string;
|
|
311
|
+
type: 'voucher';
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
export declare type VoucherTransaction = GiftCardTransaction | LoyaltyCardTransaction;
|
|
317
|
+
export declare type VoucherTransactionsExportFields = 'id' | 'campaign_id' | 'voucher_id' | 'type' | 'source_id' | 'reason' | 'source' | 'balance' | 'amount' | 'related_transaction_id' | 'created_at' | 'details';
|
|
318
|
+
export interface VouchersListTransactionsRequestQuery {
|
|
319
|
+
limit?: number;
|
|
320
|
+
page?: number;
|
|
321
|
+
}
|
|
322
|
+
export interface VouchersListTransactionsResponseBody {
|
|
323
|
+
object: 'list';
|
|
324
|
+
data_ref: 'data';
|
|
325
|
+
data: VoucherTransaction[];
|
|
326
|
+
has_more: boolean;
|
|
327
|
+
}
|
|
328
|
+
export interface VouchersExportTransactionsRequestBody {
|
|
329
|
+
parameters?: {
|
|
330
|
+
order?: '-created_at' | 'created_at';
|
|
331
|
+
fields?: VoucherTransactionsExportFields[];
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
export interface VouchersExportTransactionsResponseBody {
|
|
335
|
+
id: string;
|
|
336
|
+
status: 'SCHEDULED';
|
|
337
|
+
channel: string;
|
|
338
|
+
parameters: {
|
|
339
|
+
order?: string;
|
|
340
|
+
fields?: VoucherTransactionsExportFields[];
|
|
341
|
+
filters: {
|
|
342
|
+
voucher_id: {
|
|
343
|
+
conditions: {
|
|
344
|
+
$in: [string];
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
result: null;
|
|
350
|
+
user_id: string | null;
|
|
351
|
+
exported_object: 'voucher_transactions';
|
|
352
|
+
object: 'export';
|
|
353
|
+
created_at: string;
|
|
354
|
+
}
|
|
@@ -393,6 +393,14 @@ class Exports {
|
|
|
393
393
|
create(exportResource) {
|
|
394
394
|
return this.client.post('/exports', exportResource);
|
|
395
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* @see https://docs.voucherify.io/reference/list-exports
|
|
398
|
+
*/
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
list(query = {}) {
|
|
402
|
+
return this.client.get('/exports', query);
|
|
403
|
+
}
|
|
396
404
|
/**
|
|
397
405
|
* @see https://docs.voucherify.io/reference/get-export
|
|
398
406
|
*/
|
|
@@ -578,6 +586,22 @@ class Vouchers {
|
|
|
578
586
|
form.append('file', fileStream);
|
|
579
587
|
return this.client.post('/vouchers/importCSV', form);
|
|
580
588
|
}
|
|
589
|
+
/**
|
|
590
|
+
* @see https://docs.voucherify.io/reference/list-voucher-transactions
|
|
591
|
+
*/
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
listTransactions(code, params) {
|
|
595
|
+
return this.client.get(`/vouchers/${encode(code)}/transactions`, params);
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* @see https://docs.voucherify.io/reference/export-voucher-transactions
|
|
599
|
+
*/
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
exportTransactions(code, body) {
|
|
603
|
+
return this.client.post(`/vouchers/${encode(code)}/transactions/export`, body);
|
|
604
|
+
}
|
|
581
605
|
|
|
582
606
|
}
|
|
583
607
|
|
|
@@ -765,11 +789,13 @@ class PromotionTiers {
|
|
|
765
789
|
}
|
|
766
790
|
|
|
767
791
|
class Promotions {
|
|
768
|
-
constructor(client, tiers) {
|
|
792
|
+
constructor(client, tiers, stack) {
|
|
769
793
|
this.client = void 0;
|
|
770
794
|
this.tiers = void 0;
|
|
795
|
+
this.stack = void 0;
|
|
771
796
|
this.client = client;
|
|
772
797
|
this.tiers = tiers;
|
|
798
|
+
this.stack = stack;
|
|
773
799
|
}
|
|
774
800
|
/**
|
|
775
801
|
* @see https://docs.voucherify.io/reference/create-promotion-campaign
|
|
@@ -1172,6 +1198,14 @@ class Rewards {
|
|
|
1172
1198
|
delete(rewardId) {
|
|
1173
1199
|
return this.client.delete(`/rewards/${encode(rewardId)}`);
|
|
1174
1200
|
}
|
|
1201
|
+
/**
|
|
1202
|
+
* @see https://docs.voucherify.io/reference/get-reward-assignment
|
|
1203
|
+
*/
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
getAssignment(rewardId, assignmentId) {
|
|
1207
|
+
return this.client.get(`/rewards/${encode(rewardId)}/assignments/${encode(assignmentId)}`);
|
|
1208
|
+
}
|
|
1175
1209
|
/**
|
|
1176
1210
|
* @see https://docs.voucherify.io/reference/list-reward-assignments
|
|
1177
1211
|
*/
|
|
@@ -1280,6 +1314,14 @@ class Loyalties {
|
|
|
1280
1314
|
deleteRewardAssignment(campaignId, assignmentId) {
|
|
1281
1315
|
return this.client.delete(`/loyalties/${encode(campaignId)}/rewards/${assignmentId}`);
|
|
1282
1316
|
}
|
|
1317
|
+
/**
|
|
1318
|
+
* @see https://docs.voucherify.io/reference/get-reward-assignment-2
|
|
1319
|
+
*/
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
getRewardAssignment(campaignId, assignmentId) {
|
|
1323
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/rewards/${encode(assignmentId)}`);
|
|
1324
|
+
}
|
|
1283
1325
|
/**
|
|
1284
1326
|
* @see https://docs.voucherify.io/reference/list-earning-rules
|
|
1285
1327
|
*/
|
|
@@ -1354,28 +1396,63 @@ class Loyalties {
|
|
|
1354
1396
|
}
|
|
1355
1397
|
/**
|
|
1356
1398
|
* @see https://docs.voucherify.io/reference/get-member
|
|
1399
|
+
* @see https://docs.voucherify.io/reference/get-member-1
|
|
1357
1400
|
*/
|
|
1358
1401
|
|
|
1359
1402
|
|
|
1360
1403
|
getMember(campaignId, memberId) {
|
|
1361
|
-
return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}`);
|
|
1404
|
+
return this.client.get(campaignId ? `/loyalties/${encode(campaignId)}/members/${memberId}` : `/loyalties/members/${memberId}`);
|
|
1362
1405
|
}
|
|
1363
1406
|
/**
|
|
1364
1407
|
* @see https://docs.voucherify.io/reference/get-member-activities
|
|
1408
|
+
* @see https://docs.voucherify.io/reference/get-member-activities-1
|
|
1365
1409
|
*/
|
|
1366
1410
|
|
|
1367
1411
|
|
|
1368
1412
|
getMemberActivities(campaignId, memberId) {
|
|
1369
|
-
return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}/activities`);
|
|
1413
|
+
return this.client.get(campaignId ? `/loyalties/${encode(campaignId)}/members/${memberId}/activities` : `/loyalties/members/${memberId}/activities`);
|
|
1370
1414
|
}
|
|
1371
1415
|
/**
|
|
1372
|
-
* @see https://docs.voucherify.io/reference/
|
|
1416
|
+
* @see https://docs.voucherify.io/reference/list-member-rewards
|
|
1417
|
+
*/
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
listMemberRewards(memberId, params) {
|
|
1421
|
+
return this.client.get(`/loyalties/members/${encode(memberId)}/rewards`, params);
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* @see https://docs.voucherify.io/reference/add-remove-loyalty-card-balance
|
|
1425
|
+
* @see https://docs.voucherify.io/reference/add-remove-loyalty-card-balance-1
|
|
1426
|
+
*/
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
addOrRemoveCardBalance(memberId, balance, campaignId) {
|
|
1430
|
+
return this.client.post(campaignId ? `/loyalties/${encode(campaignId)}/members/${memberId}/balance` : `/loyalties/members/${memberId}/balance`, balance);
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* @see https://docs.voucherify.io/reference/add-remove-loyalty-card-balance-1
|
|
1373
1434
|
*/
|
|
1374
1435
|
|
|
1375
1436
|
|
|
1376
1437
|
addPoints(campaignId, memberId, balance) {
|
|
1377
1438
|
return this.client.post(`/loyalties/${encode(campaignId)}/members/${memberId}/balance`, balance);
|
|
1378
1439
|
}
|
|
1440
|
+
/**
|
|
1441
|
+
* @see https://docs.voucherify.io/reference/transfer-points
|
|
1442
|
+
*/
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
transferPoints(campaignId, memberId, loyaltiesTransferPoints) {
|
|
1446
|
+
return this.client.post(`/loyalties/${encode(campaignId)}/members/${encode(memberId)}/transfers`, loyaltiesTransferPoints);
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* @see https://docs.voucherify.io/reference/get-points-expiration
|
|
1450
|
+
*/
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
getPointsExpiration(campaignId, memberId, params) {
|
|
1454
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}/points-expiration`, params);
|
|
1455
|
+
}
|
|
1379
1456
|
/**
|
|
1380
1457
|
* @see https://docs.voucherify.io/reference/redeem-loyalty-card
|
|
1381
1458
|
*/
|
|
@@ -1384,6 +1461,80 @@ class Loyalties {
|
|
|
1384
1461
|
redeemReward(campaignId, memberId, params) {
|
|
1385
1462
|
return this.client.post(`/loyalties/${encode(campaignId)}/members/${encode(memberId)}/redemption`, params);
|
|
1386
1463
|
}
|
|
1464
|
+
/**
|
|
1465
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-tier-rewards
|
|
1466
|
+
*/
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
listLoyaltyTierRewards(campaignId, tierId) {
|
|
1470
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/tiers/${encode(tierId)}/rewards`);
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-card-transactions
|
|
1474
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-card-transactions-1
|
|
1475
|
+
*/
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
listCardTransactions(memberId, campaignId, params) {
|
|
1479
|
+
return this.client.get(campaignId ? `/loyalties/${encode(campaignId)}/members/${encode(memberId)}/transactions` : `/loyalties/members/${encode(memberId)}/transactions`, params);
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* @see https://docs.voucherify.io/reference/export-loyalty-card-transactions
|
|
1483
|
+
* @see https://docs.voucherify.io/reference/export-loyalty-card-transactions-1
|
|
1484
|
+
*/
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
exportCardTransactions(memberId, campaignId, params = {}) {
|
|
1488
|
+
return this.client.post(campaignId ? `/loyalties/${encode(campaignId)}/members/${encode(memberId)}/transactions/export` : `/loyalties/members/${encode(memberId)}/transactions/export`, params);
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* @see https://docs.voucherify.io/reference/get-reward-details
|
|
1492
|
+
*/
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
getRewardDetails(campaignId, assignmentId) {
|
|
1496
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/reward-assignments/${encode(assignmentId)}/reward`);
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-tiers
|
|
1500
|
+
*/
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
listTiers(campaignId, params) {
|
|
1504
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/tiers`, params);
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* @see https://docs.voucherify.io/reference/get-loyalty-tier
|
|
1508
|
+
*/
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
getTier(campaignId, tierId) {
|
|
1512
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/tiers/${encode(tierId)}`);
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* @see https://docs.voucherify.io/reference/create-loyalty-tiers
|
|
1516
|
+
*/
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
createTiers(campaignId, tiers) {
|
|
1520
|
+
return this.client.post(`/loyalties/${encode(campaignId)}/tiers`, tiers);
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-tier-earning-rules
|
|
1524
|
+
*/
|
|
1525
|
+
|
|
1526
|
+
|
|
1527
|
+
listLoyaltyTierEarningRules(campaignId, tierId, params) {
|
|
1528
|
+
return this.client.get(`/loyalties/${encode(campaignId)}/tiers/${encode(tierId)}/earning-rules`, params);
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* @see https://docs.voucherify.io/reference/get-member-loyalty-tier
|
|
1532
|
+
*/
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
listMemberLoyaltyTiers(memberId) {
|
|
1536
|
+
return this.client.get(`/loyalties/members/${encode(memberId)}/tiers`);
|
|
1537
|
+
}
|
|
1387
1538
|
|
|
1388
1539
|
}
|
|
1389
1540
|
|
|
@@ -1452,6 +1603,14 @@ class ValidationRules {
|
|
|
1452
1603
|
list(params = {}) {
|
|
1453
1604
|
return this.client.get('/validation-rules', params);
|
|
1454
1605
|
}
|
|
1606
|
+
/**
|
|
1607
|
+
* @see https://docs.voucherify.io/reference/list-validation-rules-assignments
|
|
1608
|
+
*/
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
listRulesAssignments(params = {}) {
|
|
1612
|
+
return this.client.get(`/validation-rules-assignments`, params);
|
|
1613
|
+
}
|
|
1455
1614
|
/**
|
|
1456
1615
|
* @see https://docs.voucherify.io/reference/list-validation-rule-assignments
|
|
1457
1616
|
*/
|
|
@@ -1574,8 +1733,8 @@ class Categories {
|
|
|
1574
1733
|
*/
|
|
1575
1734
|
|
|
1576
1735
|
|
|
1577
|
-
list() {
|
|
1578
|
-
return this.client.get('/categories');
|
|
1736
|
+
list(params = {}) {
|
|
1737
|
+
return this.client.get('/categories', params);
|
|
1579
1738
|
}
|
|
1580
1739
|
/**
|
|
1581
1740
|
* @see https://docs.voucherify.io/reference/create-category
|
|
@@ -1612,6 +1771,110 @@ class Categories {
|
|
|
1612
1771
|
|
|
1613
1772
|
}
|
|
1614
1773
|
|
|
1774
|
+
class PromotionsStacks {
|
|
1775
|
+
constructor(client) {
|
|
1776
|
+
this.client = void 0;
|
|
1777
|
+
this.client = client;
|
|
1778
|
+
}
|
|
1779
|
+
/**
|
|
1780
|
+
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
1781
|
+
*/
|
|
1782
|
+
|
|
1783
|
+
|
|
1784
|
+
listInCampaign(campaignId) {
|
|
1785
|
+
return this.client.get(`/promotions/${campaignId}/stacks`);
|
|
1786
|
+
}
|
|
1787
|
+
/**
|
|
1788
|
+
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
1789
|
+
*/
|
|
1790
|
+
|
|
1791
|
+
|
|
1792
|
+
createInCampaign(campaignId, body) {
|
|
1793
|
+
return this.client.post(`/promotions/${campaignId}/stacks`, body);
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* @see https://docs.voucherify.io/reference/delete-promotion-stack
|
|
1797
|
+
*/
|
|
1798
|
+
|
|
1799
|
+
|
|
1800
|
+
delete(campaignId, stackId) {
|
|
1801
|
+
return this.client.delete(`/promotions/${campaignId}/stacks/${stackId}`);
|
|
1802
|
+
}
|
|
1803
|
+
/**
|
|
1804
|
+
* @see https://docs.voucherify.io/reference/get-promotion-stack
|
|
1805
|
+
*/
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
get(campaignId, stackId) {
|
|
1809
|
+
return this.client.get(`/promotions/${campaignId}/stacks/${stackId}`);
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* @see https://docs.voucherify.io/reference/update-promotion-stack
|
|
1813
|
+
*/
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
update(campaignId, stackId, body) {
|
|
1817
|
+
return this.client.put(`/promotions/${campaignId}/stacks/${stackId}`, body);
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
1821
|
+
*/
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
list(params) {
|
|
1825
|
+
return this.client.get(`/promotions/stacks`, params);
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
class ProductCollections {
|
|
1831
|
+
constructor(client) {
|
|
1832
|
+
this.client = void 0;
|
|
1833
|
+
this.client = client;
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* @see https://docs.voucherify.io/reference/create-product-collection
|
|
1837
|
+
*/
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
create(productCollection) {
|
|
1841
|
+
return this.client.post(`/product-collections`, productCollection);
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* @see https://docs.voucherify.io/reference/list-product-collections
|
|
1845
|
+
*/
|
|
1846
|
+
|
|
1847
|
+
|
|
1848
|
+
list(params) {
|
|
1849
|
+
return this.client.get(`/product-collections`, params);
|
|
1850
|
+
}
|
|
1851
|
+
/**
|
|
1852
|
+
* @see https://docs.voucherify.io/reference/delete-product-collection
|
|
1853
|
+
*/
|
|
1854
|
+
|
|
1855
|
+
|
|
1856
|
+
delete(productCollectionId) {
|
|
1857
|
+
return this.client.delete(`/product-collections/${encode(productCollectionId)}`);
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* @see https://docs.voucherify.io/reference/get-product-collection
|
|
1861
|
+
*/
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
get(productCollectionId) {
|
|
1865
|
+
return this.client.get(`/product-collections/${encode(productCollectionId)}`);
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* @see https://docs.voucherify.io/reference/list-products-in-collection
|
|
1869
|
+
*/
|
|
1870
|
+
|
|
1871
|
+
|
|
1872
|
+
listProducts(productCollectionId, params) {
|
|
1873
|
+
return this.client.get(`/product-collections/${encode(productCollectionId)}/products`, params);
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1615
1878
|
// apiLimitsHandler: ApiLimitsHandler
|
|
1616
1879
|
// campaigns: Campaigns
|
|
1617
1880
|
// consents: Consents
|
|
@@ -1642,7 +1905,7 @@ function VoucherifyServerSide(options) {
|
|
|
1642
1905
|
let headers = {
|
|
1643
1906
|
'X-App-Id': options.applicationId,
|
|
1644
1907
|
'X-App-Token': options.secretKey,
|
|
1645
|
-
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.
|
|
1908
|
+
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.6.0"}`,
|
|
1646
1909
|
'Content-Type': 'application/json'
|
|
1647
1910
|
};
|
|
1648
1911
|
|
|
@@ -1680,13 +1943,15 @@ function VoucherifyServerSide(options) {
|
|
|
1680
1943
|
const events = new Events(client);
|
|
1681
1944
|
const distributions = new Distributions(client, exportsNamespace);
|
|
1682
1945
|
const promotionTiers = new PromotionTiers(client);
|
|
1683
|
-
const
|
|
1946
|
+
const promotionStack = new PromotionsStacks(client);
|
|
1947
|
+
const promotions = new Promotions(client, promotionTiers, promotionStack);
|
|
1684
1948
|
const validations = new Validations(client, promotions);
|
|
1685
1949
|
const redemptions = new Redemptions(client);
|
|
1686
1950
|
const customers = new Customers(client);
|
|
1687
1951
|
const consents = new Consents(client);
|
|
1688
1952
|
const orders = new Orders(client);
|
|
1689
1953
|
const products = new Products(client);
|
|
1954
|
+
const productCollections = new ProductCollections(client);
|
|
1690
1955
|
const rewards = new Rewards(client);
|
|
1691
1956
|
const loyalties = new Loyalties(client);
|
|
1692
1957
|
const segments = new Segments(client);
|
|
@@ -1705,6 +1970,7 @@ function VoucherifyServerSide(options) {
|
|
|
1705
1970
|
consents,
|
|
1706
1971
|
orders,
|
|
1707
1972
|
products,
|
|
1973
|
+
productCollections,
|
|
1708
1974
|
rewards,
|
|
1709
1975
|
loyalties,
|
|
1710
1976
|
segments,
|
|
@@ -1895,7 +2161,7 @@ function VoucherifyClientSide(options) {
|
|
|
1895
2161
|
let headers = {
|
|
1896
2162
|
'X-Client-Application-Id': options.clientApplicationId,
|
|
1897
2163
|
'X-Client-Token': options.clientSecretKey,
|
|
1898
|
-
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.
|
|
2164
|
+
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.6.0"}`
|
|
1899
2165
|
};
|
|
1900
2166
|
|
|
1901
2167
|
if (environment().startsWith('Node')) {
|