Skip to content

Commit 878fb89

Browse files
committed
feat(tiered_pricing): 🔵 extract first price step logic
1 parent 7d3e387 commit 878fb89

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
export default class GraduatedTieredPricing {
22
priceFor(subscriptions: number): number {
3-
if (subscriptions === 1) {
4-
return 299;
3+
const step1Price = 299;
4+
const step2Price = 239;
5+
6+
if (subscriptions <= 2) {
7+
return subscriptions * step1Price;
58
}
6-
if (subscriptions === 2) {
7-
return 598;
9+
if (subscriptions <= 5) {
10+
return 2 * step1Price + (subscriptions - 2) * step2Price;
811
}
9-
if (subscriptions === 3) {
10-
return 837;
11-
}
12-
return 0;
12+
throw new Error("Not implemented yet");
1313
}
1414
}

0 commit comments

Comments
 (0)