turf-common 1.2.1-beta.23 → 1.2.1-beta.24
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.
|
@@ -130,7 +130,7 @@ var BookingCode = /** @class */ (function () {
|
|
|
130
130
|
message: ["Coupon with code ".concat(couponCode, " is wrong ")],
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
if (code
|
|
133
|
+
if (code === "P" || code === "PHP") {
|
|
134
134
|
var percentDiscount = parseFloat(couponCode);
|
|
135
135
|
if (validationApply) {
|
|
136
136
|
if (percentDiscount > 90) {
|
|
@@ -142,10 +142,10 @@ var BookingCode = /** @class */ (function () {
|
|
|
142
142
|
}
|
|
143
143
|
discount = totalCost * (percentDiscount / 100);
|
|
144
144
|
}
|
|
145
|
-
else if (code
|
|
145
|
+
else if (code === "U") {
|
|
146
146
|
discount = parseFloat(couponCode);
|
|
147
147
|
}
|
|
148
|
-
else if (code
|
|
148
|
+
else if (code === "PHU") {
|
|
149
149
|
if (totalBookingHours === undefined) {
|
|
150
150
|
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
151
151
|
key: "totalBookingHours",
|
|
@@ -60,7 +60,7 @@ var ChargesModel = /** @class */ (function () {
|
|
|
60
60
|
message: ["Coupon with code ".concat(couponCode, " is wrong ")],
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
if (code
|
|
63
|
+
if (code === "P" || code === "PHP") {
|
|
64
64
|
var percentDiscount = parseFloat(couponCode);
|
|
65
65
|
if (validationApply && percentDiscount > 90) {
|
|
66
66
|
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
@@ -70,10 +70,10 @@ var ChargesModel = /** @class */ (function () {
|
|
|
70
70
|
}
|
|
71
71
|
discountAmount = totalCost * (percentDiscount / 100);
|
|
72
72
|
}
|
|
73
|
-
else if (code
|
|
73
|
+
else if (code === "U") {
|
|
74
74
|
discountAmount = parseFloat(couponCode);
|
|
75
75
|
}
|
|
76
|
-
else if (code
|
|
76
|
+
else if (code === "PHU") {
|
|
77
77
|
if (totalBookingHours === undefined) {
|
|
78
78
|
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
79
79
|
key: "totalBookingHours",
|
|
@@ -23,8 +23,8 @@ declare class StringUtil {
|
|
|
23
23
|
* @throws {TypeError} - If the provided 'couponCode' is not a string.
|
|
24
24
|
*/
|
|
25
25
|
getCouponDetails(couponCode: string): {
|
|
26
|
-
code:
|
|
27
|
-
value:
|
|
26
|
+
code: string;
|
|
27
|
+
value: string;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
export declare const stringUtil: StringUtil;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stringUtil = void 0;
|
|
4
|
+
var app_badrequest_exception_1 = require("../exceptions/app-badrequest.exception");
|
|
4
5
|
var StringUtil = /** @class */ (function () {
|
|
5
6
|
function StringUtil() {
|
|
6
7
|
}
|
|
@@ -65,9 +66,15 @@ var StringUtil = /** @class */ (function () {
|
|
|
65
66
|
StringUtil.prototype.getCouponDetails = function (couponCode) {
|
|
66
67
|
var code = couponCode.match(/[a-zA-Z]+/g);
|
|
67
68
|
var value = couponCode.match(/\d+/g);
|
|
69
|
+
if (!code || !value) {
|
|
70
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
71
|
+
key: "couponCode",
|
|
72
|
+
message: ["coupon with code ".concat(couponCode, " is wrong ")],
|
|
73
|
+
});
|
|
74
|
+
}
|
|
68
75
|
return {
|
|
69
|
-
code: code,
|
|
70
|
-
value: value,
|
|
76
|
+
code: code[0],
|
|
77
|
+
value: value[0],
|
|
71
78
|
};
|
|
72
79
|
};
|
|
73
80
|
return StringUtil;
|