Jag har fixat ihop kreditkorttransaktionerna för Nordea
Funktion updateTransactions i Nordea.java
Code:
@Override
public void updateTransactions(Account account, Urllib urlopen) throws LoginException, BankException {
super.updateTransactions(account, urlopen);
//No transaction history for loans, funds
int accType = account.getType();
if (accType == Account.LOANS || accType == Account.FUNDS ) return;
String response = null;
Matcher matcher;
try {
//Credit cards
if(accType==Account.CCARD) {
response = urlopen.open("https://mobil.nordea.se/banking-nordea/nordea-c3/card/list.html");
//Strip c: from account id
Log.d(TAG, "Opening: https://mobil.nordea.se/banking-nordea/nordea-c3/card/invoiceUnsent.html?id="+account.getId().substring(3)+";Visa");
response = urlopen.open("https://mobil.nordea.se/banking-nordea/nordea-c3/card/invoiceUnsent.html?id="+account.getId().substring(3)+";Visa");
matcher = reCurrency.matcher(response);
}
//Accounts
else {
response = urlopen.open("https://mobil.nordea.se/banking-nordea/nordea-c3/accounts.html");
Log.d(TAG, "Opening: https://mobil.nordea.se/banking-nordea/nordea-c3/account.html?id=konton:"+account.getId());
response = urlopen.open("https://mobil.nordea.se/banking-nordea/nordea-c3/account.html?id=konton:"+account.getId());
matcher = reCurrency.matcher(response);
}
/*
* Capture groups:
* GROUP EXAMPLE DATA
* 1: Currency SEK
*
*/
String currency = "SEK";
if (matcher.find()) {
currency = matcher.group(1).trim();
}
else {
Log.d(TAG, "Unable to find currency, assuming SEK.");
}
matcher = reTransactions.matcher(response);
ArrayList<Transaction> transactions = new ArrayList<Transaction>();
while (matcher.find()) {
Transaction transaction = new Transaction(Html.fromHtml(matcher.group(1)).toString().trim(), Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3)));
transaction.setCurrency(currency);
transactions.add(transaction);
}
account.setTransactions(transactions);
account.setCurrency(currency);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Det är endast transaktionerna som inte är skickade på faktura än.
https://github.com/sed03/android-ba...com/liato/bankdroid/banking/banks/Nordea.java