added payment setting page and quota
This commit is contained in:
1 parent
2effb45d01
commit
03779995ba
20 files changed
+824
-113
No files matched your search
@@ -7,6 +7,7 @@ import {
|
||||
type IntlPaymentListParams,
|
||||
type IntlPaymentCreatePayload,
|
||||
type IntlPaymentUpdatePayload,
|
||||
type PayPayload,
|
||||
} from "../api/visaMasterPaymentsApi";
|
||||
|
||||
export const INTL_PAYMENT_KEYS = {
|
||||
@@ -72,3 +73,24 @@ export function useDeleteIntlPayment() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useQuoteIntlPayment(id: string) {
|
||||
return useQuery({
|
||||
queryKey: [...INTL_PAYMENT_KEYS.detail(id), "quote"] as const,
|
||||
queryFn: () => intlPaymentApi.quote(id),
|
||||
enabled: !!id,
|
||||
staleTime: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function usePayIntlPayment() {
|
||||
const qc = useQueryClient();
|
||||
const { t } = useTranslation();
|
||||
return useMutation({
|
||||
mutationFn: ({ id, payload }: { id: string; payload: PayPayload }) => intlPaymentApi.pay(id, payload),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.lists() });
|
||||
toast.success(t("intlPayment.paySuccess", "Töleg üstünlikli amala aşyryldy"));
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user