callDeleteDiscountCartApi method
Future<void>
callDeleteDiscountCartApi(
)
Implementation
Future<void> callDeleteDiscountCartApi() async {
BuildContext context = Get.context!;
Helper.progressDialog(context, "Please wait..");
var body = {"cartDiscountId": null};
await ApiClient(baseUrl: ApiConstant.posBL)
.discountDeleteCart(
cartDiscountId: body,
cartId: cartId,
xRoles: storage.read("XUSER_ID"),
xUserId: storage.read("XUSER_ID"))
.then((response) {
Helper.close();
cart.CartModel model = response;
if (model.status == "POS200") {
discountId.value = "";
cartId = model.data!.cartId!;
if (currentScan == ScanType.spotSellThru) {
updateSpotSellThruOrder(model);
}
} else {
if (model.errors != null) {
Helper.messageDialog(
Get.context!,
model.errors![0].code ?? "Try again!!",
model.errors![0].localeMessage ?? "Something went wrong");
}
}
}).catchError((error) {
print(error.toString());
Helper.close();
MainController mainController = Get.put(MainController());
mainController.showErrorPopup();
});
}