SuperTopApi method
dynamic
SuperTopApi({
- dynamic user_id,
- dynamic name,
- dynamic dob,
- dynamic adhaar,
- dynamic pan,
- dynamic address_1,
- dynamic address_2,
- dynamic landmark,
- dynamic pincode,
- dynamic city,
- dynamic state,
- dynamic gender,
- dynamic userpackageid,
- dynamic occupation,
- dynamic relation,
- dynamic nomineename,
- dynamic nomineerelation,
- dynamic nominee_dob,
- dynamic existingAilments,
- 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}');
}
}