@voucherify/sdk 2.0.1 → 2.0.4

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.
@@ -7,6 +7,13 @@
7
7
  axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
8
8
  Qs = Qs && Object.prototype.hasOwnProperty.call(Qs, 'default') ? Qs['default'] : Qs;
9
9
 
10
+ (function (DiscountVouchersTypesEnum) {
11
+ DiscountVouchersTypesEnum["AMOUNT"] = "AMOUNT";
12
+ DiscountVouchersTypesEnum["PERCENT"] = "PERCENT";
13
+ DiscountVouchersTypesEnum["UNIT"] = "UNIT";
14
+ DiscountVouchersTypesEnum["FIXED"] = "FIXED";
15
+ })(exports.DiscountVouchersTypesEnum || (exports.DiscountVouchersTypesEnum = {}));
16
+
10
17
  /**
11
18
  * @internal
12
19
  */
@@ -81,6 +88,9 @@
81
88
  async post(path, body, params, headers) {
82
89
  const response = await this.request.post(path, body, {
83
90
  params,
91
+ paramsSerializer: function (params) {
92
+ return Qs.stringify(params);
93
+ },
84
94
  headers
85
95
  });
86
96
  return response.data;
@@ -505,6 +515,14 @@
505
515
 
506
516
  return this.validateVoucher(code, context);
507
517
  }
518
+ /**
519
+ * @see https://docs.voucherify.io/reference/validate-stacked-discounts-1
520
+ */
521
+
522
+
523
+ validateStackable(params) {
524
+ return this.client.post(`/validations`, params);
525
+ }
508
526
 
509
527
  }
510
528
 
@@ -521,6 +539,14 @@
521
539
  redeem(code, body = {}) {
522
540
  return this.client.post(`/vouchers/${encode(code)}/redemption`, body);
523
541
  }
542
+ /**
543
+ * @see https://docs.voucherify.io/reference/redeem-stacked-discounts
544
+ */
545
+
546
+
547
+ redeemStackable(params) {
548
+ return this.client.post(`/redemptions`, params);
549
+ }
524
550
  /**
525
551
  * @see https://docs.voucherify.io/reference/get-redemption
526
552
  */
@@ -573,6 +599,15 @@
573
599
 
574
600
  return this.client.post(`/redemptions/${encode(redemptionId)}/rollback`, payload, queryParams);
575
601
  }
602
+ /**
603
+ * @see https://docs.voucherify.io/reference/rollback-stackable-redemptions
604
+ * Types of params and queryParams WILL be changed in future - please do not depend on it!
605
+ */
606
+
607
+
608
+ rollbackStackable(parentRedemptionId, params, queryParams) {
609
+ return this.client.post(`/redemptions/${encode(parentRedemptionId)}/rollbacks`, params, queryParams);
610
+ }
576
611
 
577
612
  }
578
613
 
@@ -652,8 +687,8 @@
652
687
  */
653
688
 
654
689
 
655
- validate(params) {
656
- return this.client.post('/promotions/validation', params);
690
+ validate(body, params) {
691
+ return this.client.post('/promotions/validation', body, params);
657
692
  }
658
693
 
659
694
  }
@@ -753,6 +788,14 @@
753
788
  updateConsents(idOrSourceId, consents) {
754
789
  return this.client.put(`/customers/${encode(idOrSourceId)}/consents`, consents);
755
790
  }
791
+ /**
792
+ * @see https://docs.voucherify.io/reference/get-customer-activities
793
+ */
794
+
795
+
796
+ listActivities(customerId, params) {
797
+ return this.client.get(`/customers/${encode(customerId)}/activities`, params);
798
+ }
756
799
 
757
800
  }
758
801
 
@@ -1296,7 +1339,7 @@
1296
1339
  let headers = {
1297
1340
  'X-App-Id': options.applicationId,
1298
1341
  'X-App-Token': options.secretKey,
1299
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.1"}`,
1342
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.4"}`,
1300
1343
  'Content-Type': 'application/json'
1301
1344
  };
1302
1345
 
@@ -1511,6 +1554,22 @@
1511
1554
  updateConsents(idOrSourceId, consents) {
1512
1555
  return this.client.put(`/customers/${encode(idOrSourceId)}/consents`, consents);
1513
1556
  }
1557
+ /**
1558
+ * @see https://docs.voucherify.io/reference/validate-stackable-discounts-client-side
1559
+ */
1560
+
1561
+
1562
+ validateStackable(params) {
1563
+ return this.client.post(`/validations`, params);
1564
+ }
1565
+ /**
1566
+ * @see https://docs.voucherify.io/reference/redeem-stackable-discounts-client-side
1567
+ */
1568
+
1569
+
1570
+ redeemStackable(params) {
1571
+ return this.client.post(`/redemptions`, params);
1572
+ }
1514
1573
 
1515
1574
  }
1516
1575
 
@@ -1525,7 +1584,7 @@
1525
1584
  let headers = {
1526
1585
  'X-Client-Application-Id': options.clientApplicationId,
1527
1586
  'X-Client-Token': options.clientSecretKey,
1528
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.1"}`
1587
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.4"}`
1529
1588
  };
1530
1589
 
1531
1590
  if (environment().startsWith('Node')) {