teleconsultationPlaceOrderAPI method

Future teleconsultationPlaceOrderAPI({
  1. dynamic bookedId,
  2. dynamic context,
})

Implementation

Future teleconsultationPlaceOrderAPI({bookedId, context}) async {
  var decodedResponse;
  final ApiBody = {
    "booked_id": '$bookedId',
    "package_id": packageId.value == '' ? '' : '$packageId',
  };

  http.Response response = await http.post(
      Uri.parse('${medicine_API}api/teleconsultation/amount/utilization'),
      headers: {
        'Authorization': currentUserToken,
      },
      body: ApiBody);

  decodedResponse = json.decode(response.body);
  teleconsultationPlaceOrderData = await decodedResponse;

  if (decodedResponse['success'] == true) {
    Get.back();
  } else {
    Get.back();
    Validator().errorMessage(
        context: context, message: "${decodedResponse['message']}");
  }
}