import 'dart:developer'; import 'package:dio/dio.dart'; import 'package:kmobile/core/errors/exceptions.dart'; import 'package:kmobile/data/models/ifsc.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(); } }