@flink-app/stripe-plugin 2.0.0-alpha.55 → 2.0.0-alpha.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flink/generatedAgents.ts +1 -1
- package/.flink/generatedHandlers.ts +1 -1
- package/.flink/generatedJobs.ts +1 -1
- package/.flink/generatedRepos.ts +1 -1
- package/.flink/generatedTools.ts +1 -1
- package/.flink/start.ts +1 -1
- package/CHANGELOG.md +25 -0
- package/dist/.flink/generatedAgents.js +13 -6
- package/dist/.flink/generatedAgents.js.map +1 -0
- package/dist/.flink/generatedHandlers.js +13 -6
- package/dist/.flink/generatedHandlers.js.map +1 -0
- package/dist/.flink/generatedJobs.js +13 -6
- package/dist/.flink/generatedJobs.js.map +1 -0
- package/dist/.flink/generatedRepos.js +13 -6
- package/dist/.flink/generatedRepos.js.map +1 -0
- package/dist/.flink/generatedTools.js +13 -6
- package/dist/.flink/generatedTools.js.map +1 -0
- package/dist/.flink/schema-manifest.json +234 -0
- package/dist/.flink/schemas/schemas.js +1 -1
- package/dist/.flink/start.js +12 -3
- package/dist/.flink/start.js.map +1 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/src/Ctx.js +3 -1
- package/dist/src/Ctx.js.map +1 -0
- package/dist/src/handlers/HandlebarsTemplateHandler.d.ts +1 -1
- package/dist/src/handlers/HandlebarsTemplateHandler.js +24 -60
- package/dist/src/handlers/HandlebarsTemplateHandler.js.map +1 -0
- package/dist/src/index.js +225 -341
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/customer.js +101 -116
- package/dist/src/lib/customer.js.map +1 -0
- package/dist/src/lib/payment.js +64 -107
- package/dist/src/lib/payment.js.map +1 -0
- package/dist/src/reposx/ConnectSessionRepo.js +12 -24
- package/dist/src/reposx/ConnectSessionRepo.js.map +1 -0
- package/dist/src/schemas/ConnectSession.js +3 -1
- package/dist/src/schemas/ConnectSession.js.map +1 -0
- package/dist/src/schemas/createStripeCustomerOptions.js +3 -1
- package/dist/src/schemas/createStripeCustomerOptions.js.map +1 -0
- package/dist/src/schemas/customer/connectToStripeConnectOptions.js +3 -1
- package/dist/src/schemas/customer/connectToStripeConnectOptions.js.map +1 -0
- package/dist/src/schemas/customer/hasPaymentMethodOptions.js +3 -1
- package/dist/src/schemas/customer/hasPaymentMethodOptions.js.map +1 -0
- package/dist/src/schemas/customer/setupCardOptions.js +3 -1
- package/dist/src/schemas/customer/setupCardOptions.js.map +1 -0
- package/dist/src/schemas/customer/setupCardResponse.js +3 -1
- package/dist/src/schemas/customer/setupCardResponse.js.map +1 -0
- package/dist/src/schemas/customer/setupCardTokenOptions.js +3 -1
- package/dist/src/schemas/customer/setupCardTokenOptions.js.map +1 -0
- package/dist/src/schemas/payment/capturePaymentOptions.js +3 -1
- package/dist/src/schemas/payment/capturePaymentOptions.js.map +1 -0
- package/dist/src/schemas/payment/confirmPaymentOptions.js +3 -1
- package/dist/src/schemas/payment/confirmPaymentOptions.js.map +1 -0
- package/dist/src/schemas/payment/confirmPaymentResponse.js +3 -1
- package/dist/src/schemas/payment/confirmPaymentResponse.js.map +1 -0
- package/dist/src/schemas/payment/confirmPaymentTokenOptions.js +3 -1
- package/dist/src/schemas/payment/confirmPaymentTokenOptions.js.map +1 -0
- package/dist/src/schemas/payment/createPaymentResponse.js +3 -1
- package/dist/src/schemas/payment/createPaymentResponse.js.map +1 -0
- package/dist/src/schemas/stripeAPIToken.js +3 -1
- package/dist/src/schemas/stripeAPIToken.js.map +1 -0
- package/dist/src/schemas/stripePluginOptions.js +3 -1
- package/dist/src/schemas/stripePluginOptions.js.map +1 -0
- package/dist/src/stripeAPI.js +87 -154
- package/dist/src/stripeAPI.js.map +1 -0
- package/dist/src/stripePluginContext.js +3 -1
- package/dist/src/stripePluginContext.js.map +1 -0
- package/dist/src/templates/connect-done.js +23 -3
- package/dist/src/templates/connect-done.js.map +1 -0
- package/dist/src/templates/error.js +10 -3
- package/dist/src/templates/error.js.map +1 -0
- package/dist/src/templates/master.js +29 -3
- package/dist/src/templates/master.js.map +1 -0
- package/dist/src/templates/pay-done.d.ts +1 -0
- package/dist/src/templates/pay-done.js +24 -0
- package/dist/src/templates/pay-done.js.map +1 -0
- package/dist/src/templates/pay-enter-card.js +95 -3
- package/dist/src/templates/pay-enter-card.js.map +1 -0
- package/dist/src/templates/pay-select-card.js +79 -3
- package/dist/src/templates/pay-select-card.js.map +1 -0
- package/dist/src/templates/setup-card.js +102 -3
- package/dist/src/templates/setup-card.js.map +1 -0
- package/dist/src/templates/setup-done.js +23 -3
- package/dist/src/templates/setup-done.js.map +1 -0
- package/dist/src/templates/style.js +144 -3
- package/dist/src/templates/style.js.map +1 -0
- package/package.json +3 -3
- package/.flink/schemas/schemas.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/index.ts"],"sourcesContent":["import { FlinkApp, FlinkPlugin, log } from \"@flink-app/flink\";\nimport { Stripe } from \"stripe\";\nimport { HandlebarsTemplateHandler } from \"./handlers/HandlebarsTemplateHandler\";\nimport { stripePluginOptions } from \"./schemas/stripePluginOptions\";\nimport { StripeAPI } from \"./stripeAPI\";\nexport * from \"./stripePluginContext\";\n\nimport { connectDoneTemplate } from \"./templates/connect-done\";\nimport { errorTemplate } from \"./templates/error\";\nimport { masterTemplate } from \"./templates/master\";\nimport { payEnterCardTemplate } from \"./templates/pay-enter-card\";\nimport { paySelectCardTemplate } from \"./templates/pay-select-card\";\nimport { setupCardTemplate } from \"./templates/setup-card\";\nimport { setupDoneTemplate } from \"./templates/setup-done\";\nimport { styleTemplate } from \"./templates/style\";\n\nimport { verify } from \"jsonwebtoken\";\nimport connectSessionRepo from \"./reposx/ConnectSessionRepo\";\nimport { setupCardTokenOptions } from \"./schemas/customer/setupCardTokenOptions\";\nimport { confirmPaymentTokenOptions } from \"./schemas/payment/confirmPaymentTokenOptions\";\nimport { stripeAPIToken } from \"./schemas/stripeAPIToken\";\nexport const stripePlugin = (options: stripePluginOptions): FlinkPlugin => {\n if (options.paymentCallback == null) options.paymentCallback = () => {};\n if (options.stripeConnectCallback == null) options.stripeConnectCallback = () => {};\n\n const stripeAPI = new StripeAPI(options);\n\n const templates = {\n master: options.templates?.master || masterTemplate,\n style: options.templates?.style || styleTemplate,\n setupCard: options.templates?.setupCard || setupCardTemplate,\n setupDone: options.templates?.setupDone || setupDoneTemplate,\n error: options.templates?.error || errorTemplate,\n paySelectCard: options.templates?.paySelectCard || paySelectCardTemplate,\n payEnterCard: options.templates?.payEnterCard || payEnterCardTemplate,\n connectDone: options.templates?.connectDone || connectDoneTemplate,\n };\n return {\n id: \"stripePlugin\",\n init: (app) => init(app, options),\n ctx: {\n stripeAPI,\n templates,\n },\n };\n};\n\nfunction init(app: FlinkApp<any>, options: stripePluginOptions) {\n if (options.baseUrl == null) options.baseUrl = \"/stripe\";\n\n log.info(\"Registered route GET \" + options.baseUrl + \"/customer/setup-card/:token\");\n app.expressApp?.get(options.baseUrl + \"/customer/setup-card/:token\", (req: any, res: any) => {\n try {\n const tokenData: stripeAPIToken<setupCardTokenOptions> = verify(req.params.token, options.JTW_TOKEN) as stripeAPIToken<setupCardTokenOptions>;\n if (tokenData.type != \"setup_card\") {\n throw \"Invalid token type\";\n }\n HandlebarsTemplateHandler(\n app.ctx.plugins.stripePlugin.templates.master,\n app.ctx.plugins.stripePlugin.templates.style,\n app.ctx.plugins.stripePlugin.templates.setupCard,\n {\n setupDescription: options.phrases?.setupDescription,\n logo: options.logo,\n stripePublishableKey: options.stripePublishableKey,\n client_secret: tokenData.options.client_secret,\n baseUrl: options.baseUrl,\n setupButtonText: options.phrases?.setupButtonText || \"Spara\",\n },\n res\n );\n } catch (ex) {\n log.error(ex);\n res.redirect(options.baseUrl + \"/error\");\n return;\n }\n });\n\n log.info(\"Registered route GET \" + options.baseUrl + \"/customer/setup-card-done\");\n\n app.expressApp?.get(options.baseUrl + \"/customer/setup-card-done/\", (req: any, res: any) => {\n try {\n HandlebarsTemplateHandler(\n app.ctx.plugins.stripePlugin.templates.master,\n app.ctx.plugins.stripePlugin.templates.style,\n app.ctx.plugins.stripePlugin.templates.setupDone,\n {\n redirectUrl: options.redirectUrl,\n message: options.phrases?.setupDoneMessage || \"Kortet har sparats.\",\n },\n res\n );\n } catch (ex) {\n log.error(ex);\n res.redirect(options.baseUrl + \"/error\");\n return;\n }\n });\n\n app.expressApp?.get(options.baseUrl + \"/error\", (req: any, res: any) => {\n try {\n HandlebarsTemplateHandler(\n app.ctx.plugins.stripePlugin.templates.master,\n app.ctx.plugins.stripePlugin.templates.style,\n app.ctx.plugins.stripePlugin.templates.error,\n {},\n res\n );\n } catch (ex) {\n log.error(ex);\n res.redirect(options.baseUrl + \"/\");\n return;\n }\n });\n\n log.info(\"Registered route GET \" + options.baseUrl + \"/payment/confirm/:token\");\n app.expressApp?.get(options.baseUrl + \"/payment/confirm/:token\", async (req: any, res: any) => {\n try {\n const tokenData = verify(req.params.token, options.JTW_TOKEN) as stripeAPIToken<confirmPaymentTokenOptions>;\n if (tokenData.type != \"payment\") {\n throw \"Invalid token type\";\n }\n const stripe = app.ctx.plugins.stripePlugin.stripeAPI.stripe as Stripe;\n const paymentIntent = await stripe.paymentIntents.retrieve(tokenData.options.paymentIntentId);\n const paymentMethods = await stripe.paymentMethods.list({\n customer: paymentIntent.customer?.toString(),\n type: \"card\",\n });\n if (paymentMethods.data.length == 0) {\n res.redirect(options.baseUrl + \"/payment/enter-card/\" + req.params.token);\n } else {\n res.redirect(options.baseUrl + \"/payment/select-card/\" + req.params.token);\n }\n } catch (ex) {\n log.error(ex);\n res.redirect(options.baseUrl + \"/error\");\n return;\n }\n });\n\n log.info(\"Registered route GET \" + options.baseUrl + \"/payment/select-card/:token\");\n\n app.expressApp?.get(options.baseUrl + \"/payment/select-card/:token\", async (req: any, res: any) => {\n try {\n const tokenData = verify(req.params.token, options.JTW_TOKEN) as stripeAPIToken<confirmPaymentTokenOptions>;\n if (tokenData.type != \"payment\") {\n throw \"Invalid token type\";\n }\n const stripe = app.ctx.plugins.stripePlugin.stripeAPI.stripe as Stripe;\n const paymentIntent = await stripe.paymentIntents.retrieve(tokenData.options.paymentIntentId);\n const paymentMethods = await stripe.paymentMethods.list({\n customer: paymentIntent.customer?.toString(),\n type: \"card\",\n });\n if (paymentMethods.data.length == 0) {\n res.redirect(options.baseUrl + \"/payment/enter-card/\" + req.params.token);\n }\n\n const ctx = {\n card: paymentMethods.data[0].card,\n paymentSelectCardPayButtonText: options.phrases?.paymentSelectCardPayButtonText || \"Betala\",\n paymentSelectCardChangeCardButtonText: options.phrases?.paymentSelectCardChangeCardButtonText || \"Byt kort\",\n publishableKey: options.stripePublishableKey,\n token: req.params.token,\n baseUrl: options.baseUrl,\n logo: options.logo,\n client_secrect: paymentIntent.client_secret,\n price: (paymentIntent.amount / 100).toFixed(2) + \" \" + paymentIntent.currency.toUpperCase(),\n description: paymentIntent.description,\n };\n\n HandlebarsTemplateHandler(\n app.ctx.plugins.stripePlugin.templates.master,\n app.ctx.plugins.stripePlugin.templates.style,\n app.ctx.plugins.stripePlugin.templates.paySelectCard,\n ctx,\n res\n );\n } catch (ex) {\n log.error(ex);\n res.redirect(options.baseUrl + \"/error\");\n return;\n }\n });\n\n log.info(\"Registered route GET \" + options.baseUrl + \"/payment/enter-card/:token\");\n app.expressApp?.get(options.baseUrl + \"/payment/enter-card/:token\", async (req: any, res: any) => {\n try {\n const tokenData = verify(req.params.token, options.JTW_TOKEN) as stripeAPIToken<confirmPaymentTokenOptions>;\n if (tokenData.type != \"payment\") {\n throw \"Invalid token type\";\n }\n const stripe = app.ctx.plugins.stripePlugin.stripeAPI.stripe as Stripe;\n const paymentIntent = await stripe.paymentIntents.retrieve(tokenData.options.paymentIntentId);\n const paymentMethods = await stripe.paymentMethods.list({\n customer: paymentIntent.customer?.toString(),\n type: \"card\",\n });\n for (var x in paymentMethods.data) {\n const pi = paymentMethods.data[x];\n await stripe.paymentMethods.detach(pi.id);\n }\n\n const ctx = {\n paymentEnterCardPayButtonText: options.phrases?.paymentEnterCardPayButtonText || \"Betala\",\n publishableKey: options.stripePublishableKey,\n token: req.params.token,\n baseUrl: options.baseUrl,\n logo: options.logo,\n client_secrect: paymentIntent.client_secret,\n price: (paymentIntent.amount / 100).toFixed(2) + \" \" + paymentIntent.currency.toUpperCase(),\n description: paymentIntent.description,\n };\n\n HandlebarsTemplateHandler(\n app.ctx.plugins.stripePlugin.templates.master,\n app.ctx.plugins.stripePlugin.templates.style,\n app.ctx.plugins.stripePlugin.templates.payEnterCard,\n ctx,\n res\n );\n } catch (ex) {\n log.error(ex);\n res.redirect(options.baseUrl + \"/error\");\n return;\n }\n });\n\n log.info(\"Registered route GET \" + options.baseUrl + \"/callback/:event\");\n app.expressApp?.post(options.baseUrl + \"/callback/:event\", async (req: any, res: any) => {\n if (req.params.event == \"charge.succeeded\") {\n const paymentIntentId = req.body?.data?.object?.payment_intent;\n if (paymentIntentId == null) {\n res.status(400).send(\"Bad request\");\n return;\n }\n const stripe = app.ctx.plugins.stripePlugin.stripeAPI.stripe as Stripe;\n try {\n const paymentIntent = await stripe.paymentIntents.retrieve(paymentIntentId);\n if (paymentIntent == null) {\n res.status(400).send(\"Bad request\");\n return;\n }\n if (paymentIntent.status == \"succeeded\" || paymentIntent.status == \"requires_capture\") {\n try {\n options.paymentCallback!(paymentIntent.id, paymentIntent.status);\n } catch (ex) {\n log.error(\"paymentCallback:\" + ex);\n }\n }\n } catch (ex) {\n log.error(ex);\n res.status(500).send(\"Internal error\");\n }\n }\n res.status(200).send(\"Completed\");\n });\n\n log.info(\"Registered route GET \" + options.baseUrl + \"/connect\");\n app.expressApp?.get(options.baseUrl + \"/connect\", async (req: any, res: any) => {\n const { code, state } = req.query;\n if (code && state) {\n const stripe = app.ctx.plugins.stripePlugin.stripeAPI.stripe as Stripe;\n const token = await stripe.oauth.token({\n grant_type: \"authorization_code\",\n code: code.toString(),\n });\n\n const repo = app.ctx.repos.connectsessionRepo as connectSessionRepo;\n const session = await repo.getById(state.toString());\n\n try {\n options.stripeConnectCallback!(session!.userId, token.stripe_user_id!);\n\n HandlebarsTemplateHandler(\n app.ctx.plugins.stripePlugin.templates.master,\n app.ctx.plugins.stripePlugin.templates.style,\n app.ctx.plugins.stripePlugin.templates.connectDone,\n {\n redirectUrl: options.redirectUrl,\n message: options.phrases?.connectDoneMessage || \"Kontot har kopplats till Stripe.\",\n },\n res\n );\n } catch (ex) {\n log.error(\"paymentCallback:\" + ex);\n res.redirect(options.baseUrl + \"/error\");\n }\n } else {\n res.redirect(options.baseUrl + \"/error\");\n }\n });\n\n if (app.db != null) {\n app.addRepo(\"connectsessionRepo\", new connectSessionRepo(\"ConnectSessionRepo\", app.db));\n }\n\n app.ctx.plugins.stripePlugin.stripeAPI.config.setRepo(app.ctx.repos.connectsessionRepo);\n}\n"],"names":["stripePlugin","options","paymentCallback","stripeConnectCallback","stripeAPI","StripeAPI","templates","master","masterTemplate","style","styleTemplate","setupCard","setupCardTemplate","setupDone","setupDoneTemplate","error","errorTemplate","paySelectCard","paySelectCardTemplate","payEnterCard","payEnterCardTemplate","connectDone","connectDoneTemplate","id","init","app","ctx","baseUrl","log","info","expressApp","get","req","res","tokenData","verify","params","token","JTW_TOKEN","type","HandlebarsTemplateHandler","plugins","setupDescription","phrases","logo","stripePublishableKey","client_secret","setupButtonText","ex","redirect","redirectUrl","message","setupDoneMessage","paymentIntent","stripe","paymentIntents","retrieve","paymentIntentId","paymentMethods","list","customer","toString","data","length","card","paymentSelectCardPayButtonText","paymentSelectCardChangeCardButtonText","publishableKey","client_secrect","price","amount","toFixed","currency","toUpperCase","description","x","pi","detach","paymentEnterCardPayButtonText","post","event","body","object","payment_intent","status","send","code","state","query","oauth","grant_type","repo","repos","connectsessionRepo","session","getById","userId","stripe_user_id","connectDoneMessage","db","addRepo","connectSessionRepo","config","setRepo"],"mappings":";;;;+BAqBaA;;;eAAAA;;;uBArB8B;2CAED;2BAEhB;qBACZ;6BAEsB;u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7
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get createStripeCustomer () {
|
|
13
|
+
return createStripeCustomer;
|
|
14
|
+
},
|
|
15
|
+
get hasPaymentMethod () {
|
|
16
|
+
return hasPaymentMethod;
|
|
17
|
+
},
|
|
18
|
+
get setupCardRegistration () {
|
|
19
|
+
return setupCardRegistration;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _jsonwebtoken = require("jsonwebtoken");
|
|
23
|
+
function _define_property(obj, key, value) {
|
|
24
|
+
if (key in obj) {
|
|
25
|
+
Object.defineProperty(obj, key, {
|
|
26
|
+
value: value,
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
obj[key] = value;
|
|
33
|
+
}
|
|
34
|
+
return obj;
|
|
35
|
+
}
|
|
36
|
+
function _object_spread(target) {
|
|
37
|
+
for(var i = 1; i < arguments.length; i++){
|
|
38
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
39
|
+
var ownKeys = Object.keys(source);
|
|
40
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
41
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
42
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
43
|
+
}));
|
|
8
44
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
45
|
+
ownKeys.forEach(function(key) {
|
|
46
|
+
_define_property(target, key, source[key]);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return target;
|
|
50
|
+
}
|
|
51
|
+
function ownKeys(object, enumerableOnly) {
|
|
52
|
+
var keys = Object.keys(object);
|
|
53
|
+
if (Object.getOwnPropertySymbols) {
|
|
54
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
55
|
+
if (enumerableOnly) {
|
|
56
|
+
symbols = symbols.filter(function(sym) {
|
|
57
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
keys.push.apply(keys, symbols);
|
|
61
|
+
}
|
|
62
|
+
return keys;
|
|
63
|
+
}
|
|
64
|
+
function _object_spread_props(target, source) {
|
|
65
|
+
source = source != null ? source : {};
|
|
66
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
67
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
68
|
+
} else {
|
|
69
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
70
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return target;
|
|
74
|
+
}
|
|
75
|
+
const createStripeCustomer = async (stripe, options)=>{
|
|
76
|
+
const resp = await stripe.customers.create(options);
|
|
77
|
+
return resp.id;
|
|
12
78
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
79
|
+
const hasPaymentMethod = async (stripe, options)=>{
|
|
80
|
+
const paymentMethods = await stripe.paymentMethods.list({
|
|
81
|
+
customer: options.stripeCustomerId,
|
|
82
|
+
type: "card"
|
|
20
83
|
});
|
|
84
|
+
return paymentMethods.data.length > 0;
|
|
21
85
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.setupCardRegistration = exports.hasPaymentMethod = exports.createStripeCustomer = void 0;
|
|
51
|
-
var jsonwebtoken_1 = require("jsonwebtoken");
|
|
52
|
-
var createStripeCustomer = function (stripe, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
-
var resp;
|
|
54
|
-
return __generator(this, function (_a) {
|
|
55
|
-
switch (_a.label) {
|
|
56
|
-
case 0: return [4 /*yield*/, stripe.customers.create(options)];
|
|
57
|
-
case 1:
|
|
58
|
-
resp = _a.sent();
|
|
59
|
-
return [2 /*return*/, resp.id];
|
|
60
|
-
}
|
|
86
|
+
const setupCardRegistration = async (stripe, JWT_TOKEN, options)=>{
|
|
87
|
+
//Remove old payment methods if they exists
|
|
88
|
+
const paymentMethods = await stripe.paymentMethods.list({
|
|
89
|
+
customer: options.stripeCustomerId,
|
|
90
|
+
type: "card"
|
|
61
91
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
case 0: return [4 /*yield*/, stripe.paymentMethods.list({
|
|
69
|
-
customer: options.stripeCustomerId,
|
|
70
|
-
type: "card",
|
|
71
|
-
})];
|
|
72
|
-
case 1:
|
|
73
|
-
paymentMethods = _a.sent();
|
|
74
|
-
return [2 /*return*/, paymentMethods.data.length > 0];
|
|
75
|
-
}
|
|
92
|
+
for(var x in paymentMethods.data){
|
|
93
|
+
const pi = paymentMethods.data[x];
|
|
94
|
+
await stripe.paymentMethods.detach(pi.id);
|
|
95
|
+
}
|
|
96
|
+
const intent = await stripe.setupIntents.create({
|
|
97
|
+
customer: options.stripeCustomerId
|
|
76
98
|
});
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
var setupCardRegistration = function (stripe, JWT_TOKEN, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
-
var paymentMethods, _a, _b, _c, _i, x, pi, intent, tokenOptions, tokenData, token;
|
|
81
|
-
return __generator(this, function (_d) {
|
|
82
|
-
switch (_d.label) {
|
|
83
|
-
case 0: return [4 /*yield*/, stripe.paymentMethods.list({
|
|
84
|
-
customer: options.stripeCustomerId,
|
|
85
|
-
type: "card",
|
|
86
|
-
})];
|
|
87
|
-
case 1:
|
|
88
|
-
paymentMethods = _d.sent();
|
|
89
|
-
_a = paymentMethods.data;
|
|
90
|
-
_b = [];
|
|
91
|
-
for (_c in _a)
|
|
92
|
-
_b.push(_c);
|
|
93
|
-
_i = 0;
|
|
94
|
-
_d.label = 2;
|
|
95
|
-
case 2:
|
|
96
|
-
if (!(_i < _b.length)) return [3 /*break*/, 5];
|
|
97
|
-
_c = _b[_i];
|
|
98
|
-
if (!(_c in _a)) return [3 /*break*/, 4];
|
|
99
|
-
x = _c;
|
|
100
|
-
pi = paymentMethods.data[x];
|
|
101
|
-
return [4 /*yield*/, stripe.paymentMethods.detach(pi.id)];
|
|
102
|
-
case 3:
|
|
103
|
-
_d.sent();
|
|
104
|
-
_d.label = 4;
|
|
105
|
-
case 4:
|
|
106
|
-
_i++;
|
|
107
|
-
return [3 /*break*/, 2];
|
|
108
|
-
case 5: return [4 /*yield*/, stripe.setupIntents.create({
|
|
109
|
-
customer: options.stripeCustomerId,
|
|
110
|
-
})];
|
|
111
|
-
case 6:
|
|
112
|
-
intent = _d.sent();
|
|
113
|
-
tokenOptions = __assign(__assign({}, options), { client_secret: intent.client_secret });
|
|
114
|
-
intent.client_secret;
|
|
115
|
-
tokenData = {
|
|
116
|
-
type: "setup_card",
|
|
117
|
-
options: tokenOptions,
|
|
118
|
-
};
|
|
119
|
-
token = (0, jsonwebtoken_1.sign)(tokenData, JWT_TOKEN);
|
|
120
|
-
return [2 /*return*/, token];
|
|
121
|
-
}
|
|
99
|
+
const tokenOptions = _object_spread_props(_object_spread({}, options), {
|
|
100
|
+
client_secret: intent.client_secret
|
|
122
101
|
});
|
|
123
|
-
|
|
124
|
-
|
|
102
|
+
intent.client_secret;
|
|
103
|
+
const tokenData = {
|
|
104
|
+
type: "setup_card",
|
|
105
|
+
options: tokenOptions
|
|
106
|
+
};
|
|
107
|
+
const token = (0, _jsonwebtoken.sign)(tokenData, JWT_TOKEN);
|
|
108
|
+
return token;
|
|
109
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/lib/customer.ts"],"sourcesContent":["import { hasPaymentMethodOptions } from \"../schemas/customer/hasPaymentMethodOptions\";\nimport { setupCardOptions } from \"../schemas/customer/setupCardOptions\";\nimport { setupCardTokenOptions } from \"../schemas/customer/setupCardTokenOptions\";\n\nimport { sign } from \"jsonwebtoken\";\nimport { Stripe } from \"stripe\";\nimport { stripeAPIToken } from \"../schemas/stripeAPIToken\";\n\nexport const createStripeCustomer = async (stripe: Stripe, options: Stripe.CustomerCreateParams): Promise<string> => {\n const resp = await stripe.customers.create(options);\n return resp.id;\n};\n\nexport const hasPaymentMethod = async (stripe: Stripe, options: hasPaymentMethodOptions): Promise<boolean> => {\n const paymentMethods = await stripe.paymentMethods.list({\n customer: options.stripeCustomerId,\n type: \"card\",\n });\n return paymentMethods.data.length > 0;\n};\n\nexport const setupCardRegistration = async (stripe: Stripe, JWT_TOKEN: string, options: setupCardOptions): Promise<string> => {\n //Remove old payment methods if they exists\n const paymentMethods = await stripe.paymentMethods.list({\n customer: options.stripeCustomerId,\n type: \"card\",\n });\n\n for (var x in paymentMethods.data) {\n const pi = paymentMethods.data[x];\n await stripe.paymentMethods.detach(pi.id);\n }\n\n const intent = await stripe.setupIntents.create({\n customer: options.stripeCustomerId,\n });\n\n const tokenOptions: setupCardTokenOptions = {\n ...options,\n client_secret: intent.client_secret!,\n };\n intent.client_secret;\n\n const tokenData: stripeAPIToken<setupCardTokenOptions> = {\n type: \"setup_card\",\n options: tokenOptions,\n };\n const token = sign(tokenData, JWT_TOKEN);\n return token;\n};\n"],"names":["createStripeCustomer","hasPaymentMethod","setupCardRegistration","stripe","options","resp","customers","create","id","paymentMethods","list","customer","stripeCustomerId","type","data","length","JWT_TOKEN","x","pi","detach","intent","setupIntents","tokenOptions","client_secret","tokenData","token","sign"],"mappings":";;;;;;;;;;;QAQaA;eAAAA;;QAKAC;eAAAA;;QAQAC;eAAAA;;;8BAjBQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAId,MAAMF,uBAAuB,OAAOG,QAAgBC;IACvD,MAAMC,OAAO,MAAMF,OAAOG,SAAS,CAACC,MAAM,CAACH;IAC3C,OAAOC,KAAKG,EAAE;AAClB;AAEO,MAAMP,mBAAmB,OAAOE,QAAgBC;IACnD,MAAMK,iBAAiB,MAAMN,OAAOM,cAAc,CAACC,IAAI,CAAC;QACpDC,UAAUP,QAAQQ,gBAAgB;QAClCC,MAAM;IACV;IACA,OAAOJ,eAAeK,IAAI,CAACC,MAAM,GAAG;AACxC;AAEO,MAAMb,wBAAwB,OAAOC,QAAgBa,WAAmBZ;IAC3E,2CAA2C;IAC3C,MAAMK,iBAAiB,MAAMN,OAAOM,cAAc,CAACC,IAAI,CAAC;QACpDC,UAAUP,QAAQQ,gBAAgB;QAClCC,MAAM;IACV;IAEA,IAAK,IAAII,KAAKR,eAAeK,IAAI,CAAE;QAC/B,MAAMI,KAAKT,eAAeK,IAAI,CAACG,EAAE;QACjC,MAAMd,OAAOM,cAAc,CAACU,MAAM,CAACD,GAAGV,EAAE;IAC5C;IAEA,MAAMY,SAAS,MAAMjB,OAAOkB,YAAY,CAACd,MAAM,CAAC;QAC5CI,UAAUP,QAAQQ,gBAAgB;IACtC;IAEA,MAAMU,eAAsC,wCACrClB;QACHmB,eAAeH,OAAOG,aAAa;;IAEvCH,OAAOG,aAAa;IAEpB,MAAMC,YAAmD;QACrDX,MAAM;QACNT,SAASkB;IACb;IACA,MAAMG,QAAQC,IAAAA,kBAAI,EAACF,WAAWR;IAC9B,OAAOS;AACX"}
|
package/dist/src/lib/payment.js
CHANGED
|
@@ -1,113 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get confirmPayment () {
|
|
13
|
+
return confirmPayment;
|
|
14
|
+
},
|
|
15
|
+
get createPaymentIntent () {
|
|
16
|
+
return createPaymentIntent;
|
|
36
17
|
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
case 1:
|
|
47
|
-
paymentIntent = _a.sent();
|
|
48
|
-
tokenData = {
|
|
49
|
-
type: "payment",
|
|
50
|
-
options: {
|
|
51
|
-
paymentIntentId: paymentIntent.id,
|
|
52
|
-
client_secret: paymentIntent.client_secret,
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
token = (0, jsonwebtoken_1.sign)(tokenData, JWT_TOKEN);
|
|
56
|
-
return [2 /*return*/, {
|
|
57
|
-
paymentIntentId: paymentIntent.id,
|
|
58
|
-
token: token,
|
|
59
|
-
}];
|
|
18
|
+
});
|
|
19
|
+
const _jsonwebtoken = require("jsonwebtoken");
|
|
20
|
+
const createPaymentIntent = async (stripe, JWT_TOKEN, options)=>{
|
|
21
|
+
const paymentIntent = await stripe.paymentIntents.create(options);
|
|
22
|
+
const tokenData = {
|
|
23
|
+
type: "payment",
|
|
24
|
+
options: {
|
|
25
|
+
paymentIntentId: paymentIntent.id,
|
|
26
|
+
client_secret: paymentIntent.client_secret
|
|
60
27
|
}
|
|
28
|
+
};
|
|
29
|
+
const token = (0, _jsonwebtoken.sign)(tokenData, JWT_TOKEN);
|
|
30
|
+
return {
|
|
31
|
+
paymentIntentId: paymentIntent.id,
|
|
32
|
+
token
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const confirmPayment = async (stripe, JWT_TOKEN, options)=>{
|
|
36
|
+
var _paymentIntent_customer;
|
|
37
|
+
const paymentIntent = await stripe.paymentIntents.retrieve(options.paymentIntentId);
|
|
38
|
+
const paymentMethods = await stripe.paymentMethods.list({
|
|
39
|
+
customer: (_paymentIntent_customer = paymentIntent.customer) === null || _paymentIntent_customer === void 0 ? void 0 : _paymentIntent_customer.toString(),
|
|
40
|
+
type: "card"
|
|
61
41
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return __generator(this, function (_b) {
|
|
68
|
-
switch (_b.label) {
|
|
69
|
-
case 0: return [4 /*yield*/, stripe.paymentIntents.retrieve(options.paymentIntentId)];
|
|
70
|
-
case 1:
|
|
71
|
-
paymentIntent = _b.sent();
|
|
72
|
-
return [4 /*yield*/, stripe.paymentMethods.list({
|
|
73
|
-
customer: (_a = paymentIntent.customer) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
74
|
-
type: "card",
|
|
75
|
-
})];
|
|
76
|
-
case 2:
|
|
77
|
-
paymentMethods = _b.sent();
|
|
78
|
-
if (paymentMethods.data.length == 0) {
|
|
79
|
-
throw "Payment method is missing";
|
|
80
|
-
}
|
|
81
|
-
return [4 /*yield*/, stripe.paymentIntents.confirm(options.paymentIntentId, {
|
|
82
|
-
payment_method: paymentMethods.data[0].id,
|
|
83
|
-
})];
|
|
84
|
-
case 3:
|
|
85
|
-
resp = _b.sent();
|
|
86
|
-
captured = false;
|
|
87
|
-
confirmed = false;
|
|
88
|
-
token = undefined;
|
|
89
|
-
if (resp.status == "requires_capture" || resp.status == "succeeded") {
|
|
90
|
-
confirmed = true;
|
|
91
|
-
if (resp.status == "succeeded")
|
|
92
|
-
captured = true;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
tokenData = {
|
|
96
|
-
type: "payment",
|
|
97
|
-
options: {
|
|
98
|
-
paymentIntentId: options.paymentIntentId,
|
|
99
|
-
client_secret: paymentIntent.client_secret,
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
token = (0, jsonwebtoken_1.sign)(tokenData, JWT_TOKEN);
|
|
103
|
-
}
|
|
104
|
-
return [2 /*return*/, {
|
|
105
|
-
paymentIntentId: options.paymentIntentId,
|
|
106
|
-
captured: captured,
|
|
107
|
-
confirmed: confirmed,
|
|
108
|
-
token: token,
|
|
109
|
-
}];
|
|
110
|
-
}
|
|
42
|
+
if (paymentMethods.data.length == 0) {
|
|
43
|
+
throw "Payment method is missing";
|
|
44
|
+
}
|
|
45
|
+
const resp = await stripe.paymentIntents.confirm(options.paymentIntentId, {
|
|
46
|
+
payment_method: paymentMethods.data[0].id
|
|
111
47
|
});
|
|
112
|
-
|
|
113
|
-
|
|
48
|
+
let captured = false;
|
|
49
|
+
let confirmed = false;
|
|
50
|
+
let token = undefined;
|
|
51
|
+
if (resp.status == "requires_capture" || resp.status == "succeeded") {
|
|
52
|
+
confirmed = true;
|
|
53
|
+
if (resp.status == "succeeded") captured = true;
|
|
54
|
+
} else {
|
|
55
|
+
const tokenData = {
|
|
56
|
+
type: "payment",
|
|
57
|
+
options: {
|
|
58
|
+
paymentIntentId: options.paymentIntentId,
|
|
59
|
+
client_secret: paymentIntent.client_secret
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
token = (0, _jsonwebtoken.sign)(tokenData, JWT_TOKEN);
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
paymentIntentId: options.paymentIntentId,
|
|
66
|
+
captured,
|
|
67
|
+
confirmed,
|
|
68
|
+
token
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/lib/payment.ts"],"sourcesContent":["import { Stripe } from \"stripe\";\nimport { confirmPaymentOptions } from \"../schemas/payment/confirmPaymentOptions\";\nimport { confirmPaymentResponse } from \"../schemas/payment/confirmPaymentResponse\";\nimport { confirmPaymentTokenOptions } from \"../schemas/payment/confirmPaymentTokenOptions\";\nimport { createPaymentResponse } from \"../schemas/payment/createPaymentResponse\";\n\nimport { stripeAPIToken } from \"../schemas/stripeAPIToken\";\nimport { sign } from \"jsonwebtoken\";\n\nexport const createPaymentIntent = async (stripe: Stripe, JWT_TOKEN: string, options: Stripe.PaymentIntentCreateParams): Promise<createPaymentResponse> => {\n const paymentIntent = await stripe.paymentIntents.create(options);\n\n const tokenData: stripeAPIToken<confirmPaymentTokenOptions> = {\n type: \"payment\",\n options: {\n paymentIntentId: paymentIntent.id,\n client_secret: paymentIntent.client_secret!,\n },\n };\n const token = sign(tokenData, JWT_TOKEN);\n\n return {\n paymentIntentId: paymentIntent.id,\n token,\n };\n};\n\nexport const confirmPayment = async (stripe: Stripe, JWT_TOKEN: string, options: confirmPaymentOptions): Promise<confirmPaymentResponse> => {\n const paymentIntent = await stripe.paymentIntents.retrieve(options.paymentIntentId);\n const paymentMethods = await stripe.paymentMethods.list({\n customer: paymentIntent.customer?.toString(),\n type: \"card\",\n });\n\n if (paymentMethods.data.length == 0) {\n throw \"Payment method is missing\";\n }\n\n const resp = await stripe.paymentIntents.confirm(options.paymentIntentId, {\n payment_method: paymentMethods.data[0].id,\n });\n let captured = false;\n let confirmed = false;\n let token = undefined;\n if (resp.status == \"requires_capture\" || resp.status == \"succeeded\") {\n confirmed = true;\n if (resp.status == \"succeeded\") captured = true;\n } else {\n const tokenData: stripeAPIToken<confirmPaymentTokenOptions> = {\n type: \"payment\",\n options: {\n paymentIntentId: options.paymentIntentId,\n client_secret: paymentIntent.client_secret!,\n },\n };\n token = sign(tokenData, JWT_TOKEN);\n }\n return {\n paymentIntentId: options.paymentIntentId,\n captured,\n confirmed,\n token,\n };\n};\n"],"names":["confirmPayment","createPaymentIntent","stripe","JWT_TOKEN","options","paymentIntent","paymentIntents","create","tokenData","type","paymentIntentId","id","client_secret","token","sign","retrieve","paymentMethods","list","customer","toString","data","length","resp","confirm","payment_method","captured","confirmed","undefined","status"],"mappings":";;;;;;;;;;;QA2BaA;eAAAA;;QAlBAC;eAAAA;;;8BAFQ;AAEd,MAAMA,sBAAsB,OAAOC,QAAgBC,WAAmBC;IACzE,MAAMC,gBAAgB,MAAMH,OAAOI,cAAc,CAACC,MAAM,CAACH;IAEzD,MAAMI,YAAwD;QAC1DC,MAAM;QACNL,SAAS;YACLM,iBAAiBL,cAAcM,EAAE;YACjCC,eAAeP,cAAcO,aAAa;QAC9C;IACJ;IACA,MAAMC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TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var flink_1 = require("@flink-app/flink");
|
|
19
|
-
var ConnectSessionRepo = /** @class */ (function (_super) {
|
|
20
|
-
__extends(ConnectSessionRepo, _super);
|
|
21
|
-
function ConnectSessionRepo() {
|
|
22
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
23
9
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
});
|
|
11
|
+
const _flink = require("@flink-app/flink");
|
|
12
|
+
let ConnectSessionRepo = class ConnectSessionRepo extends _flink.FlinkRepo {
|
|
13
|
+
};
|
|
14
|
+
const _default = ConnectSessionRepo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/reposx/ConnectSessionRepo.ts"],"sourcesContent":["import { FlinkRepo } from \"@flink-app/flink\";\nimport { ConnectSession } from \"../schemas/ConnectSession\";\n\nclass ConnectSessionRepo extends FlinkRepo<any, ConnectSession> {}\n\nexport default ConnectSessionRepo;\n"],"names":["ConnectSessionRepo","FlinkRepo"],"mappings":";;;;+BAKA;;;eAAA;;;uBAL0B;AAG1B,IAAA,AAAMA,qBAAN,MAAMA,2BAA2BC,gBAAS;AAAuB;MAEjE,WAAeD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|