CancelDiagnosticOrder method

dynamic CancelDiagnosticOrder({
  1. dynamic cancelReason,
  2. dynamic cancelId,
  3. dynamic context,
})

Implementation

CancelDiagnosticOrder({cancelReason, cancelId, context}) async {
  var decodedResponse;
  final ApiBody = {
    "cancel_reason": '${cancelReason}',
    "cancel_order_id": '${cancelId}',
  };
  try {
    http.Response response = await http.post(
      Uri.parse('${SDK_BASE_URL}api/home_index/cancel_order'),
      headers: {
        "Authorization": SignUpController.currentUserToken,
      },
      body: ApiBody,
    );

    decodedResponse = json.decode(response.body);

    if (decodedResponse['status'] == 200) {
      Get.back();
      getUserDetails();
      showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext context) {
          return PinCodePopUp(
            messag: "${decodedResponse['message']}",
            image: '${LottiePath}Upload_Successful.json',
          );
        },
      );
    }
  } catch (e) {
    errorListner(
        apiname: 'api/home_index/cancel_order',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}