@paydock/client-sdk 0.0.3 → 0.1.2-beta
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/README.md +9050 -52
- package/bundles/index.cjs +38558 -0
- package/bundles/index.cjs.d.ts +4777 -0
- package/bundles/index.mjs +38519 -0
- package/bundles/index.mjs.d.ts +4777 -0
- package/bundles/types/api/api-base.d.ts +54 -0
- package/bundles/types/api/api-base.d.ts.map +1 -0
- package/bundles/types/api/api-charge-internal.d.ts +99 -0
- package/bundles/types/api/api-charge-internal.d.ts.map +1 -0
- package/bundles/types/api/api-charge.d.ts +36 -0
- package/bundles/types/api/api-charge.d.ts.map +1 -0
- package/bundles/types/api/api-checkout-internal.d.ts +58 -0
- package/bundles/types/api/api-checkout-internal.d.ts.map +1 -0
- package/bundles/types/api/api-gateway-internal.d.ts +12 -0
- package/bundles/types/api/api-gateway-internal.d.ts.map +1 -0
- package/bundles/types/api/api-internal.d.ts +13 -0
- package/bundles/types/api/api-internal.d.ts.map +1 -0
- package/bundles/types/api/api-service-internal.d.ts +19 -0
- package/bundles/types/api/api-service-internal.d.ts.map +1 -0
- package/bundles/types/api/api.d.ts +55 -0
- package/bundles/types/api/api.d.ts.map +1 -0
- package/bundles/types/api/index.d.ts +2 -0
- package/bundles/types/api/index.d.ts.map +1 -0
- package/bundles/types/canvas-3ds/canvas-3ds.d.ts +109 -0
- package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +1 -0
- package/bundles/types/canvas-3ds/index.d.ts +2 -0
- package/bundles/types/canvas-3ds/index.d.ts.map +1 -0
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +43 -0
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -0
- package/bundles/types/canvas-3ds/services/index.d.ts +2 -0
- package/bundles/types/canvas-3ds/services/index.d.ts.map +1 -0
- package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts +22 -0
- package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts.map +1 -0
- package/bundles/types/checkout/checkout.d.ts +107 -0
- package/bundles/types/checkout/checkout.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/instruction-handler.d.ts +25 -0
- package/bundles/types/checkout/helpers/instruction-handler.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/instruction-module.d.ts +6 -0
- package/bundles/types/checkout/helpers/instruction-module.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/instruction-module.decorator.d.ts +6 -0
- package/bundles/types/checkout/helpers/instruction-module.decorator.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/instruction.decorator.d.ts +5 -0
- package/bundles/types/checkout/helpers/instruction.decorator.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/resource-helper.d.ts +6 -0
- package/bundles/types/checkout/helpers/resource-helper.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/session-helper.d.ts +8 -0
- package/bundles/types/checkout/helpers/session-helper.d.ts.map +1 -0
- package/bundles/types/checkout/index.d.ts +2 -0
- package/bundles/types/checkout/index.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/index.d.ts +3 -0
- package/bundles/types/checkout/instructions/index.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/index.d.ts +4 -0
- package/bundles/types/checkout/instructions/v1/index.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts +20 -0
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_wallet_form.show.d.ts +14 -0
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_wallet_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.apple_pay_form.show.d.ts +18 -0
- package/bundles/types/checkout/instructions/v1/instruction.apple_pay_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.bank_account_form.show.d.ts +15 -0
- package/bundles/types/checkout/instructions/v1/instruction.bank_account_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.canvas_3ds.show.d.ts +11 -0
- package/bundles/types/checkout/instructions/v1/instruction.canvas_3ds.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts +19 -0
- package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.disable_payment_method_event.emit.d.ts +20 -0
- package/bundles/types/checkout/instructions/v1/instruction.disable_payment_method_event.emit.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.fraud_service.show.d.ts +21 -0
- package/bundles/types/checkout/instructions/v1/instruction.fraud_service.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts +26 -0
- package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.google_pay_form.show.d.ts +18 -0
- package/bundles/types/checkout/instructions/v1/instruction.google_pay_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.merchant_event.emit.d.ts +18 -0
- package/bundles/types/checkout/instructions/v1/instruction.merchant_event.emit.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts +18 -0
- package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.paypal_form.show.d.ts +21 -0
- package/bundles/types/checkout/instructions/v1/instruction.paypal_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts +19 -0
- package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/additionals.d.ts +3 -0
- package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/default-variables.enum.d.ts +9 -0
- package/bundles/types/checkout/layout-widgets/default-variables.enum.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/message.d.ts +34 -0
- package/bundles/types/checkout/layout-widgets/message.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts +13 -0
- package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts +55 -0
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/payment-template.d.ts +3 -0
- package/bundles/types/checkout/layout-widgets/payment-template.d.ts.map +1 -0
- package/bundles/types/checkout-button/afterpay/afterpay-checkout-button.d.ts +36 -0
- package/bundles/types/checkout-button/afterpay/afterpay-checkout-button.d.ts.map +1 -0
- package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts +13 -0
- package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts.map +1 -0
- package/bundles/types/checkout-button/checkout-button.d.ts +139 -0
- package/bundles/types/checkout-button/checkout-button.d.ts.map +1 -0
- package/bundles/types/checkout-button/checkout-button.interface.d.ts +49 -0
- package/bundles/types/checkout-button/checkout-button.interface.d.ts.map +1 -0
- package/bundles/types/checkout-button/checkout-contextual-handler.d.ts +27 -0
- package/bundles/types/checkout-button/checkout-contextual-handler.d.ts.map +1 -0
- package/bundles/types/checkout-button/index.d.ts +85 -0
- package/bundles/types/checkout-button/index.d.ts.map +1 -0
- package/bundles/types/checkout-button/paypal/paypal-checkout-button.d.ts +21 -0
- package/bundles/types/checkout-button/paypal/paypal-checkout-button.d.ts.map +1 -0
- package/bundles/types/checkout-button/paypal/paypal.runner.d.ts +6 -0
- package/bundles/types/checkout-button/paypal/paypal.runner.d.ts.map +1 -0
- package/bundles/types/checkout-button/runner/base.runner.d.ts +18 -0
- package/bundles/types/checkout-button/runner/base.runner.d.ts.map +1 -0
- package/bundles/types/checkout-button/runner/contextual.runner.d.ts +39 -0
- package/bundles/types/checkout-button/runner/contextual.runner.d.ts.map +1 -0
- package/bundles/types/checkout-button/runner/index.d.ts +9 -0
- package/bundles/types/checkout-button/runner/index.d.ts.map +1 -0
- package/bundles/types/checkout-button/runner/popup.runner.d.ts +35 -0
- package/bundles/types/checkout-button/runner/popup.runner.d.ts.map +1 -0
- package/bundles/types/checkout-button/runner/redirect.runner.d.ts +17 -0
- package/bundles/types/checkout-button/runner/redirect.runner.d.ts.map +1 -0
- package/bundles/types/checkout-button/zipmoney/index.d.ts +4 -0
- package/bundles/types/checkout-button/zipmoney/index.d.ts.map +1 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney-checkout-button.d.ts +49 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney-checkout-button.d.ts.map +1 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts +39 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts.map +1 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney-redirect.runner.d.ts +26 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney-redirect.runner.d.ts.map +1 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney.config.d.ts +4 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney.config.d.ts.map +1 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney.runner.d.ts +10 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney.runner.d.ts.map +1 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney.types.d.ts +12 -0
- package/bundles/types/checkout-button/zipmoney/zipmoney.types.d.ts.map +1 -0
- package/bundles/types/components/ability-guard.d.ts +12 -0
- package/bundles/types/components/ability-guard.d.ts.map +1 -0
- package/bundles/types/components/background.d.ts +43 -0
- package/bundles/types/components/background.d.ts.map +1 -0
- package/bundles/types/components/container.d.ts +12 -0
- package/bundles/types/components/container.d.ts.map +1 -0
- package/bundles/types/components/dispatcher.d.ts +14 -0
- package/bundles/types/components/dispatcher.d.ts.map +1 -0
- package/bundles/types/components/element-style.d.ts +17 -0
- package/bundles/types/components/element-style.d.ts.map +1 -0
- package/bundles/types/components/flypay-iframe-event.d.ts +15 -0
- package/bundles/types/components/flypay-iframe-event.d.ts.map +1 -0
- package/{lib/widget/components/form-Interceptor.d.ts → bundles/types/components/form-interceptor.d.ts} +2 -1
- package/bundles/types/components/form-interceptor.d.ts.map +1 -0
- package/bundles/types/components/http-core.d.ts +14 -0
- package/bundles/types/components/http-core.d.ts.map +1 -0
- package/bundles/types/components/iframe-event.d.ts +72 -0
- package/bundles/types/components/iframe-event.d.ts.map +1 -0
- package/bundles/types/components/iframe.d.ts +20 -0
- package/bundles/types/components/iframe.d.ts.map +1 -0
- package/bundles/types/components/link.d.ts +27 -0
- package/bundles/types/components/link.d.ts.map +1 -0
- package/bundles/types/components/loader.d.ts +5 -0
- package/bundles/types/components/loader.d.ts.map +1 -0
- package/bundles/types/components/param.d.ts +430 -0
- package/bundles/types/components/param.d.ts.map +1 -0
- package/bundles/types/components/popup.d.ts +30 -0
- package/bundles/types/components/popup.d.ts.map +1 -0
- package/bundles/types/components/storage-dispatcher.d.ts +31 -0
- package/bundles/types/components/storage-dispatcher.d.ts.map +1 -0
- package/bundles/types/components/trigger.d.ts +48 -0
- package/bundles/types/components/trigger.d.ts.map +1 -0
- package/bundles/types/components/vault-display-iframe-event.d.ts +5 -0
- package/bundles/types/components/vault-display-iframe-event.d.ts.map +1 -0
- package/bundles/types/components/wallet-background.d.ts +13 -0
- package/bundles/types/components/wallet-background.d.ts.map +1 -0
- package/bundles/types/components/wallet-trigger.d.ts +19 -0
- package/bundles/types/components/wallet-trigger.d.ts.map +1 -0
- package/bundles/types/configs/env/environment.cba.d.ts +30 -0
- package/bundles/types/configs/env/environment.cba.d.ts.map +1 -0
- package/bundles/types/configs/env/environment.interface.d.ts +12 -0
- package/bundles/types/configs/env/environment.interface.d.ts.map +1 -0
- package/bundles/types/configs/env/environment.paydock.d.ts +49 -0
- package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -0
- package/bundles/types/configs/env/index.d.ts +3 -0
- package/bundles/types/configs/env/index.d.ts.map +1 -0
- package/bundles/types/configs/sdk.d.ts +10 -0
- package/bundles/types/configs/sdk.d.ts.map +1 -0
- package/bundles/types/constants/validators.d.ts +45 -0
- package/bundles/types/constants/validators.d.ts.map +1 -0
- package/bundles/types/external-checkout/builder.d.ts +29 -0
- package/bundles/types/external-checkout/builder.d.ts.map +1 -0
- package/bundles/types/external-checkout/checker.d.ts +14 -0
- package/bundles/types/external-checkout/checker.d.ts.map +1 -0
- package/bundles/types/external-checkout/index.d.ts +3 -0
- package/bundles/types/external-checkout/index.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts +9 -0
- package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts +42 -0
- package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts +163 -0
- package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/index.d.ts +3 -0
- package/bundles/types/fraud-prevention/index.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts +79 -0
- package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts +2 -0
- package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts +20 -0
- package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts.map +1 -0
- package/bundles/types/helper/access-token.d.ts +26 -0
- package/bundles/types/helper/access-token.d.ts.map +1 -0
- package/bundles/types/helper/browser.d.ts +17 -0
- package/bundles/types/helper/browser.d.ts.map +1 -0
- package/bundles/types/helper/deep-clone.d.ts +13 -0
- package/bundles/types/helper/deep-clone.d.ts.map +1 -0
- package/bundles/types/helper/element-id.d.ts +5 -0
- package/bundles/types/helper/element-id.d.ts.map +1 -0
- package/bundles/types/helper/event-emitter.d.ts +7 -0
- package/bundles/types/helper/event-emitter.d.ts.map +1 -0
- package/bundles/types/helper/event-error.d.ts +55 -0
- package/bundles/types/helper/event-error.d.ts.map +1 -0
- package/bundles/types/helper/event.d.ts +10 -0
- package/bundles/types/helper/event.d.ts.map +1 -0
- package/bundles/types/helper/ms.d.ts +6 -0
- package/bundles/types/helper/ms.d.ts.map +1 -0
- package/{lib/widget → bundles/types}/helper/object.d.ts +1 -0
- package/bundles/types/helper/object.d.ts.map +1 -0
- package/bundles/types/helper/process-event-error.d.ts +9 -0
- package/bundles/types/helper/process-event-error.d.ts.map +1 -0
- package/bundles/types/helper/spiner.util.d.ts +6 -0
- package/bundles/types/helper/spiner.util.d.ts.map +1 -0
- package/bundles/types/helper/url.d.ts +5 -0
- package/bundles/types/helper/url.d.ts.map +1 -0
- package/bundles/types/helper/uuid.d.ts +6 -0
- package/bundles/types/helper/uuid.d.ts.map +1 -0
- package/bundles/types/index-cba.d.ts +52 -0
- package/bundles/types/index-cba.d.ts.map +1 -0
- package/bundles/types/index.d.ts +52 -0
- package/bundles/types/index.d.ts.map +1 -0
- package/bundles/types/payment-source/builder.d.ts +23 -0
- package/bundles/types/payment-source/builder.d.ts.map +1 -0
- package/bundles/types/payment-source/index.d.ts +2 -0
- package/bundles/types/payment-source/index.d.ts.map +1 -0
- package/bundles/types/payment-source-widget/html-payment-source-widget.d.ts +181 -0
- package/bundles/types/payment-source-widget/html-payment-source-widget.d.ts.map +1 -0
- package/bundles/types/payment-source-widget/index.d.ts +35 -0
- package/bundles/types/payment-source-widget/index.d.ts.map +1 -0
- package/bundles/types/payment-source-widget/interfaces.d.ts +12 -0
- package/bundles/types/payment-source-widget/interfaces.d.ts.map +1 -0
- package/bundles/types/payment-source-widget/payment-source-widget.d.ts +93 -0
- package/bundles/types/payment-source-widget/payment-source-widget.d.ts.map +1 -0
- package/bundles/types/paypal-data-collector/index.d.ts +23 -0
- package/bundles/types/paypal-data-collector/index.d.ts.map +1 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts +58 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts.map +1 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts +21 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts.map +1 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts +17 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts.map +1 -0
- package/bundles/types/paypal-save-payment-source/index.d.ts +61 -0
- package/bundles/types/paypal-save-payment-source/index.d.ts.map +1 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts +85 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts.map +1 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts +83 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts.map +1 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts +35 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +31 -0
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/index.d.ts +105 -0
- package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/interfaces.d.ts +156 -0
- package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/index.d.ts +2 -0
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/index.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts +25 -0
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts +11 -0
- package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts +86 -0
- package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +1 -0
- package/bundles/types/shared/device/device-info.service.d.ts +13 -0
- package/bundles/types/shared/device/device-info.service.d.ts.map +1 -0
- package/bundles/types/shared/http/authorization-strategy.d.ts +41 -0
- package/bundles/types/shared/http/authorization-strategy.d.ts.map +1 -0
- package/bundles/types/shared/http/http-fetcher.d.ts +29 -0
- package/bundles/types/shared/http/http-fetcher.d.ts.map +1 -0
- package/bundles/types/shared/http/http-fetcher.factory.d.ts +17 -0
- package/bundles/types/shared/http/http-fetcher.factory.d.ts.map +1 -0
- package/bundles/types/shared/http/http-request.d.ts +14 -0
- package/bundles/types/shared/http/http-request.d.ts.map +1 -0
- package/bundles/types/shared/http/http-response.dto.d.ts +19 -0
- package/bundles/types/shared/http/http-response.dto.d.ts.map +1 -0
- package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts +12 -0
- package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts.map +1 -0
- package/bundles/types/shared/services/configuration-validation/types.d.ts +73 -0
- package/bundles/types/shared/services/configuration-validation/types.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts +15 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts +66 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts +14 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts +15 -0
- package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts +23 -0
- package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts +15 -0
- package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/repositories/index.d.ts +4 -0
- package/bundles/types/shared/services/instrumentation/repositories/index.d.ts.map +1 -0
- package/bundles/types/shared/shared.constants.d.ts +6 -0
- package/bundles/types/shared/shared.constants.d.ts.map +1 -0
- package/bundles/types/vault-display-widget/index.d.ts +14 -0
- package/bundles/types/vault-display-widget/index.d.ts.map +1 -0
- package/bundles/types/vault-display-widget/vault-display-widget.d.ts +69 -0
- package/bundles/types/vault-display-widget/vault-display-widget.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/enums.d.ts +12 -0
- package/bundles/types/wallet-buttons/enums.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/helpers/flypay-v2.helper.d.ts +6 -0
- package/bundles/types/wallet-buttons/helpers/flypay-v2.helper.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/index-cba.d.ts +2 -0
- package/bundles/types/wallet-buttons/index-cba.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/index.d.ts +138 -0
- package/bundles/types/wallet-buttons/index.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/interfaces.d.ts +128 -0
- package/bundles/types/wallet-buttons/interfaces.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +321 -0
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +330 -0
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts +24 -0
- package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts +49 -0
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts +28 -0
- package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts +26 -0
- package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts +35 -0
- package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/mastercard.wallet-service.d.ts +8 -0
- package/bundles/types/wallet-buttons/wallet-services/mastercard.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts +26 -0
- package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts +19 -0
- package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts +131 -0
- package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +252 -0
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts +12 -0
- package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/index.d.ts +245 -0
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts +5 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts +44 -0
- package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +9 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +11 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts +21 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts +9 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts +13 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-response.interface.d.ts +9 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-response.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts +22 -0
- package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts +58 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts +2 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-events.constant.d.ts +5 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-events.constant.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +22 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts +2 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts +2 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-contact-editing-mode.type.d.ts +5 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-contact-editing-mode.type.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts +21 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts +21 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts +4 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-sdk.interface.d.ts +164 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-sdk.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +32 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +53 -0
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts.map +1 -0
- package/bundles/types/widget/configuration.d.ts +165 -0
- package/bundles/types/widget/configuration.d.ts.map +1 -0
- package/bundles/types/widget/html-multi-widget.d.ts +337 -0
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -0
- package/bundles/types/widget/html-widget.d.ts +107 -0
- package/bundles/types/widget/html-widget.d.ts.map +1 -0
- package/bundles/types/widget/index.d.ts +132 -0
- package/bundles/types/widget/index.d.ts.map +1 -0
- package/bundles/types/widget/meta.d.ts +8 -0
- package/bundles/types/widget/meta.d.ts.map +1 -0
- package/bundles/types/widget/multi-widget.d.ts +241 -0
- package/bundles/types/widget/multi-widget.d.ts.map +1 -0
- package/bundles/types/widget/style.d.ts +177 -0
- package/bundles/types/widget/style.d.ts.map +1 -0
- package/bundles/widget.umd.js +38429 -767
- package/bundles/widget.umd.js.d.ts +4777 -0
- package/bundles/widget.umd.js.min.d.ts +4777 -0
- package/bundles/widget.umd.min.js +1 -0
- package/docs/api-canvas3ds.md +158 -0
- package/docs/api-checkout-button.md +912 -0
- package/docs/api-examples.md +65 -0
- package/docs/api-ps-widget.md +585 -0
- package/docs/api-vault-display.md +94 -0
- package/docs/api-widget.md +2542 -0
- package/docs/api-wrapper.md +45 -0
- package/docs/canvas3ds-examples.md +242 -0
- package/docs/cba-header.md +13 -0
- package/docs/cba-license.md +2 -0
- package/docs/checkout-examples.md +248 -0
- package/docs/click-to-pay-examples.md +231 -0
- package/docs/click-to-pay.md +337 -0
- package/docs/fraud-prevention-examples.md +154 -0
- package/docs/fraud-prevention.md +0 -0
- package/docs/header.md +15 -0
- package/docs/html/layout.html +79 -0
- package/docs/html/marked.js +23 -0
- package/docs/html/style.css +365 -0
- package/docs/install/npm.content.md +16 -0
- package/docs/install/npm.example.md +24 -0
- package/docs/install/umd.content.md +20 -0
- package/docs/install/umd.example.md +6 -0
- package/docs/install.md +43 -0
- package/docs/install.readme.t.md +17 -0
- package/docs/install.slate.t.md +17 -0
- package/docs/license.md +2 -0
- package/docs/partials/header.hbs +3 -0
- package/docs/paypal-data-collector-examples.md +59 -0
- package/docs/paypal-data-collector.md +149 -0
- package/docs/paypal-save-payment-source-examples.md +63 -0
- package/docs/paypal-save-payment-source.md +256 -0
- package/docs/ps-examples.md +129 -0
- package/docs/vault-display-example.md +132 -0
- package/docs/wallet-buttons-examples.md +638 -0
- package/docs/wallet-buttons-express-examples.md +201 -0
- package/docs/wallet-buttons-express.md +1076 -0
- package/docs/wallet-buttons.md +625 -0
- package/docs/wallet-cba-buttons-examples.md +388 -0
- package/docs/widget-examples.md +271 -0
- package/examples/html-widget/actions.html +47 -0
- package/examples/html-widget/events.html +2 -2
- package/examples/html-widget/form.html +2 -3
- package/examples/html-widget/html-styles.html +29 -0
- package/examples/html-widget/insert-input.html +2 -2
- package/examples/html-widget/optional-settings.html +30 -0
- package/examples/html-widget/simple.html +3 -3
- package/examples/html-widget/styles.html +3 -3
- package/examples/multi-html-widget/extend.html +7 -2
- package/examples/multi-html-widget/simple.html +6 -8
- package/package.json +225 -55
- package/slate.md +2218 -0
- package/.npmignore +0 -15
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -3
- package/lib/index.js.map +0 -1
- package/lib/widget/components/container.d.ts +0 -9
- package/lib/widget/components/container.js +0 -18
- package/lib/widget/components/container.js.map +0 -1
- package/lib/widget/components/env.d.ts +0 -19
- package/lib/widget/components/env.js +0 -33
- package/lib/widget/components/env.js.map +0 -1
- package/lib/widget/components/event.d.ts +0 -26
- package/lib/widget/components/event.js +0 -49
- package/lib/widget/components/event.js.map +0 -1
- package/lib/widget/components/form-Interceptor.js +0 -38
- package/lib/widget/components/form-Interceptor.js.map +0 -1
- package/lib/widget/components/iframe.d.ts +0 -11
- package/lib/widget/components/iframe.js +0 -31
- package/lib/widget/components/iframe.js.map +0 -1
- package/lib/widget/components/link.d.ts +0 -13
- package/lib/widget/components/link.js +0 -37
- package/lib/widget/components/link.js.map +0 -1
- package/lib/widget/components/param.d.ts +0 -39
- package/lib/widget/components/param.js +0 -21
- package/lib/widget/components/param.js.map +0 -1
- package/lib/widget/components/trigger.d.ts +0 -19
- package/lib/widget/components/trigger.js +0 -22
- package/lib/widget/components/trigger.js.map +0 -1
- package/lib/widget/configuration.d.ts +0 -59
- package/lib/widget/configuration.js +0 -134
- package/lib/widget/configuration.js.map +0 -1
- package/lib/widget/helper/event.d.ts +0 -8
- package/lib/widget/helper/event.js +0 -15
- package/lib/widget/helper/event.js.map +0 -1
- package/lib/widget/helper/object.js +0 -6
- package/lib/widget/helper/object.js.map +0 -1
- package/lib/widget/helper/url.d.ts +0 -3
- package/lib/widget/helper/url.js +0 -8
- package/lib/widget/helper/url.js.map +0 -1
- package/lib/widget/html-multi-widget.d.ts +0 -56
- package/lib/widget/html-multi-widget.js +0 -89
- package/lib/widget/html-multi-widget.js.map +0 -1
- package/lib/widget/html-widget.d.ts +0 -37
- package/lib/widget/html-widget.js +0 -50
- package/lib/widget/html-widget.js.map +0 -1
- package/lib/widget/index.d.ts +0 -5
- package/lib/widget/index.js +0 -6
- package/lib/widget/index.js.map +0 -1
- package/lib/widget/multi-widget.d.ts +0 -22
- package/lib/widget/multi-widget.js +0 -83
- package/lib/widget/multi-widget.js.map +0 -1
|
@@ -0,0 +1,4777 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { MicroAgent } from '@newrelic/browser-agent/loaders/micro-agent';
|
|
3
|
+
|
|
4
|
+
declare class ApiCharge {
|
|
5
|
+
protected api: Api;
|
|
6
|
+
constructor(api: Api);
|
|
7
|
+
/**
|
|
8
|
+
* Current method allows to work with charge related endpoints
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* api.charge().preAuth('payload', cb);
|
|
12
|
+
*
|
|
13
|
+
* @param {object} payload - Payload for pre authorization.
|
|
14
|
+
* @param {number} payload.amount - Charge amount.
|
|
15
|
+
* @param {string} payload.currency - Charge currency.
|
|
16
|
+
* @param {string} payload.token - Payment source token.
|
|
17
|
+
* @param {string} [payload._3ds.redirect_url] - Redirect url after 3d secure processing.
|
|
18
|
+
* @param {listener} [cb]
|
|
19
|
+
*/
|
|
20
|
+
preAuth(payload: PreAuthBody, cb?: (data: any) => void): void | Promise<PreAuthResponse>;
|
|
21
|
+
}
|
|
22
|
+
interface PreAuthResponse {
|
|
23
|
+
_3ds: {
|
|
24
|
+
token: string;
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
27
|
+
status: string;
|
|
28
|
+
}
|
|
29
|
+
interface PreAuthBody {
|
|
30
|
+
token: string;
|
|
31
|
+
amount: string | number;
|
|
32
|
+
currency: string;
|
|
33
|
+
_3ds?: {
|
|
34
|
+
redirect_url?: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type EnvironmentConfiguration = {
|
|
39
|
+
env: string;
|
|
40
|
+
url: string;
|
|
41
|
+
};
|
|
42
|
+
type EnvironmentConfigurations = EnvironmentConfiguration[];
|
|
43
|
+
interface IEnvironment {
|
|
44
|
+
getConf(): EnvironmentConfiguration;
|
|
45
|
+
getEnv(): string;
|
|
46
|
+
setEnv(environmentId: string, alias?: string): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare class Env implements IEnvironment {
|
|
50
|
+
private alias;
|
|
51
|
+
private environmentConfigurations;
|
|
52
|
+
private environmentId;
|
|
53
|
+
constructor(configs: EnvironmentConfigurations, defaultEnv?: string);
|
|
54
|
+
setEnv(environmentId: string, alias?: string): void;
|
|
55
|
+
getEnv(): string;
|
|
56
|
+
getConf(): EnvironmentConfiguration;
|
|
57
|
+
private validateAlias;
|
|
58
|
+
private validateEnvironmentId;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type HttpRequestMethod = 'GET' | 'POST';
|
|
62
|
+
type HttpRequestUrl = string | URL;
|
|
63
|
+
|
|
64
|
+
type AgentPrototype = Pick<(typeof MicroAgent)['prototype'], 'addPageAction' | 'noticeError'>;
|
|
65
|
+
type AgentMethodNames = keyof AgentPrototype;
|
|
66
|
+
type AgentMethodParameters<T extends AgentMethodNames> = Parameters<AgentPrototype[T]>;
|
|
67
|
+
declare class InstrumentationAgent extends MicroAgent {
|
|
68
|
+
private static agent;
|
|
69
|
+
private static available;
|
|
70
|
+
private static initialized;
|
|
71
|
+
private constructor();
|
|
72
|
+
static get instance(): InstrumentationAgent;
|
|
73
|
+
isAvailable(): boolean;
|
|
74
|
+
call: <T extends "addPageAction" | "noticeError">(method: T, ...args: AgentMethodParameters<T>) => void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface CustomEventDTO {
|
|
78
|
+
environment: string;
|
|
79
|
+
appId?: never;
|
|
80
|
+
timestamp?: never;
|
|
81
|
+
[x: string]: unknown;
|
|
82
|
+
}
|
|
83
|
+
interface ReportBaseContext {
|
|
84
|
+
sdkVersion: string | null;
|
|
85
|
+
description?: string;
|
|
86
|
+
environment?: string;
|
|
87
|
+
[x: string]: SerializableValue | undefined;
|
|
88
|
+
}
|
|
89
|
+
type SerializableValue = string | number | symbol | object | null;
|
|
90
|
+
|
|
91
|
+
type ReportErrorFn = (repository: ErrorRepository, error: string | Error, ctx: ReportBaseContext & ({
|
|
92
|
+
className: string;
|
|
93
|
+
classMethod: string;
|
|
94
|
+
functionName?: never;
|
|
95
|
+
} | {
|
|
96
|
+
className?: never;
|
|
97
|
+
classMethod?: never;
|
|
98
|
+
functionName: string;
|
|
99
|
+
})) => void;
|
|
100
|
+
declare class ErrorRepository {
|
|
101
|
+
private readonly agent;
|
|
102
|
+
constructor();
|
|
103
|
+
createError(...args: Parameters<InstrumentationAgent['noticeError']>): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
type ReportEventFn = (repository: EventRepository, actionName: string, ctx: ReportBaseContext & CustomEventDTO) => void;
|
|
107
|
+
declare class EventRepository {
|
|
108
|
+
private readonly agent;
|
|
109
|
+
constructor();
|
|
110
|
+
createEvent(...args: Parameters<InstrumentationAgent['addPageAction']>): Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare enum API_AUTH_TYPE {
|
|
114
|
+
PUBLIC_KEY = 0,
|
|
115
|
+
TOKEN = 1
|
|
116
|
+
}
|
|
117
|
+
declare class ApiBase {
|
|
118
|
+
protected env: Env;
|
|
119
|
+
auth: string;
|
|
120
|
+
authType: API_AUTH_TYPE;
|
|
121
|
+
constructor(auth: string, authType?: API_AUTH_TYPE);
|
|
122
|
+
/**
|
|
123
|
+
* Current method can change environment. By default environment = sandbox.
|
|
124
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* widget.setEnv('production');
|
|
128
|
+
* @param {string} env - sandbox, production
|
|
129
|
+
* @param {string} [alias] - Own domain alias
|
|
130
|
+
*/
|
|
131
|
+
setEnv(env: string, alias?: string): ApiBase;
|
|
132
|
+
requestObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req): Observable<Res>;
|
|
133
|
+
private makeRequest;
|
|
134
|
+
private onRequestLoad;
|
|
135
|
+
private onRequestError;
|
|
136
|
+
setAuthType(): API_AUTH_TYPE;
|
|
137
|
+
getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
138
|
+
config: XMLHttpRequest;
|
|
139
|
+
send: (body: any, cb?: (data) => void, errorCb?: (data: any) => any) => void;
|
|
140
|
+
};
|
|
141
|
+
getClientPromise<Req extends object, Res>(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
142
|
+
config: XMLHttpRequest;
|
|
143
|
+
send: (body: Req) => Promise<Res>;
|
|
144
|
+
};
|
|
145
|
+
parser({ text, status }: {
|
|
146
|
+
text: string;
|
|
147
|
+
status: number;
|
|
148
|
+
}, cb: any, errorCb: any): any;
|
|
149
|
+
parserPromise<Res>({ text, status, }: {
|
|
150
|
+
text: string;
|
|
151
|
+
status: number;
|
|
152
|
+
}): Promise<Res>;
|
|
153
|
+
reportEvent: ReportEventFn;
|
|
154
|
+
reportError: ReportErrorFn;
|
|
155
|
+
protected newApiRequest(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): XMLHttpRequest;
|
|
156
|
+
get ctx(): {
|
|
157
|
+
sdkVersion: string;
|
|
158
|
+
className: string;
|
|
159
|
+
environment: string;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Interface for browser details response.
|
|
165
|
+
* @interface BrowserDetails
|
|
166
|
+
*
|
|
167
|
+
* @param {string} [name]
|
|
168
|
+
* @param {string} [java_enabled]
|
|
169
|
+
* @param {string} [language]
|
|
170
|
+
* @param {string} [screen_height]
|
|
171
|
+
* @param {string} [screen_width]
|
|
172
|
+
* @param {string} [time_zone]
|
|
173
|
+
* @param {string} [color_depth]
|
|
174
|
+
* */
|
|
175
|
+
interface BrowserDetails {
|
|
176
|
+
name: string;
|
|
177
|
+
java_enabled: string;
|
|
178
|
+
language: string;
|
|
179
|
+
screen_height: string;
|
|
180
|
+
screen_width: string;
|
|
181
|
+
time_zone: string;
|
|
182
|
+
color_depth: string;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Class Api include method for working with paydock api
|
|
186
|
+
* @constructor
|
|
187
|
+
*
|
|
188
|
+
* @param {string} publicKey - PayDock users public key
|
|
189
|
+
* @example
|
|
190
|
+
* var api = new Api('publicKey');
|
|
191
|
+
*
|
|
192
|
+
*
|
|
193
|
+
**/
|
|
194
|
+
declare class Api extends ApiBase {
|
|
195
|
+
publicKey: String;
|
|
196
|
+
/** @constructs */ constructor(publicKey: string);
|
|
197
|
+
/**
|
|
198
|
+
* Method for getting browser details
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* api.getBrowserDetails();
|
|
202
|
+
*
|
|
203
|
+
* @return {BrowserDetails} Browser details object
|
|
204
|
+
*/
|
|
205
|
+
getBrowserDetails(): BrowserDetails;
|
|
206
|
+
/**
|
|
207
|
+
* Current method allows to work with charge related endpoints
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* api.charge();
|
|
211
|
+
*/
|
|
212
|
+
charge(): ApiCharge;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* List of available form field validators dedicated to cards and their definition
|
|
217
|
+
*
|
|
218
|
+
* @const CARD_VALIDATORS
|
|
219
|
+
*
|
|
220
|
+
* @type {Record<string, string>}
|
|
221
|
+
*
|
|
222
|
+
* @param {string} CVV=cardCvvValidation
|
|
223
|
+
* Asserts that CVV contains zero or more digits and is a number
|
|
224
|
+
* @param {string} EXPIRY_DATE=expireDateValidation
|
|
225
|
+
* Asserts value is a date in the future with format MM/YY
|
|
226
|
+
* @param {string} HOLDER_NAME=cardHoldernameValidation
|
|
227
|
+
* Asserts value is a name that respects the
|
|
228
|
+
ITU-T T.50 standard (@see https://www.itu.int/rec/T-REC-T.50/en)
|
|
229
|
+
* @param {string} NUMBER=cardNumberValidation
|
|
230
|
+
Asserts the value matches a known card scheme and as a the correct length.
|
|
231
|
+
E.g., matches a 13, 16 or 19 digit bank card, **or**, a 13 to 25 digit Vii Gift card
|
|
232
|
+
* @param {string} PIN=cardPinValidation
|
|
233
|
+
Asserts the value is a number with exactly 4 digits
|
|
234
|
+
*/
|
|
235
|
+
declare const CARD_VALIDATORS: {
|
|
236
|
+
readonly CVV: "cardCvvValidator";
|
|
237
|
+
readonly EXPIRY_DATE: "expireDateValidation";
|
|
238
|
+
readonly HOLDER_NAME: "cardHoldernameValidator";
|
|
239
|
+
readonly NUMBER: "cardNumberValidator";
|
|
240
|
+
readonly PIN: "cardPinValidator";
|
|
241
|
+
};
|
|
242
|
+
type CardValidatorValue = typeof CARD_VALIDATORS[keyof typeof CARD_VALIDATORS];
|
|
243
|
+
/**
|
|
244
|
+
* List of available generic form field validators and their definition
|
|
245
|
+
*
|
|
246
|
+
* @const GENERIC_VALIDATORS
|
|
247
|
+
*
|
|
248
|
+
* @type {Record<string, string>}
|
|
249
|
+
*
|
|
250
|
+
* @param {string} REQUIRED=required
|
|
251
|
+
* Asserts the input or form field has a value defined truthy value
|
|
252
|
+
*/
|
|
253
|
+
declare const GENERIC_VALIDATORS: {
|
|
254
|
+
readonly REQUIRED: "required";
|
|
255
|
+
};
|
|
256
|
+
type GenericValidatorValue = typeof GENERIC_VALIDATORS[keyof typeof GENERIC_VALIDATORS];
|
|
257
|
+
|
|
258
|
+
declare const FORM_FIELD: {
|
|
259
|
+
CARD_NAME: string;
|
|
260
|
+
CARD_NUMBER: string;
|
|
261
|
+
EXPIRE_MONTH: string;
|
|
262
|
+
EXPIRE_YEAR: string;
|
|
263
|
+
CARD_CCV: string;
|
|
264
|
+
CARD_PIN: string;
|
|
265
|
+
ACCOUNT_NAME: string;
|
|
266
|
+
ACCOUNT_BSB: string;
|
|
267
|
+
ACCOUNT_NUMBER: string;
|
|
268
|
+
ACCOUNT_ROUTING: string;
|
|
269
|
+
ACCOUNT_HOLDER_TYPE: string;
|
|
270
|
+
ACCOUNT_BANK_NAME: string;
|
|
271
|
+
ACCOUNT_TYPE: string;
|
|
272
|
+
FIRST_NAME: string;
|
|
273
|
+
LAST_NAME: string;
|
|
274
|
+
EMAIL: string;
|
|
275
|
+
PHONE: string;
|
|
276
|
+
PHONE2: string;
|
|
277
|
+
ADDRESS_LINE1: string;
|
|
278
|
+
ADDRESS_LINE2: string;
|
|
279
|
+
ADDRESS_STATE: string;
|
|
280
|
+
ADDRESS_COUNTRY: string;
|
|
281
|
+
ADDRESS_CITY: string;
|
|
282
|
+
ADDRESS_POSTCODE: string;
|
|
283
|
+
ADDRESS_COMPANY: string;
|
|
284
|
+
};
|
|
285
|
+
declare const STYLE: {
|
|
286
|
+
BACKGROUND_COLOR: string;
|
|
287
|
+
BACKGROUND_ACTIVE_COLOR: string;
|
|
288
|
+
TEXT_COLOR: string;
|
|
289
|
+
BORDER_COLOR: string;
|
|
290
|
+
ICON_SIZE: string;
|
|
291
|
+
BUTTON_COLOR: string;
|
|
292
|
+
ERROR_COLOR: string;
|
|
293
|
+
SUCCESS_COLOR: string;
|
|
294
|
+
FONT_SIZE: string;
|
|
295
|
+
FONT_FAMILY: string;
|
|
296
|
+
};
|
|
297
|
+
declare const VAULT_DISPLAY_STYLE: {
|
|
298
|
+
BACKGROUND_COLOR: string;
|
|
299
|
+
TEXT_COLOR: string;
|
|
300
|
+
BORDER_COLOR: string;
|
|
301
|
+
BUTTON_COLOR: string;
|
|
302
|
+
FONT_SIZE: string;
|
|
303
|
+
FONT_FAMILY: string;
|
|
304
|
+
};
|
|
305
|
+
declare const TEXT: {
|
|
306
|
+
TITLE: string;
|
|
307
|
+
TITLE_H1: string;
|
|
308
|
+
TITLE_H2: string;
|
|
309
|
+
TITLE_H3: string;
|
|
310
|
+
TITLE_H4: string;
|
|
311
|
+
TITLE_H5: string;
|
|
312
|
+
TITLE_H6: string;
|
|
313
|
+
FINISH: string;
|
|
314
|
+
TITLE_DESCRIPTION: string;
|
|
315
|
+
SUBMIT_BUTTON: string;
|
|
316
|
+
SUBMIT_BUTTON_PROCESSING: string;
|
|
317
|
+
};
|
|
318
|
+
declare const ELEMENT: {
|
|
319
|
+
SUBMIT_BUTTON: string;
|
|
320
|
+
TABS: string;
|
|
321
|
+
};
|
|
322
|
+
declare const SUPPORTED_CARD_TYPES: {
|
|
323
|
+
AMEX: string;
|
|
324
|
+
AUSBC: string;
|
|
325
|
+
DINERS: string;
|
|
326
|
+
DISCOVER: string;
|
|
327
|
+
JAPCB: string;
|
|
328
|
+
LASER: string;
|
|
329
|
+
MASTERCARD: string;
|
|
330
|
+
SOLO: string;
|
|
331
|
+
VISA: string;
|
|
332
|
+
VISA_WHITE: string;
|
|
333
|
+
EFTPOS: string;
|
|
334
|
+
EFTPOS_WHITE: string;
|
|
335
|
+
};
|
|
336
|
+
interface IIcons {
|
|
337
|
+
paypal_checkout_button?: string;
|
|
338
|
+
afterpay_checkout_button?: string;
|
|
339
|
+
zipmoney_checkout_button?: string;
|
|
340
|
+
}
|
|
341
|
+
interface IFormPropertyOption {
|
|
342
|
+
card_name?: string;
|
|
343
|
+
card_number?: string;
|
|
344
|
+
expire_month?: string;
|
|
345
|
+
expire_year?: string;
|
|
346
|
+
card_ccv?: string;
|
|
347
|
+
card_pin?: string;
|
|
348
|
+
account_name?: string;
|
|
349
|
+
account_bsb?: string;
|
|
350
|
+
account_number?: string;
|
|
351
|
+
account_routing?: string;
|
|
352
|
+
account_holder_type?: string;
|
|
353
|
+
account_bank_name?: string;
|
|
354
|
+
first_name?: string;
|
|
355
|
+
last_name?: string;
|
|
356
|
+
email?: string;
|
|
357
|
+
phone?: string;
|
|
358
|
+
phone2?: string;
|
|
359
|
+
address_line1?: string;
|
|
360
|
+
address_line2?: string;
|
|
361
|
+
address_state?: string;
|
|
362
|
+
address_country?: string;
|
|
363
|
+
address_city?: string;
|
|
364
|
+
address_postcode?: string;
|
|
365
|
+
address_company?: string;
|
|
366
|
+
}
|
|
367
|
+
interface IFormValues extends IFormPropertyOption {
|
|
368
|
+
}
|
|
369
|
+
interface IFormLabels extends IFormPropertyOption {
|
|
370
|
+
}
|
|
371
|
+
interface IFormPlaceholders extends IFormPropertyOption {
|
|
372
|
+
}
|
|
373
|
+
interface IFormElement {
|
|
374
|
+
field: string;
|
|
375
|
+
label?: string;
|
|
376
|
+
placeholder?: string;
|
|
377
|
+
value?: string;
|
|
378
|
+
}
|
|
379
|
+
type ValidatorFieldsMapKey = CardValidatorValue | GenericValidatorValue;
|
|
380
|
+
type ValidatorFieldsMap = Partial<Record<ValidatorFieldsMapKey, string[]>>;
|
|
381
|
+
interface IFormValidation {
|
|
382
|
+
form_valid?: boolean;
|
|
383
|
+
invalid_fields?: string[];
|
|
384
|
+
invalid_showed_fields?: string[];
|
|
385
|
+
validators?: ValidatorFieldsMap;
|
|
386
|
+
}
|
|
387
|
+
interface IStyles$1 {
|
|
388
|
+
background_color?: string;
|
|
389
|
+
background_active_color?: string;
|
|
390
|
+
text_color?: string;
|
|
391
|
+
border_color?: string;
|
|
392
|
+
button_color?: string;
|
|
393
|
+
icon_size?: string;
|
|
394
|
+
error_color?: string;
|
|
395
|
+
success_color?: string;
|
|
396
|
+
font_size?: string;
|
|
397
|
+
font_family?: string;
|
|
398
|
+
}
|
|
399
|
+
interface ITexts {
|
|
400
|
+
title?: string;
|
|
401
|
+
title_h1?: string;
|
|
402
|
+
title_h2?: string;
|
|
403
|
+
title_h3?: string;
|
|
404
|
+
title_h4?: string;
|
|
405
|
+
title_h5?: string;
|
|
406
|
+
title_h6?: string;
|
|
407
|
+
finish_text?: string;
|
|
408
|
+
title_description?: string;
|
|
409
|
+
submit_button?: string;
|
|
410
|
+
submit_button_processing?: string;
|
|
411
|
+
}
|
|
412
|
+
interface ICommonParams {
|
|
413
|
+
sdk_version?: string;
|
|
414
|
+
sdk_type?: string;
|
|
415
|
+
}
|
|
416
|
+
interface ISRCParams extends ICommonParams {
|
|
417
|
+
public_key?: string;
|
|
418
|
+
service_id?: string;
|
|
419
|
+
meta?: string;
|
|
420
|
+
}
|
|
421
|
+
interface IWalletParams extends IStyles$1, ITexts, ICommonParams {
|
|
422
|
+
token: string;
|
|
423
|
+
credentials: string;
|
|
424
|
+
currency: string;
|
|
425
|
+
amount: number;
|
|
426
|
+
gateway_mode: string;
|
|
427
|
+
}
|
|
428
|
+
interface IParams extends IStyles$1, ITexts, ICommonParams {
|
|
429
|
+
access_token?: string;
|
|
430
|
+
public_key?: string;
|
|
431
|
+
token?: string;
|
|
432
|
+
configuration_token?: string;
|
|
433
|
+
configuration_tokens?: string;
|
|
434
|
+
ref_id?: string;
|
|
435
|
+
supported_card_types?: string;
|
|
436
|
+
validate_card_types?: boolean;
|
|
437
|
+
fields_validation?: boolean;
|
|
438
|
+
hidden_elements?: string;
|
|
439
|
+
icons?: string;
|
|
440
|
+
form_values?: string;
|
|
441
|
+
form_labels?: string;
|
|
442
|
+
form_placeholders?: string;
|
|
443
|
+
query_token?: string;
|
|
444
|
+
limit?: number;
|
|
445
|
+
widget_id?: string;
|
|
446
|
+
gateway_id?: string;
|
|
447
|
+
gateway_ids?: string;
|
|
448
|
+
payment_source_types?: string;
|
|
449
|
+
element_styles?: string;
|
|
450
|
+
use_country_phone_mask?: boolean;
|
|
451
|
+
phone_mask_preferred_countries?: string;
|
|
452
|
+
phone_mask_default_country?: string;
|
|
453
|
+
phone_mask_only_countries?: string;
|
|
454
|
+
language?: string;
|
|
455
|
+
vault_display_token?: string;
|
|
456
|
+
sdk_origin?: boolean;
|
|
457
|
+
hide_ui_errors?: boolean;
|
|
458
|
+
}
|
|
459
|
+
interface ICountryPhoneMask {
|
|
460
|
+
preferred_countries?: string[];
|
|
461
|
+
default_country?: string;
|
|
462
|
+
only_countries?: string[];
|
|
463
|
+
}
|
|
464
|
+
interface IPayPalMeta {
|
|
465
|
+
brand_name?: string;
|
|
466
|
+
cart_border_color?: string;
|
|
467
|
+
reference?: string;
|
|
468
|
+
email?: string;
|
|
469
|
+
hdr_img?: string;
|
|
470
|
+
logo_img?: string;
|
|
471
|
+
pay_flow_color?: string;
|
|
472
|
+
first_name?: string;
|
|
473
|
+
last_name?: string;
|
|
474
|
+
address_line?: string;
|
|
475
|
+
address_line2?: string;
|
|
476
|
+
address_city?: string;
|
|
477
|
+
address_state?: string;
|
|
478
|
+
address_postcode?: string;
|
|
479
|
+
address_country?: string;
|
|
480
|
+
phone?: string;
|
|
481
|
+
hide_shipping_address?: boolean;
|
|
482
|
+
}
|
|
483
|
+
interface IBamboraMeta {
|
|
484
|
+
customer_storage_number?: string;
|
|
485
|
+
tokenise_algorithm?: number;
|
|
486
|
+
}
|
|
487
|
+
interface IZipmoneyMeta {
|
|
488
|
+
first_name: string;
|
|
489
|
+
last_name: string;
|
|
490
|
+
phone?: string;
|
|
491
|
+
tokenize?: boolean;
|
|
492
|
+
email: string;
|
|
493
|
+
gender?: string;
|
|
494
|
+
date_of_birth?: string;
|
|
495
|
+
charge: {
|
|
496
|
+
amount: number;
|
|
497
|
+
currency?: string;
|
|
498
|
+
reference?: string;
|
|
499
|
+
shipping_type?: string;
|
|
500
|
+
items: Array<{
|
|
501
|
+
name: string;
|
|
502
|
+
amount: number;
|
|
503
|
+
quantity: number;
|
|
504
|
+
type?: string;
|
|
505
|
+
reference?: string;
|
|
506
|
+
item_uri?: string;
|
|
507
|
+
image_url?: string;
|
|
508
|
+
}>;
|
|
509
|
+
shipping_address?: {
|
|
510
|
+
first_name?: string;
|
|
511
|
+
last_name?: string;
|
|
512
|
+
line1: string;
|
|
513
|
+
line2?: string;
|
|
514
|
+
country: string;
|
|
515
|
+
postcode: string;
|
|
516
|
+
city: string;
|
|
517
|
+
state: string;
|
|
518
|
+
};
|
|
519
|
+
billing_address: {
|
|
520
|
+
first_name?: string;
|
|
521
|
+
last_name?: string;
|
|
522
|
+
line1: string;
|
|
523
|
+
line2?: string;
|
|
524
|
+
country: string;
|
|
525
|
+
postcode: string;
|
|
526
|
+
city: string;
|
|
527
|
+
state: string;
|
|
528
|
+
};
|
|
529
|
+
};
|
|
530
|
+
statistics: {
|
|
531
|
+
account_created?: string;
|
|
532
|
+
sales_total_number?: number;
|
|
533
|
+
sales_total_amount?: number;
|
|
534
|
+
sales_avg_value?: number;
|
|
535
|
+
sales_max_value?: number;
|
|
536
|
+
refunds_total_amount?: number;
|
|
537
|
+
previous_chargeback?: boolean;
|
|
538
|
+
currency?: string;
|
|
539
|
+
last_login?: string;
|
|
540
|
+
};
|
|
541
|
+
hide_shipping_address?: boolean;
|
|
542
|
+
}
|
|
543
|
+
interface IAfterpayMeta {
|
|
544
|
+
amount: number;
|
|
545
|
+
currency: string;
|
|
546
|
+
email: string;
|
|
547
|
+
first_name: string;
|
|
548
|
+
last_name: string;
|
|
549
|
+
address_line: string;
|
|
550
|
+
address_line2: string;
|
|
551
|
+
address_city: string;
|
|
552
|
+
address_state: string;
|
|
553
|
+
address_postcode: string;
|
|
554
|
+
address_country: string;
|
|
555
|
+
phone: string;
|
|
556
|
+
}
|
|
557
|
+
interface VaultDisplayStyle {
|
|
558
|
+
background_color?: string;
|
|
559
|
+
text_color?: string;
|
|
560
|
+
border_color?: string;
|
|
561
|
+
button_color?: string;
|
|
562
|
+
font_size?: string;
|
|
563
|
+
font_family?: string;
|
|
564
|
+
}
|
|
565
|
+
interface IApplePayShippingOption {
|
|
566
|
+
id: string;
|
|
567
|
+
label: string;
|
|
568
|
+
detail: string;
|
|
569
|
+
amount: string;
|
|
570
|
+
type?: 'ELECTRONIC' | 'GROUND' | 'NOT_SHIPPED' | 'OVERNIGHT' | 'PICKUP' | 'PRIORITY' | 'SAME_DAY';
|
|
571
|
+
}
|
|
572
|
+
interface IGooglePayShippingOption {
|
|
573
|
+
id: string;
|
|
574
|
+
label: string;
|
|
575
|
+
detail?: string;
|
|
576
|
+
type?: 'ELECTRONIC' | 'GROUND' | 'NOT_SHIPPED' | 'OVERNIGHT' | 'PICKUP' | 'PRIORITY' | 'SAME_DAY';
|
|
577
|
+
}
|
|
578
|
+
interface IPayPalShippingOption {
|
|
579
|
+
id: string;
|
|
580
|
+
label: string;
|
|
581
|
+
amount: string;
|
|
582
|
+
currency: string;
|
|
583
|
+
type: 'SHIPPING' | 'PICKUP';
|
|
584
|
+
}
|
|
585
|
+
type IShippingOption = IApplePayShippingOption | IGooglePayShippingOption | IPayPalShippingOption;
|
|
586
|
+
declare enum WALLET_TYPE {
|
|
587
|
+
GOOGLE = "google",
|
|
588
|
+
APPLE = "apple",
|
|
589
|
+
FLYPAY = "flypay",
|
|
590
|
+
FLYPAY_V2 = "flypayV2",
|
|
591
|
+
PAYPAL = "paypal",
|
|
592
|
+
AFTERPAY = "afterpay"
|
|
593
|
+
}
|
|
594
|
+
interface ApplePayStyles {
|
|
595
|
+
button_type?: 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'plain' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
|
|
596
|
+
button_style?: 'black' | 'white' | 'white-outline';
|
|
597
|
+
}
|
|
598
|
+
interface GooglePayStyles {
|
|
599
|
+
button_type?: 'book' | 'buy' | 'checkout' | 'donate' | 'order' | 'pay' | 'plain' | 'subscribe';
|
|
600
|
+
button_size_mode?: 'static' | 'fill';
|
|
601
|
+
button_color?: 'default' | 'black' | 'white';
|
|
602
|
+
}
|
|
603
|
+
interface AfterpayStyles {
|
|
604
|
+
button_type?: 'black' | 'mint' | 'white';
|
|
605
|
+
height?: string;
|
|
606
|
+
}
|
|
607
|
+
type WalletStyles = {
|
|
608
|
+
apple?: ApplePayStyles;
|
|
609
|
+
google?: GooglePayStyles;
|
|
610
|
+
afterpay?: AfterpayStyles;
|
|
611
|
+
} | object;
|
|
612
|
+
type WalletRawDataInitialization = {
|
|
613
|
+
apple?: ApplePayRawDataInitialization;
|
|
614
|
+
google?: GooglePayRawDataInitialization;
|
|
615
|
+
} | object;
|
|
616
|
+
type ApplePayRawDataInitialization = ApplePayJS.ApplePayPaymentRequest;
|
|
617
|
+
type GooglePayRawDataInitialization = google.payments.api.IsReadyToPayPaymentMethodSpecification | google.payments.api.PaymentMethodSpecification;
|
|
618
|
+
interface IWalletMeta {
|
|
619
|
+
amount_label?: string;
|
|
620
|
+
country?: string;
|
|
621
|
+
pay_later?: boolean;
|
|
622
|
+
hide_message?: boolean;
|
|
623
|
+
standalone?: boolean;
|
|
624
|
+
show_billing_address?: boolean;
|
|
625
|
+
request_payer_name?: boolean;
|
|
626
|
+
request_payer_email?: boolean;
|
|
627
|
+
request_payer_phone?: boolean;
|
|
628
|
+
request_shipping?: boolean;
|
|
629
|
+
shipping_options?: IShippingOption[];
|
|
630
|
+
merchant_name?: string;
|
|
631
|
+
raw_data_initialization?: WalletRawDataInitialization;
|
|
632
|
+
access_token?: string;
|
|
633
|
+
refresh_token?: string;
|
|
634
|
+
style?: WalletStyles;
|
|
635
|
+
wallets?: WALLET_TYPE[];
|
|
636
|
+
client_id?: string;
|
|
637
|
+
apple_pay_capabilities?: Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
declare class Link {
|
|
641
|
+
protected env: Env;
|
|
642
|
+
protected linkResource: string;
|
|
643
|
+
protected params: IParams;
|
|
644
|
+
protected widgetId: string;
|
|
645
|
+
constructor(linkResource: string);
|
|
646
|
+
getNetUrl(): string;
|
|
647
|
+
getUrl(): string;
|
|
648
|
+
setParams(params: IParams | IWalletParams | ISRCParams): void;
|
|
649
|
+
concatParams(params: IParams): void;
|
|
650
|
+
getParams(): IParams;
|
|
651
|
+
setEnv(env: string, alias?: string): void;
|
|
652
|
+
getEnv(): string;
|
|
653
|
+
getBaseUrl(): string;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
declare class Container {
|
|
657
|
+
protected selector: string;
|
|
658
|
+
constructor(selector: string);
|
|
659
|
+
isExist(): boolean;
|
|
660
|
+
getStyles<T>(allowValue: string[]): T | {};
|
|
661
|
+
on(name: any, cb: (event: MouseEvent) => void): void;
|
|
662
|
+
getAttr<T>(allowValue: string[]): T | {};
|
|
663
|
+
getElement(): Element;
|
|
664
|
+
getSelector(): string;
|
|
665
|
+
private convertConfigs;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
declare class IFrame {
|
|
669
|
+
protected container: Container;
|
|
670
|
+
constructor(container: Container);
|
|
671
|
+
load(link: string, options?: {
|
|
672
|
+
title?: string;
|
|
673
|
+
}, iframeClass?: string): void;
|
|
674
|
+
loadFromHtml(content: string, options?: {
|
|
675
|
+
title?: string;
|
|
676
|
+
}, iframeClass?: string): void;
|
|
677
|
+
remove(): void;
|
|
678
|
+
show(): void;
|
|
679
|
+
hide(saveSize?: boolean): void;
|
|
680
|
+
isExist(): boolean;
|
|
681
|
+
getElement(): HTMLIFrameElement;
|
|
682
|
+
setStyle(property: string, value: string): void;
|
|
683
|
+
setIframeHeight(iframeElement: HTMLIFrameElement, iFrameDocument: Document, selector: string): void;
|
|
684
|
+
private setStyles;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* List of available payment source types
|
|
689
|
+
*
|
|
690
|
+
* @type {object}
|
|
691
|
+
* @param {string} CARD=card
|
|
692
|
+
* @param {string} BANK_ACCOUNT=bank_account
|
|
693
|
+
* @param {string} CHECKOUT=checkout
|
|
694
|
+
*/
|
|
695
|
+
declare const PAYMENT_TYPE: {
|
|
696
|
+
CARD: string;
|
|
697
|
+
GIFT_CARD: string;
|
|
698
|
+
BANK_ACCOUNT: string;
|
|
699
|
+
CHECKOUT: string;
|
|
700
|
+
BSB: string;
|
|
701
|
+
};
|
|
702
|
+
/**
|
|
703
|
+
* Purposes
|
|
704
|
+
* @type {object}
|
|
705
|
+
* @param {string} PAYMENT_SOURCE=payment_source
|
|
706
|
+
* @param {string} CARD_PAYMENT_SOURCE_WITH_CVV=card_payment_source_with_cvv
|
|
707
|
+
* @param {string} CARD_PAYMENT_SOURCE_WITHOUT_CVV=card_payment_source_without_cvv
|
|
708
|
+
* */
|
|
709
|
+
declare enum PURPOSE {
|
|
710
|
+
PAYMENT_SOURCE = "payment_source",
|
|
711
|
+
CARD_PAYMENT_SOURCE_WITH_CVV = "card_payment_source_with_cvv",
|
|
712
|
+
CARD_PAYMENT_SOURCE_WITHOUT_CVV = "card_payment_source_without_cvv"
|
|
713
|
+
}
|
|
714
|
+
interface IGeneral {
|
|
715
|
+
purpose: PURPOSE;
|
|
716
|
+
predefined_fields: IPredefinedFields;
|
|
717
|
+
defined_form_fields?: string[];
|
|
718
|
+
webhook_destination?: string;
|
|
719
|
+
success_redirect_url?: string;
|
|
720
|
+
error_redirect_url?: string;
|
|
721
|
+
meta?: IPayPalMeta;
|
|
722
|
+
label?: string;
|
|
723
|
+
dynamic_fields_position?: boolean;
|
|
724
|
+
}
|
|
725
|
+
interface IPredefinedFields {
|
|
726
|
+
gateway_id: string;
|
|
727
|
+
type?: string;
|
|
728
|
+
card_scheme?: string;
|
|
729
|
+
card_processing_network?: string;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Class Configuration include methods for creating configuration token
|
|
733
|
+
* @constructor
|
|
734
|
+
*
|
|
735
|
+
* @example
|
|
736
|
+
* var config = new Configuration('gatewayId'); // short
|
|
737
|
+
*
|
|
738
|
+
* var config = new Configuration('gatewayId', 'bank_account', 'paymentSource'); // extend
|
|
739
|
+
*
|
|
740
|
+
* var config = new Configuration('not_configured'); // without gateway
|
|
741
|
+
*
|
|
742
|
+
* @param {string} [gatewayID=default] - gateway ID. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token.
|
|
743
|
+
* @param {string} paymentType - Type of payment source which shows in widget form. Available parameters [PAYMENT_TYPE]{@link PAYMENT_TYPE}
|
|
744
|
+
* @param {string} purpose - Param which describes payment purpose. By default uses Available parameters [PURPOSE]{@link PURPOSE}
|
|
745
|
+
*/
|
|
746
|
+
declare class Configuration {
|
|
747
|
+
private configs;
|
|
748
|
+
private env;
|
|
749
|
+
static createEachToken(accessToken: string, configs: Configuration[]): Promise<string[]>;
|
|
750
|
+
private static addTokenInBase64;
|
|
751
|
+
/** @constructs */ constructor(gatewayID?: string, paymentType?: string, purpose?: PURPOSE);
|
|
752
|
+
/**
|
|
753
|
+
* Destination, where customer will receive all successful responses.
|
|
754
|
+
* Response will contain “data” object with “payment_source” or other parameters, in depending on 'purpose'
|
|
755
|
+
*
|
|
756
|
+
* @example
|
|
757
|
+
* config.setWebHookDestination('http://google.com');
|
|
758
|
+
*
|
|
759
|
+
* @param {string} url - Your endpoint for post request.
|
|
760
|
+
*/
|
|
761
|
+
setWebHookDestination(url: string): void;
|
|
762
|
+
/**
|
|
763
|
+
* URL to which the Customer will be redirected to after the success finish
|
|
764
|
+
*
|
|
765
|
+
* @example
|
|
766
|
+
* config.setSuccessRedirectUrl('google.com/search?q=success');
|
|
767
|
+
*
|
|
768
|
+
* @param {string} url
|
|
769
|
+
*/
|
|
770
|
+
setSuccessRedirectUrl(url: string): void;
|
|
771
|
+
/**
|
|
772
|
+
* URL to which the Customer will be redirected to if an error is triggered in the process of operation
|
|
773
|
+
*
|
|
774
|
+
* @example
|
|
775
|
+
* config.setErrorRedirectUrl('google.com/search?q=error');
|
|
776
|
+
*
|
|
777
|
+
* @param {string} url
|
|
778
|
+
*/
|
|
779
|
+
setErrorRedirectUrl(url: string): void;
|
|
780
|
+
/**
|
|
781
|
+
* Set list with widget form field, which will be shown in form. Also you can set the required validation for these fields
|
|
782
|
+
*
|
|
783
|
+
* @example
|
|
784
|
+
* config.setFormFields(['phone', 'email', 'first_name*']);
|
|
785
|
+
*
|
|
786
|
+
* @param {string[]} fields - name of fields which can be shown in a widget.
|
|
787
|
+
* If after a name of a field, you put “*”, this field will be required on client-side.
|
|
788
|
+
* (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) [FORM_FIELD]{@link FORM_FIELD}
|
|
789
|
+
*/
|
|
790
|
+
setFormFields(fields: string[]): void;
|
|
791
|
+
/**
|
|
792
|
+
* Method for setting meta information for checkout page
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* config.setMeta({
|
|
796
|
+
brand_name: 'paydock',
|
|
797
|
+
reference: '15',
|
|
798
|
+
email: 'wault@paydock.com'
|
|
799
|
+
});
|
|
800
|
+
*
|
|
801
|
+
* @param {IPayPalMeta | IZipmoneyMeta | IAfterpayMeta | IBamboraMeta} object -
|
|
802
|
+
* data which can be shown on checkout page [IPayPalMeta]{@link IPayPalMeta} [IZipmoneyMeta]{@link IZipmoneyMeta} [IAfterpayMeta]{@link IAfterpayMeta} [IBamboraMeta]{@link IBamboraMeta}
|
|
803
|
+
*/
|
|
804
|
+
setMeta(meta: IPayPalMeta | IZipmoneyMeta | IAfterpayMeta | IBamboraMeta): void;
|
|
805
|
+
/**
|
|
806
|
+
* Current method can change environment. By default environment = sandbox.
|
|
807
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
808
|
+
*
|
|
809
|
+
* @example
|
|
810
|
+
* config.setEnv('production');
|
|
811
|
+
* @param {string} env - sandbox, production
|
|
812
|
+
* @param {string} [alias] - Own domain alias
|
|
813
|
+
*/
|
|
814
|
+
setEnv(env: string, alias?: string): void;
|
|
815
|
+
/**
|
|
816
|
+
* Title for tab which can be set instead of default
|
|
817
|
+
*
|
|
818
|
+
* @example
|
|
819
|
+
* config.setLabel('custom label');
|
|
820
|
+
*
|
|
821
|
+
* @param {string} label - Text label for tab
|
|
822
|
+
*/
|
|
823
|
+
setLabel(label: string): void;
|
|
824
|
+
getEnv(): string;
|
|
825
|
+
/**
|
|
826
|
+
* createToken - method which exactly create payment one time token
|
|
827
|
+
*
|
|
828
|
+
* @example
|
|
829
|
+
* config.createToken('582035346f65cdd57ee81192d6e5w65w4e5',
|
|
830
|
+
* function (data) {
|
|
831
|
+
* console.log(data);
|
|
832
|
+
* }, function (error) {
|
|
833
|
+
* console.log(error);
|
|
834
|
+
* });
|
|
835
|
+
*
|
|
836
|
+
* @param {string} accessToken - Customer access token or public key which provided for each client
|
|
837
|
+
* @param {createToken~requestCallback} cb - The callback that handles the success response.
|
|
838
|
+
* @param {createToken~requestCallback} errorCb - The callback that handles the failed response.
|
|
839
|
+
*/
|
|
840
|
+
createToken(accessToken: string, cb: (token: string) => void, errorCb?: (error: any) => void): void;
|
|
841
|
+
getDefaultGateway<T>(accessToken: string, method: HttpRequestMethod, url: HttpRequestUrl): Promise<T>;
|
|
842
|
+
private send;
|
|
843
|
+
getConfigs(): IGeneral;
|
|
844
|
+
private getUrl;
|
|
845
|
+
private getDefaultGatewayUrl;
|
|
846
|
+
setGiftCardSchemeData(giftCardScheme: any, processingNetwork: any): void;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Current constant include available type of element for styling
|
|
851
|
+
* @const STYLABLE_ELEMENT
|
|
852
|
+
* @type {object}
|
|
853
|
+
* @param {string} INPUT=input.
|
|
854
|
+
* These states are available: [STYLABLE_ELEMENT_STATE.ERROR]{@link STYLABLE_ELEMENT_STATE}, [STYLABLE_ELEMENT_STATE.FOCUS]{@link STYLABLE_ELEMENT_STATE}.
|
|
855
|
+
* These styles are available [IElementStyleInput]{@link IElementStyleInput}
|
|
856
|
+
* @param {string} SUBMIT_BUTTON=submit_button
|
|
857
|
+
* These states are available: [STYLABLE_ELEMENT_STATE.HOVER]{@link STYLABLE_ELEMENT_STATE}.
|
|
858
|
+
* These styles are available [IElementStyleSubmitButton]{@link IElementStyleSubmitButton}
|
|
859
|
+
* @param {string} LABEL=label.
|
|
860
|
+
* These styles are available [IElementStyleLabel]{@link IElementStyleLabel}
|
|
861
|
+
* @param {string} TITLE=title.
|
|
862
|
+
* These styles are available [IElementStyleTitle]{@link IElementStyleTitle}
|
|
863
|
+
* @param {string} TITLE_DESCRIPTION=title_description.
|
|
864
|
+
* These styles are available [IElementStyleTitleDescription]{@link IElementStyleTitleDescription}
|
|
865
|
+
* */
|
|
866
|
+
declare const STYLABLE_ELEMENT: {
|
|
867
|
+
INPUT: string;
|
|
868
|
+
SUBMIT_BUTTON: string;
|
|
869
|
+
LABEL: string;
|
|
870
|
+
TITLE: string;
|
|
871
|
+
TITLE_DESCRIPTION: string;
|
|
872
|
+
};
|
|
873
|
+
/**
|
|
874
|
+
* Current constant include available states of element for styling
|
|
875
|
+
* @const STYLABLE_ELEMENT_STATE
|
|
876
|
+
* @type {object}
|
|
877
|
+
* @param {string} ERROR=error client|server validation. This state applies to: input
|
|
878
|
+
* @param {string} FOCUS=focus focus. This state applies to: input
|
|
879
|
+
* @param {string} HOVER=hover focus. This state applies to: submit_button
|
|
880
|
+
* */
|
|
881
|
+
declare const STYLABLE_ELEMENT_STATE: {
|
|
882
|
+
ERROR: string;
|
|
883
|
+
FOCUS: string;
|
|
884
|
+
HOVER: string;
|
|
885
|
+
};
|
|
886
|
+
interface IElementStyleInput {
|
|
887
|
+
color?: string;
|
|
888
|
+
border?: string;
|
|
889
|
+
border_radius?: string;
|
|
890
|
+
background_color?: string;
|
|
891
|
+
height?: string;
|
|
892
|
+
text_decoration?: string;
|
|
893
|
+
font_size?: string;
|
|
894
|
+
font_family?: string;
|
|
895
|
+
padding?: string;
|
|
896
|
+
margin?: string;
|
|
897
|
+
transition?: string;
|
|
898
|
+
line_height?: string;
|
|
899
|
+
font_weight?: string;
|
|
900
|
+
}
|
|
901
|
+
interface IElementStyleSubmitButton {
|
|
902
|
+
color?: string;
|
|
903
|
+
border?: string;
|
|
904
|
+
border_radius?: string;
|
|
905
|
+
background_color?: string;
|
|
906
|
+
text_decoration?: string;
|
|
907
|
+
font_size?: string;
|
|
908
|
+
font_family?: string;
|
|
909
|
+
padding?: string;
|
|
910
|
+
margin?: string;
|
|
911
|
+
transition?: string;
|
|
912
|
+
line_height?: string;
|
|
913
|
+
font_weight?: string;
|
|
914
|
+
opacity?: string;
|
|
915
|
+
}
|
|
916
|
+
interface IElementStyleLabel {
|
|
917
|
+
color?: string;
|
|
918
|
+
text_decoration?: string;
|
|
919
|
+
font_size?: string;
|
|
920
|
+
font_family?: string;
|
|
921
|
+
line_height?: string;
|
|
922
|
+
font_weight?: string;
|
|
923
|
+
padding?: string;
|
|
924
|
+
margin?: string;
|
|
925
|
+
}
|
|
926
|
+
interface IElementStyleTitle {
|
|
927
|
+
color?: string;
|
|
928
|
+
text_decoration?: string;
|
|
929
|
+
font_size?: string;
|
|
930
|
+
font_family?: string;
|
|
931
|
+
line_height?: string;
|
|
932
|
+
font_weight?: string;
|
|
933
|
+
padding?: string;
|
|
934
|
+
margin?: string;
|
|
935
|
+
}
|
|
936
|
+
interface IElementStyleTitleDescription {
|
|
937
|
+
color?: string;
|
|
938
|
+
text_decoration?: string;
|
|
939
|
+
font_size?: string;
|
|
940
|
+
font_family?: string;
|
|
941
|
+
line_height?: string;
|
|
942
|
+
font_weight?: string;
|
|
943
|
+
padding?: string;
|
|
944
|
+
margin?: string;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
declare const ERROR_CATEGORY: {
|
|
948
|
+
readonly CONFIGURATION: "configuration";
|
|
949
|
+
readonly IDENTITY: "identity_access_management";
|
|
950
|
+
readonly INTERNAL: "internal";
|
|
951
|
+
readonly PROCESS: "process";
|
|
952
|
+
readonly RESOURCE: "resource";
|
|
953
|
+
readonly VALIDATION: "validation";
|
|
954
|
+
};
|
|
955
|
+
type ErrorCategory = (typeof ERROR_CATEGORY)[keyof typeof ERROR_CATEGORY];
|
|
956
|
+
declare const ERROR_CAUSE: {
|
|
957
|
+
readonly ABORTED: "aborted";
|
|
958
|
+
readonly ACCESS_FORBIDDEN: "access_forbidden";
|
|
959
|
+
readonly ALREADY_EXISTS: "already_exists";
|
|
960
|
+
readonly CANCELED: "canceled";
|
|
961
|
+
readonly INVALID_CONFIGURATION: "invalid_configuration";
|
|
962
|
+
readonly INVALID_INPUT: "invalid_input";
|
|
963
|
+
readonly NOT_FOUND: "not_found";
|
|
964
|
+
readonly NOT_IMPLEMENTED: "not_implemented";
|
|
965
|
+
readonly RATE_LIMITED: "rate_limited";
|
|
966
|
+
readonly SERVER_BUSY: "server_busy";
|
|
967
|
+
readonly SERVICE_UNREACHABLE: "service_unreachable";
|
|
968
|
+
readonly UNAUTHORIZED: "unauthorized";
|
|
969
|
+
readonly UNKNOWN: "unknown_error";
|
|
970
|
+
readonly UNPROCESSABLE_ENTITY: "unprocessable_entity";
|
|
971
|
+
};
|
|
972
|
+
type ErrorCause = (typeof ERROR_CAUSE)[keyof typeof ERROR_CAUSE];
|
|
973
|
+
interface ErrorDetails {
|
|
974
|
+
cause: ErrorCause;
|
|
975
|
+
contextId: string;
|
|
976
|
+
message: string;
|
|
977
|
+
timestamp: string;
|
|
978
|
+
}
|
|
979
|
+
interface IEventError {
|
|
980
|
+
cause: ErrorCause;
|
|
981
|
+
category: ErrorCategory;
|
|
982
|
+
retryable: boolean;
|
|
983
|
+
details: ErrorDetails;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
*
|
|
988
|
+
* Class MultiWidget include method for for creating iframe url
|
|
989
|
+
* @constructor
|
|
990
|
+
*
|
|
991
|
+
* @param {string} accessToken - PayDock users access token or public key
|
|
992
|
+
* @param {(Configuration | string | Configuration[] | string[])} conf - exemplar[s] Configuration class OR configuration token
|
|
993
|
+
*
|
|
994
|
+
* @example
|
|
995
|
+
* var widget = new MultiWidget('accessToken','configurationToken'); // With a pre-created configuration token
|
|
996
|
+
*
|
|
997
|
+
* var widget = new MultiWidget('accessToken',['configurationToken', 'configurationToken2']); // With pre-created configuration tokens
|
|
998
|
+
*
|
|
999
|
+
* var widget = new MultiWidget('accessToken', new Configuration('gatewayId')); With Configuration
|
|
1000
|
+
*
|
|
1001
|
+
* var widget = new MultiWidget('accessToken',[ With Configurations
|
|
1002
|
+
* Configuration('gatewayId'),
|
|
1003
|
+
* Configuration('gatewayId', 'bank_account')
|
|
1004
|
+
* ]);
|
|
1005
|
+
*/
|
|
1006
|
+
declare class MultiWidget {
|
|
1007
|
+
protected link: Link;
|
|
1008
|
+
protected configs: Configuration[];
|
|
1009
|
+
protected configTokens: string[];
|
|
1010
|
+
protected accessToken: string;
|
|
1011
|
+
protected event: IFrameEvent;
|
|
1012
|
+
constructor(accessToken: string, confTokens: string[]);
|
|
1013
|
+
constructor(accessToken: string, confToken: string);
|
|
1014
|
+
constructor(accessToken: string, configs: Configuration[]);
|
|
1015
|
+
constructor(accessToken: string, conf: Configuration);
|
|
1016
|
+
/**
|
|
1017
|
+
* Object contain styles for widget
|
|
1018
|
+
*
|
|
1019
|
+
* @example
|
|
1020
|
+
* widget.setStyles({
|
|
1021
|
+
* background_color: 'rgb(0, 0, 0)',
|
|
1022
|
+
* border_color: 'yellow',
|
|
1023
|
+
* text_color: '#FFFFAA',
|
|
1024
|
+
* button_color: 'rgba(255, 255, 255, 0.9)',
|
|
1025
|
+
* font_size: '20px'
|
|
1026
|
+
* fort_family: 'fantasy'
|
|
1027
|
+
* });
|
|
1028
|
+
* @param {IStyles} fields - name of styles which can be shown in widget [STYLE]{@link STYLE}
|
|
1029
|
+
*/
|
|
1030
|
+
setStyles(styles: IStyles$1): void;
|
|
1031
|
+
/**
|
|
1032
|
+
* Method to set a country code mask for the phone input.
|
|
1033
|
+
*
|
|
1034
|
+
* @example
|
|
1035
|
+
* widget.usePhoneCountryMask();
|
|
1036
|
+
*
|
|
1037
|
+
* @example
|
|
1038
|
+
* widget.usePhoneCountryMask({
|
|
1039
|
+
* default_country: 'au',
|
|
1040
|
+
* preferred_countries: ['au', 'gb'],
|
|
1041
|
+
* only_countries: ['au', 'gb', 'us', 'ua']
|
|
1042
|
+
* });
|
|
1043
|
+
*
|
|
1044
|
+
* @param {object} [options] - Options for configure the phone mask.
|
|
1045
|
+
* @param {string} [options.default_country] - Set a default country for the mask.
|
|
1046
|
+
* @param {Array.<string>} [options.preferred_countries] - Set list of preferred countries for the top of the select box .
|
|
1047
|
+
* @param {Array.<string>} [options.only_countries] - Set list of countries to show in the select box.
|
|
1048
|
+
*/
|
|
1049
|
+
usePhoneCountryMask(options?: ICountryPhoneMask): void;
|
|
1050
|
+
setStyle(param: string, value: string): void;
|
|
1051
|
+
/**
|
|
1052
|
+
* Method for set different texts inside the widget
|
|
1053
|
+
*
|
|
1054
|
+
* @example
|
|
1055
|
+
* widget.setTexts({
|
|
1056
|
+
* title: 'Your card',
|
|
1057
|
+
* finish_text: 'Payment resource was successfully accepted',
|
|
1058
|
+
* title_description: '* indicates required field',
|
|
1059
|
+
* submit_button: 'Save',
|
|
1060
|
+
* submit_button_processing: 'Load...',
|
|
1061
|
+
* });
|
|
1062
|
+
*
|
|
1063
|
+
* @param {ITexts} fields - name of text items which can be shown in widget [TEXT]{@link TEXT}
|
|
1064
|
+
*/
|
|
1065
|
+
setTexts(texts: ITexts): void;
|
|
1066
|
+
setText(param: string, value: string): void;
|
|
1067
|
+
setElementStyle(element: string, state: string, styles: IElementStyleInput | IElementStyleSubmitButton | IElementStyleLabel): any;
|
|
1068
|
+
setElementStyle(element: string, styles: IElementStyleInput | IElementStyleSubmitButton | IElementStyleLabel | IElementStyleTitle | IElementStyleTitleDescription): any;
|
|
1069
|
+
/**
|
|
1070
|
+
* The method to set the predefined values for the form fields inside the widget
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* widget.setFormValues({
|
|
1074
|
+
* email: 'predefined@email.com',
|
|
1075
|
+
* card_name: 'Houston'
|
|
1076
|
+
* });
|
|
1077
|
+
*
|
|
1078
|
+
* @param { Object } fieldValues - Key of object is one of [FORM_FIELD]{@link FORM_FIELD}, The object value is what we are expecting
|
|
1079
|
+
*/
|
|
1080
|
+
setFormValues(fieldValues: IFormValues): void;
|
|
1081
|
+
setFormValue(key: string, value: string): void;
|
|
1082
|
+
/**
|
|
1083
|
+
* The method to set custom form field labels
|
|
1084
|
+
*
|
|
1085
|
+
* @example
|
|
1086
|
+
* widget.setFormPlaceholders({
|
|
1087
|
+
* card_name: 'Card Holder Name',
|
|
1088
|
+
* email: 'Email For Receipt'
|
|
1089
|
+
* })
|
|
1090
|
+
*
|
|
1091
|
+
* @param { Object } fieldLabels - Key of object is one of [FORM_FIELD]{@link FORM_FIELD}, The object value is what we are expecting
|
|
1092
|
+
*/
|
|
1093
|
+
setFormLabels(fieldLabels: IFormLabels): void;
|
|
1094
|
+
setFormLabel(key: string, label: string): void;
|
|
1095
|
+
/**
|
|
1096
|
+
* The method to set custom form fields placeholders
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* widget.setFormPlaceholders({
|
|
1100
|
+
* card_name: 'Input your card holder name...',
|
|
1101
|
+
* email: 'Input your email, like test@example.com'
|
|
1102
|
+
* })
|
|
1103
|
+
*
|
|
1104
|
+
* @param { Object } fieldPlaceholders - Key of object is one of [FORM_FIELD]{@link FORM_FIELD}, Value of object is expected placeholder
|
|
1105
|
+
*/
|
|
1106
|
+
setFormPlaceholders(fieldPlaceholders: IFormPlaceholders): void;
|
|
1107
|
+
setFormPlaceholder(key: string, placeholder: string): void;
|
|
1108
|
+
/**
|
|
1109
|
+
* The method to set the full configuration for the all specific form elements (label, placeholder, value)
|
|
1110
|
+
* You can also use the other method for the partial configuration like: setFormValues, setFormPlaceholder, setFormLabel
|
|
1111
|
+
*
|
|
1112
|
+
* @example
|
|
1113
|
+
* widget.setFormElements([
|
|
1114
|
+
* {
|
|
1115
|
+
* field: 'card_name',
|
|
1116
|
+
* placeholder: 'Input your card holder name...',
|
|
1117
|
+
* label: 'Card Holder Name',
|
|
1118
|
+
* value: 'Houston',
|
|
1119
|
+
* },
|
|
1120
|
+
* {
|
|
1121
|
+
* field: 'email',
|
|
1122
|
+
* placeholder: 'Input your email, like test@example.com',
|
|
1123
|
+
* label: 'Email For Receipt',
|
|
1124
|
+
* value: 'predefined@email.com',
|
|
1125
|
+
* },
|
|
1126
|
+
* ])
|
|
1127
|
+
*
|
|
1128
|
+
* @param { string } elements - The list of elements
|
|
1129
|
+
* @param { string } elements[].field - Field name of the element [FORM_FIELD]{@link FORM_FIELD}
|
|
1130
|
+
* @param { string } elements[].placeholder - Set custom form field placeholder
|
|
1131
|
+
* @param { string } elements[].label - Set custom labels near form field
|
|
1132
|
+
* @param { string } elements[].value - Set predefined values for the form field
|
|
1133
|
+
*/
|
|
1134
|
+
setFormElements(elements: IFormElement[]): void;
|
|
1135
|
+
setFormElement(element: IFormElement): void;
|
|
1136
|
+
/**
|
|
1137
|
+
* The method to change the widget icons
|
|
1138
|
+
*
|
|
1139
|
+
* @deprecated
|
|
1140
|
+
*/
|
|
1141
|
+
setIcons(icons: IIcons): void;
|
|
1142
|
+
setIcon(key: string, value: string): void;
|
|
1143
|
+
/**
|
|
1144
|
+
* Using this method you can set hidden elements inside widget
|
|
1145
|
+
*
|
|
1146
|
+
* @example
|
|
1147
|
+
* widget.setHiddenElements(['submit_button', 'email']);
|
|
1148
|
+
*
|
|
1149
|
+
* @param {string[]} elements - list of element which can be hidden [ELEMENT]{@link ELEMENT} || [FORM_FIELD]{@link FORM_FIELD}
|
|
1150
|
+
*/
|
|
1151
|
+
setHiddenElements(elements: string[]): void;
|
|
1152
|
+
/**
|
|
1153
|
+
* Current method can set custom ID to identify the data in the future
|
|
1154
|
+
*
|
|
1155
|
+
* @example
|
|
1156
|
+
* widget.setRefId('id');
|
|
1157
|
+
*
|
|
1158
|
+
* @param {string} refId - custom id
|
|
1159
|
+
*/
|
|
1160
|
+
setRefId(refId: string): void;
|
|
1161
|
+
/**
|
|
1162
|
+
* Current method can add visual validation from gateway to widget's form fields
|
|
1163
|
+
*
|
|
1164
|
+
* @example
|
|
1165
|
+
* widget.useGatewayFieldValidation();
|
|
1166
|
+
*/
|
|
1167
|
+
useGatewayFieldValidation(): void;
|
|
1168
|
+
/**
|
|
1169
|
+
* Current method can set icons of supported card types
|
|
1170
|
+
*
|
|
1171
|
+
* @example
|
|
1172
|
+
*
|
|
1173
|
+
* widget.setSupportedCardIcons(['mastercard', 'visa'], validateCardNumberInput);
|
|
1174
|
+
*
|
|
1175
|
+
* @param {string[]} elements - [SUPPORTED_CARD_TYPES]{@link SUPPORTED_CARD_TYPES}
|
|
1176
|
+
* @param {boolean} validateCardNumberInput - [validateCardNumberInput=false] - using this param you allow validation for card number input on supported card types
|
|
1177
|
+
*/
|
|
1178
|
+
setSupportedCardIcons(elements: string[], validateCardNumberInput?: boolean): void;
|
|
1179
|
+
/**
|
|
1180
|
+
* Current method can hide prevent the widget from showing the error messages
|
|
1181
|
+
*
|
|
1182
|
+
* @example
|
|
1183
|
+
* widget.hideUiErrors('id');
|
|
1184
|
+
*/
|
|
1185
|
+
hideUiErrors(): void;
|
|
1186
|
+
/**
|
|
1187
|
+
* Current method can change environment. By default environment = sandbox.
|
|
1188
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
1189
|
+
*
|
|
1190
|
+
* @example
|
|
1191
|
+
* widget.setEnv('production', 'paydock.com');
|
|
1192
|
+
* @param {string} env - sandbox, production
|
|
1193
|
+
* @param {string} [alias] - Own domain alias
|
|
1194
|
+
*/
|
|
1195
|
+
setEnv(env: string, alias?: string): void;
|
|
1196
|
+
getEnv(): void;
|
|
1197
|
+
/**
|
|
1198
|
+
* Method for creating iframe url
|
|
1199
|
+
*
|
|
1200
|
+
* @example
|
|
1201
|
+
* widget.loadIFrameUrl(function (url) {
|
|
1202
|
+
* console.log(url);
|
|
1203
|
+
* }, function (errors) {
|
|
1204
|
+
* console.log(errors);
|
|
1205
|
+
* });
|
|
1206
|
+
*/
|
|
1207
|
+
loadIFrameUrl(cb: (url: string) => void, errorCb?: (error: any) => void): void;
|
|
1208
|
+
/**
|
|
1209
|
+
* Method for setting a custom language code
|
|
1210
|
+
*
|
|
1211
|
+
* @example
|
|
1212
|
+
* config.setLanguage('en');
|
|
1213
|
+
* @param {string} code - ISO 639-1
|
|
1214
|
+
*/
|
|
1215
|
+
setLanguage(code: any): void;
|
|
1216
|
+
getLink(): Link;
|
|
1217
|
+
protected handleErrorEvent(event: EventTypes, error: IEventError, purpose: PURPOSE): void;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
interface ITriggerData {
|
|
1221
|
+
configuration_token?: string;
|
|
1222
|
+
tab_number?: number;
|
|
1223
|
+
elements?: string;
|
|
1224
|
+
form_values?: string;
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Interface for classes that represent a trigger data.
|
|
1228
|
+
* @interface ITriggerData
|
|
1229
|
+
*
|
|
1230
|
+
* @param {string} [configuration_token]
|
|
1231
|
+
* @param {string} [tab_number]
|
|
1232
|
+
* @param {string} [elements]
|
|
1233
|
+
* @param {string} [form_values]
|
|
1234
|
+
* */
|
|
1235
|
+
/**
|
|
1236
|
+
* List of available triggers
|
|
1237
|
+
*
|
|
1238
|
+
* @type {object}
|
|
1239
|
+
* @param {string} SUBMIT_FORM=submit_form
|
|
1240
|
+
* @param {string} CHANGE_TAB=tab
|
|
1241
|
+
* @param {string} HIDE_ELEMENTS=hide_elements
|
|
1242
|
+
* @param {string} SHOW_ELEMENTS=show_elements
|
|
1243
|
+
* @param {string} REFRESH_CHECKOUT=refresh_checkout
|
|
1244
|
+
* @param {string} UPDATE_FORM_VALUES=update_form_values
|
|
1245
|
+
* @param {string} INIT_CHECKOUT=init_checkout
|
|
1246
|
+
*/
|
|
1247
|
+
declare const TRIGGER: {
|
|
1248
|
+
SUBMIT_FORM: string;
|
|
1249
|
+
CHANGE_TAB: string;
|
|
1250
|
+
HIDE_ELEMENTS: string;
|
|
1251
|
+
SHOW_ELEMENTS: string;
|
|
1252
|
+
REFRESH_CHECKOUT: string;
|
|
1253
|
+
UPDATE_FORM_VALUES: string;
|
|
1254
|
+
INIT_CHECKOUT: string;
|
|
1255
|
+
};
|
|
1256
|
+
declare class Trigger {
|
|
1257
|
+
protected iFrame: IFrame;
|
|
1258
|
+
constructor(iFrame: IFrame);
|
|
1259
|
+
push(triggerName: string, data?: ITriggerData): void;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
interface IEventMetaData extends IEventData$1 {
|
|
1263
|
+
configuration_token: string;
|
|
1264
|
+
type: string;
|
|
1265
|
+
account_name?: string;
|
|
1266
|
+
account_number?: string;
|
|
1267
|
+
card_number_last4?: string;
|
|
1268
|
+
card_number_length?: number;
|
|
1269
|
+
card_scheme?: string;
|
|
1270
|
+
gateway_type?: string;
|
|
1271
|
+
}
|
|
1272
|
+
interface IEventFinishData extends IEventData$1 {
|
|
1273
|
+
payment_source: string;
|
|
1274
|
+
payment_source_token?: string;
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Interface of data from validation event.
|
|
1278
|
+
*
|
|
1279
|
+
* @interface IFormValidation
|
|
1280
|
+
*
|
|
1281
|
+
* @param {string} event The name of the event.
|
|
1282
|
+
* @param {string} message_source A system variable that identifies the event source.
|
|
1283
|
+
* @param {string} purpose A system variable that states the purpose of the event.
|
|
1284
|
+
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
|
|
1285
|
+
* @param {boolean} [form_valid] Indicates wether or not the form is valid.
|
|
1286
|
+
* @param {Array<string>} [invalid_fields] Names of form fields with invalid data.
|
|
1287
|
+
* @param {Array<string>} [invalid_showed_fields] Names of invalid form fields which are already displaying the error.
|
|
1288
|
+
* @param {Partial<Record<CardValidatorValue | GenericValidatorValue, Array<string>>>} [validators] Object containing validator identifiers as keys and the fields subject to that validator as an array of form field names.
|
|
1289
|
+
* See list of available [Generic Vallidators]{@link GENERIC_VALIDATORS} and [Card Validators]{@link CARD_VALIDATORS},
|
|
1290
|
+
*/
|
|
1291
|
+
/**
|
|
1292
|
+
* Contains basic information associated with the event and additional meta data
|
|
1293
|
+
* specific to the event. E.g., card info, gateway info, etc.
|
|
1294
|
+
*
|
|
1295
|
+
* @interface IEventMetaData
|
|
1296
|
+
*
|
|
1297
|
+
* @param {string} event The name of the event.
|
|
1298
|
+
* @param {string} purpose A system variable that states the purpose of the event.
|
|
1299
|
+
* @param {string} message_source A system variable that identifies the event source.
|
|
1300
|
+
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
|
|
1301
|
+
* @param {string} configuration_token Token received from our API with widget data
|
|
1302
|
+
* @param {string} type Payment type 'card', 'bank_account'
|
|
1303
|
+
* @param {string} gateway_type Gateway type
|
|
1304
|
+
* @param {string} [card_number_last4] Last 4 digit of your card
|
|
1305
|
+
* @param {string} [card_scheme] Card scheme, e.g., (Visa, Mastercard and American Express (AmEx))
|
|
1306
|
+
* @param {number} [card_number_length] Card number length
|
|
1307
|
+
* @param {string} [account_name] Bank account account name
|
|
1308
|
+
* @param {string} [account_number] Bank account account number
|
|
1309
|
+
* */
|
|
1310
|
+
/**
|
|
1311
|
+
* Interface of data from event.
|
|
1312
|
+
* @interface IEventAfterLoadData
|
|
1313
|
+
*
|
|
1314
|
+
* @param {string} event The name of the event.
|
|
1315
|
+
* @param {string} purpose A system variable that states the purpose of the event.
|
|
1316
|
+
* @param {string} message_source A system variable that identifies the event source.
|
|
1317
|
+
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
|
|
1318
|
+
* */
|
|
1319
|
+
/**
|
|
1320
|
+
* Interface of data from event.
|
|
1321
|
+
* @interface IEventFinishData
|
|
1322
|
+
*
|
|
1323
|
+
* @param {string} event The name of the event.
|
|
1324
|
+
* @param {string} purpose A system variable that states the purpose of the event.
|
|
1325
|
+
* @param {string} message_source A system variable that identifies the event source.
|
|
1326
|
+
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
|
|
1327
|
+
* @param {string} payment_source One time token. Result from this endpoint [API docs](https://docs.paydock.com/#tokens)
|
|
1328
|
+
* */
|
|
1329
|
+
/**
|
|
1330
|
+
* List of available event's name
|
|
1331
|
+
* @const EVENT
|
|
1332
|
+
*
|
|
1333
|
+
* @type {object}
|
|
1334
|
+
* @param {string} AFTER_LOAD=afterLoad
|
|
1335
|
+
* @param {string} SUBMIT=submit
|
|
1336
|
+
* @param {string} FINISH=finish
|
|
1337
|
+
* @param {string} VALIDATION=validation
|
|
1338
|
+
* @param {string} VALIDATION_ERROR=validationError
|
|
1339
|
+
* @param {string} SYSTEM_ERROR=systemError
|
|
1340
|
+
* @param {string} META_CHANGE=metaChange
|
|
1341
|
+
* @param {string} RESIZE=resize
|
|
1342
|
+
*/
|
|
1343
|
+
/**
|
|
1344
|
+
* List of available event's name
|
|
1345
|
+
* @const VAULT_DISPLAY_EVENT
|
|
1346
|
+
*
|
|
1347
|
+
* @type {object}
|
|
1348
|
+
* @param {string} AFTER_LOAD=afterLoad
|
|
1349
|
+
* @param {string} SYSTEM_ERROR=system_error
|
|
1350
|
+
* @param {string} CVV_SECURE_CODE_REQUESTED=cvv_secure_code_requested
|
|
1351
|
+
* @param {string} CARD_NUMBER_SECURE_CODE_REQUESTED=card_number_secure_code_requested
|
|
1352
|
+
* @param {string} ACCESS_FORBIDDEN=access_forbidden
|
|
1353
|
+
* @param {string} SESSION_EXPIRED=systemError
|
|
1354
|
+
* @param {string} SYSTEM_ERROR=session_expired
|
|
1355
|
+
* @param {string} OPERATION_FORBIDDEN=operation_forbidden
|
|
1356
|
+
*/
|
|
1357
|
+
/**
|
|
1358
|
+
* Class HtmlMultiWidget include method for working with html
|
|
1359
|
+
* @constructor
|
|
1360
|
+
* @extends MultiWidget
|
|
1361
|
+
*
|
|
1362
|
+
* @param {string} selector - Selector of html element. Container for widget
|
|
1363
|
+
* @param {string} publicKey - PayDock users public key
|
|
1364
|
+
* @param {(Configuration | string | Configuration[] | string[])} conf - exemplar[s] Configuration class OR configuration token
|
|
1365
|
+
* @example
|
|
1366
|
+
* var widget = new MultiWidget('#widget', 'publicKey','configurationToken'); // With a pre-created configuration token
|
|
1367
|
+
*
|
|
1368
|
+
* var widget = new MultiWidget('#widget', 'publicKey',['configurationToken', 'configurationToken2']); // With pre-created configuration tokens
|
|
1369
|
+
*
|
|
1370
|
+
* var widget = new MultiWidget('#widget', 'publicKey', new Configuration('gatewayId')); With Configuration
|
|
1371
|
+
*
|
|
1372
|
+
* var widget = new MultiWidget('#widget', 'publicKey',[ With Configurations
|
|
1373
|
+
* Configuration(), // default gateway_id,
|
|
1374
|
+
* Configuration('not_configured'), // without gateway,
|
|
1375
|
+
* Configuration('gatewayId'),
|
|
1376
|
+
* Configuration('gatewayId', 'bank_account')
|
|
1377
|
+
* ]);
|
|
1378
|
+
*/
|
|
1379
|
+
declare class HtmlMultiWidget extends MultiWidget {
|
|
1380
|
+
protected container: Container;
|
|
1381
|
+
protected iFrame: IFrame;
|
|
1382
|
+
protected triggerElement: Trigger;
|
|
1383
|
+
protected validationData: IFormValidation;
|
|
1384
|
+
/** @constructs */ constructor(selector: string, publicKey: string, conf: any);
|
|
1385
|
+
/**
|
|
1386
|
+
* Loads the widget.
|
|
1387
|
+
*
|
|
1388
|
+
* Calling this method results in an iframe element being inserted and rendered in the DOM.
|
|
1389
|
+
*/
|
|
1390
|
+
load(): void;
|
|
1391
|
+
/**
|
|
1392
|
+
* Registers a form validation callback for validation events.
|
|
1393
|
+
*/
|
|
1394
|
+
protected afterLoad(): void;
|
|
1395
|
+
/**
|
|
1396
|
+
* Listen to events of widget
|
|
1397
|
+
*
|
|
1398
|
+
* @example
|
|
1399
|
+
*
|
|
1400
|
+
* ```javascript
|
|
1401
|
+
* widget.on('form_submit', function (data) {
|
|
1402
|
+
* console.log(data);
|
|
1403
|
+
* });
|
|
1404
|
+
* ```
|
|
1405
|
+
*
|
|
1406
|
+
* @example
|
|
1407
|
+
*
|
|
1408
|
+
* ```javascript
|
|
1409
|
+
* widget.on('form_submit').then(function (data) {
|
|
1410
|
+
* console.log(data);
|
|
1411
|
+
* });
|
|
1412
|
+
* ```
|
|
1413
|
+
*
|
|
1414
|
+
* @typedef {(data: IEventData | IEventMetaData | IEventFinishData | IFormValidation) => void} EventListenerCallback
|
|
1415
|
+
*
|
|
1416
|
+
* @param {string} eventName - The name of the event that should be listened. Available event names [EVENT]{@link EVENT}.
|
|
1417
|
+
* @param {EventListenerCallback} [cb] - A function to be invoked whenever the event occurs.
|
|
1418
|
+
*
|
|
1419
|
+
* @return {Promise<IEventData | IEventMetaData | IEventFinishData | IFormValidation> | void}
|
|
1420
|
+
*/
|
|
1421
|
+
on(eventName: string): Promise<IEventData$1 | IEventMetaData | IEventFinishData | IFormValidation>;
|
|
1422
|
+
on(eventName: string, cb: (data: IEventData$1 | IEventMetaData | IEventFinishData | IFormValidation) => void): any;
|
|
1423
|
+
/**
|
|
1424
|
+
* Registers callback that will be invoked for every trigger.
|
|
1425
|
+
*
|
|
1426
|
+
* @param {'submit_form' | 'tab'} triggers - The Widget element identifier that caused the trigger.
|
|
1427
|
+
* @param {ITriggerData} data - Data that will be sent to the widget when the trigger occurs.
|
|
1428
|
+
*/
|
|
1429
|
+
trigger(triggerName: string, data?: ITriggerData): void;
|
|
1430
|
+
/**
|
|
1431
|
+
* Gets a reference to the form current validation state.
|
|
1432
|
+
*
|
|
1433
|
+
* !Warning: do not directly modify the values of the returned object.
|
|
1434
|
+
*
|
|
1435
|
+
* @return {IFormValidation} Form validation object
|
|
1436
|
+
*/
|
|
1437
|
+
getValidationState(): IFormValidation;
|
|
1438
|
+
/**
|
|
1439
|
+
* Checks if a given form is valid.
|
|
1440
|
+
*
|
|
1441
|
+
* A form is valid if all form fields are valid.
|
|
1442
|
+
*
|
|
1443
|
+
* @return {boolean} Indicates wether or not form is valid.
|
|
1444
|
+
*/
|
|
1445
|
+
isValidForm(): boolean;
|
|
1446
|
+
/**
|
|
1447
|
+
* Using this method you can check if a specific form field is invalid
|
|
1448
|
+
*
|
|
1449
|
+
* @param {string} field - Field name
|
|
1450
|
+
* @return {boolean} Field is invalid
|
|
1451
|
+
*/
|
|
1452
|
+
isInvalidField(field?: string): boolean;
|
|
1453
|
+
/**
|
|
1454
|
+
* Checks if a given form field is displaying an error.
|
|
1455
|
+
*
|
|
1456
|
+
* @param {string} field - The form field name
|
|
1457
|
+
*
|
|
1458
|
+
* @return {boolean} Indicates wether or not the Error message is being displayed on the associated field.
|
|
1459
|
+
*/
|
|
1460
|
+
isFieldErrorShowed(field?: string): boolean;
|
|
1461
|
+
/**
|
|
1462
|
+
* Checks if a given form field is valid or invalid by name.
|
|
1463
|
+
*
|
|
1464
|
+
* @param {string} field - The form field name
|
|
1465
|
+
* @param validator - The name of the validator.
|
|
1466
|
+
*
|
|
1467
|
+
* @return {boolean} Indicates wether or not the field is invalid based on validator intepretation.
|
|
1468
|
+
*/
|
|
1469
|
+
isInvalidFieldByValidator(field: string, validator: ValidatorFieldsMapKey): boolean;
|
|
1470
|
+
/**
|
|
1471
|
+
* Hides the widget.
|
|
1472
|
+
*
|
|
1473
|
+
* E.g., use this method to hide the widget after it loads.
|
|
1474
|
+
*
|
|
1475
|
+
* @param {boolean} [saveSize=false] Wether the original iframe element size should be saved before being hidden.
|
|
1476
|
+
*/
|
|
1477
|
+
hide(saveSize: boolean): void;
|
|
1478
|
+
/**
|
|
1479
|
+
* Shows the widget.
|
|
1480
|
+
*
|
|
1481
|
+
* E.g., use this method to show the widget after it was explicitly hidden.
|
|
1482
|
+
*/
|
|
1483
|
+
show(): void;
|
|
1484
|
+
/**
|
|
1485
|
+
* Reloads the widget.
|
|
1486
|
+
*/
|
|
1487
|
+
reload(): void;
|
|
1488
|
+
/**
|
|
1489
|
+
* Hides the specified Widget elements by their identifier.
|
|
1490
|
+
*
|
|
1491
|
+
* @example
|
|
1492
|
+
*
|
|
1493
|
+
* ```javascript
|
|
1494
|
+
* widget.hideElements(['submit_button', 'email']);
|
|
1495
|
+
* ```
|
|
1496
|
+
*
|
|
1497
|
+
* @param {string[]} elements - List of element which can be hidden [ELEMENT]{@link ELEMENT} || [FORM_FIELD]{@link FORM_FIELD}
|
|
1498
|
+
*/
|
|
1499
|
+
hideElements(elements: string[]): void;
|
|
1500
|
+
/**
|
|
1501
|
+
* Shows the specified Widget elements by their identifier.
|
|
1502
|
+
*
|
|
1503
|
+
* @example
|
|
1504
|
+
*
|
|
1505
|
+
* ```javascript
|
|
1506
|
+
* widget.showElements(['submit_button', 'email']);
|
|
1507
|
+
* ```
|
|
1508
|
+
*
|
|
1509
|
+
* @param {string[]} elements - List of elements which can be showed [ELEMENT]{@link ELEMENT} || [FORM_FIELD]{@link FORM_FIELD}
|
|
1510
|
+
*/
|
|
1511
|
+
showElements(elements: string[]): void;
|
|
1512
|
+
/**
|
|
1513
|
+
* Updates the form field values inside the widget.
|
|
1514
|
+
*
|
|
1515
|
+
* @example
|
|
1516
|
+
*
|
|
1517
|
+
* ```javascript
|
|
1518
|
+
* widget.updateFormValues({
|
|
1519
|
+
* email: 'predefined@email.com',
|
|
1520
|
+
* card_name: 'Houston'
|
|
1521
|
+
* });
|
|
1522
|
+
*```
|
|
1523
|
+
*
|
|
1524
|
+
* @param {IFormValues} fieldValues - Fields with values
|
|
1525
|
+
*/
|
|
1526
|
+
updateFormValues(fieldValues: IFormValues): void;
|
|
1527
|
+
/**
|
|
1528
|
+
* Updates a single form field values inside the widget by the form field name.
|
|
1529
|
+
*
|
|
1530
|
+
* @example
|
|
1531
|
+
*
|
|
1532
|
+
* ```javascript
|
|
1533
|
+
* widget.updateFormValue("card_name", "John Doe");
|
|
1534
|
+
*```
|
|
1535
|
+
*
|
|
1536
|
+
* @param {string} key - The form field name
|
|
1537
|
+
* @param {string} value - The form field value
|
|
1538
|
+
*/
|
|
1539
|
+
updateFormValue(key: string, value: string): void;
|
|
1540
|
+
/**
|
|
1541
|
+
* Inserts the event data (after finish event) onto the input field associated with the provided CSS selector.
|
|
1542
|
+
*
|
|
1543
|
+
* @param {string} selector - A CSS selector. E.g., ".my-class", "#my-id", or others
|
|
1544
|
+
* @param {string} dataType - The data type of IEventData object.
|
|
1545
|
+
*/
|
|
1546
|
+
onFinishInsert(selector: string, dataType: string): void;
|
|
1547
|
+
/**
|
|
1548
|
+
* Intercepts a form submission and delegates processing to the widget.
|
|
1549
|
+
*
|
|
1550
|
+
* An simplified example of the process:
|
|
1551
|
+
* - User clicks submit button in your form
|
|
1552
|
+
* - This implicitly triggers a submission to the widget
|
|
1553
|
+
* - The widget submits your form
|
|
1554
|
+
*
|
|
1555
|
+
* @note The widget's submit button will be hidden.
|
|
1556
|
+
*
|
|
1557
|
+
* @param {string} selector - css selector of your form
|
|
1558
|
+
*
|
|
1559
|
+
* @example
|
|
1560
|
+
*
|
|
1561
|
+
* ```html
|
|
1562
|
+
* <body>
|
|
1563
|
+
* <form id="myForm">
|
|
1564
|
+
* <input name="amount">
|
|
1565
|
+
* <button type="submit">Submit</button>
|
|
1566
|
+
* </form>
|
|
1567
|
+
* <script>
|
|
1568
|
+
* widget.interceptSubmitForm('#myForm');
|
|
1569
|
+
* </script>
|
|
1570
|
+
* </body>
|
|
1571
|
+
* ```
|
|
1572
|
+
*/
|
|
1573
|
+
interceptSubmitForm(selector: string): void;
|
|
1574
|
+
/**
|
|
1575
|
+
* This method hides a submit button and automatically execute form submit
|
|
1576
|
+
*/
|
|
1577
|
+
useCheckoutAutoSubmit(): void;
|
|
1578
|
+
/**
|
|
1579
|
+
* Use this method for resize iFrame according content height
|
|
1580
|
+
*
|
|
1581
|
+
* @example
|
|
1582
|
+
*
|
|
1583
|
+
* ```javascript
|
|
1584
|
+
* widget.useAutoResize();
|
|
1585
|
+
*```
|
|
1586
|
+
*/
|
|
1587
|
+
useAutoResize(): void;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* Class Widget include method for working on html and include extended by HtmlMultiWidget methods
|
|
1592
|
+
* @constructor
|
|
1593
|
+
* @extends HtmlMultiWidget
|
|
1594
|
+
* @extends MultiWidget
|
|
1595
|
+
*
|
|
1596
|
+
* @example
|
|
1597
|
+
* var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID'); // short
|
|
1598
|
+
*
|
|
1599
|
+
* var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID', 'bank_account', 'payment_source'); // extend
|
|
1600
|
+
*
|
|
1601
|
+
* var widget = new HtmlWidget('#widget', 'publicKey', 'not_configured'); // without gateway
|
|
1602
|
+
*
|
|
1603
|
+
* @param {string} selector - Selector of html element. Container for widget
|
|
1604
|
+
* @param {string} publicKey - PayDock users public key
|
|
1605
|
+
* @param {string} [gatewayID=default] - ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token.
|
|
1606
|
+
* @param {string} [paymentType=card] - Type of payment source which shows in widget form. Available parameters : “card”, “bank_account”.
|
|
1607
|
+
* @param {string} [purpose=payment_source] - Purpose of widget form. Available parameters: ‘payment_source’, ‘card_payment_source_with_cvv’, ‘card_payment_source_without_cvv’
|
|
1608
|
+
*/
|
|
1609
|
+
declare class HtmlWidget extends HtmlMultiWidget {
|
|
1610
|
+
/** @constructs */ constructor(selector: string, publicKey: string, gatewayID?: string, paymentType?: string, purpose?: PURPOSE);
|
|
1611
|
+
/**
|
|
1612
|
+
* Destination, where customer will receive all successful responses.
|
|
1613
|
+
* Response will contain “data” object with “payment_source” or other parameters, in depending on 'purpose'
|
|
1614
|
+
*
|
|
1615
|
+
* @example
|
|
1616
|
+
* widget.setWebHookDestination('http://google.com');
|
|
1617
|
+
*
|
|
1618
|
+
* @param {string} url - Your endpoint for post request.
|
|
1619
|
+
*/
|
|
1620
|
+
setWebHookDestination(url: string): void;
|
|
1621
|
+
/**
|
|
1622
|
+
* URL to which the Customer will be redirected to after the success finish
|
|
1623
|
+
*
|
|
1624
|
+
* @example
|
|
1625
|
+
* widget.setSuccessRedirectUrl('google.com/search?q=success');
|
|
1626
|
+
*
|
|
1627
|
+
* @param {string} url
|
|
1628
|
+
*/
|
|
1629
|
+
setSuccessRedirectUrl(url: string): void;
|
|
1630
|
+
/**
|
|
1631
|
+
* URL to which the Customer will be redirected to if an error is triggered in the process of operation
|
|
1632
|
+
*
|
|
1633
|
+
* @example
|
|
1634
|
+
* widget.setErrorRedirectUrl('google.com/search?q=error');
|
|
1635
|
+
*
|
|
1636
|
+
* @param {string} url
|
|
1637
|
+
*/
|
|
1638
|
+
setErrorRedirectUrl(url: string): void;
|
|
1639
|
+
/**
|
|
1640
|
+
* Set list with widget form field, which will be shown in form. Also you can set the required validation for these fields
|
|
1641
|
+
*
|
|
1642
|
+
* @example
|
|
1643
|
+
* widget.setFormFields(['phone', 'email', 'first_name*']);
|
|
1644
|
+
*
|
|
1645
|
+
* @param {string[]} fields - name of fields which can be shown in a widget.
|
|
1646
|
+
* If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) [FORM_FIELD]{@link FORM_FIELD}
|
|
1647
|
+
*/
|
|
1648
|
+
setFormFields(fields: string[]): void;
|
|
1649
|
+
/**
|
|
1650
|
+
* The method to set the full configuration for the all specific form elements (visibility, required, label, placeholder, value)
|
|
1651
|
+
* You can also use the other method for the partial configuration like: setFormFields, setFormValues, setFormPlaceholder, setFormLabel
|
|
1652
|
+
*
|
|
1653
|
+
* @example
|
|
1654
|
+
* widget.setFormElements([
|
|
1655
|
+
* {
|
|
1656
|
+
* field: 'card_name*',
|
|
1657
|
+
* placeholder: 'Input your card holder name...',
|
|
1658
|
+
* label: 'Card Holder Name',
|
|
1659
|
+
* value: 'Houston',
|
|
1660
|
+
* },
|
|
1661
|
+
* {
|
|
1662
|
+
* field: 'email',
|
|
1663
|
+
* placeholder: 'Input your email, like test@example.com',
|
|
1664
|
+
* label: 'Email for the receipt',
|
|
1665
|
+
* value: 'predefined@email.com',
|
|
1666
|
+
* },
|
|
1667
|
+
* ])
|
|
1668
|
+
*
|
|
1669
|
+
* @param { Object[] } elements - List of elements
|
|
1670
|
+
* @param { string } elements[].field - Field name of element. If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) [FORM_FIELD]{@link FORM_FIELD}
|
|
1671
|
+
* @param { string } elements[].placeholder - Set custom placeholders in form fields
|
|
1672
|
+
* @param { string } elements[].label - Set a custom labels near the form field
|
|
1673
|
+
* @param { string } elements[].value - Set predefined values for the form field
|
|
1674
|
+
*/
|
|
1675
|
+
setFormElements(elements: IFormElement[]): void;
|
|
1676
|
+
setFormElement(element: IFormElement): void;
|
|
1677
|
+
/**
|
|
1678
|
+
* The method to set meta information for the checkout page
|
|
1679
|
+
*
|
|
1680
|
+
* @example
|
|
1681
|
+
* config.setMeta({
|
|
1682
|
+
brand_name: 'paydock',
|
|
1683
|
+
reference: '15',
|
|
1684
|
+
email: 'wault@paydock.com'
|
|
1685
|
+
});
|
|
1686
|
+
*
|
|
1687
|
+
* @param {IPayPalMeta | IBamboraMeta} object - data which can be shown on checkout page [IPayPalMeta]{@link IPayPalMeta} [IBamboraMeta]{@link IBamboraMeta}
|
|
1688
|
+
*/
|
|
1689
|
+
setMeta(meta: IPayPalMeta | IBamboraMeta): void;
|
|
1690
|
+
setGiftCardScheme(giftCardScheme: any, processingNetwork: any): void;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Contains basic information associated with the event.
|
|
1695
|
+
*
|
|
1696
|
+
* Including event (name), source of the message, purpose and a unique identifier
|
|
1697
|
+
* for the event.
|
|
1698
|
+
*
|
|
1699
|
+
* @interface IEventData
|
|
1700
|
+
*
|
|
1701
|
+
* @param {string} event The name of the event.
|
|
1702
|
+
* @param {string} message_source A system variable that identifies the event source.
|
|
1703
|
+
* @param {string} purpose A system variable that states the purpose of the event.
|
|
1704
|
+
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
|
|
1705
|
+
*/
|
|
1706
|
+
interface IEventData$1 {
|
|
1707
|
+
event: string;
|
|
1708
|
+
message_source: string;
|
|
1709
|
+
purpose: PURPOSE;
|
|
1710
|
+
widget_id: string;
|
|
1711
|
+
data?: any;
|
|
1712
|
+
ref_id?: string;
|
|
1713
|
+
error?: IEventError;
|
|
1714
|
+
}
|
|
1715
|
+
declare const EVENT$1: {
|
|
1716
|
+
readonly AFTER_LOAD: "afterLoad";
|
|
1717
|
+
readonly SUBMIT: "submit";
|
|
1718
|
+
readonly FINISH: "finish";
|
|
1719
|
+
readonly VALIDATION_ERROR: "validationError";
|
|
1720
|
+
readonly SYSTEM_ERROR: "systemError";
|
|
1721
|
+
readonly ERROR: "error";
|
|
1722
|
+
/** @deprecated */
|
|
1723
|
+
readonly CHECKOUT_SUCCESS: "checkoutSuccess";
|
|
1724
|
+
readonly CHECKOUT_READY: "checkoutReady";
|
|
1725
|
+
readonly CHECKOUT_ERROR: "checkoutError";
|
|
1726
|
+
readonly CHECKOUT_COMPLETED: "checkoutCompleted";
|
|
1727
|
+
readonly CHECKOUT_POPUP_OPEN: "checkoutPopupOpen";
|
|
1728
|
+
readonly CHECKOUT_POPUP_CLOSE: "checkoutPopupClose";
|
|
1729
|
+
readonly RECOGNITION_TOKEN_REQUESTED: "recognitionTokenRequested";
|
|
1730
|
+
readonly RECOGNITION_TOKEN_DROPPED: "recognitionTokenDropped";
|
|
1731
|
+
readonly VALIDATION: "validation";
|
|
1732
|
+
readonly SELECT: "select";
|
|
1733
|
+
readonly UNSELECT: "unselect";
|
|
1734
|
+
readonly NEXT: "next";
|
|
1735
|
+
readonly PREV: "prev";
|
|
1736
|
+
readonly META_CHANGE: "metaChange";
|
|
1737
|
+
readonly RESIZE: "resize";
|
|
1738
|
+
readonly CHARGE_AUTH_SUCCESS: "chargeAuthSuccess";
|
|
1739
|
+
readonly CHARGE_AUTH_REJECT: "chargeAuthReject";
|
|
1740
|
+
readonly CHARGE_AUTH_CANCELLED: "chargeAuthCancelled";
|
|
1741
|
+
readonly ADDITIONAL_DATA_SUCCESS: "additionalDataCollectSuccess";
|
|
1742
|
+
readonly ADDITIONAL_DATA_REJECT: "additionalDataCollectReject";
|
|
1743
|
+
readonly CHARGE_AUTH: "chargeAuth";
|
|
1744
|
+
readonly DISPATCH_SUCCESS: "dispatchSuccess";
|
|
1745
|
+
readonly DISPATCH_ERROR: "dispatchError";
|
|
1746
|
+
};
|
|
1747
|
+
type EventTypes = typeof EVENT$1[keyof typeof EVENT$1];
|
|
1748
|
+
interface Listener {
|
|
1749
|
+
event: string;
|
|
1750
|
+
listener: (event: any) => void;
|
|
1751
|
+
widget_id: string;
|
|
1752
|
+
}
|
|
1753
|
+
declare type Listeners = Listener[];
|
|
1754
|
+
declare class IFrameEvent {
|
|
1755
|
+
protected listeners: Listeners;
|
|
1756
|
+
constructor(subject: Window | null);
|
|
1757
|
+
emit(data: IEventData$1): void;
|
|
1758
|
+
on<T>(eventName: string, widgetId: string, cb: (data: T) => void): void;
|
|
1759
|
+
clear(): void;
|
|
1760
|
+
private subscribe;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
declare class EventEmitter {
|
|
1764
|
+
private events;
|
|
1765
|
+
emit<T>(eventName: string, data?: T): void;
|
|
1766
|
+
emitWithResult<T, R>(eventName: string, data?: T): Promise<R[]>;
|
|
1767
|
+
subscribe<T>(eventName: string, handler: (data: T) => void): () => void;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
declare class Standalone3dsService {
|
|
1771
|
+
protected container: Container;
|
|
1772
|
+
protected eventEmitter: EventEmitter;
|
|
1773
|
+
protected env: string;
|
|
1774
|
+
protected alias: string;
|
|
1775
|
+
constructor(container: Container, eventEmitter: any);
|
|
1776
|
+
load(token: string, options: {
|
|
1777
|
+
title: string;
|
|
1778
|
+
}): void;
|
|
1779
|
+
setEnv(env: string, alias?: string): void;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* List of available token's content formats
|
|
1784
|
+
* @enum TOKEN_FORMAT
|
|
1785
|
+
*
|
|
1786
|
+
* @type {object}
|
|
1787
|
+
* @param {string} HTML=html
|
|
1788
|
+
*/
|
|
1789
|
+
declare enum TOKEN_FORMAT {
|
|
1790
|
+
HTML = "html",
|
|
1791
|
+
URL = "url",
|
|
1792
|
+
STANDALONE_3DS = "standalone_3ds"
|
|
1793
|
+
}
|
|
1794
|
+
/**
|
|
1795
|
+
* List of available event's name
|
|
1796
|
+
* @const EVENT
|
|
1797
|
+
*
|
|
1798
|
+
* @type {object}
|
|
1799
|
+
* @param {string} CHARGE_AUTH_SUCCESS=chargeAuthSuccess
|
|
1800
|
+
* @param {string} CHARGE_AUTH_REJECT=chargeAuthReject
|
|
1801
|
+
* @param {string} ADDITIONAL_DATA_SUCCESS=additionalDataCollectSuccess
|
|
1802
|
+
* @param {string} ADDITIONAL_DATA_REJECT=additionalDataCollectReject
|
|
1803
|
+
* @param {string} CHARGE_AUTH=chargeAuth
|
|
1804
|
+
*/
|
|
1805
|
+
/**
|
|
1806
|
+
* List of available event's name for Standalone 3ds flow
|
|
1807
|
+
* @const STANDALONE_3DS_EVENT
|
|
1808
|
+
*
|
|
1809
|
+
* @type {object}
|
|
1810
|
+
* @param {string} CHARGE_AUTH_SUCCESS=chargeAuthSuccess
|
|
1811
|
+
* @param {string} CHARGE_AUTH_REJECT=chargeAuthReject
|
|
1812
|
+
* @param {string} CHARGE_AUTH_DECOUPLED=chargeAuthDecoupled
|
|
1813
|
+
* @param {string} CHARGE_AUTH_CHALLENGE=chargeAuthChallenge
|
|
1814
|
+
* @param {string} CHARGE_AUTH_INFO=chargeAuthInfo
|
|
1815
|
+
* @param {string} ERROR=error
|
|
1816
|
+
*/
|
|
1817
|
+
/**
|
|
1818
|
+
* Class Canvas3ds include method for working on html
|
|
1819
|
+
* @constructor
|
|
1820
|
+
*
|
|
1821
|
+
* @param {string} selector - Selector of html element. Container for widget
|
|
1822
|
+
* @param {string} token - Pre authorized token
|
|
1823
|
+
* @example
|
|
1824
|
+
* var widget = new Canvas3ds('#widget', 'token');
|
|
1825
|
+
*
|
|
1826
|
+
*
|
|
1827
|
+
*/
|
|
1828
|
+
declare class Canvas3ds {
|
|
1829
|
+
protected link: Link;
|
|
1830
|
+
protected configs: Configuration[];
|
|
1831
|
+
protected publicKey: string;
|
|
1832
|
+
protected token: {
|
|
1833
|
+
content: string;
|
|
1834
|
+
format: TOKEN_FORMAT;
|
|
1835
|
+
charge_3ds_id: string;
|
|
1836
|
+
};
|
|
1837
|
+
protected standalone3dsService: Standalone3dsService;
|
|
1838
|
+
protected container: Container;
|
|
1839
|
+
protected iFrame: IFrame;
|
|
1840
|
+
protected event: IFrameEvent;
|
|
1841
|
+
protected eventEmitter: EventEmitter;
|
|
1842
|
+
/** @constructs */ constructor(selector: string, token: string);
|
|
1843
|
+
protected static extractToken(token: string): {
|
|
1844
|
+
content: string;
|
|
1845
|
+
format: TOKEN_FORMAT;
|
|
1846
|
+
charge_3ds_id: string;
|
|
1847
|
+
};
|
|
1848
|
+
/**
|
|
1849
|
+
* The final method to beginning, the load process of widget to html
|
|
1850
|
+
*
|
|
1851
|
+
*/
|
|
1852
|
+
load(): void;
|
|
1853
|
+
/**
|
|
1854
|
+
* Current method can change environment. By default environment = sandbox.
|
|
1855
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
1856
|
+
*
|
|
1857
|
+
* @example
|
|
1858
|
+
* widget.setEnv('production');
|
|
1859
|
+
* @param {string} env - sandbox, production
|
|
1860
|
+
* @param {string} [alias] - Own domain alias
|
|
1861
|
+
*/
|
|
1862
|
+
setEnv(env: string, alias?: string): void;
|
|
1863
|
+
getEnv(): string;
|
|
1864
|
+
on(eventName: string): Promise<IEventData$1>;
|
|
1865
|
+
on(eventName: string, cb: (data: IEventData$1) => void): any;
|
|
1866
|
+
/**
|
|
1867
|
+
* Using this method you can hide widget after load
|
|
1868
|
+
* @param {boolean} [saveSize=false] - using this param you can save iframe's size
|
|
1869
|
+
*/
|
|
1870
|
+
hide(saveSize: boolean): void;
|
|
1871
|
+
/**
|
|
1872
|
+
* Using this method you can show widget after using hide method
|
|
1873
|
+
*
|
|
1874
|
+
*/
|
|
1875
|
+
show(): void;
|
|
1876
|
+
/**
|
|
1877
|
+
* Using this method you can reload widget
|
|
1878
|
+
*
|
|
1879
|
+
*/
|
|
1880
|
+
reload(): void;
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
/**
|
|
1884
|
+
* @type {object}
|
|
1885
|
+
* @param {string} CLICK=click
|
|
1886
|
+
* @param {string} POPUP_REDIRECT=popup_redirect
|
|
1887
|
+
* @param {string} ERROR=error
|
|
1888
|
+
* @param {string} ACCEPTED=accepted
|
|
1889
|
+
* @param {string} FINISH=finish
|
|
1890
|
+
* @param {string} CLOSE=close
|
|
1891
|
+
*/
|
|
1892
|
+
declare const CHECKOUT_BUTTON_EVENT: {
|
|
1893
|
+
CLICK: string;
|
|
1894
|
+
POPUP_REDIRECT: string;
|
|
1895
|
+
REDIRECT: string;
|
|
1896
|
+
ERROR: string;
|
|
1897
|
+
REFERRED: string;
|
|
1898
|
+
DECLINED: string;
|
|
1899
|
+
CANCELLED: string;
|
|
1900
|
+
ACCEPTED: string;
|
|
1901
|
+
FINISH: string;
|
|
1902
|
+
CLOSE: string;
|
|
1903
|
+
};
|
|
1904
|
+
/**
|
|
1905
|
+
* @type {object}
|
|
1906
|
+
* @param {string} CONTEXTUAL=contextual
|
|
1907
|
+
* @param {string} REDIRECT=redirect
|
|
1908
|
+
*/
|
|
1909
|
+
declare enum CHECKOUT_MODE {
|
|
1910
|
+
CONTEXTUAL = "contextual",
|
|
1911
|
+
REDIRECT = "redirect"
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* @type {object}
|
|
1915
|
+
* @param {string} ZIPMONEY=Zipmoney
|
|
1916
|
+
* @param {string} PAYPAL=PaypalClassic
|
|
1917
|
+
* @param {string} AFTERPAY=Afterpay
|
|
1918
|
+
*/
|
|
1919
|
+
declare enum GATEWAY_TYPE {
|
|
1920
|
+
ZIPMONEY = "Zipmoney",
|
|
1921
|
+
PAYPAL = "PaypalClassic",
|
|
1922
|
+
AFTERPAY = "Afterpay"
|
|
1923
|
+
}
|
|
1924
|
+
interface IEventCheckoutFinishData {
|
|
1925
|
+
payment_source_token: string;
|
|
1926
|
+
checkout_email: string;
|
|
1927
|
+
checkout_holder: string;
|
|
1928
|
+
gateway_type: string;
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
/**
|
|
1932
|
+
* Class Background create overlay for checkout
|
|
1933
|
+
*
|
|
1934
|
+
* @example
|
|
1935
|
+
* var overlay = new Background();
|
|
1936
|
+
*/
|
|
1937
|
+
declare class Background {
|
|
1938
|
+
protected description: string;
|
|
1939
|
+
protected title: string;
|
|
1940
|
+
protected overlay: HTMLElement;
|
|
1941
|
+
protected style: HTMLStyleElement;
|
|
1942
|
+
protected eventEmitter: EventEmitter;
|
|
1943
|
+
protected showControl: boolean;
|
|
1944
|
+
protected showLoader: boolean;
|
|
1945
|
+
constructor();
|
|
1946
|
+
initControl(): void;
|
|
1947
|
+
initLoader(): void;
|
|
1948
|
+
private eventHandler;
|
|
1949
|
+
clear(): void;
|
|
1950
|
+
private createLoader;
|
|
1951
|
+
protected createTemplate(): void;
|
|
1952
|
+
private createStyles;
|
|
1953
|
+
setBackdropDescription(text: string): void;
|
|
1954
|
+
setBackdropTitle(text: string): void;
|
|
1955
|
+
onTrigger(triggerName: string, cb: () => void): void;
|
|
1956
|
+
isInit(): boolean;
|
|
1957
|
+
hideContinueControl(): void;
|
|
1958
|
+
turnOffControl(): void;
|
|
1959
|
+
turnOffLoader(): void;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
declare type SuccessCb = (data: any, status: number) => void;
|
|
1963
|
+
declare type ErrorCb = (err: any, status: number) => void;
|
|
1964
|
+
declare abstract class HttpCore {
|
|
1965
|
+
private env;
|
|
1966
|
+
constructor();
|
|
1967
|
+
setEnv(env: string, alias?: string): void;
|
|
1968
|
+
getEnv(): string;
|
|
1969
|
+
protected getUrl(): string;
|
|
1970
|
+
protected create(accessToken: string, data: any, cb: SuccessCb, errorCb: ErrorCb): void;
|
|
1971
|
+
protected get(accessToken: string, cb: SuccessCb, errorCb: ErrorCb): void;
|
|
1972
|
+
protected parser(text: any, status: number, cb: SuccessCb, errorCb: ErrorCb): void;
|
|
1973
|
+
protected abstract getLink(): string;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
interface IBody$1 {
|
|
1977
|
+
gateway_id: string;
|
|
1978
|
+
success_redirect_url: string;
|
|
1979
|
+
error_redirect_url: string;
|
|
1980
|
+
redirect_url: string;
|
|
1981
|
+
meta: IPayPalMeta;
|
|
1982
|
+
description?: string;
|
|
1983
|
+
}
|
|
1984
|
+
interface ICheckout {
|
|
1985
|
+
gateway_id: string;
|
|
1986
|
+
checkout_type: string;
|
|
1987
|
+
gateway_type: string;
|
|
1988
|
+
link: string;
|
|
1989
|
+
reference_id: string;
|
|
1990
|
+
token: string;
|
|
1991
|
+
mode?: string;
|
|
1992
|
+
}
|
|
1993
|
+
declare class Builder$1 extends HttpCore {
|
|
1994
|
+
private body;
|
|
1995
|
+
constructor(gatewayID: string, successRedirectUrl: string, errorRedirectUrl: string);
|
|
1996
|
+
protected getLink(): string;
|
|
1997
|
+
setDescriptions(text: string): void;
|
|
1998
|
+
setMeta(meta: IPayPalMeta): void;
|
|
1999
|
+
getConfigs(): IBody$1;
|
|
2000
|
+
send(publicKey: string, cb: (checkout: ICheckout) => void, errorCb?: (error: any, code: string) => void): void;
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
interface IDetails {
|
|
2004
|
+
checkout_email: string;
|
|
2005
|
+
checkout_holder: string;
|
|
2006
|
+
status: string;
|
|
2007
|
+
gateway_type: string;
|
|
2008
|
+
}
|
|
2009
|
+
declare class Checker extends HttpCore {
|
|
2010
|
+
token: string;
|
|
2011
|
+
constructor(token: string);
|
|
2012
|
+
protected getLink(): string;
|
|
2013
|
+
send(accessToken: string, cb: (details: IDetails) => void, errorCb?: (error: any) => void): void;
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
type AdditionalParams = Record<string, string | number | boolean>;
|
|
2017
|
+
interface IRunner {
|
|
2018
|
+
next(checkoutData: ICheckout, params?: AdditionalParams): void;
|
|
2019
|
+
error(error: string, code: string, cb: (close: boolean) => void): void;
|
|
2020
|
+
getSuccessRedirectUri(): string;
|
|
2021
|
+
getErrorRedirectUri(): string;
|
|
2022
|
+
setEnv(env: string, alias?: string): void;
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
interface IDispatcherData {
|
|
2026
|
+
message_source: string;
|
|
2027
|
+
event: string;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
interface IContextualRunner extends IRunner {
|
|
2031
|
+
run(): void;
|
|
2032
|
+
isRunning(): boolean;
|
|
2033
|
+
continue(): void;
|
|
2034
|
+
stop(): void;
|
|
2035
|
+
onStop(cb: () => void): void;
|
|
2036
|
+
onCheckout<T extends IDispatcherData>(event: string, cb: (checkout: ICheckout, data?: T) => void): void;
|
|
2037
|
+
setBackgroundTitle(text: string): void;
|
|
2038
|
+
setBackgroundDescription(text: string): void;
|
|
2039
|
+
turnOffBackdrop(): void;
|
|
2040
|
+
setSuspendedRedirectUri(uri: string): void;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
interface IRedirectRunner extends IRunner {
|
|
2044
|
+
setRedirectUrl(url: string): void;
|
|
2045
|
+
getRedirectUrl(): string;
|
|
2046
|
+
getProxyRedirectUrl(): string;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
interface CheckoutContextualHandlerParams {
|
|
2050
|
+
accessToken: string;
|
|
2051
|
+
gatewayId: string;
|
|
2052
|
+
}
|
|
2053
|
+
declare class CheckoutContextualHandler {
|
|
2054
|
+
protected background: Background;
|
|
2055
|
+
protected runner: IContextualRunner;
|
|
2056
|
+
protected eventEmitter: EventEmitter;
|
|
2057
|
+
protected params: CheckoutContextualHandlerParams;
|
|
2058
|
+
protected env: string;
|
|
2059
|
+
protected details: IDetails;
|
|
2060
|
+
constructor(background: Background, runner: IContextualRunner, eventEmitter: EventEmitter, params: CheckoutContextualHandlerParams);
|
|
2061
|
+
init(env: string): void;
|
|
2062
|
+
setEnv(env: string): void;
|
|
2063
|
+
protected checkToken(token: string, cb: () => void): void;
|
|
2064
|
+
protected createOneTimeToken(token: string): void;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* Class CheckoutButton transform usual button into checkout
|
|
2069
|
+
*
|
|
2070
|
+
* @constructor
|
|
2071
|
+
*
|
|
2072
|
+
* @param {string} selector - Selector of html element.
|
|
2073
|
+
* @param {string} aceessToken - PayDock access token or users public key
|
|
2074
|
+
* @param {string} [gatewayId=default] - PayDock's gatewayId. By default or if put 'default', it will use the selected default gateway
|
|
2075
|
+
* @param {string} [type=PaypalClassic] - Type of gateway (PaypalClassic, Zipmoney)
|
|
2076
|
+
* @example
|
|
2077
|
+
* var widget = new CheckoutButton('#button', 'accessToken','gatewayId');
|
|
2078
|
+
*/
|
|
2079
|
+
declare class CheckoutButton {
|
|
2080
|
+
protected accessToken: string;
|
|
2081
|
+
protected gatewayId: string;
|
|
2082
|
+
protected gatewayType: GATEWAY_TYPE;
|
|
2083
|
+
protected mode: CHECKOUT_MODE;
|
|
2084
|
+
protected window: Window;
|
|
2085
|
+
protected eventEmitter: EventEmitter;
|
|
2086
|
+
protected container: Container;
|
|
2087
|
+
protected meta: IPayPalMeta;
|
|
2088
|
+
protected runner: IContextualRunner | IRedirectRunner;
|
|
2089
|
+
protected background?: Background;
|
|
2090
|
+
protected checkoutHandler?: CheckoutContextualHandler;
|
|
2091
|
+
protected env: string;
|
|
2092
|
+
protected alias?: string;
|
|
2093
|
+
/** @constructs */ constructor(selector: string, accessToken: string, gatewayId?: string, gatewayType?: GATEWAY_TYPE, mode?: CHECKOUT_MODE);
|
|
2094
|
+
protected chooseRunner(gatewayType: GATEWAY_TYPE, mode: CHECKOUT_MODE): void;
|
|
2095
|
+
protected buildAdditionalParams(): AdditionalParams;
|
|
2096
|
+
protected initCheckout(container: Container): void;
|
|
2097
|
+
/**
|
|
2098
|
+
* This callback will be called for each event in payment source widget
|
|
2099
|
+
*
|
|
2100
|
+
* @callback listener
|
|
2101
|
+
*/
|
|
2102
|
+
/**
|
|
2103
|
+
* Listen to events of widget
|
|
2104
|
+
*
|
|
2105
|
+
* @example
|
|
2106
|
+
*
|
|
2107
|
+
* widget.on('click', function () {
|
|
2108
|
+
*
|
|
2109
|
+
* });
|
|
2110
|
+
* @param {string} eventName - Available event names [CHECKOUT_BUTTON_EVENT]{@link CHECKOUT_BUTTON_EVENT}
|
|
2111
|
+
* @param {listener} cb
|
|
2112
|
+
*/
|
|
2113
|
+
on<T = object>(name: string, handler: (data: T) => void): void;
|
|
2114
|
+
/**
|
|
2115
|
+
* Close popup window forcibly.
|
|
2116
|
+
* Only for 'contextual' mode.
|
|
2117
|
+
*
|
|
2118
|
+
*/
|
|
2119
|
+
close(): void;
|
|
2120
|
+
/**
|
|
2121
|
+
* After finish event of checkout button, data (dataType) will be insert to input (selector)
|
|
2122
|
+
*
|
|
2123
|
+
* @param {string} selector - css selector . [] #
|
|
2124
|
+
* @param {string} dataType - data type of IEventCheckoutFinishData [IEventCheckoutFinishData]{@link #IEventCheckoutFinishData}.
|
|
2125
|
+
*/
|
|
2126
|
+
onFinishInsert(selector: string, dataType: string): void;
|
|
2127
|
+
/**
|
|
2128
|
+
* Method for setting meta information for checkout page
|
|
2129
|
+
*
|
|
2130
|
+
* @example
|
|
2131
|
+
* button.setMeta({
|
|
2132
|
+
brand_name: 'paydock',
|
|
2133
|
+
reference: '15',
|
|
2134
|
+
email: 'wault@paydock.com'
|
|
2135
|
+
});
|
|
2136
|
+
*
|
|
2137
|
+
* @param {(IPayPalMeta|IAfterpayMeta|IZipmoneyMeta)} meta - Data which can be shown on checkout page [IPayPalMeta]{@link IPayPalMeta} [IZipmoneyMeta]{@link IZipmoneyMeta} [IAfterpayMeta]{@link IAfterpayMeta}
|
|
2138
|
+
*/
|
|
2139
|
+
setMeta(meta: IPayPalMeta | IAfterpayMeta | IZipmoneyMeta): void;
|
|
2140
|
+
/**
|
|
2141
|
+
* Method for setting backdrop description.
|
|
2142
|
+
* Only for 'contextual' mode.
|
|
2143
|
+
*
|
|
2144
|
+
* @example
|
|
2145
|
+
* button.setBackdropDescription('Custom description');
|
|
2146
|
+
*
|
|
2147
|
+
* @param {string} text - description which can be shown in overlay of back side checkout page
|
|
2148
|
+
*/
|
|
2149
|
+
setBackdropDescription(text: string): void;
|
|
2150
|
+
/**
|
|
2151
|
+
* Method for setting backdrop title.
|
|
2152
|
+
* Only for 'contextual' mode.
|
|
2153
|
+
*
|
|
2154
|
+
* @example
|
|
2155
|
+
* button.setBackdropTitle('Custom title');
|
|
2156
|
+
*
|
|
2157
|
+
* @param {text} string - title which can be shown in overlay of back side checkout page
|
|
2158
|
+
*/
|
|
2159
|
+
setBackdropTitle(text: string): void;
|
|
2160
|
+
/**
|
|
2161
|
+
* Method for setting suspended redirect uri. Redirect after referred checkout.
|
|
2162
|
+
* Only for 'contextual' mode.
|
|
2163
|
+
*
|
|
2164
|
+
* @param {uri} string - uri for redirect (by default)
|
|
2165
|
+
*/
|
|
2166
|
+
setSuspendedRedirectUri(uri: string): void;
|
|
2167
|
+
/**
|
|
2168
|
+
* Method for setting the merchant redirect URL.
|
|
2169
|
+
* Merchant's customers redirect after successfull checkout.
|
|
2170
|
+
* Only for 'redirect' mode.
|
|
2171
|
+
*
|
|
2172
|
+
* @param {url} string - redirect url
|
|
2173
|
+
*/
|
|
2174
|
+
setRedirectUrl(url: string): void;
|
|
2175
|
+
getSuccessRedirectUri(): string;
|
|
2176
|
+
/**
|
|
2177
|
+
* Method for disable backdrop on the page.
|
|
2178
|
+
* Only for 'contextual' mode.
|
|
2179
|
+
*
|
|
2180
|
+
* @example
|
|
2181
|
+
* button.turnOffBackdrop();
|
|
2182
|
+
*
|
|
2183
|
+
*/
|
|
2184
|
+
turnOffBackdrop(): void;
|
|
2185
|
+
protected turnOffControlBackdrop(): void;
|
|
2186
|
+
protected turnOffLoaderBackdrop(): void;
|
|
2187
|
+
setEnv(env: string, alias?: string): void;
|
|
2188
|
+
getEnv(): string;
|
|
2189
|
+
private getRunnerByMode;
|
|
2190
|
+
private assertMethodSupport;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
interface ZipmoneyRunnerParams extends AdditionalParams {
|
|
2194
|
+
gateway_id: string;
|
|
2195
|
+
public_key: string;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
/**
|
|
2199
|
+
* Class ZipmoneyCheckoutButton is wrapper of CheckoutButton transform usual button into checkout
|
|
2200
|
+
*
|
|
2201
|
+
* @extends CheckoutButton
|
|
2202
|
+
*
|
|
2203
|
+
* @constructor
|
|
2204
|
+
*
|
|
2205
|
+
* @param {string} selector - Selector of html element.
|
|
2206
|
+
* @param {string} publicKey - PayDock users public key
|
|
2207
|
+
* @param {string} [gatewayId=default] - PayDock's gatewayId. By default or if put 'default', it will use the selected default gateway
|
|
2208
|
+
* @param {string} [gatewayId=default] - Checkout mode, it could be set to 'contextual' or 'redirect'. By default it 'contextual'
|
|
2209
|
+
* @example
|
|
2210
|
+
* var widget = new ZipmoneyCheckoutButton('#button', 'publicKey','gatewayId');
|
|
2211
|
+
*/
|
|
2212
|
+
declare class ZipmoneyCheckoutButton extends CheckoutButton {
|
|
2213
|
+
protected publicKey: string;
|
|
2214
|
+
protected gatewayId: string;
|
|
2215
|
+
protected mode: CHECKOUT_MODE;
|
|
2216
|
+
/** @constructs */ constructor(selector: string, publicKey: string, gatewayId?: string, mode?: CHECKOUT_MODE);
|
|
2217
|
+
/**
|
|
2218
|
+
* Method for setting suspended redirect uri. Redirect after referred checkout
|
|
2219
|
+
*
|
|
2220
|
+
* The URI is used for a redirect after the checkout is complete.
|
|
2221
|
+
* This can be provided, even if using in-context checkout (sdk). By default, the standard styled page will be used.
|
|
2222
|
+
* If using in-context (sdk) we will not automatically redirect to this URI.
|
|
2223
|
+
*
|
|
2224
|
+
|
|
2225
|
+
* @param {uri} string - uri for suspended redirect (by default)
|
|
2226
|
+
*/
|
|
2227
|
+
setSuspendedRedirectUri(uri: string): void;
|
|
2228
|
+
/**
|
|
2229
|
+
* Method for setting the merchant redirect URL.
|
|
2230
|
+
* The merchant's customers would be redirected to the specified URL
|
|
2231
|
+
* at the end of ZipMoney checkout flow.
|
|
2232
|
+
*
|
|
2233
|
+
* Once the redirect URL would be set, the checkout flow would be immediately switched
|
|
2234
|
+
* from 'contextual' mode to the 'redirect' mode.
|
|
2235
|
+
* The merchant's customer would be automatically redirected to this URL after the checkout is complete.
|
|
2236
|
+
*
|
|
2237
|
+
* @param {url} string - URL for redirect
|
|
2238
|
+
*/
|
|
2239
|
+
setRedirectUrl(url: string): void;
|
|
2240
|
+
protected buildAdditionalParams(): ZipmoneyRunnerParams;
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
/**
|
|
2244
|
+
* Class AfterpayCheckoutButton is wrapper of CheckoutButton transform usual button into checkout
|
|
2245
|
+
*
|
|
2246
|
+
* @extends CheckoutButton
|
|
2247
|
+
*
|
|
2248
|
+
* @constructor
|
|
2249
|
+
*
|
|
2250
|
+
* @param {string} selector - Selector of html element.
|
|
2251
|
+
* @param {string} accessToken - PayDock access-token or users public key
|
|
2252
|
+
* @param {string} [gatewayId=default] - PayDock's gatewayId. By default or if put 'default', it will use the selected default gateway
|
|
2253
|
+
* @example
|
|
2254
|
+
* var widget = new AfterpayCheckoutButton('#button', 'access-token','gatewayId');
|
|
2255
|
+
*/
|
|
2256
|
+
declare class AfterpayCheckoutButton extends CheckoutButton {
|
|
2257
|
+
protected accessToken: string;
|
|
2258
|
+
protected gatewayId: string;
|
|
2259
|
+
protected showETP: boolean;
|
|
2260
|
+
/** @constructs */ constructor(selector: string, accessToken: string, gatewayId?: string);
|
|
2261
|
+
/**
|
|
2262
|
+
* Method which toggles the "Enhanced Tracking Protection" warning popup to 'on' mode.
|
|
2263
|
+
*
|
|
2264
|
+
* This popup with a warning about "Enhanced Tracking Protection" limitations
|
|
2265
|
+
* would be shown in the Mozilla Firefox browser version 100+
|
|
2266
|
+
*
|
|
2267
|
+
* By default, the popup would not be shown, until
|
|
2268
|
+
* the flag would be set to `true`
|
|
2269
|
+
|
|
2270
|
+
* @param {doShow} boolean - flag which toggle the popup visibility
|
|
2271
|
+
*/
|
|
2272
|
+
showEnhancedTrackingProtectionPopup(doShow: boolean): void;
|
|
2273
|
+
protected buildAdditionalParams(): AdditionalParams;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
/**
|
|
2277
|
+
* Class PaypalCheckoutButton is wrapper of CheckoutButton transform usual button into checkout
|
|
2278
|
+
*
|
|
2279
|
+
* @extends CheckoutButton
|
|
2280
|
+
*
|
|
2281
|
+
* @constructor
|
|
2282
|
+
*
|
|
2283
|
+
* @param {string} selector - Selector of html element.
|
|
2284
|
+
* @param {string} publicKey - PayDock users public key
|
|
2285
|
+
* @param {string} [gatewayId=default] - PayDock's gatewayId. By default or if put 'default', it will use the selected default gateway
|
|
2286
|
+
* @example
|
|
2287
|
+
* var widget = new PaypalCheckoutButton('#button', 'publicKey','gatewayId');
|
|
2288
|
+
*/
|
|
2289
|
+
declare class PaypalCheckoutButton extends CheckoutButton {
|
|
2290
|
+
protected publicKey: string;
|
|
2291
|
+
protected gatewayId: string;
|
|
2292
|
+
/** @constructs */ constructor(selector: string, publicKey: string, gatewayId?: string);
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
type Mode = (typeof MODES)[number];
|
|
2296
|
+
declare const MODES: readonly ["live", "test"];
|
|
2297
|
+
type FraudPreventionProvider = (typeof PROVIDERS)[keyof typeof PROVIDERS];
|
|
2298
|
+
declare const PROVIDERS: {
|
|
2299
|
+
readonly FORTER: "forter";
|
|
2300
|
+
};
|
|
2301
|
+
|
|
2302
|
+
declare const NAMESPACE = "fraudPrevention";
|
|
2303
|
+
declare const TYPES: {
|
|
2304
|
+
readonly FINGERPRINT_TOKEN_ERROR: "fingerprint-token-error";
|
|
2305
|
+
readonly FINTERPRINT_TOKEN_READY: "fingerprint-token-ready";
|
|
2306
|
+
};
|
|
2307
|
+
declare const FRAUD_PREVENTION_EVENTS: {
|
|
2308
|
+
readonly NAMESPACE: "fraudPrevention";
|
|
2309
|
+
readonly TYPES: {
|
|
2310
|
+
readonly FINGERPRINT_TOKEN_ERROR: "fingerprint-token-error";
|
|
2311
|
+
readonly FINTERPRINT_TOKEN_READY: "fingerprint-token-ready";
|
|
2312
|
+
};
|
|
2313
|
+
readonly PROVIDERS: {
|
|
2314
|
+
readonly FORTER: "forter";
|
|
2315
|
+
};
|
|
2316
|
+
};
|
|
2317
|
+
type FraudPreventionEventType = (typeof TYPES)[keyof typeof TYPES];
|
|
2318
|
+
type FraudPreventionEventFingerprintTokenReady = {
|
|
2319
|
+
type: Extract<FraudPreventionEventType, 'fingerprint-token-ready'>;
|
|
2320
|
+
provider: FraudPreventionProvider;
|
|
2321
|
+
payload: {
|
|
2322
|
+
token: string;
|
|
2323
|
+
};
|
|
2324
|
+
};
|
|
2325
|
+
type FraudPreventionEventFingerprintTokenError = {
|
|
2326
|
+
type: Extract<FraudPreventionEventType, 'fingerprint-token-error'>;
|
|
2327
|
+
provider: FraudPreventionProvider;
|
|
2328
|
+
payload: {
|
|
2329
|
+
code: 'unexpected_token_type';
|
|
2330
|
+
message: string;
|
|
2331
|
+
};
|
|
2332
|
+
};
|
|
2333
|
+
type FraudPreventionEvent = FraudPreventionEventFingerprintTokenReady | FraudPreventionEventFingerprintTokenError;
|
|
2334
|
+
interface IFraudPreventionEventMap {
|
|
2335
|
+
[NAMESPACE]: CustomEvent<FraudPreventionEvent>;
|
|
2336
|
+
}
|
|
2337
|
+
declare global {
|
|
2338
|
+
interface DocumentEventMap extends IFraudPreventionEventMap {
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
type ResultFailure<F> = Readonly<[null, F]>;
|
|
2343
|
+
type ResultSuccess<S> = Readonly<[S, null]>;
|
|
2344
|
+
type Result<S = unknown, F = unknown> = ResultFailure<F> | ResultSuccess<S>;
|
|
2345
|
+
|
|
2346
|
+
/**
|
|
2347
|
+
* Configuration options for the Forter Device Agent
|
|
2348
|
+
*
|
|
2349
|
+
* @typedef {Object} ForterDeviceAgentConfig
|
|
2350
|
+
* @property {string} siteId - Your Forter site ID or subsite merchant ID
|
|
2351
|
+
* @property {boolean} csp - Set to true if your site uses Content-Security-Policy
|
|
2352
|
+
* @property {'live' | 'test'} mode - Environment mode, must be either 'live' or 'test'
|
|
2353
|
+
*/
|
|
2354
|
+
type ForterDeviceAgentConfig = {
|
|
2355
|
+
siteId: string;
|
|
2356
|
+
csp: boolean;
|
|
2357
|
+
mode: Mode;
|
|
2358
|
+
};
|
|
2359
|
+
/**
|
|
2360
|
+
* A class that manages Forter's device fingerprinting integration.
|
|
2361
|
+
* It handles script injection and token management.
|
|
2362
|
+
*
|
|
2363
|
+
* @example
|
|
2364
|
+
*
|
|
2365
|
+
* ```js
|
|
2366
|
+
* const agent = new ForterDeviceAgent({
|
|
2367
|
+
* siteId: 'your-site-id',
|
|
2368
|
+
* csp: false,
|
|
2369
|
+
* mode: 'test'
|
|
2370
|
+
* }).init();
|
|
2371
|
+
*
|
|
2372
|
+
* // Later, access the token
|
|
2373
|
+
* const token = agent.token;
|
|
2374
|
+
* ```
|
|
2375
|
+
*/
|
|
2376
|
+
declare class ForterDeviceAgent {
|
|
2377
|
+
private readonly config;
|
|
2378
|
+
private cookieToken;
|
|
2379
|
+
/**
|
|
2380
|
+
* Creates a new instance of ForterDeviceAgent
|
|
2381
|
+
*
|
|
2382
|
+
* @param {ForterDeviceAgentConfig} config - Configuration object for Forter integration
|
|
2383
|
+
*/
|
|
2384
|
+
constructor(config: ForterDeviceAgentConfig);
|
|
2385
|
+
/**
|
|
2386
|
+
* Returns the current Forter token if available
|
|
2387
|
+
*
|
|
2388
|
+
* @returns {string | null} The Forter token or null if not yet available
|
|
2389
|
+
*
|
|
2390
|
+
* @example
|
|
2391
|
+
*
|
|
2392
|
+
* ```js
|
|
2393
|
+
* const token = forterAgent.token;
|
|
2394
|
+
* if (token) {
|
|
2395
|
+
* // Use the token
|
|
2396
|
+
* }
|
|
2397
|
+
* ```
|
|
2398
|
+
*/
|
|
2399
|
+
get token(): string | null;
|
|
2400
|
+
/**
|
|
2401
|
+
* Initializes the Forter Device Agent by injecting the required script
|
|
2402
|
+
* and setting up event listeners.
|
|
2403
|
+
*
|
|
2404
|
+
* @returns {ForterDeviceAgent} The current instance for method chaining
|
|
2405
|
+
*
|
|
2406
|
+
* @example
|
|
2407
|
+
*
|
|
2408
|
+
* ```js
|
|
2409
|
+
* const agent = new ForterDeviceAgent(config).init();
|
|
2410
|
+
* ```
|
|
2411
|
+
*/
|
|
2412
|
+
init(): ForterDeviceAgent;
|
|
2413
|
+
private emit;
|
|
2414
|
+
private emitFingerprintTokenWrongTypeError;
|
|
2415
|
+
private emitFingerprintTokenReady;
|
|
2416
|
+
private getScriptContent;
|
|
2417
|
+
private injectScript;
|
|
2418
|
+
private subscribeSdkEvents;
|
|
2419
|
+
private validateCsp;
|
|
2420
|
+
private validateMode;
|
|
2421
|
+
private validateSiteId;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
type FraudPreventionConfig = {
|
|
2425
|
+
mode: Mode;
|
|
2426
|
+
environmentAlias?: string;
|
|
2427
|
+
environmentId: string;
|
|
2428
|
+
};
|
|
2429
|
+
/**
|
|
2430
|
+
* A class to manage integration fraud prevention integrations.
|
|
2431
|
+
*
|
|
2432
|
+
* @example
|
|
2433
|
+
*
|
|
2434
|
+
* ```js
|
|
2435
|
+
* const fps = new FraudPreventionService({
|
|
2436
|
+
* environmentId: 'production',
|
|
2437
|
+
* mode: 'live',
|
|
2438
|
+
* });
|
|
2439
|
+
* ```
|
|
2440
|
+
*/
|
|
2441
|
+
declare class FraudPreventionService {
|
|
2442
|
+
private readonly environment;
|
|
2443
|
+
private readonly httpFetcherFactory;
|
|
2444
|
+
private readonly mode;
|
|
2445
|
+
private authorizationStrategy;
|
|
2446
|
+
private forterDeviceAgent;
|
|
2447
|
+
/**
|
|
2448
|
+
* @constructs
|
|
2449
|
+
*
|
|
2450
|
+
* @param {Object} config - FraudPreventionService configuration object
|
|
2451
|
+
* @param {string} config.mode - Environment mode, must be either 'test' or 'live'
|
|
2452
|
+
* @param {string} config.environmentId - Environment identifier
|
|
2453
|
+
* @param {string} [config.environmentAlias] - Optional environment alias for API requests
|
|
2454
|
+
*/
|
|
2455
|
+
constructor(config: FraudPreventionConfig);
|
|
2456
|
+
/**
|
|
2457
|
+
* Automatically detects and sets the authorization strategy the service should use
|
|
2458
|
+
* based on the shape of the provided string.
|
|
2459
|
+
*
|
|
2460
|
+
* If the value is a JWT token, it will use an access token strategy, otherwise it will use
|
|
2461
|
+
* a public key strategy.
|
|
2462
|
+
*
|
|
2463
|
+
* @param value - The authorization value (either JWT token or public key)
|
|
2464
|
+
*
|
|
2465
|
+
* @returns The FraudPreventionService instance for method chaining
|
|
2466
|
+
*
|
|
2467
|
+
* @example
|
|
2468
|
+
* ```ts
|
|
2469
|
+
* // With JWT token
|
|
2470
|
+
* fps.withAuthorization('eyJhbGciOiJIUzI1NiIs...');
|
|
2471
|
+
*
|
|
2472
|
+
* // With public key
|
|
2473
|
+
* fps.withAuthorization('pk_example_...');
|
|
2474
|
+
* ```
|
|
2475
|
+
*/
|
|
2476
|
+
withAuthorization(value: string): FraudPreventionService;
|
|
2477
|
+
/**
|
|
2478
|
+
* Sets the authorization strategy to use access token authentication.
|
|
2479
|
+
*
|
|
2480
|
+
* @param accessToken - The JWT access token
|
|
2481
|
+
* @returns The FraudPreventionService instance for method chaining
|
|
2482
|
+
*
|
|
2483
|
+
* @example
|
|
2484
|
+
*
|
|
2485
|
+
* ```ts
|
|
2486
|
+
* fps.withAccessTokenStrategy('eyJhbGciOiJIUzI1NiIs...');
|
|
2487
|
+
* ```
|
|
2488
|
+
*/
|
|
2489
|
+
withAccessTokenStrategy(accessToken: string): FraudPreventionService;
|
|
2490
|
+
/**
|
|
2491
|
+
* Sets the authorization strategy to use public key authentication.
|
|
2492
|
+
*
|
|
2493
|
+
* @param publicKey - The public key
|
|
2494
|
+
* @returns The FraudPreventionService instance for method chaining
|
|
2495
|
+
*
|
|
2496
|
+
* @example
|
|
2497
|
+
*
|
|
2498
|
+
* ```ts
|
|
2499
|
+
* fps.withPublicKeyStrategy('pk_example_...');
|
|
2500
|
+
* ```
|
|
2501
|
+
*/
|
|
2502
|
+
withPublicKeyStrategy(publicKey: string): FraudPreventionService;
|
|
2503
|
+
/**
|
|
2504
|
+
* Initializes Forter integration with the provided configuration. This method injects
|
|
2505
|
+
* Forter's JavaScript snippet into the page and starts tracking user behavior.
|
|
2506
|
+
*
|
|
2507
|
+
* @param {Object} config - Configuration object for Forter integration
|
|
2508
|
+
* @param {string} [config.siteId] - Your Forter site ID or subsite merchant ID
|
|
2509
|
+
* @param {string} [config.providerId] - Your Paydock integrated Forter Service ID.
|
|
2510
|
+
* @param {boolean} [config.csp] - Set to true if your site uses Content-Security-Policies
|
|
2511
|
+
*
|
|
2512
|
+
* @throws If neither siteId nor providerId are provided in the configuration
|
|
2513
|
+
* @throws If providerId fails to resolve to a siteId through Paydock integration services
|
|
2514
|
+
*
|
|
2515
|
+
* @returns Promise with existing FraudPreventionService instance
|
|
2516
|
+
*
|
|
2517
|
+
* @example
|
|
2518
|
+
*
|
|
2519
|
+
* ```js
|
|
2520
|
+
* await fps.withForter({
|
|
2521
|
+
* providerId: 'your-paydock-forter-service-id'
|
|
2522
|
+
* });
|
|
2523
|
+
* ```
|
|
2524
|
+
*
|
|
2525
|
+
* @example
|
|
2526
|
+
*
|
|
2527
|
+
* ```js
|
|
2528
|
+
* await fps.withForter({
|
|
2529
|
+
* siteId: 'your-forter-site-id',
|
|
2530
|
+
* });
|
|
2531
|
+
* ```
|
|
2532
|
+
*/
|
|
2533
|
+
withForter(config: {
|
|
2534
|
+
csp?: boolean;
|
|
2535
|
+
} & ({
|
|
2536
|
+
siteId: string;
|
|
2537
|
+
providerId?: never;
|
|
2538
|
+
} | {
|
|
2539
|
+
siteId?: never;
|
|
2540
|
+
providerId: string;
|
|
2541
|
+
})): Promise<this>;
|
|
2542
|
+
/**
|
|
2543
|
+
* Returns the initialized Forter device agent instance if available.
|
|
2544
|
+
*
|
|
2545
|
+
* Make sure to call withForter() before accessing this getter.
|
|
2546
|
+
*
|
|
2547
|
+
* @returns {ForterDeviceAgent | null} The Forter device agent instance or null if not initialized
|
|
2548
|
+
*
|
|
2549
|
+
* @example
|
|
2550
|
+
*
|
|
2551
|
+
* ```js
|
|
2552
|
+
* const fps = new FraudPreventionService();
|
|
2553
|
+
*
|
|
2554
|
+
* fps.withForter({
|
|
2555
|
+
* siteId: 'your-site-id',
|
|
2556
|
+
* mode: 'test'
|
|
2557
|
+
* });
|
|
2558
|
+
*
|
|
2559
|
+
* const token = fps.forter?.token;
|
|
2560
|
+
* ```
|
|
2561
|
+
*/
|
|
2562
|
+
get forter(): ForterDeviceAgent | null;
|
|
2563
|
+
/**
|
|
2564
|
+
* Gets the credentials for a specific fraud prevention provider.
|
|
2565
|
+
*
|
|
2566
|
+
* Returns different credential types based on the selected provider.
|
|
2567
|
+
*
|
|
2568
|
+
* @param provider - The fraud prevention provider
|
|
2569
|
+
* @param providerId - The ID of the provider instance
|
|
2570
|
+
*
|
|
2571
|
+
* @returns a tuple with shape [providerSpecificCredentials, error]
|
|
2572
|
+
*/
|
|
2573
|
+
getProviderCredentials<P extends FraudPreventionProvider>(provider: P, providerId: string): Promise<Result<P extends "forter" ? {
|
|
2574
|
+
provider: "forter";
|
|
2575
|
+
siteId: string;
|
|
2576
|
+
subsiteId: string;
|
|
2577
|
+
} : never, unknown>>;
|
|
2578
|
+
private validateEnvironmentId;
|
|
2579
|
+
private validateEnvironmentAlias;
|
|
2580
|
+
private validateMode;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
/**
|
|
2584
|
+
*
|
|
2585
|
+
* Class PaymentSourceWidget include method for for creating iframe url
|
|
2586
|
+
* @constructor
|
|
2587
|
+
*
|
|
2588
|
+
* @param {string} publicKey - PayDock users public key
|
|
2589
|
+
* @param {string} customer - PayDock's customer_id or customer_reference (In order to use the customer_reference, you must explicitly specify useReference as true)
|
|
2590
|
+
* @param {boolean} [useReference=false]
|
|
2591
|
+
*
|
|
2592
|
+
* @example
|
|
2593
|
+
* var widget = new PaymentSourceWidget('publicKey','customerId');
|
|
2594
|
+
* // or
|
|
2595
|
+
* var widget = new PaymentSourceWidget('publicKey', customerReference, true);
|
|
2596
|
+
*/
|
|
2597
|
+
declare class PaymentSourceWidget {
|
|
2598
|
+
protected link: Link;
|
|
2599
|
+
protected configs: Configuration[];
|
|
2600
|
+
protected configTokens: string[];
|
|
2601
|
+
protected publicKey: string;
|
|
2602
|
+
/** @constructs */ constructor(accessToken: string, queryToken: string);
|
|
2603
|
+
/**
|
|
2604
|
+
* Object contain styles for widget
|
|
2605
|
+
*
|
|
2606
|
+
* @example
|
|
2607
|
+
* widget.setStyles({
|
|
2608
|
+
* background_color: 'rgb(0, 0, 0)',
|
|
2609
|
+
* border_color: 'yellow',
|
|
2610
|
+
* text_color: '#FFFFAA',
|
|
2611
|
+
* icon_size: 'small',
|
|
2612
|
+
* font_size: '20px'
|
|
2613
|
+
* });
|
|
2614
|
+
* @param {IStyles} fields - name of styles which can be shown in widget [STYLE]{@link STYLE}
|
|
2615
|
+
*/
|
|
2616
|
+
setStyles(styles: IStyles$1): void;
|
|
2617
|
+
setStyle(param: string, value: string): void;
|
|
2618
|
+
/**
|
|
2619
|
+
* Current method can set custom ID to identify the data in the future
|
|
2620
|
+
*
|
|
2621
|
+
* @example
|
|
2622
|
+
* widget.setRefId('id');
|
|
2623
|
+
*
|
|
2624
|
+
* @param {string} refId - custom id
|
|
2625
|
+
*/
|
|
2626
|
+
setRefId(refId: string): void;
|
|
2627
|
+
/**
|
|
2628
|
+
* Current method can set limit for payment sources count. In case when limit sets less then general count will be shown pagination buttons prev and next.
|
|
2629
|
+
*
|
|
2630
|
+
* @param {string} count - payment source count
|
|
2631
|
+
*/
|
|
2632
|
+
setLimit(count: number): void;
|
|
2633
|
+
/**
|
|
2634
|
+
* Current method can change environment. By default environment = sandbox
|
|
2635
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
2636
|
+
*
|
|
2637
|
+
* @example
|
|
2638
|
+
* widget.setEnv('production');
|
|
2639
|
+
* @param {string} env - sandbox, production
|
|
2640
|
+
* @param {string} [alias] - Own domain alias
|
|
2641
|
+
*/
|
|
2642
|
+
setEnv(env: string, alias?: string): void;
|
|
2643
|
+
getEnv(): void;
|
|
2644
|
+
/**
|
|
2645
|
+
* Method for getting iframe's url
|
|
2646
|
+
*/
|
|
2647
|
+
getIFrameUrl(): string;
|
|
2648
|
+
/**
|
|
2649
|
+
* Show payment source inside widget only with requested gateway ids
|
|
2650
|
+
*
|
|
2651
|
+
*
|
|
2652
|
+
* @param {string[]} ids - List of gateway_id
|
|
2653
|
+
*/
|
|
2654
|
+
filterByGatewayIds(ids: string[]): void;
|
|
2655
|
+
/**
|
|
2656
|
+
*
|
|
2657
|
+
* Show payment source inside widget only with requested payment source types
|
|
2658
|
+
*
|
|
2659
|
+
* @param types - List of payment source types. Available parameters [PAYMENT_TYPE]{@link PAYMENT_TYPE}
|
|
2660
|
+
*/
|
|
2661
|
+
filterByTypes(types: string[]): void;
|
|
2662
|
+
/**
|
|
2663
|
+
* Method for setting a custom language code
|
|
2664
|
+
*
|
|
2665
|
+
* @example
|
|
2666
|
+
* config.setLanguage('en');
|
|
2667
|
+
* @param {string} code - ISO 639-1
|
|
2668
|
+
*/
|
|
2669
|
+
setLanguage(code: any): void;
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
interface IEventSelectData extends IEventData$1 {
|
|
2673
|
+
customer_id: string;
|
|
2674
|
+
payment_source_id: string;
|
|
2675
|
+
gateway_id: string;
|
|
2676
|
+
primary: boolean;
|
|
2677
|
+
card_number_last4?: string;
|
|
2678
|
+
card_scheme?: string;
|
|
2679
|
+
checkout_email?: string;
|
|
2680
|
+
gateway_type?: string;
|
|
2681
|
+
payment_source_type: string;
|
|
2682
|
+
account_name?: string;
|
|
2683
|
+
account_number?: string;
|
|
2684
|
+
}
|
|
2685
|
+
interface IEventPaginationData extends IEventData$1 {
|
|
2686
|
+
total_item: number;
|
|
2687
|
+
skip: number;
|
|
2688
|
+
limit: number;
|
|
2689
|
+
}
|
|
2690
|
+
interface IEventAfterLoadData extends IEventData$1 {
|
|
2691
|
+
total_item: number;
|
|
2692
|
+
skip: number;
|
|
2693
|
+
limit: number;
|
|
2694
|
+
}
|
|
2695
|
+
interface IEventSizeData extends IEventData$1 {
|
|
2696
|
+
height: number;
|
|
2697
|
+
width: number;
|
|
2698
|
+
}
|
|
2699
|
+
/**
|
|
2700
|
+
* Interface of data from event.
|
|
2701
|
+
*
|
|
2702
|
+
* @interface IEventSelectData
|
|
2703
|
+
*
|
|
2704
|
+
* @param {string} event
|
|
2705
|
+
* @param {string} purpose
|
|
2706
|
+
* @param {string} message_source
|
|
2707
|
+
* @param {string} [ref_id]
|
|
2708
|
+
* @param {string} customer_id
|
|
2709
|
+
* @param {string} payment_source_id
|
|
2710
|
+
* @param {string} gateway_id
|
|
2711
|
+
* @param {boolean} primary
|
|
2712
|
+
* @param {string} [widget_id]
|
|
2713
|
+
* @param {string} [card_number_last4]
|
|
2714
|
+
* @param {string} [card_scheme]
|
|
2715
|
+
* @param {string} gateway_type
|
|
2716
|
+
* @param {string} [checkout_email]
|
|
2717
|
+
* @param {string} payment_source_type
|
|
2718
|
+
* @param {string} [account_name]
|
|
2719
|
+
* @param {string} [account_number]
|
|
2720
|
+
* */
|
|
2721
|
+
/**
|
|
2722
|
+
* Interface of data from event.
|
|
2723
|
+
*
|
|
2724
|
+
* @interface IEventPaginationData
|
|
2725
|
+
*
|
|
2726
|
+
* @param {string} event
|
|
2727
|
+
* @param {string} purpose
|
|
2728
|
+
* @param {string} message_source
|
|
2729
|
+
* @param {string} [ref_id]
|
|
2730
|
+
* @param {number} total_item
|
|
2731
|
+
* @param {number} skip
|
|
2732
|
+
* @param {number} limit
|
|
2733
|
+
* */
|
|
2734
|
+
/**
|
|
2735
|
+
* Interface of data from event.
|
|
2736
|
+
*
|
|
2737
|
+
* @interface IEventAfterLoadData
|
|
2738
|
+
*
|
|
2739
|
+
* @param {string} event The name of the event.
|
|
2740
|
+
* @param {string} purpose A system variable that states the purpose of the event.
|
|
2741
|
+
* @param {string} message_source A system variable that identifies the event source.
|
|
2742
|
+
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
|
|
2743
|
+
* @param {number} total_item Pagination param. Total item count
|
|
2744
|
+
* @param {number} skip Pagination param. Skip items from first item
|
|
2745
|
+
* @param {number} limit Pagination param. Query limit
|
|
2746
|
+
* */
|
|
2747
|
+
/**
|
|
2748
|
+
* Interface of data from event.
|
|
2749
|
+
* @interface IEventFinishData
|
|
2750
|
+
*
|
|
2751
|
+
* @param {string} event The name of the event.
|
|
2752
|
+
* @param {string} purpose A system variable that states the purpose of the event.
|
|
2753
|
+
* @param {string} message_source A system variable that identifies the event source.
|
|
2754
|
+
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
|
|
2755
|
+
* */
|
|
2756
|
+
/**
|
|
2757
|
+
* Interface of data from event.
|
|
2758
|
+
* @interface IEventSizeData
|
|
2759
|
+
*
|
|
2760
|
+
* @param {number} event The name of the event.
|
|
2761
|
+
* @param {number} purpose A system variable that states the purpose of the event.
|
|
2762
|
+
* @param {string} message_source A system variable that identifies the event source.
|
|
2763
|
+
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
|
|
2764
|
+
* @param {number} height Height of iFrame
|
|
2765
|
+
* @param {number} width Width of iFrame
|
|
2766
|
+
* */
|
|
2767
|
+
/**
|
|
2768
|
+
* List of available event's name
|
|
2769
|
+
*
|
|
2770
|
+
* @const EVENT
|
|
2771
|
+
*
|
|
2772
|
+
* @type {object}
|
|
2773
|
+
* @param {string} AFTER_LOAD=afterLoad
|
|
2774
|
+
* @param {string} SYSTEM_ERROR=systemError
|
|
2775
|
+
* @param {string} SELECT=select
|
|
2776
|
+
* @param {string} UNSELECT=unselect
|
|
2777
|
+
* @param {string} NEXT=next
|
|
2778
|
+
* @param {string} PREV=prev
|
|
2779
|
+
* @param {string} META_CHANGE=metaChange
|
|
2780
|
+
* @param {string} RESIZE=resize
|
|
2781
|
+
*/
|
|
2782
|
+
/**
|
|
2783
|
+
* Class HtmlPaymentSourceWidget include method for working on html
|
|
2784
|
+
* @constructor
|
|
2785
|
+
* @extends PaymentSourceWidget
|
|
2786
|
+
*
|
|
2787
|
+
* @param {string} selector - Selector of html element. Container for widget
|
|
2788
|
+
* @param {string} publicKey - PayDock users public key
|
|
2789
|
+
* @param {string} queryToken - PayDock's query token that represents params to search customer by id or reference
|
|
2790
|
+
* @example
|
|
2791
|
+
* * var widget = new HtmlPaymentSourceWidget('#widget', 'publicKey','queryToken');
|
|
2792
|
+
|
|
2793
|
+
*/
|
|
2794
|
+
declare class HtmlPaymentSourceWidget extends PaymentSourceWidget {
|
|
2795
|
+
protected container: Container;
|
|
2796
|
+
protected iFrame: IFrame;
|
|
2797
|
+
protected event: IFrameEvent;
|
|
2798
|
+
/** @constructs */ constructor(selector: string, publicKey: string, queryToken: string);
|
|
2799
|
+
/**
|
|
2800
|
+
* The final method to beginning, the load process of widget to html
|
|
2801
|
+
*
|
|
2802
|
+
*/
|
|
2803
|
+
load(): void;
|
|
2804
|
+
/**
|
|
2805
|
+
* This callback will be called for each event in payment source widget
|
|
2806
|
+
*
|
|
2807
|
+
* @callback listener--PaymentSourceWidget
|
|
2808
|
+
* @param {IEventData | IEventSelectData | IEventPaginationData | IEventAfterLoadData} response
|
|
2809
|
+
*/
|
|
2810
|
+
/**
|
|
2811
|
+
* Listen to events of widget
|
|
2812
|
+
*
|
|
2813
|
+
* @example
|
|
2814
|
+
*
|
|
2815
|
+
* widget.on('select', function (data) {
|
|
2816
|
+
* console.log(data);
|
|
2817
|
+
* });
|
|
2818
|
+
* @param {string} eventName - Available event names [EVENT]{@link EVENT}
|
|
2819
|
+
* @param {listener--PaymentSourceWidget} cb
|
|
2820
|
+
*/
|
|
2821
|
+
on(eventName: string, cb: (data: IEventData$1 | IEventSelectData | IEventPaginationData | IEventAfterLoadData | IEventSizeData) => void): void;
|
|
2822
|
+
/**
|
|
2823
|
+
* Using this method you can hide widget after load
|
|
2824
|
+
* @param {boolean} [saveSize=false] - using this param you can save iframe's size
|
|
2825
|
+
*/
|
|
2826
|
+
hide(saveSize: boolean): void;
|
|
2827
|
+
/**
|
|
2828
|
+
* Using this method you can show widget after using hide method
|
|
2829
|
+
*
|
|
2830
|
+
*/
|
|
2831
|
+
show(): void;
|
|
2832
|
+
/**
|
|
2833
|
+
* Using this method you can reload widget
|
|
2834
|
+
*
|
|
2835
|
+
*/
|
|
2836
|
+
reload(): void;
|
|
2837
|
+
/**
|
|
2838
|
+
* After select event of widget, data (dataType) will be insert to input (selector)
|
|
2839
|
+
*
|
|
2840
|
+
* @param {string} selector - css selector . [] #
|
|
2841
|
+
* @param {string} dataType - data type of [IEventSelectData]{@link IEventSelectData}.
|
|
2842
|
+
*/
|
|
2843
|
+
onSelectInsert(selector: string, dataType: string): void;
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
declare const TYPE: {
|
|
2847
|
+
EXTERNAL_CHECKOUT_TOKEN: string;
|
|
2848
|
+
CHECKOUT_TOKEN: string;
|
|
2849
|
+
BANK_ACCOUNT: string;
|
|
2850
|
+
CARD: string;
|
|
2851
|
+
};
|
|
2852
|
+
interface IBody {
|
|
2853
|
+
gateway_id: string;
|
|
2854
|
+
type: string;
|
|
2855
|
+
checkout_token?: string;
|
|
2856
|
+
}
|
|
2857
|
+
declare class Builder extends HttpCore {
|
|
2858
|
+
private body;
|
|
2859
|
+
constructor(gatewayID: string, checkoutToken: string, type: string);
|
|
2860
|
+
constructor(gatewayID: string, externalCheckoutToken: string, type: string);
|
|
2861
|
+
constructor(gatewayID: string, card: any, type: string);
|
|
2862
|
+
constructor(gatewayID: string, bankAccount: any, type: string);
|
|
2863
|
+
protected getLink(): string;
|
|
2864
|
+
send(accessToken: string, cb: (token: string) => void, errorCb?: (error: any) => void): void;
|
|
2865
|
+
getConfigs(): IBody;
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
interface IBaseSRCMeta {
|
|
2869
|
+
customizations?: IStyles;
|
|
2870
|
+
dpa_data?: {
|
|
2871
|
+
dpa_presentation_name?: string;
|
|
2872
|
+
dpa_uri?: string;
|
|
2873
|
+
};
|
|
2874
|
+
dpa_transaction_options?: {
|
|
2875
|
+
dpa_locale?: string;
|
|
2876
|
+
dpa_accepted_billing_countries?: string[];
|
|
2877
|
+
consumer_name_requested?: boolean;
|
|
2878
|
+
consumer_email_address_requested?: boolean;
|
|
2879
|
+
consumer_phone_number_requested?: boolean;
|
|
2880
|
+
transaction_amount?: {
|
|
2881
|
+
transaction_amount?: number;
|
|
2882
|
+
transaction_currency_code?: string;
|
|
2883
|
+
};
|
|
2884
|
+
merchant_order_id?: string;
|
|
2885
|
+
merchant_category_code?: string;
|
|
2886
|
+
merchant_country_code?: string;
|
|
2887
|
+
};
|
|
2888
|
+
}
|
|
2889
|
+
interface PhoneNumber {
|
|
2890
|
+
country_code: string;
|
|
2891
|
+
phone_number: string;
|
|
2892
|
+
}
|
|
2893
|
+
interface Customer {
|
|
2894
|
+
email?: string;
|
|
2895
|
+
phone?: {
|
|
2896
|
+
country_code?: string;
|
|
2897
|
+
phone?: string;
|
|
2898
|
+
};
|
|
2899
|
+
first_name?: string;
|
|
2900
|
+
last_name?: string;
|
|
2901
|
+
}
|
|
2902
|
+
interface IClickToPayMeta extends IBaseSRCMeta {
|
|
2903
|
+
dpa_data?: IBaseSRCMeta['dpa_data'] & {
|
|
2904
|
+
dpa_address?: string;
|
|
2905
|
+
dpa_email_address?: string;
|
|
2906
|
+
dpa_phone_number?: PhoneNumber;
|
|
2907
|
+
dpa_logo_uri?: string;
|
|
2908
|
+
dpa_supported_email_address?: string;
|
|
2909
|
+
dpa_supported_phone_number?: PhoneNumber;
|
|
2910
|
+
dpa_uri?: string;
|
|
2911
|
+
dpa_support_uri?: string;
|
|
2912
|
+
application_type?: 'WEB_BROWSER' | 'MOBILE_APP';
|
|
2913
|
+
};
|
|
2914
|
+
disable_summary_screen?: boolean;
|
|
2915
|
+
co_brand_names?: string[];
|
|
2916
|
+
checkout_experience?: 'WITHIN_CHECKOUT' | 'PAYMENT_SETTINGS';
|
|
2917
|
+
services?: 'INLINE_CHECKOUT' | 'INLINE_INSTALLMENTS';
|
|
2918
|
+
dpa_transaction_options?: IBaseSRCMeta['dpa_transaction_options'] & {
|
|
2919
|
+
dpa_billing_preference?: MASTERCARD_DPA_SHIPPING_BILLING_PREFERENCE;
|
|
2920
|
+
payment_options?: Array<{
|
|
2921
|
+
dynamic_data_type?: string;
|
|
2922
|
+
}>;
|
|
2923
|
+
order_type?: MASTERCARD_ORDER_TYPE;
|
|
2924
|
+
three_ds_preference?: string;
|
|
2925
|
+
confirm_payment?: boolean;
|
|
2926
|
+
};
|
|
2927
|
+
customer?: Customer;
|
|
2928
|
+
unaccepted_card_type?: 'CREDIT' | 'DEBIT';
|
|
2929
|
+
recognition_token?: string;
|
|
2930
|
+
}
|
|
2931
|
+
type MASTERCARD_DPA_SHIPPING_BILLING_PREFERENCE = 'FULL' | 'POSTAL_COUNTRY' | 'NONE';
|
|
2932
|
+
type MASTERCARD_ORDER_TYPE = 'SPLIT_SHIPMENT' | 'PREFERRED_CARD';
|
|
2933
|
+
interface IStyles {
|
|
2934
|
+
primary_button_color?: string;
|
|
2935
|
+
secondary_button_color?: string;
|
|
2936
|
+
primary_button_text_color?: string;
|
|
2937
|
+
secondary_button_text_color?: string;
|
|
2938
|
+
font_family?: string;
|
|
2939
|
+
enable_src_popup?: boolean;
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2942
|
+
declare class ApiChargeInternal {
|
|
2943
|
+
protected api: ApiInternal;
|
|
2944
|
+
constructor(api: ApiInternal);
|
|
2945
|
+
walletCapture(payload: WalletCaptureBody): Promise<WalletCaptureResponse>;
|
|
2946
|
+
walletCallback(payload: WalletCallbackBody): Promise<WalletCallbackResponse>;
|
|
2947
|
+
standalone3dsProcess(payload: Standalone3dsProcessBody): Promise<ProcessAuthenticationResponse>;
|
|
2948
|
+
standalone3dsHandle(): Promise<HandleResponseInterface>;
|
|
2949
|
+
}
|
|
2950
|
+
interface WalletCaptureResponse {
|
|
2951
|
+
id: string;
|
|
2952
|
+
amount: number;
|
|
2953
|
+
currency: string;
|
|
2954
|
+
status: string;
|
|
2955
|
+
}
|
|
2956
|
+
interface WalletCaptureBody {
|
|
2957
|
+
payment_method_id?: string;
|
|
2958
|
+
customer?: {
|
|
2959
|
+
payment_source?: {
|
|
2960
|
+
type?: string;
|
|
2961
|
+
card_name?: string;
|
|
2962
|
+
card_scheme?: string;
|
|
2963
|
+
card_number_last4?: string;
|
|
2964
|
+
expire_month?: number;
|
|
2965
|
+
expire_year?: number;
|
|
2966
|
+
address_line1?: string;
|
|
2967
|
+
address_line2?: string;
|
|
2968
|
+
address_city?: string;
|
|
2969
|
+
address_postcode?: string;
|
|
2970
|
+
address_state?: string;
|
|
2971
|
+
address_country?: string;
|
|
2972
|
+
external_payer_id?: string;
|
|
2973
|
+
ref_token?: string;
|
|
2974
|
+
wallet_express?: boolean;
|
|
2975
|
+
};
|
|
2976
|
+
};
|
|
2977
|
+
}
|
|
2978
|
+
interface WalletCallbackBody {
|
|
2979
|
+
request_type: string;
|
|
2980
|
+
}
|
|
2981
|
+
interface WalletCallbackResponse {
|
|
2982
|
+
id: string;
|
|
2983
|
+
status: string;
|
|
2984
|
+
callback_method: string;
|
|
2985
|
+
callback_rel: string;
|
|
2986
|
+
callback_url: string;
|
|
2987
|
+
}
|
|
2988
|
+
interface Standalone3dsProcessBody {
|
|
2989
|
+
charge_3ds_id: string;
|
|
2990
|
+
}
|
|
2991
|
+
interface HandleResponseInterface {
|
|
2992
|
+
status: string;
|
|
2993
|
+
error: string;
|
|
2994
|
+
result: {
|
|
2995
|
+
reference: string;
|
|
2996
|
+
reference_2: string;
|
|
2997
|
+
identifier: string;
|
|
2998
|
+
identifier_2: string;
|
|
2999
|
+
identifier_3: string;
|
|
3000
|
+
identifier_4: string;
|
|
3001
|
+
identifier_5: string;
|
|
3002
|
+
type: string;
|
|
3003
|
+
status: string;
|
|
3004
|
+
status_2: string;
|
|
3005
|
+
status_code: string;
|
|
3006
|
+
ref_token: string;
|
|
3007
|
+
cancellation: string;
|
|
3008
|
+
count: string;
|
|
3009
|
+
version: string;
|
|
3010
|
+
whitelist: {
|
|
3011
|
+
status: string;
|
|
3012
|
+
source: string;
|
|
3013
|
+
};
|
|
3014
|
+
result: string;
|
|
3015
|
+
};
|
|
3016
|
+
}
|
|
3017
|
+
interface ProcessAuthenticationResponse {
|
|
3018
|
+
status: string;
|
|
3019
|
+
error?: string;
|
|
3020
|
+
result?: {
|
|
3021
|
+
challenge: string;
|
|
3022
|
+
challenge_url: string;
|
|
3023
|
+
decoupled_challenge: boolean;
|
|
3024
|
+
frictionless: boolean;
|
|
3025
|
+
identifier: string;
|
|
3026
|
+
identifier_3: string;
|
|
3027
|
+
identifier_4: string;
|
|
3028
|
+
reference: string;
|
|
3029
|
+
reference_2: string;
|
|
3030
|
+
secondary_url: string;
|
|
3031
|
+
skipped: boolean;
|
|
3032
|
+
status: string;
|
|
3033
|
+
type: string;
|
|
3034
|
+
version: string;
|
|
3035
|
+
description?: string;
|
|
3036
|
+
};
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
declare class ApiGatewayInternal {
|
|
3040
|
+
protected api: ApiInternal;
|
|
3041
|
+
constructor(api: ApiInternal);
|
|
3042
|
+
getWalletConfig(gateway_id: string): Promise<GetWalletConfigResponse>;
|
|
3043
|
+
}
|
|
3044
|
+
interface GetWalletConfigResponse {
|
|
3045
|
+
type: string;
|
|
3046
|
+
mode: string;
|
|
3047
|
+
credentials?: object;
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
declare class ApiServiceInternal {
|
|
3051
|
+
protected api: ApiInternal;
|
|
3052
|
+
constructor(api: ApiInternal);
|
|
3053
|
+
getConfig(service_id: string): Promise<GetConfigResponse>;
|
|
3054
|
+
}
|
|
3055
|
+
interface GetConfigResponse {
|
|
3056
|
+
type: string;
|
|
3057
|
+
merchant: string;
|
|
3058
|
+
username: string;
|
|
3059
|
+
password: string;
|
|
3060
|
+
certificate: string;
|
|
3061
|
+
certificate_passphrase: string;
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
declare class ApiCheckoutInternal {
|
|
3065
|
+
protected api: ApiInternal;
|
|
3066
|
+
constructor(api: ApiInternal);
|
|
3067
|
+
instructions(): Observable<object>;
|
|
3068
|
+
private getInstructionLink;
|
|
3069
|
+
callback(payload: Object): Promise<Object>;
|
|
3070
|
+
status(id: string): Promise<Object>;
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
declare class ApiInternal extends ApiBase {
|
|
3074
|
+
charge(): ApiChargeInternal;
|
|
3075
|
+
service(): ApiServiceInternal;
|
|
3076
|
+
checkout(): ApiCheckoutInternal;
|
|
3077
|
+
gateway(): ApiGatewayInternal;
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
interface SRCProvider {
|
|
3081
|
+
load(): void;
|
|
3082
|
+
getEnv(): string;
|
|
3083
|
+
hideButton?(saveSize: boolean): void;
|
|
3084
|
+
showButton?(): void;
|
|
3085
|
+
hideCheckout?(saveSize: boolean): void;
|
|
3086
|
+
showCheckout?(): void;
|
|
3087
|
+
reload(): void;
|
|
3088
|
+
useAutoResize?(): void;
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
declare abstract class SRC {
|
|
3092
|
+
protected iframe_selector: string;
|
|
3093
|
+
protected service_id: string;
|
|
3094
|
+
protected public_key_or_access_token: string;
|
|
3095
|
+
protected meta: IClickToPayMeta;
|
|
3096
|
+
protected eventEmitter: EventEmitter;
|
|
3097
|
+
protected env: string;
|
|
3098
|
+
protected alias?: string;
|
|
3099
|
+
protected api: ApiInternal;
|
|
3100
|
+
protected provider: SRCProvider;
|
|
3101
|
+
protected autoResize: boolean;
|
|
3102
|
+
protected style: IStyles;
|
|
3103
|
+
constructor(iframe_selector: string, service_id: string, public_key_or_access_token: string, meta: IClickToPayMeta);
|
|
3104
|
+
/**
|
|
3105
|
+
* Object contain styles for widget - call before `.load()`.
|
|
3106
|
+
*
|
|
3107
|
+
* @example
|
|
3108
|
+
* widget.setStyles({
|
|
3109
|
+
* enable_src_popup: true
|
|
3110
|
+
* primary_button_color: 'red',
|
|
3111
|
+
* secondary_button_color: 'blue',
|
|
3112
|
+
* primary_button_text_color: 'white',
|
|
3113
|
+
* secondary_button_text_color: 'white',
|
|
3114
|
+
* font_family: 'Arial',
|
|
3115
|
+
* });
|
|
3116
|
+
* @param {IStyles} fields - name of styles which can be shown in widget [STYLE]{@link STYLE}
|
|
3117
|
+
*/
|
|
3118
|
+
setStyles(styles: IStyles): void;
|
|
3119
|
+
private setStyle;
|
|
3120
|
+
load(): void;
|
|
3121
|
+
/**
|
|
3122
|
+
* Current method can change environment. By default environment = sandbox.
|
|
3123
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
3124
|
+
*
|
|
3125
|
+
* @example
|
|
3126
|
+
* SRC.setEnv('production');
|
|
3127
|
+
* @param {string} env - sandbox, production
|
|
3128
|
+
* @param {string} [alias] - Own domain alias
|
|
3129
|
+
*/
|
|
3130
|
+
setEnv(env: string, alias?: string): void;
|
|
3131
|
+
/**
|
|
3132
|
+
* Method to read the current environment
|
|
3133
|
+
*
|
|
3134
|
+
* @example
|
|
3135
|
+
* SRC.getEnv();
|
|
3136
|
+
*/
|
|
3137
|
+
getEnv(): string;
|
|
3138
|
+
on(eventName: string): Promise<any>;
|
|
3139
|
+
on(eventName: string, cb: (data: any) => void): any;
|
|
3140
|
+
/**
|
|
3141
|
+
* Using this method you can hide checkout after load and button click
|
|
3142
|
+
* @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
|
|
3143
|
+
*
|
|
3144
|
+
* @example
|
|
3145
|
+
* SRC.hideCheckout();
|
|
3146
|
+
*/
|
|
3147
|
+
hideCheckout(saveSize: boolean): void;
|
|
3148
|
+
/**
|
|
3149
|
+
* Using this method you can show checkout after using hideCheckout method
|
|
3150
|
+
*
|
|
3151
|
+
* @example
|
|
3152
|
+
* SRC.showCheckout()
|
|
3153
|
+
*/
|
|
3154
|
+
showCheckout(): void;
|
|
3155
|
+
/**
|
|
3156
|
+
* Using this method you can reload the whole checkout
|
|
3157
|
+
*
|
|
3158
|
+
* @example
|
|
3159
|
+
* SRC.reload()
|
|
3160
|
+
*/
|
|
3161
|
+
reload(): void;
|
|
3162
|
+
/**
|
|
3163
|
+
* Use this method for resize checkout iFrame according to content height, if applicable
|
|
3164
|
+
*
|
|
3165
|
+
* @example
|
|
3166
|
+
* SRC.useAutoResize();
|
|
3167
|
+
*
|
|
3168
|
+
*/
|
|
3169
|
+
useAutoResize(): void;
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
/**
|
|
3173
|
+
* Class ClickToPay include methods for interacting with the ClickToPay checkout and Manual Card option
|
|
3174
|
+
*
|
|
3175
|
+
* @extends SRC
|
|
3176
|
+
*
|
|
3177
|
+
* @constructor
|
|
3178
|
+
*
|
|
3179
|
+
* @param {string} iframe_selector - Selector of html element. Container for Click To Pay checkout iFrame.
|
|
3180
|
+
* @param {string} service_id - Card Scheme Service ID
|
|
3181
|
+
* @param {string} public_key_or_access_token - Paydock public key or Access Token
|
|
3182
|
+
* @param {IClickToPayMeta} meta - Data that configures the Click To Pay checkout
|
|
3183
|
+
* @example
|
|
3184
|
+
* var mastercardSRC = new ClickToPay('#checkoutIframe', 'service_id', 'public_key', {});
|
|
3185
|
+
*
|
|
3186
|
+
*/
|
|
3187
|
+
declare class ClickToPay extends SRC {
|
|
3188
|
+
protected iframe_selector: string;
|
|
3189
|
+
protected service_id: string;
|
|
3190
|
+
protected public_key_or_access_token: string;
|
|
3191
|
+
protected meta: IClickToPayMeta;
|
|
3192
|
+
/** @constructs */ constructor(iframe_selector: string, service_id: string, public_key_or_access_token: string, meta: IClickToPayMeta);
|
|
3193
|
+
/**
|
|
3194
|
+
* The final method after configuring the SRC to start the load process of Click To Pay checkout
|
|
3195
|
+
*
|
|
3196
|
+
*/
|
|
3197
|
+
load(): void;
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
declare class VaultDisplayIframeEvent extends IFrameEvent {
|
|
3201
|
+
on<T>(eventName: string, widgetId: string, cb: (data: T) => void): void;
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
/**
|
|
3205
|
+
* Class VaultDisplayWidget include method for working on html
|
|
3206
|
+
* @constructor
|
|
3207
|
+
*
|
|
3208
|
+
* @example
|
|
3209
|
+
* var widget = new VaultDisplayWidget('#widget', 'token');
|
|
3210
|
+
*
|
|
3211
|
+
* @param {string} selector - Selector of html element. Container for widget
|
|
3212
|
+
* @param {string} token - One time token
|
|
3213
|
+
*/
|
|
3214
|
+
declare class VaultDisplayWidget {
|
|
3215
|
+
protected container: Container;
|
|
3216
|
+
protected iFrame: IFrame;
|
|
3217
|
+
protected triggerElement: Trigger;
|
|
3218
|
+
protected event: VaultDisplayIframeEvent;
|
|
3219
|
+
protected validationData: IFormValidation;
|
|
3220
|
+
protected vaultDisplayToken: string;
|
|
3221
|
+
protected link: Link;
|
|
3222
|
+
protected configs: any[];
|
|
3223
|
+
/** @constructs */ constructor(selector: string, token: string);
|
|
3224
|
+
/**
|
|
3225
|
+
* Current method can change environment. By default environment = sandbox.
|
|
3226
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
3227
|
+
*
|
|
3228
|
+
* @example
|
|
3229
|
+
* widget.setEnv('production', 'paydock.com');
|
|
3230
|
+
* @param {string} env - sandbox, production
|
|
3231
|
+
* @param {string} [alias] - Own domain alias
|
|
3232
|
+
*/
|
|
3233
|
+
setEnv(env: string, alias?: string): void;
|
|
3234
|
+
/**
|
|
3235
|
+
* This callback will be called for each event in widget
|
|
3236
|
+
*
|
|
3237
|
+
* @callback listener
|
|
3238
|
+
* @param {IEventData} response
|
|
3239
|
+
*/
|
|
3240
|
+
on(eventName: string): Promise<IEventData$1>;
|
|
3241
|
+
on(eventName: string, cb: (data: IEventData$1) => void): any;
|
|
3242
|
+
/**
|
|
3243
|
+
* Object contain styles for widget
|
|
3244
|
+
*
|
|
3245
|
+
* @example
|
|
3246
|
+
* widget.setStyles({
|
|
3247
|
+
* background_color: '#fff',
|
|
3248
|
+
* border_color: 'yellow',
|
|
3249
|
+
* text_color: '#FFFFAA',
|
|
3250
|
+
* button_color: 'rgba(255, 255, 255, 0.9)',
|
|
3251
|
+
* font_size: '20px',
|
|
3252
|
+
* fort_family: 'fantasy'
|
|
3253
|
+
* });
|
|
3254
|
+
* @param {VaultDisplayStyle} fields - name of styles which can be shown in widget [VAULT_DISPLAY_STYLE]{@link VAULT_DISPLAY_STYLE}
|
|
3255
|
+
*/
|
|
3256
|
+
setStyles(styles: IStyles$1): void;
|
|
3257
|
+
setStyle(param: string, value: string): void;
|
|
3258
|
+
/**
|
|
3259
|
+
* The final method to beginning, the load process of widget to html
|
|
3260
|
+
*
|
|
3261
|
+
*/
|
|
3262
|
+
load(): void;
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
interface IWalletServiceUpdateData {
|
|
3266
|
+
amount: number;
|
|
3267
|
+
shipping_options?: IShippingOption[];
|
|
3268
|
+
}
|
|
3269
|
+
interface IWalletServiceUpdate {
|
|
3270
|
+
success: boolean;
|
|
3271
|
+
body?: IWalletServiceUpdateData;
|
|
3272
|
+
}
|
|
3273
|
+
interface IPaymentMethod {
|
|
3274
|
+
payment_method_id?: string;
|
|
3275
|
+
device?: string;
|
|
3276
|
+
customer: {
|
|
3277
|
+
payer_name: string;
|
|
3278
|
+
payer_email: string;
|
|
3279
|
+
payer_phone: string;
|
|
3280
|
+
payment_source: {
|
|
3281
|
+
wallet_type: WALLET_TYPE;
|
|
3282
|
+
card_name: string;
|
|
3283
|
+
type: string;
|
|
3284
|
+
card_scheme: string;
|
|
3285
|
+
card_number_last4: string;
|
|
3286
|
+
expire_month: number;
|
|
3287
|
+
expire_year: number;
|
|
3288
|
+
address_line1: string;
|
|
3289
|
+
address_line2: string;
|
|
3290
|
+
address_city: string;
|
|
3291
|
+
address_postcode: string;
|
|
3292
|
+
address_state: string;
|
|
3293
|
+
address_country: string;
|
|
3294
|
+
ref_token?: string;
|
|
3295
|
+
};
|
|
3296
|
+
};
|
|
3297
|
+
shipping?: {
|
|
3298
|
+
method?: string;
|
|
3299
|
+
options?: IShippingOption[];
|
|
3300
|
+
address_line1?: string;
|
|
3301
|
+
address_line2?: string;
|
|
3302
|
+
address_city?: string;
|
|
3303
|
+
address_postcode?: string;
|
|
3304
|
+
address_state?: string;
|
|
3305
|
+
address_country?: string;
|
|
3306
|
+
address_company?: string;
|
|
3307
|
+
address_origin_postcode?: string;
|
|
3308
|
+
contact?: {
|
|
3309
|
+
first_name?: string;
|
|
3310
|
+
last_name?: string;
|
|
3311
|
+
email?: string;
|
|
3312
|
+
phone?: string;
|
|
3313
|
+
phone2?: string;
|
|
3314
|
+
};
|
|
3315
|
+
};
|
|
3316
|
+
}
|
|
3317
|
+
interface IUnavailableWalletEventBody {
|
|
3318
|
+
}
|
|
3319
|
+
interface IPaymentMethodSelectedWalletEventBody {
|
|
3320
|
+
data: IPaymentMethod;
|
|
3321
|
+
onSuccess: () => void;
|
|
3322
|
+
onError: (message?: string) => void;
|
|
3323
|
+
}
|
|
3324
|
+
interface IWalletService {
|
|
3325
|
+
load(container: Container): Promise<void>;
|
|
3326
|
+
close?(): void;
|
|
3327
|
+
update(data: IWalletServiceUpdate): void;
|
|
3328
|
+
enable(): void;
|
|
3329
|
+
disable(): void;
|
|
3330
|
+
setEnv(env: string): any;
|
|
3331
|
+
on(eventName: string, cb?: (data: IUnavailableWalletEventBody | IPaymentMethodSelectedWalletEventBody | any) => void): any;
|
|
3332
|
+
}
|
|
3333
|
+
|
|
3334
|
+
interface IWalletPaymentSuccessful {
|
|
3335
|
+
id: string;
|
|
3336
|
+
amount: number;
|
|
3337
|
+
currency: string;
|
|
3338
|
+
status: string;
|
|
3339
|
+
payer_name?: string;
|
|
3340
|
+
payer_email?: string;
|
|
3341
|
+
payer_phone?: string;
|
|
3342
|
+
}
|
|
3343
|
+
interface IWalletUnavailable {
|
|
3344
|
+
wallet?: WALLET_TYPE;
|
|
3345
|
+
}
|
|
3346
|
+
interface IWalletOnClick {
|
|
3347
|
+
attachResult: (result: Promise<void> | boolean) => void;
|
|
3348
|
+
}
|
|
3349
|
+
interface IWalletUpdate {
|
|
3350
|
+
wallet_response_code?: string;
|
|
3351
|
+
wallet_order_id?: string;
|
|
3352
|
+
wallet_session_id?: string;
|
|
3353
|
+
payment_source?: {
|
|
3354
|
+
wallet_payment_method_id?: string;
|
|
3355
|
+
card_number_last4?: string;
|
|
3356
|
+
card_scheme?: string;
|
|
3357
|
+
};
|
|
3358
|
+
wallet_loyalty_account?: {
|
|
3359
|
+
id?: string;
|
|
3360
|
+
barcode?: string;
|
|
3361
|
+
};
|
|
3362
|
+
shipping?: {
|
|
3363
|
+
address_line1?: string;
|
|
3364
|
+
address_line2?: string;
|
|
3365
|
+
address_postcode?: string;
|
|
3366
|
+
address_city?: string;
|
|
3367
|
+
address_state?: string;
|
|
3368
|
+
address_country?: string;
|
|
3369
|
+
address_company?: string;
|
|
3370
|
+
post_office_box_number?: string;
|
|
3371
|
+
wallet_address_id?: string;
|
|
3372
|
+
wallet_address_name?: string;
|
|
3373
|
+
wallet_address_created_timestamp?: string;
|
|
3374
|
+
wallet_address_updated_timestamp?: string;
|
|
3375
|
+
};
|
|
3376
|
+
selected_shipping_option?: IShippingOption;
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
declare enum EventEnum {
|
|
3380
|
+
UNAVAILABLE = "unavailable",
|
|
3381
|
+
UPDATE = "update",
|
|
3382
|
+
PAYMENT_SUCCESSFUL = "paymentSuccessful",
|
|
3383
|
+
PAYMENT_ERROR = "paymentError",
|
|
3384
|
+
PAYMENT_IN_REVIEW = "paymentInReview",
|
|
3385
|
+
AUTH_TOKENS_CHANGED = "authTokensChanged",
|
|
3386
|
+
ON_CLICK = "onClick",
|
|
3387
|
+
ON_CHECKOUT_OPEN = "onCheckoutOpen",
|
|
3388
|
+
ON_CHECKOUT_CLOSE = "onCheckoutClose"
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
interface IEventData<T = any> {
|
|
3392
|
+
event: string;
|
|
3393
|
+
data: T;
|
|
3394
|
+
}
|
|
3395
|
+
interface IWalletPaymentSuccessfulEvent extends IEventData<IWalletPaymentSuccessful> {
|
|
3396
|
+
event: EventEnum.PAYMENT_SUCCESSFUL;
|
|
3397
|
+
}
|
|
3398
|
+
interface IWalletUpdateEvent extends IEventData<IWalletUpdate> {
|
|
3399
|
+
event: EventEnum.UPDATE;
|
|
3400
|
+
}
|
|
3401
|
+
interface IWalletUnavailableEvent extends IEventData<IWalletUnavailable> {
|
|
3402
|
+
event: EventEnum.UNAVAILABLE;
|
|
3403
|
+
}
|
|
3404
|
+
interface IWalletOnClickEvent extends IEventData<IWalletOnClick> {
|
|
3405
|
+
event: EventEnum.ON_CLICK;
|
|
3406
|
+
}
|
|
3407
|
+
interface IWalletUpdateData {
|
|
3408
|
+
success: boolean;
|
|
3409
|
+
}
|
|
3410
|
+
/**
|
|
3411
|
+
* Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay, Flypay V2, Paypal, Afterpay)
|
|
3412
|
+
* @constructor
|
|
3413
|
+
*
|
|
3414
|
+
* @example
|
|
3415
|
+
* var button = new WalletButtons('#wallet-buttons', 'charge-token', { amount_label: 'Total', country: 'us' });
|
|
3416
|
+
*
|
|
3417
|
+
* @param {string} selector - Selector of html element. Container for the WalletButtons.
|
|
3418
|
+
* @param {string} chargeToken - token for the wallet transaction, created with a secure call to `POST charges/wallet`.
|
|
3419
|
+
* @param {IWalletMeta} meta - data that configures the E-Wallet, which can be shown on checkout page and configures required customer information.
|
|
3420
|
+
*/
|
|
3421
|
+
declare class WalletButtons {
|
|
3422
|
+
protected container: Container;
|
|
3423
|
+
protected api: ApiInternal;
|
|
3424
|
+
protected service: IWalletService;
|
|
3425
|
+
protected eventEmitter: EventEmitter;
|
|
3426
|
+
protected hasUpdateHandler: boolean;
|
|
3427
|
+
/** @constructs */ constructor(selector: string, chargeToken: string, meta: IWalletMeta);
|
|
3428
|
+
/**
|
|
3429
|
+
* Initializes the availability checks and inserts the button if possible.
|
|
3430
|
+
* Otherwise function onUnavailable(handler: VoidFunction) will be called.
|
|
3431
|
+
*
|
|
3432
|
+
* @example
|
|
3433
|
+
* var button = new WalletButtons(
|
|
3434
|
+
* '#buttons',
|
|
3435
|
+
* token,
|
|
3436
|
+
* {
|
|
3437
|
+
* amount_label: 'Total',
|
|
3438
|
+
* country: 'DE',
|
|
3439
|
+
* }
|
|
3440
|
+
* );
|
|
3441
|
+
* button.load();
|
|
3442
|
+
*/
|
|
3443
|
+
load(): void;
|
|
3444
|
+
/**
|
|
3445
|
+
* Triggers the update process of the wallet, if available.
|
|
3446
|
+
* Currently supported by Flypay, Paypal and ApplePay/GooglePay via MPGS Wallets.
|
|
3447
|
+
*
|
|
3448
|
+
* @example
|
|
3449
|
+
* var button = new WalletButtons(
|
|
3450
|
+
* '#buttons',
|
|
3451
|
+
* token,
|
|
3452
|
+
* {
|
|
3453
|
+
* amount_label: 'Total',
|
|
3454
|
+
* country: 'DE',
|
|
3455
|
+
* }
|
|
3456
|
+
* );
|
|
3457
|
+
* button.on('update', (data) => {
|
|
3458
|
+
* updateChargeAmountInBackend(data);
|
|
3459
|
+
* button.update({ success: true });
|
|
3460
|
+
* });
|
|
3461
|
+
*
|
|
3462
|
+
* @example
|
|
3463
|
+
* // ApplePay via MPGS example:
|
|
3464
|
+
* var button = new WalletButtons(
|
|
3465
|
+
* '#buttons',
|
|
3466
|
+
* token,
|
|
3467
|
+
* {
|
|
3468
|
+
* amount_label: 'Total',
|
|
3469
|
+
* country: 'AU',
|
|
3470
|
+
* ...
|
|
3471
|
+
* }
|
|
3472
|
+
* );
|
|
3473
|
+
* button.on('update', (data) => {
|
|
3474
|
+
* updateChargeAmountInBackend(data);
|
|
3475
|
+
* button.update({
|
|
3476
|
+
* success: true,
|
|
3477
|
+
* body: {
|
|
3478
|
+
* amount: 15,
|
|
3479
|
+
* shipping_options: [
|
|
3480
|
+
* {
|
|
3481
|
+
* id: "NEW-FreeShip",
|
|
3482
|
+
* label: "NEW - Free Shipping",
|
|
3483
|
+
* detail: "Arrives in 3 to 5 days",
|
|
3484
|
+
* amount: "0.00"
|
|
3485
|
+
* },
|
|
3486
|
+
* {
|
|
3487
|
+
* id: "NEW - FastShip",
|
|
3488
|
+
* label: "NEW - Fast Shipping",
|
|
3489
|
+
* detail: "Arrives in less than 1 day",
|
|
3490
|
+
* amount: "10.00"
|
|
3491
|
+
* }
|
|
3492
|
+
* ]
|
|
3493
|
+
* }
|
|
3494
|
+
* });
|
|
3495
|
+
* });
|
|
3496
|
+
*/
|
|
3497
|
+
update(data: IWalletUpdateData): void;
|
|
3498
|
+
/**
|
|
3499
|
+
* Current method can change environment. By default environment = sandbox.
|
|
3500
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
3501
|
+
* Bear in mind that you must set an environment before calling `button.load()`.
|
|
3502
|
+
*
|
|
3503
|
+
* @example
|
|
3504
|
+
* button.setEnv('production', 'paydock.com');
|
|
3505
|
+
* @param {string} env - sandbox, production
|
|
3506
|
+
* @param {string} [alias] - Own domain alias
|
|
3507
|
+
*/
|
|
3508
|
+
setEnv(env: string, alias?: string): void;
|
|
3509
|
+
/**
|
|
3510
|
+
* Current method can enable the payment button. This method is only supported for Flypay V2.
|
|
3511
|
+
*
|
|
3512
|
+
* @example
|
|
3513
|
+
* button.enable();
|
|
3514
|
+
*/
|
|
3515
|
+
enable(): void;
|
|
3516
|
+
/**
|
|
3517
|
+
* Current method can disable the payment button. This method is only supported for Flypay V2.
|
|
3518
|
+
*
|
|
3519
|
+
* @example
|
|
3520
|
+
* button.disable('production', 'paydock.com');
|
|
3521
|
+
*/
|
|
3522
|
+
disable(): void;
|
|
3523
|
+
/**
|
|
3524
|
+
* Closes the checkout forcibly. Currently supported in Flypay wallet.
|
|
3525
|
+
*
|
|
3526
|
+
* @example
|
|
3527
|
+
* button.close();
|
|
3528
|
+
*/
|
|
3529
|
+
close(): void;
|
|
3530
|
+
on(eventName: string): Promise<IEventData>;
|
|
3531
|
+
on(eventName: string, cb: (data: IEventData) => void): any;
|
|
3532
|
+
/**
|
|
3533
|
+
* User to subscribe to the no button available event. This method is used after loading when the button is not available.
|
|
3534
|
+
* For MPGS, since can have more than one wallet button configured (ApplePay/GooglePay) you will receive a body (({ wallet: WALLET_TYPE.GOOGLE }) or ({ wallet: WALLET_TYPE.APPLE })) indicating which button is unavailable
|
|
3535
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3536
|
+
*
|
|
3537
|
+
* @example
|
|
3538
|
+
* button.onUnavailable(() => {
|
|
3539
|
+
* console.log('No wallet buttons available');
|
|
3540
|
+
* });
|
|
3541
|
+
*
|
|
3542
|
+
* @example
|
|
3543
|
+
* button.onUnavailable().then(() => console.log('No wallet buttons available'));
|
|
3544
|
+
*
|
|
3545
|
+
* @example
|
|
3546
|
+
* button.onUnavailable(function (data) {console.log('data.wallet :: ', data.wallet)});
|
|
3547
|
+
*
|
|
3548
|
+
* @param {listener} [handler] - Function to be called when no button is available.
|
|
3549
|
+
*/
|
|
3550
|
+
onUnavailable(handler?: (data: IWalletUnavailableEvent) => void): Promise<void> | (() => void);
|
|
3551
|
+
/**
|
|
3552
|
+
* If the wallet performs some update in the checkout process, the function passed as parameter will be called.
|
|
3553
|
+
*
|
|
3554
|
+
* NOTE: make sure to call the `button.update(result)` method on handler completion.
|
|
3555
|
+
*
|
|
3556
|
+
* @example
|
|
3557
|
+
* button.onUpdate((data) => {
|
|
3558
|
+
* button.update({ success: true });
|
|
3559
|
+
* });
|
|
3560
|
+
*
|
|
3561
|
+
* @example
|
|
3562
|
+
* button.onUpdate().then((data) => throw new Error());
|
|
3563
|
+
*
|
|
3564
|
+
* @param {listener} [handler] - Function to be called when the payment was successful.
|
|
3565
|
+
*/
|
|
3566
|
+
onUpdate(handler?: (data: IWalletUpdateEvent) => void): Promise<unknown> | (() => void);
|
|
3567
|
+
/**
|
|
3568
|
+
* If the payment was successful, the function passed as parameter will be called.
|
|
3569
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3570
|
+
*
|
|
3571
|
+
* @example
|
|
3572
|
+
* button.onPaymentSuccessful((data) => {
|
|
3573
|
+
* console.log('Payment successful!');
|
|
3574
|
+
* });
|
|
3575
|
+
*
|
|
3576
|
+
* @example
|
|
3577
|
+
* button.onPaymentSuccessful().then((data) => console.log('Payment successful!'));
|
|
3578
|
+
*
|
|
3579
|
+
* @param {listener} [handler] - Function to be called when the payment was successful.
|
|
3580
|
+
*/
|
|
3581
|
+
onPaymentSuccessful(handler?: (data: IWalletPaymentSuccessfulEvent) => void): Promise<unknown> | (() => void);
|
|
3582
|
+
/**
|
|
3583
|
+
* If the payment was left in fraud review, the function passed as parameter will be called.
|
|
3584
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3585
|
+
*
|
|
3586
|
+
* @example
|
|
3587
|
+
* button.onPaymentInReview((data) => {
|
|
3588
|
+
* console.log('Payment in fraud review');
|
|
3589
|
+
* });
|
|
3590
|
+
*
|
|
3591
|
+
* @example
|
|
3592
|
+
* button.onPaymentInReview().then((data) => console.log('Payment in fraud review'));
|
|
3593
|
+
*
|
|
3594
|
+
* @param {listener} [handler] - Function to be called when the payment was left in fraud review status.
|
|
3595
|
+
*/
|
|
3596
|
+
onPaymentInReview(handler?: (err: IEventData) => void): Promise<unknown> | (() => void);
|
|
3597
|
+
/**
|
|
3598
|
+
* If the payment was not successful, the function passed as parameter will be called.
|
|
3599
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3600
|
+
*
|
|
3601
|
+
* @example
|
|
3602
|
+
* button.onPaymentError((err) => {
|
|
3603
|
+
* console.log('Payment not successful');
|
|
3604
|
+
* });
|
|
3605
|
+
*
|
|
3606
|
+
* @example
|
|
3607
|
+
* button.onPaymentError().then((err) => console.log('Payment not successful'));
|
|
3608
|
+
*
|
|
3609
|
+
* @param {listener} [handler] - Function to be called when the payment was not successful.
|
|
3610
|
+
*/
|
|
3611
|
+
onPaymentError(handler?: (err: IEventData) => void): Promise<unknown> | (() => void);
|
|
3612
|
+
/**
|
|
3613
|
+
* Registers a callback function to be invoked when authentication tokens are changed.
|
|
3614
|
+
* This function allows you to respond to changes in authentication tokens, such as when a user logs in.
|
|
3615
|
+
*
|
|
3616
|
+
* @example
|
|
3617
|
+
* button.onAuthTokensChanged((eventData) => {
|
|
3618
|
+
* console.log('Authentication tokens changed:', eventData);
|
|
3619
|
+
* });
|
|
3620
|
+
*
|
|
3621
|
+
* @example
|
|
3622
|
+
* button.onAuthTokensChanged().then((eventData) => {
|
|
3623
|
+
* console.log('Authentication tokens changed:', eventData);
|
|
3624
|
+
* });
|
|
3625
|
+
*
|
|
3626
|
+
* @param {listener} [handler] - Function to be called when authentication tokens are changed.
|
|
3627
|
+
*/
|
|
3628
|
+
onAuthTokensChanged(handler?: (err: IEventData) => void): Promise<unknown> | (() => void);
|
|
3629
|
+
/**
|
|
3630
|
+
* Registers a callback function to be invoked when the wallet button gets clicked.
|
|
3631
|
+
* There are two operational modes supported, Synchronous and Asynchronous.
|
|
3632
|
+
* When asynchronous operations need to occur on the callback handler, attaching the Promise via `attachResult` is required to have the wallet wait for a result.
|
|
3633
|
+
* When synchronous operations occur on the callback handler, attaching a boolean result via `attachResult` is optional to control the execution flow.
|
|
3634
|
+
* Note this is supported for Paypal, GooglePay and ApplePay wallet buttons at the moment.
|
|
3635
|
+
*
|
|
3636
|
+
* @example
|
|
3637
|
+
* button.onClick((data) => {
|
|
3638
|
+
* performValidationLogic();
|
|
3639
|
+
* });
|
|
3640
|
+
*
|
|
3641
|
+
* @param {listener} handler - Function to be called when the wallet button is clicked.
|
|
3642
|
+
*/
|
|
3643
|
+
onClick(handler: (data: IWalletOnClickEvent) => void): () => void;
|
|
3644
|
+
/**
|
|
3645
|
+
* Registers a callback function to be invoked when the wallet checkout opens.
|
|
3646
|
+
* Note this is supported for FlypayV2 wallet button at the moment.
|
|
3647
|
+
*
|
|
3648
|
+
* @example
|
|
3649
|
+
* button.onCheckoutOpen((data) => {
|
|
3650
|
+
* console.log('Checkout opens');
|
|
3651
|
+
* });
|
|
3652
|
+
*
|
|
3653
|
+
* @param {listener} handler - Function to be called when the wallet checkout opens.
|
|
3654
|
+
*/
|
|
3655
|
+
onCheckoutOpen(handler?: (err: IEventData) => void): Promise<unknown> | (() => void);
|
|
3656
|
+
/**
|
|
3657
|
+
* Registers a callback function to be invoked when the wallet checkout closes.
|
|
3658
|
+
* Note this is supported for FlypayV2 wallet button at the moment.
|
|
3659
|
+
*
|
|
3660
|
+
* @example
|
|
3661
|
+
* button.onCheckoutClose(() => {
|
|
3662
|
+
* console.log('Wallet checkout closes');
|
|
3663
|
+
* });
|
|
3664
|
+
*
|
|
3665
|
+
* @param {listener} handler - Function to be called when the wallet checkout closes.
|
|
3666
|
+
*/
|
|
3667
|
+
onCheckoutClose(handler?: (err: IEventData) => void): Promise<unknown> | (() => void);
|
|
3668
|
+
private setupServiceCallbacks;
|
|
3669
|
+
private setupUnavailableCallback;
|
|
3670
|
+
private setupUpdateCallback;
|
|
3671
|
+
private setupOnClickCallback;
|
|
3672
|
+
private setupOnCheckoutOpenCallback;
|
|
3673
|
+
private setupOnCheckoutCloseCallback;
|
|
3674
|
+
private setupWalletCallback;
|
|
3675
|
+
private setupPaymentCallback;
|
|
3676
|
+
private setupPaymentSuccessCallback;
|
|
3677
|
+
private setupPaymentInReviewCallback;
|
|
3678
|
+
private setupPaymentErrorCallback;
|
|
3679
|
+
private setupAuthTokensChangedCallback;
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
type Instruction = new (selector: string, formSelector: string, api: ApiInternal, checkoutWidget: Checkout) => InstructionHandler & InstructionDestroyable & InstructionDecorated;
|
|
3683
|
+
interface InstructionHandleable {
|
|
3684
|
+
handle(payload: object, eventEmitter: EventEmitter): void;
|
|
3685
|
+
}
|
|
3686
|
+
interface InstructionDecorated {
|
|
3687
|
+
instruction: string;
|
|
3688
|
+
}
|
|
3689
|
+
interface InstructionDestroyable {
|
|
3690
|
+
destroy(): void;
|
|
3691
|
+
}
|
|
3692
|
+
declare abstract class InstructionHandler implements InstructionHandleable, InstructionDestroyable, InstructionDecorated {
|
|
3693
|
+
selector: string;
|
|
3694
|
+
formSelector: string;
|
|
3695
|
+
api: ApiInternal;
|
|
3696
|
+
protected checkoutWidget?: Checkout;
|
|
3697
|
+
constructor(selector: string, formSelector: string, api: ApiInternal, checkoutWidget?: Checkout);
|
|
3698
|
+
instruction: string;
|
|
3699
|
+
abstract handle(context: object, eventEmitter?: any): void;
|
|
3700
|
+
abstract destroy(): void;
|
|
3701
|
+
getEnv(instruction_token: string): string;
|
|
3702
|
+
}
|
|
3703
|
+
|
|
3704
|
+
declare class InstructionModule {
|
|
3705
|
+
instructions: any[];
|
|
3706
|
+
getInstruction(id: string): Instruction | null;
|
|
3707
|
+
}
|
|
3708
|
+
|
|
3709
|
+
interface IntentTokenPayload {
|
|
3710
|
+
env: string;
|
|
3711
|
+
intent_id: string;
|
|
3712
|
+
version: number;
|
|
3713
|
+
env_alias: string;
|
|
3714
|
+
whitelist_domains: string[];
|
|
3715
|
+
}
|
|
3716
|
+
/**
|
|
3717
|
+
* Class CheckoutButton transform usual button into checkout
|
|
3718
|
+
*
|
|
3719
|
+
* @constructor
|
|
3720
|
+
*
|
|
3721
|
+
* @param {string} selector - Selector of html element.
|
|
3722
|
+
* @param {string} intentToken - PayDock intent token
|
|
3723
|
+
* @example
|
|
3724
|
+
* var widget = new Checkout('#widget', 'intent_token');
|
|
3725
|
+
**/
|
|
3726
|
+
declare class Checkout {
|
|
3727
|
+
protected formSelector: string;
|
|
3728
|
+
protected intentToken: string;
|
|
3729
|
+
protected debug: boolean;
|
|
3730
|
+
protected window: Window;
|
|
3731
|
+
protected eventEmitter: EventEmitter;
|
|
3732
|
+
protected container: Container;
|
|
3733
|
+
protected intentTokenPayload: IntentTokenPayload;
|
|
3734
|
+
protected api: ApiInternal;
|
|
3735
|
+
protected checkoutApi: ApiCheckoutInternal;
|
|
3736
|
+
protected instructions: InstructionModule;
|
|
3737
|
+
protected currentInstruction: InstructionDestroyable & InstructionHandleable;
|
|
3738
|
+
private timeoutTimer;
|
|
3739
|
+
private requestInFlight;
|
|
3740
|
+
private inTimeoutRange;
|
|
3741
|
+
private checkoutFinished;
|
|
3742
|
+
constructor(formSelector: string, intentToken: string, debug?: boolean);
|
|
3743
|
+
fetchInstruction(): void;
|
|
3744
|
+
finaliseCheckout(): void;
|
|
3745
|
+
private setupTimeoutTimer;
|
|
3746
|
+
private extractIntentTokenPayload;
|
|
3747
|
+
validateJWTWhitelistedDomains(whitelist_domains: string[]): boolean;
|
|
3748
|
+
private ready;
|
|
3749
|
+
private initContractVersion;
|
|
3750
|
+
private isTimeoutInstruction;
|
|
3751
|
+
private handleInstruction;
|
|
3752
|
+
private handleTimeoutInstructions;
|
|
3753
|
+
private getInstructionFromResponse;
|
|
3754
|
+
private extractInstructionPayloadFromResponse;
|
|
3755
|
+
private setEnv;
|
|
3756
|
+
/**
|
|
3757
|
+
* If the payment was successful, the function passed as parameter will be called.
|
|
3758
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3759
|
+
*
|
|
3760
|
+
* @example
|
|
3761
|
+
* widget.onPaymentSuccessful((data) => {
|
|
3762
|
+
* console.log('Payment successful!');
|
|
3763
|
+
* });
|
|
3764
|
+
*/
|
|
3765
|
+
onPaymentSuccessful(handler: (data: IEventData$1) => void): () => void;
|
|
3766
|
+
/**
|
|
3767
|
+
* If the payment was not successful, the function passed as parameter will be called.
|
|
3768
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3769
|
+
*
|
|
3770
|
+
* @example
|
|
3771
|
+
* widget.onPaymentError((err) => {
|
|
3772
|
+
* console.log('Payment not successful');
|
|
3773
|
+
* });
|
|
3774
|
+
*/
|
|
3775
|
+
onPaymentFailure(handler: (data: IEventData$1) => void): () => void;
|
|
3776
|
+
/**
|
|
3777
|
+
* If the payment was expired, the function passed as parameter will be called.
|
|
3778
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3779
|
+
*
|
|
3780
|
+
* @example
|
|
3781
|
+
* widget.onPaymentInReview((data) => {
|
|
3782
|
+
* console.log('Payment in fraud review');
|
|
3783
|
+
* });
|
|
3784
|
+
*/
|
|
3785
|
+
onPaymentExpired(handler: (data: IEventData$1) => void): () => void;
|
|
3786
|
+
createWidgetStructure(): void;
|
|
3787
|
+
private setStyles;
|
|
3788
|
+
}
|
|
3789
|
+
declare class InstructionDebugger {
|
|
3790
|
+
constructor(selector: string, formSelector: string, version: number, instructionName: string, context: object, token?: string);
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
declare enum EVENT {
|
|
3794
|
+
UNAVAILABLE = "unavailable",
|
|
3795
|
+
ERROR = "error",
|
|
3796
|
+
PAYMENT_SUCCESSFUL = "paymentSuccessful",
|
|
3797
|
+
PAYMENT_ERROR = "paymentError",
|
|
3798
|
+
PAYMENT_IN_REVIEW = "paymentInReview",
|
|
3799
|
+
ON_CLICK = "onClick",
|
|
3800
|
+
ON_CHECKOUT_CLOSE = "onCheckoutClose",
|
|
3801
|
+
ON_SHIPPING_ADDRESS_CHANGE = "onShippingAddressChange",
|
|
3802
|
+
ON_SHIPPING_OPTIONS_CHANGE = "onShippingOptionsChange"
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
interface BaseEventData<T> {
|
|
3806
|
+
event: string;
|
|
3807
|
+
chargeId?: string;
|
|
3808
|
+
data?: T | undefined;
|
|
3809
|
+
}
|
|
3810
|
+
|
|
3811
|
+
interface OnClickEventData extends BaseEventData<undefined> {
|
|
3812
|
+
event: EVENT.ON_CLICK;
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
interface OnPaymentSuccessfulEventData extends BaseEventData<{
|
|
3816
|
+
id: string;
|
|
3817
|
+
amount: number;
|
|
3818
|
+
currency: string;
|
|
3819
|
+
status: string;
|
|
3820
|
+
}> {
|
|
3821
|
+
event: EVENT.PAYMENT_SUCCESSFUL;
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
interface OnCloseEventData extends BaseEventData<undefined> {
|
|
3825
|
+
event: EVENT.ON_CHECKOUT_CLOSE;
|
|
3826
|
+
}
|
|
3827
|
+
|
|
3828
|
+
interface OnPaymentInReviewEventData extends Omit<OnPaymentSuccessfulEventData, 'event'> {
|
|
3829
|
+
event: EVENT.PAYMENT_IN_REVIEW;
|
|
3830
|
+
}
|
|
3831
|
+
|
|
3832
|
+
interface OnPaymentErrorEventData extends BaseEventData<{
|
|
3833
|
+
message?: string;
|
|
3834
|
+
code?: string;
|
|
3835
|
+
}> {
|
|
3836
|
+
event: EVENT.PAYMENT_ERROR;
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
interface WalletCaptureRequest {
|
|
3840
|
+
payment_method_id?: string;
|
|
3841
|
+
customer: {
|
|
3842
|
+
email?: string;
|
|
3843
|
+
phone?: string;
|
|
3844
|
+
first_name?: string;
|
|
3845
|
+
last_name?: string;
|
|
3846
|
+
payment_source?: {
|
|
3847
|
+
wallet_type?: string;
|
|
3848
|
+
address_line1?: string;
|
|
3849
|
+
address_line2?: string;
|
|
3850
|
+
address_country?: string;
|
|
3851
|
+
address_city?: string;
|
|
3852
|
+
address_postcode?: string;
|
|
3853
|
+
address_state?: string;
|
|
3854
|
+
ref_token?: string;
|
|
3855
|
+
external_payer_id?: string;
|
|
3856
|
+
wallet_express?: boolean;
|
|
3857
|
+
};
|
|
3858
|
+
};
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
interface OnUnavailableEventData extends BaseEventData<undefined> {
|
|
3862
|
+
event: EVENT.UNAVAILABLE;
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3865
|
+
interface BaseGatewayConfig<T> {
|
|
3866
|
+
type: string;
|
|
3867
|
+
mode: string;
|
|
3868
|
+
credentials?: T;
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3871
|
+
interface ChargeWalletTokenMeta {
|
|
3872
|
+
charge: {
|
|
3873
|
+
id: string;
|
|
3874
|
+
amount: number;
|
|
3875
|
+
currency: string;
|
|
3876
|
+
capture?: boolean;
|
|
3877
|
+
reference?: string;
|
|
3878
|
+
shipping?: {
|
|
3879
|
+
amount?: number;
|
|
3880
|
+
currency?: string;
|
|
3881
|
+
address_line1?: string;
|
|
3882
|
+
address_line2?: string;
|
|
3883
|
+
address_line3?: string;
|
|
3884
|
+
address_city?: string;
|
|
3885
|
+
address_postcode?: string;
|
|
3886
|
+
address_state?: string;
|
|
3887
|
+
address_country?: string;
|
|
3888
|
+
address_company?: string;
|
|
3889
|
+
address_origin_postcode?: string;
|
|
3890
|
+
method?: string;
|
|
3891
|
+
type?: string;
|
|
3892
|
+
options?: Array<{
|
|
3893
|
+
id?: string;
|
|
3894
|
+
label?: string;
|
|
3895
|
+
detail?: string;
|
|
3896
|
+
amount?: string;
|
|
3897
|
+
currency?: string;
|
|
3898
|
+
type?: string;
|
|
3899
|
+
}>;
|
|
3900
|
+
contact?: {
|
|
3901
|
+
first_name?: string;
|
|
3902
|
+
last_name?: string;
|
|
3903
|
+
email?: string;
|
|
3904
|
+
phone?: string;
|
|
3905
|
+
phone2?: string;
|
|
3906
|
+
};
|
|
3907
|
+
};
|
|
3908
|
+
};
|
|
3909
|
+
gateway: {
|
|
3910
|
+
mode: string;
|
|
3911
|
+
type: string;
|
|
3912
|
+
};
|
|
3913
|
+
}
|
|
3914
|
+
|
|
3915
|
+
interface BaseWalletMeta {
|
|
3916
|
+
amount: number;
|
|
3917
|
+
currency: string;
|
|
3918
|
+
}
|
|
3919
|
+
|
|
3920
|
+
interface OnErrorEventData extends BaseEventData<Error> {
|
|
3921
|
+
event: EVENT.ERROR;
|
|
3922
|
+
}
|
|
3923
|
+
|
|
3924
|
+
interface OnShippingAddressChangeEventData extends BaseEventData<AddressChangeEventData> {
|
|
3925
|
+
event: EVENT.ON_SHIPPING_ADDRESS_CHANGE;
|
|
3926
|
+
}
|
|
3927
|
+
interface AddressChangeEventData {
|
|
3928
|
+
address_postcode?: string;
|
|
3929
|
+
address_city?: string;
|
|
3930
|
+
address_state?: string;
|
|
3931
|
+
address_country?: string;
|
|
3932
|
+
address_line1?: string;
|
|
3933
|
+
address_line2?: string;
|
|
3934
|
+
contact?: {
|
|
3935
|
+
phone?: string;
|
|
3936
|
+
email?: string;
|
|
3937
|
+
first_name?: string;
|
|
3938
|
+
last_name?: string;
|
|
3939
|
+
};
|
|
3940
|
+
}
|
|
3941
|
+
|
|
3942
|
+
interface OnShippingOptionChangeEventData extends BaseEventData<ShippingOptionChangeEventData> {
|
|
3943
|
+
event: EVENT.ON_SHIPPING_OPTIONS_CHANGE;
|
|
3944
|
+
}
|
|
3945
|
+
interface ShippingOptionChangeEventData {
|
|
3946
|
+
shipping_option_id?: string;
|
|
3947
|
+
amount?: string;
|
|
3948
|
+
label?: string;
|
|
3949
|
+
detail?: string;
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3952
|
+
interface OnShippingAddressChangeEventResponse {
|
|
3953
|
+
token?: string;
|
|
3954
|
+
error?: {
|
|
3955
|
+
code: 'address_error' | 'country_error' | 'state_error' | 'zip_error' | 'shipping_contact_invalid' | 'billing_contact_invalid' | string;
|
|
3956
|
+
field?: 'phone' | 'email' | 'name' | 'phonetic_name' | 'address_lines' | 'locality' | 'postal_code' | 'administrative_area' | 'country' | 'country_code';
|
|
3957
|
+
message?: string;
|
|
3958
|
+
};
|
|
3959
|
+
}
|
|
3960
|
+
|
|
3961
|
+
interface OnShippingOptionChangeEventResponse {
|
|
3962
|
+
token?: string;
|
|
3963
|
+
label?: string;
|
|
3964
|
+
amount?: string;
|
|
3965
|
+
error?: {
|
|
3966
|
+
code: 'method_unavailable' | 'store_unavailable' | string;
|
|
3967
|
+
};
|
|
3968
|
+
}
|
|
3969
|
+
|
|
3970
|
+
type ShippingEventToResponse<T> = T extends OnShippingAddressChangeEventData ? OnShippingAddressChangeEventResponse : T extends OnShippingOptionChangeEventData ? OnShippingOptionChangeEventResponse : never;
|
|
3971
|
+
|
|
3972
|
+
declare abstract class BaseWalletButton<T extends BaseWalletMeta> {
|
|
3973
|
+
protected container: Container;
|
|
3974
|
+
protected api: ApiInternal;
|
|
3975
|
+
protected env: string;
|
|
3976
|
+
protected gatewayId: string;
|
|
3977
|
+
protected meta: T;
|
|
3978
|
+
protected eventEmitter: EventEmitter;
|
|
3979
|
+
protected chargeWalletTokenMeta?: ChargeWalletTokenMeta;
|
|
3980
|
+
private onShippingOptionsChangeHandlerRegistered;
|
|
3981
|
+
constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: T, requiredMetaFields: string[]);
|
|
3982
|
+
private getApiAuthType;
|
|
3983
|
+
/**
|
|
3984
|
+
* Current method can change environment. By default environment = sandbox.
|
|
3985
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
3986
|
+
* Bear in mind that you must set an environment before calling `button.load()`.
|
|
3987
|
+
*
|
|
3988
|
+
* @example
|
|
3989
|
+
* button.setEnv('production', 'paydock.com');
|
|
3990
|
+
* @param {string} env - sandbox, production
|
|
3991
|
+
* @param {string} [alias] - Own domain alias
|
|
3992
|
+
*/
|
|
3993
|
+
setEnv(env: string, alias?: string): void;
|
|
3994
|
+
/**
|
|
3995
|
+
* Callback for onClick method.
|
|
3996
|
+
*
|
|
3997
|
+
* @callback OnClickCallback
|
|
3998
|
+
* @param {OnClickEventData} data
|
|
3999
|
+
* @return {Promise<string>} walletToken string result
|
|
4000
|
+
*/
|
|
4001
|
+
/**
|
|
4002
|
+
* Registers a callback function to be invoked when the wallet button gets clicked.
|
|
4003
|
+
* **Note:** is mandatory to handle this event to perform the wallet initialization (and optionally any validation logic).
|
|
4004
|
+
* The event handler needs to return the wallet token string in order for the Wallet charge processing to proceed, or throw an error in case of failure or validation errors.
|
|
4005
|
+
* **Note:** this callback may be called multiple times as the customer closes the payment checkout and re-clicks the button.
|
|
4006
|
+
* It's the merchant's responsibility to handle this situation and evaluate in each case if generating a new WalletCharge Token is required or the previous one can be used in each case, depending on order data and updates.
|
|
4007
|
+
* In case a new one needs to be generated, remember it will need to be preceded by a `setMeta` call.
|
|
4008
|
+
*
|
|
4009
|
+
* @example
|
|
4010
|
+
* button.onClick(async (data) => {
|
|
4011
|
+
* const responseData = await fetch('https://your-server.com/init-wallet-charge');
|
|
4012
|
+
* return responseData.walletToken;
|
|
4013
|
+
* });
|
|
4014
|
+
*
|
|
4015
|
+
* @param {OnClickCallback} handler - Function to be called when the wallet button is clicked.
|
|
4016
|
+
*/
|
|
4017
|
+
onClick(handler: (data: OnClickEventData) => Promise<string>): () => void;
|
|
4018
|
+
/**
|
|
4019
|
+
* Callback for onPaymentSuccessful method.
|
|
4020
|
+
*
|
|
4021
|
+
* @callback OnPaymentSuccessfulCallback
|
|
4022
|
+
* @param {OnPaymentSuccessfulEventData} data
|
|
4023
|
+
*/
|
|
4024
|
+
/**
|
|
4025
|
+
* If the payment was successful, the function passed as parameter will be called.
|
|
4026
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
4027
|
+
*
|
|
4028
|
+
* @example
|
|
4029
|
+
* button.onPaymentSuccessful((data) => {
|
|
4030
|
+
* console.log('Payment successful!');
|
|
4031
|
+
* });
|
|
4032
|
+
*
|
|
4033
|
+
* @example
|
|
4034
|
+
* button.onPaymentSuccessful().then((data) => console.log('Payment successful!'));
|
|
4035
|
+
*
|
|
4036
|
+
* @param {OnPaymentSuccessfulCallback} [handler] - Function to be called when the payment was successful.
|
|
4037
|
+
*/
|
|
4038
|
+
onPaymentSuccessful(handler?: (data: OnPaymentSuccessfulEventData) => void): Promise<unknown> | (() => void);
|
|
4039
|
+
/**
|
|
4040
|
+
* Callback for onPaymentInReview method.
|
|
4041
|
+
*
|
|
4042
|
+
* @callback OnPaymentInReviewCallback
|
|
4043
|
+
* @param {OnPaymentInReviewEventData} data
|
|
4044
|
+
*/
|
|
4045
|
+
/**
|
|
4046
|
+
* If the payment was left in fraud review, the function passed as parameter will be called.
|
|
4047
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
4048
|
+
*
|
|
4049
|
+
* @example
|
|
4050
|
+
* button.onPaymentInReview((data) => {
|
|
4051
|
+
* console.log('Payment in fraud review');
|
|
4052
|
+
* });
|
|
4053
|
+
*
|
|
4054
|
+
* @example
|
|
4055
|
+
* button.onPaymentInReview().then((data) => console.log('Payment in fraud review'));
|
|
4056
|
+
*
|
|
4057
|
+
* @param {OnPaymentInReviewCallback} [handler] - Function to be called when the payment was left in fraud review status.
|
|
4058
|
+
*/
|
|
4059
|
+
onPaymentInReview(handler?: (err: OnPaymentInReviewEventData) => void): Promise<unknown> | (() => void);
|
|
4060
|
+
/**
|
|
4061
|
+
* Callback for onPaymentError method.
|
|
4062
|
+
*
|
|
4063
|
+
* @callback OnPaymentErrorCallback
|
|
4064
|
+
* @param {OnPaymentErrorEventData} data
|
|
4065
|
+
*/
|
|
4066
|
+
/**
|
|
4067
|
+
* If the payment was not successful, the function passed as parameter will be called.
|
|
4068
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
4069
|
+
*
|
|
4070
|
+
* @example
|
|
4071
|
+
* button.onPaymentError((err) => {
|
|
4072
|
+
* console.log('Payment not successful');
|
|
4073
|
+
* });
|
|
4074
|
+
*
|
|
4075
|
+
* @example
|
|
4076
|
+
* button.onPaymentError().then((err) => console.log('Payment not successful'));
|
|
4077
|
+
*
|
|
4078
|
+
* @param {OnPaymentErrorCallback} [handler] - Function to be called when the payment was not successful.
|
|
4079
|
+
*/
|
|
4080
|
+
onPaymentError(handler?: (err: OnPaymentErrorEventData) => void): Promise<unknown> | (() => void);
|
|
4081
|
+
/**
|
|
4082
|
+
* Callback for onCheckoutClose method.
|
|
4083
|
+
*
|
|
4084
|
+
* @callback OnCheckoutCloseCallback
|
|
4085
|
+
* @param {OnCloseEventData} data
|
|
4086
|
+
*/
|
|
4087
|
+
/**
|
|
4088
|
+
* Registers a callback function to be invoked when the wallet checkout closes.
|
|
4089
|
+
*
|
|
4090
|
+
* @example
|
|
4091
|
+
* button.onCheckoutClose(() => {
|
|
4092
|
+
* console.log('Wallet checkout closes');
|
|
4093
|
+
* });
|
|
4094
|
+
*
|
|
4095
|
+
* @param {OnCheckoutCloseCallback} handler - Function to be called when the wallet checkout closes.
|
|
4096
|
+
*/
|
|
4097
|
+
onCheckoutClose(handler?: (err: OnCloseEventData) => void): Promise<unknown> | (() => void);
|
|
4098
|
+
/**
|
|
4099
|
+
* Callback for onShippingAddressChange method.
|
|
4100
|
+
*
|
|
4101
|
+
* @callback OnShippingAddressChangeCallback
|
|
4102
|
+
* @param {OnShippingAddressChangeEventData} data
|
|
4103
|
+
* @return {Promise<OnShippingAddressChangeEventResponse>} Address update result
|
|
4104
|
+
*/
|
|
4105
|
+
/**
|
|
4106
|
+
* If shipping address data is updated, the function passed as parameter will be called.
|
|
4107
|
+
* Use this method to listen for shipping address selection or input from customer when shipping is enabled.
|
|
4108
|
+
* The event handler needs to return a new token in case a backend to backend wallet update call was executed.
|
|
4109
|
+
* In addition, if any error occured, an error string must be supplied.
|
|
4110
|
+
* By default, the event handler will be processed successfuly if neither token nor error is returned.
|
|
4111
|
+
*
|
|
4112
|
+
* @example
|
|
4113
|
+
* button.onShippingAddressChange((data) => {
|
|
4114
|
+
* const responseData = await fetch('https://your-server.com/update-shipping-info');
|
|
4115
|
+
* return { error: null, token: responseData.walletToken };
|
|
4116
|
+
* });
|
|
4117
|
+
*
|
|
4118
|
+
* @param {OnShippingAddressChangeCallback} [handler] - Function to be called when the shipping address data is updated.
|
|
4119
|
+
*/
|
|
4120
|
+
onShippingAddressChange(handler?: (data: OnShippingAddressChangeEventData) => Promise<OnShippingAddressChangeEventResponse>): () => void;
|
|
4121
|
+
/**
|
|
4122
|
+
* Callback for onShippingOptionsChange method.
|
|
4123
|
+
*
|
|
4124
|
+
* @callback OnShippingOptionsChangeCallback
|
|
4125
|
+
* @param {OnShippingOptionChangeEventData} data
|
|
4126
|
+
* @return {Promise<OnShippingOptionChangeEventResponse>} Address update result
|
|
4127
|
+
*/
|
|
4128
|
+
/**
|
|
4129
|
+
* If shipping options data is updated, the function passed as parameter will be called.
|
|
4130
|
+
* Use this method to listen for shipping option selection from customer when shipping is enabled.
|
|
4131
|
+
* The event handler needs to return a new token in case a backend to backend wallet update call was executed.
|
|
4132
|
+
* In addition, if any error occured, an error string must be supplied.
|
|
4133
|
+
* By default, the event handler will be processed successfuly if neither token nor error is returned.
|
|
4134
|
+
*
|
|
4135
|
+
* @example
|
|
4136
|
+
* button.onShippingOptionsChange((data) => {
|
|
4137
|
+
* const responseData = await fetch('https://your-server.com/update-shipping-info');
|
|
4138
|
+
* return { error: null, token: responseData.walletToken };
|
|
4139
|
+
* });
|
|
4140
|
+
*
|
|
4141
|
+
* @param {OnShippingOptionsChangeCallback} [handler] - Function to be called when the shipping options data is updated.
|
|
4142
|
+
*/
|
|
4143
|
+
onShippingOptionsChange(handler?: (data: OnShippingOptionChangeEventData) => Promise<OnShippingOptionChangeEventResponse>): () => void;
|
|
4144
|
+
/**
|
|
4145
|
+
* Callback for onUnavailable method.
|
|
4146
|
+
*
|
|
4147
|
+
* @callback OnUnavailableCallback
|
|
4148
|
+
* @param {OnUnavailableEventData} data
|
|
4149
|
+
*/
|
|
4150
|
+
/**
|
|
4151
|
+
* Registers a callback function to be invoked when the wallet is not available in the current context.
|
|
4152
|
+
*
|
|
4153
|
+
* @example
|
|
4154
|
+
* button.onUnavailable(() => {
|
|
4155
|
+
* console.log('Wallet not available');
|
|
4156
|
+
* });
|
|
4157
|
+
*
|
|
4158
|
+
* @param {OnUnavailableCallback} handler - Function to be called when the wallet is not available in the current context.
|
|
4159
|
+
*/
|
|
4160
|
+
onUnavailable(handler?: (err: OnUnavailableEventData) => void): Promise<unknown> | (() => void);
|
|
4161
|
+
/**
|
|
4162
|
+
* Callback for onError method.
|
|
4163
|
+
*
|
|
4164
|
+
* @callback OnErrorCallback
|
|
4165
|
+
* @param {OnErrorEventData} data
|
|
4166
|
+
*/
|
|
4167
|
+
/**
|
|
4168
|
+
* Registers a callback function to be invoked when an error that is not related to payment execution occurs.
|
|
4169
|
+
* For example, if the amount of the wallet token injected via the `onClick` event handler does not match the amount provided via the initial `meta` or `setMeta` method.
|
|
4170
|
+
*
|
|
4171
|
+
* @example
|
|
4172
|
+
* button.onError((error) => {
|
|
4173
|
+
* console.log('WalletButtonExpress error', error);
|
|
4174
|
+
* });
|
|
4175
|
+
*
|
|
4176
|
+
* @param {OnErrorCallback} handler - Function to be called when the WalletButton has an error.
|
|
4177
|
+
*/
|
|
4178
|
+
onError(handler?: (err: OnErrorEventData) => void): Promise<unknown> | (() => void);
|
|
4179
|
+
/**
|
|
4180
|
+
* Add docs on each child class
|
|
4181
|
+
*/
|
|
4182
|
+
abstract load(): void;
|
|
4183
|
+
/**
|
|
4184
|
+
* Add docs on each child class
|
|
4185
|
+
*/
|
|
4186
|
+
abstract setMeta(meta: object): void;
|
|
4187
|
+
protected getGatewayWalletConfig<T>(): Promise<BaseGatewayConfig<T>>;
|
|
4188
|
+
protected executeWalletCallback<T, U extends {
|
|
4189
|
+
request_type: string;
|
|
4190
|
+
}>(data: U): Promise<T>;
|
|
4191
|
+
protected executeWalletCapture<T>(data: WalletCaptureRequest): Promise<T>;
|
|
4192
|
+
protected handleMerchantOnExpressButtonClickEvent(): Promise<void>;
|
|
4193
|
+
protected handleMerchantOnShippingChangedEvent<T extends OnShippingAddressChangeEventData | OnShippingOptionChangeEventData>(eventData: T): Promise<ShippingEventToResponse<T>>;
|
|
4194
|
+
protected setWalletToken(token: string, opts?: {
|
|
4195
|
+
skipApiAuth: boolean;
|
|
4196
|
+
}): void;
|
|
4197
|
+
protected handleCheckoutClose(): void;
|
|
4198
|
+
protected handleOnUnavailable(): void;
|
|
4199
|
+
protected handleOnError(error?: Error): void;
|
|
4200
|
+
protected eventDataFromApiError(err: any): OnPaymentErrorEventData['data'];
|
|
4201
|
+
protected validateRequiredMetaFields(requiredMetaFields: string[]): void;
|
|
4202
|
+
}
|
|
4203
|
+
|
|
4204
|
+
type ApplePayButtonStyle = 'black' | 'white' | 'white-outline';
|
|
4205
|
+
|
|
4206
|
+
type ApplePayButtonType = 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'plain' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
|
|
4207
|
+
|
|
4208
|
+
declare enum ContactShippingEditingMode {
|
|
4209
|
+
AVAILABLE = "available",
|
|
4210
|
+
STORE_PICKUP = "store_pickup"
|
|
4211
|
+
}
|
|
4212
|
+
|
|
4213
|
+
interface AppleShippingType {
|
|
4214
|
+
contact: {
|
|
4215
|
+
email: string;
|
|
4216
|
+
phone: string;
|
|
4217
|
+
first_name: string;
|
|
4218
|
+
last_name: string;
|
|
4219
|
+
};
|
|
4220
|
+
address_line1: string;
|
|
4221
|
+
address_line2: string;
|
|
4222
|
+
address_city: string;
|
|
4223
|
+
address_postcode: string;
|
|
4224
|
+
address_state: string;
|
|
4225
|
+
address_country: string;
|
|
4226
|
+
}
|
|
4227
|
+
|
|
4228
|
+
interface ApplePayWalletMeta extends BaseWalletMeta {
|
|
4229
|
+
amount_label: string;
|
|
4230
|
+
country: string;
|
|
4231
|
+
merchant_capabilities?: Array<'supports3DS' | 'supportsEMV' | 'supportsCredit' | 'supportsDebit'>;
|
|
4232
|
+
supported_networks?: Array<'visa' | 'masterCard' | 'amex' | 'chinaUnionPay' | 'discover' | 'interac' | 'jcb' | 'privateLabel'>;
|
|
4233
|
+
required_billing_contact_fields?: Array<'email' | 'name' | 'phone' | 'postalAddress'>;
|
|
4234
|
+
required_shipping_contact_fields?: Array<'email' | 'phone'>;
|
|
4235
|
+
apple_pay_capabilities?: Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>;
|
|
4236
|
+
supported_countries?: string[];
|
|
4237
|
+
style?: {
|
|
4238
|
+
button_type?: ApplePayButtonType;
|
|
4239
|
+
button_style?: ApplePayButtonStyle;
|
|
4240
|
+
};
|
|
4241
|
+
shipping?: AppleShippingType;
|
|
4242
|
+
shipping_editing_mode?: ContactShippingEditingMode;
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4245
|
+
/**
|
|
4246
|
+
* Class ApplePayWalletButtonExpress to work with Apple Pay Wallet.
|
|
4247
|
+
*
|
|
4248
|
+
* @extends BaseWalletButton
|
|
4249
|
+
*
|
|
4250
|
+
* @constructor
|
|
4251
|
+
*
|
|
4252
|
+
* @example
|
|
4253
|
+
* var button = new ApplePayWalletButtonExpress('#wallet-buttons', 'publicKeyOrAccessToken', 'gatewayId', meta);
|
|
4254
|
+
*
|
|
4255
|
+
* @param {string} selector - Selector of html element. Container for the ApplePayWalletButtonExpress.
|
|
4256
|
+
* @param {string} publicKeyOrAccessToken - Public key or Access token for the ApplePayWalletButtonExpress.
|
|
4257
|
+
* @param {string} gatewayId - Gateway ID for the ApplePayWalletButtonExpress.
|
|
4258
|
+
* @param {ApplePayWalletMeta} meta - data that configures the Apple Pay Wallet.
|
|
4259
|
+
*/
|
|
4260
|
+
declare class ApplePayWalletButtonExpress extends BaseWalletButton<ApplePayWalletMeta> {
|
|
4261
|
+
private paymentSession;
|
|
4262
|
+
/** @constructs */ constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: ApplePayWalletMeta);
|
|
4263
|
+
/**
|
|
4264
|
+
* Initializes the availability checks and inserts the button if possible.
|
|
4265
|
+
* Otherwise function onUnavailable(handler: VoidFunction) will be called.
|
|
4266
|
+
* **Important**: Is required to invoke this method to render the wallet button.
|
|
4267
|
+
*
|
|
4268
|
+
* @example
|
|
4269
|
+
* button.load();
|
|
4270
|
+
*/
|
|
4271
|
+
load(): void;
|
|
4272
|
+
/**
|
|
4273
|
+
* Call this method if updating the originally-provided meta object after order information changed.
|
|
4274
|
+
* For example, if the order amount has changed from the time where the button was originally rendered.
|
|
4275
|
+
*
|
|
4276
|
+
* @example
|
|
4277
|
+
* button.setMeta(meta);
|
|
4278
|
+
*
|
|
4279
|
+
* @param {ApplePayWalletMeta} meta - // data that configures the Apple Pay Wallet.
|
|
4280
|
+
*/
|
|
4281
|
+
setMeta(meta: ApplePayWalletMeta): void;
|
|
4282
|
+
private checkAvailability;
|
|
4283
|
+
private mount;
|
|
4284
|
+
private onApplePayButtonClicked;
|
|
4285
|
+
private createRequest;
|
|
4286
|
+
private onValidateMerchant;
|
|
4287
|
+
private getMerchantSession;
|
|
4288
|
+
private onPaymentAuthorized;
|
|
4289
|
+
private formatCapabilities;
|
|
4290
|
+
private onCancelPayment;
|
|
4291
|
+
private parseShippingContact;
|
|
4292
|
+
private parseShippingMethod;
|
|
4293
|
+
private onApplePayShippingContactUpdate;
|
|
4294
|
+
private onApplePayShippingMethodUpdate;
|
|
4295
|
+
private parseShippingMethodUpdateEvent;
|
|
4296
|
+
private parseShippingContactUpdateEvent;
|
|
4297
|
+
private formatErrorFields;
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4300
|
+
interface PaypalWalletMeta extends BaseWalletMeta {
|
|
4301
|
+
pay_later?: boolean;
|
|
4302
|
+
hide_message?: boolean;
|
|
4303
|
+
standalone?: boolean;
|
|
4304
|
+
capture?: boolean;
|
|
4305
|
+
style?: {
|
|
4306
|
+
layout?: 'vertical' | 'horizontal';
|
|
4307
|
+
color?: 'gold' | 'blue' | 'silver' | 'black' | 'white';
|
|
4308
|
+
shape?: 'rect' | 'pill' | 'sharp';
|
|
4309
|
+
borderRadius?: number;
|
|
4310
|
+
height?: number;
|
|
4311
|
+
disableMaxWidth?: boolean;
|
|
4312
|
+
label?: 'paypal' | 'checkout' | 'buynow' | 'pay' | 'installment';
|
|
4313
|
+
tagline?: boolean;
|
|
4314
|
+
messages?: {
|
|
4315
|
+
layout?: 'text' | 'flex';
|
|
4316
|
+
logo?: {
|
|
4317
|
+
type?: 'primary' | 'alternative' | 'inline' | 'none';
|
|
4318
|
+
position?: 'left' | 'right' | 'top';
|
|
4319
|
+
};
|
|
4320
|
+
text?: {
|
|
4321
|
+
color?: 'black' | 'white' | 'monochrome' | 'grayscale';
|
|
4322
|
+
size?: 10 | 11 | 12 | 13 | 14 | 15 | 16;
|
|
4323
|
+
align?: 'left' | 'center' | 'right';
|
|
4324
|
+
};
|
|
4325
|
+
color?: 'blue' | 'black' | 'white' | 'white-no-border' | 'gray' | 'monochrome' | 'grayscale';
|
|
4326
|
+
ratio?: '1x1' | '1x4' | '8x1' | '20x1';
|
|
4327
|
+
};
|
|
4328
|
+
};
|
|
4329
|
+
}
|
|
4330
|
+
|
|
4331
|
+
interface PayPalSDK {
|
|
4332
|
+
Buttons?: (options?: PayPalButtonsComponentOptions) => PayPalButtonsComponent;
|
|
4333
|
+
Messages?: (options?: PayPalMessagesComponentOptions) => PayPalMessagesComponent;
|
|
4334
|
+
FUNDING?: Record<string, FUNDING_SOURCE>;
|
|
4335
|
+
}
|
|
4336
|
+
interface PayPalButtonsComponentOptions {
|
|
4337
|
+
/**
|
|
4338
|
+
* Called on button click to set up a one-time payment. [createOrder docs](https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-reference/#createorder).
|
|
4339
|
+
*/
|
|
4340
|
+
createOrder?: PayPalButtonCreateOrder;
|
|
4341
|
+
/**
|
|
4342
|
+
* Used for defining a standalone button.
|
|
4343
|
+
* Learn more about [configuring the funding source for standalone buttons](https://developer.paypal.com/docs/business/checkout/configure-payments/standalone-buttons/#4-funding-sources).
|
|
4344
|
+
*/
|
|
4345
|
+
fundingSource?: PayPalButtonFundingSource;
|
|
4346
|
+
/**
|
|
4347
|
+
* Called when finalizing the transaction. Often used to inform the buyer that the transaction is complete. [onApprove docs](https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-reference/#onapprove).
|
|
4348
|
+
*/
|
|
4349
|
+
onApprove?: PayPalButtonOnApprove;
|
|
4350
|
+
/**
|
|
4351
|
+
* Called when the buyer cancels the transaction.
|
|
4352
|
+
* Often used to show the buyer a [cancellation page](https://developer.paypal.com/docs/business/checkout/add-capabilities/buyer-experience/#3-show-cancellation-page).
|
|
4353
|
+
*/
|
|
4354
|
+
onCancel?: PayPalButtonOnCancel;
|
|
4355
|
+
/**
|
|
4356
|
+
* Called when the button is clicked. Often used for [validation](https://developer.paypal.com/docs/checkout/integration-features/validation/).
|
|
4357
|
+
*/
|
|
4358
|
+
onClick?: PayPalButtonOnClick;
|
|
4359
|
+
/**
|
|
4360
|
+
* Catch all for errors preventing buyer checkout.
|
|
4361
|
+
* Often used to show the buyer an [error page](https://developer.paypal.com/docs/checkout/integration-features/handle-errors/).
|
|
4362
|
+
*/
|
|
4363
|
+
onError?: PayPalButtonOnError;
|
|
4364
|
+
/**
|
|
4365
|
+
* Called when the buyer selects a new shipping option on PayPal.
|
|
4366
|
+
*/
|
|
4367
|
+
onShippingOptionsChange?: PayPalButtonOnShippingOptionsChange;
|
|
4368
|
+
/**
|
|
4369
|
+
* Called when the buyer updates their shipping address on PayPal.
|
|
4370
|
+
*/
|
|
4371
|
+
onShippingAddressChange?: PayPalButtonOnShippingAddressChange;
|
|
4372
|
+
/**
|
|
4373
|
+
* [Styling options](https://developer.paypal.com/docs/business/checkout/reference/style-guide/#customize-the-payment-buttons) for customizing the button appearance.
|
|
4374
|
+
*/
|
|
4375
|
+
style?: PayPalButtonStyle;
|
|
4376
|
+
}
|
|
4377
|
+
interface PayPalButtonsComponent {
|
|
4378
|
+
close: () => Promise<void>;
|
|
4379
|
+
isEligible: () => boolean;
|
|
4380
|
+
render: (container: HTMLElement | string) => Promise<void>;
|
|
4381
|
+
updateProps: (props: PayPalButtonsComponentOptions) => Promise<void>;
|
|
4382
|
+
}
|
|
4383
|
+
type PayPalButtonCreateOrder = (data: CreateOrderData) => Promise<string>;
|
|
4384
|
+
interface CreateOrderData {
|
|
4385
|
+
paymentSource: FUNDING_SOURCE;
|
|
4386
|
+
}
|
|
4387
|
+
type PayPalButtonFundingSource = FUNDING_SOURCE;
|
|
4388
|
+
type FUNDING_SOURCE = 'paypal' | 'venmo' | 'applepay' | 'itau' | 'credit' | 'paylater' | 'card' | 'ideal' | 'sepa' | 'bancontact' | 'giropay' | 'sofort' | 'eps' | 'mybank' | 'p24' | 'verkkopankki' | 'payu' | 'blik' | 'trustly' | 'zimpler' | 'maxima' | 'oxxo' | 'boletobancario' | 'wechatpay' | 'mercadopago' | 'multibanco';
|
|
4389
|
+
type PayPalButtonOnApprove = (data: OnApproveData) => Promise<void>;
|
|
4390
|
+
interface OnApproveData {
|
|
4391
|
+
billingToken?: string | null;
|
|
4392
|
+
facilitatorAccessToken?: string;
|
|
4393
|
+
orderID: string;
|
|
4394
|
+
payerID?: string | null;
|
|
4395
|
+
paymentID?: string | null;
|
|
4396
|
+
subscriptionID?: string | null;
|
|
4397
|
+
authCode?: string | null;
|
|
4398
|
+
}
|
|
4399
|
+
type PayPalButtonOnCancel = (data: Record<string, unknown>) => void;
|
|
4400
|
+
type PayPalButtonOnClick = (data: Record<string, unknown>, actions: OnClickActions) => Promise<void> | void;
|
|
4401
|
+
interface OnClickActions {
|
|
4402
|
+
reject: () => Promise<void>;
|
|
4403
|
+
resolve: () => Promise<void>;
|
|
4404
|
+
}
|
|
4405
|
+
type PayPalButtonOnError = (err: Record<string, unknown>) => void;
|
|
4406
|
+
type PayPalButtonOnShippingOptionsChange = (data: OnShippingOptionsChangeData, actions: OnShippingOptionsChangeActions) => Promise<void>;
|
|
4407
|
+
interface OnShippingOptionsChangeData {
|
|
4408
|
+
orderID?: string;
|
|
4409
|
+
paymentID?: string;
|
|
4410
|
+
paymentToken?: string;
|
|
4411
|
+
errors: {
|
|
4412
|
+
METHOD_UNAVAILABLE: string;
|
|
4413
|
+
STORE_UNAVAILABLE: string;
|
|
4414
|
+
};
|
|
4415
|
+
selectedShippingOption?: CheckoutShippingOption;
|
|
4416
|
+
}
|
|
4417
|
+
interface CheckoutShippingOption {
|
|
4418
|
+
amount: CurrencyCodeAndValue;
|
|
4419
|
+
id?: string;
|
|
4420
|
+
label: string;
|
|
4421
|
+
selected: boolean;
|
|
4422
|
+
type: 'SHIPPING' | 'PICKUP';
|
|
4423
|
+
}
|
|
4424
|
+
interface CurrencyCodeAndValue {
|
|
4425
|
+
currencyCode: string;
|
|
4426
|
+
value: string;
|
|
4427
|
+
}
|
|
4428
|
+
interface OnShippingOptionsChangeActions {
|
|
4429
|
+
reject: (reason?: string) => Promise<void>;
|
|
4430
|
+
}
|
|
4431
|
+
type PayPalButtonOnShippingAddressChange = (data: OnShippingAddressChangeData, actions: OnShippingAddressChangeActions) => Promise<void>;
|
|
4432
|
+
interface OnShippingAddressChangeData {
|
|
4433
|
+
amount: CurrencyCodeAndValue;
|
|
4434
|
+
orderID?: string;
|
|
4435
|
+
paymentID?: string;
|
|
4436
|
+
paymentToken?: string;
|
|
4437
|
+
errors: {
|
|
4438
|
+
ADDRESS_ERROR: string;
|
|
4439
|
+
COUNTRY_ERROR: string;
|
|
4440
|
+
STATE_ERROR: string;
|
|
4441
|
+
ZIP_ERROR: string;
|
|
4442
|
+
};
|
|
4443
|
+
shippingAddress: {
|
|
4444
|
+
city: string;
|
|
4445
|
+
state: string;
|
|
4446
|
+
/** The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region. */
|
|
4447
|
+
countryCode: string;
|
|
4448
|
+
/**
|
|
4449
|
+
* The postal code, which is the zip code or equivalent.
|
|
4450
|
+
* Typically required for countries with a postal code or an equivalent.
|
|
4451
|
+
*/
|
|
4452
|
+
postalCode: string;
|
|
4453
|
+
};
|
|
4454
|
+
}
|
|
4455
|
+
interface OnShippingAddressChangeActions {
|
|
4456
|
+
reject: (reason?: string) => Promise<void>;
|
|
4457
|
+
}
|
|
4458
|
+
interface PayPalButtonStyle {
|
|
4459
|
+
borderRadius?: number;
|
|
4460
|
+
color?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
|
|
4461
|
+
disableMaxWidth?: boolean;
|
|
4462
|
+
height?: number;
|
|
4463
|
+
label?: 'paypal' | 'checkout' | 'buynow' | 'pay' | 'installment' | 'subscribe' | 'donate';
|
|
4464
|
+
layout?: 'vertical' | 'horizontal';
|
|
4465
|
+
shape?: 'rect' | 'pill' | 'sharp';
|
|
4466
|
+
tagline?: boolean;
|
|
4467
|
+
}
|
|
4468
|
+
interface PayPalMessagesComponentOptions {
|
|
4469
|
+
amount?: number | string;
|
|
4470
|
+
currency?: 'USD' | 'GBP' | 'EUR';
|
|
4471
|
+
style?: {
|
|
4472
|
+
layout?: 'text' | 'flex' | 'custom';
|
|
4473
|
+
color?: string;
|
|
4474
|
+
logo?: {
|
|
4475
|
+
type?: 'primary' | 'alternative' | 'inline' | 'none';
|
|
4476
|
+
position?: 'left' | 'right' | 'top';
|
|
4477
|
+
};
|
|
4478
|
+
text?: {
|
|
4479
|
+
color?: 'black' | 'white' | 'monochrome' | 'grayscale';
|
|
4480
|
+
size?: 10 | 11 | 12 | 13 | 14 | 15 | 16;
|
|
4481
|
+
align?: 'left' | 'center' | 'right';
|
|
4482
|
+
};
|
|
4483
|
+
ratio?: '1x1' | '1x4' | '8x1' | '20x1';
|
|
4484
|
+
};
|
|
4485
|
+
placement?: 'home' | 'category' | 'product' | 'cart' | 'payment';
|
|
4486
|
+
onApply?: (data: Record<string, unknown>) => void;
|
|
4487
|
+
onClick?: (data: Record<string, unknown>) => void;
|
|
4488
|
+
onRender?: (data: Record<string, unknown>) => void;
|
|
4489
|
+
}
|
|
4490
|
+
interface PayPalMessagesComponent {
|
|
4491
|
+
render: (container: HTMLElement | string) => Promise<void>;
|
|
4492
|
+
}
|
|
4493
|
+
|
|
4494
|
+
/**
|
|
4495
|
+
* Class PaypalWalletButtonExpress to work with Paypal Wallet.
|
|
4496
|
+
*
|
|
4497
|
+
* @extends BaseWalletButton
|
|
4498
|
+
*
|
|
4499
|
+
* @constructor
|
|
4500
|
+
*
|
|
4501
|
+
* @example
|
|
4502
|
+
* var button = new PaypalWalletButtonExpress('#wallet-buttons', 'publicKeyOrAccessToken', 'gatewayId', meta);
|
|
4503
|
+
*
|
|
4504
|
+
* @param {string} selector - Selector of html element. Container for the PaypalWalletButtonExpress.
|
|
4505
|
+
* @param {string} publicKeyOrAccessToken - Public key or Access token for the PaypalWalletButtonExpress.
|
|
4506
|
+
* @param {string} gatewayId - Gateway ID for the PaypalWalletButtonExpress.
|
|
4507
|
+
* @param {PaypalWalletMeta} meta - data that configures the Paypal Wallet.
|
|
4508
|
+
*/
|
|
4509
|
+
declare class PaypalWalletButtonExpress extends BaseWalletButton<PaypalWalletMeta> {
|
|
4510
|
+
private config;
|
|
4511
|
+
protected paypal: PayPalSDK;
|
|
4512
|
+
protected pendingApprovalPromise?: Promise<{
|
|
4513
|
+
status: string;
|
|
4514
|
+
}>;
|
|
4515
|
+
private shippingRequested;
|
|
4516
|
+
/** @constructs */ constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: PaypalWalletMeta);
|
|
4517
|
+
/**
|
|
4518
|
+
* Initializes the availability checks and inserts the button if possible.
|
|
4519
|
+
* Otherwise function onUnavailable(handler: VoidFunction) will be called.
|
|
4520
|
+
* **Important**: Is required to invoke this method to render the wallet button.
|
|
4521
|
+
*
|
|
4522
|
+
* @example
|
|
4523
|
+
* button.load();
|
|
4524
|
+
*/
|
|
4525
|
+
load(): void;
|
|
4526
|
+
/**
|
|
4527
|
+
* Call this method if updating the originally-provided meta object after order information changed.
|
|
4528
|
+
* For example, if the order amount has changed from the time where the button was originally rendered.
|
|
4529
|
+
*
|
|
4530
|
+
* @example
|
|
4531
|
+
* button.setMeta(meta);
|
|
4532
|
+
* @param {PaypalWalletMeta} meta - // data that configures the Paypal Wallet.
|
|
4533
|
+
*/
|
|
4534
|
+
setMeta(meta: PaypalWalletMeta): void;
|
|
4535
|
+
private renderPaypalButton;
|
|
4536
|
+
private renderPaypalCommonComponent;
|
|
4537
|
+
private renderPaypalStandaloneComponent;
|
|
4538
|
+
private paypalSharedProps;
|
|
4539
|
+
private handleShippingAddressUpdate;
|
|
4540
|
+
private handleShippingOptionsUpdate;
|
|
4541
|
+
}
|
|
4542
|
+
|
|
4543
|
+
declare enum ErrorCodes$1 {
|
|
4544
|
+
PROMISE_NOT_ENABLED = "promise_not_enabled",
|
|
4545
|
+
SCRIPT_ERROR = "script_error"
|
|
4546
|
+
}
|
|
4547
|
+
interface PayPalDataCollectorConfig {
|
|
4548
|
+
mouse_movement?: boolean;
|
|
4549
|
+
}
|
|
4550
|
+
interface IPayPalDataCollector {
|
|
4551
|
+
collectDeviceData(): Promise<CollectedDeviceData>;
|
|
4552
|
+
setEnv(env: string): void;
|
|
4553
|
+
}
|
|
4554
|
+
interface CollectedDeviceData {
|
|
4555
|
+
correlation_id: string;
|
|
4556
|
+
}
|
|
4557
|
+
interface IOnErrorEventData$1 {
|
|
4558
|
+
error_code: ErrorCodes$1;
|
|
4559
|
+
}
|
|
4560
|
+
|
|
4561
|
+
/**
|
|
4562
|
+
* PayPal Data Collector Widget constructor
|
|
4563
|
+
*
|
|
4564
|
+
* @param {string} [flowId] - This string identifies the source website of the FraudNet request.
|
|
4565
|
+
* @param {PayPalDataCollectorConfig} [config] - Extra configuration for the widget.
|
|
4566
|
+
*
|
|
4567
|
+
* @example
|
|
4568
|
+
* var payPalDataCollector = new PayPalDataCollector('FLOW_ID', {});
|
|
4569
|
+
*/
|
|
4570
|
+
declare class PayPalDataCollector {
|
|
4571
|
+
protected service: IPayPalDataCollector;
|
|
4572
|
+
protected eventEmitter: EventEmitter;
|
|
4573
|
+
/** @constructs */ constructor(flowId?: string, config?: PayPalDataCollectorConfig);
|
|
4574
|
+
/**
|
|
4575
|
+
* After configuring the PayPalDataCollector Widget, starts the process and returns
|
|
4576
|
+
* the correlation id used among the requests asynchronously.
|
|
4577
|
+
*
|
|
4578
|
+
* @returns {Promise<CollectedDeviceData>} Promise when resolved, returns an object
|
|
4579
|
+
* that contains the `correlation_id` key.
|
|
4580
|
+
*
|
|
4581
|
+
* @example
|
|
4582
|
+
* const collectedDeviceData = await payPalDataCollectorWidget.collectDeviceData();
|
|
4583
|
+
* console.log(collectedDeviceData.correlation_id)
|
|
4584
|
+
*/
|
|
4585
|
+
collectDeviceData(): Promise<CollectedDeviceData>;
|
|
4586
|
+
/**
|
|
4587
|
+
* Callback for onError method.
|
|
4588
|
+
*
|
|
4589
|
+
* @callback OnErrorCallback
|
|
4590
|
+
* @param {IOnErrorEventData|null} data
|
|
4591
|
+
*/
|
|
4592
|
+
/**
|
|
4593
|
+
* If the process fails, the function passed as parameter will be called.
|
|
4594
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
4595
|
+
*
|
|
4596
|
+
* @example
|
|
4597
|
+
* PayPalDataCollector.onError((eventData) => console.log('Some error occur'));
|
|
4598
|
+
*
|
|
4599
|
+
* @param {OnErrorCallback} [callback] - Function to be called when there is an error in the flow.
|
|
4600
|
+
*/
|
|
4601
|
+
onError(callback?: (data?: IOnErrorEventData$1) => void): () => void;
|
|
4602
|
+
/**
|
|
4603
|
+
* Current method can change environment. By default environment = test.
|
|
4604
|
+
* This method does not affect Paydock's API calls or environments, is only for PayPal Data Collector
|
|
4605
|
+
* script, in order to know if the script is injected on a live server or is a testing
|
|
4606
|
+
* environment. The available values are `test` and `live`. This should match with the used
|
|
4607
|
+
* `gateway.mode` in Paydock to process the transaction.
|
|
4608
|
+
*
|
|
4609
|
+
* @example
|
|
4610
|
+
* PayPalDataCollector.setEnv('live');
|
|
4611
|
+
* @param {string} env - test, live
|
|
4612
|
+
*/
|
|
4613
|
+
setEnv(env: string): void;
|
|
4614
|
+
}
|
|
4615
|
+
|
|
4616
|
+
interface PayPalStyleConfig {
|
|
4617
|
+
layout?: 'vertical' | 'horizontal';
|
|
4618
|
+
color?: 'blue' | 'gold' | 'silver' | 'black' | 'white';
|
|
4619
|
+
shape?: 'rect' | 'sharp' | 'pill';
|
|
4620
|
+
label?: 'paypal' | 'checkout' | 'buynow' | 'pay';
|
|
4621
|
+
disableMaxWidth?: boolean;
|
|
4622
|
+
disableMaxHeight?: boolean;
|
|
4623
|
+
height?: number;
|
|
4624
|
+
borderRadius?: number;
|
|
4625
|
+
tagline?: boolean;
|
|
4626
|
+
}
|
|
4627
|
+
interface PayPalMessageConfig {
|
|
4628
|
+
amount?: number;
|
|
4629
|
+
align?: 'center' | 'left' | 'right';
|
|
4630
|
+
color?: 'black' | 'white';
|
|
4631
|
+
position?: 'top' | 'bottom';
|
|
4632
|
+
}
|
|
4633
|
+
interface PayPalSavePaymentSourceWidgetConfig {
|
|
4634
|
+
style?: PayPalStyleConfig;
|
|
4635
|
+
message?: PayPalMessageConfig;
|
|
4636
|
+
}
|
|
4637
|
+
interface IPayPalSavePaymentSourceWidget {
|
|
4638
|
+
load(container: Container): void;
|
|
4639
|
+
setEnv(env: string, alias?: string): void;
|
|
4640
|
+
}
|
|
4641
|
+
declare enum ErrorCodes {
|
|
4642
|
+
UNAVAILABLE = "unavailable",
|
|
4643
|
+
ON_PAYPAL_VAULT_SETUP_TOKEN_ERROR = "onPaypalVaultSetupTokenError",
|
|
4644
|
+
ON_GET_ID_TOKEN_ERROR = "onGetIdTokenError",
|
|
4645
|
+
ON_GET_WALLET_CONFIG_ERROR = "onGetWalletConfigError",
|
|
4646
|
+
ON_GET_SETUP_TOKEN_ERROR = "onGetSetupTokenError",
|
|
4647
|
+
ON_ONE_TIME_TOKEN_ERROR = "onOneTimeTokenError"
|
|
4648
|
+
}
|
|
4649
|
+
declare enum EVENTS {
|
|
4650
|
+
ON_SUCCESS = "ON_SUCCESS",
|
|
4651
|
+
ON_ERROR = "ON_ERROR",
|
|
4652
|
+
ON_CANCEL = "ON_CANCEL"
|
|
4653
|
+
}
|
|
4654
|
+
interface IOnSuccessEventData {
|
|
4655
|
+
event: EVENTS.ON_SUCCESS;
|
|
4656
|
+
data: {
|
|
4657
|
+
token: string;
|
|
4658
|
+
email: string;
|
|
4659
|
+
};
|
|
4660
|
+
}
|
|
4661
|
+
interface IOnErrorEventData {
|
|
4662
|
+
event: EVENTS.ON_ERROR;
|
|
4663
|
+
data: {
|
|
4664
|
+
error_code: ErrorCodes;
|
|
4665
|
+
details?: string;
|
|
4666
|
+
message?: string;
|
|
4667
|
+
};
|
|
4668
|
+
}
|
|
4669
|
+
interface IOnCancelEventData {
|
|
4670
|
+
event: EVENTS.ON_CANCEL;
|
|
4671
|
+
}
|
|
4672
|
+
|
|
4673
|
+
/**
|
|
4674
|
+
* PayPal Save Payment Source Widget constructor
|
|
4675
|
+
*
|
|
4676
|
+
* @param {string} selector - Selector of html element. Container for PayPal Save Payment Source Widget.
|
|
4677
|
+
* @param {string} publicKey - PayDock users public key.
|
|
4678
|
+
* @param {string} gatewayId - PayDock's PayPal gatewayId.
|
|
4679
|
+
* @param {PayPalSavePaymentSourceWidgetConfig} config - Extra configuration for the widget, like styles.
|
|
4680
|
+
*
|
|
4681
|
+
* @example
|
|
4682
|
+
* var payPalSavePaymentSourceWidget = new PayPalSavePaymentSourceWidget('#paypalButton', 'public_key', 'gateway_id');
|
|
4683
|
+
*/
|
|
4684
|
+
declare class PayPalSavePaymentSourceWidget {
|
|
4685
|
+
protected container: Container;
|
|
4686
|
+
protected service: IPayPalSavePaymentSourceWidget;
|
|
4687
|
+
protected eventEmitter: EventEmitter;
|
|
4688
|
+
/** @constructs */ constructor(selector: string, publicKey: string, gatewayId: string, config?: PayPalSavePaymentSourceWidgetConfig);
|
|
4689
|
+
/**
|
|
4690
|
+
* The final method after configuring the PayPalSavePaymentSource Widget to
|
|
4691
|
+
* start the load process.
|
|
4692
|
+
*/
|
|
4693
|
+
load(): void;
|
|
4694
|
+
/**
|
|
4695
|
+
* Current method can change environment. By default environment = sandbox.
|
|
4696
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
4697
|
+
*
|
|
4698
|
+
* @example
|
|
4699
|
+
* payPalSavePaymentSourceWidget.setEnv('production');
|
|
4700
|
+
* @param {string} env - sandbox, production
|
|
4701
|
+
* @param {string} [alias] - Own domain alias
|
|
4702
|
+
*/
|
|
4703
|
+
setEnv(env: string, alias?: string): void;
|
|
4704
|
+
/**
|
|
4705
|
+
* Callback for onSuccess method.
|
|
4706
|
+
*
|
|
4707
|
+
* @callback OnSuccessCallback
|
|
4708
|
+
* @param {IOnSuccessEventData} data
|
|
4709
|
+
*/
|
|
4710
|
+
/**
|
|
4711
|
+
* If the setup token was successfully approved and a OTT was generated, the function passed as parameter will be called.
|
|
4712
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
4713
|
+
*
|
|
4714
|
+
* @example
|
|
4715
|
+
* payPalSavePaymentSourceWidget.onSuccess((eventData) => console.log('One time token and email obtained successfully'));
|
|
4716
|
+
*
|
|
4717
|
+
* @param {OnSuccessCallback} [callback] - Function to be called when the result is successful.
|
|
4718
|
+
*/
|
|
4719
|
+
onSuccess(callback?: (data: IOnSuccessEventData) => void): () => void;
|
|
4720
|
+
/**
|
|
4721
|
+
* Callback for onError method.
|
|
4722
|
+
*
|
|
4723
|
+
* @callback OnErrorCallback
|
|
4724
|
+
* @param {IOnErrorEventData} data
|
|
4725
|
+
*/
|
|
4726
|
+
/**
|
|
4727
|
+
* If in the process for obtaining the setup token fails, the function passed as parameter will be called.
|
|
4728
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
4729
|
+
*
|
|
4730
|
+
* @example
|
|
4731
|
+
* payPalSavePaymentSourceWidget.onError((eventData) => console.log('Some error occurred'));
|
|
4732
|
+
*
|
|
4733
|
+
* @param {OnErrorCallback} [callback] - Function to be called when there is an error in the flow.
|
|
4734
|
+
*/
|
|
4735
|
+
onError(callback?: (data: IOnErrorEventData) => void): () => void;
|
|
4736
|
+
/**
|
|
4737
|
+
* Callback for onCancel method.
|
|
4738
|
+
*
|
|
4739
|
+
* @callback OnCancelCallback
|
|
4740
|
+
* @param {IOnCancelEventData} data
|
|
4741
|
+
*/
|
|
4742
|
+
/**
|
|
4743
|
+
* If in the process for obtaining the setup token was cancelled, the function passed as parameter will be called.
|
|
4744
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
4745
|
+
*
|
|
4746
|
+
* @example
|
|
4747
|
+
* payPalSavePaymentSourceWidget.onCancel(() => console.log('Operation cancelled'));
|
|
4748
|
+
*
|
|
4749
|
+
* @param {OnCancelCallback} [callback] - Function to be called when the operation is cancelled.
|
|
4750
|
+
*/
|
|
4751
|
+
onCancel(callback?: (data?: IOnCancelEventData) => void): () => void;
|
|
4752
|
+
}
|
|
4753
|
+
|
|
4754
|
+
declare global {
|
|
4755
|
+
interface Window {
|
|
4756
|
+
paydock: {
|
|
4757
|
+
WalletButtons: typeof WalletButtons;
|
|
4758
|
+
PaypalCheckoutButton: typeof PaypalCheckoutButton;
|
|
4759
|
+
AfterpayCheckoutButton: typeof AfterpayCheckoutButton;
|
|
4760
|
+
ZipmoneyCheckoutButton: typeof ZipmoneyCheckoutButton;
|
|
4761
|
+
PaymentSourceWidget: typeof PaymentSourceWidget;
|
|
4762
|
+
VaultDisplayWidget: typeof VaultDisplayWidget;
|
|
4763
|
+
ClickToPay: typeof ClickToPay;
|
|
4764
|
+
ExternalCheckoutBuilder: typeof Builder$1;
|
|
4765
|
+
ExternalCheckoutChecker: typeof Checker;
|
|
4766
|
+
PaymentSourceBuilder: typeof Builder;
|
|
4767
|
+
Canvas3DS: typeof Canvas3ds;
|
|
4768
|
+
MultiWidget: typeof MultiWidget;
|
|
4769
|
+
HtmlMultiWidget: typeof HtmlMultiWidget;
|
|
4770
|
+
HtmlWidget: typeof HtmlWidget;
|
|
4771
|
+
PayPalDataCollector: typeof PayPalDataCollector;
|
|
4772
|
+
PayPalSavePaymentSource: typeof PayPalSavePaymentSourceWidget;
|
|
4773
|
+
};
|
|
4774
|
+
}
|
|
4775
|
+
}
|
|
4776
|
+
|
|
4777
|
+
export { AfterpayCheckoutButton, Api, ApplePayWalletButtonExpress, CHECKOUT_BUTTON_EVENT, Canvas3ds, Checkout, ClickToPay, Configuration, ELEMENT, EVENT$1 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD, FRAUD_PREVENTION_EVENTS, type FraudPreventionEvent, type FraudPreventionEventType, type FraudPreventionProvider, FraudPreventionService, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, type ICheckout, type IClickToPayMeta, type IDetails, type IElementStyleInput, type IEventCheckoutFinishData, type IEventData, type IPayPalMeta, type IStyles$1 as IStyles, type ITexts, type IWalletMeta, type IWalletOnClickEvent, type IWalletPaymentSuccessfulEvent, type IWalletUnavailableEvent, type IWalletUpdateData, type IWalletUpdateEvent, InstructionDebugger, MultiWidget, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE, SUPPORTED_CARD_TYPES, TEXT, TRIGGER, TYPE, VAULT_DISPLAY_STYLE, type VaultDisplayStyle, VaultDisplayWidget, WalletButtons, ZipmoneyCheckoutButton };
|