@nimee/calculations 1.0.10 → 1.0.12
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/dist/prices.d.ts +1 -0
- package/dist/prices.js +10 -8
- package/dist/prices.js.map +1 -1
- package/package.json +1 -1
- package/src/prices.ts +7 -6
- package/tests/prices.test.ts +24 -5
package/dist/prices.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IAccountModel, IEventModel } from "@nimee/shared-types";
|
|
2
2
|
export declare const paymeFee: number;
|
|
3
|
+
export declare const roundToTwoDecimals: (num: number) => number;
|
|
3
4
|
export declare const calculateFinalPriceWithNimiFee: (totalPriceWithoutCouponDiscount: number, event: IEventModel, account: IAccountModel, totalPriceWithCouponDiscount: number) => {
|
|
4
5
|
nimiFeePercentage: number;
|
|
5
6
|
nimiFee: number;
|
package/dist/prices.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.calculateFinalPriceWithEndUserSeasonTicket = exports.calculateFinalPriceWithCouponDiscount = exports.calculateFinalPriceWithNimiFee = exports.paymeFee = void 0;
|
|
6
|
+
exports.calculateFinalPriceWithEndUserSeasonTicket = exports.calculateFinalPriceWithCouponDiscount = exports.calculateFinalPriceWithNimiFee = exports.roundToTwoDecimals = exports.paymeFee = void 0;
|
|
7
7
|
/* Central the prices logic so we won't repeat it */
|
|
8
8
|
const shared_types_1 = require("@nimee/shared-types");
|
|
9
9
|
const logger_1 = __importDefault(require("@nimee/logger"));
|
|
@@ -14,15 +14,16 @@ exports.paymeFee = 1.1 * 1.17;
|
|
|
14
14
|
// then we return the coupon discount and the final price with nimi fee
|
|
15
15
|
// then we calculate the nimi fee percentage from the final price after discount with nimi fee
|
|
16
16
|
const roundToTwoDecimals = (num) => Math.round(num * 100) / 100;
|
|
17
|
+
exports.roundToTwoDecimals = roundToTwoDecimals;
|
|
17
18
|
const calculateFinalPriceWithNimiFee = (totalPriceWithoutCouponDiscount, event, account, totalPriceWithCouponDiscount) => {
|
|
18
19
|
switch (event.feeCollectionType) {
|
|
19
20
|
case shared_types_1.IFeeCollectionType.PERCENTAGE_FROM_TICKET:
|
|
20
21
|
const marketplaceFeeOfPERCENTAGE_FROM_TICKET = (totalPriceWithCouponDiscount * (account.originalMarketFee - exports.paymeFee - account.marketFee)) / 100;
|
|
21
22
|
return {
|
|
22
|
-
finalPriceWithNimiFee: totalPriceWithCouponDiscount,
|
|
23
|
+
finalPriceWithNimiFee: (0, exports.roundToTwoDecimals)(totalPriceWithCouponDiscount),
|
|
23
24
|
nimiFee: 0,
|
|
24
25
|
nimiFeePercentage: account.marketFee,
|
|
25
|
-
marketplaceFee: roundToTwoDecimals(marketplaceFeeOfPERCENTAGE_FROM_TICKET),
|
|
26
|
+
marketplaceFee: (0, exports.roundToTwoDecimals)(marketplaceFeeOfPERCENTAGE_FROM_TICKET), // todo if the fee is less than 0, it means that the account belongs to the marketplace and the fee is 0 - so let return 0 if negative
|
|
26
27
|
}; // we use here marketFee (and not originalMarketFee) because we need to send the fee to payme without their fee
|
|
27
28
|
case shared_types_1.IFeeCollectionType.ON_TOP_OF_TICKET:
|
|
28
29
|
// check if the totalPrice with coupon discount is 0 then we return 0 for the fee and the percentage
|
|
@@ -30,14 +31,15 @@ const calculateFinalPriceWithNimiFee = (totalPriceWithoutCouponDiscount, event,
|
|
|
30
31
|
return { finalPriceWithNimiFee: 0, nimiFee: 0, nimiFeePercentage: 0, marketplaceFee: 0 };
|
|
31
32
|
}
|
|
32
33
|
// minimum 3 so we use max we totalPriceWithoutCouponDiscount because the fee is calculated on top of the original price and not the price after discount
|
|
33
|
-
const unroundedFee = Math.max(
|
|
34
|
-
let roundedFee = roundToTwoDecimals(unroundedFee);
|
|
34
|
+
const unroundedFee = Math.max(4, (totalPriceWithCouponDiscount * account.originalMarketFee) / 100); // here we use originalMarketFee because we need to calculate the fee on top of the original price (later we will subtract payme fee from the fee we send to payme)
|
|
35
|
+
let roundedFee = (0, exports.roundToTwoDecimals)(unroundedFee);
|
|
35
36
|
// nimiFeePercentage has unknown range that need to be aware of - we get error when we send to payme with range above 60 so we use max
|
|
36
37
|
// const nimiFeePercentage = Math.min(59, (roundedFee / totalPriceWithCouponDiscount) * 100); // we use here totalPriceWithCouponDiscount because we send payme the price after the discount plus the nimiFee (roundedFee) so we need to know the percentage of the fee from the final price
|
|
37
38
|
// we need to make sure we send marketFee that is greater or equal to 0 so we use max and we must subtract payme fee from nimiFeePercentage because payme ask to send them the fee without their fee
|
|
38
39
|
// const nimiFeePercentageMinusPaymeFee = Math.max(0, nimiFeePercentage - 1.1 * 1.17);
|
|
39
|
-
const totalFee = roundToTwoDecimals(((roundedFee + totalPriceWithCouponDiscount) * (account.marketFee + exports.paymeFee)) / 100);
|
|
40
|
+
const totalFee = (0, exports.roundToTwoDecimals)(((roundedFee + totalPriceWithCouponDiscount) * (account.marketFee + exports.paymeFee)) / 100); // this is the fee that actually will be taken from the order
|
|
40
41
|
if (roundedFee < totalFee) {
|
|
42
|
+
// if the totalFee is greater the seller will lose money so we need to make sure the roundedFee is greater than the totalFee - this can no longer happens becuase of the client restrictions when adding originalFee when creating a seller
|
|
41
43
|
logger_1.default.debug(`roundedFee is less than totalFee roundedFee: ${roundedFee} and totalFee: ${totalFee} for event: ${event._id}`);
|
|
42
44
|
roundedFee = totalFee;
|
|
43
45
|
}
|
|
@@ -58,10 +60,10 @@ const calculateFinalPriceWithNimiFee = (totalPriceWithoutCouponDiscount, event,
|
|
|
58
60
|
// );
|
|
59
61
|
// }
|
|
60
62
|
return {
|
|
61
|
-
finalPriceWithNimiFee: roundedFee + totalPriceWithCouponDiscount,
|
|
63
|
+
finalPriceWithNimiFee: (0, exports.roundToTwoDecimals)(roundedFee + totalPriceWithCouponDiscount),
|
|
62
64
|
nimiFee: roundedFee,
|
|
63
65
|
nimiFeePercentage: account.marketFee,
|
|
64
|
-
marketplaceFee: roundToTwoDecimals(marketplaceFeeOfON_TOP_OF_TICKET),
|
|
66
|
+
marketplaceFee: (0, exports.roundToTwoDecimals)(marketplaceFeeOfON_TOP_OF_TICKET),
|
|
65
67
|
};
|
|
66
68
|
default:
|
|
67
69
|
throw new error_handler_1.CustomError("fee_collection_type_not_supported", 400, `fee collection type not supported - ${event.feeCollectionType}`);
|
package/dist/prices.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prices.js","sourceRoot":"","sources":["../src/prices.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAoD;AACpD,sDAAsG;AACtG,2DAAmC;AACnC,wDAAmD;AACtC,QAAA,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC;AAEnC,qGAAqG;AACrG,wFAAwF;AACxF,uEAAuE;AACvE,8FAA8F;
|
|
1
|
+
{"version":3,"file":"prices.js","sourceRoot":"","sources":["../src/prices.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAoD;AACpD,sDAAsG;AACtG,2DAAmC;AACnC,wDAAmD;AACtC,QAAA,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC;AAEnC,qGAAqG;AACrG,wFAAwF;AACxF,uEAAuE;AACvE,8FAA8F;AACvF,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAAlE,QAAA,kBAAkB,sBAAgD;AAExE,MAAM,8BAA8B,GAAG,CAC5C,+BAAuC,EACvC,KAAkB,EAClB,OAAsB,EACtB,4BAAoC,EACmE,EAAE;IACzG,QAAQ,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAChC,KAAK,iCAAkB,CAAC,sBAAsB;YAC5C,MAAM,sCAAsC,GAC1C,CAAC,4BAA4B,GAAG,CAAC,OAAO,CAA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C1C,mBAAmB;AACnB,MAAM;AAEN,0BAA0B;AAC1B,qHAAqH;AACrH,yCAAyC;AACzC,qBAAqB;AACrB,QAAQ;AACR,MAAM;AAEN,kBAAkB;AAClB,KAAK"}
|
package/package.json
CHANGED
package/src/prices.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const paymeFee = 1.1 * 1.17;
|
|
|
8
8
|
// we need the original price becuase the fee is calculated on top of the original price
|
|
9
9
|
// then we return the coupon discount and the final price with nimi fee
|
|
10
10
|
// then we calculate the nimi fee percentage from the final price after discount with nimi fee
|
|
11
|
-
const roundToTwoDecimals = (num: number) => Math.round(num * 100) / 100;
|
|
11
|
+
export const roundToTwoDecimals = (num: number) => Math.round(num * 100) / 100;
|
|
12
12
|
|
|
13
13
|
export const calculateFinalPriceWithNimiFee = (
|
|
14
14
|
totalPriceWithoutCouponDiscount: number,
|
|
@@ -21,10 +21,10 @@ export const calculateFinalPriceWithNimiFee = (
|
|
|
21
21
|
const marketplaceFeeOfPERCENTAGE_FROM_TICKET =
|
|
22
22
|
(totalPriceWithCouponDiscount * (account.originalMarketFee - paymeFee - account.marketFee)) / 100;
|
|
23
23
|
return {
|
|
24
|
-
finalPriceWithNimiFee: totalPriceWithCouponDiscount,
|
|
24
|
+
finalPriceWithNimiFee: roundToTwoDecimals(totalPriceWithCouponDiscount),
|
|
25
25
|
nimiFee: 0,
|
|
26
26
|
nimiFeePercentage: account.marketFee,
|
|
27
|
-
marketplaceFee: roundToTwoDecimals(marketplaceFeeOfPERCENTAGE_FROM_TICKET),
|
|
27
|
+
marketplaceFee: roundToTwoDecimals(marketplaceFeeOfPERCENTAGE_FROM_TICKET), // todo if the fee is less than 0, it means that the account belongs to the marketplace and the fee is 0 - so let return 0 if negative
|
|
28
28
|
}; // we use here marketFee (and not originalMarketFee) because we need to send the fee to payme without their fee
|
|
29
29
|
case IFeeCollectionType.ON_TOP_OF_TICKET:
|
|
30
30
|
// check if the totalPrice with coupon discount is 0 then we return 0 for the fee and the percentage
|
|
@@ -32,14 +32,15 @@ export const calculateFinalPriceWithNimiFee = (
|
|
|
32
32
|
return { finalPriceWithNimiFee: 0, nimiFee: 0, nimiFeePercentage: 0, marketplaceFee: 0 };
|
|
33
33
|
}
|
|
34
34
|
// minimum 3 so we use max we totalPriceWithoutCouponDiscount because the fee is calculated on top of the original price and not the price after discount
|
|
35
|
-
const unroundedFee = Math.max(
|
|
35
|
+
const unroundedFee = Math.max(4, (totalPriceWithCouponDiscount * account.originalMarketFee) / 100); // here we use originalMarketFee because we need to calculate the fee on top of the original price (later we will subtract payme fee from the fee we send to payme)
|
|
36
36
|
let roundedFee = roundToTwoDecimals(unroundedFee);
|
|
37
37
|
// nimiFeePercentage has unknown range that need to be aware of - we get error when we send to payme with range above 60 so we use max
|
|
38
38
|
// const nimiFeePercentage = Math.min(59, (roundedFee / totalPriceWithCouponDiscount) * 100); // we use here totalPriceWithCouponDiscount because we send payme the price after the discount plus the nimiFee (roundedFee) so we need to know the percentage of the fee from the final price
|
|
39
39
|
// we need to make sure we send marketFee that is greater or equal to 0 so we use max and we must subtract payme fee from nimiFeePercentage because payme ask to send them the fee without their fee
|
|
40
40
|
// const nimiFeePercentageMinusPaymeFee = Math.max(0, nimiFeePercentage - 1.1 * 1.17);
|
|
41
|
-
const totalFee = roundToTwoDecimals(((roundedFee + totalPriceWithCouponDiscount) * (account.marketFee + paymeFee)) / 100);
|
|
41
|
+
const totalFee = roundToTwoDecimals(((roundedFee + totalPriceWithCouponDiscount) * (account.marketFee + paymeFee)) / 100); // this is the fee that actually will be taken from the order
|
|
42
42
|
if (roundedFee < totalFee) {
|
|
43
|
+
// if the totalFee is greater the seller will lose money so we need to make sure the roundedFee is greater than the totalFee - this can no longer happens becuase of the client restrictions when adding originalFee when creating a seller
|
|
43
44
|
logger.debug(
|
|
44
45
|
`roundedFee is less than totalFee roundedFee: ${roundedFee} and totalFee: ${totalFee} for event: ${event._id}`
|
|
45
46
|
);
|
|
@@ -62,7 +63,7 @@ export const calculateFinalPriceWithNimiFee = (
|
|
|
62
63
|
// );
|
|
63
64
|
// }
|
|
64
65
|
return {
|
|
65
|
-
finalPriceWithNimiFee: roundedFee + totalPriceWithCouponDiscount,
|
|
66
|
+
finalPriceWithNimiFee: roundToTwoDecimals(roundedFee + totalPriceWithCouponDiscount),
|
|
66
67
|
nimiFee: roundedFee,
|
|
67
68
|
nimiFeePercentage: account.marketFee,
|
|
68
69
|
marketplaceFee: roundToTwoDecimals(marketplaceFeeOfON_TOP_OF_TICKET),
|
package/tests/prices.test.ts
CHANGED
|
@@ -3,8 +3,27 @@ import {
|
|
|
3
3
|
calculateFinalPriceWithCouponDiscount,
|
|
4
4
|
calculateFinalPriceWithEndUserSeasonTicket,
|
|
5
5
|
paymeFee,
|
|
6
|
+
roundToTwoDecimals,
|
|
6
7
|
} from "../src/prices";
|
|
7
8
|
|
|
9
|
+
describe("roundToTwoDecimals", () => {
|
|
10
|
+
it("should return the number rounded to two decimals max", () => {
|
|
11
|
+
const number = 43.599999999994;
|
|
12
|
+
|
|
13
|
+
const roundedNumber = roundToTwoDecimals(number);
|
|
14
|
+
|
|
15
|
+
expect(roundedNumber).toBe(43.6);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should return the number rounded to two decimals max", () => {
|
|
19
|
+
const number = 43.111111111111;
|
|
20
|
+
|
|
21
|
+
const roundedNumber = roundToTwoDecimals(number);
|
|
22
|
+
|
|
23
|
+
expect(roundedNumber).toBe(43.11);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
8
27
|
describe("calculateFinalPriceWithNimiFee", () => {
|
|
9
28
|
it("when event fee type is PERCENTAGE_FROM_TICKET, should calculate the final price with nimi fee and return the nimi fee percentage and nimi fee and marketplaceFee", () => {
|
|
10
29
|
const totalPriceWithoutCouponDiscount = 100;
|
|
@@ -43,7 +62,7 @@ describe("calculateFinalPriceWithNimiFee", () => {
|
|
|
43
62
|
account as any,
|
|
44
63
|
totalPriceWithCouponDiscount
|
|
45
64
|
);
|
|
46
|
-
const nimiFee =
|
|
65
|
+
const nimiFee = 4;
|
|
47
66
|
const expectedMarketplaceFee = parseFloat(
|
|
48
67
|
(nimiFee - ((totalPriceWithCouponDiscount + nimiFee) * (paymeFee + account.marketFee)) / 100).toFixed(2)
|
|
49
68
|
);
|
|
@@ -52,7 +71,7 @@ describe("calculateFinalPriceWithNimiFee", () => {
|
|
|
52
71
|
expect(result.finalPriceWithNimiFee).toBe(totalPriceWithCouponDiscount + nimiFee);
|
|
53
72
|
expect(result.marketplaceFee).toBe(expectedMarketplaceFee);
|
|
54
73
|
});
|
|
55
|
-
it("when event fee type is ON_TOP_OF_TICKET and the originalMarketFee is float 2, should calculate the final price with nimi fee and return the nimi fee percentage and nimi fee and marketplaceFee", () => {
|
|
74
|
+
it("when event fee type is ON_TOP_OF_TICKET and the originalMarketFee is float 2, should calculate the final price with nimi fee and return the nimi fee percentage and nimi fee calculation was below minimum so it returns the minimum configured and marketplaceFee", () => {
|
|
56
75
|
const totalPriceWithoutCouponDiscount = 100;
|
|
57
76
|
const accountMarketFee = 2;
|
|
58
77
|
const originalMarketFee = 3.158;
|
|
@@ -67,7 +86,7 @@ describe("calculateFinalPriceWithNimiFee", () => {
|
|
|
67
86
|
totalPriceWithCouponDiscount
|
|
68
87
|
);
|
|
69
88
|
|
|
70
|
-
const nimiFee =
|
|
89
|
+
const nimiFee = 4;
|
|
71
90
|
const expectedMarketplaceFee = parseFloat(
|
|
72
91
|
(nimiFee - ((totalPriceWithCouponDiscount + nimiFee) * (paymeFee + account.marketFee)) / 100).toFixed(2)
|
|
73
92
|
);
|
|
@@ -78,7 +97,7 @@ describe("calculateFinalPriceWithNimiFee", () => {
|
|
|
78
97
|
expect(result.marketplaceFee).toBe(expectedMarketplaceFee);
|
|
79
98
|
});
|
|
80
99
|
it("when event fee type is ON_TOP_OF_TICKET and the originalMarketFee is float 2 and result of marketplaceFee is below zero, should calculate the final price with nimi fee and return the nimi fee percentage and nimi fee and marketplaceFee", () => {
|
|
81
|
-
const totalPriceWithoutCouponDiscount =
|
|
100
|
+
const totalPriceWithoutCouponDiscount = 2;
|
|
82
101
|
const accountMarketFee = 1.287;
|
|
83
102
|
const originalMarketFee = 0.287;
|
|
84
103
|
const event = { id: "1", name: "Event 1", feeCollectionType: "on_top_of_ticket" };
|
|
@@ -92,7 +111,7 @@ describe("calculateFinalPriceWithNimiFee", () => {
|
|
|
92
111
|
totalPriceWithCouponDiscount
|
|
93
112
|
);
|
|
94
113
|
|
|
95
|
-
const nimiFee = 5.
|
|
114
|
+
const nimiFee = 5.25;
|
|
96
115
|
expect(result.nimiFeePercentage).toBe(accountMarketFee);
|
|
97
116
|
expect(result.nimiFee).toBe(nimiFee);
|
|
98
117
|
expect(result.finalPriceWithNimiFee).toBe(totalPriceWithCouponDiscount + nimiFee);
|