mirror of
https://github.com/nestriness/nestri.git
synced 2026-11-30 11:06:13 +02:00
fix(billing): a returning customer's subscription reaches their team
The provider reuses a customer it already has under the same email and
leaves our team id off it, so the subscription arrived with no team,
was acknowledged, and changed nothing: a paid plan never applied. The
checkout now carries the team in its metadata, which the subscription
keeps, and the webhook reads it there when the customer has none. A
paid delivery that still matches no team is logged instead of dropped
in silence.
(cherry picked from commit 1301ff0806)
This commit is contained in:
@@ -84,6 +84,11 @@ export namespace BillingApi {
|
||||
// would have them retry it for days against a thing that will
|
||||
// never become actionable.
|
||||
if (!delivery.teamId || !delivery.standing) {
|
||||
// Said, because a paid subscription that matches no team is
|
||||
// somebody paying for nothing, and a 200 alone hides it.
|
||||
if (delivery.standing?.plan === 'paid') {
|
||||
console.error('a paid subscription matched no team', { type: delivery.type });
|
||||
}
|
||||
return c.json({ data: { applied: false, type: delivery.type } });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user