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