bookDoctorPreview method

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

Implementation

Future bookDoctorPreview(
    {doctorId,
    hospitalId,
    fullname,
    mobilenumber,
    emailid,
    price,
    slotdate,
    slottime}) async {
  final ApiBody = {
    "doctor_id": doctorId,
    "hospital_id": hospitalId,
    "fullname": fullname,
    "mobileno": mobilenumber,
    "email_id": emailid,
    "price": price,
    "slot_date": slotdate,
    "slot_time": slottime,
  };
  var decodedResponse;
  try {
    final response = await http.post(
      Uri.parse('${SDK_BASE_URL}doctor_api/preview'),
      body: ApiBody,
      headers: {
        "Authorization": SignUpController.currentUserToken,
      },
    );
    decodedResponse = json.decode(response.body);
    Get.back();
    if (decodedResponse['wallet']['show_button'] == 'wallet') {
      await BookDoctorPlaceorder(
          doctorId: doctorId,
          hospitalId: hospitalId,
          fullname: fullname,
          mobilenumber: mobilenumber,
          emailid: emailid,
          price: price,
          slotdate: slotdate,
          slottime: slottime,
          inserid: decodedResponse['results']['insert_id'].toString());
    } else {
      DoctorDetails = await [
        doctorId,
        hospitalId,
        fullname,
        mobilenumber,
        emailid,
        price,
        slotdate,
        slottime,
        decodedResponse['results']['insert_id'].toString()
      ];
      await doctorrazorpaycntr.MakePaymentOnline(
        amount: decodedResponse['results']['razorpay_details']['amount'],
        desc: decodedResponse['results']['razorpay_details']['description'],
        mobnum: decodedResponse['results']['razorpay_details']
            ['prefill_contact'],
        email: decodedResponse['results']['razorpay_details']
            ['prefill_email'],
      );
    }
  } catch (e) {
    errorListner(
        apiname: 'doctor_api/preview',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}