added bank payment api

This commit is contained in:
Jelaletdin12
2026-09-21 16:23:15 +05:00
parent 03779995ba
commit 18e7c03e76
3 changed files with 18 additions and 3 deletions

View File

@@ -88,9 +88,15 @@ export function usePayIntlPayment() {
const { t } = useTranslation();
return useMutation({
mutationFn: ({ id, payload }: { id: string; payload: PayPayload }) => intlPaymentApi.pay(id, payload),
onSuccess: () => {
onSuccess: (data) => {
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.lists() });
toast.success(t("intlPayment.paySuccess", "Töleg üstünlikli amala aşyryldy"));
if (data?.formUrl) {
const newWindow = window.open(data.formUrl, "_blank");
if (!newWindow || newWindow.closed || typeof newWindow.closed === "undefined") {
window.location.href = data.formUrl;
}
}
},
});
}