Merged in fix/SW-2899 (pull request #2433)
fix (SW-2899): correct VAT calculations * fix (SW-2899): correct VAT calculations * refactor: add calculateVat util Approved-by: Christian Andolf
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { calculateVat } from "@/components/HotelReservation/utils"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import styles from "./specification.module.css"
|
||||
@@ -51,9 +52,10 @@ export default async function Specification({
|
||||
(p) => p.code === RoomPackageCodeEnum.PET_ROOM
|
||||
)
|
||||
|
||||
const roomPriceExclVat =
|
||||
booking.roomPrice - (booking.roomPrice * booking.vatPercentage) / 100
|
||||
const roomPriceVat = booking.roomPrice - roomPriceExclVat
|
||||
const { vatAmount, priceExclVat } = calculateVat(
|
||||
booking.roomPrice,
|
||||
booking.vatPercentage
|
||||
)
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
@@ -121,7 +123,7 @@ export default async function Specification({
|
||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||
<dd className={styles.tertiary}>
|
||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||
{`${roomPriceExclVat.toFixed(2)} ${currency}`}
|
||||
{`${priceExclVat.toFixed(2)} ${currency}`}
|
||||
</dd>
|
||||
</Typography>
|
||||
|
||||
@@ -137,7 +139,7 @@ export default async function Specification({
|
||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||
<dd className={styles.tertiary}>
|
||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||
{`${roomPriceVat.toFixed(2)} ${currency}`}
|
||||
{`${vatAmount.toFixed(2)} ${currency}`}
|
||||
</dd>
|
||||
</Typography>
|
||||
</dl>
|
||||
|
||||
Reference in New Issue
Block a user