Package rewards.internal.account

Examples of rewards.internal.account.Account


  }

  public void testCreateReward() throws SQLException {
    Dining dining = Dining.createDining("100.00", "1234123412341234", "0123456789");

    Account account = new Account("1", "Keith and Keri Donald");
    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


    this.rewardRepository = rewardRepository;
  }

  @Transactional
  public RewardConfirmation rewardAccountFor(Dining dining) {
    Account account = accountRepository.findByCreditCard(dining.getCreditCardNumber());
    Restaurant restaurant = restaurantRepository.findByMerchantNumber(dining.getMerchantNumber());
    MonetaryAmount amount = restaurant.calculateBenefitFor(account, dining);
    AccountContribution contribution = account.makeContribution(amount);
    return rewardRepository.confirmReward(contribution, dining);
  }
View Full Code Here

    this.rewardRepository = rewardRepository;
  }

  public RewardConfirmation rewardAccountFor(Dining dining) {

    Account account = accountMapper.findByCreditCard(dining.getCreditCardNumber());
    Restaurant restaurant = restaurantMapper.findByMerchantNumber(dining.getMerchantNumber());
    MonetaryAmount amount = restaurant.calculateBenefitFor(account, dining);
    AccountContribution contribution = account.makeContribution(amount);
    updateBeneficiaries(account);
    return rewardRepository.confirmReward(contribution, dining);
  }
View Full Code Here

public class StubAccountRepository implements AccountRepository {

  private Map<String, Account> accountsByCreditCard = new HashMap<String, Account>();

  public StubAccountRepository() {
    Account account = new Account("123456789", "Keith and Keri Donald");
    account.addBeneficiary("Annabelle", Percentage.valueOf("50%"));
    account.addBeneficiary("Corgan", Percentage.valueOf("50%"));
    accountsByCreditCard.put("1234123412341234", account);
  }
View Full Code Here

    account.addBeneficiary("Corgan", Percentage.valueOf("50%"));
    accountsByCreditCard.put("1234123412341234", account);
  }

  public Account findByCreditCard(String creditCardNumber) {
    Account account = accountsByCreditCard.get(creditCardNumber);
    if (account == null) {
      throw new EmptyResultDataAccessException(1);
    }
    return account;
  }
View Full Code Here

        this.restaurantRepository = restaurantRepository;
        this.rewardRepository = rewardRepository;
    }

    public RewardConfirmation rewardAccountFor(Dining dining) {
        Account account = accountRepository.findByCreditCard(dining.getCreditCardNumber());
        Restaurant restaurant = restaurantRepository.findByMerchantNumber(dining.getMerchantNumber());
        MonetaryAmount amount = restaurant.calculateBenefitFor(account, dining);
        AccountContribution contribution = account.makeContribution(amount);
        accountRepository.updateBeneficiaries(account);
        return rewardRepository.confirmReward(contribution, dining);
    }
View Full Code Here

  @Test
  public void testCreateReward() throws SQLException {
    Dining dining = Dining.createDining("100.00", "1234123412341234", "0123456789");

    Account account = new Account("1", "Keith and Keri Donald");
    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

public class StubAccountRepository implements AccountRepository {

  private Map<String, Account> accountsByCreditCard = new HashMap<String, Account>();

  public StubAccountRepository() {
    Account account = new Account("123456789", "Keith and Keri Donald");
    account.addBeneficiary("Annabelle", Percentage.valueOf("50%"));
    account.addBeneficiary("Corgan", Percentage.valueOf("50%"));
    accountsByCreditCard.put("1234123412341234", account);
  }
View Full Code Here

    account.addBeneficiary("Corgan", Percentage.valueOf("50%"));
    accountsByCreditCard.put("1234123412341234", account);
  }

  public Account findByCreditCard(String creditCardNumber) {
    Account account = accountsByCreditCard.get(creditCardNumber);
    if (account == null) {
      throw new ObjectRetrievalFailureException(Account.class, creditCardNumber);
    }
    return account;
  }
View Full Code Here

  @Test
  public void testCreateReward() throws SQLException {
    Dining dining = Dining.createDining("100.00", "1234123412341234", "0123456789");

    Account account = new Account("1", "Keith and Keri Donald");
    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

TOP

Related Classes of rewards.internal.account.Account

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.