Skip to content

Feature/2961 reservation full day expiry - #2964

Open
OlegPhenomenon wants to merge 2 commits into
masterfrom
feature/2961-reservation-full-day-expiry
Open

OlegPhenomenon wants to merge 2 commits into
masterfrom
feature/2961-reservation-full-day-expiry

Conversation

@OlegPhenomenon

@OlegPhenomenon OlegPhenomenon commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2961

What

Business registry reservation period is now counted in full calendar days instead of from the exact activation timestamp.

  • The activation day is not counted; the period starts at 00:00 of the next day.
  • The reservation ends at 23:59:59 (Europe/Tallinn) of its last day.
  • Applies to both free short-term (7 days) and paid long-term (1 year) reservations.

Example: reservation made on 2026-10-01 at 13:43

  • 7 days → expire_at = 2026-10-08T23:59:59.000+03:00
  • 1 year → expire_at = 2027-10-01T23:59:59.000+03:00

Changes

  • ReservedDomain.expire_at_for(period, from:) is the single place computing the deadline: (from + period).end_of_day.change(usec: 0).
  • Used in ReservedDomain.reserve_domains_without_payment (7 days) and ReserveDomainInvoice#create_paid_reserved_domains (1 year).
  • EisBilling::BusinessRegistryCallbackController#callback created reserved domains without expire_at, making them permanent. It now sets the same 1-year full-day expiry.
  • CHANGELOG entry.

Edge cases covered by tests

  • Example from the issue (2026-10-01 13:43 → 2026-10-08 23:59:59)
  • DST change (2026-10-25)
  • Leap day (2028-02-29 + 1 year → 2029-02-28 23:59:59)
  • Year boundary (2026-12-28 + 7 days → 2027-01-04 23:59:59)

Existing API tests that compared expire_at with a ±5 s delta now assert exact timestamps using travel_to.

Docs

API documentation updated in internetee/domain-reservation-api-docs (branch feature/2961-reservation-full-day-expiry).

Testing

rails test test/models/reserved_domain_test.rb test/models/reserve_domain_invoice_test.rb test/integration/api/business_registry/ test/services/business_registry/ test/models/free_domain_reservation_holder_test.rb
→ 90 runs, 266 assertions, 0 failures, 0 errors

A reservation used to expire at the exact activation timestamp plus the
period, so a domain reserved at 13:43 was released at 13:43 seven days
later. The period is now counted in full calendar days in the app time
zone: the activation day is not counted and the reservation ends at
23:59:59 of its last day.

ReservedDomain.expire_at_for is the single place computing the deadline
and is used for both free (7 days) and paid (1 year) reservations.

Closes #2961
The business registry billing callback created reserved domains without
expire_at, which made them permanent. Use the same 1-year full-day
expiry as the status endpoint.

Refs #2961
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Deploy Complete!

Property Value
App registry
Slot 1
URL https://registry1-dev.cloud.tld.ee
Namespace registry1-dev

(Environment ready for testing)

This branch has not been deployed

No deployments
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.

BusinessRegistry integration: Change reservation period calculation from minute-based to full days

4 participants