Skip to content

Commit

Permalink
invoice: CR for PR #868
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrossie committed Feb 14, 2018
1 parent 3fc2275 commit 975cc1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -136,7 +136,7 @@ List<UsageConsumableInArrearTierUnitDetail> getBilledDetailsForUnitType(final It
resultMap.put(curDetail.getTier(), curDetail); resultMap.put(curDetail.getTier(), curDetail);
} else { } else {
final UsageConsumableInArrearTierUnitDetail perTierDetail = resultMap.get(curDetail.getTier()); final UsageConsumableInArrearTierUnitDetail perTierDetail = resultMap.get(curDetail.getTier());
perTierDetail.updateQuantityAndAmount(perTierDetail.getQuantity() + curDetail.getQuantity()); perTierDetail.updateQuantityAndAmount(curDetail.getQuantity());
} }
} }
} }
Expand Down
Expand Up @@ -71,12 +71,12 @@ public int getTierBlockSize() {
return tierBlockSize; return tierBlockSize;
} }


public void updateQuantityAndAmount(final Integer targetQuantity) { public void updateQuantityAndAmount(final Integer addionalQuantity) {
this.quantity = targetQuantity; this.quantity = quantity + addionalQuantity;
this.amount = computeAmount(tierPrice, targetQuantity); this.amount = computeAmount(tierPrice, quantity);
} }


private static BigDecimal computeAmount(final BigDecimal targetTierPrice, final Integer targetQuantity) { private static BigDecimal computeAmount(final BigDecimal targetTierPrice, final Integer targetQuantity) {
return targetTierPrice.multiply(new BigDecimal(targetQuantity)); return targetTierPrice.multiply(BigDecimal.valueOf(targetQuantity));
} }
} }

0 comments on commit 975cc1e

Please sign in to comment.