-
-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial fix for 1869 #1877
Initial fix for 1869 #1877
Conversation
@@ -744,7 +744,7 @@ private DateTime alignToNextBCDIfRequired(final Plan curPlan, final PlanPhase cu | |||
} | |||
|
|||
final BillingPeriod billingPeriod = curPlanPhase.getRecurring() != null ? curPlanPhase.getRecurring().getBillingPeriod() : BillingPeriod.NO_BILLING_PERIOD; | |||
final LocalDate resultingLocalDate = BillCycleDayCalculator.alignProposedNextBillCycleDate(originalTransitionDate, bcd, billingPeriod, context); | |||
final LocalDate resultingLocalDate = BillCycleDayCalculator.alignProposedNextBillCycleDate(originalTransitionDate, lastTransitionDate, bcd, billingPeriod, context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to your change, but the name are so confusing. Would it make sense to rename
originalTransitionDate
->curTransitionDate
# Really the transition time associated with thePlan#EffectiveDateForExistingSubscriptions
lastTransitionDate
->prevTransitionDate
And perhaps swap the 2 in the method signature?
@@ -76,22 +76,27 @@ public static LocalDate alignProposedBillCycleDate(final DateTime proposedDate, | |||
} | |||
|
|||
|
|||
public static LocalDate alignProposedNextBillCycleDate(final LocalDate proposedDate, final int billingCycleDay, final BillingPeriod billingPeriod) { | |||
public static LocalDate alignProposedNextBillCycleDate(final LocalDate proposedDate, final LocalDate originalDate, final int billingCycleDay, final BillingPeriod billingPeriod) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here - rename and swap:
originalDate
->prevTransitionDate
proposedDate
->curTransitionDate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about we also change the method name to alignProposedNextBillCycleDate
-> alignToNextBillCycleDate
. It would take as a first argument prevTransitionDate
, and then curTransitionDate
with a comment /* date to be aligned */ ?
@@ -172,7 +172,7 @@ public void testAlignProposedNextBillCycleDate1() { | |||
// BCD > proposed day of the month |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a few unit tests here to cover for non monthly billing periods - at least the one matching the scenario?
@reshmabidikar I am merging your PR as-is - optionally we could have another small one to clean things up and address the comments. |
Initial fix for #1869