This commit is contained in:
efrilm
2025-11-01 16:17:45 +07:00
parent ef23839761
commit 069c2296de
24 changed files with 2670 additions and 133 deletions
@@ -262,4 +262,27 @@ class OrderRemoteDataProvider {
return DC.error(OrderFailure.serverError(e));
}
}
Future<DC<OrderFailure, Unit>> refundPayment({
required String id,
required String reason,
required int refundAmount,
}) async {
try {
final response = await _apiClient.post(
'${ApiPath.orders}/$id/refund',
data: {'refund_amount': refundAmount, 'reason': reason},
headers: getAuthorizationHeader(),
);
if (response.data['success'] == false) {
return DC.error(OrderFailure.unexpectedError());
}
return DC.data(unit);
} on ApiFailure catch (e, s) {
log('refundPaymnetError', name: _logName, error: e, stackTrace: s);
return DC.error(OrderFailure.serverError(e));
}
}
}