@@ -250,7 +250,7 @@ private List<BillingRequestDTO> getProductPricesAntTimePeriodGroupsForNow(Produc
250250 ProductOfferingPrice pop = billingService .getProductOfferingPrice (pprice .getProductOfferingPrice ().getId ());
251251 Assert .state (!Objects .isNull (pop ), "The ProductOfferingPrice reference is missing in the ProductPrice " + pprice .getName ());
252252
253- if ("one-time" .equals (pop .getPriceType ().toLowerCase ())) {
253+ if ("one-time" .equals (pop .getPriceType ().toLowerCase ())|| "one time" . equals ( pop . getPriceType (). toLowerCase ()) ) {
254254 logger .info ("Calculate ProductPrice list and TimePeriod group for one-time" );
255255 String keyPeriod = PREFIX_KEY + "one-time" ;
256256
@@ -268,11 +268,13 @@ private List<BillingRequestDTO> getProductPricesAntTimePeriodGroupsForNow(Produc
268268 String keyPeriod = PREFIX_KEY + "recurring-prepaid" ;
269269
270270 //Get recurringPeriod
271- String recurringPeriod =pop .getRecurringChargePeriodLength ()+" " +pop .getRecurringChargePeriodType ();
271+ String recurringPeriod = pop .getRecurringChargePeriodLength () + " " + pop .getRecurringChargePeriodType ();
272+ keyPeriod = keyPeriod + "-" + pop .getRecurringChargePeriodLength () + "-" + pop .getRecurringChargePeriodType ();
272273
273274 // Get TimePeriod and ProductPrice for billing
274275 TimePeriod tp = new TimePeriod ();
275- OffsetDateTime nextBillingTime = BillingUtils .getNextBillingTime (OffsetDateTime .now (), OffsetDateTime .now (), recurringPeriod );
276+ OffsetDateTime nextBillingTime = BillingUtils .getNextBillingTime (OffsetDateTime .now (), OffsetDateTime .now ().plusDays (1 ), recurringPeriod );
277+
276278 tp .setStartDateTime (OffsetDateTime .now ());
277279 tp .setEndDateTime (nextBillingTime );
278280
@@ -284,7 +286,7 @@ private List<BillingRequestDTO> getProductPricesAntTimePeriodGroupsForNow(Produc
284286 }
285287 }
286288
287- logger .info ("Number of item for billing found: {}" , productPrices .size ());
289+ logger .info ("Number of item for billing found: {}" , productPrices .size ());
288290 for (Map .Entry <String , List <ProductPrice >> entry : productPrices .entrySet ()) {
289291
290292 String key = entry .getKey ();
@@ -293,6 +295,7 @@ private List<BillingRequestDTO> getProductPricesAntTimePeriodGroupsForNow(Produc
293295 if (!timePeriods .get (key ).isEmpty ()) {
294296 logger .debug ("TimePeriod - startDate: " + tp .getStartDateTime () + " - endDate: " + tp .getEndDateTime ());
295297 List <ProductPrice > pps = entry .getValue ();
298+ logger .debug ("Number of ProductPrice in the list: " +pps .size ());
296299
297300 //Create the BillingRequestDTO for the group
298301 BillingRequestDTO brDTO = new BillingRequestDTO (product , tp , pps );
0 commit comments