Package com.bank.domain

Examples of com.bank.domain.TransferReceipt


        Double.valueOf(props.getProperty("minimum.transfer.amount")));

    // generate a random amount between 10.00 and 90.00 dollars
    double amount = (new Random().nextInt(8) + 1) * 10;

    TransferReceipt reciept = transferService.transfer(amount, "A123", "C456");

    System.out.println(reciept);
  }
View Full Code Here


    TransferService transferService = ctx.getBean(TransferService.class);

    // generate a random amount between 10.00 and 90.00 dollars
    double amount = (new Random().nextInt(8) + 1) * 10;

    TransferReceipt receipt = transferService.transfer(amount, "A123", "C456");

    System.out.println(receipt);

  }
View Full Code Here

  @Test
  public void transfer10Dollars() throws InsufficientFundsException {
    assertThat(queryForBalance("A123"), equalTo(100.00));
    final double transferAmount = 10.00;
    TransferReceipt receipt = transferService.transfer(transferAmount, "A123", "C456");
    double transferTotal =  transferAmount + receipt.getFeeAmount();
    assertThat(queryForBalance("A123"), equalTo(100.00 - transferTotal));
  }
View Full Code Here

    if (amount < minimumTransferAmount)
      throw new IllegalArgumentException(
          format("transfer amount must be at least $%.2f", minimumTransferAmount));

    TransferReceipt receipt = new TransferReceipt();

    Account srcAcct = accountRepository.findById(srcAcctId);
    Account dstAcct = accountRepository.findById(dstAcctId);

    receipt.setInitialSourceAccount(srcAcct);
    receipt.setInitialDestinationAccount(dstAcct);

    double fee = feePolicy.calculateFee(amount);
    if (fee > 0)
      srcAcct.debit(fee);

    receipt.setTransferAmount(amount);
    receipt.setFeeAmount(fee);

    srcAcct.debit(amount);
    dstAcct.credit(amount);

    accountRepository.updateBalance(srcAcct);
    accountRepository.updateBalance(dstAcct);

    receipt.setFinalSourceAccount(srcAcct);
    receipt.setFinalDestinationAccount(dstAcct);

    return receipt;
  }
View Full Code Here

  @Test
  public void transfer10Dollars() throws InsufficientFundsException {
    assertThat(queryForBalance("A123"), equalTo(100.00));
    final double transferAmount = 10.00;
    TransferReceipt receipt = transferService.transfer(transferAmount, "A123", "C456");
    double transferTotal =  transferAmount + receipt.getFeeAmount();
    assertThat(queryForBalance("A123"), equalTo(100.00 - transferTotal));
  }
View Full Code Here

  @Test
  public void transfer10Dollars() throws InsufficientFundsException {
    assertThat(queryForBalance("A123"), equalTo(100.00));
    final double transferAmount = 10.00;
    TransferReceipt receipt = transferService.transfer(transferAmount, "A123", "C456");
    double transferTotal =  transferAmount + receipt.getFeeAmount();
    assertThat(queryForBalance("A123"), equalTo(100.00 - transferTotal));
  }
View Full Code Here

    if (amount < minimumTransferAmount)
      throw new IllegalArgumentException(
          format("transfer amount must be at least $%.2f", minimumTransferAmount));

    TransferReceipt receipt = new TransferReceipt();

    Account srcAcct = accountRepository.findById(srcAcctId);
    Account dstAcct = accountRepository.findById(dstAcctId);

    receipt.setInitialSourceAccount(srcAcct);
    receipt.setInitialDestinationAccount(dstAcct);

    double fee = feePolicy.calculateFee(amount);
    if (fee > 0)
      srcAcct.debit(fee);

    receipt.setTransferAmount(amount);
    receipt.setFeeAmount(fee);

    srcAcct.debit(amount);
    dstAcct.credit(amount);

    accountRepository.updateBalance(srcAcct);
    accountRepository.updateBalance(dstAcct);

    receipt.setFinalSourceAccount(srcAcct);
    receipt.setFinalDestinationAccount(dstAcct);

    return receipt;
  }
View Full Code Here

  @Test
  public void transfer10Dollars() throws InsufficientFundsException {
    assertThat(queryForBalance("A123"), equalTo(100.00));
    final double transferAmount = 10.00;
    TransferReceipt receipt = transferService.transfer(transferAmount, "A123", "C456");
    double transferTotal =  transferAmount + receipt.getFeeAmount();
    assertThat(queryForBalance("A123"), equalTo(100.00 - transferTotal));
  }
View Full Code Here

  @Test
  public void transfer10Dollars() throws InsufficientFundsException {
    assertThat(queryForBalance("A123"), equalTo(100.00));
    final double transferAmount = 10.00;
    TransferReceipt receipt = transferService.transfer(transferAmount, "A123", "C456");
    double transferTotal =  transferAmount + receipt.getFeeAmount();
    assertThat(queryForBalance("A123"), equalTo(100.00 - transferTotal));
  }
View Full Code Here

    if (amount < minimumTransferAmount)
      throw new IllegalArgumentException(
          format("transfer amount must be at least $%.2f", minimumTransferAmount));

    TransferReceipt receipt = new TransferReceipt();

    Account srcAcct = accountRepository.findById(srcAcctId);
    Account dstAcct = accountRepository.findById(dstAcctId);

    receipt.setInitialSourceAccount(srcAcct);
    receipt.setInitialDestinationAccount(dstAcct);

    double fee = feePolicy.calculateFee(amount);
    if (fee > 0)
      srcAcct.debit(fee);

    receipt.setTransferAmount(amount);
    receipt.setFeeAmount(fee);

    srcAcct.debit(amount);
    dstAcct.credit(amount);

    accountRepository.updateBalance(srcAcct);
    accountRepository.updateBalance(dstAcct);

    receipt.setFinalSourceAccount(srcAcct);
    receipt.setFinalDestinationAccount(dstAcct);

    return receipt;
  }
View Full Code Here

TOP

Related Classes of com.bank.domain.TransferReceipt

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.