@lightspeed/online-payments-sdk 0.2.3 → 1.0.0

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.
Files changed (45) hide show
  1. package/dist/cjs/v1/EventBroadcaster.js +61 -0
  2. package/dist/cjs/v1/adyen/ResultBuilder.js +47 -0
  3. package/dist/cjs/v1/adyen/widget.js +14 -30
  4. package/dist/cjs/v1/common.js +0 -36
  5. package/dist/cjs/v1/error.js +45 -1
  6. package/dist/cjs/v1/index.js +6 -7
  7. package/dist/cjs/v1/logging/common.js +36 -0
  8. package/dist/cjs/v1/logging/datadog/logger.js +6 -3
  9. package/dist/cjs/v1/logging/noop-logger.js +1 -1
  10. package/dist/cjs/v1/session.js +3 -3
  11. package/dist/cjs/v1/stripe/ResultBuilder.js +59 -0
  12. package/dist/cjs/v1/stripe/widget.js +68 -43
  13. package/dist/cjs/v1/widget.js +44 -32
  14. package/dist/v1/EventBroadcaster.d.ts +39 -0
  15. package/dist/v1/EventBroadcaster.js +58 -0
  16. package/dist/v1/adyen/ResultBuilder.d.ts +7 -0
  17. package/dist/v1/adyen/ResultBuilder.js +44 -0
  18. package/dist/v1/adyen/widget.d.ts +1 -3
  19. package/dist/v1/adyen/widget.js +14 -29
  20. package/dist/v1/common.d.ts +5 -17
  21. package/dist/v1/common.js +1 -35
  22. package/dist/v1/error.d.ts +18 -2
  23. package/dist/v1/error.js +44 -0
  24. package/dist/v1/index.d.ts +4 -4
  25. package/dist/v1/index.js +1 -2
  26. package/dist/v1/logging/common.d.ts +2 -1
  27. package/dist/v1/logging/common.js +35 -0
  28. package/dist/v1/logging/datadog/logger.d.ts +1 -1
  29. package/dist/v1/logging/datadog/logger.js +6 -3
  30. package/dist/v1/logging/noop-logger.d.ts +1 -1
  31. package/dist/v1/logging/noop-logger.js +1 -1
  32. package/dist/v1/session.js +2 -2
  33. package/dist/v1/stripe/ResultBuilder.d.ts +7 -0
  34. package/dist/v1/stripe/ResultBuilder.js +56 -0
  35. package/dist/v1/stripe/widget.d.ts +3 -4
  36. package/dist/v1/stripe/widget.js +68 -42
  37. package/dist/v1/widget.d.ts +5 -3
  38. package/dist/v1/widget.js +44 -32
  39. package/package.json +1 -1
  40. package/dist/cjs/v1/session.error.js +0 -43
  41. package/dist/cjs/v1/widget.error.js +0 -43
  42. package/dist/v1/session.error.d.ts +0 -15
  43. package/dist/v1/session.error.js +0 -40
  44. package/dist/v1/widget.error.d.ts +0 -15
  45. package/dist/v1/widget.error.js +0 -40
