feat: integrate unified payment and wallet refunds
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user