import { Form, Radio, Space } from "antd"; import { Group } from "antd/es/radio"; import ArabicPrice from "components/ArabicPrice"; import DifferentCardIcon from "components/Icons/paymentMethods/DifferentCardIcon"; import ProText from "components/ProText"; import { selectCart, selectGrandTotal, updatePaymentMethod, } from "features/order/orderSlice"; import { useTranslation } from "react-i18next"; import { useAppDispatch, useAppSelector } from "redux/hooks"; import { colors, ProGray1 } from "../../ThemeConstants"; import ProInputCard from "../ProInputCard/ProInputCard"; import styles from "./PaymentMethods.module.css"; import { OrderType } from "pages/checkout/hooks/types.ts"; const PaymentMethods = () => { const { t } = useTranslation(); const { paymentMethod, orderType } = useAppSelector(selectCart); const dispatch = useAppDispatch(); const grandTotal = useAppSelector(selectGrandTotal); const options: { label: string; value: string; price?: string; icon?: React.ReactNode; style?: React.CSSProperties; hideCurrency?: boolean; }[] = [ ...(orderType !== OrderType.Gift ? [ { label: t("checkout.cash"), value: "cash", price: grandTotal.toString(), style: { color: colors.primary, }, }, ] : []), { label: t("checkout.creditDebitCard"), value: "creditDebitCard", price: t("checkout.expiresIn") + ":12/26", hideCurrency: true, }, { label: t("checkout.differentCard"), value: "differentCard", icon: (
), hideCurrency: true, }, { label: t("checkout.fascanoWallet"), value: "fascanoWallet", price: "7.50", style: { color: colors.primary, }, }, ]; const onPaymentSelect = (value: string) => { dispatch(updatePaymentMethod(value)); }; return ( {options.map((option) => (
onPaymentSelect(option.value)} style={{ height: 50, borderRadius: 888, border: "1px solid #DDD", padding: 16, }} >
{option.label} {!option.icon ? ( ) : ( <>{option.icon} )}
))}
); }; export default PaymentMethods;