feat(payment): enhance payment configuration to include active gateways and update CORS settings

This commit is contained in:
hamed
2026-07-01 12:45:18 +03:30
parent e1eae1099c
commit dfc86391c4
10 changed files with 342 additions and 41 deletions
+16 -2
View File
@@ -2,11 +2,25 @@ import { useQuery } from '@tanstack/react-query';
import { api } from '../lib/api';
import type { ApiResponse } from '../lib/api';
export interface PaymentGatewayInfo {
name: string;
label: string;
}
interface PaymentConfig {
test_mode: boolean;
appointment_fee_rials: number;
gateways: PaymentGatewayInfo[];
}
export function usePaymentConfig() {
const { data } = useQuery<ApiResponse<{ test_mode: boolean }>>({
const { data } = useQuery<ApiResponse<PaymentConfig>>({
queryKey: ['payment-config'],
queryFn: () => api.get('/api/v1/payment/config'),
staleTime: 5 * 60 * 1000,
});
return { isTestMode: data?.data?.test_mode ?? false };
return {
isTestMode: data?.data?.test_mode ?? false,
gateways: data?.data?.gateways ?? [],
};
}