fix to prod
This commit is contained in:
@@ -36,8 +36,8 @@ import '../models/subscriptions_response.dart';
|
||||
import '../models/user_check_response_dto.dart';
|
||||
|
||||
class ApiService {
|
||||
static const String baseUrl = "https://sharing-api.sparkit.by/api/v1";
|
||||
static const String fileBaseUrl = "https://sharing-api.sparkit.by";
|
||||
static const String baseUrl = "https://api.behappybel.by/api/v1";
|
||||
static const String fileBaseUrl = "https://api.behappybel.by/";
|
||||
|
||||
final SecurityService _securityService;
|
||||
final Dio _dio;
|
||||
@@ -935,11 +935,30 @@ class ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
/// GET /scooterorder/fines/client
|
||||
Future<List<Fine>> getClientFines() async {
|
||||
try {
|
||||
final response = await _dio.get(
|
||||
"$baseUrl/scooterorder/fines/client",
|
||||
options: await _getAuthOptions(),
|
||||
);
|
||||
|
||||
if (response.statusCode == 200 && response.data is Map) {
|
||||
final List<dynamic> dataList = response.data['data'] ?? [];
|
||||
return dataList.map((json) => Fine.fromJson(json)).toList();
|
||||
}
|
||||
return [];
|
||||
} on DioException catch (e) {
|
||||
_handleDioError(e);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/// GET /scooterorder/{id}/fine
|
||||
Future<Fine?> getFineDetails(int orderId) async {
|
||||
try {
|
||||
final response = await _dio.get(
|
||||
"$baseUrl/scooterorder/$orderId/fine",
|
||||
"$baseUrl/scooterorder/fines/client/$orderId",
|
||||
options: await _getAuthOptions(),
|
||||
);
|
||||
|
||||
@@ -953,7 +972,8 @@ class ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
/// PUT /scooterorder/{id}/fine
|
||||
/// PUT /scooterorder/fines/client/{id}
|
||||
/// {id} — это id штрафа (Fine.id), а не id заказа (Fine.orderId)
|
||||
Future<void> payFine({
|
||||
required int orderId,
|
||||
int? cardId,
|
||||
@@ -961,10 +981,10 @@ class ApiService {
|
||||
}) async {
|
||||
try {
|
||||
await _dio.put(
|
||||
"$baseUrl/scooterorder/$orderId/fine",
|
||||
"$baseUrl/scooterorder/fines/client/$orderId",
|
||||
data: {
|
||||
if (cardId != null) 'cardId': cardId,
|
||||
'isBalance': isBalance,
|
||||
"cardId": cardId ?? 0,
|
||||
"isBalance": isBalance,
|
||||
},
|
||||
options: await _getAuthOptions(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user