import 'dart:developer'; import 'package:dio/dio.dart'; class YojnaService { final Dio _dio; YojnaService(this._dio); Future fetchpmydetails({ required String scheme, required String action, required String accountno, }) async { try { final response = await _dio.post( "/api/gov-scheme/req/PMJBY", data: { 'scheme': scheme, 'action': action, 'accountNo': accountno, }, options: Options( headers: { "Content-Type": "application/json", }, ), ); log("PMY Details Response: ${response.data}"); if (response.statusCode == 200) { return response.data; } else { throw Exception("INTERNAL SERVER ERROR"); } } catch (e) { log("Error fetching PMY details: $e"); return null; } } Future secondvalidationPMJJBY({ String? aadharno, String? accountno, String? availablebalance, String? country, String? customerdob, String? customername, String? customerno, String? dateofacctopening, String? emailid, String? financialyear, String? gender, String? ifsccode, String? married, String? mobileno, String? pan, String? pincode, String? policynumber, String? premiumamount, String? state, String? healthstatus, String? collectionchannel, String? nomineename, String? nomineeaddress, String? nomineerelationship, String? nomineeminor, String? ruralcategory, }) async { final response = await _dio.post( '/api/gov-scheme/create/PMJBY', options: Options( validateStatus: (int? status) => true, receiveDataWhenStatusError: true, ), data: { 'aadharno': aadharno , 'accountno': accountno, 'availablebalance': availablebalance, 'country': country, 'customerdob': customerdob, 'customername': customername, 'customerno': customerno, 'dateofacctopening': dateofacctopening, 'emailid': emailid, 'financialyear': financialyear, 'gender': gender, 'ifsccode': ifsccode, 'married': married, 'mobileno': mobileno, 'pan': pan, 'pincode': pincode, 'policynumber': policynumber, 'premiumamount': premiumamount, 'state': state, 'healthstatus': healthstatus, 'collectionchannel': collectionchannel, 'nomineename': nomineename, 'nomineeaddress': nomineeaddress, 'nomineerelationship': nomineerelationship, 'nomineeminor': nomineeminor, 'ruralcategory': ruralcategory, }, ); return response.toString(); } Future secondvalidationPMSBY({ String? aadharno, String? accountno, String? address1, String? address2, String? availablebalance, String? city, String? country, String? customerdob, String? customername, String? customerno, String? emailid, String? financialyear, String? gender, String? married, String? mobileno, String? pan, String? pincode, String? policyno, String? premiumamount, String? state, String? healthstatus, String? nomineename, String? nomineeadress, String? relationwithnominee, String? nomineeminor, String? collectionchannel, String? ruralcategory, String? policystatus, }) async { final response = await _dio.post( '/api/gov-scheme/create/PMSBY', options: Options( validateStatus: (int? status) => true, receiveDataWhenStatusError: true, ), data: { "aadharno": aadharno, "accountno": accountno, "address1": address1, "address2": address2, "availablebalance": availablebalance, "city": city, "country": country, "customerdob": customerdob, "customername": customername, "customerno": customerno, "emailid": emailid, "financialyear": financialyear, "gender": gender, "married": married, "mobileno": mobileno, "pan": pan, "pincode": pincode, "policyno": policyno, "premiumamount": premiumamount, "state": state, "healthstatus": healthstatus, "nomineename": nomineename, "nomineeadress": nomineeadress, "relationwithnominee": relationwithnominee, "nomineeminor": nomineeminor, "collectionchannel": collectionchannel, "ruralcategory": ruralcategory, "policystatus": policystatus, }, ); return response.toString(); } Future enquiry({ required String scheme, required String action, required String financialyear, String? customerno, }) async { try { final response = await _dio.get( "/api/gov-scheme/enquiry/PMJBY", queryParameters: { 'scheme': scheme, 'action': action, 'financialyear': financialyear, 'customerno': customerno, }, options: Options( headers: { "Content-Type": "application/json", }, ), ); log("PMY Details Response: ${response.data}"); if (response.statusCode == 200) { return response.data; } else { throw Exception("INTERNAL SERVER ERROR"); } } catch (e) { log("Error fetching PMY details: $e"); return null; } } Future fetchpapydetails({ required String accountno, }) async { try { final response = await _dio.post( "/api/apy/req/APY", data: { 'accountNo': accountno, }, options: Options( headers: { "Content-Type": "application/json", }, ), ); log("PMY Details Response: ${response.data}"); if (response.statusCode == 200) { return response.data; } else { throw Exception("INTERNAL SERVER ERROR"); } } catch (e) { log("Error fetching APY details: $e"); return null; } } Future registerAPY({ String? accountno, String? customerfirstname, String? customermiddlename, String? customerlastname, String? availablebalance, String? customerdob, String? emailid, String? gender, String? married, String? nomineename, String? relationwithsubscriber, String? mobilenumber, String? nomineeminor, String? customerno, String? beneficaryofothersociatysecurityschemes, String? whetherincometaxpayer, String? customertitle, String? aadharno, String? nameofspouse, String? ageofjoining, String? pensionamtoptedfor, String? montlycontributioncalculate, String? collectionchannel, String? subsequentContributionDebitDate, String? secondnomineeminor, String? secondnomineename, String? secondrelationshipwithsubscriber, String? pincode, String? fatcacrsapplicable, String? countryofbirth, String? countryofcitizenship, String? countryofresidencefortaxpurpose, String? uspersonflag, String? fatcadeclarationcount, String? documentevidencingcitizenshipflag, String? reasonfornoevidence, String? nameofdocumentforcitizenshipevidence, String? modeofcollection, String? contributionType, }) async { final response = await _dio.post( '/api/apy/create/APY', options: Options( validateStatus: (int? status) => true, receiveDataWhenStatusError: true, ), data: { 'accountno':accountno, 'customerfirstname':customerfirstname, 'customermiddlename':customermiddlename, 'customerlastname':customerlastname, 'availablebalance':availablebalance, 'customerdob':customerdob, 'emailid':emailid, 'gender':gender, 'married':married, 'nomineename':nomineename, 'relationwithsubscriber':relationwithsubscriber, 'mobilenumber':mobilenumber, 'nomineeminor':nomineeminor, 'customerno':customerno, 'beneficaryofothersociatysecurityschemes':beneficaryofothersociatysecurityschemes, 'whetherincometaxpayer':whetherincometaxpayer, 'customertitle':customertitle, 'aadharno':aadharno, 'nameofspouse':nameofspouse, 'ageofjoining':ageofjoining, 'pensionamtoptedfor':pensionamtoptedfor, 'montlycontributioncalculate':montlycontributioncalculate, 'collectionchannel':collectionchannel, 'subsequentContributionDebitDate':subsequentContributionDebitDate, 'secondnomineeminor':secondnomineeminor, 'secondnomineename':secondnomineename, 'secondrelationshipwithsubscriber':secondrelationshipwithsubscriber, 'pincode':pincode, 'fatcacrsapplicable':fatcacrsapplicable, 'countryofbirth':countryofbirth, 'countryofcitizenship':countryofcitizenship, 'countryofresidencefortaxpurpose':countryofresidencefortaxpurpose, 'uspersonflag':uspersonflag, 'fatcadeclarationcount':fatcadeclarationcount, 'documentevidencingcitizenshipflag':documentevidencingcitizenshipflag, 'reasonfornoevidence':reasonfornoevidence, 'nameofdocumentforcitizenshipevidence':nameofdocumentforcitizenshipevidence, 'modeofcollection':modeofcollection, 'contributionType':contributionType, }, ); return response.toString(); } }