feat(subscription): include amount_rials in subscription payment mutation

This commit is contained in:
hamed
2026-06-15 13:02:06 +03:30
parent 3763c83471
commit 5fd45b429e
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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('خطا در دریافت لینک پرداخت');
},
+4 -4
View File
@@ -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