Merged in fix/refactor-currency-display (pull request #3434)

fix(SW-3616): Handle EuroBonus point type everywhere

* Add tests to formatPrice

* formatPrice

* More work replacing config with api points type

* More work replacing config with api points type

* More fixing with currency

* maybe actually fixed it

* Fix MyStay

* Clean up

* Fix comments

* Merge branch 'master' into fix/refactor-currency-display

* Fix calculateTotalPrice for EB points + SF points + cash


Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2026-01-15 09:32:17 +00:00
parent c61ddaf94d
commit 16fbdb7ae0
59 changed files with 729 additions and 282 deletions

View File

@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { PointType } from "@scandic-hotels/common/constants/pointType"
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
import {
@@ -998,16 +999,24 @@ describe("getRedemptionPrice", () => {
const result = getRedemptionPrice([], 1)
expect(result).toEqual({
local: { price: 0, currency: CurrencyEnum.POINTS },
local: {
price: 0,
currency: CurrencyEnum.POINTS,
pointsType: PointType.SCANDIC,
},
requested: undefined,
})
})
it("returns price 0 and set currency when rooms are empty", () => {
const result = getRedemptionPrice([], 1, CurrencyEnum.EUROBONUS)
const result = getRedemptionPrice([], 1)
expect(result).toEqual({
local: { price: 0, currency: CurrencyEnum.EUROBONUS },
local: {
price: 0,
currency: CurrencyEnum.POINTS,
pointsType: PointType.SCANDIC,
},
requested: undefined,
})
})
@@ -1026,6 +1035,7 @@ describe("getRedemptionPrice", () => {
pointsPerStay: 100,
currency: CurrencyEnum.POINTS,
additionalPricePerStay: 0,
pointsType: PointType.SCANDIC,
},
},
},
@@ -1040,6 +1050,7 @@ describe("getRedemptionPrice", () => {
currency: CurrencyEnum.POINTS,
additionalPrice: 0,
additionalPriceCurrency: CurrencyEnum.POINTS,
pointsType: PointType.SCANDIC,
},
requested: undefined,
})
@@ -1059,6 +1070,7 @@ describe("getRedemptionPrice", () => {
pointsPerStay: 100,
currency: CurrencyEnum.POINTS,
additionalPricePerStay: 0,
pointsType: PointType.SCANDIC,
},
},
},
@@ -1073,6 +1085,7 @@ describe("getRedemptionPrice", () => {
currency: CurrencyEnum.POINTS,
additionalPrice: 0,
additionalPriceCurrency: CurrencyEnum.POINTS,
pointsType: PointType.SCANDIC,
},
requested: undefined,
})
@@ -1092,6 +1105,7 @@ describe("getRedemptionPrice", () => {
pointsPerStay: 100,
currency: CurrencyEnum.POINTS,
additionalPricePerStay: 0,
pointsType: PointType.SCANDIC,
},
},
},
@@ -1106,6 +1120,7 @@ describe("getRedemptionPrice", () => {
pointsPerStay: 150,
currency: CurrencyEnum.POINTS,
additionalPricePerStay: 0,
pointsType: PointType.SCANDIC,
},
},
},
@@ -1120,6 +1135,7 @@ describe("getRedemptionPrice", () => {
currency: CurrencyEnum.POINTS,
additionalPrice: 0,
additionalPriceCurrency: CurrencyEnum.POINTS,
pointsType: PointType.SCANDIC,
},
requested: undefined,
})
@@ -1144,6 +1160,7 @@ describe("getRedemptionPrice", () => {
pointsPerStay: 100,
currency: CurrencyEnum.POINTS,
additionalPricePerStay: 0,
pointsType: PointType.SCANDIC,
},
},
},
@@ -1158,6 +1175,7 @@ describe("getRedemptionPrice", () => {
currency: CurrencyEnum.POINTS,
additionalPrice: 33,
additionalPriceCurrency: CurrencyEnum.POINTS,
pointsType: PointType.SCANDIC,
},
requested: undefined,
})
@@ -1818,6 +1836,7 @@ describe("getTotalPrice", () => {
pointsPerStay: 100,
currency: CurrencyEnum.POINTS,
additionalPricePerStay: 0,
pointsType: PointType.SCANDIC,
},
},
},
@@ -1856,6 +1875,7 @@ describe("getTotalPrice", () => {
currency: CurrencyEnum.POINTS,
additionalPrice: 0,
additionalPriceCurrency: CurrencyEnum.POINTS,
pointsType: PointType.SCANDIC,
},
requested: undefined,
})