Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
fix: stripe selected currency (calcom#11593)
Browse files Browse the repository at this point in the history
  • Loading branch information
alannnc authored Sep 28, 2023
1 parent 68bd877 commit 31bc586
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 0 additions & 2 deletions apps/web/playwright/fixtures/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,6 @@ export async function apiLogin(
export async function setupEventWithPrice(eventType: Pick<Prisma.EventType, "id">, page: Page) {
await page.goto(`/event-types/${eventType?.id}?tabName=apps`);
await page.locator("div > .ml-auto").first().click();
await page.locator(".text-black > .bg-default > div > div:nth-child(2)").first().click();
await page.getByTestId("select-option-usd").click();
await page.getByPlaceholder("Price").fill("100");
await page.getByTestId("update-eventtype").click();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { usePathname } from "next/navigation";
import { useState } from "react";
import { useState, useEffect } from "react";

import { useAppContextWithSchema } from "@calcom/app-store/EventTypeAppContext";
import AppCard from "@calcom/app-store/_components/AppCard";
Expand All @@ -25,8 +25,8 @@ const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({
const currency = getAppData("currency");
const [selectedCurrency, setSelectedCurrency] = useState(
currencyOptions.find((c) => c.value === currency) || {
label: "",
value: "",
label: currencyOptions[0].label,
value: currencyOptions[0].value,
}
);
const paymentOption = getAppData("paymentOption");
Expand All @@ -46,6 +46,16 @@ const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({
})
.replace(/\d/g, "")
.trim();

useEffect(() => {
if (!getAppData("currency")) {
setAppData("currency", currencyOptions[0].value);
}
if (!getAppData("paymentOption")) {
setAppData("paymentOption", paymentOptions[0].value);
}
}, []);

return (
<AppCard
returnTo={WEBAPP_URL + pathname + "?tabName=apps"}
Expand Down

0 comments on commit 31bc586

Please sign in to comment.