Package rewards

Examples of rewards.RewardConfirmation


    // expose in "request scope" for other resources to access
    request.setAttribute("dining", dining);

    try {
      // invoke application
      RewardConfirmation confirmation = rewardNetwork.rewardAccountFor(dining);
      // expose in "request scope" for other resources to access
      request.setAttribute("rewardConfirmation", confirmation);
      RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/rewardConfirmation.jsp");
      // forward to a confirmation JSP resource for rendering
      dispatcher.forward(request, response);
View Full Code Here


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

    // TODO 4: call the 'rewardAccountFor(..)' method
    RewardConfirmation confirmation = null;

    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

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

    // TODO 12: call the 'rewardAccountFor(..)' method
    RewardConfirmation confirmation = null;

    // assert the expected reward confirmation results
    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

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

    // TODO 8: call the 'rewardAccountFor(..)' method
    RewardConfirmation confirmation = null;


    // assert the expected reward confirmation results
    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

  @Override
  protected Element invokeInternal(Element requestElement, Document document) throws Exception {
    Element diningElement = DomUtils.getChildElementByTagName(requestElement, "dining");
    Dining dining = mapDining(diningElement);
    RewardConfirmation confirmation = rewardNetwork.rewardAccountFor(dining);
    Element responseElement = document.createElementNS(NAMESPACE_URI, "rewardAccountForDiningResponse");
    responseElement.appendChild(mapRewardConfirmation(document, confirmation));
    return responseElement;
  }
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();
    jdbcTemplate.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 accountNumber = confirmationElement.getAttribute("accountNumber");
    String amount = confirmationElement.getAttribute("amount");
    List<Element> distributionElements = DomUtils.getChildElementsByTagName(confirmationElement, "distribution");
    AccountContribution contribution = new AccountContribution(accountNumber, MonetaryAmount.valueOf(amount),
        mapDistributions(distributionElements));
    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

    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

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.