changing to banker's rounding
This commit is contained in:
@@ -98,14 +98,14 @@ public class CalculateChargesHandler implements HandlerInterface {
|
||||
chargeAmount = charge.getFlat();
|
||||
}else {
|
||||
BigDecimal fraction = charge.getPercentageRate().divide(
|
||||
new BigDecimal(100), 4, RoundingMode.CEILING);
|
||||
new BigDecimal(100), 4, RoundingMode.HALF_EVEN);
|
||||
chargeAmount = amountToCharge.multiply(fraction)
|
||||
.setScale(2, RoundingMode.CEILING);
|
||||
.setScale(2, RoundingMode.HALF_EVEN);
|
||||
|
||||
// if it's a composite charge then add the flat component as well
|
||||
if(charge.isComposite()) {
|
||||
chargeAmount = chargeAmount.add(charge.getFlat())
|
||||
.setScale(2, RoundingMode.CEILING);
|
||||
.setScale(2, RoundingMode.HALF_EVEN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,9 +119,9 @@ public class PurchaseInvoiceHandler implements HandlerInterface {
|
||||
Provider provider = providerService.getProviderRepository()
|
||||
.findByClientId(transaction.getBillClientId());
|
||||
BigDecimal commissionPercentage = BigDecimal.valueOf(provider.getPercentageCommission())
|
||||
.divide(BigDecimal.valueOf(100), 2, RoundingMode.CEILING);
|
||||
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_EVEN);
|
||||
BigDecimal commission = transaction.getAmount().multiply(commissionPercentage)
|
||||
.setScale(2, RoundingMode.CEILING);
|
||||
.setScale(2, RoundingMode.HALF_EVEN);
|
||||
BigDecimal amount = transaction.getAmount().subtract(commission);
|
||||
|
||||
PurchaseTaxDto purchaseTaxDto = PurchaseTaxDto.builder()
|
||||
|
||||
@@ -110,9 +110,9 @@ public class PurchasePaymentEntryHandler implements HandlerInterface {
|
||||
Provider provider = providerService.getProviderRepository()
|
||||
.findByClientId(transaction.getBillClientId());
|
||||
BigDecimal commissionPercentage = BigDecimal.valueOf(provider.getPercentageCommission())
|
||||
.divide(BigDecimal.valueOf(100), 2, RoundingMode.CEILING);
|
||||
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_EVEN);
|
||||
BigDecimal commission = transaction.getAmount().multiply(commissionPercentage)
|
||||
.setScale(2, RoundingMode.CEILING);
|
||||
.setScale(2, RoundingMode.HALF_EVEN);
|
||||
BigDecimal amount = transaction.getAmount().subtract(commission);
|
||||
|
||||
PaymentReferenceDto paymentReferenceDto = PaymentReferenceDto.builder()
|
||||
|
||||
Reference in New Issue
Block a user