SuperTopApi method

dynamic SuperTopApi({
  1. dynamic user_id,
  2. dynamic name,
  3. dynamic dob,
  4. dynamic adhaar,
  5. dynamic pan,
  6. dynamic address_1,
  7. dynamic address_2,
  8. dynamic landmark,
  9. dynamic pincode,
  10. dynamic city,
  11. dynamic state,
  12. dynamic gender,
  13. dynamic userpackageid,
  14. dynamic occupation,
  15. dynamic relation,
  16. dynamic nomineename,
  17. dynamic nomineerelation,
  18. dynamic nominee_dob,
  19. dynamic existingAilments,
  20. dynamic context,
})

Implementation

SuperTopApi(
    {user_id,
    name,
    dob,
    adhaar,
    pan,
    address_1,
    address_2,
    landmark,
    pincode,
    city,
    state,
    gender,
    userpackageid,
    occupation,
    relation,
    nomineename,
    nomineerelation,
    nominee_dob,
    existingAilments,
    context}) async {
  var decodedResponse;
  final ApiBody = {
    "user_id": '${user_id}',
    "name": '${name}',
    "dob": '${dob}',
    "adhaar": '${adhaar}',
    "address_1": '${address_1}',
    "address_2": '${address_2}',
    "pan": '${pan}',
    "landmark": '${landmark}',
    "pincode": '${pincode}',
    "city": '${city}',
    "state": '${state}',
    "gender": '${gender}',
    "user_package_id": '${userpackageid}',
    "occupation": '${occupation}',
    "relation": "1",
    "nominee_name": '${nomineename}',
    "nominee_relation": '${nomineerelation}',
    "nominee_dob": '${nominee_dob}',
    "pre_existing_ailments": "${existingAilments}"
  };
  print("RESPONSE => ${ApiBody}");

  try {
    http.Response response = await http.post(
      Uri.parse('${SDK_BASE_URL}api/home_index/save_topup'),
      headers: {
        "Authorization": SignUpController.currentUserToken,
      },
      body: ApiBody,
    );

    decodedResponse = json.decode(response.body);
    print("RESPONSE => ${decodedResponse}");
    if (decodedResponse['status'] == 200) {
      BackFunction(4);
      await showDialog(
        barrierDismissible: false,
        context: context,
        builder: (BuildContext context) {
          return PinCodePopUp(
            messag: "${decodedResponse['message']}",
            image: '${LottiePath}Order_Successful.json',
          );
        },
      );
      Get.back();
    } else {
      BackFunction(2);
      showDialog(
        barrierDismissible: false,
        context: context,
        builder: (BuildContext context) {
          return PinCodePopUp(
            messag: "${decodedResponse['message']}",
            image: '${LottiePath}Error.json',
          );
        },
      );
    }
  } catch (e) {
    errorListner(
        apiname: 'api/home_index/save_topup',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}