Fix refund pending finalization gaps

This commit is contained in:
wucm667
2026-06-30 10:19:50 +08:00
parent 7316d83027
commit 93a3bf3077
17 changed files with 591 additions and 39 deletions
+14 -1
View File
@@ -49,6 +49,14 @@ export interface UpdatePaymentConfigRequest {
help_text?: string
}
export interface RefundResult {
success: boolean
warning?: string
require_force?: boolean
balance_deducted?: number
subscription_days_deducted?: number
}
export const adminPaymentAPI = {
// ==================== Config ====================
@@ -105,7 +113,12 @@ export const adminPaymentAPI = {
/** Process a refund */
refundOrder(id: number, data: { amount: number; reason: string; deduct_balance?: boolean; force?: boolean }) {
return apiClient.post(`/admin/payment/orders/${id}/refund`, data)
return apiClient.post<RefundResult>(`/admin/payment/orders/${id}/refund`, data)
},
/** Query and finalize a pending refund */
queryRefund(id: number) {
return apiClient.post<RefundResult>(`/admin/payment/orders/${id}/refund/query`)
},
// ==================== Channels ====================
+10 -2
View File
@@ -16,6 +16,14 @@ import type {
} from '@/types/payment'
import type { BasePaginationResponse } from '@/types'
export interface PublicOrderVerifyResult {
out_trade_no: string
status: string
paid: boolean
created_at: string
expires_at: string
}
export const paymentAPI = {
/** Get payment configuration (enabled types, limits, etc.) */
getConfig() {
@@ -69,12 +77,12 @@ export const paymentAPI = {
/** Legacy-compatible public order lookup by out_trade_no */
verifyOrderPublic(outTradeNo: string) {
return apiClient.post<PaymentOrder>('/payment/public/orders/verify', { out_trade_no: outTradeNo })
return apiClient.post<PublicOrderVerifyResult>('/payment/public/orders/verify', { out_trade_no: outTradeNo })
},
/** Resolve an order from a signed resume token without auth */
resolveOrderPublicByResumeToken(resumeToken: string) {
return apiClient.post<PaymentOrder>('/payment/public/orders/resolve', { resume_token: resumeToken })
return apiClient.post<PublicOrderVerifyResult>('/payment/public/orders/resolve', { resume_token: resumeToken })
},
/** Request a refund for a completed order */