BookDoctorPlaceorder method

Future BookDoctorPlaceorder({
  1. dynamic doctorId,
  2. dynamic hospitalId,
  3. dynamic fullname,
  4. dynamic mobilenumber,
  5. dynamic emailid,
  6. dynamic price,
  7. dynamic slotdate,
  8. dynamic slottime,
  9. dynamic inserid,
})

Implementation

Future BookDoctorPlaceorder(
    {doctorId,
    hospitalId,
    fullname,
    mobilenumber,
    emailid,
    price,
    slotdate,
    slottime,
    inserid}) async {
  final ApiBody = {
    "doctor_id": doctorId,
    "hospital_id": hospitalId,
    "fullname": fullname,
    "mobileno": mobilenumber,
    "email_id": emailid,
    "price": price,
    "slot_date": slotdate,
    "slot_time": slottime,
    "insert_id": inserid
  };
  var decodedResponse;
  try {
    Map data = ApiBody;
    var body = jsonEncode(data);
    final response = await http.post(
      Uri.parse('${SDK_BASE_URL}doctor_api/place_order'),
      headers: {'Authorization': SignUpController.currentUserToken},
      body: body,
    );
    decodedResponse = json.decode(response.body);
    Get.to(PaymentPopup(
      fromplace: 'doctor',
      messag: '${decodedResponse['results']['message']}',
      image: '${LottiePath}Upload_Successful.json',
    ));
  } catch (e) {
    errorListner(
        apiname: 'doctor_api/place_order',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}