diff --git a/assets/admin/pages/SmsWalletPage.tsx b/assets/admin/pages/SmsWalletPage.tsx index 0996f6dd..6b4ae0f9 100644 --- a/assets/admin/pages/SmsWalletPage.tsx +++ b/assets/admin/pages/SmsWalletPage.tsx @@ -59,7 +59,7 @@ function SmsWalletPageInner() { mutationFn: ({ amount_rials }: ChargeForm) => api.post<{ data: { payment_url: string } }>('/api/v1/sms/wallet/charge', { gateway, amount_rials }), onSuccess: (res: any) => { - const url = res?.data?.payment_url; + const url = res?.data?.redirect_url ?? res?.data?.payment_url; if (url) window.location.href = url; else toast.error('خطا در دریافت لینک پرداخت'); }, diff --git a/assets/admin/pages/SubscriptionPage.tsx b/assets/admin/pages/SubscriptionPage.tsx index bc24007b..dd333248 100644 --- a/assets/admin/pages/SubscriptionPage.tsx +++ b/assets/admin/pages/SubscriptionPage.tsx @@ -78,10 +78,10 @@ export default function SubscriptionPage() { }); const purchaseMutation = useMutation({ - mutationFn: ({ period_uuid, gateway }: { period_uuid: string; gateway: string }) => - api.post<{ data: { payment_url: string } }>('/api/v1/subscription-payment', { period_uuid, gateway }), + mutationFn: ({ period_uuid, gateway, amount_rials }: { period_uuid: string; gateway: string; amount_rials: number }) => + api.post<{ data: { payment_url: string } }>('/api/v1/subscription-payment', { period_uuid, gateway, amount_rials }), onSuccess: (res: any) => { - const url = res?.data?.payment_url; + const url = res?.data?.redirect_url ?? res?.data?.payment_url; if (url) window.location.href = url; else toast.error('خطا در دریافت لینک پرداخت'); }, @@ -352,7 +352,7 @@ export default function SubscriptionPage() { style={{ flex: 1, height: 44 }} disabled={purchaseMutation.isPending} onClick={() => - purchaseMutation.mutate({ period_uuid: purchaseTarget.period.uuid, gateway: selectedGateway }) + purchaseMutation.mutate({ period_uuid: purchaseTarget.period.uuid, gateway: selectedGateway, amount_rials: purchaseTarget.period.price_rials }) } > {purchaseMutation.isPending