Skip to content

IA-965: feat: Trial period days, subscription status filter, and idempotent subscription upsert

khadija.elbachouri a demandé de fusionner feature/IA-965 vers develop

MR Description

Summary

This MR introduces several improvements across the subscription and pricing plan modules.


Changes

1. Trial Period Support

  • Added trialPeriodDays field to PlanRequestDTO and PlanUpdateDTO
  • Added getTrialPeriodDaysByGatewayPriceId() to PricingPlanService interface and PricingPlanServiceImpl, resolving trial days from the linked plan
  • Exposed a new endpoint GET /pricing-plans/{gatewayPriceId}/trial-days in SubscriptionController

2. Subscription Status Filtering

  • Added getSubscriptionsByStatus() to SubscriptionService interface and SubscriptionServiceImpl, mapping SubscriptionStatusType to the internal StatusType
  • Added findByStatus() to SubscriptionRepository
  • Exposed a new endpoint GET /subscriptions?status= in SubscriptionController

3. Idempotent Subscription Upsert

  • createSubscription(SubscriptionRequestDTO) now performs an upsert: if the subscription already exists by gatewaySubscriptionId, it updates the status and period dates instead of failing or duplicating — with special logic to preserve TRIALING status against an incoming ACTIVE
  • updateSubscription(String, SubscriptionRequestDTO) now creates the subscription if it doesn't exist, making the update endpoint resilient to out-of-order webhook delivery
  • Added structured logging throughout both methods

Rapports de requête de fusion