Package org.openbankdata.core.client

Examples of org.openbankdata.core.client.BankRequest


  private BankRequest expectedInitialRequest() {
    return new BankRequest("https://services.sveadirekt.se/mypages/sv/").skipAuthentication(true);
  }

  private BankRequest expectedLoginRequest() {
    return new BankRequest("https://services.sveadirekt.se/mypages/sv/j_security_check")
        .addParam("j_username", USERNAME)
        .addParam("j_password", PASSWORD)
        .skipAuthentication(true);
  }
View Full Code Here


    account.setId("_idcl:0:_id15");
    return account;
  }

  private BankRequest getAccountsRequest() {
    BankRequest bankRequest = new BankRequest(ACCOUNTS_URL);
    bankRequest.addParam("homeForm:balance", "Saldo");
    bankRequest.addParam("homeForm", "homeForm");
    return bankRequest;
  }
View Full Code Here

    bankResponse.code(200);
    return bankResponse;
  }

  private BankRequest getTransactionsRequest() {
    return new BankRequest("http://foo.bar");
  }
View Full Code Here

*/
public class SveaDirektBankClient extends AbstractBankClient {

  @Override
  protected boolean activateSession() {
    if (!get(new BankRequest("https://services.sveadirekt.se/mypages/sv/").skipAuthentication(true))
        .ok()) {
      return false;
    }
    BankRequest request =
        new BankRequest("https://services.sveadirekt.se/mypages/sv/j_security_check")
            .addParam("j_username", getUsername())
            .addParam("j_password", getPassword())
            .skipAuthentication(true);
    return isLoginSuccessful(post(request));
  }
View Full Code Here

    return this;
  }

  @Override
  protected boolean activateSession() {
    if (!get(new BankRequest(BASE_URI).skipAuthentication(true)).ok()) {
      return false;
    }

    BankRequest loginRequest = new BankRequest(LOGIN_URL).skipAuthentication(true)
        .addParam("request_type", "LogLogonHandler")
        .addParam("Face", "sv_SE")
        .addParam("DestPage", AmericanExpressAccountService.ACCOUNTS_URL)
        .addParam("Logon", "Continue...")
        .addParam("UserID", mUsername)
        .addParam("Password", mPassword);

    BankResponse loginResponse = post(loginRequest);
    if (isLoginSuccessful(loginResponse)) {
      this.setSessionActive(true);
      getCache()
          .put(new BankRequest(AmericanExpressAccountService.ACCOUNTS_URL),
              loginResponse);
      return true;
    }
    return false;
  }
View Full Code Here

  }

  @Override
  public List<Account> getAccounts() {
    List<Account> vAccounts = new ArrayList<Account>();
    BankResponse vAccountsRequest = mBankClient.get(new BankRequest(ACCOUNTS_URL));
    String response = vAccountsRequest.body();
    Document doc = Jsoup.parse(response);
    Element el = doc.getElementById("summaryImageHeaderRow");

    if (el != null) {
View Full Code Here

    mTransactionService = pTransactionService;
  }

  @Override
  public List<Account> getAccounts() {
    BankRequest pRequest = new BankRequest().setUri(ACCOUNTS_URL)
        .setParams(getAccountsRequestParams());
    BankResponse response = mBankClient.post(pRequest);

    Document doc = Jsoup.parse(response.body());
    List<Account> accounts = parseAccounts(doc);
View Full Code Here

  BankRequest createTransactionRequest(Account pAccount) {
    Map<String, String> params = new HashMap<String, String>();
    params.put("balanceForm", "balanceForm");
    params.put(createAccountFormName(pAccount), createAccountFormInput(pAccount));
    return new BankRequest().setUri(TRANSACTIONS_URL).setParams(params);
  }
View Full Code Here

  @Test
  public void testGetAccounts() {
    // Given
    // One account exists at the website
    EasyMock.expect(mockedBankClient.get(new BankRequest(ACCOUNT_URI))).andReturn(
        mockedAccountResponse());
    EasyMock.replay(mockedBankClient);

    // When
    // Getting the list of accounts
View Full Code Here

  @Test
  public void testGetAccountsWithZeroAccountsAvailable() {
    // Given
    // No accounts exists
    EasyMock.expect(mockedBankClient.get(new BankRequest(ACCOUNT_URI))).andReturn(
        emptyAccountsResponse());
    EasyMock.replay(mockedBankClient);
    // When
    // Getting the list of accounts
    List<Account> actual = mAccountService.getAccounts();
View Full Code Here

TOP

Related Classes of org.openbankdata.core.client.BankRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.