feat: integrate unified payment and wallet refunds

This commit is contained in:
2026-08-02 23:24:32 +08:00
parent f0b8af0bc8
commit 82a2106a97
64 changed files with 1519 additions and 254 deletions

View File

@@ -79,6 +79,44 @@ class ClientRepository {
subtitleKeys: const ['amount', 'direction'],
);
Future<List<ClientRecord>> refunds() => _records(
'$root/refunds',
titleKeys: const ['refund_no'],
subtitleKeys: const ['reason', 'amount'],
statusKey: 'refund_status',
);
Future<Map<String, Object?>> payOrder({
required String business,
required String identity,
required String requestNo,
required String channel,
required String payType,
String openid = '',
}) async => jsonMap(await _api.post(
'$root/$business/orders/$identity/pay',
body: {
'request_no': requestNo,
'channel': channel,
'pay_type': payType,
if (openid.isNotEmpty) 'openid': openid,
},
));
Future<void> createRefund({
required String business,
required String identity,
required String requestNo,
required String reason,
required List<Map<String, Object?>> items,
}) async {
await _api.post('$root/$business/orders/$identity/refunds', body: {
'request_no': requestNo,
'reason': reason,
'items': items,
});
}
Future<Map<String, Object?>?> serviceRelation() async {
final value = await _api.get('$root/service-relation');
if (value == null || value == '') return null;