diff --git a/components/appointment/paying/index.js b/components/appointment/paying/index.js index 8453e1e..b7173f4 100644 --- a/components/appointment/paying/index.js +++ b/components/appointment/paying/index.js @@ -11,7 +11,7 @@ function Paying({ setStep, appointmentId }) { const banks = [ { id: "mellat", title: "بانک ملت" }, - { id: "saman", title: "سامان کیش" } + { id: "sep", title: "سامان (سپ)" } ]; useEffect(() => { @@ -44,17 +44,16 @@ function Paying({ setStep, appointmentId }) { setLoading(true); try { const paymentPayload = { - payment_method: selectedBank, - bundle: "appointment", - entity_reference_id: appointmentId + appointment_uuid: appointmentId, + gateway: selectedBank, + frontend_address: `${window.location.origin}/payment/result`, }; - const response = await request.postPayment(paymentPayload); + const res = await request.postAppointmentPayment(paymentPayload); - // Redirect to payment gateway - if (response?.uuid) { - const paymentUrl = `${process.env.NEXT_PUBLIC_API_URL}/payment/${response.uuid}`; - window.location.href = paymentUrl; + const redirectUrl = res?.data?.redirect_url; + if (redirectUrl) { + window.location.href = redirectUrl; } else { setStep((prev) => prev + 1); } @@ -114,10 +113,7 @@ function Paying({ setStep, appointmentId }) { -
-

- مبلغ قابل پرداخت : 10،000 تومان -

+