Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
pasquy73 committed Jan 28, 2025
2 parents 9d91341 + 02b04c2 commit 14774fc
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private List<BillingRequestDTO> getProductPricesAntTimePeriodGroupsForNow(Produc
ProductOfferingPrice pop = billingService.getProductOfferingPrice(pprice.getProductOfferingPrice().getId());
Assert.state(!Objects.isNull(pop), "The ProductOfferingPrice reference is missing in the ProductPrice " + pprice.getName());

if("one-time".equals(pop.getPriceType().toLowerCase())) {
if("one-time".equals(pop.getPriceType().toLowerCase())||"one time".equals(pop.getPriceType().toLowerCase())) {
logger.info("Calculate ProductPrice list and TimePeriod group for one-time");
String keyPeriod = PREFIX_KEY + "one-time";

Expand All @@ -268,11 +268,13 @@ private List<BillingRequestDTO> getProductPricesAntTimePeriodGroupsForNow(Produc
String keyPeriod = PREFIX_KEY + "recurring-prepaid";

//Get recurringPeriod
String recurringPeriod=pop.getRecurringChargePeriodLength()+" "+pop.getRecurringChargePeriodType();
String recurringPeriod = pop.getRecurringChargePeriodLength() + " " + pop.getRecurringChargePeriodType();
keyPeriod = keyPeriod + "-" + pop.getRecurringChargePeriodLength() + "-" + pop.getRecurringChargePeriodType();

// Get TimePeriod and ProductPrice for billing
TimePeriod tp = new TimePeriod();
OffsetDateTime nextBillingTime = BillingUtils.getNextBillingTime(OffsetDateTime.now(), OffsetDateTime.now(), recurringPeriod);
OffsetDateTime nextBillingTime = BillingUtils.getNextBillingTime(OffsetDateTime.now(), OffsetDateTime.now().plusDays(1), recurringPeriod);

tp.setStartDateTime(OffsetDateTime.now());
tp.setEndDateTime(nextBillingTime);

Expand All @@ -284,7 +286,7 @@ private List<BillingRequestDTO> getProductPricesAntTimePeriodGroupsForNow(Produc
}
}

logger.info("Number of item for billing found: {}", productPrices.size());
logger.info("Number of item for billing found: {}", productPrices.size());
for (Map.Entry<String, List<ProductPrice>> entry : productPrices.entrySet()) {

String key = entry.getKey();
Expand All @@ -293,6 +295,7 @@ private List<BillingRequestDTO> getProductPricesAntTimePeriodGroupsForNow(Produc
if (!timePeriods.get(key).isEmpty()) {
logger.debug("TimePeriod - startDate: " + tp.getStartDateTime() + " - endDate: " + tp.getEndDateTime());
List<ProductPrice> pps = entry.getValue();
logger.debug("Number of ProductPrice in the list: "+pps.size());

//Create the BillingRequestDTO for the group
BillingRequestDTO brDTO = new BillingRequestDTO(product, tp, pps);
Expand Down

0 comments on commit 14774fc

Please sign in to comment.