| | |
| | | |
| | | Map<String, Map<String, BigDecimal>> incomeIndex = service.buildChargingBillIncomeIndex( |
| | | Arrays.asList( |
| | | settlementRow(1, "2026-06", "6.12", "1.85", "0.00"), |
| | | settlementRow(2, "2026-06", "1.00", "1.00", "0.20") |
| | | incomeRow(1, "2026-06", "7.97", "1.85"), |
| | | incomeRow(2, "2026-06", "2.00", "0.00") |
| | | ), |
| | | ratios |
| | | ); |
| | | |
| | | assertEquals(new BigDecimal("7.69"), incomeIndex.get("1|2026-06").get("platformIncome")); |
| | | assertEquals(new BigDecimal("0.28"), incomeIndex.get("1|2026-06").get("partnerIncome")); |
| | | assertEquals(new BigDecimal("1.80"), incomeIndex.get("2|2026-06").get("platformIncome")); |
| | | assertEquals(new BigDecimal("2.00"), incomeIndex.get("2|2026-06").get("platformIncome")); |
| | | assertEquals(new BigDecimal("0.00"), incomeIndex.get("2|2026-06").get("partnerIncome")); |
| | | assertEquals(new BigDecimal("9.49"), incomeIndex.get("0|2026-06").get("platformIncome")); |
| | | assertEquals(new BigDecimal("9.69"), incomeIndex.get("0|2026-06").get("platformIncome")); |
| | | assertEquals(new BigDecimal("0.28"), incomeIndex.get("0|2026-06").get("partnerIncome")); |
| | | } |
| | | |
| | | private Map<String, Object> settlementRow(Integer siteId, String billingCycle, String electricAmount, |
| | | String serviceAmount, String tripartiteCommission) { |
| | | @Test |
| | | void givesAllPaidAmountToPlatformWhenSharingIsDisabled() { |
| | | TChargingBillServiceImpl service = new TChargingBillServiceImpl(); |
| | | Map<Integer, BigDecimal> ratios = new HashMap<>(); |
| | | ratios.put(1, BigDecimal.ZERO); |
| | | |
| | | Map<String, Map<String, BigDecimal>> incomeIndex = service.buildChargingBillIncomeIndex( |
| | | Arrays.asList(incomeRow(1, "2026-07", "12.34", "2.00")), |
| | | ratios |
| | | ); |
| | | |
| | | assertEquals(new BigDecimal("12.34"), incomeIndex.get("1|2026-07").get("platformIncome")); |
| | | assertEquals(new BigDecimal("0"), incomeIndex.get("1|2026-07").get("partnerIncome")); |
| | | } |
| | | |
| | | private Map<String, Object> incomeRow(Integer siteId, String billingCycle, String paymentAmount, |
| | | String commissionableServiceFee) { |
| | | Map<String, Object> row = new HashMap<>(); |
| | | row.put("site_id", siteId); |
| | | row.put("billingCycle", billingCycle); |
| | | row.put("total_electricity_charge", new BigDecimal(electricAmount)); |
| | | row.put("total_service_fee", new BigDecimal(serviceAmount)); |
| | | row.put("tripartite_commission", new BigDecimal(tripartiteCommission)); |
| | | row.put("payment_amount", new BigDecimal(paymentAmount)); |
| | | row.put("commissionable_service_fee", new BigDecimal(commissionableServiceFee)); |
| | | return row; |
| | | } |
| | | } |