83 lines
2.0 KiB
JavaScript
83 lines
2.0 KiB
JavaScript
import api from './request'
|
||
|
||
// 支付相关API
|
||
export const getPayments = (params) => {
|
||
return api.get('/payments', { params })
|
||
}
|
||
|
||
export const getPaymentById = (id) => {
|
||
return api.get(`/payments/${id}`)
|
||
}
|
||
|
||
export const createPayment = (paymentData) => {
|
||
return api.post('/payments/create', paymentData)
|
||
}
|
||
|
||
export const createTestPayment = (paymentData) => {
|
||
return api.post('/payments/create-test', paymentData)
|
||
}
|
||
|
||
export const updatePaymentStatus = (id, status) => {
|
||
return api.put(`/payments/${id}/status`, { status })
|
||
}
|
||
|
||
export const confirmPaymentSuccess = (id, externalTransactionId) => {
|
||
return api.post(`/payments/${id}/success`, {
|
||
externalTransactionId
|
||
})
|
||
}
|
||
|
||
export const confirmPaymentFailure = (id, failureReason) => {
|
||
return api.post(`/payments/${id}/failure`, {
|
||
failureReason
|
||
})
|
||
}
|
||
|
||
// 测试支付完成API
|
||
export const testPaymentComplete = (id) => {
|
||
return api.post(`/payments/${id}/test-complete`)
|
||
}
|
||
|
||
// 支付宝支付API
|
||
export const createAlipayPayment = (paymentData) => {
|
||
return api.post(`/payments/alipay/create`, paymentData)
|
||
}
|
||
|
||
export const handleAlipayCallback = (params) => {
|
||
return api.post('/payments/alipay/callback', params)
|
||
}
|
||
|
||
// 噜噜支付(彩虹易支付)API
|
||
export const createLuluPayment = (paymentData) => {
|
||
return api.post('/payments/lulupay/create', paymentData)
|
||
}
|
||
|
||
// PayPal支付API
|
||
export const createPayPalPayment = (paymentData) => {
|
||
return api.post('/payment/paypal/create', paymentData)
|
||
}
|
||
|
||
export const getPayPalPaymentStatus = (paymentId) => {
|
||
return api.get(`/payment/paypal/status/${paymentId}`)
|
||
}
|
||
|
||
// 支付统计API
|
||
export const getPaymentStats = () => {
|
||
return api.get('/payments/stats')
|
||
}
|
||
|
||
// 获取用户订阅信息
|
||
export const getUserSubscriptionInfo = () => {
|
||
return api.get('/payments/subscription/info')
|
||
}
|
||
|
||
// 删除单个支付记录
|
||
export const deletePayment = (id) => {
|
||
return api.delete(`/payments/${id}`)
|
||
}
|
||
|
||
// 批量删除支付记录
|
||
export const deletePayments = (paymentIds) => {
|
||
return api.delete('/payments/batch', { data: paymentIds })
|
||
}
|