mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-30 00:21:34 +00:00
Fix refund pending finalization gaps
This commit is contained in:
@@ -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 ====================
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user