"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateAndCreateStripeSdk = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const zod_1 = __importDefault(require("zod"));
const client_1 = __importDefault(require("../api/client"));
const settings_1 = require("../settings");
const validateAndCreateStripeSdk = async ({ fieldsSchema, payload, }) => {
    const { settings: { testModeSecretKey, liveModeSecretKey, mode }, fields, settings, } = (0, extensions_core_1.validate)({
        schema: zod_1.default.object({
            fields: fieldsSchema,
            settings: settings_1.SettingsValidationSchema,
            pathway: zod_1.default.object({ id: zod_1.default.string() }),
            activity: zod_1.default.object({ id: zod_1.default.string() }),
        }),
        payload,
    });
    const { patient, pathway, activity } = payload;
    const stripe = new client_1.default(mode === 'Test' ? testModeSecretKey : (liveModeSecretKey));
    return { stripe, fields, settings, patient, pathway, activity };
};
exports.validateAndCreateStripeSdk = validateAndCreateStripeSdk;
//# sourceMappingURL=validateAndCreateStripeSdk.js.map