♻️ refactor(payment): Reconstruct the payment page

This commit is contained in:
web@ppanel
2025-03-11 20:06:12 +07:00
parent fc0da761b5
commit 710947209a
34 changed files with 1826 additions and 2000 deletions
+48 -83
View File
@@ -2,20 +2,12 @@
/* eslint-disable */
import request from '@/utils/request';
/** Get alipay f2f payment config GET /v1/admin/payment/alipay_f2f */
export async function getAlipayF2FPaymentConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.PaymentConfig }>('/v1/admin/payment/alipay_f2f', {
method: 'GET',
...(options || {}),
});
}
/** Update alipay f2f payment config PUT /v1/admin/payment/alipay_f2f */
export async function updateAlipayF2FPaymentConfig(
body: API.UpdateAlipayF2fRequest,
/** Update Payment Method PUT /v1/admin/payment/ */
export async function updatePaymentMethod(
body: API.UpdatePaymentMethodRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/payment/alipay_f2f', {
return request<API.Response & { data?: API.PaymentConfig }>('/v1/admin/payment/', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
@@ -25,85 +17,58 @@ export async function updateAlipayF2FPaymentConfig(
});
}
/** Get all payment config GET /v1/admin/payment/all */
export async function getAllPaymentConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetAllPaymentConfigResponse }>(
'/v1/admin/payment/all',
/** Create Payment Method POST /v1/admin/payment/ */
export async function createPaymentMethod(
body: API.CreatePaymentMethodRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.PaymentConfig }>('/v1/admin/payment/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Delete Payment Method DELETE /v1/admin/payment/ */
export async function deletePaymentMethod(
body: API.DeletePaymentMethodRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/payment/', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Get Payment Method List GET /v1/admin/payment/list */
export async function getPaymentMethodList(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.GetPaymentMethodListParams,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.GetPaymentMethodListResponse }>(
'/v1/admin/payment/list',
{
method: 'GET',
params: {
...params,
},
...(options || {}),
},
);
}
/** Get epay payment config GET /v1/admin/payment/epay */
export async function getEpayPaymentConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.PaymentConfig }>('/v1/admin/payment/epay', {
/** Get supported payment platform GET /v1/admin/payment/platform */
export async function getPaymentPlatform(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.PlatformResponse }>('/v1/admin/payment/platform', {
method: 'GET',
...(options || {}),
});
}
/** Update epay payment config PUT /v1/admin/payment/epay */
export async function updateEpayPaymentConfig(
body: API.UpdateEpayRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/payment/epay', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Get stripe alipay payment config GET /v1/admin/payment/stripe_alipay */
export async function getStripeAlipayPaymentConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.PaymentConfig }>('/v1/admin/payment/stripe_alipay', {
method: 'GET',
...(options || {}),
});
}
/** Update stripe alipay payment config PUT /v1/admin/payment/stripe_alipay */
export async function updateStripeAlipayPaymentConfig(
body: API.UpdateStripeRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/payment/stripe_alipay', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Get stripe wechat pay payment config GET /v1/admin/payment/stripe_wechat_pay */
export async function getStripeWeChatPayPaymentConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.PaymentConfig }>(
'/v1/admin/payment/stripe_wechat_pay',
{
method: 'GET',
...(options || {}),
},
);
}
/** Update stripe wechat pay payment config PUT /v1/admin/payment/stripe_wechat_pay */
export async function updateStripeWeChatPayPaymentConfig(
body: API.UpdateStripeRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/payment/stripe_wechat_pay', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
+83 -66
View File
@@ -13,12 +13,8 @@ declare namespace API {
updated_at: number;
};
type AlipayF2FConfig = {
app_id: string;
private_key: string;
public_key: string;
invoice_name: string;
sandbox: boolean;
type AlipayNotifyResponse = {
return_code: string;
};
type Announcement = {
@@ -234,6 +230,18 @@ declare namespace API {
subscribe_id?: number;
};
type CreatePaymentMethodRequest = {
name: string;
platform: string;
icon?: string;
domain?: string;
config: Record<string, any>;
fee_mode: number;
fee_percent?: number;
fee_amount?: number;
enable: boolean;
};
type CreateRuleGroupRequest = {
name: string;
icon: string;
@@ -341,6 +349,10 @@ declare namespace API {
id: number;
};
type DeletePaymentMethodRequest = {
id: number;
};
type DeleteRuleGroupRequest = {
id: number;
};
@@ -387,10 +399,17 @@ declare namespace API {
domain_suffix_list: string;
};
type EpayConfig = {
pid: string;
url: string;
key: string;
type EPayNotifyRequest = {
pid: number;
trade_no: string;
out_trade_no: string;
type: string;
name: string;
money: string;
trade_status: string;
param: string;
sign: string;
sign_type: string;
};
type Follow = {
@@ -429,10 +448,6 @@ declare namespace API {
list: Ads[];
};
type GetAllPaymentConfigResponse = {
list: PaymentConfig[];
};
type GetAnnouncementListParams = {
page: number;
size: number;
@@ -614,6 +629,27 @@ declare namespace API {
list: Order[];
};
type GetPaymentMethodListParams = {
page: number;
size: number;
platform?: string;
search?: string;
enable?: boolean;
};
type GetPaymentMethodListRequest = {
page: number;
size: number;
platform?: string;
search?: string;
enable?: boolean;
};
type GetPaymentMethodListResponse = {
total: number;
list: PaymentMethodDetail[];
};
type GetRuleGroupResponse = {
total: number;
list: ServerRuleGroup[];
@@ -927,7 +963,7 @@ declare namespace API {
type PaymenMethod = {
id: number;
name: string;
mark: string;
platform: string;
icon: string;
fee_mode: number;
fee_percent: number;
@@ -937,7 +973,7 @@ declare namespace API {
type PaymentConfig = {
id: number;
name: string;
mark: string;
platform: string;
icon?: string;
domain?: string;
config: Record<string, any>;
@@ -947,6 +983,20 @@ declare namespace API {
enable: boolean;
};
type PaymentMethodDetail = {
id: number;
name: string;
platform: string;
icon: string;
domain: string;
config: Record<string, any>;
fee_mode: number;
fee_percent: number;
fee_amount: number;
enable: boolean;
notify_url: string;
};
type PlatformInfo = {
platform: string;
platform_url: string;
@@ -989,7 +1039,7 @@ declare namespace API {
type PurchaseOrderRequest = {
subscribe_id: number;
quantity: number;
payment: string;
payment: number;
coupon?: string;
};
@@ -1049,7 +1099,7 @@ declare namespace API {
type RechargeOrderRequest = {
amount: number;
payment: string;
payment: number;
};
type RechargeOrderResponse = {
@@ -1070,7 +1120,7 @@ declare namespace API {
type RenewalOrderRequest = {
user_subscribe_id: number;
quantity: number;
payment: string;
payment: number;
coupon?: string;
};
@@ -1080,7 +1130,7 @@ declare namespace API {
type ResetTrafficOrderRequest = {
user_subscribe_id: number;
payment: string;
payment: number;
};
type ResetTrafficOrderResponse = {
@@ -1205,13 +1255,6 @@ declare namespace API {
sort: number;
};
type StripeConfig = {
public_key: string;
secret_key: string;
webhook_secret: string;
payment: string;
};
type StripePayment = {
method: string;
client_secret: string;
@@ -1383,19 +1426,6 @@ declare namespace API {
status: number;
};
type UpdateAlipayF2fRequest = {
id: number;
name: string;
mark: string;
icon?: string;
domain?: string;
config: AlipayF2FConfig;
fee_mode: number;
fee_percent?: number;
fee_amount?: number;
enable: boolean;
};
type UpdateAnnouncementEnableRequest = {
id: number;
enable: boolean;
@@ -1459,19 +1489,6 @@ declare namespace API {
show: boolean;
};
type UpdateEpayRequest = {
id: number;
name: string;
mark: string;
icon?: string;
domain?: string;
config: EpayConfig;
fee_mode: number;
fee_percent?: number;
fee_amount?: number;
enable: boolean;
};
type UpdateNodeGroupRequest = {
id: number;
name: string;
@@ -1503,6 +1520,19 @@ declare namespace API {
trade_no?: string;
};
type UpdatePaymentMethodRequest = {
id: number;
name: string;
platform: string;
icon?: string;
domain?: string;
config: Record<string, any>;
fee_mode: number;
fee_percent?: number;
fee_amount?: number;
enable: boolean;
};
type UpdateRuleGroupRequest = {
id: number;
name: string;
@@ -1511,19 +1541,6 @@ declare namespace API {
enable: boolean;
};
type UpdateStripeRequest = {
id: number;
name: string;
mark: string;
icon?: string;
domain?: string;
config: StripeConfig;
fee_mode: number;
fee_percent?: number;
fee_amount?: number;
enable: boolean;
};
type UpdateSubscribeGroupRequest = {
id: number;
name: string;
+15
View File
@@ -2,6 +2,21 @@
/* eslint-disable */
import request from '@/utils/request';
/** Get Ads GET /v1/common/ads */
export async function getAds(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.GetAdsParams,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.GetAdsResponse }>('/v1/common/ads', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** Get Tos Content GET /v1/common/application */
export async function getApplication(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetAppcationResponse }>('/v1/common/application', {
+62 -6
View File
@@ -13,6 +13,10 @@ declare namespace API {
updated_at: number;
};
type AlipayNotifyResponse = {
return_code: string;
};
type Announcement = {
id: number;
title: string;
@@ -149,6 +153,19 @@ declare namespace API {
domain_suffix_list: string;
};
type EPayNotifyRequest = {
pid: number;
trade_no: string;
out_trade_no: string;
type: string;
name: string;
money: string;
trade_status: string;
param: string;
sign: string;
sign_type: string;
};
type Follow = {
id: number;
ticket_id: number;
@@ -158,6 +175,20 @@ declare namespace API {
created_at: number;
};
type GetAdsParams = {
device: string;
position: string;
};
type GetAdsRequest = {
device: string;
position: string;
};
type GetAdsResponse = {
list: Ads[];
};
type GetAppcationResponse = {
config: ApplicationConfig;
applications: ApplicationResponseInfo[];
@@ -176,6 +207,7 @@ declare namespace API {
subscribe: SubscribeConfig;
verify_code: PubilcVerifyCodeConfig;
oauth_methods: string[];
web_ad: boolean;
};
type GetStatResponse = {
@@ -331,7 +363,7 @@ declare namespace API {
type PaymenMethod = {
id: number;
name: string;
mark: string;
platform: string;
icon: string;
fee_mode: number;
fee_percent: number;
@@ -341,7 +373,7 @@ declare namespace API {
type PaymentConfig = {
id: number;
name: string;
mark: string;
platform: string;
icon?: string;
domain?: string;
config: Record<string, any>;
@@ -351,6 +383,30 @@ declare namespace API {
enable: boolean;
};
type PaymentMethodDetail = {
id: number;
name: string;
platform: string;
icon: string;
domain: string;
config: Record<string, any>;
fee_mode: number;
fee_percent: number;
fee_amount: number;
enable: boolean;
notify_url: string;
};
type PlatformInfo = {
platform: string;
platform_url: string;
platform_field_description: Record<string, any>;
};
type PlatformResponse = {
list: PlatformInfo[];
};
type PreOrderResponse = {
price: number;
amount: number;
@@ -383,7 +439,7 @@ declare namespace API {
type PurchaseOrderRequest = {
subscribe_id: number;
quantity: number;
payment: string;
payment: number;
coupon?: string;
};
@@ -443,7 +499,7 @@ declare namespace API {
type RechargeOrderRequest = {
amount: number;
payment: string;
payment: number;
};
type RechargeOrderResponse = {
@@ -464,7 +520,7 @@ declare namespace API {
type RenewalOrderRequest = {
user_subscribe_id: number;
quantity: number;
payment: string;
payment: number;
coupon?: string;
};
@@ -481,7 +537,7 @@ declare namespace API {
type ResetTrafficOrderRequest = {
user_subscribe_id: number;
payment: string;
payment: number;
};
type ResetTrafficOrderResponse = {