callRupayTransactionHistoryApi method
Implementation
callRupayTransactionHistoryApi(BuildContext context,int? key) async {
print('callRupayTransactionHistoryApi called >>>>>>');
try {
Map<String, dynamic> requestBody = {
"MobileNumber": kglobal.shared.mobileNum,
"DeviceID": kglobal.shared.deviceID,
"GeoLocation": kglobal.shared.geolocation,
"WalletTypeID": key.toString(),
"From_Date": fromDate.value,
"ToD_ate": toDate.value,
};
print(requestBody);
isLoading.value = true;
String bodyJson = jsonEncode(requestBody);
auth.coupanStatement(context, bodyJson).then((value) {
setData(value);
filteredList.clear();
if (coupanStatement.value.responseCode!.length == 4) {
if (value.info != null) {
if (value.info!.length > 0) {
if (selectedStatus != "All") {
filteredList.assignAll(coupanStatement.value.info!
.where((item) => item.transactionRemarks!
.toLowerCase()
.contains(selectedStatus.toLowerCase()))
.toList());
update();
} else {
filteredList.assignAll(coupanStatement.value.info!);
update();
}
} else {
filteredList.clear();
filteredList.assignAll([]);
update();
}
} else {
filteredList.clear();
filteredList.assignAll([]);
update();
}
isLoading.value = false;
} else if (value.responseCode == "99723") {
isLoading.value = false;
kglobal.shared.showSnack(context,true, coupanStatement.value.message ?? "");
/*kglobal.shared.callValiudateJWTToken(
context,
() {
callRupayTransactionHistoryApi(key);
},
);*/
// 22 oct mini statement also put
} else {
/* PopupAlert()
.showPopup(context, coupanStatement.value.message ?? '', true);*/
kglobal.shared.showSnack(context,true, coupanStatement.value.message ?? "");
isLoading.value = false;
}
});
} catch (error) {
print("Error fetching data from API: $error");
}
}