@justifi/webcomponents 4.13.0-rc.0 → 4.13.0-rc.1
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/{Api-a06b996e.js → Api-ab34a402.js} +4 -1
- package/dist/cjs/{Business-98686045.js → Business-32a53780.js} +1 -1
- package/dist/cjs/{utils-f8079741.js → ComponentError-8ba0c0e7.js} +0 -25
- package/dist/cjs/{business-additional-questions-schema-f8086f7a.js → business-additional-questions-schema-0a35f597.js} +1 -1
- package/dist/cjs/{business-form-options-fd1c0032.js → business-form-options-43366c9a.js} +1 -1
- package/dist/cjs/form-control-date_3.cjs.entry.js +1 -1
- package/dist/cjs/form-control-file.cjs.entry.js +44 -0
- package/dist/cjs/justifi-additional-questions-form-step_5.cjs.entry.js +6 -6
- package/dist/cjs/justifi-additional-questions_4.cjs.entry.js +3 -3
- package/dist/cjs/justifi-billing-form_4.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-details.cjs.entry.js +9 -8
- package/dist/cjs/justifi-business-form.cjs.entry.js +6 -6
- package/dist/cjs/justifi-business-list.cjs.entry.js +3 -3
- package/dist/cjs/justifi-checkout-core.cjs.entry.js +22 -8
- package/dist/cjs/justifi-checkout.cjs.entry.js +14 -9
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +7 -6
- package/dist/cjs/justifi-new-payment-method_4.cjs.entry.js +11 -11
- package/dist/cjs/justifi-owner-form.cjs.entry.js +5 -5
- package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +1 -1
- package/dist/cjs/justifi-payment-details.cjs.entry.js +8 -7
- package/dist/cjs/justifi-payment-form.cjs.entry.js +6 -5
- package/dist/cjs/justifi-payments-list.cjs.entry.js +8 -7
- package/dist/cjs/justifi-payout-details.cjs.entry.js +8 -7
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +7 -6
- package/dist/cjs/justifi-proceeds-list.cjs.entry.js +1 -1
- package/dist/cjs/justifi-refund-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-subaccount-details.cjs.entry.js +1 -1
- package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{payload-parsers-fe27be37.js → payload-parsers-6c4b5323.js} +2 -2
- package/dist/cjs/{payment.service-9db24ab9.js → payment.service-336189d3.js} +1 -1
- package/dist/cjs/{payout.service-a0efb71a.js → payout.service-6012d576.js} +1 -1
- package/dist/cjs/{state-options-4145f9b4.js → state-options-4fbcb48a.js} +4 -0
- package/dist/cjs/utils-491248ca.js +28 -0
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/api/Api.js +4 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/checkout/checkout-actions.js +1 -2
- package/dist/collection/components/checkout/checkout-core.js +22 -9
- package/dist/collection/components/checkout/checkout.js +30 -2
- package/dist/collection/components/checkout/new-payment-method.js +11 -11
- package/dist/collection/components/checkout/test/checkout-actions.spec.js +1 -3
- package/dist/collection/components/checkout/test/checkout-core.spec.js +2 -2
- package/dist/collection/components/form/form-control-file.css +1806 -0
- package/dist/collection/components/form/form-control-file.js +169 -0
- package/dist/collection/components/form/test/form-control-file.spec.js +84 -0
- package/dist/collection/utils/state-options.js +4 -0
- package/dist/docs.json +183 -4
- package/dist/esm/{Api-0e88671c.js → Api-e9d568c7.js} +4 -1
- package/dist/esm/{Business-6e0efa26.js → Business-d83fbdb4.js} +1 -1
- package/dist/esm/{utils-4609f32c.js → ComponentError-2a58dbbc.js} +1 -23
- package/dist/esm/{business-additional-questions-schema-8e742129.js → business-additional-questions-schema-e96b0509.js} +1 -1
- package/dist/esm/{business-form-options-75c0a7ec.js → business-form-options-de11bc46.js} +1 -1
- package/dist/esm/form-control-date_3.entry.js +1 -1
- package/dist/esm/form-control-file.entry.js +40 -0
- package/dist/esm/justifi-additional-questions-form-step_5.entry.js +6 -6
- package/dist/esm/justifi-additional-questions_4.entry.js +3 -3
- package/dist/esm/justifi-billing-form_4.entry.js +2 -2
- package/dist/esm/justifi-business-details.entry.js +5 -4
- package/dist/esm/justifi-business-form.entry.js +6 -6
- package/dist/esm/justifi-business-list.entry.js +3 -3
- package/dist/esm/justifi-checkout-core.entry.js +22 -8
- package/dist/esm/justifi-checkout.entry.js +11 -6
- package/dist/esm/justifi-gross-payment-chart.entry.js +3 -2
- package/dist/esm/justifi-new-payment-method_4.entry.js +11 -11
- package/dist/esm/justifi-owner-form.entry.js +5 -5
- package/dist/esm/justifi-payment-balance-transactions.entry.js +1 -1
- package/dist/esm/justifi-payment-details.entry.js +4 -3
- package/dist/esm/justifi-payment-form.entry.js +2 -1
- package/dist/esm/justifi-payments-list.entry.js +4 -3
- package/dist/esm/justifi-payout-details.entry.js +4 -3
- package/dist/esm/justifi-payouts-list.entry.js +4 -3
- package/dist/esm/justifi-proceeds-list.entry.js +1 -1
- package/dist/esm/justifi-refund-form.entry.js +1 -1
- package/dist/esm/justifi-subaccount-details.entry.js +1 -1
- package/dist/esm/justifi-subaccounts-list.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{payload-parsers-73c12fa2.js → payload-parsers-32028700.js} +2 -2
- package/dist/esm/{payment.service-ec28a959.js → payment.service-2fdc5018.js} +1 -1
- package/dist/esm/{payout.service-5fd5986c.js → payout.service-15064bcc.js} +1 -1
- package/dist/esm/{state-options-c0b757ad.js → state-options-a356fb11.js} +4 -0
- package/dist/esm/utils-f580d6b7.js +25 -0
- package/dist/esm/webcomponents.js +1 -1
- package/dist/module/Api.js +4 -1
- package/dist/module/ComponentError.js +16 -0
- package/dist/module/checkout-core.js +22 -9
- package/dist/module/form-control-file.d.ts +11 -0
- package/dist/module/form-control-file.js +67 -0
- package/dist/module/justifi-business-details.js +2 -1
- package/dist/module/justifi-checkout.js +11 -7
- package/dist/module/justifi-gross-payment-chart.js +2 -1
- package/dist/module/justifi-payment-details.js +2 -1
- package/dist/module/justifi-payment-form.js +2 -1
- package/dist/module/justifi-payments-list.js +2 -1
- package/dist/module/justifi-payout-details.js +2 -1
- package/dist/module/justifi-payouts-list.js +2 -1
- package/dist/module/new-payment-method.js +11 -11
- package/dist/module/payment-method-form.js +1 -1
- package/dist/module/state-options.js +4 -0
- package/dist/module/utils3.js +2 -15
- package/dist/types/api/Api.d.ts +1 -0
- package/dist/types/components/checkout/checkout-core.d.ts +6 -2
- package/dist/types/components/checkout/checkout.d.ts +3 -0
- package/dist/types/components/checkout/payment-method-payload.d.ts +5 -0
- package/dist/types/components/form/form-control-file.d.ts +17 -0
- package/dist/types/components/payment-method-form/payment-method-responses.d.ts +1 -0
- package/dist/types/components.d.ts +57 -0
- package/dist/webcomponents/p-00ca94d1.js +1 -0
- package/dist/webcomponents/p-02b18979.entry.js +1 -0
- package/dist/webcomponents/p-0d80748f.js +1 -0
- package/dist/webcomponents/{p-30b6ea06.entry.js → p-101b2648.entry.js} +1 -1
- package/dist/webcomponents/{p-ed6ca114.js → p-132ba228.js} +1 -1
- package/dist/webcomponents/p-13e2f667.js +1 -0
- package/dist/webcomponents/{p-19885f77.entry.js → p-1885c478.entry.js} +1 -1
- package/dist/webcomponents/{p-8abba4c2.entry.js → p-23099f1f.entry.js} +1 -1
- package/dist/webcomponents/{p-31fe7232.entry.js → p-230b96df.entry.js} +1 -1
- package/dist/webcomponents/{p-35e59bb5.entry.js → p-3367225e.entry.js} +1 -1
- package/dist/webcomponents/{p-57fbd98d.js → p-3da23f21.js} +1 -1
- package/dist/webcomponents/p-41bdee27.entry.js +1 -0
- package/dist/webcomponents/{p-5ff7826e.entry.js → p-4c84952f.entry.js} +1 -1
- package/dist/webcomponents/p-6078a370.js +1 -0
- package/dist/webcomponents/{p-3ffe6784.js → p-61fd33c7.js} +1 -1
- package/dist/webcomponents/{p-2c4c5f0d.entry.js → p-64710363.entry.js} +1 -1
- package/dist/webcomponents/{p-9245777b.js → p-731085e3.js} +1 -1
- package/dist/webcomponents/p-78b32fb9.entry.js +1 -0
- package/dist/webcomponents/p-7e334dce.entry.js +1 -0
- package/dist/webcomponents/{p-5a789239.entry.js → p-7faacb1e.entry.js} +1 -1
- package/dist/webcomponents/{p-49c349e7.js → p-9ada56da.js} +1 -1
- package/dist/webcomponents/p-9ba31a6a.entry.js +1 -0
- package/dist/webcomponents/{p-4d335a3d.entry.js → p-a9af8f40.entry.js} +1 -1
- package/dist/webcomponents/p-b81afd51.entry.js +1 -0
- package/dist/webcomponents/{p-c556deda.entry.js → p-bb58e656.entry.js} +1 -1
- package/dist/webcomponents/p-bc12b8b9.js +1 -0
- package/dist/webcomponents/p-bfe7c55c.entry.js +1 -0
- package/dist/webcomponents/p-c1be3378.entry.js +1 -0
- package/dist/webcomponents/p-cb31488b.entry.js +1 -0
- package/dist/webcomponents/{p-31e8f29c.entry.js → p-cf3151a3.entry.js} +1 -1
- package/dist/webcomponents/{p-f3cf3513.entry.js → p-d0a8c631.entry.js} +1 -1
- package/dist/webcomponents/p-e6ab1f0d.entry.js +1 -0
- package/dist/webcomponents/{p-3adc0688.entry.js → p-efbc8ffc.entry.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/dist/webcomponents/p-04c7f8f8.js +0 -1
- package/dist/webcomponents/p-0c269feb.entry.js +0 -1
- package/dist/webcomponents/p-0eb77101.entry.js +0 -1
- package/dist/webcomponents/p-19001cc5.entry.js +0 -1
- package/dist/webcomponents/p-3496e37f.js +0 -1
- package/dist/webcomponents/p-3934a3a8.entry.js +0 -1
- package/dist/webcomponents/p-6f294d5d.js +0 -1
- package/dist/webcomponents/p-8da13f40.entry.js +0 -1
- package/dist/webcomponents/p-a8caec98.entry.js +0 -1
- package/dist/webcomponents/p-a90f7ca0.js +0 -1
- package/dist/webcomponents/p-abc03d5a.entry.js +0 -1
- package/dist/webcomponents/p-ba454cd7.entry.js +0 -1
- package/dist/webcomponents/p-d69a485a.entry.js +0 -1
|
@@ -27,13 +27,16 @@ const Api = (authToken, apiOrigin) => {
|
|
|
27
27
|
async function post(endpoint, body, params, signal) {
|
|
28
28
|
return makeRequest(endpoint, 'POST', params, body, signal);
|
|
29
29
|
}
|
|
30
|
+
async function put(endpoint, body, params, signal) {
|
|
31
|
+
return makeRequest(endpoint, 'PUT', params, body, signal);
|
|
32
|
+
}
|
|
30
33
|
async function patch(endpoint, body, params, signal) {
|
|
31
34
|
return makeRequest(endpoint, 'PATCH', params, body, signal);
|
|
32
35
|
}
|
|
33
36
|
async function destroy(endpoint, params, signal) {
|
|
34
37
|
return makeRequest(endpoint, 'DELETE', params, null, signal);
|
|
35
38
|
}
|
|
36
|
-
return { get, post, patch, destroy };
|
|
39
|
+
return { get, post, put, patch, destroy };
|
|
37
40
|
};
|
|
38
41
|
function handleError(requestUrl) {
|
|
39
42
|
console.error(`Error fetching from ${requestUrl}`);
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"components/details/details.js",
|
|
38
38
|
"components/form/form-control-date.js",
|
|
39
39
|
"components/form/form-control-datepart.js",
|
|
40
|
+
"components/form/form-control-file.js",
|
|
40
41
|
"components/form/form-control-monetary.js",
|
|
41
42
|
"components/form/form-control-number-masked.js",
|
|
42
43
|
"components/form/form-control-number.js",
|
|
@@ -32,8 +32,7 @@ export const makeCheckoutComplete = ({ authToken, checkoutId, service }) => asyn
|
|
|
32
32
|
try {
|
|
33
33
|
const response = await service.complete(authToken, checkoutId, payment);
|
|
34
34
|
if (!response.error) {
|
|
35
|
-
|
|
36
|
-
onSuccess({ checkout });
|
|
35
|
+
onSuccess(response);
|
|
37
36
|
}
|
|
38
37
|
else {
|
|
39
38
|
const responseError = getErrorMessage(response.error);
|
|
@@ -2,12 +2,21 @@ import { h, Host } from "@stencil/core";
|
|
|
2
2
|
import { extractComputedFontsToLoad, formatCurrency } from "../../utils/utils";
|
|
3
3
|
import { config } from "../../../config";
|
|
4
4
|
import { Checkout } from "../../api/Checkout";
|
|
5
|
+
import { ComponentErrorSeverity } from "../../api/ComponentError";
|
|
5
6
|
export class CheckoutCore {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.onSubmitted = (data) => {
|
|
8
9
|
this.submitted.emit(data);
|
|
9
10
|
this.isLoading = false;
|
|
10
11
|
};
|
|
12
|
+
this.onError = ({ error, code, severity }) => {
|
|
13
|
+
this.errorEvent.emit({
|
|
14
|
+
errorCode: code,
|
|
15
|
+
message: error,
|
|
16
|
+
severity,
|
|
17
|
+
});
|
|
18
|
+
this.isLoading = false;
|
|
19
|
+
};
|
|
11
20
|
this.loadingSpinner = (h("div", { class: "spinner-border spinner-border-sm", role: "status" }, h("span", { class: "visually-hidden" }, "Loading...")));
|
|
12
21
|
this.iframeOrigin = config.iframeOrigin;
|
|
13
22
|
this.authToken = undefined;
|
|
@@ -18,7 +27,6 @@ export class CheckoutCore {
|
|
|
18
27
|
this.isLoading = false;
|
|
19
28
|
this.checkout = undefined;
|
|
20
29
|
this.serverError = false;
|
|
21
|
-
this.errorMessage = '';
|
|
22
30
|
this.creatingNewPaymentMethod = false;
|
|
23
31
|
}
|
|
24
32
|
componentWillLoad() {
|
|
@@ -40,7 +48,6 @@ export class CheckoutCore {
|
|
|
40
48
|
this.isLoading = false;
|
|
41
49
|
},
|
|
42
50
|
onError: ({ error, code, severity }) => {
|
|
43
|
-
this.errorMessage = error;
|
|
44
51
|
this.isLoading = false;
|
|
45
52
|
this.errorEvent.emit({
|
|
46
53
|
errorCode: code,
|
|
@@ -68,23 +75,30 @@ export class CheckoutCore {
|
|
|
68
75
|
event.preventDefault();
|
|
69
76
|
this.isLoading = true;
|
|
70
77
|
const payload = await this.paymentMethodOptionsRef.resolvePaymentMethod();
|
|
71
|
-
if (payload
|
|
78
|
+
if (!payload) {
|
|
79
|
+
this.isLoading = false;
|
|
80
|
+
}
|
|
81
|
+
else if (payload.error) {
|
|
82
|
+
this.onError({
|
|
83
|
+
code: payload.error.code,
|
|
84
|
+
error: payload.error.message,
|
|
85
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
else if (payload.token) {
|
|
72
89
|
this.complete({
|
|
73
90
|
payment: { payment_mode: 'ecom', payment_token: payload.token },
|
|
74
91
|
onSuccess: this.onSubmitted,
|
|
75
|
-
onError: this.
|
|
92
|
+
onError: this.onError,
|
|
76
93
|
});
|
|
77
94
|
}
|
|
78
95
|
else if (((_a = payload.bnpl) === null || _a === void 0 ? void 0 : _a.status) === 'success') {
|
|
79
96
|
this.complete({
|
|
80
97
|
payment: { payment_mode: 'bnpl' },
|
|
81
98
|
onSuccess: this.onSubmitted,
|
|
82
|
-
onError: this.
|
|
99
|
+
onError: this.onError,
|
|
83
100
|
});
|
|
84
101
|
}
|
|
85
|
-
else {
|
|
86
|
-
this.isLoading = false;
|
|
87
|
-
}
|
|
88
102
|
}
|
|
89
103
|
render() {
|
|
90
104
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -204,7 +218,6 @@ export class CheckoutCore {
|
|
|
204
218
|
"isLoading": {},
|
|
205
219
|
"checkout": {},
|
|
206
220
|
"serverError": {},
|
|
207
|
-
"errorMessage": {},
|
|
208
221
|
"creatingNewPaymentMethod": {}
|
|
209
222
|
};
|
|
210
223
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { makeGetCheckout, makeCheckoutComplete } from "./checkout-actions";
|
|
3
3
|
import { CheckoutService } from "../../api/services/checkout.service";
|
|
4
|
+
import { ComponentErrorCodes, ComponentErrorSeverity } from "../../api/ComponentError";
|
|
4
5
|
export class Checkout {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.iframeOrigin = undefined;
|
|
@@ -27,7 +28,11 @@ export class Checkout {
|
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
30
|
-
this.
|
|
31
|
+
this.errorEvent.emit({
|
|
32
|
+
message: 'auth-token and checkout-id are required',
|
|
33
|
+
errorCode: ComponentErrorCodes.MISSING_PROPS,
|
|
34
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
35
|
+
});
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
propChanged() {
|
|
@@ -37,7 +42,6 @@ export class Checkout {
|
|
|
37
42
|
return (h("justifi-checkout-core", { getCheckout: this.getCheckout, complete: this.complete }));
|
|
38
43
|
}
|
|
39
44
|
static get is() { return "justifi-checkout"; }
|
|
40
|
-
static get encapsulation() { return "shadow"; }
|
|
41
45
|
static get properties() {
|
|
42
46
|
return {
|
|
43
47
|
"iframeOrigin": {
|
|
@@ -100,6 +104,30 @@ export class Checkout {
|
|
|
100
104
|
"errorMessage": {}
|
|
101
105
|
};
|
|
102
106
|
}
|
|
107
|
+
static get events() {
|
|
108
|
+
return [{
|
|
109
|
+
"method": "errorEvent",
|
|
110
|
+
"name": "error-event",
|
|
111
|
+
"bubbles": true,
|
|
112
|
+
"cancelable": true,
|
|
113
|
+
"composed": true,
|
|
114
|
+
"docs": {
|
|
115
|
+
"tags": [],
|
|
116
|
+
"text": ""
|
|
117
|
+
},
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "ComponentError",
|
|
120
|
+
"resolved": "ComponentError",
|
|
121
|
+
"references": {
|
|
122
|
+
"ComponentError": {
|
|
123
|
+
"location": "import",
|
|
124
|
+
"path": "../../api/ComponentError",
|
|
125
|
+
"id": "src/api/ComponentError.ts::ComponentError"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}];
|
|
130
|
+
}
|
|
103
131
|
static get watchers() {
|
|
104
132
|
return [{
|
|
105
133
|
"propName": "authToken",
|
|
@@ -16,14 +16,21 @@ export class NewPaymentMethod {
|
|
|
16
16
|
this.isSelected = undefined;
|
|
17
17
|
}
|
|
18
18
|
async resolvePaymentMethod() {
|
|
19
|
+
var _a, _b;
|
|
19
20
|
if (!this.paymentMethodFormRef || !this.billingFormRef)
|
|
20
21
|
return;
|
|
21
22
|
const billingFormValidation = await this.billingFormRef.validate();
|
|
22
23
|
const paymentMethodFormValidation = await this.paymentMethodFormRef.validate();
|
|
23
24
|
if (!billingFormValidation.isValid || !paymentMethodFormValidation.isValid)
|
|
24
25
|
return;
|
|
25
|
-
const
|
|
26
|
-
|
|
26
|
+
const tokenizeResponse = await this.tokenize();
|
|
27
|
+
if (tokenizeResponse.error) {
|
|
28
|
+
return { error: tokenizeResponse.error };
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const tokenizeRessponseData = tokenizeResponse.data;
|
|
32
|
+
return { token: ((_a = tokenizeRessponseData.card) === null || _a === void 0 ? void 0 : _a.token) || ((_b = tokenizeRessponseData.bank_account) === null || _b === void 0 ? void 0 : _b.token) };
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
35
|
async tokenize() {
|
|
29
36
|
try {
|
|
@@ -31,17 +38,10 @@ export class NewPaymentMethod {
|
|
|
31
38
|
const paymentMethodData = Object.assign({}, billingFormFieldValues);
|
|
32
39
|
const clientId = this.clientId;
|
|
33
40
|
const tokenizeResponse = await this.paymentMethodFormRef.tokenize(clientId, paymentMethodData, this.accountId);
|
|
34
|
-
|
|
35
|
-
console.error(`An error occured submitting the form: ${tokenizeResponse.error.message}`);
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const data = tokenizeResponse.data;
|
|
39
|
-
const tokenizedPaymentMethod = data.card || data.ach; // fix the response types to avoid this
|
|
40
|
-
return tokenizedPaymentMethod.token;
|
|
41
|
+
return tokenizeResponse;
|
|
41
42
|
}
|
|
42
43
|
catch (error) {
|
|
43
|
-
|
|
44
|
-
return null;
|
|
44
|
+
return error;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
showNewPaymentMethodForm() {
|
|
@@ -83,9 +83,7 @@ describe('makeCheckoutComplete', () => {
|
|
|
83
83
|
service: mockService,
|
|
84
84
|
});
|
|
85
85
|
await completeCheckout({ payment, onSuccess, onError });
|
|
86
|
-
expect(onSuccess).toHaveBeenCalledWith(
|
|
87
|
-
checkout: new Checkout(mockResponse.data),
|
|
88
|
-
});
|
|
86
|
+
expect(onSuccess).toHaveBeenCalledWith(mockResponse);
|
|
89
87
|
expect(onError).not.toHaveBeenCalled();
|
|
90
88
|
});
|
|
91
89
|
it('calls onError with an error message on post error', async () => {
|
|
@@ -104,7 +104,7 @@ describe('justifi-checkout-core', () => {
|
|
|
104
104
|
authToken: '',
|
|
105
105
|
checkoutId: '',
|
|
106
106
|
service: {
|
|
107
|
-
|
|
107
|
+
complete: async () => mockPostCheckoutSuccess,
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
const submittedSpy = jest.fn();
|
|
@@ -121,7 +121,7 @@ describe('justifi-checkout-core', () => {
|
|
|
121
121
|
submitButton.click();
|
|
122
122
|
await page.waitForChanges();
|
|
123
123
|
expect(submittedSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
124
|
-
detail:
|
|
124
|
+
detail: mockPostCheckoutSuccess
|
|
125
125
|
}));
|
|
126
126
|
});
|
|
127
127
|
});
|