fix(topup-agent-management): fix wallet deposit fields
This commit is contained in:
@@ -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;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user