fix: currency for event types (#10792)

Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com>
pull/10810/head^2
alannnc 2023-08-16 14:58:28 -07:00 committed by GitHub
parent f0dcfc83c8
commit 053da1ec32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View File

@ -93,7 +93,7 @@ const querySchema = z.object({
}); });
export default function Success(props: SuccessProps) { export default function Success(props: SuccessProps) {
const { t } = useLocale(); const { t, i18n } = useLocale();
const router = useRouter(); const router = useRouter();
const routerQuery = useRouterQuery(); const routerQuery = useRouterQuery();
const pathname = usePathname(); const pathname = usePathname();
@ -478,6 +478,21 @@ export default function Success(props: SuccessProps) {
</div> </div>
</> </>
)} )}
{props.paymentStatus && (
<>
<div className="mt-3 font-medium">
{props.paymentStatus.paymentOption === "HOLD"
? t("complete_your_booking")
: t("payment")}
</div>
<div className="col-span-2 mb-2 mt-3">
{new Intl.NumberFormat(i18n.language, {
style: "currency",
currency: props.paymentStatus.currency,
}).format(props.paymentStatus.amount / 100.0)}
</div>
</>
)}
{bookingInfo?.description && ( {bookingInfo?.description && (
<> <>
<div className="mt-9 font-medium">{t("additional_notes")}</div> <div className="mt-9 font-medium">{t("additional_notes")}</div>
@ -1115,6 +1130,9 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
select: { select: {
success: true, success: true,
refunded: true, refunded: true,
currency: true,
amount: true,
paymentOption: true,
}, },
}); });

View File

@ -18,12 +18,14 @@ export const getEventTypeAppData = <T extends EventTypeAppsList>(
return allowDataGet return allowDataGet
? { ? {
...appMetadata, ...appMetadata,
// We should favor eventType's price and currency over appMetadata's price and currency
price: eventType.price || appMetadata.price,
currency: eventType.currency || appMetadata.currency,
// trackingId is legacy way to store value for TRACKING_ID. So, we need to support both. // trackingId is legacy way to store value for TRACKING_ID. So, we need to support both.
TRACKING_ID: appMetadata.TRACKING_ID || appMetadata.trackingId, TRACKING_ID: appMetadata.TRACKING_ID || appMetadata.trackingId,
} }
: null; : null;
} }
// Backward compatibility for existing event types. // Backward compatibility for existing event types.
// TODO: After the new AppStore EventType App flow is stable, write a migration to migrate metadata to new format which will let us remove this compatibility code // TODO: After the new AppStore EventType App flow is stable, write a migration to migrate metadata to new format which will let us remove this compatibility code
// Migration isn't being done right now, to allow a revert if needed // Migration isn't being done right now, to allow a revert if needed

View File

@ -227,7 +227,7 @@ export default async function getEventTypeById({
app: { app: {
enabled: true, enabled: true,
categories: { categories: {
hasSome: [AppCategories.conferencing, AppCategories.video], hasSome: [AppCategories.conferencing, AppCategories.video, AppCategories.payment],
}, },
}, },
}, },