(input: {
event: Stripe.Event;
dataAbstraction: ReturnType<typeof dataAbstraction>;
})
| 46 | } |
| 47 | |
| 48 | async function getUserIdFromEvent(input: { |
| 49 | event: Stripe.Event; |
| 50 | dataAbstraction: ReturnType<typeof dataAbstraction>; |
| 51 | }) { |
| 52 | const userId = await input.dataAbstraction.hget( |
| 53 | 'customer', |
| 54 | (input.event.data.object as any).customer, |
| 55 | 'user-id', |
| 56 | ); |
| 57 | |
| 58 | if (userId == null) { |
| 59 | throw new TRPCError({ |
| 60 | code: 'NOT_FOUND', |
| 61 | message: 'User not found.', |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | return userId; |
| 66 | } |
| 67 | |
| 68 | async function customerSubscriptionUpdated(input: { |
| 69 | event: Stripe.Event; |
no test coverage detected