import InputError from '@/components/input-error'; import LoadingButton from '@/components/loading-button'; import Switch from '@/components/switch'; import { Card } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import stripeCurrencies from '@/data/currencies/stripe'; import { onHandleChange } from '@/lib/inertia'; import { SharedData } from '@/types/global'; import { useForm, usePage } from '@inertiajs/react'; interface StripeProps { payment: Settings; } const Stripe = ({ payment }: StripeProps) => { const { props } = usePage(); const { translate } = props; const { settings, input, button, common } = translate; const { data, setData, post, errors, processing } = useForm({ ...(payment.fields as StripeFields), type: 'stripe', }); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); post(route('settings.payment.update', { id: payment.id })); }; return (

{settings.stripe_settings}

{settings.configure_payment_gateway.replace(':gateway', 'Stripe')}

setData('active', checked)} />
{settings.test_mode}: setData('test_mode', checked)} />
{/* Test Mode Credentials Section */}

{settings.test_credentials}

onHandleChange(e, setData)} placeholder={input.test_public_key_placeholder} />
onHandleChange(e, setData)} placeholder={input.test_secret_key_placeholder} disabled={!data.test_mode} type="password" />
{/* Live Mode Credentials Section */}

{settings.live_credentials}

onHandleChange(e, setData)} placeholder={input.live_public_key_placeholder} disabled={data.test_mode} />
onHandleChange(e, setData)} placeholder={input.live_secret_key_placeholder} disabled={data.test_mode} type="password" />
{button.save_changes}
); }; export default Stripe;