Skip to content

IA-965 : feat(stripe): dynamic trial period days for checkout sessions

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

Summary

Previously, the checkout session hardcoded a 7-day trial period for all subscriptions. This change makes the trial period dynamic by first checking the value passed in the request, then falling back to fetching the configured trial days from the subscription service based on the gateway price ID.

Changes

StripeCheckoutRequestDTO

  • Added optional trialPeriodDays field to allow callers to explicitly provide a trial period.

StripeServiceImpl#createCheckoutSession

  • Updated trial period resolution logic: uses the value from the request if valid, otherwise calls the subscription service to fetch the trial days associated with the given price.
  • Falls back to no trial if neither source provides a valid value.

SubscriptionServiceClient

  • Added getTrialPeriodDaysByGatewayPriceId(String gatewayPriceId) to fetch trial days from the subscription service.
    • Endpoint: GET /api/subscriptions/by-gateway-price/{gatewayPriceId}/trial-days
  • Removed broken getSubscriptionUuidByInternalId — endpoint /api/subscriptions/{id}/uuid does not exist on the subscription service.
  • Removed broken getSubscriptionByGatewayId — endpoint returns Long, not SubscriptionDTO, causing deserialization failures.
  • Added getSubscriptionsByStatus(StatusType status) utility method.
  • Added updateStatus(String gatewaySubscriptionId, StatusType status) utility method.

Rapports de requête de fusion