"use client"; import { useState } from 'react' import PageTitle from '@/components/ui/PageTitle'; import { Typography, Button, Input, Form, Select, Switch } from 'antd' import Link from 'next/link'; import { BankFilled, WalletFilled } from '@ant-design/icons'; import type { PaymentType } from '@/types/payment'; import { useQuery } from '@tanstack/react-query'; import { getPaymentType } from '@/app/api/general/paymentService'; const { Text, Title } = Typography; const iconMapper = { "card": , "bank": }; const CreatePersona: React.FC = () => { const [selectedPaymentID, setSelectedPaymentID] = useState() const [companyName, setCompanyName] = useState("") const [cardNumber, setCardNumber] = useState("") const [cvc, setCvc] = useState("") const { data: paymentType, error, isLoading } = useQuery({ queryKey: ["getPaymentType"], queryFn: () => getPaymentType() }); if (isLoading) { return Loading...; } return ( Enter your payment details By continuing you agree to our Terms {paymentType?.map(({ id, type, description, icon_id }) => ( setSelectedPaymentID(id)} > {iconMapper[icon_id]} {`Transfer via card number`} ))} Company Name}> setCompanyName(e.target.value)} /> Card Number}> { const rawValue = e.target.value.replace(/\D/g, '').slice(0, 16); const formattedValue = rawValue.replace(/(.{4})/g, '$1 ').trim(); setCardNumber(formattedValue); }} /> Exp Month} className="w-full"> { const month = String(i + 1).padStart(2, '0'); return { label: month, value: month }; }) } /> Exp Year} className="w-full"> { const year = new Date().getFullYear() + i; return { label: String(year), value: String(year) }; }) } /> CVC}> { const rawValue = e.target.value.replace(/\D/g, '').slice(0, 4); setCvc(rawValue); }} /> 3 or 4 digits usually found on the signature strips { }} /> SET AS DEFAULT CONFIRM ) } export default CreatePersona;
Loading...
Enter your payment details
By continuing you agree to our Terms
{`Transfer via card number`}
3 or 4 digits usually found on the signature strips