Skip to content
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

Model chargedThroughDate as NextBillingPeriodStartDate #354

Merged
merged 2 commits into from Jul 29, 2019

Conversation

mariogalic
Copy link
Contributor

@mariogalic mariogalic commented Jul 25, 2019

https://docs.google.com/document/d/1O-jIw0SBUcSjcLArZfWQY8ad2aX3H-b3O6ONrOQnFLQ

Holiday credit is applied to the next invoice on the first day of the next billing period.

This PR makes the above requirement more explicit by modelling the concept of next invoice like so

/**
 * Holiday credit is applied to the next invoice on the first day of the next billing period.
 *
 * 'Invoiced period' or `billing period that has already been invoiced` is defined as
 * [processedThroughDate, chargedThroughDate) meaning
 *   - from processedThroughDate inclusive
 *   - to chargedThroughDate exclusive
 *
 * Hence chargedThroughDate represents the first day of the next billing period. For quarterly
 * billing period this would be the first day of the next quarter, whilst for annual this would be
 * the first day of the next year.
 *
 * Note chargedThroughDate is an API concept. The UI and the actual invoice use the term 'Service Period'
 * where from and to dates are both inclusive.
 *
 * Note nextBillingPeriodStartDate represents a specific date yyyy-mm-dd unlike billingPeriod (quarterly)
 * or billingPeriodStartDay (1st of month).
 */
object NextBillingPeriodStartDate {

and making it part of the main for-comprehension in def processHolidayStop.

@coveralls
Copy link

coveralls commented Jul 25, 2019

Coverage Status

Coverage increased (+0.04%) to 59.873% when pulling 2971a5d on factor-out-NextInvoiceStartDate into 3406350 on master.

Copy link
Member

@kelvin-chappell kelvin-chappell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to call nextInvoiceStartDate nextBillingPeriodStartDate. And have some comments about what it means more explicitly and what its preconditions are. Eg. it only exists for a subscription when a bill run has happened.

@mariogalic mariogalic changed the title Model chargedThroughDate as NextInvoiceStartDate Model chargedThroughDate as NextBillingPeriodStartDate Jul 26, 2019
@guardian guardian deleted a comment Jul 26, 2019
@mariogalic mariogalic merged commit 646c718 into master Jul 29, 2019
@mariogalic mariogalic deleted the factor-out-NextInvoiceStartDate branch July 29, 2019 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants