Files
kra-new/web/src/api/payment.js
T
2026-08-21 21:37:30 +08:00

51 lines
1.3 KiB
JavaScript

import service from '@/utils/request'
export const getPaymentOrders = (params) => service({
url: '/payment/orders',
method: 'get',
params,
donNotShowLoading: true
})
export const getPaymentOrder = (data) => service({
url: '/payment/order',
method: 'post',
data,
donNotShowLoading: true
})
export const queryPaymentOrder = (data) => service({
url: '/payment/query',
method: 'post',
data,
donNotShowLoading: true
})
export const refundPaymentOrder = (data) => service({
url: '/payment/refund',
method: 'post',
data,
donNotShowLoading: true
})
export const fulfillPaymentOrder = (data) => service({
url: '/payment/fulfill',
method: 'post',
data,
donNotShowLoading: true
})
export const testPaymentProvider = (provider) => service({
// The payment test route is registered at /payment/... (without the
// frontend /api proxy prefix). When the built UI is opened directly from
// the backend port, bypass axios' default /api baseURL for this request
// only. Vite/Nginx deployments continue to use the normal proxy path.
...(typeof window !== 'undefined' &&
String(window.location.port) === String(import.meta.env.VITE_SERVER_PORT || '8000')
? { baseURL: `${window.location.origin}/` }
: {}),
url: `/payment/providers/${encodeURIComponent(provider)}/test`,
method: 'post',
donNotShowLoading: true
})