Package rewards

Examples of rewards.RewardConfirmation


      ps.setString(4, contribution.getAccountNumber());
      ps.setString(5, dining.getMerchantNumber());
      ps.setDate(6, new Date(dining.getDate().inMilliseconds()));
      ps.setBigDecimal(7, dining.getAmount().asBigDecimal());
      ps.execute();
      return new RewardConfirmation(confirmationNumber, contribution);
    } catch (SQLException e) {
      throw new RuntimeException("SQL exception occured inserting reward record", e);
    } finally {
      if (ps != null) {
        try {
View Full Code Here


    account.setEntityId(0L);
    account.addBeneficiary("Annabelle", Percentage.valueOf("50%"));
    account.addBeneficiary("Corgan", Percentage.valueOf("50%"));

    AccountContribution contribution = account.makeContribution(MonetaryAmount.valueOf("8.00"));
    RewardConfirmation confirmation = repository.confirmReward(contribution, dining);
    assertNotNull("confirmation should not be null", confirmation);
    assertNotNull("confirmation number should not be null", confirmation.getConfirmationNumber());
    assertEquals("wrong contribution object", contribution, confirmation.getAccountContribution());
    verifyRewardInserted(confirmation, dining);
  }
View Full Code Here

      ps.setString(4, contribution.getAccountNumber());
      ps.setString(5, dining.getMerchantNumber());
      ps.setDate(6, new Date(dining.getDate().inMilliseconds()));
      ps.setBigDecimal(7, dining.getAmount().asBigDecimal());
      ps.execute();
      return new RewardConfirmation(confirmationNumber, contribution);
    } catch (SQLException e) {
      throw new RuntimeException("SQL exception occured inserting reward record", e);
    } finally {
      if (ps != null) {
        try {
View Full Code Here

  public void testRewardForDining() {
    // create a new dining of 100.00 charged to credit card '1234123412341234' by merchant '123457890' as test input
    Dining dining = Dining.createDining("100.00", "1234123412341234", "1234567890");

    // call the 'rewardNetwork' to test its rewardAccountFor(Dining) method
    RewardConfirmation confirmation = rewardNetwork.rewardAccountFor(dining);

    // assert the expected reward confirmation results
    assertNotNull(confirmation);
    assertNotNull(confirmation.getConfirmationNumber());

    // assert an account contribution was made
    AccountContribution contribution = confirmation.getAccountContribution();
    assertNotNull(contribution);

    // the account number should be '123456789'
    assertEquals("123456789", contribution.getAccountNumber());
View Full Code Here

  public void testRewardForDining() {
    // create a new dining of 100.00 charged to credit card '1234123412341234' by merchant '123457890' as test input
    Dining dining = Dining.createDining("100.00", "1234123412341234", "1234567890");

    // call the 'rewardNetwork' to test its rewardAccountFor(Dining) method
    RewardConfirmation confirmation = rewardNetwork.rewardAccountFor(dining);

    // assert the expected reward confirmation results
    assertNotNull(confirmation);
    assertNotNull(confirmation.getConfirmationNumber());

    // assert an account contribution was made
    AccountContribution contribution = confirmation.getAccountContribution();
    assertNotNull(contribution);

    // the account number should be '123456789'
    assertEquals("123456789", contribution.getAccountNumber());
View Full Code Here

    account.setEntityId(0L);
    account.addBeneficiary("Annabelle", Percentage.valueOf("50%"));
    account.addBeneficiary("Corgan", Percentage.valueOf("50%"));

    AccountContribution contribution = account.makeContribution(MonetaryAmount.valueOf("8.00"));
    RewardConfirmation confirmation = repository.confirmReward(contribution, dining);
    assertNotNull("confirmation should not be null", confirmation);
    assertNotNull("confirmation number should not be null", confirmation.getConfirmationNumber());
    assertEquals("wrong contribution object", contribution, confirmation.getAccountContribution());
    verifyRewardInserted(confirmation, dining);
  }
View Full Code Here

    String sql = "insert into T_REWARD (CONFIRMATION_NUMBER, REWARD_AMOUNT, REWARD_DATE, ACCOUNT_NUMBER, DINING_MERCHANT_NUMBER, DINING_DATE, DINING_AMOUNT) values (?, ?, ?, ?, ?, ?, ?)";
    String confirmationNumber = nextConfirmationNumber();
    getSimpleJdbcTemplate().update(sql, confirmationNumber, contribution.getAmount().asBigDecimal(),
        SimpleDate.today().asDate(), contribution.getAccountNumber(), dining.getMerchantNumber(),
        dining.getDate().asDate(), dining.getAmount().asBigDecimal());
    return new RewardConfirmation(confirmationNumber, contribution);
  }
View Full Code Here

    String sql = "insert into T_REWARD (CONFIRMATION_NUMBER, REWARD_AMOUNT, REWARD_DATE, ACCOUNT_NUMBER, DINING_MERCHANT_NUMBER, DINING_DATE, DINING_AMOUNT) values (?, ?, ?, ?, ?, ?, ?)";
    String confirmationNumber = nextConfirmationNumber();
    getSimpleJdbcTemplate().update(sql, confirmationNumber, contribution.getAmount().asBigDecimal(),
        SimpleDate.today().asDate(), contribution.getAccountNumber(), dining.getMerchantNumber(),
        dining.getDate().asDate(), dining.getAmount().asBigDecimal());
    return new RewardConfirmation(confirmationNumber, contribution);
  }
View Full Code Here

* A dummy reward repository implementation.
*/
public class StubRewardRepository implements RewardRepository {

  public RewardConfirmation confirmReward(AccountContribution contribution, Dining dining) {
    return new RewardConfirmation(confirmationNumber(), contribution);
  }
View Full Code Here

  public void testRewardForDining() {
    // create a new dining of 100.00 charged to credit card '1234123412341234' by merchant '123457890' as test input
    Dining dining = Dining.createDining("100.00", "1234123412341234", "1234567890");

    // call the 'rewardNetwork' to test its rewardAccountFor(Dining) method
    RewardConfirmation confirmation = rewardNetwork.rewardAccountFor(dining);

    // assert the expected reward confirmation results
    assertNotNull(confirmation);
    assertNotNull(confirmation.getConfirmationNumber());

    // assert an account contribution was made
    AccountContribution contribution = confirmation.getAccountContribution();
    assertNotNull(contribution);

    // the account number should be '123456789'
    assertEquals("123456789", contribution.getAccountNumber());
View Full Code Here

TOP

Related Classes of rewards.RewardConfirmation

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.