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