@infrab4a/connect 1.0.0-beta.0 → 1.0.0-beta.1

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.
@@ -797,6 +797,20 @@
797
797
  return Base;
798
798
  }());
799
799
 
800
+ exports.DiscountType = void 0;
801
+ (function (DiscountType) {
802
+ DiscountType[DiscountType["ABSOLUTE"] = 1] = "ABSOLUTE";
803
+ DiscountType[DiscountType["PERCENTAGE"] = 2] = "PERCENTAGE";
804
+ DiscountType[DiscountType["FREE_SHIPPING"] = 3] = "FREE_SHIPPING";
805
+ })(exports.DiscountType || (exports.DiscountType = {}));
806
+
807
+ exports.Exclusivities = void 0;
808
+ (function (Exclusivities) {
809
+ Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
810
+ Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
811
+ Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
812
+ })(exports.Exclusivities || (exports.Exclusivities = {}));
813
+
800
814
  var Coupon = /** @class */ (function (_super) {
801
815
  __extends(Coupon, _super);
802
816
  function Coupon() {
@@ -812,6 +826,14 @@
812
826
  Coupon.prototype.identifierFields = function () {
813
827
  return ['id'];
814
828
  };
829
+ Coupon.prototype.calculeDiscount = function (amount) {
830
+ switch (this.discountType) {
831
+ case exports.DiscountType.ABSOLUTE:
832
+ return this.discount < amount ? this.discount : amount;
833
+ case exports.DiscountType.PERCENTAGE:
834
+ return this.discount * 0.01 * amount;
835
+ }
836
+ };
815
837
  return Coupon;
816
838
  }(BaseModel));
817
839
  __decorate([
@@ -1136,20 +1158,6 @@
1136
1158
  return Variant;
1137
1159
  }(BaseModel));
1138
1160
 
1139
- exports.DiscountType = void 0;
1140
- (function (DiscountType) {
1141
- DiscountType[DiscountType["ABSOLUTE"] = 1] = "ABSOLUTE";
1142
- DiscountType[DiscountType["PERCENTAGE"] = 2] = "PERCENTAGE";
1143
- DiscountType[DiscountType["FREE_SHIPPING"] = 3] = "FREE_SHIPPING";
1144
- })(exports.DiscountType || (exports.DiscountType = {}));
1145
-
1146
- exports.Exclusivities = void 0;
1147
- (function (Exclusivities) {
1148
- Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
1149
- Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
1150
- Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
1151
- })(exports.Exclusivities || (exports.Exclusivities = {}));
1152
-
1153
1161
  exports.CheckoutTypes = void 0;
1154
1162
  (function (CheckoutTypes) {
1155
1163
  CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";