@@ -0,0 +1,56 @@
1
+ var EventBuilder = /** @class */ (function () {
2
+ function EventBuilder() {
3
+ }
4
+ EventBuilder.fromSetupIntent = function (setupIntent) {
5
+ var loggingEnrichment = {
6
+ setupIntentId: setupIntent === null || setupIntent === void 0 ? void 0 : setupIntent.id,
7
+ };
8
+ if (setupIntent.status === 'succeeded') {
9
+ return { status: 'Succeeded', code: 'Authorized', loggingEnrichment: loggingEnrichment };
10
+ }
11
+ return { status: 'Pending', code: 'Processing', loggingEnrichment: loggingEnrichment };
12
+ };
13
+ EventBuilder.fromStripeError = function (stripeError) {
14
+ var _a, _b;
15
+ var loggingEnrichment = {
16
+ message: stripeError === null || stripeError === void 0 ? void 0 : stripeError.message,
17
+ type: stripeError === null || stripeError === void 0 ? void 0 : stripeError.type,
18
+ paymentIntentId: (_a = stripeError === null || stripeError === void 0 ? void 0 : stripeError.payment_intent) === null || _a === void 0 ? void 0 : _a.id,
19
+ setupIntentId: (_b = stripeError === null || stripeError === void 0 ? void 0 : stripeError.setup_intent) === null || _b === void 0 ? void 0 : _b.id,
20
+ };
21
+ switch (stripeError.code) {
22
+ case 'expired_card':
23
+ case 'incorrect_cvc':
24
+ case 'incorrect_number':
25
+ return {
26
+ status: 'Refused',
27
+ code: 'CardValidation',
28
+ loggingEnrichment: loggingEnrichment,
29
+ };
30
+ case 'processing_error':
31
+ case 'card_declined':
32
+ return {
33
+ status: 'Refused',
34
+ code: 'Generic',
35
+ loggingEnrichment: loggingEnrichment,
36
+ };
37
+ default:
38
+ return {
39
+ status: 'Error',
40
+ code: 'Unexpected',
41
+ loggingEnrichment: loggingEnrichment,
42
+ };
43
+ }
44
+ };
45
+ EventBuilder.fromPaymentIntent = function (paymentIntent) {
46
+ var loggingEnrichment = {
47
+ paymentIntentId: paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.id,
48
+ };
49
+ if (paymentIntent.status === 'succeeded') {
50
+ return { status: 'Succeeded', code: 'Authorized', loggingEnrichment: loggingEnrichment };
51
+ }
52
+ return { status: 'Pending', code: 'Processing', loggingEnrichment: loggingEnrichment };
53
+ };
54
+ return EventBuilder;
55
+ }());
56
+ export { EventBuilder };
@@ -1,6 +1,5 @@
1
- import type { SetupIntent, PaymentIntent } from '@stripe/stripe-js';
2
1
  import { StripeContext } from './session';
3
- import { Callbacks, DefaultValues, ResultCode, WidgetController, WidgetInterface } from '../common';
4
- export declare function mapStripeResultCode(code: SetupIntent.Status | PaymentIntent.Status): ResultCode;
5
- export declare function mount(mountElement: HTMLElement, context: StripeContext, listeners: Callbacks, defaultValues?: DefaultValues): Promise<WidgetController>;
2
+ import { DefaultValues, WidgetController, WidgetInterface } from '../common';
3
+ import { EventBroadcaster } from '../EventBroadcaster';
4
+ export declare function mount(mountElement: HTMLElement, context: StripeContext, eventBroadcaster: EventBroadcaster, defaultValues?: DefaultValues): Promise<WidgetController>;
6
5
  export declare const StripeWidget: WidgetInterface<StripeContext>;
@@ -35,14 +35,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import { loadStripe } from '@stripe/stripe-js';
38
- export function mapStripeResultCode(code) {
39
- switch (code) {
40
- case 'succeeded':
41
- return 'Success';
42
- default:
43
- return 'Unexpected';
44
- }
45
- }
38
+ import { EventBuilder } from './ResultBuilder';
39
+ import { InvalidSessionPayloadError, ProcessingError } from '../error';
46
40
  function init(context) {
47
41
  return __awaiter(this, void 0, void 0, function () {
48
42
  var publishableKey, clientSecret, customerSessionClientSecret, loadedStripe, stripe, elements;
@@ -66,7 +60,7 @@ function init(context) {
66
60
  });
67
61
  });
68
62
  }
