@medusajs/payment-stripe 0.0.3 → 1.0.0-rc-20241003153304

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/dist/core/stripe-base.d.ts +6 -7
  2. package/dist/core/stripe-base.d.ts.map +1 -0
  3. package/dist/core/stripe-base.js +238 -440
  4. package/dist/core/stripe-base.js.map +1 -0
  5. package/dist/index.d.ts +2 -1
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +5 -5
  8. package/dist/index.js.map +1 -0
  9. package/dist/services/index.d.ts +1 -0
  10. package/dist/services/index.d.ts.map +1 -0
  11. package/dist/services/index.js +1 -1
  12. package/dist/services/index.js.map +1 -0
  13. package/dist/services/stripe-bancontact.d.ts +1 -0
  14. package/dist/services/stripe-bancontact.d.ts.map +1 -0
  15. package/dist/services/stripe-bancontact.js +14 -35
  16. package/dist/services/stripe-bancontact.js.map +1 -0
  17. package/dist/services/stripe-blik.d.ts +1 -0
  18. package/dist/services/stripe-blik.d.ts.map +1 -0
  19. package/dist/services/stripe-blik.js +14 -35
  20. package/dist/services/stripe-blik.js.map +1 -0
  21. package/dist/services/stripe-giropay.d.ts +1 -0
  22. package/dist/services/stripe-giropay.d.ts.map +1 -0
  23. package/dist/services/stripe-giropay.js +14 -35
  24. package/dist/services/stripe-giropay.js.map +1 -0
  25. package/dist/services/stripe-ideal.d.ts +1 -0
  26. package/dist/services/stripe-ideal.d.ts.map +1 -0
  27. package/dist/services/stripe-ideal.js +14 -35
  28. package/dist/services/stripe-ideal.js.map +1 -0
  29. package/dist/services/stripe-provider.d.ts +1 -0
  30. package/dist/services/stripe-provider.d.ts.map +1 -0
  31. package/dist/services/stripe-provider.js +11 -32
  32. package/dist/services/stripe-provider.js.map +1 -0
  33. package/dist/services/stripe-przelewy24.d.ts +1 -0
  34. package/dist/services/stripe-przelewy24.d.ts.map +1 -0
  35. package/dist/services/stripe-przelewy24.js +14 -35
  36. package/dist/services/stripe-przelewy24.js.map +1 -0
  37. package/dist/tsconfig.tsbuildinfo +1 -0
  38. package/dist/types/index.d.ts +11 -7
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types/index.js +1 -1
  41. package/dist/types/index.js.map +1 -0
  42. package/dist/utils/get-smallest-unit.d.ts +17 -0
  43. package/dist/utils/get-smallest-unit.d.ts.map +1 -0
  44. package/dist/utils/get-smallest-unit.js +68 -0
  45. package/dist/utils/get-smallest-unit.js.map +1 -0
  46. package/package.json +15 -16
@@ -1,471 +1,269 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new 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
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
- step((generator = generator.apply(thisArg, _arguments || [])).next());
35
- });
36
- };
37
- var __generator = (this && this.__generator) || function (thisArg, body) {
38
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
- function verb(n) { return function (v) { return step([n, v]); }; }
41
- function step(op) {
42
- if (f) throw new TypeError("Generator is already executing.");
43
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
- 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;
45
- if (y = 0, t) op = [op[0] & 2, t.value];
46
- switch (op[0]) {
47
- case 0: case 1: t = op; break;
48
- case 4: _.label++; return { value: op[1], done: false };
49
- case 5: _.label++; y = op[1]; op = [0]; continue;
50
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
- default:
52
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
- if (t[2]) _.ops.pop();
57
- _.trys.pop(); continue;
58
- }
59
- op = body.call(thisArg, _);
60
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
- }
63
- };
64
- var __read = (this && this.__read) || function (o, n) {
65
- var m = typeof Symbol === "function" && o[Symbol.iterator];
66
- if (!m) return o;
67
- var i = m.call(o), r, ar = [], e;
68
- try {
69
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
70
- }
71
- catch (error) { e = { error: error }; }
72
- finally {
73
- try {
74
- if (r && !r.done && (m = i["return"])) m.call(i);
75
- }
76
- finally { if (e) throw e.error; }
77
- }
78
- return ar;
79
- };
80
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
81
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
82
- if (ar || !(i in from)) {
83
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
84
- ar[i] = from[i];
85
- }
86
- }
87
- return to.concat(ar || Array.prototype.slice.call(from));
88
- };
89
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
90
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
91
4
  };
