fix(topup-agent-management): fix wallet deposit fields

This commit is contained in:
ghazall-ag
2026-01-06 12:28:42 +03:30
parent 964965f0d1
commit 80d0c675a0
6 changed files with 398 additions and 257 deletions

View File

@@ -54,5 +54,56 @@ export const generalAPI = {
throw error;
}
},
// ========== System Configuration Voucher API ==========
// GET /api/v1/SystemConfiguration/Voucher
async getVoucherConfiguration() {
try {
console.log('🔵 General API - getVoucherConfiguration request');
const res = await api.get('/api/v1/SystemConfiguration/Voucher', {
skipAuthRedirect: true
});
console.log('🟢 General API - getVoucherConfiguration response:', res?.data);
// Response structure: { statusCode, isSuccess, code, message, errors, data: { expireInDays, refundUponVoucherExpiration, canPurchaseByAgentVouchers, canTopUpWithUserVouchers } }
return res?.data?.data || null;
} catch (error) {
console.error('🔴 General API - getVoucherConfiguration error:', {
status: error?.response?.status,
data: error?.response?.data,
error: error?.response?.data || error?.message
});
throw error;
}
},
// PUT /api/v1/SystemConfiguration/Voucher
async updateVoucherConfiguration(config) {
if (!config) {
throw new Error('Voucher configuration is required');
}
try {
const payload = {
expireInDays: Number(config.expireInDays) || 0,
refundUponVoucherExpiration: Boolean(config.refundUponVoucherExpiration),
canPurchaseByAgentVouchers: Boolean(config.canPurchaseByAgentVouchers),
canTopUpWithUserVouchers: Boolean(config.canTopUpWithUserVouchers)
};
console.log('🔵 General API - updateVoucherConfiguration request:', { payload });
const res = await api.put('/api/v1/SystemConfiguration/Voucher', payload, {
skipAuthRedirect: true
});
console.log('🟢 General API - updateVoucherConfiguration response:', res?.data);
return res?.data;
} catch (error) {
console.error('🔴 General API - updateVoucherConfiguration error:', {
payload: config,
status: error?.response?.status,
data: error?.response?.data,
error: error?.response?.data || error?.message
});
throw error;
}
},
};