Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

control: return pseudo phases if no schedule #226

Merged
merged 1 commit into from
Jan 30, 2023
Merged

control: return pseudo phases if no schedule #226

merged 1 commit into from
Jan 30, 2023

Conversation

bmizerany
Copy link
Contributor

@bmizerany bmizerany commented Jan 26, 2023

This prevents lookupPhases from passing empty schedule IDs to Stripe,
which causes an API error that bubbles up to Tier clients.

The lookupPhases method will now return pseudo Phases in place of
schedule phases if no schedule exists for a subscription at the time of
calling. If trialing, the first phase will be the trial phase. If a
cancel is scheduled, a final "cancel" phase will be appended after the
paid phase, if any.

This allows callers to think in Phases/Schedules only and not
worry about what a subscription is as well.

Fixes #221

@bmizerany bmizerany marked this pull request as ready for review January 26, 2023 23:31
@bmizerany bmizerany linked an issue Jan 26, 2023 that may be closed by this pull request
This prevents lookupPhases from passing empty schedule IDs to Stripe,
which causes an API error that bubbles up to Tier clients.

The lookupPhases method will now return pseudo Phases in place of
schedule phases if no schedule exists for a subscription at the time of
calling. If a trialing, the first phase will be the trial phase. If a
cancel is scheduled, a final "cancel" phase will be appended after the
paid phase, if any.

This allows callers to think in Phases/Schedules only and not
worry about what a subscription is as well.

Fixes #221
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lookupPhase raising stripe error
1 participant