getHistory static method
Implementation
static Future<bool> getHistory(List<String> history) async {
bool result = false;
String apduClSelectApp = await _channel.invokeMethod('apduIsMyCard');
String apduClBalance = await _channel.invokeMethod('apduBalance');
var dataBalance = jsonDecode(apduClBalance);
var dataSelect = jsonDecode(apduClSelectApp);
List<ApduResponse> apduList = dataSelect
.map<ApduResponse>((result) => new ApduResponse.fromJson(result))
.toList();
List<ApduResponse> apduListBalance = dataBalance
.map<ApduResponse>((result) => new ApduResponse.fromJson(result))
.toList();
try {
for (ApduResponse s in apduList) {
String selectApp = await FlutterNfcKit.transceive(s.apdu);
if (_apduIsOke(selectApp)) {
for (ApduResponse b in apduListBalance) {
if (s.bankType == b.bankType) {
if (s.bankType == "MANDIRI") {
await FlutterNfcKit.transceive(b.apdu);
result = await _getHistoryMandiri(history);
} else if (s.bankType == "BNI") {
result = await _getHistoryBni(history);
}
}
}
}
}
} catch (error) {
result = false;
}
return result;
}