iachat/enterprise/app/services/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
..
auto_assignment fix: Enforce team boundaries to prevent cross-team assignments (#13353) 2026-02-16 14:39:20 +05:30
billing feat(cloud-billing): cancel subscriptions at period end on deletion mark (#13580) 2026-02-19 11:40:06 +05:30
contacts feat: outbound voice call essentials (#12782) 2025-11-24 17:47:00 -08:00
conversations feat: Add support for search_conversations in copilot (#11520) 2025-05-20 19:22:17 -07:00
message_templates fix: Captain not responding to campaign conversations (#13489) 2026-02-12 10:07:56 +05:30
action_service.rb feat: Conversation update API for sla_policy_id (#8973) 2024-03-14 17:22:32 +05:30
clearbit_lookup_service.rb feat: account onboarding with clearbit (#8857) 2024-02-12 23:21:42 +05:30
search_service.rb feat: Advanced Search Backend (#12917) 2026-01-07 15:30:49 +05:30