import{a as e}from"./chunk-BNv3lrIs.js";import{n as t,t as n}from"./jsx-runtime-pmtNMKr4.js";import{t as r}from"./openPay-4KSuxreV.js";var i=e(t(),1),a=n();function o(){let[e,t]=(0,i.useState)({customer_id:`aswrjptj8ih4othmcthl`,customer_name:`John Doe`,customer_email:`john.doe@example.com`,amount:12.5,description:`Transferencia entre cuentas`,order_id:`oid-1245678`}),[n,o]=(0,i.useState)(!1),[s,c]=(0,i.useState)(null),l=n=>{let{name:r,value:i}=n.target;t({...e,[r]:i})};return(0,a.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),o(!0),c(null);try{let t=await r({method:`bank_account`,amount:e.amount,description:e.description,order_id:e.order_id,customer:{id:e.customer_id,name:e.customer_name,email:e.customer_email}});console.log(`Transferencia realizada con éxito:`,t)}catch(e){console.error(`Error al realizar la transferencia:`,e),c(`Hubo un error al realizar la transferencia.`)}finally{o(!1)}},children:[(0,a.jsx)(`input`,{type:`number`,name:`amount`,placeholder:`Monto`,value:e.amount,onChange:l}),(0,a.jsx)(`input`,{type:`text`,name:`description`,placeholder:`Descripción`,value:e.description,onChange:l}),(0,a.jsx)(`input`,{type:`text`,name:`customer_name`,placeholder:`Nombre del Cliente`,value:e.customer_name,onChange:l}),(0,a.jsx)(`input`,{type:`email`,name:`customer_email`,placeholder:`Email del Cliente`,value:e.customer_email,onChange:l}),s&&(0,a.jsx)(`p`,{style:{color:`red`},children:s}),(0,a.jsx)(`button`,{type:`submit`,disabled:n,children:n?`Procesando...`:`Realizar transferencia`})]})}export{o as default};