@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":[],"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":""}
|
package/dist/src/stripeAPI.js
CHANGED
|
@@ -1,163 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
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 };
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "StripeAPI", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return StripeAPI;
|
|
36
9
|
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
10
|
+
});
|
|
11
|
+
const _stripe = require("stripe");
|
|
12
|
+
const _customer = require("./lib/customer");
|
|
13
|
+
const _payment = require("./lib/payment");
|
|
14
|
+
function _define_property(obj, key, value) {
|
|
15
|
+
if (key in obj) {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
value: value,
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
obj[key] = value;
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
let StripeAPI = class StripeAPI {
|
|
28
|
+
constructor(options){
|
|
29
|
+
_define_property(this, "stripe", void 0);
|
|
30
|
+
_define_property(this, "pluginOptions", void 0);
|
|
31
|
+
_define_property(this, "repo", void 0);
|
|
32
|
+
_define_property(this, "config", {
|
|
33
|
+
setRepo: (repo)=>{
|
|
34
|
+
this.repo = repo;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
_define_property(this, "payment", {
|
|
38
|
+
create: async (options)=>{
|
|
39
|
+
let resp = await (0, _payment.createPaymentIntent)(this.stripe, this.pluginOptions.JTW_TOKEN, options);
|
|
40
|
+
resp.paymentUrl = `${this.pluginOptions.baseUrl || "/stripe"}/payment/confirm/${resp.token}`;
|
|
41
|
+
return resp;
|
|
49
42
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}); },
|
|
64
|
-
confirm: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
65
|
-
var resp;
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0: return [4 /*yield*/, (0, payment_1.confirmPayment)(this.stripe, this.pluginOptions.JTW_TOKEN, options)];
|
|
69
|
-
case 1:
|
|
70
|
-
resp = _a.sent();
|
|
71
|
-
if (resp.token != null) {
|
|
72
|
-
resp.redirectUrl = "".concat(this.pluginOptions.baseUrl || "/stripe", "/payment/confirm/").concat(resp.token);
|
|
73
|
-
}
|
|
74
|
-
return [2 /*return*/, resp];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}); },
|
|
78
|
-
createAndConfirm: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
79
|
-
var createPaymentResponse, resp;
|
|
80
|
-
return __generator(this, function (_a) {
|
|
81
|
-
switch (_a.label) {
|
|
82
|
-
case 0: return [4 /*yield*/, (0, payment_1.createPaymentIntent)(this.stripe, this.pluginOptions.JTW_TOKEN, options)];
|
|
83
|
-
case 1:
|
|
84
|
-
createPaymentResponse = _a.sent();
|
|
85
|
-
return [4 /*yield*/, (0, payment_1.confirmPayment)(this.stripe, this.pluginOptions.JTW_TOKEN, { paymentIntentId: createPaymentResponse.paymentIntentId })];
|
|
86
|
-
case 2:
|
|
87
|
-
resp = _a.sent();
|
|
88
|
-
if (resp.token != null) {
|
|
89
|
-
resp.redirectUrl = "".concat(this.pluginOptions.baseUrl || "/stripe", "/payment/confirm/").concat(resp.token);
|
|
90
|
-
}
|
|
91
|
-
return [2 /*return*/, resp];
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}); },
|
|
95
|
-
capture: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
96
|
-
var captureResponse;
|
|
97
|
-
return __generator(this, function (_a) {
|
|
98
|
-
switch (_a.label) {
|
|
99
|
-
case 0: return [4 /*yield*/, this.stripe.paymentIntents.capture(options.paymentIntentId, { amount_to_capture: options.amount })];
|
|
100
|
-
case 1:
|
|
101
|
-
captureResponse = _a.sent();
|
|
102
|
-
return [2 /*return*/, captureResponse.status == "succeeded"];
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}); },
|
|
106
|
-
};
|
|
107
|
-
this.customer = {
|
|
108
|
-
create: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
109
|
-
return __generator(this, function (_a) {
|
|
110
|
-
switch (_a.label) {
|
|
111
|
-
case 0: return [4 /*yield*/, (0, customer_1.createStripeCustomer)(this.stripe, options)];
|
|
112
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}); },
|
|
116
|
-
hasPaymentMethod: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
117
|
-
return __generator(this, function (_a) {
|
|
118
|
-
switch (_a.label) {
|
|
119
|
-
case 0: return [4 /*yield*/, (0, customer_1.hasPaymentMethod)(this.stripe, options)];
|
|
120
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}); },
|
|
124
|
-
setupCard: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
125
|
-
var token;
|
|
126
|
-
return __generator(this, function (_a) {
|
|
127
|
-
switch (_a.label) {
|
|
128
|
-
case 0: return [4 /*yield*/, (0, customer_1.setupCardRegistration)(this.stripe, this.pluginOptions.JTW_TOKEN, options)];
|
|
129
|
-
case 1:
|
|
130
|
-
token = _a.sent();
|
|
131
|
-
return [2 /*return*/, {
|
|
132
|
-
token: token,
|
|
133
|
-
redirectUrl: "".concat(this.pluginOptions.baseUrl || "/stripe", "/customer/setup-card/").concat(token),
|
|
134
|
-
}];
|
|
135
|
-
}
|
|
43
|
+
confirm: async (options)=>{
|
|
44
|
+
let resp = await (0, _payment.confirmPayment)(this.stripe, this.pluginOptions.JTW_TOKEN, options);
|
|
45
|
+
if (resp.token != null) {
|
|
46
|
+
resp.redirectUrl = `${this.pluginOptions.baseUrl || "/stripe"}/payment/confirm/${resp.token}`;
|
|
47
|
+
}
|
|
48
|
+
return resp;
|
|
49
|
+
},
|
|
50
|
+
createAndConfirm: async (options)=>{
|
|
51
|
+
const createPaymentResponse = await (0, _payment.createPaymentIntent)(this.stripe, this.pluginOptions.JTW_TOKEN, options);
|
|
52
|
+
let resp = await (0, _payment.confirmPayment)(this.stripe, this.pluginOptions.JTW_TOKEN, {
|
|
53
|
+
paymentIntentId: createPaymentResponse.paymentIntentId
|
|
136
54
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
return [4 /*yield*/, this.repo.create(options)];
|
|
147
|
-
case 1:
|
|
148
|
-
session = _a.sent();
|
|
149
|
-
url = "https://connect.stripe.com/express/oauth/authorize?client_id=" + this.pluginOptions.stripeConnectClientID + "&state=" + session._id;
|
|
150
|
-
return [2 /*return*/, url];
|
|
151
|
-
}
|
|
55
|
+
if (resp.token != null) {
|
|
56
|
+
resp.redirectUrl = `${this.pluginOptions.baseUrl || "/stripe"}/payment/confirm/${resp.token}`;
|
|
57
|
+
}
|
|
58
|
+
return resp;
|
|
59
|
+
},
|
|
60
|
+
capture: async (options)=>{
|
|
61
|
+
const captureResponse = await this.stripe.paymentIntents.capture(options.paymentIntentId, {
|
|
62
|
+
amount_to_capture: options.amount
|
|
152
63
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
64
|
+
return captureResponse.status == "succeeded";
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
_define_property(this, "customer", {
|
|
68
|
+
create: async (options)=>{
|
|
69
|
+
return await (0, _customer.createStripeCustomer)(this.stripe, options);
|
|
70
|
+
},
|
|
71
|
+
hasPaymentMethod: async (options)=>{
|
|
72
|
+
return await (0, _customer.hasPaymentMethod)(this.stripe, options);
|
|
73
|
+
},
|
|
74
|
+
setupCard: async (options)=>{
|
|
75
|
+
const token = await (0, _customer.setupCardRegistration)(this.stripe, this.pluginOptions.JTW_TOKEN, options);
|
|
76
|
+
return {
|
|
77
|
+
token,
|
|
78
|
+
redirectUrl: `${this.pluginOptions.baseUrl || "/stripe"}/customer/setup-card/${token}`
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
connectToStripeConnect: async (options)=>{
|
|
82
|
+
if (this.repo == null) {
|
|
83
|
+
throw "Repo not set, cannot use connectToStripeConnect()";
|
|
84
|
+
}
|
|
85
|
+
const session = await this.repo.create(options);
|
|
86
|
+
const url = "https://connect.stripe.com/express/oauth/authorize?client_id=" + this.pluginOptions.stripeConnectClientID + "&state=" + session._id;
|
|
87
|
+
return url;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const stripe = new _stripe.Stripe(options.stripeSecreteKey, {
|
|
91
|
+
apiVersion: "2020-08-27"
|
|
157
92
|
});
|
|
158
93
|
this.stripe = stripe;
|
|
159
94
|
this.pluginOptions = options;
|
|
160
95
|
}
|
|
161
|
-
|
|
162
|
-
}());
|
|
163
|
-
exports.StripeAPI = StripeAPI;
|
|
96
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/stripeAPI.ts"],"sourcesContent":["import { Stripe } from \"stripe\";\nimport { createStripeCustomer, hasPaymentMethod, setupCardRegistration } from \"./lib/customer\";\nimport { hasPaymentMethodOptions } from \"./schemas/customer/hasPaymentMethodOptions\";\nimport { setupCardOptions } from \"./schemas/customer/setupCardOptions\";\nimport { setupCardResponse } from \"./schemas/customer/setupCardResponse\";\nimport { stripePluginOptions } from \"./schemas/stripePluginOptions\";\nimport { confirmPayment, createPaymentIntent } from \"./lib/payment\";\nimport { confirmPaymentOptions } from \"./schemas/payment/confirmPaymentOptions\";\nimport { confirmPaymentResponse } from \"./schemas/payment/confirmPaymentResponse\";\nimport { createPaymentResponse } from \"./schemas/payment/createPaymentResponse\";\nimport ConnectSessionRepo from \"./reposx/ConnectSessionRepo\";\nimport { connectToStripeConnectOptions } from \"./schemas/customer/connectToStripeConnectOptions\";\nimport { capturePaymentOptions } from \"./schemas/payment/capturePaymentOptions\";\nexport class StripeAPI {\n stripe: Stripe;\n pluginOptions: stripePluginOptions;\n repo?: ConnectSessionRepo;\n constructor(options: stripePluginOptions) {\n const stripe = new Stripe(options.stripeSecreteKey, {\n apiVersion: \"2020-08-27\",\n });\n\n this.stripe = stripe;\n this.pluginOptions = options;\n }\n config = {\n setRepo: (repo: ConnectSessionRepo): void => {\n this.repo = repo;\n },\n };\n\n payment = {\n create: async (options: Stripe.PaymentIntentCreateParams): Promise<createPaymentResponse> => {\n let resp = await createPaymentIntent(this.stripe, this.pluginOptions.JTW_TOKEN, options);\n resp.paymentUrl = `${this.pluginOptions.baseUrl || \"/stripe\"}/payment/confirm/${resp.token}`;\n return resp;\n },\n confirm: async (options: confirmPaymentOptions): Promise<confirmPaymentResponse> => {\n let resp = await confirmPayment(this.stripe, this.pluginOptions.JTW_TOKEN, options);\n if (resp.token != null) {\n resp.redirectUrl = `${this.pluginOptions.baseUrl || \"/stripe\"}/payment/confirm/${resp.token}`;\n }\n return resp;\n },\n createAndConfirm: async (options: Stripe.PaymentIntentCreateParams): Promise<confirmPaymentResponse> => {\n const createPaymentResponse = await createPaymentIntent(this.stripe, this.pluginOptions.JTW_TOKEN, options);\n let resp = await confirmPayment(this.stripe, this.pluginOptions.JTW_TOKEN, { paymentIntentId: createPaymentResponse.paymentIntentId });\n if (resp.token != null) {\n resp.redirectUrl = `${this.pluginOptions.baseUrl || \"/stripe\"}/payment/confirm/${resp.token}`;\n }\n return resp;\n },\n capture: async (options: capturePaymentOptions): Promise<boolean> => {\n const captureResponse = await this.stripe.paymentIntents.capture(options.paymentIntentId, { amount_to_capture: options.amount });\n return captureResponse.status == \"succeeded\";\n },\n };\n customer = {\n create: async (options: Stripe.CustomerCreateParams): Promise<string> => {\n return await createStripeCustomer(this.stripe, options);\n },\n hasPaymentMethod: async (options: hasPaymentMethodOptions): Promise<boolean> => {\n return await hasPaymentMethod(this.stripe, options);\n },\n setupCard: async (options: setupCardOptions): Promise<setupCardResponse> => {\n const token = await setupCardRegistration(this.stripe, this.pluginOptions.JTW_TOKEN, options);\n return {\n token,\n redirectUrl: `${this.pluginOptions.baseUrl || \"/stripe\"}/customer/setup-card/${token}`,\n };\n },\n connectToStripeConnect: async (options: connectToStripeConnectOptions): Promise<string> => {\n if (this.repo == null) {\n throw \"Repo not set, cannot use connectToStripeConnect()\";\n }\n const session = await this.repo!.create(options);\n const url = \"https://connect.stripe.com/express/oauth/authorize?client_id=\" + this.pluginOptions.stripeConnectClientID + \"&state=\" + session._id;\n return url;\n },\n };\n}\n"],"names":["StripeAPI","options","stripe","pluginOptions","repo","config","setRepo","payment","create","resp","createPaymentIntent","JTW_TOKEN","paymentUrl","baseUrl","token","confirm","confirmPayment","redirectUrl","createAndConfirm","createPaymentResponse","paymentIntentId","capture","captureResponse","paymentIntents","amount_to_capture","amount","status","customer","createStripeCustomer","hasPaymentMethod","setupCard","setupCardRegistration","connectToStripeConnect","session","url","stripeConnectClientID","_id","Stripe","stripeSecreteKey","apiVersion"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "connectDoneTemplate", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return connectDoneTemplate;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const connectDoneTemplate = `
|
|
12
|
+
<div id="success">
|
|
13
|
+
<i class="fas fa-check"></i>
|
|
14
|
+
<div id="sucess_message">{{message}}</div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
{{#if redirectUrl}}
|
|
18
|
+
<script>
|
|
19
|
+
setTimeout(function(){
|
|
20
|
+
window.location="{{redirectUrl}}";
|
|
21
|
+
}, 1000)
|
|
22
|
+
</script>
|
|
23
|
+
{{/if}}
|
|
24
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/templates/connect-done.ts"],"sourcesContent":["export const connectDoneTemplate = `\n <div id=\"success\">\n <i class=\"fas fa-check\"></i>\n <div id=\"sucess_message\">{{message}}</div>\n </div>\n\n {{#if redirectUrl}}\n <script>\n setTimeout(function(){\n window.location=\"{{redirectUrl}}\";\n }, 1000)\n </script>\n {{/if}}\n`;\n"],"names":["connectDoneTemplate"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,sBAAsB,CAAC;;;;;;;;;;;;;AAapC,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "errorTemplate", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return errorTemplate;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const errorTemplate = `Någonting gick fel, vänligen försök igen.`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/templates/error.ts"],"sourcesContent":["export const errorTemplate = `Någonting gick fel, vänligen försök igen.`;\n"],"names":["errorTemplate"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,gBAAgB,CAAC,yCAAyC,CAAC"}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "masterTemplate", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return masterTemplate;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const masterTemplate = `
|
|
12
|
+
<html>
|
|
13
|
+
<head>
|
|
14
|
+
<meta charset="UTF-8">
|
|
15
|
+
<script src="https://kit.fontawesome.com/b439aafa7e.js" crossorigin="anonymous"></script>
|
|
16
|
+
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
|
17
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
|
18
|
+
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
|
|
19
|
+
<script src="https://js.stripe.com/v3/"></script>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
{{{style}}}
|
|
23
|
+
</style>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
{{{body}}}
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
29
|
+
|
|
30
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/templates/master.ts"],"sourcesContent":["export const masterTemplate = `\n<html>\n <head>\n <meta charset=\"UTF-8\">\n <script src=\"https://kit.fontawesome.com/b439aafa7e.js\" crossorigin=\"anonymous\"></script>\n <script src=\"https://code.jquery.com/jquery-3.5.1.min.js\" integrity=\"sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=\" crossorigin=\"anonymous\"></script>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\" />\n <link href=\"https://fonts.googleapis.com/css2?family=Open+Sans&display=swap\" rel=\"stylesheet\">\n <script src=\"https://js.stripe.com/v3/\"></script>\n\n <style>\n {{{style}}}\n </style>\n </head>\n <body>\n {{{body}}}\n </body>\n</html>\n\n`;\n"],"names":["masterTemplate"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;AAmB/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const payDone = "\n <div id=\"success\">\n <i class=\"fas fa-check\"></i>\n <div id=\"sucess_message\">{{message}}</div>\n </div>\n\n {{#if redirectUrl}}\n <script>\n setTimeout(function(){\n window.location=\"{{redirectUrl}}\";\n }, 1000)\n </script>\n {{/if}}\n";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "payDone", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return payDone;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const payDone = `
|
|
12
|
+
<div id="success">
|
|
13
|
+
<i class="fas fa-check"></i>
|
|
14
|
+
<div id="sucess_message">{{message}}</div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
{{#if redirectUrl}}
|
|
18
|
+
<script>
|
|
19
|
+
setTimeout(function(){
|
|
20
|
+
window.location="{{redirectUrl}}";
|
|
21
|
+
}, 1000)
|
|
22
|
+
</script>
|
|
23
|
+
{{/if}}
|
|
24
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/templates/pay-done.ts"],"sourcesContent":["export const payDone = `\n <div id=\"success\">\n <i class=\"fas fa-check\"></i>\n <div id=\"sucess_message\">{{message}}</div>\n </div>\n\n {{#if redirectUrl}}\n <script>\n setTimeout(function(){\n window.location=\"{{redirectUrl}}\";\n }, 1000)\n </script>\n {{/if}}\n`;\n"],"names":["payDone"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,UAAU,CAAC;;;;;;;;;;;;;AAaxB,CAAC"}
|
|
@@ -1,4 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "payEnterCardTemplate", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return payEnterCardTemplate;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const payEnterCardTemplate = `
|
|
12
|
+
|
|
13
|
+
{{#if logo}}
|
|
14
|
+
<div id="logo-image-holder">
|
|
15
|
+
<img src="{{logo}}" id="logo-image"/>
|
|
16
|
+
</div>
|
|
17
|
+
{{/if}}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<div id="card-container">
|
|
22
|
+
|
|
23
|
+
<div id="card-element">
|
|
24
|
+
<!-- Elements will create input elements here -->
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div id="card-errors" role="alert"></div>
|
|
28
|
+
|
|
29
|
+
<div id="card-submit">
|
|
30
|
+
{{paymentEnterCardPayButtonText}}
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
<div id="loading_container">
|
|
39
|
+
<div id="loading">
|
|
40
|
+
<i class="fas fa-circle-notch fa-spin"></i>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
<script>
|
|
46
|
+
var stripe = Stripe('{{publishableKey}}');
|
|
47
|
+
var elements = stripe.elements();
|
|
48
|
+
|
|
49
|
+
var style = {
|
|
50
|
+
base: {
|
|
51
|
+
color: "#32325d",
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var card = elements.create("card", { style: style });
|
|
56
|
+
card.mount("#card-element");
|
|
57
|
+
card.on('ready',function(){
|
|
58
|
+
$("#loading_container").hide();
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
card.addEventListener('change', function(event) {
|
|
64
|
+
if (event.error) {
|
|
65
|
+
$("#card-errors").text(event.error.message)
|
|
66
|
+
$("#card-errors").show();
|
|
67
|
+
} else {
|
|
68
|
+
$("#card-errors").text('')
|
|
69
|
+
$("#card-errors").hide();
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
$("#card-submit").click(function(){
|
|
77
|
+
$("#card-errors").hide();
|
|
78
|
+
$("#loading_container").show();
|
|
79
|
+
stripe.confirmCardPayment('{{client_secrect}}', {
|
|
80
|
+
payment_method: { card: card },
|
|
81
|
+
setup_future_usage: 'off_session'
|
|
82
|
+
}).then(function(result) {
|
|
83
|
+
if(result.error!=null){
|
|
84
|
+
$("#card-errors").text(result.error.message)
|
|
85
|
+
$("#card-errors").show();
|
|
86
|
+
$("#loading_container").hide();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if(result.paymentIntent != null){
|
|
91
|
+
document.location = "{{baseUrl}}/payment/done/{{token}}";
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
</script>`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/joel/projects/flink/flink-framework/packages/stripe-plugin/src/templates/pay-enter-card.ts"],"sourcesContent":["export const payEnterCardTemplate = `\n\n{{#if logo}}\n <div id=\"logo-image-holder\">\n <img src=\"{{logo}}\" id=\"logo-image\"/>\n </div>\n{{/if}}\n\n\n\n<div id=\"card-container\">\n\n <div id=\"card-element\">\n <!-- Elements will create input elements here -->\n </div>\n\n <div id=\"card-errors\" role=\"alert\"></div>\n\n <div id=\"card-submit\">\n {{paymentEnterCardPayButtonText}}\n </div>\n\n\n\n</div>\n\n\n<div id=\"loading_container\">\n <div id=\"loading\">\n <i class=\"fas fa-circle-notch fa-spin\"></i>\n </div> \n</div> \n\n\n<script>\nvar stripe = Stripe('{{publishableKey}}');\nvar elements = stripe.elements();\n\nvar style = {\n base: {\n color: \"#32325d\",\n }\n};\n\nvar card = elements.create(\"card\", { style: style });\ncard.mount(\"#card-element\"); \ncard.on('ready',function(){\n $(\"#loading_container\").hide();\n})\n\n\n\ncard.addEventListener('change', function(event) {\n if (event.error) {\n $(\"#card-errors\").text(event.error.message)\n $(\"#card-errors\").show();\n } else {\n $(\"#card-errors\").text('')\n $(\"#card-errors\").hide();\n \n }\n});\n\n\n\n$(\"#card-submit\").click(function(){\n $(\"#card-errors\").hide();\n $(\"#loading_container\").show();\n stripe.confirmCardPayment('{{client_secrect}}', {\n payment_method: { card: card },\n setup_future_usage: 'off_session'\n }).then(function(result) {\n if(result.error!=null){\n $(\"#card-errors\").text(result.error.message)\n $(\"#card-errors\").show();\n $(\"#loading_container\").hide();\n return;\n }\n\n if(result.paymentIntent != null){\n document.location = \"{{baseUrl}}/payment/done/{{token}}\";\n }\n });\n})\n\n</script>`;\n"],"names":["payEnterCardTemplate"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,uBAAuB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqF5B,CAAC"}
|