added bank payment api
This commit is contained in:
@@ -25,6 +25,12 @@ export interface PayPayload {
|
||||
paymentPeriod: string; // "YYYY-MM-DD"
|
||||
}
|
||||
|
||||
export interface PayResponse {
|
||||
paymentId?: number;
|
||||
formUrl?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
/** Kabul ediji + Upgradyý resminamalar (15 sany) — hem UI hem Payload ortak */
|
||||
export interface IntlPaymentDocs {
|
||||
doc_sberbank_account: string | null;
|
||||
@@ -382,7 +388,9 @@ export const intlPaymentApi = {
|
||||
return data;
|
||||
},
|
||||
|
||||
async pay(id: string, payload: PayPayload): Promise<void> {
|
||||
await apiClient.post(`/visa-master-payment-orders/${id}/pay`, payload);
|
||||
async pay(id: string, payload: PayPayload): Promise<PayResponse> {
|
||||
const res = await apiClient.post<any>(`/visa-master-payment-orders/${id}/pay`, payload);
|
||||
const data = res.data?.data ?? res.data;
|
||||
return data as PayResponse;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
||||
--sidebar-border: oklch(0.92 0.004 286.32);
|
||||
--sidebar-ring: oklch(0.705 0.015 286.067);
|
||||
--link-color: #18b69b;
|
||||
}
|
||||
|
||||
.dark {
|
||||
|
||||
Reference in New Issue
Block a user