diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 263dd12a5..09b9cbca6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -656,10 +656,6 @@ public class TradeLogServiceImpl implements TradeLogService { .filter(log -> log.getBigDecimal("settle_amount") != null) .map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP))) .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); - analysis.put("total_transaction_fee_tax", logs.parallelStream() - .filter(log -> log.getBigDecimal("settle_amount") != null) - .map(log -> getSymbol(log).multiply(log.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP))) - .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); analysis.put("total_surcharge", logs.parallelStream() .filter(log -> log.getBigDecimal("settle_amount") != null) .map(log -> getSymbol(log).multiply(log.getBigDecimal("total_surcharge").add(log.getBigDecimal("tax_amount")))) @@ -972,15 +968,14 @@ public class TradeLogServiceImpl implements TradeLogService { parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO)); parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO)); parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP)); - BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").add(analysis.getBigDecimal("total_transaction_fee_tax")).setScale(2, RoundingMode.HALF_UP); - BigDecimal totalRoyalpayFee = analysis.getBigDecimal("total_surcharge") + BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").setScale(2, RoundingMode.HALF_UP); + BigDecimal totalRoyalpaySvcFee = analysis.getBigDecimal("total_surcharge") .subtract(analysis.getBigDecimal("total_transaction_fee")) - .subtract(analysis.getBigDecimal("total_transaction_fee_tax")) .subtract(analysis.getBigDecimal("total_incremental_surcharge")) .subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP); parmerters.put("total_transaction_fee", totalTransactionFee); - parmerters.put("total_royalpay_fee", totalRoyalpayFee); - parmerters.put("total_card_fee", totalRoyalpayFee.add(totalTransactionFee)); + parmerters.put("total_royalpay_fee", totalRoyalpaySvcFee); + parmerters.put("total_card_fee", totalRoyalpaySvcFee.add(totalTransactionFee)); parmerters.put("total_incremental_fee", parmerters.getBigDecimal("incremental_fee").add(parmerters.getBigDecimal("incremental_gst"))); dataList.parallelStream().forEach(item -> { BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO; @@ -991,12 +986,11 @@ public class TradeLogServiceImpl implements TradeLogService { item.put("transaction_fee", BigDecimal.ZERO); } BigDecimal transactionFee = item.getBigDecimal("transaction_fee"); - BigDecimal transactionFeeTax = item.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP); - BigDecimal realRoyalpayCharge = (item.containsKey("total_surcharge")?item.getBigDecimal("total_surcharge"):BigDecimal.ZERO) - .add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax).subtract(incrementalSurcharge).subtract(incrementalTax); + BigDecimal royalpaySvcFee = (item.containsKey("total_surcharge") ? item.getBigDecimal("total_surcharge") : BigDecimal.ZERO) + .add(taxAmount).subtract(transactionFee).subtract(incrementalSurcharge).subtract(incrementalTax); item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP)); - item.put("total_surcharge_intax", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP)); - item.put("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2, RoundingMode.HALF_UP)); + item.put("total_surcharge_intax", royalpaySvcFee.setScale(2, RoundingMode.HALF_UP)); + item.put("transaction_fee_intax", transactionFee.setScale(2, RoundingMode.HALF_UP)); scaleDecimalVal(item, "display_amount", item.getString("currency")); String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency(); scaleDecimalVal(item, "clearing_amount", platformCurrency);