@justifi/webcomponents 4.12.2 → 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-21cef37d.js → Business-32a53780.js} +8 -3
- package/dist/cjs/{utils-f8079741.js → ComponentError-8ba0c0e7.js} +0 -25
- package/dist/cjs/additional-questions-details_5.cjs.entry.js +2 -2
- package/dist/cjs/{business-additional-questions-schema-f5f303fb.js → business-additional-questions-schema-0a35f597.js} +17 -9
- package/dist/cjs/{business-form-types-a3cc374d.js → business-form-options-43366c9a.js} +50 -33
- package/dist/cjs/business-form-types-29b2bad9.js +26 -0
- package/dist/cjs/form-control-date_3.cjs.entry.js +1 -1
- package/dist/cjs/form-control-datepart_2.cjs.entry.js +1 -1
- package/dist/cjs/form-control-file.cjs.entry.js +44 -0
- package/dist/cjs/form-control-monetary.cjs.entry.js +7 -12
- package/dist/cjs/form-input-masks-0879c139.js +27 -0
- package/dist/cjs/{index-fc5339a5.js → index-d8e99b54.js} +352 -198
- package/dist/cjs/justifi-additional-questions-form-step_5.cjs.entry.js +10 -9
- package/dist/cjs/justifi-additional-questions_4.cjs.entry.js +6 -6
- package/dist/cjs/justifi-billing-form_4.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-details.cjs.entry.js +8 -7
- package/dist/cjs/justifi-business-form.cjs.entry.js +6 -5
- package/dist/cjs/justifi-business-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-owners.cjs.entry.js +1 -1
- package/dist/cjs/justifi-checkout-core.cjs.entry.js +30 -11
- package/dist/cjs/justifi-checkout.cjs.entry.js +36 -9
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +7 -6
- package/dist/cjs/justifi-new-payment-method_4.cjs.entry.js +12 -12
- package/dist/cjs/justifi-owner-form.cjs.entry.js +6 -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-payment-provisioning.cjs.entry.js +1 -3
- 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 +3 -2
- 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-74693a97.js → payload-parsers-6c4b5323.js} +61 -6
- 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/utils-491248ca.js +28 -0
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/api/Api.js +4 -1
- package/dist/collection/api/Business.js +8 -3
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +2 -2
- package/dist/collection/components/business-forms/business-form/additional-questions/additional-questions.js +4 -2
- package/dist/collection/components/business-forms/business-form/business-core-info/business-core-info.js +2 -2
- package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.js +4 -2
- package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +3 -2
- package/dist/collection/components/business-forms/schemas/business-additional-questions-schema.js +16 -9
- package/dist/collection/components/business-forms/schemas/business-core-info-schema.js +3 -1
- package/dist/collection/components/business-forms/schemas/schema-helpers.js +3 -0
- package/dist/collection/components/business-forms/schemas/schema-validations.js +51 -7
- package/dist/collection/components/business-forms/utils/business-form-options.js +119 -0
- package/dist/collection/components/business-forms/utils/business-form-types.js +0 -81
- package/dist/collection/components/checkout/checkout-actions.js +29 -7
- package/dist/collection/components/checkout/checkout-core.js +51 -14
- 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/payment-method-options.js +2 -18
- package/dist/collection/components/checkout/test/checkout-actions.spec.js +124 -0
- package/dist/collection/components/checkout/test/checkout-core.spec.js +127 -0
- package/dist/collection/components/checkout/test/checkout.spec.js +0 -153
- 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/form-control-monetary.css +1812 -0
- package/dist/collection/components/form/form-control-monetary.js +24 -11
- package/dist/collection/components/form/test/form-control-file.spec.js +84 -0
- package/dist/collection/components/form/test/form-control-monetary.spec.js +5 -3
- package/dist/collection/components/refund-form/refund-form.js +2 -1
- package/dist/collection/utils/form-input-masks.js +15 -0
- package/dist/docs.json +275 -33
- package/dist/esm/{Api-0e88671c.js → Api-e9d568c7.js} +4 -1
- package/dist/esm/{Business-0e8a9a3a.js → Business-d83fbdb4.js} +8 -3
- package/dist/esm/{utils-4609f32c.js → ComponentError-2a58dbbc.js} +1 -23
- package/dist/esm/additional-questions-details_5.entry.js +2 -2
- package/dist/esm/{business-additional-questions-schema-a84dd641.js → business-additional-questions-schema-e96b0509.js} +18 -10
- package/dist/esm/{business-form-types-7420dc96.js → business-form-options-de11bc46.js} +46 -32
- package/dist/esm/business-form-types-0d76133c.js +26 -0
- package/dist/esm/form-control-date_3.entry.js +1 -1
- package/dist/esm/form-control-datepart_2.entry.js +1 -1
- package/dist/esm/form-control-file.entry.js +40 -0
- package/dist/esm/form-control-monetary.entry.js +7 -12
- package/dist/esm/form-input-masks-0e18300f.js +22 -0
- package/dist/esm/{index-5eb05747.js → index-dc1350b1.js} +352 -198
- package/dist/esm/justifi-additional-questions-form-step_5.entry.js +10 -9
- package/dist/esm/justifi-additional-questions_4.entry.js +6 -6
- package/dist/esm/justifi-billing-form_4.entry.js +2 -2
- package/dist/esm/justifi-business-details.entry.js +4 -3
- package/dist/esm/justifi-business-form.entry.js +6 -5
- package/dist/esm/justifi-business-list.entry.js +2 -2
- package/dist/esm/justifi-business-owners.entry.js +1 -1
- package/dist/esm/justifi-checkout-core.entry.js +30 -11
- package/dist/esm/justifi-checkout.entry.js +37 -10
- package/dist/esm/justifi-gross-payment-chart.entry.js +3 -2
- package/dist/esm/justifi-new-payment-method_4.entry.js +12 -12
- package/dist/esm/justifi-owner-form.entry.js +6 -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-payment-provisioning.entry.js +1 -3
- 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 +3 -2
- 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-0c4fc2b1.js → payload-parsers-32028700.js} +54 -7
- 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/utils-f580d6b7.js +25 -0
- package/dist/esm/webcomponents.js +1 -1
- package/dist/module/Api.js +4 -1
- package/dist/module/Business.js +8 -3
- package/dist/module/ComponentError.js +16 -0
- package/dist/module/additional-questions-details2.js +2 -2
- package/dist/module/additional-questions.js +18 -4
- package/dist/module/business-additional-questions-form-step.js +18 -4
- package/dist/module/business-additional-questions-schema.js +16 -9
- package/dist/module/business-address-schema.js +1 -1
- package/dist/module/business-core-info-form-step.js +10 -3
- package/dist/module/business-core-info-schema.js +3 -1
- package/dist/module/business-core-info.js +9 -3
- package/dist/module/business-form-options.js +122 -0
- package/dist/module/business-form-types.js +153 -82
- package/dist/module/business-identity-schema.js +1 -1
- package/dist/module/business-representative-form-step.js +1 -1
- package/dist/module/checkout-core.js +30 -13
- package/dist/module/form-control-file.d.ts +11 -0
- package/dist/module/form-control-file.js +67 -0
- package/dist/module/form-control-monetary2.js +8 -12
- package/dist/module/form-input-masks.js +16 -1
- package/dist/module/index2.js +352 -198
- package/dist/module/justifi-business-details.js +2 -1
- package/dist/module/justifi-business-form.js +2 -2
- package/dist/module/justifi-checkout.js +37 -11
- 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-payment-provisioning.js +1 -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/justifi-refund-form.js +2 -1
- package/dist/module/legal-address-form-step.js +1 -1
- package/dist/module/new-payment-method.js +11 -11
- package/dist/module/owner-form.js +2 -2
- package/dist/module/payload-parsers.js +1 -107
- package/dist/module/payment-method-form.js +2 -2
- package/dist/module/payment-method-options.js +2 -2
- package/dist/module/utils3.js +2 -15
- package/dist/types/api/Api.d.ts +1 -0
- package/dist/types/api/Business.d.ts +15 -5
- package/dist/types/api/services/checkout.service.d.ts +3 -3
- package/dist/types/components/business-forms/schemas/business-additional-questions-schema.d.ts +10 -4
- package/dist/types/components/business-forms/schemas/business-core-info-schema.d.ts +2 -0
- package/dist/types/components/business-forms/schemas/business-form-schema.d.ts +12 -4
- package/dist/types/components/business-forms/schemas/schema-helpers.d.ts +3 -0
- package/dist/types/components/business-forms/schemas/schema-validations.d.ts +8 -0
- package/dist/types/components/business-forms/utils/business-form-options.d.ts +21 -0
- package/dist/types/components/business-forms/utils/business-form-types.d.ts +0 -9
- package/dist/types/components/checkout/checkout-core.d.ts +8 -3
- package/dist/types/components/checkout/checkout.d.ts +3 -0
- package/dist/types/components/checkout/payment-method-options.d.ts +1 -1
- 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/form/form-control-monetary.d.ts +1 -0
- package/dist/types/components/payment-method-form/payment-method-responses.d.ts +1 -0
- package/dist/types/components.d.ts +61 -2
- package/dist/types/utils/form-input-masks.d.ts +15 -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-101b2648.entry.js +1 -0
- package/dist/webcomponents/p-132ba228.js +1 -0
- package/dist/webcomponents/p-13e2f667.js +1 -0
- package/dist/webcomponents/{p-18cf5a16.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-230b96df.entry.js +1 -0
- package/dist/webcomponents/{p-2fbe8823.entry.js → p-3367225e.entry.js} +1 -1
- package/dist/webcomponents/p-3917edbf.entry.js +1 -0
- package/dist/webcomponents/p-3da23f21.js +1 -0
- 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-4ff52695.entry.js +1 -0
- package/dist/webcomponents/p-525db3e8.js +1 -0
- package/dist/webcomponents/p-61fd33c7.js +1 -0
- package/dist/webcomponents/p-64710363.entry.js +1 -0
- 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-7faacb1e.entry.js +1 -0
- package/dist/webcomponents/{p-5f5e730c.entry.js → p-834cba99.entry.js} +1 -1
- package/dist/webcomponents/p-87d646c0.js +1 -0
- package/dist/webcomponents/p-935d6f55.js +1 -0
- package/dist/webcomponents/{p-e3946c2b.js → p-9ada56da.js} +1 -1
- package/dist/webcomponents/p-9ba31a6a.entry.js +1 -0
- package/dist/webcomponents/p-a9af8f40.entry.js +1 -0
- 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-cf3151a3.entry.js +1 -0
- package/dist/webcomponents/p-d0a8c631.entry.js +1 -0
- package/dist/webcomponents/p-e6ab1f0d.entry.js +1 -0
- package/dist/webcomponents/p-ee68566f.entry.js +1 -0
- package/dist/webcomponents/{p-3adc0688.entry.js → p-efbc8ffc.entry.js} +1 -1
- package/dist/webcomponents/{p-b9f04fb0.entry.js → p-f152d6b8.entry.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/form-input-masks-efd44b8e.js +0 -11
- package/dist/esm/form-input-masks-84875967.js +0 -7
- package/dist/webcomponents/p-01913426.js +0 -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-2319abaf.entry.js +0 -1
- package/dist/webcomponents/p-2bee72bd.entry.js +0 -1
- package/dist/webcomponents/p-51ee396f.entry.js +0 -1
- package/dist/webcomponents/p-52e4cc27.js +0 -1
- package/dist/webcomponents/p-602a1588.entry.js +0 -1
- package/dist/webcomponents/p-6ec77980.entry.js +0 -1
- package/dist/webcomponents/p-6f294d5d.js +0 -1
- package/dist/webcomponents/p-81c43ba5.entry.js +0 -1
- package/dist/webcomponents/p-927150b4.entry.js +0 -1
- package/dist/webcomponents/p-93579716.js +0 -1
- package/dist/webcomponents/p-9e35b0f6.entry.js +0 -1
- package/dist/webcomponents/p-9e3f9e05.entry.js +0 -1
- package/dist/webcomponents/p-9ec89299.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-b38baa84.entry.js +0 -1
- package/dist/webcomponents/p-bfc634c6.entry.js +0 -1
- package/dist/webcomponents/p-c1b92cec.entry.js +0 -1
- package/dist/webcomponents/p-cb86b2fd.js +0 -1
- package/dist/webcomponents/p-d2b7beac.js +0 -1
- package/dist/webcomponents/p-d69a485a.entry.js +0 -1
|
@@ -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() {
|
|
@@ -11,8 +11,8 @@ export class PaymentMethodOptions {
|
|
|
11
11
|
this.accountId = undefined;
|
|
12
12
|
this.iframeOrigin = config.iframeOrigin;
|
|
13
13
|
this.savedPaymentMethods = [];
|
|
14
|
-
this.selectedPaymentMethodId = undefined;
|
|
15
14
|
this.paymentAmount = undefined;
|
|
15
|
+
this.selectedPaymentMethodId = undefined;
|
|
16
16
|
this.paymentMethodOptions = [];
|
|
17
17
|
}
|
|
18
18
|
paymentMethodsChanged() {
|
|
@@ -202,23 +202,6 @@ export class PaymentMethodOptions {
|
|
|
202
202
|
},
|
|
203
203
|
"defaultValue": "[]"
|
|
204
204
|
},
|
|
205
|
-
"selectedPaymentMethodId": {
|
|
206
|
-
"type": "string",
|
|
207
|
-
"mutable": false,
|
|
208
|
-
"complexType": {
|
|
209
|
-
"original": "string",
|
|
210
|
-
"resolved": "string",
|
|
211
|
-
"references": {}
|
|
212
|
-
},
|
|
213
|
-
"required": false,
|
|
214
|
-
"optional": false,
|
|
215
|
-
"docs": {
|
|
216
|
-
"tags": [],
|
|
217
|
-
"text": ""
|
|
218
|
-
},
|
|
219
|
-
"attribute": "selected-payment-method-id",
|
|
220
|
-
"reflect": false
|
|
221
|
-
},
|
|
222
205
|
"paymentAmount": {
|
|
223
206
|
"type": "string",
|
|
224
207
|
"mutable": false,
|
|
@@ -240,6 +223,7 @@ export class PaymentMethodOptions {
|
|
|
240
223
|
}
|
|
241
224
|
static get states() {
|
|
242
225
|
return {
|
|
226
|
+
"selectedPaymentMethodId": {},
|
|
243
227
|
"paymentMethodOptions": {}
|
|
244
228
|
};
|
|
245
229
|
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { makeGetCheckout, makeCheckoutComplete } from "../checkout-actions";
|
|
2
|
+
import mockResponse from "../../../../../../mockData/mockGetCheckoutSuccess.json";
|
|
3
|
+
import { Checkout } from "../../../api/Checkout";
|
|
4
|
+
import { API_NOT_AUTHENTICATED_ERROR } from "../../../api/shared";
|
|
5
|
+
// Mocks
|
|
6
|
+
jest.mock('../../../api/services/utils.ts', () => ({
|
|
7
|
+
getErrorMessage: jest.fn(),
|
|
8
|
+
}));
|
|
9
|
+
const mockService = {
|
|
10
|
+
fetchCheckout: jest.fn(),
|
|
11
|
+
complete: jest.fn(),
|
|
12
|
+
};
|
|
13
|
+
// Test Suite
|
|
14
|
+
describe('makeGetCheckout', () => {
|
|
15
|
+
const checkoutId = '123';
|
|
16
|
+
const authToken = 'token';
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
jest.clearAllMocks();
|
|
19
|
+
});
|
|
20
|
+
it('calls onSuccess with a new Checkout instance on successful fetch', async () => {
|
|
21
|
+
mockService.fetchCheckout.mockResolvedValue(mockResponse);
|
|
22
|
+
const onSuccess = jest.fn();
|
|
23
|
+
const onError = jest.fn();
|
|
24
|
+
const getCheckout = makeGetCheckout({
|
|
25
|
+
checkoutId,
|
|
26
|
+
authToken,
|
|
27
|
+
service: mockService,
|
|
28
|
+
});
|
|
29
|
+
await getCheckout({ onSuccess, onError });
|
|
30
|
+
expect(onSuccess).toHaveBeenCalledWith({
|
|
31
|
+
checkout: new Checkout(mockResponse.data),
|
|
32
|
+
});
|
|
33
|
+
expect(onError).not.toHaveBeenCalled();
|
|
34
|
+
});
|
|
35
|
+
it('calls onError with an error message on fetch error', async () => {
|
|
36
|
+
mockService.fetchCheckout.mockResolvedValue(API_NOT_AUTHENTICATED_ERROR);
|
|
37
|
+
const onSuccess = jest.fn();
|
|
38
|
+
const onError = jest.fn();
|
|
39
|
+
const getCheckout = makeGetCheckout({
|
|
40
|
+
checkoutId,
|
|
41
|
+
authToken,
|
|
42
|
+
service: mockService,
|
|
43
|
+
});
|
|
44
|
+
await getCheckout({ onSuccess, onError });
|
|
45
|
+
expect(onError).toHaveBeenCalledWith({
|
|
46
|
+
error: 'Not Authenticated',
|
|
47
|
+
code: 'not-authenticated',
|
|
48
|
+
severity: 'error',
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
it('calls onError with an error message on fetch exception', async () => {
|
|
52
|
+
const error = new Error('Network error');
|
|
53
|
+
mockService.fetchCheckout.mockRejectedValue(error);
|
|
54
|
+
const onSuccess = jest.fn();
|
|
55
|
+
const onError = jest.fn();
|
|
56
|
+
const getCheckout = makeGetCheckout({
|
|
57
|
+
checkoutId,
|
|
58
|
+
authToken,
|
|
59
|
+
service: mockService,
|
|
60
|
+
});
|
|
61
|
+
await getCheckout({ onSuccess, onError });
|
|
62
|
+
expect(onError).toHaveBeenCalledWith({
|
|
63
|
+
error: error.message,
|
|
64
|
+
code: 'fetch-error',
|
|
65
|
+
severity: 'error',
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe('makeCheckoutComplete', () => {
|
|
70
|
+
const checkoutId = '123';
|
|
71
|
+
const authToken = 'token';
|
|
72
|
+
afterEach(() => {
|
|
73
|
+
jest.clearAllMocks();
|
|
74
|
+
});
|
|
75
|
+
it('calls onSuccess with checkout complete response data', async () => {
|
|
76
|
+
mockService.complete.mockResolvedValue(mockResponse);
|
|
77
|
+
const payment = { payment_mode: 'ecom', payment_token: '123' };
|
|
78
|
+
const onSuccess = jest.fn();
|
|
79
|
+
const onError = jest.fn();
|
|
80
|
+
const completeCheckout = makeCheckoutComplete({
|
|
81
|
+
checkoutId,
|
|
82
|
+
authToken,
|
|
83
|
+
service: mockService,
|
|
84
|
+
});
|
|
85
|
+
await completeCheckout({ payment, onSuccess, onError });
|
|
86
|
+
expect(onSuccess).toHaveBeenCalledWith(mockResponse);
|
|
87
|
+
expect(onError).not.toHaveBeenCalled();
|
|
88
|
+
});
|
|
89
|
+
it('calls onError with an error message on post error', async () => {
|
|
90
|
+
mockService.complete.mockResolvedValue(API_NOT_AUTHENTICATED_ERROR);
|
|
91
|
+
const payment = { payment_mode: 'ecom', payment_token: '123' };
|
|
92
|
+
const onSuccess = jest.fn();
|
|
93
|
+
const onError = jest.fn();
|
|
94
|
+
const completeCheckout = makeCheckoutComplete({
|
|
95
|
+
checkoutId,
|
|
96
|
+
authToken,
|
|
97
|
+
service: mockService,
|
|
98
|
+
});
|
|
99
|
+
await completeCheckout({ payment, onSuccess, onError });
|
|
100
|
+
expect(onError).toHaveBeenCalledWith({
|
|
101
|
+
error: 'Not Authenticated',
|
|
102
|
+
code: 'not-authenticated',
|
|
103
|
+
severity: 'error',
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
it('calls onError with an error message on fetch exception', async () => {
|
|
107
|
+
const error = new Error('Network error');
|
|
108
|
+
mockService.complete.mockRejectedValue(error);
|
|
109
|
+
const payment = { payment_mode: 'ecom', payment_token: '123' };
|
|
110
|
+
const onSuccess = jest.fn();
|
|
111
|
+
const onError = jest.fn();
|
|
112
|
+
const completeCheckout = makeCheckoutComplete({
|
|
113
|
+
checkoutId,
|
|
114
|
+
authToken,
|
|
115
|
+
service: mockService,
|
|
116
|
+
});
|
|
117
|
+
await completeCheckout({ payment, onSuccess, onError });
|
|
118
|
+
expect(onError).toHaveBeenCalledWith({
|
|
119
|
+
error: error.message,
|
|
120
|
+
code: 'fetch-error',
|
|
121
|
+
severity: 'error',
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { newSpecPage } from "@stencil/core/testing";
|
|
3
|
+
import { CheckoutCore } from "../checkout-core";
|
|
4
|
+
import { makeCheckoutComplete, makeGetCheckout } from "../checkout-actions";
|
|
5
|
+
import { Checkout } from "../../../api/Checkout";
|
|
6
|
+
import { API_NOT_AUTHENTICATED_ERROR } from "../../../api/shared";
|
|
7
|
+
import mockGetCheckoutSuccess from "./../../../../../../mockData/mockGetCheckoutSuccess.json";
|
|
8
|
+
import mockPostCheckoutSuccess from "./../../../../../../mockData/mockPostCheckoutSuccess.json";
|
|
9
|
+
import { PaymentMethodOptions } from "../payment-method-options";
|
|
10
|
+
describe('justifi-checkout-core', () => {
|
|
11
|
+
it('should display loading state correclty', async () => {
|
|
12
|
+
const page = await newSpecPage({
|
|
13
|
+
components: [CheckoutCore],
|
|
14
|
+
template: () => h("justifi-checkout-core", null),
|
|
15
|
+
});
|
|
16
|
+
await page.waitForChanges();
|
|
17
|
+
expect(page.root).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
it('should display error state correctly', async () => {
|
|
20
|
+
const getCheckout = makeGetCheckout({
|
|
21
|
+
checkoutId: '',
|
|
22
|
+
authToken: '',
|
|
23
|
+
service: {
|
|
24
|
+
fetchCheckout: async () => ({ error: 'error' }),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const page = await newSpecPage({
|
|
28
|
+
components: [CheckoutCore],
|
|
29
|
+
template: () => h("checkout-core", { getCheckout: getCheckout }),
|
|
30
|
+
});
|
|
31
|
+
await page.waitForChanges();
|
|
32
|
+
expect(page.root).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
it('should set checkout correctly to state', async () => {
|
|
35
|
+
const getCheckout = makeGetCheckout({
|
|
36
|
+
checkoutId: '',
|
|
37
|
+
authToken: '',
|
|
38
|
+
service: {
|
|
39
|
+
fetchCheckout: async () => mockGetCheckoutSuccess,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const page = await newSpecPage({
|
|
43
|
+
components: [CheckoutCore],
|
|
44
|
+
template: () => h("justifi-checkout-core", { getCheckout: getCheckout }),
|
|
45
|
+
});
|
|
46
|
+
await page.waitForChanges();
|
|
47
|
+
const expectedCheckout = new Checkout(mockGetCheckoutSuccess.data);
|
|
48
|
+
expect(page.rootInstance.checkout).toEqual(expectedCheckout);
|
|
49
|
+
expect(page.root).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
it('should emit error event when fetch fails', async () => {
|
|
52
|
+
const getCheckout = makeGetCheckout({
|
|
53
|
+
authToken: '',
|
|
54
|
+
checkoutId: '',
|
|
55
|
+
service: {
|
|
56
|
+
fetchCheckout: jest.fn().mockRejectedValue(new Error('Fetch error')),
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
const errorSpy = jest.fn();
|
|
60
|
+
const page = await newSpecPage({
|
|
61
|
+
components: [CheckoutCore],
|
|
62
|
+
template: () => h("justifi-checkout-core", { getCheckout: getCheckout, "onError-event": errorSpy }),
|
|
63
|
+
});
|
|
64
|
+
await page.waitForChanges();
|
|
65
|
+
expect(errorSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
66
|
+
detail: {
|
|
67
|
+
errorCode: 'fetch-error',
|
|
68
|
+
message: 'Fetch error',
|
|
69
|
+
severity: 'error',
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
it('should emit error event when API returns error', async () => {
|
|
74
|
+
const getCheckout = makeGetCheckout({
|
|
75
|
+
authToken: '',
|
|
76
|
+
checkoutId: '',
|
|
77
|
+
service: {
|
|
78
|
+
fetchCheckout: jest.fn().mockResolvedValue(API_NOT_AUTHENTICATED_ERROR),
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
const errorSpy = jest.fn();
|
|
82
|
+
const page = await newSpecPage({
|
|
83
|
+
components: [CheckoutCore],
|
|
84
|
+
template: () => h("justifi-checkout-core", { getCheckout: getCheckout, "onError-event": errorSpy }),
|
|
85
|
+
});
|
|
86
|
+
await page.waitForChanges();
|
|
87
|
+
expect(errorSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
88
|
+
detail: {
|
|
89
|
+
errorCode: 'not-authenticated',
|
|
90
|
+
message: 'Not Authenticated',
|
|
91
|
+
severity: 'error',
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
});
|
|
95
|
+
it('emits "submitted" event upon submit request completion', async () => {
|
|
96
|
+
const getCheckout = makeGetCheckout({
|
|
97
|
+
authToken: '',
|
|
98
|
+
checkoutId: '',
|
|
99
|
+
service: {
|
|
100
|
+
fetchCheckout: async () => mockGetCheckoutSuccess,
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const checkoutComplete = makeCheckoutComplete({
|
|
104
|
+
authToken: '',
|
|
105
|
+
checkoutId: '',
|
|
106
|
+
service: {
|
|
107
|
+
complete: async () => mockPostCheckoutSuccess,
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const submittedSpy = jest.fn();
|
|
111
|
+
const page = await newSpecPage({
|
|
112
|
+
components: [CheckoutCore, PaymentMethodOptions],
|
|
113
|
+
template: () => h("justifi-checkout-core", { getCheckout: getCheckout, complete: checkoutComplete, onSubmitted: submittedSpy }),
|
|
114
|
+
});
|
|
115
|
+
await page.waitForChanges();
|
|
116
|
+
// mock resolved payment method (token) / select payment method
|
|
117
|
+
const instance = page.rootInstance;
|
|
118
|
+
instance.paymentMethodOptionsRef = { resolvePaymentMethod: jest.fn().mockResolvedValue({ token: '123' }) };
|
|
119
|
+
// Submit the form
|
|
120
|
+
const submitButton = page.root.shadowRoot.querySelector('button[type="submit"]');
|
|
121
|
+
submitButton.click();
|
|
122
|
+
await page.waitForChanges();
|
|
123
|
+
expect(submittedSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
124
|
+
detail: mockPostCheckoutSuccess
|
|
125
|
+
}));
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { newSpecPage } from "@stencil/core/testing";
|
|
2
2
|
import { Checkout } from "../checkout";
|
|
3
3
|
import { CheckoutCore } from "../checkout-core";
|
|
4
|
-
// import { PaymentMethodTypes } from '../../../api';
|
|
5
|
-
// import { BillingFormFields } from '../../billing-form/billing-form-schema';
|
|
6
4
|
describe('justifi-checkout', () => {
|
|
7
5
|
it('renders', async () => {
|
|
8
6
|
const page = await newSpecPage({
|
|
@@ -12,155 +10,4 @@ describe('justifi-checkout', () => {
|
|
|
12
10
|
await page.waitForChanges();
|
|
13
11
|
expect(page.root).toMatchSnapshot();
|
|
14
12
|
});
|
|
15
|
-
// it('should update selectedPaymentMethodType when paymentMethodSelected event is fired', async () => {
|
|
16
|
-
// // Mock component
|
|
17
|
-
// const mockComponent = new Checkout();
|
|
18
|
-
// mockComponent.selectedPaymentMethodType = PaymentMethodTypes.card;
|
|
19
|
-
// // Define the event details
|
|
20
|
-
// const detail = PaymentMethodTypes.bankAccount;
|
|
21
|
-
// const event = new CustomEvent('paymentMethodSelected', { detail });
|
|
22
|
-
// // Simulate the event
|
|
23
|
-
// mockComponent.paymentMethodSelectedHandler(event);
|
|
24
|
-
// // Assertion
|
|
25
|
-
// expect(mockComponent.selectedPaymentMethodType).toBe(PaymentMethodTypes.bankAccount);
|
|
26
|
-
// });
|
|
27
|
-
// // Props Testing
|
|
28
|
-
// it('should have the expected default properties', () => {
|
|
29
|
-
// const checkout = new Checkout();
|
|
30
|
-
// // Assert that the properties exist and have the expected default values
|
|
31
|
-
// expect(checkout).toHaveProperty('bankAccount', undefined);
|
|
32
|
-
// expect(checkout).toHaveProperty('card', undefined);
|
|
33
|
-
// expect(checkout).toHaveProperty('email', undefined);
|
|
34
|
-
// expect(checkout).toHaveProperty('iframeOrigin', undefined);
|
|
35
|
-
// expect(checkout).toHaveProperty('clientId', undefined);
|
|
36
|
-
// expect(checkout).toHaveProperty('accountId', undefined);
|
|
37
|
-
// expect(checkout).toHaveProperty('submitButtonText', undefined);
|
|
38
|
-
// });
|
|
39
|
-
// // Method Testing
|
|
40
|
-
// it('should correctly fill billing form when fillBillingForm method is called', async () => {
|
|
41
|
-
// // Mock child component
|
|
42
|
-
// const mockBillingFormRef = {
|
|
43
|
-
// fill: jest.fn(),
|
|
44
|
-
// };
|
|
45
|
-
// // Mock component
|
|
46
|
-
// const mockComponent = new Checkout();
|
|
47
|
-
// // Cast to any to bypass type checker and directly set private property
|
|
48
|
-
// (mockComponent as any).billingFormRef = mockBillingFormRef;
|
|
49
|
-
// // Define the fields to fill the billing form
|
|
50
|
-
// const fields: BillingFormFields = {
|
|
51
|
-
// name: 'John Doe',
|
|
52
|
-
// address_line1: '123 Main St',
|
|
53
|
-
// address_line2: 'Apt 4B',
|
|
54
|
-
// address_city: 'Townsville',
|
|
55
|
-
// address_state: 'TS',
|
|
56
|
-
// address_postal_code: '12345',
|
|
57
|
-
// };
|
|
58
|
-
// // Call the method
|
|
59
|
-
// await mockComponent.fillBillingForm(fields);
|
|
60
|
-
// // Check that the child component's fill method was called with the correct arguments
|
|
61
|
-
// expect(mockBillingFormRef.fill).toHaveBeenCalledWith(fields);
|
|
62
|
-
// });
|
|
63
|
-
// it('should submit the form correctly and trigger the "submitted" event with the correct payload when submit method is called', async () => {
|
|
64
|
-
// // Mock billingFormRef and paymentMethodFormRef
|
|
65
|
-
// const mockBillingFormRef = {
|
|
66
|
-
// validate: jest.fn().mockResolvedValue({ isValid: true }),
|
|
67
|
-
// getValues: jest.fn().mockResolvedValue({ name: 'John Doe' }),
|
|
68
|
-
// };
|
|
69
|
-
// const mockPaymentMethodFormRef = {
|
|
70
|
-
// validate: jest.fn().mockResolvedValue({ isValid: true }),
|
|
71
|
-
// tokenize: jest.fn().mockResolvedValue({ token: 'abc123' }),
|
|
72
|
-
// };
|
|
73
|
-
// // Mock component
|
|
74
|
-
// const mockComponent = new Checkout();
|
|
75
|
-
// // Cast to any to bypass type checker and directly set private properties
|
|
76
|
-
// (mockComponent as any).billingFormRef = mockBillingFormRef;
|
|
77
|
-
// (mockComponent as any).paymentMethodFormRef = mockPaymentMethodFormRef;
|
|
78
|
-
// // Mock event
|
|
79
|
-
// const mockEvent = { preventDefault: jest.fn() };
|
|
80
|
-
// // Mock event emitter
|
|
81
|
-
// const mockEmitter = { emit: jest.fn() };
|
|
82
|
-
// mockComponent.submitted = mockEmitter as any;
|
|
83
|
-
// // Call submit method
|
|
84
|
-
// await mockComponent.submit(mockEvent);
|
|
85
|
-
// // Expectations
|
|
86
|
-
// expect(mockEvent.preventDefault).toHaveBeenCalled();
|
|
87
|
-
// expect(mockBillingFormRef.validate).toHaveBeenCalled();
|
|
88
|
-
// expect(mockPaymentMethodFormRef.validate).toHaveBeenCalled();
|
|
89
|
-
// expect(mockBillingFormRef.getValues).toHaveBeenCalled();
|
|
90
|
-
// expect(mockPaymentMethodFormRef.tokenize).toHaveBeenCalledWith(mockComponent.clientId, { name: 'John Doe' }, mockComponent.accountId);
|
|
91
|
-
// expect(mockEmitter.emit).toHaveBeenCalledWith({ token: 'abc123' });
|
|
92
|
-
// });
|
|
93
|
-
// // Event Testing
|
|
94
|
-
// it('should fire the "submitted" event with correct data when the form is submitted', async () => {
|
|
95
|
-
// // Mock billingFormRef and paymentMethodFormRef
|
|
96
|
-
// const mockBillingFormRef = {
|
|
97
|
-
// validate: jest.fn().mockResolvedValue({ isValid: true }),
|
|
98
|
-
// getValues: jest.fn().mockResolvedValue({
|
|
99
|
-
// name: 'John Doe',
|
|
100
|
-
// address_line1: 'Address 1',
|
|
101
|
-
// address_line2: 'Address 2',
|
|
102
|
-
// address_city: 'City',
|
|
103
|
-
// address_state: 'State',
|
|
104
|
-
// address_postal_code: 'Postal Code',
|
|
105
|
-
// }),
|
|
106
|
-
// };
|
|
107
|
-
// const mockPaymentMethodFormRef = {
|
|
108
|
-
// validate: jest.fn().mockResolvedValue({ isValid: true }),
|
|
109
|
-
// tokenize: jest.fn().mockResolvedValue({ token: 'abc123' }),
|
|
110
|
-
// };
|
|
111
|
-
// // Mock component
|
|
112
|
-
// const mockComponent = new Checkout();
|
|
113
|
-
// // Cast to any to bypass type checker and directly set private properties
|
|
114
|
-
// (mockComponent as any).billingFormRef = mockBillingFormRef;
|
|
115
|
-
// (mockComponent as any).paymentMethodFormRef = mockPaymentMethodFormRef;
|
|
116
|
-
// // Mock event
|
|
117
|
-
// const mockEvent = { preventDefault: jest.fn() };
|
|
118
|
-
// // Mock event emitter
|
|
119
|
-
// const mockEmitter = { emit: jest.fn() };
|
|
120
|
-
// mockComponent.submitted = mockEmitter as any;
|
|
121
|
-
// // Call submit method
|
|
122
|
-
// await mockComponent.submit(mockEvent);
|
|
123
|
-
// // Define expected payload
|
|
124
|
-
// const expectedPayload = { token: 'abc123' };
|
|
125
|
-
// // Expectations
|
|
126
|
-
// expect(mockEmitter.emit).toHaveBeenCalledWith(expectedPayload);
|
|
127
|
-
// });
|
|
128
|
-
// // Render Testing
|
|
129
|
-
// it('should correctly render the child components based on the given props and state', async () => {
|
|
130
|
-
// // Set up new Checkout with specific props and state
|
|
131
|
-
// const component = new Checkout();
|
|
132
|
-
// component.iframeOrigin = 'https://example.com';
|
|
133
|
-
// component.clientId = 'abc123';
|
|
134
|
-
// component.accountId = 'def456';
|
|
135
|
-
// // Cast to any to bypass type checker and directly set private properties
|
|
136
|
-
// (component as any).submitButtonEnabled = true;
|
|
137
|
-
// (component as any).selectedPaymentMethodType = PaymentMethodTypes.card;
|
|
138
|
-
// (component as any).allowedPaymentMethodTypes = [PaymentMethodTypes.card, PaymentMethodTypes.bankAccount];
|
|
139
|
-
// // Render the component
|
|
140
|
-
// const { root } = await newSpecPage({
|
|
141
|
-
// components: [Checkout],
|
|
142
|
-
// html: '<justifi-checkout payment-method-form-type="card" iframe-origin="https://example.com"></justifi-checkout>',
|
|
143
|
-
// });
|
|
144
|
-
// // Assert that the rendered output is correct
|
|
145
|
-
// expect(root).toEqualHtml(`
|
|
146
|
-
// <justifi-checkout iframe-origin="https://example.com" payment-method-form-type="card">
|
|
147
|
-
// <mock:shadow-root>
|
|
148
|
-
// <form class="gy-3 row">
|
|
149
|
-
// <div class="col-12">
|
|
150
|
-
// <justifi-payment-method-form iframe-origin="https://example.com" payment-method-form-type="card"></justifi-payment-method-form>
|
|
151
|
-
// </div>
|
|
152
|
-
// <div class="col-12">
|
|
153
|
-
// <justifi-billing-form legend="Billing Info"></justifi-billing-form>
|
|
154
|
-
// </div>
|
|
155
|
-
// <slot name="insurance"></slot>
|
|
156
|
-
// <div class="col-12">
|
|
157
|
-
// <button class="btn btn-primary jfi-submit-button" type="submit">
|
|
158
|
-
// Submit
|
|
159
|
-
// </button>
|
|
160
|
-
// </div>
|
|
161
|
-
// </form>
|
|
162
|
-
// </mock:shadow-root>
|
|
163
|
-
// </justifi-checkout>
|
|
164
|
-
// `);
|
|
165
|
-
// });
|
|
166
13
|
});
|