"use strict";
/*
Get invoices and receipts for the given user.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const get_invoices_and_receipts_1 = __importDefault(require("@cocalc/server/billing/get-invoices-and-receipts"));
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) {
        return {};
    }
    return await (0, get_invoices_and_receipts_1.default)(account_id);
}
//# sourceMappingURL=get-invoices-and-receipts.js.map