Files
fcs/lib/data/provider/fcs_shipment_data_provider.dart

50 lines
1.7 KiB
Dart
Raw Normal View History

2020-10-07 17:22:01 +06:30
import 'package:fcs/domain/entities/fcs_shipment.dart';
import 'package:fcs/helpers/api_helper.dart';
import 'package:fcs/helpers/firebase_helper.dart';
import 'package:logging/logging.dart';
class FcsShipmentDataProvider {
final log = Logger('FcsShipmentDataProvider');
Future<void> createFcsShipment(FcsShipment fcsShipment) async {
2024-03-01 17:33:14 +06:30
return await requestAPI("/fcs_shipments", "POST",
2020-10-07 17:22:01 +06:30
payload: fcsShipment.toMap(), token: await getToken());
}
Future<void> updateFcsShipment(FcsShipment fcsShipment) async {
2024-03-01 17:33:14 +06:30
return await requestAPI("/fcs_shipments", "PUT",
2020-10-07 17:22:01 +06:30
payload: fcsShipment.toMap(), token: await getToken());
}
2020-10-19 05:13:49 +06:30
2020-10-28 05:11:06 +06:30
Future<String> reportFcsShipment(FcsShipment fcsShipment) async {
dynamic data = await requestAPI("/fcs_shipments/report", "POST",
payload: fcsShipment.toMap(), token: await getToken());
return data["url"];
}
2024-02-21 17:05:20 +06:30
Future<void> processFcsShipment(String id) async {
2024-03-01 17:33:14 +06:30
return await requestAPI("/fcs_shipments/process", "PUT",
2024-02-21 17:05:20 +06:30
payload: {"id": id}, token: await getToken());
}
Future<void> cancelFcsShipment(String id) async {
2024-03-01 17:33:14 +06:30
return await requestAPI("/fcs_shipments/cancel", "PUT",
2024-02-21 17:05:20 +06:30
payload: {"id": id}, token: await getToken());
}
Future<void> shipFcsShipment(String id) async {
2024-03-01 17:33:14 +06:30
return await requestAPI("/fcs_shipments/ship", "PUT",
2024-02-21 17:05:20 +06:30
payload: {"id": id}, token: await getToken());
}
Future<void> arriveFcsShipment(String id) async {
2024-03-01 17:33:14 +06:30
return await requestAPI("/fcs_shipments/arrive", "PUT",
2024-02-21 17:05:20 +06:30
payload: {"id": id}, token: await getToken());
}
Future<void> invoiceFcsShipment(String id) async {
2024-03-01 17:33:14 +06:30
return await requestAPI("/fcs_shipments/invoice", "PUT",
2024-02-21 17:05:20 +06:30
payload: {"id": id}, token: await getToken());
}
2020-10-07 17:22:01 +06:30
}