Package rewards

Examples of rewards.RewardConfirmation


  public String create(@ModelAttribute("rewardForm") RewardForm rewardForm, BindingResult result) {
    if (result.hasErrors()) {
      return FORM_VIEW;
    } else {
      Dining dining = rewardForm.createDining();
      RewardConfirmation confirmation = rewardNetwork.rewardAccountFor(dining);
      return REDIRECT_SHOW_VIEW + "/" + confirmation.getConfirmationNumber();
    }
  }
View Full Code Here


        this.accountDao = accountDao;
    }

    @Override
    public RewardConfirmation rewardAccountFor(AccountDao accountDao) {
        return new RewardConfirmation();
    }
View Full Code Here

      String amount = request.getParameter("amount");
      String merchantNumber = request.getParameter("merchantNumber");
      // prepare the input needed by the application service
      Dining dining = Dining.createDining(amount, creditCardNumber, merchantNumber);
      // invoke the application
      RewardConfirmation confirmation = rewardNetwork.rewardAccountFor(dining);
      // redirect to the lookup servlet for displaying the confirmed reward details
      response.sendRedirect("show/" + confirmation.getConfirmationNumber());
    }
  }
View Full Code Here

        this.accountDao = accountDao;
    }

    @Override
    public RewardConfirmation rewardAccountFor(AccountDao accountDao) {
        return new RewardConfirmation();
    }
View Full Code Here

    }

    @Override
    public RewardConfirmation rewardAccountFor(AccountDao accountDao) {
        return new RewardConfirmation();
    }
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

    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

  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

  @Test
  public void testRmiClient() {
    Dining dining = Dining.createDining("100.00", "1234123412341234", "1234567890");

    // Remote Invocation
    RewardConfirmation confirmation = rewardNetwork.rewardAccountFor(dining);

    assertNotNull(confirmation);
    assertNotNull(confirmation.getConfirmationNumber());

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

    // the contribution 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.