// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java
// public class FSSUserAgent {
//     public static HttpClient httpclient = HttpClientBuilder.create().build();
//     public static Logger log = Logger.getLogger(FSSUserAgent.class);
//     public static BasicHttpContext context = new BasicHttpContext();
// 
//     public FSSUserAgent() {
//     }
// 
// 
// }
// 
// Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java
// public class Account {
// 
// 	static Logger Log = Logger.getLogger(Account.class);
// 	private int id;
// 	private String name;
// 	private BigDecimal balance;
// 	private String drcr;
// 	private ArrayList<Transaction> transactions;
// 	private boolean pending;
// 
// 	public Account(int id, String name, String balance, String drcr, boolean pending) {
// 		Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ")
// 				.append(balance).append(drcr).toString());
// 		this.id = id;
// 		this.name = name;
// 		this.balance = new BigDecimal(balance.replace(",", ""));
// 		this.drcr = (null == drcr ? "" : drcr);
// 		this.pending = pending;
// 	}
// 
// 	public String getDrcr() {
// 		return drcr;
// 	}
// 
// 	public void setDrcr(String drcr) {
// 		this.drcr = drcr;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	public void setBalance(String balance) {
// 		this.balance = new BigDecimal(balance.replace(",", ""));
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public BigDecimal getBalance() {
// 		return balance;
// 	}
// 
// 	public boolean isDR() {
// 		return drcr.equalsIgnoreCase("DR");
// 	}
// 
// 
// 	public boolean isPending() {
// 		return pending;
// 	}
// 
// 	public void setTransactions(ArrayList<Transaction> t) {
// 		transactions = t;
// 	}
// 
// 	public ArrayList<Transaction> getTransactions() {
// 		return transactions;
// 	}
// 
// 	public int getId() {
// 		return id;
// 	}
// 
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 
// }
// 
// Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java
// public class UnexpectedPageContentsException extends Exception
// {
// 
//     public UnexpectedPageContentsException(String s)
//     {
//         super(s);
//     }
// 
//     private static final long serialVersionUID = 0xf57ed4fa93f8378aL;
// }


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import com.syndicapp.scraper.FSSUserAgent;
import com.syndicapp.scraper.aib.model.Account;
import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 17/03/2013 01:04:34
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   AccountOverviewPage.java

package com.syndicapp.scraper.aib;




public class AccountOverviewPage extends FSSUserAgent
{

    public AccountOverviewPage()
    {
    }

    public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams)
        throws Exception {
    	String thisPage = "https://onlinebanking.aib.ie/inet/roi/accountoverview.htm";
    	
        HashMap<String, Object> outputParams = new HashMap<String, Object>();
        String transactionToken = null;
        Pattern p = Pattern.compile("accountoverview.htm\" method=\"post\" onsubmit=\"return isFormClickEnabled\\(this\\)\">\\s*<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"");
        						
        for(Matcher m = p.matcher(page); m.find();) 
            transactionToken = m.group(1);

        HttpPost httppost = new HttpPost(thisPage);
        List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
        nvps.add(new BasicNameValuePair("transactionToken", transactionToken));
        nvps.add(new BasicNameValuePair("isFormButtonClicked", "true"));
        
        log.info((new StringBuilder()).append("Clicking 'Account Overview' with ").append(nvps.toString()).toString());
        
        httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8));
        httppost.setHeader("Referer", PageUtils.getReferer(page));
        HttpResponse response = httpclient.execute(httppost);
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java
// public class FSSUserAgent {
//     public static HttpClient httpclient = HttpClientBuilder.create().build();
//     public static Logger log = Logger.getLogger(FSSUserAgent.class);
//     public static BasicHttpContext context = new BasicHttpContext();
// 
//     public FSSUserAgent() {
//     }
// 
// 
// }
// 
// Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java
// public class Account {
// 
// 	static Logger Log = Logger.getLogger(Account.class);
// 	private int id;
// 	private String name;
// 	private BigDecimal balance;
// 	private String drcr;
// 	private ArrayList<Transaction> transactions;
// 	private boolean pending;
// 
// 	public Account(int id, String name, String balance, String drcr, boolean pending) {
// 		Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ")
// 				.append(balance).append(drcr).toString());
// 		this.id = id;
// 		this.name = name;
// 		this.balance = new BigDecimal(balance.replace(",", ""));
// 		this.drcr = (null == drcr ? "" : drcr);
// 		this.pending = pending;
// 	}
// 
// 	public String getDrcr() {
// 		return drcr;
// 	}
// 
// 	public void setDrcr(String drcr) {
// 		this.drcr = drcr;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	public void setBalance(String balance) {
// 		this.balance = new BigDecimal(balance.replace(",", ""));
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public BigDecimal getBalance() {
// 		return balance;
// 	}
// 
// 	public boolean isDR() {
// 		return drcr.equalsIgnoreCase("DR");
// 	}
// 
// 
// 	public boolean isPending() {
// 		return pending;
// 	}
// 
// 	public void setTransactions(ArrayList<Transaction> t) {
// 		transactions = t;
// 	}
// 
// 	public ArrayList<Transaction> getTransactions() {
// 		return transactions;
// 	}
// 
// 	public int getId() {
// 		return id;
// 	}
// 
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 
// }
// 
// Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java
// public class UnexpectedPageContentsException extends Exception
// {
// 
//     public UnexpectedPageContentsException(String s)
//     {
//         super(s);
//     }
// 
//     private static final long serialVersionUID = 0xf57ed4fa93f8378aL;
// }


// Path: src/main/java/com/syndicapp/scraper/aib/AccountOverviewPage.java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import com.syndicapp.scraper.FSSUserAgent;
import com.syndicapp.scraper.aib.model.Account;
import com.syndicapp.scraper.exception.UnexpectedPageContentsException;

// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 17/03/2013 01:04:34
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   AccountOverviewPage.java

package com.syndicapp.scraper.aib;




public class AccountOverviewPage extends FSSUserAgent
{

    public AccountOverviewPage()
    {
    }

    public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams)
        throws Exception {
    	String thisPage = "https://onlinebanking.aib.ie/inet/roi/accountoverview.htm";
    	
        HashMap<String, Object> outputParams = new HashMap<String, Object>();
        String transactionToken = null;
        Pattern p = Pattern.compile("accountoverview.htm\" method=\"post\" onsubmit=\"return isFormClickEnabled\\(this\\)\">\\s*<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"");
        						
        for(Matcher m = p.matcher(page); m.find();) 
            transactionToken = m.group(1);

        HttpPost httppost = new HttpPost(thisPage);
        List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
        nvps.add(new BasicNameValuePair("transactionToken", transactionToken));
        nvps.add(new BasicNameValuePair("isFormButtonClicked", "true"));
        
        log.info((new StringBuilder()).append("Clicking 'Account Overview' with ").append(nvps.toString()).toString());
        
        httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8));
        httppost.setHeader("Referer", PageUtils.getReferer(page));
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity entity = response.getEntity();