iachat/enterprise/app/controllers/enterprise
Sojan Jose 2ab117e8eb
feat(cloud-billing): cancel subscriptions at period end on deletion mark (#13580)
## How to reproduce
In Chatwoot Cloud, mark an account for deletion from account settings
while the account has an active Stripe subscription. Before this change,
deletion marking did not explicitly mark subscriptions to stop renewing
at period end.

## What changed
This PR adds `Enterprise::Billing::CancelCloudSubscriptionsService` and
calls it from the delete action path in
`Enterprise::Api::V1::AccountsController`. The service lists only active
Stripe subscriptions for the customer and sets `cancel_at_period_end:
true` when needed. The account deletion schedule remains unchanged
(existing static 7-day behavior), and Stripe deleted-event fallback
behavior remains unchanged.

## How this was tested
Added and updated specs:
-
`spec/enterprise/services/enterprise/billing/cancel_cloud_subscriptions_service_spec.rb`
-
`spec/enterprise/controllers/enterprise/api/v1/accounts_controller_spec.rb`

Executed:
- `bundle exec rspec
spec/enterprise/services/enterprise/billing/cancel_cloud_subscriptions_service_spec.rb`
- `bundle exec rspec
spec/enterprise/controllers/enterprise/api/v1/accounts_controller_spec.rb:363`
2026-02-19 11:40:06 +05:30
..
api feat(cloud-billing): cancel subscriptions at period end on deletion mark (#13580) 2026-02-19 11:40:06 +05:30
concerns chore: improve plan-based feature handling with plan hierarchy (#11335) 2025-04-28 14:13:56 -07:00
devise_overrides feat: Add relay state for SAML SSO (#12597) 2025-10-07 20:32:29 +05:30
public/api/v1/portals feat: legacy features to ruby llm (#12994) 2025-12-11 14:17:28 +05:30
super_admin feat: Use amplitude for Cloud Analytics (#13217) 2026-01-09 09:32:09 -08:00
webhooks fix: Added authentication to FireCrawl API, remove unused RobinAI references (#10737) 2025-01-22 18:14:25 -08:00
widgets_controller.rb feat(poc): Disable widget based on country (#6658) 2023-03-14 09:09:57 -07:00