73 lines
1.8 KiB
Dart
73 lines
1.8 KiB
Dart
import '../api_client.dart';
|
|
import '../proxy_client.dart';
|
|
|
|
/// 支付相关 API
|
|
abstract final class PaymentApi {
|
|
static final _client = ApiClient.instance.proxy;
|
|
|
|
/// 获取 Google 商品列表
|
|
static Future<ApiResponse> getGooglePayActivities({
|
|
required String sentinel,
|
|
String? shield,
|
|
String? vambrace,
|
|
String? portal,
|
|
}) async {
|
|
return _client.request(
|
|
path: '/v1/payment/getGooglePayActivities',
|
|
method: 'GET',
|
|
queryParams: {
|
|
'sentinel': sentinel,
|
|
if (shield != null) 'shield': shield,
|
|
if (vambrace != null) 'vambrace': vambrace,
|
|
if (portal != null) 'portal': portal,
|
|
},
|
|
);
|
|
}
|
|
|
|
/// 获取 Apple 商品列表
|
|
static Future<ApiResponse> getApplePayActivities({
|
|
required String sentinel,
|
|
String? shield,
|
|
String? vambrace,
|
|
String? portal,
|
|
}) async {
|
|
return _client.request(
|
|
path: '/v1/payment/getApplePayActivities',
|
|
method: 'GET',
|
|
queryParams: {
|
|
'sentinel': sentinel,
|
|
if (shield != null) 'shield': shield,
|
|
if (vambrace != null) 'vambrace': vambrace,
|
|
if (portal != null) 'portal': portal,
|
|
},
|
|
);
|
|
}
|
|
|
|
/// 创建支付订单
|
|
static Future<ApiResponse> createPayment({
|
|
required String sentinel,
|
|
required String asset,
|
|
required String warrior,
|
|
required String resource,
|
|
String? lineage,
|
|
String? armor,
|
|
}) async {
|
|
return _client.request(
|
|
path: '/v1/payment/createPayment',
|
|
method: 'POST',
|
|
queryParams: {
|
|
'sentinel': sentinel,
|
|
'asset': asset,
|
|
},
|
|
body: {
|
|
'sentinel': sentinel,
|
|
'asset': asset,
|
|
'warrior': warrior,
|
|
'resource': resource,
|
|
if (lineage != null) 'lineage': lineage,
|
|
if (armor != null) 'armor': armor,
|
|
},
|
|
);
|
|
}
|
|
}
|