fix: Stop throwing 202 for stripe handler (#20397)
* dont throw - log error * invoice paid * update to warn * Update packages/features/ee/billing/api/webhook/_invoice.paid.ts --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com>
This commit is contained in:
co-authored by
Keith Williams
parent
2aa583bb6d
commit
da47168941
@@ -53,7 +53,7 @@ describe("stripeWebhookHandler", () => {
|
||||
await expect(handler(req)).rejects.toThrow(new HttpCode(500, "Missing STRIPE_WEBHOOK_SECRET"));
|
||||
});
|
||||
|
||||
it("should throw an error if event type is unhandled", async () => {
|
||||
it("should return success false if event type is unhandled", async () => {
|
||||
const { req, res } = createMocks<CustomNextApiRequest, CustomNextApiResponse>({
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -65,9 +65,11 @@ describe("stripeWebhookHandler", () => {
|
||||
(stripe.webhooks.constructEvent as any).mockReturnValueOnce({ type: "unhandled_event" });
|
||||
|
||||
const handler = stripeWebhookHandler({});
|
||||
await expect(handler(req)).rejects.toThrow(
|
||||
new HttpCode(202, "Unhandled Stripe Webhook event type unhandled_event")
|
||||
);
|
||||
const response = await handler(req);
|
||||
expect(response).toEqual({
|
||||
success: false,
|
||||
message: "Unhandled Stripe Webhook event type unhandled_event",
|
||||
});
|
||||
});
|
||||
|
||||
it("should call the appropriate handler for a valid event", async () => {
|
||||
|
||||
Reference in New Issue
Block a user