@lightspeed/online-payments-sdk 0.2.4 → 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.
- package/dist/cjs/v1/EventBroadcaster.js +61 -0
- package/dist/cjs/v1/adyen/ResultBuilder.js +47 -0
- package/dist/cjs/v1/adyen/widget.js +14 -30
- package/dist/cjs/v1/common.js +0 -36
- package/dist/cjs/v1/error.js +45 -1
- package/dist/cjs/v1/index.js +6 -7
- package/dist/cjs/v1/logging/common.js +36 -0
- package/dist/cjs/v1/logging/datadog/logger.js +4 -1
- package/dist/cjs/v1/session.js +3 -3
- package/dist/cjs/v1/stripe/ResultBuilder.js +59 -0
- package/dist/cjs/v1/stripe/widget.js +68 -43
- package/dist/cjs/v1/widget.js +44 -32
- package/dist/v1/EventBroadcaster.d.ts +39 -0
- package/dist/v1/EventBroadcaster.js +58 -0
- package/dist/v1/adyen/ResultBuilder.d.ts +7 -0
- package/dist/v1/adyen/ResultBuilder.js +44 -0
- package/dist/v1/adyen/widget.d.ts +1 -3
- package/dist/v1/adyen/widget.js +14 -29
- package/dist/v1/common.d.ts +5 -17
- package/dist/v1/common.js +1 -35
- package/dist/v1/error.d.ts +18 -2
- package/dist/v1/error.js +44 -0
- package/dist/v1/index.d.ts +4 -4
- package/dist/v1/index.js +1 -2
- package/dist/v1/logging/common.d.ts +1 -0
- package/dist/v1/logging/common.js +35 -0
- package/dist/v1/logging/datadog/logger.js +4 -1
- package/dist/v1/session.js +2 -2
- package/dist/v1/stripe/ResultBuilder.d.ts +7 -0
- package/dist/v1/stripe/ResultBuilder.js +56 -0
- package/dist/v1/stripe/widget.d.ts +3 -4
- package/dist/v1/stripe/widget.js +68 -42
- package/dist/v1/widget.d.ts +5 -3
- package/dist/v1/widget.js +44 -32
- package/package.json +1 -1
- package/dist/cjs/v1/session.error.js +0 -43
- package/dist/cjs/v1/widget.error.js +0 -43
- package/dist/v1/session.error.d.ts +0 -15
- package/dist/v1/session.error.js +0 -40
- package/dist/v1/widget.error.d.ts +0 -15
- package/dist/v1/widget.error.js +0 -40
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { SetupIntent, PaymentIntent } from '@stripe/stripe-js';
|
|
2
1
|
import { StripeContext } from './session';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare function mount(mountElement: HTMLElement, context: StripeContext,
|
|
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>;
|
package/dist/v1/stripe/widget.js
CHANGED
|
@@ -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
|
-
|
|
39
|
-
|
|
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,
|
|
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 () {
|
|
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
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
switch (_e.label) {
|
|
97
|
+
var result;
|
|
98
|
+
return __generator(this, function (_a) {
|
|
99
|
+
switch (_a.label) {
|
|
105
100
|
case 0:
|
|
106
|
-
result =
|
|
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
|
|
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
|
-
|
|
115
|
-
|
|
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
|
|
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
|
-
|
|
129
|
-
|
|
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
|
|
136
|
-
(
|
|
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
|
};
|
package/dist/v1/widget.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
6
|
-
|
|
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 './
|
|
40
|
+
import { UnsupportedLocationError } from './error';
|
|
42
41
|
import { getLogger } from './logging/logger';
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
switch (
|
|
61
|
-
case 'ADYEN': return [3 /*break*/,
|
|
62
|
-
case 'STRIPE': return [3 /*break*/,
|
|
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
|
|
70
|
-
case
|
|
71
|
-
widgetController =
|
|
72
|
-
return [3 /*break*/,
|
|
73
|
-
case
|
|
74
|
-
case
|
|
75
|
-
widgetController
|
|
76
|
-
|
|
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,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
|
-
}
|
package/dist/v1/session.error.js
DELETED
|
@@ -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
|
-
}
|
package/dist/v1/widget.error.js
DELETED
|
@@ -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 };
|