69
- export function mount(mountElement, context, listeners, defaultValues) {
63
+ export function mount(mountElement, context, eventBroadcaster, defaultValues) {
70
64
  return __awaiter(this, void 0, void 0, function () {
71
65
  var _a, stripe, elements, options, paymentElement;
72
66
  var _this = this;
@@ -93,51 +87,45 @@ export function mount(mountElement, context, listeners, defaultValues) {
93
87
  };
94
88
  }
95
89
  paymentElement = elements.create('payment', options);
96
- paymentElement.on('ready', function () { var _a; return (_a = listeners.onReady) === null || _a === void 0 ? void 0 : _a.call(listeners); });
90
+ paymentElement.on('ready', function () {
91
+ return eventBroadcaster.publish({ status: 'Ready', code: 'Ready' });
92
+ });
97
93
  paymentElement.mount(mountElement);
98
94
  return [2 /*return*/, {
99
95
  unmount: function () { return paymentElement.unmount(); },
100
96
  submit: function () { return __awaiter(_this, void 0, void 0, function () {
101
- var result, _a, error, setupIntent, _b, error, paymentIntent;
102
- var _c, _d;
103
- return __generator(this, function (_e) {
104
- switch (_e.label) {
97
+ var result;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
105
100
  case 0:
106
- result = { status: 'Pending', code: 'Unexpected' };
101
+ result = undefined;
102
+ if (!['save-card', 'payment'].includes(context.intent)) {
103
+ eventBroadcaster.publish({
104
+ status: 'Error',
105
+ code: 'InvalidSessionPayload',
106
+ loggingEnrichment: {
107
+ message: "context has an unexpect intent of ".concat(context.intent),
108
+ },
109
+ });
110
+ throw new InvalidSessionPayloadError();
111
+ }
107
112
  if (!(context.intent === 'save-card')) return [3 /*break*/, 2];
108
- return [4 /*yield*/, stripe.confirmSetup({
109
- elements: elements,
110
- redirect: 'if_required',
111
- confirmParams: { return_url: window.location.href },
112
- })];
113
+ return [4 /*yield*/, handleSaveCard(stripe, elements)];
113
114
  case 1:
114
- _a = _e.sent(), error = _a.error, setupIntent = _a.setupIntent;
115
- result = {
116
- status: 'Complete',
117
- code: error ? 'Failure' : mapStripeResultCode(setupIntent.status),
118
- };
119
- _e.label = 2;
115
+ result = _a.sent();
116
+ _a.label = 2;
120
117
  case 2:
121
118
  if (!(context.intent === 'payment')) return [3 /*break*/, 4];
122
- return [4 /*yield*/, stripe.confirmPayment({
123
- elements: elements,
124
- redirect: 'if_required',
125
- confirmParams: { return_url: window.location.href },
126
- })];
119
+ return [4 /*yield*/, handlePayment(stripe, elements)];
127
120
  case 3:
128
- _b = _e.sent(), error = _b.error, paymentIntent = _b.paymentIntent;
129
- result = {
130
- status: 'Complete',
131
- code: error ? 'Failure' : mapStripeResultCode(paymentIntent.status),
132
- };
133
- _e.label = 4;
121
+ result = _a.sent();
122
+ _a.label = 4;
134
123
  case 4:
135
- if (result.code === 'Failure') {
136
- (_c = listeners.onFail) === null || _c === void 0 ? void 0 : _c.call(listeners, result);
137
- }
138
- else {
139
- (_d = listeners.onComplete) === null || _d === void 0 ? void 0 : _d.call(listeners, result);
124
+ if (!result) {
125
+ eventBroadcaster.publish({ status: 'Error', code: 'Unexpected' });
126
+ throw new ProcessingError();
140
127
  }
128
+ eventBroadcaster.publish(result);
141
129
  return [2 /*return*/, result];
142
130
  }
143
131
  });
@@ -147,6 +135,44 @@ export function mount(mountElement, context, listeners, defaultValues) {
147
135
  });
148
136
  });
149
137
  }
138
+ function handleSaveCard(stripe, elements) {
139
+ return __awaiter(this, void 0, void 0, function () {
140
+ var _a, error, setupIntent;
141
+ return __generator(this, function (_b) {
142
+ switch (_b.label) {
143
+ case 0: return [4 /*yield*/, stripe.confirmSetup({
144
+ elements: elements,
145
+ redirect: 'if_required',
146
+ confirmParams: { return_url: window.location.href },
147
+ })];
148
+ case 1:
149
+ _a = _b.sent(), error = _a.error, setupIntent = _a.setupIntent;
150
+ return [2 /*return*/, error
151
+ ? EventBuilder.fromStripeError(error)
152
+ : EventBuilder.fromSetupIntent(setupIntent)];
153
+ }
154
+ });
155
+ });
156
+ }
157
+ function handlePayment(stripe, elements) {
158
+ return __awaiter(this, void 0, void 0, function () {
159
+ var _a, error, paymentIntent;
160
+ return __generator(this, function (_b) {
161
+ switch (_b.label) {
162
+ case 0: return [4 /*yield*/, stripe.confirmPayment({
163
+ elements: elements,
164
+ redirect: 'if_required',
165
+ confirmParams: { return_url: window.location.href },
166
+ })];
167
+ case 1:
168
+ _a = _b.sent(), error = _a.error, paymentIntent = _a.paymentIntent;
169
+ return [2 /*return*/, error
170
+ ? EventBuilder.fromStripeError(error)
171
+ : EventBuilder.fromPaymentIntent(paymentIntent)];
172
+ }
173
+ });
174
+ });
175
+ }
150
176
  export var StripeWidget = {
151
177
  mount: mount,
152
178
  };
@@ -1,6 +1,8 @@
1
- import { Callbacks, WidgetController, DefaultValues } from './common';
1
+ import { WidgetController, DefaultValues } from './common';
2
+ import { EventListeners } from './EventBroadcaster';
2
3
  export type PaymentWidgetConfiguration = {
3
4
  mountPoint: HTMLElement;
4
5
  defaultValues?: DefaultValues;
5
- } & Callbacks;
6
- export declare function mountPaymentWidget(session: string, { mountPoint, onComplete, onFail, onReady, defaultValues, }: PaymentWidgetConfiguration): Promise<WidgetController>;
6
+ listeners?: EventListeners;
7
+ };
8
+ export declare function mountPaymentWidget(session: string, config: PaymentWidgetConfiguration): Promise<WidgetController>;
package/dist/v1/widget.js CHANGED
@@ -35,46 +35,58 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import { AdyenWidget } from './adyen/widget';
38
- import { withLogging, } from './common';
39
38
  import { StripeWidget } from './stripe/widget';
40
39
  import { decodePaymentSessionToContext } from './session';
41
- import { UnsupportedLocationError } from './widget.error';
40
+ import { UnsupportedLocationError } from './error';
42
41
  import { getLogger } from './logging/logger';
43
- export function mountPaymentWidget(session_1, _a) {
44
- return __awaiter(this, arguments, void 0, function (session, _b) {
45
- var decodedSession, logger, handlers, widgetController, _c;
46
- var mountPoint = _b.mountPoint, onComplete = _b.onComplete, onFail = _b.onFail, onReady = _b.onReady, defaultValues = _b.defaultValues;
47
- return __generator(this, function (_d) {
48
- switch (_d.label) {
42
+ import { withLogging } from './logging/common';
43
+ import { EventBroadcaster } from './EventBroadcaster';
44
+ export function mountPaymentWidget(session, config) {
45
+ return __awaiter(this, void 0, void 0, function () {
46
+ var eventBroadcaster, decodedSession, logger_1, widgetController, _a, error_1;
47
+ return __generator(this, function (_b) {
48
+ switch (_b.label) {
49
49
  case 0:
50
+ eventBroadcaster = new EventBroadcaster(config.listeners);
51
+ _b.label = 1;
52
+ case 1:
53
+ _b.trys.push([1, 8, , 9]);
50
54
  decodedSession = decodePaymentSessionToContext(session);
51
- logger = getLogger(decodedSession.logging);
52
- logger.setSessionContext(decodedSession.metadata);
53
- handlers = {
54
- onComplete: withLogging(logger, 'complete', onComplete || (function () { })),
55
- onFail: withLogging(logger, 'fail', onFail || (function () { })),
56
- onReady: withLogging(logger, 'ready', onReady || (function () { })),
57
- };
58
- logger.log('info', 'mount', { sessionContext: decodedSession.context });
59
- _c = decodedSession.psp;
60
- switch (_c) {
61
- case 'ADYEN': return [3 /*break*/, 1];
62
- case 'STRIPE': return [3 /*break*/, 3];
55
+ logger_1 = getLogger(decodedSession.logging);
56
+ logger_1.setSessionMetadata(decodedSession.metadata);
57
+ eventBroadcaster.registerMiddleware(function (event) {
58
+ logger_1.log('info', event.status, event);
59
+ return event;
60
+ });
61
+ logger_1.log('info', 'Mount');
62
+ widgetController = void 0;
63
+ _a = decodedSession.psp;
64
+ switch (_a) {
65
+ case 'ADYEN': return [3 /*break*/, 2];
66
+ case 'STRIPE': return [3 /*break*/, 4];
63
67
  }
64
- return [3 /*break*/, 5];
65
- case 1: return [4 /*yield*/, AdyenWidget.mount(mountPoint, decodedSession.context, handlers)];
66
- case 2:
67
- widgetController = _d.sent();
68
68
  return [3 /*break*/, 6];
69
- case 3: return [4 /*yield*/, StripeWidget.mount(mountPoint, decodedSession.context, handlers, defaultValues)];
70
- case 4:
71
- widgetController = _d.sent();
72
- return [3 /*break*/, 6];
73
- case 5: throw new UnsupportedLocationError();
74
- case 6:
75
- widgetController.submit = withLogging(logger, 'submit', widgetController.submit);
76
- widgetController.unmount = withLogging(logger, 'unmount', widgetController.unmount);
69
+ case 2: return [4 /*yield*/, AdyenWidget.mount(config.mountPoint, decodedSession.context, eventBroadcaster)];
70
+ case 3:
71
+ widgetController = _b.sent();
72
+ return [3 /*break*/, 7];
73
+ case 4: return [4 /*yield*/, StripeWidget.mount(config.mountPoint, decodedSession.context, eventBroadcaster, config.defaultValues)];
74
+ case 5:
75
+ widgetController = _b.sent();
76
+ return [3 /*break*/, 7];
77
+ case 6: throw new UnsupportedLocationError();
78
+ case 7:
79
+ widgetController.submit = withLogging(logger_1, 'Submit', widgetController.submit);
80
+ widgetController.unmount = withLogging(logger_1, 'Unmount', widgetController.unmount);
77
81
  return [2 /*return*/, widgetController];
82
+ case 8:
83
+ error_1 = _b.sent();
84
+ eventBroadcaster.publish({
85
+ code: 'Unexpected',
86
+ status: 'Error',
87
+ });
88
+ throw error_1;
89
+ case 9: return [2 /*return*/];
78
90
  }
79
91
  });
80
92
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightspeed/online-payments-sdk",
3
- "version": "0.2.3",
3
+ "version": "1.0.0",
4
4
  "description": "Process online-payments with Lightspeed Payments",
5
5
  "author": "Lightspeed Commerce Inc.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -1,43 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.InvalidSessionError = exports.InvalidSessionStructureError = void 0;
19
- var error_1 = require("./error");
20
- /**
21
- * Error thrown when the session structure is invalid.
22
- * @typedef {Error} InvalidSessionStructureError
23
- */
24
- var InvalidSessionStructureError = /** @class */ (function (_super) {
25
- __extends(InvalidSessionStructureError, _super);
26
- function InvalidSessionStructureError() {
27
- return _super.call(this, 'InvalidSessionStructure', 'The contents of the session are invalid') || this;
28
- }
29
- return InvalidSessionStructureError;
30
- }(error_1.BaseError));
31
- exports.InvalidSessionStructureError = InvalidSessionStructureError;
32
- /**
33
- * Error thrown when the session is invalid.
34
- * @typedef {Error} InvalidSessionError
35
- */
36
- var InvalidSessionError = /** @class */ (function (_super) {
37
- __extends(InvalidSessionError, _super);
38
- function InvalidSessionError() {
39
- return _super.call(this, 'InvalidSessionError', 'The provided session is invalid. Verify the correct session is being passed') || this;
40
- }
41
- return InvalidSessionError;
42
- }(error_1.BaseError));
43
- exports.InvalidSessionError = InvalidSessionError;
@@ -1,43 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.PaymentProcessingError = exports.UnsupportedLocationError = void 0;
19
- var error_1 = require("./error");
20
- /**
21
- * Error thrown when the location is unsupported.
22
- * @typedef {Error} UnsupportedLocationError
23
- */
24
- var UnsupportedLocationError = /** @class */ (function (_super) {
25
- __extends(UnsupportedLocationError, _super);
26
- function UnsupportedLocationError() {
27
- return _super.call(this, 'UnsupportedLocation', 'The location you are attempting to process with is not supported') || this;
28
- }
29
- return UnsupportedLocationError;
30
- }(error_1.BaseError));
31
- exports.UnsupportedLocationError = UnsupportedLocationError;
32
- /**
33
- * Error thrown when the session structure is invalid.
34
- * @typedef {Error} PaymentProcessingError
35
- */
36
- var PaymentProcessingError = /** @class */ (function (_super) {
37
- __extends(PaymentProcessingError, _super);
38
- function PaymentProcessingError(message) {
39
- return _super.call(this, 'PaymentProcessing', "An error occurred while processing the payment. ".concat(message)) || this;
40
- }
41
- return PaymentProcessingError;
42
- }(error_1.BaseError));
43
- exports.PaymentProcessingError = PaymentProcessingError;
@@ -1,15 +0,0 @@
1
- import { BaseError } from './error';
2
- /**
3
- * Error thrown when the session structure is invalid.
4
- * @typedef {Error} InvalidSessionStructureError
5
- */
6
- export declare class InvalidSessionStructureError extends BaseError {
7
- constructor();
8
- }
9
- /**
10
- * Error thrown when the session is invalid.
11
- * @typedef {Error} InvalidSessionError
12
- */
13
- export declare class InvalidSessionError extends BaseError {
14
- constructor();
15
- }
@@ -1,40 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { BaseError } from './error';
17
- /**
18
- * Error thrown when the session structure is invalid.
19
- * @typedef {Error} InvalidSessionStructureError
20
- */
21
- var InvalidSessionStructureError = /** @class */ (function (_super) {
22
- __extends(InvalidSessionStructureError, _super);
23
- function InvalidSessionStructureError() {
24
- return _super.call(this, 'InvalidSessionStructure', 'The contents of the session are invalid') || this;
25
- }
26
- return InvalidSessionStructureError;
27
- }(BaseError));
28
- export { InvalidSessionStructureError };
29
- /**
30
- * Error thrown when the session is invalid.
31
- * @typedef {Error} InvalidSessionError
32
- */
33
- var InvalidSessionError = /** @class */ (function (_super) {
34
- __extends(InvalidSessionError, _super);
35
- function InvalidSessionError() {
36
- return _super.call(this, 'InvalidSessionError', 'The provided session is invalid. Verify the correct session is being passed') || this;
37
- }
38
- return InvalidSessionError;
39
- }(BaseError));
40
- export { InvalidSessionError };
@@ -1,15 +0,0 @@
1
- import { BaseError } from './error';
2
- /**
3
- * Error thrown when the location is unsupported.
4
- * @typedef {Error} UnsupportedLocationError
5
- */
6
- export declare class UnsupportedLocationError extends BaseError {
7
- constructor();
8
- }
9
- /**
10
- * Error thrown when the session structure is invalid.
11
- * @typedef {Error} PaymentProcessingError
12
- */
13
- export declare class PaymentProcessingError extends BaseError {
14
- constructor(message: string);
15
- }
@@ -1,40 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { BaseError } from './error';
17
- /**
18
- * Error thrown when the location is unsupported.
19
- * @typedef {Error} UnsupportedLocationError
20
- */
21
- var UnsupportedLocationError = /** @class */ (function (_super) {
22
- __extends(UnsupportedLocationError, _super);
23
- function UnsupportedLocationError() {
24
- return _super.call(this, 'UnsupportedLocation', 'The location you are attempting to process with is not supported') || this;
25
- }
26
- return UnsupportedLocationError;
27
- }(BaseError));
28
- export { UnsupportedLocationError };
29
- /**
30
- * Error thrown when the session structure is invalid.
31
- * @typedef {Error} PaymentProcessingError
32
- */
33
- var PaymentProcessingError = /** @class */ (function (_super) {
34
- __extends(PaymentProcessingError, _super);
35
- function PaymentProcessingError(message) {
36
- return _super.call(this, 'PaymentProcessing', "An error occurred while processing the payment. ".concat(message)) || this;
37
- }
38
- return PaymentProcessingError;
39
- }(BaseError));
40
- export { PaymentProcessingError };