import '../api_client.dart'; import '../api_config.dart'; import '../proxy_client.dart'; /// 支付相关 API abstract final class PaymentApi { static final _client = ApiClient.instance.proxy; /// 获取 Google 商品列表(Android) static Future getGooglePayActivities({ String? sentinel, String? shield, String? vambrace, String? portal, }) async { return _client.request( path: '/v1/payment/getGooglePayActivities', method: 'GET', queryParams: { 'sentinel': sentinel ?? ApiConfig.appId, 'portal': portal ?? ApiConfig.packageName, if (shield != null) 'shield': shield, if (vambrace != null) 'vambrace': vambrace, }, ); } /// 获取 Apple 商品列表(iOS) static Future getApplePayActivities({ String? sentinel, String? shield, String? vambrace, String? portal, }) async { return _client.request( path: '/v1/payment/getApplePayActivities', method: 'GET', queryParams: { 'sentinel': sentinel ?? 'HAndroid', 'portal': portal ?? ApiConfig.packageName, if (shield != null) 'shield': shield, if (vambrace != null) 'vambrace': vambrace, }, ); } /// 获取支付方式列表(传 activityId) static Future getPaymentMethods({ required String warrior, String? vambrace, }) async { return _client.request( path: '/v1/payment/get-payment-methods', method: 'POST', body: { 'warrior': warrior, if (vambrace != null && vambrace.isNotEmpty) 'vambrace': vambrace, }, ); } /// 创建支付订单 static Future createPayment({ required String sentinel, required String asset, required String warrior, required String resource, String? ceremony, 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 (ceremony != null && ceremony.isNotEmpty) 'ceremony': ceremony, if (lineage != null) 'lineage': lineage, if (armor != null) 'armor': armor, }, ); } /// Google 支付结果回调(凭据、订单 ID、用户 ID) static Future googlepay({ required String merchant, required String federation, required String asset, String? sample, }) async { return _client.request( path: '/v1/payment/googlepay', method: 'POST', queryParams: { 'sentinel': ApiConfig.appId, 'asset': asset, }, body: { 'merchant': merchant, 'federation': federation, 'asset': asset, if (sample != null && sample.isNotEmpty) 'sample': sample, }, ); } }