92
5
  Object.defineProperty(exports, "__esModule", { value: true });
93
- var os_1 = require("os");
94
- var stripe_1 = __importDefault(require("stripe"));
95
- var types_1 = require("@medusajs/types");
96
- var utils_1 = require("@medusajs/utils");
97
- var medusa_core_utils_1 = require("medusa-core-utils");
98
- var types_2 = require("../types");
99
- var StripeBase = /** @class */ (function (_super) {
100
- __extends(StripeBase, _super);
101
- function StripeBase(container, options) {
102
- var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
103
- _this.container_ = container;
104
- _this.options_ = options;
105
- _this.stripe_ = _this.init();
106
- return _this;
107
- }
108
- StripeBase.prototype.init = function () {
109
- this.validateOptions(this.config);
110
- return new stripe_1.default(this.config.apiKey);
111
- };
112
- StripeBase.prototype.validateOptions = function (options) {
113
- if (!(0, medusa_core_utils_1.isDefined)(options.apiKey)) {
6
+ const os_1 = require("os");
7
+ const stripe_1 = __importDefault(require("stripe"));
8
+ const utils_1 = require("@medusajs/framework/utils");
9
+ const types_1 = require("../types");
10
+ const get_smallest_unit_1 = require("../utils/get-smallest-unit");
11
+ class StripeBase extends utils_1.AbstractPaymentProvider {
12
+ static validateOptions(options) {
13
+ if (!(0, utils_1.isDefined)(options.apiKey)) {
114
14
  throw new Error("Required option `apiKey` is missing in Stripe plugin");
115
15
  }
116
- };
117
- Object.defineProperty(StripeBase.prototype, "options", {
118
- get: function () {
119
- return this.options_;
120
- },
121
- enumerable: false,
122
- configurable: true
123
- });
124
- StripeBase.prototype.getPaymentIntentOptions = function () {
125
- var _a, _b, _c;
126
- var options = {};
127
- if ((_a = this === null || this === void 0 ? void 0 : this.paymentIntentOptions) === null || _a === void 0 ? void 0 : _a.capture_method) {
16
+ }
17
+ constructor(container, options) {
18
+ // @ts-ignore
19
+ super(...arguments);
20
+ this.container_ = container;
21
+ this.options_ = options;
22
+ this.stripe_ = new stripe_1.default(options.apiKey);
23
+ }
24
+ get options() {
25
+ return this.options_;
26
+ }
27
+ getPaymentIntentOptions() {
28
+ const options = {};
29
+ if (this?.paymentIntentOptions?.capture_method) {
128
30
  options.capture_method = this.paymentIntentOptions.capture_method;
129
31
  }
130
- if ((_b = this === null || this === void 0 ? void 0 : this.paymentIntentOptions) === null || _b === void 0 ? void 0 : _b.setup_future_usage) {
32
+ if (this?.paymentIntentOptions?.setup_future_usage) {
131
33
  options.setup_future_usage = this.paymentIntentOptions.setup_future_usage;
132
34
  }
133
- if ((_c = this === null || this === void 0 ? void 0 : this.paymentIntentOptions) === null || _c === void 0 ? void 0 : _c.payment_method_types) {
35
+ if (this?.paymentIntentOptions?.payment_method_types) {
134
36
  options.payment_method_types =
135
37
  this.paymentIntentOptions.payment_method_types;
136
38
  }
137
39
  return options;
138
- };
139
- StripeBase.prototype.getPaymentStatus = function (paymentSessionData) {
140
- return __awaiter(this, void 0, void 0, function () {
141
- var id, paymentIntent;
142
- return __generator(this, function (_a) {
143
- switch (_a.label) {
144
- case 0:
145
- id = paymentSessionData.id;
146
- return [4 /*yield*/, this.stripe_.paymentIntents.retrieve(id)];
147
- case 1:
148
- paymentIntent = _a.sent();
149
- switch (paymentIntent.status) {
150
- case "requires_payment_method":
151
- case "requires_confirmation":
152
- case "processing":
153
- return [2 /*return*/, types_1.PaymentSessionStatus.PENDING];
154
- case "requires_action":
155
- return [2 /*return*/, types_1.PaymentSessionStatus.REQUIRES_MORE];
156
- case "canceled":
157
- return [2 /*return*/, types_1.PaymentSessionStatus.CANCELED];
158
- case "requires_capture":
159
- case "succeeded":
160
- return [2 /*return*/, types_1.PaymentSessionStatus.AUTHORIZED];
161
- default:
162
- return [2 /*return*/, types_1.PaymentSessionStatus.PENDING];
163
- }
164
- return [2 /*return*/];
165
- }
166
- });
167
- });
168
- };
169
- StripeBase.prototype.initiatePayment = function (input) {
170
- var _a, _b, _c, _d;
171
- return __awaiter(this, void 0, void 0, function () {
172
- var intentRequestData, _e, email, extra, resource_id, customer, currency_code, amount, description, intentRequest, stripeCustomer, e_1, sessionData, e_2;
173
- return __generator(this, function (_f) {
174
- switch (_f.label) {
175
- case 0:
176
- intentRequestData = this.getPaymentIntentOptions();
177
- _e = input.context, email = _e.email, extra = _e.extra, resource_id = _e.resource_id, customer = _e.customer;
178
- currency_code = input.currency_code, amount = input.amount;
179
- description = ((_a = extra === null || extra === void 0 ? void 0 : extra.payment_description) !== null && _a !== void 0 ? _a : (_b = this.options_) === null || _b === void 0 ? void 0 : _b.payment_description);
180
- intentRequest = __assign({ description: description, amount: Math.round(new utils_1.BigNumber(amount).numeric), currency: currency_code, metadata: { resource_id: resource_id !== null && resource_id !== void 0 ? resource_id : "Medusa Payment" }, capture_method: this.options_.capture ? "automatic" : "manual" }, intentRequestData);
181
- if ((_c = this.options_) === null || _c === void 0 ? void 0 : _c.automatic_payment_methods) {
182
- intentRequest.automatic_payment_methods = { enabled: true };
183
- }
184
- if (!((_d = customer === null || customer === void 0 ? void 0 : customer.metadata) === null || _d === void 0 ? void 0 : _d.stripe_id)) return [3 /*break*/, 1];
185
- intentRequest.customer = customer.metadata.stripe_id;
186
- return [3 /*break*/, 6];
187
- case 1:
188
- stripeCustomer = void 0;
189
- _f.label = 2;
190
- case 2:
191
- _f.trys.push([2, 4, , 5]);
192
- return [4 /*yield*/, this.stripe_.customers.create({
193
- email: email,
194
- })];
195
- case 3:
196
- stripeCustomer = _f.sent();
197
- return [3 /*break*/, 5];
198
- case 4:
199
- e_1 = _f.sent();
200
- return [2 /*return*/, this.buildError("An error occurred in initiatePayment when creating a Stripe customer", e_1)];
201
- case 5:
202
- intentRequest.customer = stripeCustomer.id;
203
- _f.label = 6;
204
- case 6:
205
- _f.trys.push([6, 8, , 9]);
206
- return [4 /*yield*/, this.stripe_.paymentIntents.create(intentRequest)];
207
- case 7:
208
- sessionData = (_f.sent());
209
- return [3 /*break*/, 9];
210
- case 8:
211
- e_2 = _f.sent();
212
- return [2 /*return*/, this.buildError("An error occurred in InitiatePayment during the creation of the stripe payment intent", e_2)];
213
- case 9: return [2 /*return*/, {
214
- data: sessionData,
215
- // TODO: REVISIT
216
- // update_requests: customer?.metadata?.stripe_id
217
- // ? undefined
218
- // : {
219
- // customer_metadata: {
220
- // stripe_id: intentRequest.customer,
221
- // },
222
- // },
223
- }];
224
- }
225
- });
226
- });
227
- };
228
- StripeBase.prototype.authorizePayment = function (paymentSessionData, context) {
229
- return __awaiter(this, void 0, void 0, function () {
230
- var status;
231
- return __generator(this, function (_a) {
232
- switch (_a.label) {
233
- case 0: return [4 /*yield*/, this.getPaymentStatus(paymentSessionData)];
234
- case 1:
235
- status = _a.sent();
236
- return [2 /*return*/, { data: paymentSessionData, status: status }];
237
- }
238
- });
239
- });
240
- };
241
- StripeBase.prototype.cancelPayment = function (paymentSessionData) {
242
- var _a;
243
- return __awaiter(this, void 0, void 0, function () {
244
- var id, error_1;
245
- return __generator(this, function (_b) {
246
- switch (_b.label) {
247
- case 0:
248
- _b.trys.push([0, 2, , 3]);
249
- id = paymentSessionData.id;
250
- return [4 /*yield*/, this.stripe_.paymentIntents.cancel(id)];
251
- case 1: return [2 /*return*/, (_b.sent())];
252
- case 2:
253
- error_1 = _b.sent();
254
- if (((_a = error_1.payment_intent) === null || _a === void 0 ? void 0 : _a.status) === types_2.ErrorIntentStatus.CANCELED) {
255
- return [2 /*return*/, error_1.payment_intent];
256
- }
257
- return [2 /*return*/, this.buildError("An error occurred in cancelPayment", error_1)];
258
- case 3: return [2 /*return*/];
259
- }
260
- });
261
- });
262
- };
263
- StripeBase.prototype.capturePayment = function (paymentSessionData) {
264
- var _a;
265
- return __awaiter(this, void 0, void 0, function () {
266
- var id, intent, error_2;
267
- return __generator(this, function (_b) {
268
- switch (_b.label) {
269
- case 0:
270
- id = paymentSessionData.id;
271
- _b.label = 1;
272
- case 1:
273
- _b.trys.push([1, 3, , 4]);
274
- return [4 /*yield*/, this.stripe_.paymentIntents.capture(id)];
275
- case 2:
276
- intent = _b.sent();
277
- return [2 /*return*/, intent];
278
- case 3:
279
- error_2 = _b.sent();
280
- if (error_2.code === types_2.ErrorCodes.PAYMENT_INTENT_UNEXPECTED_STATE) {
281
- if (((_a = error_2.payment_intent) === null || _a === void 0 ? void 0 : _a.status) === types_2.ErrorIntentStatus.SUCCEEDED) {
282
- return [2 /*return*/, error_2.payment_intent];
283
- }
284
- }
285
- return [2 /*return*/, this.buildError("An error occurred in capturePayment", error_2)];
286
- case 4: return [2 /*return*/];
287
- }
288
- });
289
- });
290
- };
291
- StripeBase.prototype.deletePayment = function (paymentSessionData) {
292
- return __awaiter(this, void 0, void 0, function () {
293
- return __generator(this, function (_a) {
294
- switch (_a.label) {
295
- case 0: return [4 /*yield*/, this.cancelPayment(paymentSessionData)];
296
- case 1: return [2 /*return*/, _a.sent()];
297
- }
298
- });
299
- });
300
- };
301
- StripeBase.prototype.refundPayment = function (paymentSessionData, refundAmount) {
302
- return __awaiter(this, void 0, void 0, function () {
303
- var id, e_3;
304
- return __generator(this, function (_a) {
305
- switch (_a.label) {
306
- case 0:
307
- id = paymentSessionData.id;
308
- _a.label = 1;
309
- case 1:
310
- _a.trys.push([1, 3, , 4]);
311
- return [4 /*yield*/, this.stripe_.refunds.create({
312
- amount: Math.round(refundAmount),
313
- payment_intent: id,
314
- })];
315
- case 2:
316
- _a.sent();
317
- return [3 /*break*/, 4];
318
- case 3:
319
- e_3 = _a.sent();
320
- return [2 /*return*/, this.buildError("An error occurred in refundPayment", e_3)];
321
- case 4: return [2 /*return*/, paymentSessionData];
322
- }
323
- });
324
- });
325
- };
326
- StripeBase.prototype.retrievePayment = function (paymentSessionData) {
327
- return __awaiter(this, void 0, void 0, function () {
328
- var id, intent, e_4;
329
- return __generator(this, function (_a) {
330
- switch (_a.label) {
331
- case 0:
332
- _a.trys.push([0, 2, , 3]);
333
- id = paymentSessionData.id;
334
- return [4 /*yield*/, this.stripe_.paymentIntents.retrieve(id)];
335
- case 1:
336
- intent = _a.sent();
337
- return [2 /*return*/, intent];
338
- case 2:
339
- e_4 = _a.sent();
340
- return [2 /*return*/, this.buildError("An error occurred in retrievePayment", e_4)];
341
- case 3: return [2 /*return*/];
342
- }
343
- });
344
- });
345
- };
346
- StripeBase.prototype.updatePayment = function (input) {
347
- var _a, _b;
348
- return __awaiter(this, void 0, void 0, function () {
349
- var context, data, amount, amountNumeric, stripeId, result, id, sessionData, e_5;
350
- return __generator(this, function (_c) {
351
- switch (_c.label) {
352
- case 0:
353
- context = input.context, data = input.data, amount = input.amount;
354
- amountNumeric = Math.round(new utils_1.BigNumber(amount).numeric);
355
- stripeId = (_b = (_a = context.customer) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.stripe_id;
356
- if (!(stripeId !== data.customer)) return [3 /*break*/, 2];
357
- return [4 /*yield*/, this.initiatePayment(input)];
358
- case 1:
359
- result = _c.sent();
360
- if ((0, utils_1.isPaymentProviderError)(result)) {
361
- return [2 /*return*/, this.buildError("An error occurred in updatePayment during the initiate of the new payment for the new customer", result)];
362
- }
363
- return [2 /*return*/, result];
364
- case 2:
365
- if (amount && data.amount === amountNumeric) {
366
- return [2 /*return*/, { data: data }];
367
- }
368
- _c.label = 3;
369
- case 3:
370
- _c.trys.push([3, 5, , 6]);
371
- id = data.id;
372
- return [4 /*yield*/, this.stripe_.paymentIntents.update(id, {
373
- amount: amountNumeric,
374
- })];
375
- case 4:
376
- sessionData = (_c.sent());
377
- return [2 /*return*/, { data: sessionData }];
378
- case 5:
379
- e_5 = _c.sent();
380
- return [2 /*return*/, this.buildError("An error occurred in updatePayment", e_5)];
381
- case 6: return [2 /*return*/];
382
- }
383
- });
384
- });
385
- };
386
- StripeBase.prototype.updatePaymentData = function (sessionId, data) {
387
- return __awaiter(this, void 0, void 0, function () {
388
- var e_6;
389
- return __generator(this, function (_a) {
390
- switch (_a.label) {
391
- case 0:
392
- _a.trys.push([0, 2, , 3]);
393
- // Prevent from updating the amount from here as it should go through
394
- // the updatePayment method to perform the correct logic
395
- if (data.amount) {
396
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Cannot update amount, use updatePayment instead");
397
- }
398
- return [4 /*yield*/, this.stripe_.paymentIntents.update(sessionId, __assign({}, data))];
399
- case 1: return [2 /*return*/, (_a.sent())];
400
- case 2:
401
- e_6 = _a.sent();
402
- return [2 /*return*/, this.buildError("An error occurred in updatePaymentData", e_6)];
403
- case 3: return [2 /*return*/];
404
- }
405
- });
406
- });
407
- };
408
- StripeBase.prototype.getWebhookActionAndData = function (webhookData) {
409
- return __awaiter(this, void 0, void 0, function () {
410
- var event, intent;
411
- return __generator(this, function (_a) {
412
- event = this.constructWebhookEvent(webhookData);
413
- intent = event.data.object;
414
- switch (event.type) {
415
- case "payment_intent.amount_capturable_updated":
416
- return [2 /*return*/, {
417
- action: utils_1.PaymentActions.AUTHORIZED,
418
- data: {
419
- resource_id: intent.metadata.resource_id,
420
- amount: intent.amount_capturable, // NOTE: revisit when implementing multicapture
421
- },
422
- }];
423
- case "payment_intent.succeeded":
424
- return [2 /*return*/, {
425
- action: utils_1.PaymentActions.SUCCESSFUL,
426
- data: {
427
- resource_id: intent.metadata.resource_id,
428
- amount: intent.amount_received,
429
- },
430
- }];
431
- case "payment_intent.payment_failed":
432
- return [2 /*return*/, {
433
- action: utils_1.PaymentActions.FAILED,
434
- data: {
435
- resource_id: intent.metadata.resource_id,
436
- amount: intent.amount,
437
- },
438
- }];
439
- default:
440
- return [2 /*return*/, { action: utils_1.PaymentActions.NOT_SUPPORTED }];
40
+ }
41
+ async getPaymentStatus(paymentSessionData) {
42
+ const id = paymentSessionData.id;
43
+ const paymentIntent = await this.stripe_.paymentIntents.retrieve(id);
44
+ switch (paymentIntent.status) {
45
+ case "requires_payment_method":
46
+ case "requires_confirmation":
47
+ case "processing":
48
+ return utils_1.PaymentSessionStatus.PENDING;
49
+ case "requires_action":
50
+ return utils_1.PaymentSessionStatus.REQUIRES_MORE;
51
+ case "canceled":
52
+ return utils_1.PaymentSessionStatus.CANCELED;
53
+ case "requires_capture":
54
+ return utils_1.PaymentSessionStatus.AUTHORIZED;
55
+ case "succeeded":
56
+ return utils_1.PaymentSessionStatus.CAPTURED;
57
+ default:
58
+ return utils_1.PaymentSessionStatus.PENDING;
59
+ }
60
+ }
61
+ async initiatePayment(input) {
62
+ const intentRequestData = this.getPaymentIntentOptions();
63
+ const { email, extra, session_id, customer } = input.context;
64
+ const { currency_code, amount } = input;
65
+ const description = (extra?.payment_description ??
66
+ this.options_?.paymentDescription);
67
+ const intentRequest = {
68
+ description,
69
+ amount: (0, get_smallest_unit_1.getSmallestUnit)(amount, currency_code),
70
+ currency: currency_code,
71
+ metadata: { session_id: session_id },
72
+ capture_method: this.options_.capture ? "automatic" : "manual",
73
+ ...intentRequestData,
74
+ };
75
+ if (this.options_?.automaticPaymentMethods) {
76
+ intentRequest.automatic_payment_methods = { enabled: true };
77
+ }
78
+ if (customer?.metadata?.stripe_id) {
79
+ intentRequest.customer = customer.metadata.stripe_id;
80
+ }
81
+ else {
82
+ let stripeCustomer;
83
+ try {
84
+ stripeCustomer = await this.stripe_.customers.create({
85
+ email,
86
+ });
87
+ }
88
+ catch (e) {
89
+ return this.buildError("An error occurred in initiatePayment when creating a Stripe customer", e);
90
+ }
91
+ intentRequest.customer = stripeCustomer.id;
92
+ }
93
+ let sessionData;
94
+ try {
95
+ sessionData = (await this.stripe_.paymentIntents.create(intentRequest));
96
+ }
97
+ catch (e) {
98
+ return this.buildError("An error occurred in InitiatePayment during the creation of the stripe payment intent", e);
99
+ }
100
+ return {
101
+ data: sessionData,
102
+ // TODO: REVISIT
103
+ // update_requests: customer?.metadata?.stripe_id
104
+ // ? undefined
105
+ // : {
106
+ // customer_metadata: {
107
+ // stripe_id: intentRequest.customer,
108
+ // },
109
+ // },
110
+ };
111
+ }
112
+ async authorizePayment(paymentSessionData, context) {
113
+ const status = await this.getPaymentStatus(paymentSessionData);
114
+ return { data: paymentSessionData, status };
115
+ }
116
+ async cancelPayment(paymentSessionData) {
117
+ try {
118
+ const id = paymentSessionData.id;
119
+ return (await this.stripe_.paymentIntents.cancel(id));
120
+ }
121
+ catch (error) {
122
+ if (error.payment_intent?.status === types_1.ErrorIntentStatus.CANCELED) {
123
+ return error.payment_intent;
124
+ }
125
+ return this.buildError("An error occurred in cancelPayment", error);
126
+ }
127
+ }
128
+ async capturePayment(paymentSessionData) {
129
+ const id = paymentSessionData.id;
130
+ try {
131
+ const intent = await this.stripe_.paymentIntents.capture(id);
132
+ return intent;
133
+ }
134
+ catch (error) {
135
+ if (error.code === types_1.ErrorCodes.PAYMENT_INTENT_UNEXPECTED_STATE) {
136
+ if (error.payment_intent?.status === types_1.ErrorIntentStatus.SUCCEEDED) {
137
+ return error.payment_intent;
441
138
  }
442
- return [2 /*return*/];
139
+ }
140
+ return this.buildError("An error occurred in capturePayment", error);
141
+ }
142
+ }
143
+ async deletePayment(paymentSessionData) {
144
+ return await this.cancelPayment(paymentSessionData);
145
+ }
146
+ async refundPayment(paymentSessionData, refundAmount) {
147
+ const id = paymentSessionData.id;
148
+ try {
149
+ const { currency } = paymentSessionData;
150
+ await this.stripe_.refunds.create({
151
+ amount: (0, get_smallest_unit_1.getSmallestUnit)(refundAmount, currency),
152
+ payment_intent: id,
443
153
  });
444
- });
445
- };
154
+ }
155
+ catch (e) {
156
+ return this.buildError("An error occurred in refundPayment", e);
157
+ }
158
+ return paymentSessionData;
159
+ }
160
+ async retrievePayment(paymentSessionData) {
161
+ try {
162
+ const id = paymentSessionData.id;
163
+ const intent = await this.stripe_.paymentIntents.retrieve(id);
164
+ intent.amount = (0, get_smallest_unit_1.getAmountFromSmallestUnit)(intent.amount, intent.currency);
165
+ return intent;
166
+ }
167
+ catch (e) {
168
+ return this.buildError("An error occurred in retrievePayment", e);
169
+ }
170
+ }
171
+ async updatePayment(input) {
172
+ const { context, data, currency_code, amount } = input;
173
+ const amountNumeric = (0, get_smallest_unit_1.getSmallestUnit)(amount, currency_code);
174
+ const stripeId = context.customer?.metadata?.stripe_id;
175
+ if (stripeId !== data.customer) {
176
+ const result = await this.initiatePayment(input);
177
+ if ((0, utils_1.isPaymentProviderError)(result)) {
178
+ return this.buildError("An error occurred in updatePayment during the initiate of the new payment for the new customer", result);
179
+ }
180
+ return result;
181
+ }
182
+ else {
183
+ if ((0, utils_1.isPresent)(amount) && data.amount === amountNumeric) {
184
+ return { data };
185
+ }
186
+ try {
187
+ const id = data.id;
188
+ const sessionData = (await this.stripe_.paymentIntents.update(id, {
189
+ amount: amountNumeric,
190
+ }));
191
+ return { data: sessionData };
192
+ }
193
+ catch (e) {
194
+ return this.buildError("An error occurred in updatePayment", e);
195
+ }
196
+ }
197
+ }
198
+ async updatePaymentData(sessionId, data) {
199
+ try {
200
+ // Prevent from updating the amount from here as it should go through
201
+ // the updatePayment method to perform the correct logic
202
+ if ((0, utils_1.isPresent)(data.amount)) {
203
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Cannot update amount, use updatePayment instead");
204
+ }
205
+ return (await this.stripe_.paymentIntents.update(sessionId, {
206
+ ...data,
207
+ }));
208
+ }
209
+ catch (e) {
210
+ return this.buildError("An error occurred in updatePaymentData", e);
211
+ }
212
+ }
213
+ async getWebhookActionAndData(webhookData) {
214
+ const event = this.constructWebhookEvent(webhookData);
215
+ const intent = event.data.object;
216
+ const { currency } = intent;
217
+ switch (event.type) {
218
+ case "payment_intent.amount_capturable_updated":
219
+ return {
220
+ action: utils_1.PaymentActions.AUTHORIZED,
221
+ data: {
222
+ session_id: intent.metadata.session_id,
223
+ amount: (0, get_smallest_unit_1.getAmountFromSmallestUnit)(intent.amount_capturable, currency), // NOTE: revisit when implementing multicapture
224
+ },
225
+ };
226
+ case "payment_intent.succeeded":
227
+ return {
228
+ action: utils_1.PaymentActions.SUCCESSFUL,
229
+ data: {
230
+ session_id: intent.metadata.session_id,
231
+ amount: (0, get_smallest_unit_1.getAmountFromSmallestUnit)(intent.amount_received, currency),
232
+ },
233
+ };
234
+ case "payment_intent.payment_failed":
235
+ return {
236
+ action: utils_1.PaymentActions.FAILED,
237
+ data: {
238
+ session_id: intent.metadata.session_id,
239
+ amount: (0, get_smallest_unit_1.getAmountFromSmallestUnit)(intent.amount, currency),
240
+ },
241
+ };
242
+ default:
243
+ return { action: utils_1.PaymentActions.NOT_SUPPORTED };
244
+ }
245
+ }
446
246
  /**
447
247
  * Constructs Stripe Webhook event
448
248
  * @param {object} data - the data of the webhook request: req.body
449
249
  * ensures integrity of the webhook event
450
250
  * @return {object} Stripe Webhook event
451
251
  */
452
- StripeBase.prototype.constructWebhookEvent = function (data) {
453
- var signature = data.headers["stripe-signature"];
454
- return this.stripe_.webhooks.constructEvent(data.rawData, signature, this.config.webhookSecret);
455
- };
456
- StripeBase.prototype.buildError = function (message, error) {
457
- var _a, _b;
252
+ constructWebhookEvent(data) {
253
+ const signature = data.headers["stripe-signature"];
254
+ return this.stripe_.webhooks.constructEvent(data.rawData, signature, this.options_.webhookSecret);
255
+ }
256
+ buildError(message, error) {
458
257
  return {
459
258
  error: message,
460
259
  code: "code" in error ? error.code : "unknown",
461
260
  detail: (0, utils_1.isPaymentProviderError)(error)
462
- ? "".concat(error.error).concat(os_1.EOL).concat((_a = error.detail) !== null && _a !== void 0 ? _a : "")
261
+ ? `${error.error}${os_1.EOL}${error.detail ?? ""}`
463
262
  : "detail" in error
464
263
  ? error.detail
465
- : (_b = error.message) !== null && _b !== void 0 ? _b : "",
264
+ : error.message ?? "",
466
265
  };
467
- };
468
- return StripeBase;
469
- }(utils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