/** * 支付配置管理 API */ import { BaseService } from '../BaseService' import type { BaseResponse } from '@/types/api' import type { PaymentSettings, PaymentSettingsQueryParams, PaymentSettingsListResponse, CreatePaymentSettingsRequest, UpdatePaymentSettingsRequest } from '@/types/api/paymentSettings' const PAYMENT_SETTINGS_BASE_URL = '/api/admin/wechat-configs' export class PaymentSettingsService extends BaseService { /** * 获取支付配置列表 */ static getPaymentSettings( params?: PaymentSettingsQueryParams ): Promise> { return this.get>(PAYMENT_SETTINGS_BASE_URL, params) } /** * 获取支付配置详情 */ static getPaymentSettingsById(id: number): Promise> { return this.get>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`) } /** * 创建支付配置 */ static createPaymentSettings( data: CreatePaymentSettingsRequest ): Promise> { return this.post>(PAYMENT_SETTINGS_BASE_URL, data) } /** * 更新支付配置 */ static updatePaymentSettings( id: number, data: UpdatePaymentSettingsRequest ): Promise> { return this.put>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`, data) } /** * 删除支付配置 */ static deletePaymentSettings(id: number): Promise> { return this.delete>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`) } /** * 激活支付配置 */ static activatePaymentSettings(id: number): Promise> { return this.post>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/activate`) } /** * 停用支付配置 */ static deactivatePaymentSettings(id: number): Promise> { return this.post>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/deactivate`) } /** * 获取当前生效的支付配置 */ static getActivePaymentSettings(): Promise> { return this.get>(`${PAYMENT_SETTINGS_BASE_URL}/active`) } }