Skip to content

Commit f5f75c5

Browse files
committed
fix: email required when buying with credit card
1 parent aa7d3db commit f5f75c5

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

web-marketplace/src/components/organisms/PaymentInfoForm/PaymentInfoForm.CustomerInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const CustomerInfo = ({
9595
error={!!errors['email']}
9696
helperText={errors['email']?.message}
9797
disabled={!!accountEmail}
98-
optional={!!wallet?.address}
98+
optional={paymentOption === PAYMENT_OPTIONS.CRYPTO}
9999
/>
100100
{!accountId && !wallet?.address && (
101101
<CheckboxLabel

web-marketplace/src/components/organisms/PaymentInfoForm/PaymentInfoForm.schema.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
import { z } from 'zod';
22

3-
import { Wallet } from 'lib/wallet/wallet';
4-
53
import { PAYMENT_OPTIONS } from 'pages/BuyCredits/BuyCredits.constants';
64
import { PaymentOptionsType } from 'pages/BuyCredits/BuyCredits.types';
75

8-
export const paymentInfoFormSchema = (
9-
paymentOption: PaymentOptionsType,
10-
wallet?: Wallet,
11-
) =>
6+
export const paymentInfoFormSchema = (paymentOption: PaymentOptionsType) =>
127
z.object({
138
name:
149
paymentOption === PAYMENT_OPTIONS.CARD ? z.string().min(1) : z.string(),
1510
email:
16-
paymentOption === PAYMENT_OPTIONS.CARD && !wallet?.address
11+
paymentOption === PAYMENT_OPTIONS.CARD
1712
? z.string().email().min(1)
1813
: z.union([z.literal(''), z.string().email().nullable()]),
1914
createAccount: z.boolean(),

web-marketplace/src/components/organisms/PaymentInfoForm/PaymentInfoForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const PaymentInfoForm = ({
5959
const [paymentInfoValid, setPaymentInfoValid] = useState(false);
6060

6161
const form = useZodForm({
62-
schema: paymentInfoFormSchema(paymentOption, wallet),
62+
schema: paymentInfoFormSchema(paymentOption),
6363
defaultValues: {
6464
email: initialValues?.email || accountEmail,
6565
name: initialValues?.name || accountName,

web-marketplace/src/pages/BuyCredits/BuyCredits.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const BuyCredits = () => {
6161
]);
6262

6363
const [retiring, setRetiring] = useState<boolean>(true);
64+
6465
const [confirmationTokenId, setConfirmationTokenId] = useState<
6566
string | undefined
6667
>();

0 commit comments

Comments
 (0)