コード例 #1
0
  /**
   * Gets the description from content.
   *
   * @param key the key
   * @param value the value
   * @return the description
   */
  private String getDescription(final String key, final String... value) {
    final Map<String, String> summaryContentMap = staticContentServ.getSummaryContents();

    if (StringUtils.isNotEmpty(key)) {
      final String summaryContent = summaryContentMap.get(key);
      if (SyntacticSugar.isNotNull(summaryContent)) {
        if (SyntacticSugar.isEmpty(value)) {
          return summaryContent;
        }
        return StringUtil.substitute(summaryContent, value);
      }
    }
    return StringUtils.EMPTY;
  }
コード例 #2
0
 /**
  * Populate card charges if applicable.
  *
  * @param bookingDetails the booking details
  * @param target the target
  */
 private void populateCardChargesIfApplicable(
     final BookingDetails bookingDetails, final List<PriceBreakDownViewData> target) {
   if (SyntacticSugar.isNotNull(bookingDetails)
       && CollectionUtils.isNotEmpty(
           bookingDetails.getBookingHistory().get(0).getPaymentReferences())) {
     final PriceBreakDownViewData cardCharges = new PriceBreakDownViewData();
     final BigDecimal cardCharge =
         getTotalCardCharges(bookingDetails.getBookingHistory().get(0).getPaymentReferences());
     cardCharges.setDescription(getDescription("CARD_CHARGES"));
     cardCharges.setPrice(cardCharge);
     cardCharges.setCurrencyAppendedPrice(
         CurrencyUtils.getCurrencySymbol(currencyResolver.getSiteCurrency())
             + cardCharge.setScale(0, RoundingMode.HALF_UP));
     target.add(cardCharges);
   }
 }
コード例 #3
0
 /**
  * Populate promotional charges if applicable.
  *
  * @param promotionalDiscount the promotional discount
  * @param target the target
  */
 private void populatePromotionalChargesIfApplicable(
     final PromotionalDiscount promotionalDiscount, final List<PriceBreakDownViewData> target) {
   if (SyntacticSugar.isNotNull(promotionalDiscount)) {
     final PriceBreakDownViewData promotionalDiscountPrice = new PriceBreakDownViewData();
     final BigDecimal promotionalDis = promotionalDiscount.getPrice().getAmount().getAmount();
     promotionalDiscountPrice.setDescription(getDescription("PROMOTIONAL_DISCOUNT"));
     promotionalDiscountPrice.setPrice(promotionalDis);
     promotionalDiscountPrice.setCurrencyAppendedPrice(
         "-"
             + " "
             + CurrencyUtils.getCurrencySymbol(currencyResolver.getSiteCurrency())
             + promotionalDis
                 .multiply(BigDecimal.valueOf(-1))
                 .setScale(TWO, RoundingMode.HALF_UP));
     target.add(promotionalDiscountPrice);
   }
 }