2021-10-01 18:07:00 +00:00
|
|
|
import type { BlitzApiHandler } from "blitz";
|
|
|
|
|
2021-10-01 22:19:06 +00:00
|
|
|
import { cancelPaddleSubscription } from "integrations/paddle";
|
|
|
|
import appLogger from "integrations/logger";
|
2021-10-01 18:07:00 +00:00
|
|
|
|
|
|
|
const logger = appLogger.child({ route: "/api/debug/cancel-subscription" });
|
|
|
|
|
|
|
|
const cancelSubscriptionHandler: BlitzApiHandler = async (req, res) => {
|
|
|
|
const { subscriptionId } = req.body;
|
|
|
|
|
|
|
|
logger.debug(`cancelling subscription for subscriptionId="${subscriptionId}"`);
|
2021-10-03 16:38:39 +00:00
|
|
|
await cancelPaddleSubscription({ subscriptionId });
|
2021-10-01 18:07:00 +00:00
|
|
|
logger.debug(`cancelled subscription for subscriptionId="${subscriptionId}"`);
|
|
|
|
|
|
|
|
res.status(200).end();
|
|
|
|
};
|
|
|
|
|
|
|
|
export default cancelSubscriptionHandler;
|