fullStatement method Null safety
fullStatement Fetches the baseAccountNo full statement that is between the dates passed startDate
, & endDate
It has a return type of BankReponse & the raw response can be gotten by calling BankReponse.rawResponceBody
The list of transactions as List of BankTransactionModel can be gotten by calling BankReponse.transactions
Implementation
Future<BankReponse> fullStatement({
required String referenceNumber,
required DateTime startDate,
required DateTime endDate,
required String accessToken,
})async{
String _dateFormat(DateTime _date){ // format to yyy-mm-dd
return '${_date.year}-${_date.month}-${_date.day}';
}
Map<String, String> _header ={
'content-type': 'application/json',
'Authorization': 'Bearer $accessToken'
};
Map<String, dynamic> _payload = {
'MessageReference': referenceNumber,
'AccountNumber': baseAccountNo,
'StartDate': _dateFormat(startDate),
'EndDate': _dateFormat(endDate)
};
try {
return await pesalinkProcessTransaction(fullStatementUrl, _header, _payload, applicationMode);
} catch (e) {
rethrow;
}
}