Sales Pack subscription update not prorated correctly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SailReal
    Member
    • Jun 2025
    • 56

    #1

    Sales Pack subscription update not prorated correctly

    Hi,

    we're on EspoCRM 10.1.4 with Sales Pack 4.5.0. When a subscription has an anchor day, a mid-period update is prorated wrongly unless it falls on the anchor day. Subscriptions without an anchor day prorate correctly.

    Example: yearly plan, period 2026-10-01 to 2027-10-01, anchor day 1, 144.00 per unit, adding 1 unit:

    - update dated 2026-10-20: charged 144.00, expected 136.50 (346/365)
    - update dated 2026-12-05: charged 119.67 (300/361), expected 118.36 (300/365)

    As far as we can tell, UpdateService: reparePeriods() moves the period start to the update date, and CreateInvoiceForPeriod::calculatePriceFactor() then derives the cycle length from that moved start, with Util::addMonths() snapping the end to the anchor day. Credits for downgrades use the same factor.

    Could the cycle length be calculated from the original period start instead?

    Steps to reproduce:
    1. Take an active subscription on a yearly plan with a billed period from 2026-10-01 to 2027-10-01, anchor day 1, 144.00 per unit.
    2. Add 1 unit with an update dated 2026-10-20, or call POST Subscription/{id}/calculateUpdateAmounts with that date.
    Thanks!
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 10133

    #2
    Hi,

    Fixed in the new release.

    Comment


    • SailReal
      SailReal commented
      Editing a comment
      Thank you very much for the super fast fix!
Working...