cancelBooking method
Implementation
void cancelBooking(BookingHistory history) async {
try {
var response = await Requests.getDio().post(
"booking/v4/${history.id}/cancellation",
);
if (response.statusCode == 200) {
CancelBookingDialog.show(
refundAmount: response.data?['data']?['amountToRefundUsd'],
cancellationFee: response.data?['data']?['deduction'],
onConfirm: () {
confirmRefundRequest(history);
},
);
} else {
debugPrint("error ${response.data}");
CustomFlashWidget.showFlashMessage(
title: "Error",
message: response.data["message"] ?? 'Error cancelling this booking',
type: FlashType.error);
}
} catch (e) {
debugPrint("error ${e.toString()}");
CustomFlashWidget.showFlashMessage(
title: "Error",
message: 'Error cancelling this booking',
type: FlashType.error);
}
}