@justifi/webcomponents 4.8.3 → 4.9.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/{Business-42d0c522.js → Business-64dffab7.js} +6 -7
- package/dist/cjs/{BusinessFormEventTypes-863f48e9.js → BusinessFormEventTypes-62990815.js} +1 -1
- package/dist/cjs/{Payout-44b49b2d.js → Payment-89a8bc21.js} +0 -43
- package/dist/cjs/Payout-a2dd7b01.js +45 -0
- package/dist/cjs/{SubAccount-2a803b22.js → SubAccount-f8144025.js} +1 -1
- package/dist/cjs/additional-questions-details_5.cjs.entry.js +24 -10
- package/dist/{webcomponents/p-4ee44c76.entry.js → cjs/business-details-core.cjs.entry.js} +55 -1
- package/dist/cjs/form-control-datepart_3.cjs.entry.js +1 -1
- package/dist/cjs/form-control-monetary.cjs.entry.js +1 -1
- package/dist/cjs/form-control-select_2.cjs.entry.js +1 -1
- package/dist/cjs/gross-payment-chart-core.cjs.entry.js +11036 -0
- package/dist/cjs/{index-55950669.js → index-07ddbad2.js} +0 -3
- package/dist/cjs/justifi-additional-questions_5.cjs.entry.js +2 -2
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +1 -1
- package/dist/cjs/{select-input_2.cjs.entry.js → justifi-billing-form_4.cjs.entry.js} +1818 -1
- package/dist/cjs/justifi-business-details.cjs.entry.js +43 -57
- package/dist/cjs/justifi-business-form-stepped.cjs.entry.js +5 -4
- package/dist/cjs/justifi-business-form.cjs.entry.js +5 -4
- package/dist/cjs/justifi-business-list.cjs.entry.js +5 -4
- package/dist/cjs/justifi-business-owners.cjs.entry.js +1 -1
- package/dist/cjs/justifi-card-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-checkout-core.cjs.entry.js +95 -0
- package/dist/cjs/justifi-checkout.cjs.entry.js +99 -0
- package/dist/cjs/justifi-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +39 -11008
- package/dist/cjs/justifi-new-payment-method_3.cjs.entry.js +168 -0
- package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +5 -4
- package/dist/cjs/justifi-payment-details.cjs.entry.js +6 -5
- package/dist/cjs/justifi-payment-form.cjs.entry.js +5 -4
- package/dist/cjs/{justifi-billing-form_2.cjs.entry.js → justifi-payment-method-selector.cjs.entry.js} +4 -79
- package/dist/cjs/justifi-payments-list.cjs.entry.js +6 -5
- package/dist/cjs/justifi-payout-details.cjs.entry.js +5 -4
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +5 -4
- package/dist/cjs/justifi-proceeds-list.cjs.entry.js +4 -3
- package/dist/cjs/justifi-refund-form.cjs.entry.js +3 -2
- package/dist/cjs/justifi-subaccount-details.cjs.entry.js +6 -5
- package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +5 -4
- package/dist/cjs/justifi-table_2.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/payment-details-core.cjs.entry.js +10 -4
- package/dist/cjs/{payment.service-605896dc.js → payment.service-0b0086dc.js} +2 -1
- package/dist/cjs/payments-list-core.cjs.entry.js +4 -3
- package/dist/cjs/payout-details-core.cjs.entry.js +4 -4
- package/dist/cjs/{payout.service-b39f2739.js → payout.service-5cc3b4e9.js} +2 -1
- package/dist/cjs/payouts-list-core.cjs.entry.js +4 -3
- package/dist/cjs/subaccount-account-details_4.cjs.entry.js +7 -7
- package/dist/cjs/subaccount-bank-details.cjs.entry.js +3 -3
- package/dist/cjs/subaccount-terms-details.cjs.entry.js +3 -3
- package/dist/cjs/{utils-d126d17c.js → utils-5c3e442d.js} +5 -5
- package/dist/cjs/{utils-29a8a91d.js → utils-84208d99.js} +11 -2
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/api/Business.js +6 -7
- package/dist/collection/api/Checkout.js +1 -0
- package/dist/collection/api/index.js +1 -0
- package/dist/collection/api/services/business.service.js +8 -0
- package/dist/collection/api/services/checkout.service.js +12 -0
- package/dist/collection/api/services/reports.service.js +9 -0
- package/dist/collection/collection-manifest.json +7 -0
- package/dist/collection/components/billing-form/billing-form.js +1 -2
- package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +5 -2
- package/dist/collection/components/business-details/additional-questions-details/test/additional-questions.spec.js +16 -0
- package/dist/collection/components/business-details/business-details-core.js +86 -0
- package/dist/collection/components/business-details/business-details.js +20 -65
- package/dist/collection/components/business-details/generic-info-details/generic-info-details.js +4 -2
- package/dist/collection/components/business-details/generic-info-details/test/generic-info-details.spec.js +16 -0
- package/dist/collection/components/business-details/get-business.js +17 -0
- package/dist/collection/components/business-details/legal-address-details/legal-address-details.js +5 -2
- package/dist/collection/components/business-details/legal-address-details/test/legal-address-details.spec.js +16 -0
- package/dist/collection/components/business-details/owner-details/owner-details.js +10 -12
- package/dist/collection/components/business-details/owner-details/test/owner-details.spec.js +16 -0
- package/dist/collection/components/business-details/representative-details/representative-details.js +5 -3
- package/dist/collection/components/business-details/representative-details/test/representative-details.spec.js +16 -0
- package/dist/collection/components/business-details/test/busines-details-core.spec.js +53 -0
- package/dist/collection/components/business-details/test/business-details.spec.js +40 -0
- package/dist/collection/components/business-details/test/get-business.spec.js +60 -0
- package/dist/collection/components/checkout/checkout-actions.js +33 -0
- package/dist/collection/components/checkout/checkout-core.css +2604 -0
- package/dist/collection/components/checkout/checkout-core.js +248 -0
- package/dist/collection/components/checkout/checkout.js +112 -0
- package/dist/collection/components/checkout/new-payment-method.js +188 -0
- package/dist/collection/components/checkout/payment-method-option-utils.js +19 -0
- package/dist/collection/components/checkout/payment-method-options.css +7073 -0
- package/dist/collection/components/checkout/payment-method-options.js +248 -0
- package/dist/collection/components/checkout/saved-payment-method.js +123 -0
- package/dist/collection/components/checkout/test/checkout.js +22 -0
- package/dist/collection/components/checkout/test/checkout.spec.js +166 -0
- package/dist/collection/components/checkout/test/mockCheckout.js +19 -0
- package/dist/collection/components/details/utils.js +4 -1
- package/dist/collection/components/gross-payment-chart/get-gross-payment-chart-data.js +14 -0
- package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +119 -0
- package/dist/collection/components/gross-payment-chart/gross-payment-chart.js +25 -73
- package/dist/collection/components/gross-payment-chart/test/get-gross-payment-chart-data.spec.js +69 -0
- package/dist/collection/components/gross-payment-chart/test/gross-payment-chart-core.spec.js +64 -0
- package/dist/collection/components/gross-payment-chart/test/gross-payment-chart.spec.js +23 -8
- package/dist/collection/components/payment-details/payment-details-core.js +8 -2
- package/dist/collection/components/payment-details/payment-details.js +0 -1
- package/dist/collection/components/payment-form/payment-form.js +1 -1
- package/dist/collection/components/payment-method-form/payment-method-form.js +1 -1
- package/dist/collection/components/payout-details/payout-details-core.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-account-details/subaccount-account-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-bank-details/subaccount-bank-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-merchant-details/subaccount-merchant-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-owners-details/subaccount-owners-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-representative-details/subaccount-representative-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-terms-details/subaccount-terms-details.js +2 -2
- package/dist/collection/utils/utils.js +9 -3
- package/dist/docs.json +1152 -187
- package/dist/esm/{Business-e9340f6b.js → Business-9921d35f.js} +6 -7
- package/dist/esm/{BusinessFormEventTypes-989960ba.js → BusinessFormEventTypes-182e20be.js} +1 -1
- package/dist/esm/{Payout-dc5f009c.js → Payment-55886c86.js} +1 -43
- package/dist/esm/Payout-dfe15b00.js +43 -0
- package/dist/esm/{SubAccount-46b4c2b1.js → SubAccount-76f6d565.js} +1 -1
- package/dist/esm/additional-questions-details_5.entry.js +24 -10
- package/dist/esm/business-details-core.entry.js +51 -0
- package/dist/esm/form-control-datepart_3.entry.js +1 -1
- package/dist/esm/form-control-monetary.entry.js +1 -1
- package/dist/esm/form-control-select_2.entry.js +1 -1
- package/dist/esm/gross-payment-chart-core.entry.js +11032 -0
- package/dist/esm/{index-62b8aa8a.js → index-fb5ca346.js} +0 -3
- package/dist/esm/justifi-additional-questions_5.entry.js +2 -2
- package/dist/esm/justifi-bank-account-form.entry.js +1 -1
- package/dist/esm/{select-input_2.entry.js → justifi-billing-form_4.entry.js} +1817 -2
- package/dist/esm/justifi-business-details.entry.js +42 -56
- package/dist/esm/justifi-business-form-stepped.entry.js +5 -4
- package/dist/esm/justifi-business-form.entry.js +5 -4
- package/dist/esm/justifi-business-list.entry.js +5 -4
- package/dist/esm/justifi-business-owners.entry.js +1 -1
- package/dist/esm/justifi-card-form.entry.js +1 -1
- package/dist/esm/justifi-checkout-core.entry.js +91 -0
- package/dist/esm/justifi-checkout.entry.js +95 -0
- package/dist/esm/justifi-details.entry.js +2 -2
- package/dist/esm/justifi-gross-payment-chart.entry.js +39 -11008
- package/dist/esm/justifi-new-payment-method_3.entry.js +162 -0
- package/dist/esm/justifi-payment-balance-transactions.entry.js +4 -3
- package/dist/esm/justifi-payment-details.entry.js +5 -4
- package/dist/esm/justifi-payment-form.entry.js +4 -3
- package/dist/esm/{justifi-billing-form_2.entry.js → justifi-payment-method-selector.entry.js} +4 -78
- package/dist/esm/justifi-payments-list.entry.js +5 -4
- package/dist/esm/justifi-payout-details.entry.js +5 -4
- package/dist/esm/justifi-payouts-list.entry.js +5 -4
- package/dist/esm/justifi-proceeds-list.entry.js +4 -3
- package/dist/esm/justifi-refund-form.entry.js +3 -2
- package/dist/esm/justifi-subaccount-details.entry.js +6 -5
- package/dist/esm/justifi-subaccounts-list.entry.js +5 -4
- package/dist/esm/justifi-table_2.entry.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/payment-details-core.entry.js +10 -4
- package/dist/esm/{payment.service-bea02ccf.js → payment.service-f274ef98.js} +2 -1
- package/dist/esm/payments-list-core.entry.js +4 -3
- package/dist/esm/payout-details-core.entry.js +4 -4
- package/dist/esm/{payout.service-92e56814.js → payout.service-af293f61.js} +2 -1
- package/dist/esm/payouts-list-core.entry.js +4 -3
- package/dist/esm/subaccount-account-details_4.entry.js +7 -7
- package/dist/esm/subaccount-bank-details.entry.js +3 -3
- package/dist/esm/subaccount-terms-details.entry.js +3 -3
- package/dist/esm/{utils-76a93600.js → utils-5193fcd7.js} +10 -3
- package/dist/esm/{utils-576874df.js → utils-a3e96d9f.js} +5 -5
- package/dist/esm/webcomponents.js +3 -3
- package/dist/module/Business.js +6 -7
- package/dist/module/Payment.js +138 -0
- package/dist/module/Payout.js +1 -138
- package/dist/module/SubAccount.js +1 -1
- package/dist/module/additional-questions-details2.js +5 -2
- package/dist/module/billing-form.js +1 -2
- package/dist/module/business-details-core.d.ts +11 -0
- package/dist/module/business-details-core.js +6 -0
- package/dist/module/business-details-core2.js +101 -0
- package/dist/module/checkout-core.js +163 -0
- package/dist/module/generic-info-details2.js +4 -2
- package/dist/module/gross-payment-chart-core.d.ts +11 -0
- package/dist/module/gross-payment-chart-core.js +6 -0
- package/dist/module/gross-payment-chart-core2.js +11055 -0
- package/dist/module/justifi-business-details.js +51 -60
- package/dist/module/justifi-business-form-stepped.js +1 -0
- package/dist/module/justifi-business-form.js +1 -0
- package/dist/module/justifi-business-list.js +2 -1
- package/dist/module/justifi-checkout-core.d.ts +11 -0
- package/dist/module/justifi-checkout-core.js +6 -0
- package/dist/module/justifi-checkout.d.ts +11 -0
- package/dist/module/justifi-checkout.js +172 -0
- package/dist/module/justifi-gross-payment-chart.js +49 -11016
- package/dist/module/justifi-new-payment-method.d.ts +11 -0
- package/dist/module/justifi-new-payment-method.js +6 -0
- package/dist/module/justifi-payment-balance-transactions.js +3 -2
- package/dist/module/justifi-payment-details.js +2 -1
- package/dist/module/justifi-payment-form.js +2 -1
- package/dist/module/justifi-payment-method-options.d.ts +11 -0
- package/dist/module/justifi-payment-method-options.js +6 -0
- 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-proceeds-list.js +2 -1
- package/dist/module/justifi-refund-form.js +1 -0
- package/dist/module/justifi-saved-payment-method.d.ts +11 -0
- package/dist/module/justifi-saved-payment-method.js +6 -0
- package/dist/module/justifi-subaccount-details.js +2 -1
- package/dist/module/justifi-subaccounts-list.js +2 -1
- package/dist/module/legal-address-details2.js +5 -2
- package/dist/module/new-payment-method.js +105 -0
- package/dist/module/owner-details2.js +10 -4
- package/dist/module/payment-details-core2.js +9 -3
- package/dist/module/payment-method-form.js +3 -2
- package/dist/module/payment-method-options.js +128 -0
- package/dist/module/payment-method-selector.js +2 -1
- package/dist/module/payment.service.js +1 -0
- package/dist/module/payments-list-core2.js +2 -1
- package/dist/module/payout-details-core2.js +3 -3
- package/dist/module/payout.service.js +1 -0
- package/dist/module/payouts-list-core2.js +3 -2
- package/dist/module/representative-details2.js +5 -3
- package/dist/module/saved-payment-method.js +66 -0
- package/dist/module/subaccount-account-details2.js +2 -2
- package/dist/module/subaccount-bank-details.js +2 -2
- package/dist/module/subaccount-merchant-details2.js +3 -3
- package/dist/module/subaccount-owners-details2.js +2 -2
- package/dist/module/subaccount-representative-details2.js +2 -2
- package/dist/module/subaccount-terms-details.js +2 -2
- package/dist/module/utils.js +4 -4
- package/dist/module/utils2.js +10 -3
- package/dist/types/api/Api.d.ts +1 -1
- package/dist/types/api/Checkout.d.ts +14 -0
- package/dist/types/api/index.d.ts +1 -0
- package/dist/types/api/services/business.service.d.ts +8 -0
- package/dist/types/api/services/checkout.service.d.ts +9 -0
- package/dist/types/api/services/reports.service.d.ts +5 -0
- package/dist/types/components/billing-form/billing-form.d.ts +0 -1
- package/dist/types/components/business-details/business-details-core.d.ts +16 -0
- package/dist/types/components/business-details/business-details.d.ts +3 -13
- package/dist/types/components/business-details/get-business.d.ts +8 -0
- package/dist/types/components/business-details/owner-details/owner-details.d.ts +0 -8
- package/dist/types/components/checkout/checkout-actions.d.ts +17 -0
- package/dist/types/components/checkout/checkout-core.d.ts +28 -0
- package/dist/types/components/checkout/checkout.d.ts +12 -0
- package/dist/types/components/checkout/new-payment-method.d.ts +17 -0
- package/dist/types/components/checkout/payment-method-option-utils.d.ts +16 -0
- package/dist/types/components/checkout/payment-method-options.d.ts +18 -0
- package/dist/types/components/checkout/saved-payment-method.d.ts +11 -0
- package/dist/types/components/checkout/test/checkout.d.ts +1 -0
- package/dist/types/components/checkout/test/mockCheckout.d.ts +19 -0
- package/dist/types/components/details/utils.d.ts +1 -1
- package/dist/types/components/gross-payment-chart/get-gross-payment-chart-data.d.ts +11 -0
- package/dist/types/components/gross-payment-chart/gross-payment-chart-core.d.ts +18 -0
- package/dist/types/components/gross-payment-chart/gross-payment-chart.d.ts +4 -14
- package/dist/types/components/payment-details/payment-details.d.ts +0 -1
- package/dist/types/components/payment-method-form/payment-method-responses.d.ts +3 -9
- package/dist/types/components.d.ts +217 -32
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/webcomponents/p-018b71f5.entry.js +1 -0
- package/dist/webcomponents/p-0923e39c.js +1 -0
- package/dist/webcomponents/{p-7a1a06c0.entry.js → p-09b94d22.entry.js} +1 -1
- package/dist/webcomponents/p-1b04d091.entry.js +1 -0
- package/dist/webcomponents/{p-0a0cf2e6.entry.js → p-1bac1674.entry.js} +1 -1
- package/dist/webcomponents/p-1cbdca15.entry.js +1 -0
- package/dist/webcomponents/p-3134ab82.entry.js +1 -0
- package/dist/webcomponents/{p-22c1acd6.js → p-34f9fe6b.js} +1 -1
- package/dist/webcomponents/p-3bae0ed3.entry.js +1 -0
- package/dist/webcomponents/p-41031759.entry.js +1 -0
- package/dist/webcomponents/p-41490d96.entry.js +1 -0
- package/dist/webcomponents/p-44b88365.entry.js +1 -0
- package/dist/webcomponents/{p-081cf5f6.entry.js → p-4ed3a9f5.entry.js} +1 -1
- package/dist/webcomponents/{p-6478f3ca.js → p-4edd9721.js} +1 -1
- package/dist/webcomponents/p-51b0bf2a.entry.js +1 -0
- package/dist/webcomponents/p-531844f6.entry.js +1 -0
- package/dist/webcomponents/{p-4fa27a28.entry.js → p-591e29bf.entry.js} +1 -1
- package/dist/webcomponents/p-5d5d7550.entry.js +1 -0
- package/dist/webcomponents/{p-810b72b5.js → p-5ea274b8.js} +1 -1
- package/dist/webcomponents/{p-4ba2c711.entry.js → p-5f785ede.entry.js} +1 -1
- package/dist/webcomponents/p-63296409.js +1 -0
- package/dist/webcomponents/{p-4f14df36.js → p-6d05174c.js} +1 -1
- package/dist/webcomponents/p-72d1ad98.entry.js +1 -0
- package/dist/webcomponents/{p-40349ffc.entry.js → p-796cf44f.entry.js} +1 -1
- package/dist/webcomponents/p-79f99d62.entry.js +1 -0
- package/dist/webcomponents/p-7b2cddc7.js +1 -0
- package/dist/webcomponents/{p-7c0f91fa.entry.js → p-7cd06ada.entry.js} +1 -1
- package/dist/webcomponents/p-8f895ec3.entry.js +1 -0
- package/dist/webcomponents/p-92a55427.entry.js +1 -0
- package/dist/webcomponents/p-97c42345.entry.js +1 -0
- package/dist/webcomponents/p-99a8b7d0.entry.js +1 -0
- package/dist/webcomponents/p-9a63eec9.entry.js +1 -0
- package/dist/webcomponents/p-9c310f5c.entry.js +1 -0
- package/dist/webcomponents/p-9e3771b7.entry.js +19 -0
- package/dist/webcomponents/{p-6d0725ef.entry.js → p-a81229a5.entry.js} +1 -1
- package/dist/webcomponents/{p-234bc840.entry.js → p-adc96df1.entry.js} +1 -1
- package/dist/webcomponents/p-baafa7f5.js +1 -0
- package/dist/webcomponents/p-babd292f.entry.js +1 -0
- package/dist/webcomponents/{p-5c0310ee.js → p-bb037696.js} +1 -1
- package/dist/webcomponents/p-bb7f6095.entry.js +1 -0
- package/dist/webcomponents/p-c032b216.entry.js +1 -0
- package/dist/webcomponents/{p-08833966.entry.js → p-c2c3d5d1.entry.js} +1 -1
- package/dist/webcomponents/p-c8d51336.entry.js +1 -0
- package/dist/webcomponents/{p-4c01df65.entry.js → p-dc05b5c5.entry.js} +1 -1
- package/dist/webcomponents/p-e3fab0e2.js +1 -0
- package/dist/webcomponents/p-e536a4c1.entry.js +1 -0
- package/dist/webcomponents/p-ec358d69.entry.js +1 -0
- package/dist/webcomponents/p-f55ac955.entry.js +1 -0
- package/dist/webcomponents/p-f64a85cf.entry.js +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +3 -2
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +0 -1747
- package/dist/esm/justifi-payment-method-form.entry.js +0 -1743
- package/dist/webcomponents/p-0bc8b02e.entry.js +0 -1
- package/dist/webcomponents/p-112acd3c.entry.js +0 -1
- package/dist/webcomponents/p-1555e6b1.js +0 -1
- package/dist/webcomponents/p-16f41fd0.entry.js +0 -1
- package/dist/webcomponents/p-17715325.js +0 -1
- package/dist/webcomponents/p-3a4d4869.entry.js +0 -1
- package/dist/webcomponents/p-3cb0b96d.js +0 -1
- package/dist/webcomponents/p-5422a24b.entry.js +0 -1
- package/dist/webcomponents/p-578e0a05.entry.js +0 -1
- package/dist/webcomponents/p-640d90dc.entry.js +0 -1
- package/dist/webcomponents/p-663bfe87.js +0 -1
- package/dist/webcomponents/p-696396c7.entry.js +0 -1
- package/dist/webcomponents/p-6ab67031.entry.js +0 -1
- package/dist/webcomponents/p-8516d602.entry.js +0 -1
- package/dist/webcomponents/p-894a7475.entry.js +0 -19
- package/dist/webcomponents/p-94ebfafb.entry.js +0 -1
- package/dist/webcomponents/p-9cb3ff78.entry.js +0 -1
- package/dist/webcomponents/p-9e81808f.entry.js +0 -1
- package/dist/webcomponents/p-a432110c.entry.js +0 -1
- package/dist/webcomponents/p-b1881723.entry.js +0 -1
- package/dist/webcomponents/p-b5aba473.entry.js +0 -1
- package/dist/webcomponents/p-bd099662.entry.js +0 -1
- package/dist/webcomponents/p-bfd917b8.entry.js +0 -1
- package/dist/webcomponents/p-c90fa055.entry.js +0 -1
- package/dist/webcomponents/p-ebb91944.entry.js +0 -1
- package/dist/webcomponents/p-ec4f27e7.entry.js +0 -1
- package/dist/webcomponents/p-fa495a43.entry.js +0 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { config } from "../../../config";
|
|
3
|
+
import { PaymentMethodTypes } from "../../api/Payment";
|
|
4
|
+
import { PaymentMethodOption } from "./payment-method-option-utils";
|
|
5
|
+
export class PaymentMethodOptions {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.showCard = undefined;
|
|
8
|
+
this.showAch = undefined;
|
|
9
|
+
this.clientId = undefined;
|
|
10
|
+
this.accountId = undefined;
|
|
11
|
+
this.iframeOrigin = config.iframeOrigin;
|
|
12
|
+
this.savedPaymentMethods = [];
|
|
13
|
+
this.selectedPaymentMethodId = undefined;
|
|
14
|
+
this.paymentMethodOptions = [];
|
|
15
|
+
}
|
|
16
|
+
paymentMethodsChanged() {
|
|
17
|
+
this.paymentMethodOptions = this.savedPaymentMethods.map((paymentMethod) => new PaymentMethodOption(paymentMethod));
|
|
18
|
+
if (this.showCard) {
|
|
19
|
+
this.paymentMethodOptions.push(new PaymentMethodOption({ id: PaymentMethodTypes.card }));
|
|
20
|
+
}
|
|
21
|
+
if (this.showAch) {
|
|
22
|
+
this.paymentMethodOptions.push(new PaymentMethodOption({ id: PaymentMethodTypes.bankAccount }));
|
|
23
|
+
}
|
|
24
|
+
this.selectedPaymentMethodId = this.paymentMethodOptions[0].id;
|
|
25
|
+
}
|
|
26
|
+
paymentMethodOptionSelected(event) {
|
|
27
|
+
this.selectedPaymentMethodId = event.detail.id;
|
|
28
|
+
}
|
|
29
|
+
async getPaymentMethodToken() {
|
|
30
|
+
var _a;
|
|
31
|
+
return await ((_a = this.selectedPaymentMethodOptionRef) === null || _a === void 0 ? void 0 : _a.getPaymentMethodToken());
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
var _a;
|
|
35
|
+
return (h("div", null, (_a = this.paymentMethodOptions) === null || _a === void 0 ? void 0 : _a.map((paymentMethodOption) => {
|
|
36
|
+
const newCard = paymentMethodOption.id === PaymentMethodTypes.card;
|
|
37
|
+
const newBankAccount = paymentMethodOption.id === PaymentMethodTypes.bankAccount;
|
|
38
|
+
const isSelected = this.selectedPaymentMethodId === paymentMethodOption.id;
|
|
39
|
+
if (newCard || newBankAccount) {
|
|
40
|
+
return (h("justifi-new-payment-method", { paymentMethodOption: paymentMethodOption, "client-id": this.clientId, "account-id": this.accountId, "is-selected": isSelected, ref: (el) => {
|
|
41
|
+
if (isSelected) {
|
|
42
|
+
this.selectedPaymentMethodOptionRef = el;
|
|
43
|
+
}
|
|
44
|
+
} }));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return (h("justifi-saved-payment-method", { paymentMethodOption: paymentMethodOption, "is-selected": isSelected, ref: (el) => {
|
|
48
|
+
if (isSelected) {
|
|
49
|
+
this.selectedPaymentMethodOptionRef = el;
|
|
50
|
+
}
|
|
51
|
+
} }));
|
|
52
|
+
}
|
|
53
|
+
})));
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "justifi-payment-method-options"; }
|
|
56
|
+
static get originalStyleUrls() {
|
|
57
|
+
return {
|
|
58
|
+
"$": ["payment-method-options.scss"]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
static get styleUrls() {
|
|
62
|
+
return {
|
|
63
|
+
"$": ["payment-method-options.css"]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
static get properties() {
|
|
67
|
+
return {
|
|
68
|
+
"showCard": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"mutable": false,
|
|
71
|
+
"complexType": {
|
|
72
|
+
"original": "boolean",
|
|
73
|
+
"resolved": "boolean",
|
|
74
|
+
"references": {}
|
|
75
|
+
},
|
|
76
|
+
"required": false,
|
|
77
|
+
"optional": false,
|
|
78
|
+
"docs": {
|
|
79
|
+
"tags": [],
|
|
80
|
+
"text": ""
|
|
81
|
+
},
|
|
82
|
+
"attribute": "show-card",
|
|
83
|
+
"reflect": false
|
|
84
|
+
},
|
|
85
|
+
"showAch": {
|
|
86
|
+
"type": "boolean",
|
|
87
|
+
"mutable": false,
|
|
88
|
+
"complexType": {
|
|
89
|
+
"original": "boolean",
|
|
90
|
+
"resolved": "boolean",
|
|
91
|
+
"references": {}
|
|
92
|
+
},
|
|
93
|
+
"required": false,
|
|
94
|
+
"optional": false,
|
|
95
|
+
"docs": {
|
|
96
|
+
"tags": [],
|
|
97
|
+
"text": ""
|
|
98
|
+
},
|
|
99
|
+
"attribute": "show-ach",
|
|
100
|
+
"reflect": false
|
|
101
|
+
},
|
|
102
|
+
"clientId": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"mutable": false,
|
|
105
|
+
"complexType": {
|
|
106
|
+
"original": "string",
|
|
107
|
+
"resolved": "string",
|
|
108
|
+
"references": {}
|
|
109
|
+
},
|
|
110
|
+
"required": false,
|
|
111
|
+
"optional": false,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": ""
|
|
115
|
+
},
|
|
116
|
+
"attribute": "client-id",
|
|
117
|
+
"reflect": false
|
|
118
|
+
},
|
|
119
|
+
"accountId": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"mutable": false,
|
|
122
|
+
"complexType": {
|
|
123
|
+
"original": "string",
|
|
124
|
+
"resolved": "string",
|
|
125
|
+
"references": {}
|
|
126
|
+
},
|
|
127
|
+
"required": false,
|
|
128
|
+
"optional": false,
|
|
129
|
+
"docs": {
|
|
130
|
+
"tags": [],
|
|
131
|
+
"text": ""
|
|
132
|
+
},
|
|
133
|
+
"attribute": "account-id",
|
|
134
|
+
"reflect": false
|
|
135
|
+
},
|
|
136
|
+
"iframeOrigin": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"mutable": true,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "string",
|
|
141
|
+
"resolved": "string",
|
|
142
|
+
"references": {}
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"optional": true,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": ""
|
|
149
|
+
},
|
|
150
|
+
"attribute": "iframe-origin",
|
|
151
|
+
"reflect": false,
|
|
152
|
+
"defaultValue": "config.iframeOrigin"
|
|
153
|
+
},
|
|
154
|
+
"savedPaymentMethods": {
|
|
155
|
+
"type": "unknown",
|
|
156
|
+
"mutable": false,
|
|
157
|
+
"complexType": {
|
|
158
|
+
"original": "any[]",
|
|
159
|
+
"resolved": "any[]",
|
|
160
|
+
"references": {}
|
|
161
|
+
},
|
|
162
|
+
"required": false,
|
|
163
|
+
"optional": false,
|
|
164
|
+
"docs": {
|
|
165
|
+
"tags": [],
|
|
166
|
+
"text": ""
|
|
167
|
+
},
|
|
168
|
+
"defaultValue": "[]"
|
|
169
|
+
},
|
|
170
|
+
"selectedPaymentMethodId": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"mutable": false,
|
|
173
|
+
"complexType": {
|
|
174
|
+
"original": "string",
|
|
175
|
+
"resolved": "string",
|
|
176
|
+
"references": {}
|
|
177
|
+
},
|
|
178
|
+
"required": false,
|
|
179
|
+
"optional": false,
|
|
180
|
+
"docs": {
|
|
181
|
+
"tags": [],
|
|
182
|
+
"text": ""
|
|
183
|
+
},
|
|
184
|
+
"attribute": "selected-payment-method-id",
|
|
185
|
+
"reflect": false
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
static get states() {
|
|
190
|
+
return {
|
|
191
|
+
"paymentMethodOptions": {}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
static get events() {
|
|
195
|
+
return [{
|
|
196
|
+
"method": "toggleCreatingNewPaymentMethod",
|
|
197
|
+
"name": "toggleCreatingNewPaymentMethod",
|
|
198
|
+
"bubbles": true,
|
|
199
|
+
"cancelable": true,
|
|
200
|
+
"composed": true,
|
|
201
|
+
"docs": {
|
|
202
|
+
"tags": [],
|
|
203
|
+
"text": ""
|
|
204
|
+
},
|
|
205
|
+
"complexType": {
|
|
206
|
+
"original": "any",
|
|
207
|
+
"resolved": "any",
|
|
208
|
+
"references": {}
|
|
209
|
+
}
|
|
210
|
+
}];
|
|
211
|
+
}
|
|
212
|
+
static get methods() {
|
|
213
|
+
return {
|
|
214
|
+
"getPaymentMethodToken": {
|
|
215
|
+
"complexType": {
|
|
216
|
+
"signature": "() => Promise<string>",
|
|
217
|
+
"parameters": [],
|
|
218
|
+
"references": {
|
|
219
|
+
"Promise": {
|
|
220
|
+
"location": "global",
|
|
221
|
+
"id": "global::Promise"
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"return": "Promise<string>"
|
|
225
|
+
},
|
|
226
|
+
"docs": {
|
|
227
|
+
"text": "",
|
|
228
|
+
"tags": []
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
static get watchers() {
|
|
234
|
+
return [{
|
|
235
|
+
"propName": "savedPaymentMethods",
|
|
236
|
+
"methodName": "paymentMethodsChanged"
|
|
237
|
+
}];
|
|
238
|
+
}
|
|
239
|
+
static get listeners() {
|
|
240
|
+
return [{
|
|
241
|
+
"name": "paymentMethodOptionSelected",
|
|
242
|
+
"method": "paymentMethodOptionSelected",
|
|
243
|
+
"target": undefined,
|
|
244
|
+
"capture": false,
|
|
245
|
+
"passive": false
|
|
246
|
+
}];
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Fragment, h } from "@stencil/core";
|
|
2
|
+
import { config } from "../../../config";
|
|
3
|
+
import { CardBrandLabels } from "./payment-method-option-utils";
|
|
4
|
+
export class SavedPaymentMethod {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.onPaymentMethodOptionClick = () => {
|
|
7
|
+
this.paymentMethodOptionSelected.emit(this.paymentMethodOption);
|
|
8
|
+
};
|
|
9
|
+
this.iframeOrigin = config.iframeOrigin;
|
|
10
|
+
this.paymentMethodOption = undefined;
|
|
11
|
+
this.isSelected = undefined;
|
|
12
|
+
}
|
|
13
|
+
async getPaymentMethodToken() {
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = this.paymentMethodOption) === null || _a === void 0 ? void 0 : _a.id;
|
|
16
|
+
}
|
|
17
|
+
;
|
|
18
|
+
render() {
|
|
19
|
+
var _a, _b, _c, _d, _e;
|
|
20
|
+
return (h(Fragment, null, h("div", { class: "payment-method" }, h("div", { class: "payment-method-header p-3 border-bottom", onClick: () => this.onPaymentMethodOptionClick() }, h("input", { type: "radio", name: "paymentMethodType", id: (_a = this.paymentMethodOption) === null || _a === void 0 ? void 0 : _a.id, value: (_b = this.paymentMethodOption) === null || _b === void 0 ? void 0 : _b.id, onClick: (event) => event.preventDefault(), checked: this.isSelected, class: "form-check-input me-2" }), h("label", { htmlFor: (_c = this.paymentMethodOption) === null || _c === void 0 ? void 0 : _c.id, class: "form-check-label" }, CardBrandLabels[(_d = this.paymentMethodOption) === null || _d === void 0 ? void 0 : _d.brand], " *", (_e = this.paymentMethodOption) === null || _e === void 0 ? void 0 :
|
|
21
|
+
_e.acct_last_four)))));
|
|
22
|
+
}
|
|
23
|
+
static get is() { return "justifi-saved-payment-method"; }
|
|
24
|
+
static get properties() {
|
|
25
|
+
return {
|
|
26
|
+
"iframeOrigin": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"mutable": true,
|
|
29
|
+
"complexType": {
|
|
30
|
+
"original": "string",
|
|
31
|
+
"resolved": "string",
|
|
32
|
+
"references": {}
|
|
33
|
+
},
|
|
34
|
+
"required": false,
|
|
35
|
+
"optional": true,
|
|
36
|
+
"docs": {
|
|
37
|
+
"tags": [],
|
|
38
|
+
"text": ""
|
|
39
|
+
},
|
|
40
|
+
"attribute": "iframe-origin",
|
|
41
|
+
"reflect": false,
|
|
42
|
+
"defaultValue": "config.iframeOrigin"
|
|
43
|
+
},
|
|
44
|
+
"paymentMethodOption": {
|
|
45
|
+
"type": "unknown",
|
|
46
|
+
"mutable": false,
|
|
47
|
+
"complexType": {
|
|
48
|
+
"original": "PaymentMethodOption",
|
|
49
|
+
"resolved": "PaymentMethodOption",
|
|
50
|
+
"references": {
|
|
51
|
+
"PaymentMethodOption": {
|
|
52
|
+
"location": "import",
|
|
53
|
+
"path": "./payment-method-option-utils",
|
|
54
|
+
"id": "src/components/checkout/payment-method-option-utils.tsx::PaymentMethodOption"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": false,
|
|
59
|
+
"optional": false,
|
|
60
|
+
"docs": {
|
|
61
|
+
"tags": [],
|
|
62
|
+
"text": ""
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"isSelected": {
|
|
66
|
+
"type": "boolean",
|
|
67
|
+
"mutable": false,
|
|
68
|
+
"complexType": {
|
|
69
|
+
"original": "boolean",
|
|
70
|
+
"resolved": "boolean",
|
|
71
|
+
"references": {}
|
|
72
|
+
},
|
|
73
|
+
"required": false,
|
|
74
|
+
"optional": false,
|
|
75
|
+
"docs": {
|
|
76
|
+
"tags": [],
|
|
77
|
+
"text": ""
|
|
78
|
+
},
|
|
79
|
+
"attribute": "is-selected",
|
|
80
|
+
"reflect": false
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
static get events() {
|
|
85
|
+
return [{
|
|
86
|
+
"method": "paymentMethodOptionSelected",
|
|
87
|
+
"name": "paymentMethodOptionSelected",
|
|
88
|
+
"bubbles": true,
|
|
89
|
+
"cancelable": true,
|
|
90
|
+
"composed": true,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": ""
|
|
94
|
+
},
|
|
95
|
+
"complexType": {
|
|
96
|
+
"original": "any",
|
|
97
|
+
"resolved": "any",
|
|
98
|
+
"references": {}
|
|
99
|
+
}
|
|
100
|
+
}];
|
|
101
|
+
}
|
|
102
|
+
static get methods() {
|
|
103
|
+
return {
|
|
104
|
+
"getPaymentMethodToken": {
|
|
105
|
+
"complexType": {
|
|
106
|
+
"signature": "() => Promise<string>",
|
|
107
|
+
"parameters": [],
|
|
108
|
+
"references": {
|
|
109
|
+
"Promise": {
|
|
110
|
+
"location": "global",
|
|
111
|
+
"id": "global::Promise"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"return": "Promise<string>"
|
|
115
|
+
},
|
|
116
|
+
"docs": {
|
|
117
|
+
"text": "",
|
|
118
|
+
"tags": []
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
+
describe('justifi-checkout', () => {
|
|
3
|
+
it('should correctly render submit button with correct text', async () => {
|
|
4
|
+
// Create new testing page and add our component to it
|
|
5
|
+
const page = await newE2EPage();
|
|
6
|
+
await page.setContent(`
|
|
7
|
+
<justifi-checkout
|
|
8
|
+
bank-account="true"
|
|
9
|
+
card="true"
|
|
10
|
+
email="test@example.com"
|
|
11
|
+
iframe-origin="https://iframe.example.com"
|
|
12
|
+
client-id="testId"
|
|
13
|
+
account-id="accountId"
|
|
14
|
+
submit-button-text="Pay Now"
|
|
15
|
+
/>
|
|
16
|
+
`);
|
|
17
|
+
// Find the submit button on the page
|
|
18
|
+
const submitButton = await page.find('justifi-checkout >>> button');
|
|
19
|
+
// Assert that the submit button's text is set correctly
|
|
20
|
+
expect(await submitButton.textContent).toBe('Pay Now');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { newSpecPage } from "@stencil/core/testing";
|
|
2
|
+
import { Checkout } from "../checkout";
|
|
3
|
+
import { CheckoutCore } from "../checkout-core";
|
|
4
|
+
// import { PaymentMethodTypes } from '../../../api';
|
|
5
|
+
// import { BillingFormFields } from '../../billing-form/billing-form-schema';
|
|
6
|
+
describe('justifi-checkout', () => {
|
|
7
|
+
it('renders', async () => {
|
|
8
|
+
const page = await newSpecPage({
|
|
9
|
+
components: [Checkout, CheckoutCore],
|
|
10
|
+
html: '<justifi-checkout></justifi-checkout>',
|
|
11
|
+
});
|
|
12
|
+
await page.waitForChanges();
|
|
13
|
+
expect(page.root).toMatchSnapshot();
|
|
14
|
+
});
|
|
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
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const mockCheckout = {
|
|
2
|
+
"id": "cho_1Kx0fKUNt2GVfHrDj5GxoO",
|
|
3
|
+
"type": "checkout",
|
|
4
|
+
"page_info": null,
|
|
5
|
+
"data": {
|
|
6
|
+
"payment_intent_id": "pi_3triuDeQOGkrdkONJwsOxD",
|
|
7
|
+
"account_id": "acc_323sM3WDAUnHH0fJD7re9h",
|
|
8
|
+
"platform_account_id": "acc_75j5yGxQUf69B9vT2hDUn9",
|
|
9
|
+
"payment_amount": "2413",
|
|
10
|
+
"payment_client_id": "test_eohVQllq0mJy34T14dsZJlHjXKr7rKyH",
|
|
11
|
+
"payment_description": "dptest pos mode",
|
|
12
|
+
"payment_methods": [],
|
|
13
|
+
"payment_method_group_id": null,
|
|
14
|
+
"payment_settings": {
|
|
15
|
+
"credit_card_payments": true,
|
|
16
|
+
"ach_payments": true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export const LoadingState = () => (h("main", { part: "detail-loading-state", class: "p-4 d-flex justify-content-center text-center", style: { fontSize: '1.2rem' } }, h("div", { part: "detail-loading-spinner", class: "spinner-border spinner-border-sm", role: "status" }, h("span", { class: "visually-hidden" }, "Loading..."))));
|
|
3
3
|
export const ErrorState = (errorMessage) => (h("main", { part: "detail-empty-state", class: "p-4 d-flex justify-content-center text-center", style: { fontSize: '1.2rem' } }, h("div", null, errorMessage)));
|
|
4
|
-
export const
|
|
4
|
+
export const DetailSectionTitle = (props) => [
|
|
5
|
+
h("h5", { part: "detail-section-title", class: "mt-4" }, props.sectionTitle),
|
|
6
|
+
h("hr", null),
|
|
7
|
+
];
|
|
5
8
|
export const DetailItem = ({ title, value, }) => title && value ? (h("div", { class: "d-table-row gap-2" }, h("span", { part: "detail-section-item-title", class: "fw-bold d-table-cell px-2" }, title), h("span", { part: "detail-section-item-data", class: "flex-1 d-table-cell px-2 text-wrap", innerHTML: value }))) : null;
|
|
6
9
|
export const EntityHeadInfoItem = ({ title, value, classes, }) => (h("div", { part: "detail-head-info-item", class: `d-flex flex-column ${classes}` }, h("span", { part: "detail-head-info-item-title", class: "fw-bold border-1 border-bottom ps-2 pe-2" }, title), h("span", { part: "detail-head-info-item-data", class: "pt-2 ps-2 pe-2" }, value)));
|
|
7
10
|
export const EntityHeadInfo = ({ title, slot, badge }, children) => (h("div", { slot: slot, part: "detail-head", class: "p-2" }, h("div", { class: "d-flex flex-row align-items-center gap-2 mb-2" }, h("h1", { class: "m-0", part: "detail-title" }, title), badge), h("div", { part: "detail-head-info", class: "d-flex flex-row align-items-top" }, children)));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const makeGetGrossPaymentChartData = ({ id, authToken, service }) => async ({ onSuccess, onError }) => {
|
|
2
|
+
try {
|
|
3
|
+
const response = await service.fetchGrossVolumeChartData(id, authToken);
|
|
4
|
+
if (!response.error) {
|
|
5
|
+
onSuccess(response.data);
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
onError(`Error trying to fetch data : ${response.error}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
onError(`Error trying to fetch data : ${error}`);
|
|
13
|
+
}
|
|
14
|
+
};
|