50 lines
1.7 KiB
Dart
50 lines
1.7 KiB
Dart
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 {
|
|
return await requestAPI("/fcs_shipments", "POST",
|
|
payload: fcsShipment.toMap(), token: await getToken());
|
|
}
|
|
|
|
Future<void> updateFcsShipment(FcsShipment fcsShipment) async {
|
|
return await requestAPI("/fcs_shipments", "PUT",
|
|
payload: fcsShipment.toMap(), token: await getToken());
|
|
}
|
|
|
|
Future<String> reportFcsShipment(FcsShipment fcsShipment) async {
|
|
dynamic data = await requestAPI("/fcs_shipments/report", "POST",
|
|
payload: fcsShipment.toMap(), token: await getToken());
|
|
return data["url"];
|
|
}
|
|
|
|
Future<void> processFcsShipment(String id) async {
|
|
return await requestAPI("/fcs_shipments/process", "PUT",
|
|
payload: {"id": id}, token: await getToken());
|
|
}
|
|
|
|
Future<void> cancelFcsShipment(String id) async {
|
|
return await requestAPI("/fcs_shipments/cancel", "POST",
|
|
payload: {"id": id}, token: await getToken());
|
|
}
|
|
|
|
Future<void> shipFcsShipment(String id) async {
|
|
return await requestAPI("/fcs_shipments/ship", "PUT",
|
|
payload: {"id": id}, token: await getToken());
|
|
}
|
|
|
|
Future<void> arriveFcsShipment(String id) async {
|
|
return await requestAPI("/fcs_shipments/arrive", "PUT",
|
|
payload: {"id": id}, token: await getToken());
|
|
}
|
|
|
|
Future<void> invoiceFcsShipment(String id) async {
|
|
return await requestAPI("/fcs_shipments/invoice", "PUT",
|
|
payload: {"id": id}, token: await getToken());
|
|
}
|
|
}
|