"use strict";
/*
Get customer object for the signed in user.  Error if user not signed in.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const get_customer_1 = __importDefault(require("@cocalc/server/billing/get-customer"));
const get_account_1 = __importDefault(require("lib/account/get-account"));
async function handle(req, res) {
    try {
        res.json(await get(req));
    }
    catch (err) {
        res.json({ error: `${err.message}` });
        return;
    }
}
exports.default = handle;
async function get(req) {
    const account_id = await (0, get_account_1.default)(req);
    if (account_id == null) {
        throw Error("must be signed in to get stripe customer information");
    }
    return await (0, get_customer_1.default)(account_id);
}
//# sourceMappingURL=get-customer.js.map