@paydock/client-sdk 1.104.9-beta → 1.105.56-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 +1984 -396
- package/bundles/index.cjs +33513 -8908
- package/bundles/index.cjs.d.ts +867 -52
- package/bundles/index.mjs +33507 -8908
- package/bundles/index.mjs.d.ts +867 -52
- package/bundles/types/api/api-base.d.ts +19 -6
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/api/api-charge-internal.d.ts +1 -0
- package/bundles/types/api/api-charge-internal.d.ts.map +1 -1
- package/bundles/types/api/api-checkout-internal.d.ts +57 -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 +4 -0
- package/bundles/types/api/api-internal.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +3 -3
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
- package/bundles/types/checkout/checkout.d.ts +86 -0
- package/bundles/types/checkout/checkout.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/instruction-handler.d.ts +23 -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 +5 -0
- package/bundles/types/checkout/helpers/resource-helper.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/session-helper.d.ts +5 -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 +19 -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.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 +52 -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.runner.d.ts +2 -0
- package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts.map +1 -1
- package/bundles/types/checkout-button/checkout-contextual-handler.d.ts +4 -0
- package/bundles/types/checkout-button/checkout-contextual-handler.d.ts.map +1 -1
- package/bundles/types/checkout-button/runner/contextual.runner.d.ts +2 -1
- package/bundles/types/checkout-button/runner/contextual.runner.d.ts.map +1 -1
- package/bundles/types/checkout-button/runner/popup.runner.d.ts +3 -3
- package/bundles/types/checkout-button/runner/popup.runner.d.ts.map +1 -1
- package/bundles/types/components/http-core.d.ts.map +1 -1
- package/bundles/types/components/iframe-event.d.ts +2 -0
- package/bundles/types/components/iframe-event.d.ts.map +1 -1
- package/bundles/types/components/iframe.d.ts +2 -0
- package/bundles/types/components/iframe.d.ts.map +1 -1
- package/bundles/types/components/link.d.ts +1 -0
- package/bundles/types/components/link.d.ts.map +1 -1
- package/bundles/types/components/param.d.ts +6 -0
- package/bundles/types/components/param.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.cba.d.ts +1 -1
- package/bundles/types/configs/env/environment.cba.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.paydock.d.ts +1 -1
- package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
- package/bundles/types/helper/access-token.d.ts +1 -0
- package/bundles/types/helper/access-token.d.ts.map +1 -1
- package/bundles/types/helper/event-emitter.d.ts +1 -0
- package/bundles/types/helper/event-emitter.d.ts.map +1 -1
- 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/widget-logger.d.ts +9 -0
- package/bundles/types/helper/widget-logger.d.ts.map +1 -0
- package/bundles/types/index-cba.d.ts +4 -0
- package/bundles/types/index-cba.d.ts.map +1 -1
- package/bundles/types/index.d.ts +4 -0
- package/bundles/types/index.d.ts.map +1 -1
- 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 +59 -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 +18 -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 +86 -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 +84 -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 +37 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/index.d.ts +2 -1
- package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/interfaces.d.ts +12 -2
- package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -1
- 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/index.d.ts +2 -0
- package/bundles/types/shared/http/index.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/wallet-buttons/index.d.ts +4 -0
- package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +4 -4
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +4 -4
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/{afterpay.wallet-service.d.ts → wallet-services/afterpay.wallet-service.d.ts} +1 -1
- package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{apple.wallet-service.d.ts → wallet-services/apple.wallet-service.d.ts} +3 -3
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{flypay-v2.wallet-service.d.ts → wallet-services/flypay-v2.wallet-service.d.ts} +3 -3
- package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{flypay.wallet-service.d.ts → wallet-services/flypay.wallet-service.d.ts} +6 -6
- package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{google.wallet-service.d.ts → wallet-services/google.wallet-service.d.ts} +4 -4
- 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.map +1 -0
- package/bundles/types/wallet-buttons/{paypal.wallet-service.d.ts → wallet-services/paypal.wallet-service.d.ts} +1 -1
- package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{stripe.wallet-service.d.ts → wallet-services/stripe.wallet-service.d.ts} +1 -1
- package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{wallet-service.d.ts → wallet-services/wallet-service.d.ts} +4 -4
- 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 +195 -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 +10 -0
- package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/index.d.ts +131 -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 +14 -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-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 +50 -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 +3 -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/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 +17 -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/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-wallet-meta.interface.d.ts +31 -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 +47 -0
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -0
- package/bundles/types/widget/configuration.d.ts.map +1 -1
- package/bundles/types/widget/html-multi-widget.d.ts +4 -3
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +33513 -8908
- package/bundles/widget.umd.js.d.ts +867 -52
- package/bundles/widget.umd.js.min.d.ts +867 -52
- package/bundles/widget.umd.min.js +61 -2
- package/docs/click-to-pay-examples.md +36 -0
- package/docs/click-to-pay.md +4 -1
- package/docs/html/layout.html +1 -0
- package/docs/paypal-data-collector-examples.md +58 -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/wallet-buttons-examples.md +29 -2
- package/docs/wallet-buttons-express-examples.md +201 -0
- package/docs/wallet-buttons-express.md +786 -0
- package/docs/wallet-buttons.md +3 -0
- package/examples/multi-html-widget/simple.html +2 -1
- package/package.json +98 -92
- package/slate.md +65 -2
- package/bundles/index.cjs.map +0 -1
- package/bundles/index.mjs.map +0 -1
- package/bundles/types/wallet-buttons/afterpay.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/apple.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/flypay.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/google.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/mastercard.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/paypal.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/stripe.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/wallet-service.d.ts.map +0 -1
- package/bundles/widget.umd.js.map +0 -1
- package/bundles/widget.umd.min.js.map +0 -1
- /package/bundles/types/wallet-buttons/{mastercard.wallet-service.d.ts → wallet-services/mastercard.wallet-service.d.ts} +0 -0
package/bundles/index.cjs.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Observable, Subscriber } from 'rxjs';
|
|
2
|
+
import { MicroAgent } from '@newrelic/browser-agent/loaders/micro-agent';
|
|
3
|
+
|
|
1
4
|
declare class ApiCharge {
|
|
2
5
|
protected api: Api;
|
|
3
6
|
constructor(api: Api);
|
|
@@ -54,6 +57,57 @@ declare class Env implements IEnvironment {
|
|
|
54
57
|
private isValidMode;
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
type HttpRequestMethod = 'DELETE' | 'GET' | 'OPTIONS' | 'POST' | 'PUT';
|
|
61
|
+
|
|
62
|
+
type AgentPrototype = Pick<(typeof MicroAgent)['prototype'], 'addPageAction' | 'noticeError'>;
|
|
63
|
+
type AgentMethodNames = keyof AgentPrototype;
|
|
64
|
+
type AgentMethodParameters<T extends AgentMethodNames> = Parameters<AgentPrototype[T]>;
|
|
65
|
+
declare class InstrumentationAgent extends MicroAgent {
|
|
66
|
+
private static agent;
|
|
67
|
+
private static available;
|
|
68
|
+
private static initialized;
|
|
69
|
+
private constructor();
|
|
70
|
+
static get instance(): InstrumentationAgent;
|
|
71
|
+
isAvailable(): boolean;
|
|
72
|
+
call: <T extends "addPageAction" | "noticeError">(method: T, ...args: AgentMethodParameters<T>) => void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface CustomEventDTO {
|
|
76
|
+
environment: string;
|
|
77
|
+
appId?: never;
|
|
78
|
+
timestamp?: never;
|
|
79
|
+
[x: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
interface ReportBaseContext {
|
|
82
|
+
environment: string;
|
|
83
|
+
sdkVersion: string | null;
|
|
84
|
+
description?: string;
|
|
85
|
+
[x: string]: SerializableValue | undefined;
|
|
86
|
+
}
|
|
87
|
+
type SerializableValue = string | number | symbol | object | null;
|
|
88
|
+
|
|
89
|
+
type ReportErrorFn = (repository: ErrorRepository, error: string | Error, ctx: ReportBaseContext & ({
|
|
90
|
+
className: string;
|
|
91
|
+
classMethod: string;
|
|
92
|
+
functionName?: never;
|
|
93
|
+
} | {
|
|
94
|
+
className?: never;
|
|
95
|
+
classMethod?: never;
|
|
96
|
+
functionName: string;
|
|
97
|
+
})) => void;
|
|
98
|
+
declare class ErrorRepository {
|
|
99
|
+
private readonly agent;
|
|
100
|
+
constructor();
|
|
101
|
+
createError(...args: Parameters<InstrumentationAgent['noticeError']>): Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
type ReportEventFn = (repository: EventRepository, actionName: string, ctx: ReportBaseContext & CustomEventDTO) => void;
|
|
105
|
+
declare class EventRepository {
|
|
106
|
+
private readonly agent;
|
|
107
|
+
constructor();
|
|
108
|
+
createEvent(...args: Parameters<InstrumentationAgent['addPageAction']>): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
|
|
57
111
|
declare enum API_AUTH_TYPE {
|
|
58
112
|
PUBLIC_KEY = 0,
|
|
59
113
|
TOKEN = 1
|
|
@@ -62,6 +116,7 @@ declare class ApiBase {
|
|
|
62
116
|
protected env: Env;
|
|
63
117
|
auth: string;
|
|
64
118
|
authType: API_AUTH_TYPE;
|
|
119
|
+
private stoppedPooling;
|
|
65
120
|
constructor(auth: string, authType?: API_AUTH_TYPE);
|
|
66
121
|
/**
|
|
67
122
|
* Current method can change environment. By default environment = sandbox.
|
|
@@ -73,12 +128,15 @@ declare class ApiBase {
|
|
|
73
128
|
* @param {string} [alias] - Own domain alias
|
|
74
129
|
*/
|
|
75
130
|
setEnv(env: string, alias?: string): ApiBase;
|
|
131
|
+
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, sessionId: string, reconnectInterval?: number): Observable<Res>;
|
|
132
|
+
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, sessionId: any, reconnectInterval: any): void;
|
|
133
|
+
destroyLongPolling(): void;
|
|
76
134
|
setAuthType(): API_AUTH_TYPE;
|
|
77
|
-
getClient(method: 'GET' | 'POST'
|
|
135
|
+
getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
78
136
|
config: XMLHttpRequest;
|
|
79
|
-
send: (body: any, cb?: (data
|
|
137
|
+
send: (body: any, cb?: (data) => void, errorCb?: (data: any) => any) => void;
|
|
80
138
|
};
|
|
81
|
-
getClientPromise<Req extends object, Res>(method: 'GET' | 'POST'
|
|
139
|
+
getClientPromise<Req extends object, Res>(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
82
140
|
config: XMLHttpRequest;
|
|
83
141
|
send: (body: Req) => Promise<Res>;
|
|
84
142
|
};
|
|
@@ -90,7 +148,14 @@ declare class ApiBase {
|
|
|
90
148
|
text: string;
|
|
91
149
|
status: number;
|
|
92
150
|
}): Promise<Res>;
|
|
93
|
-
|
|
151
|
+
reportEvent: ReportEventFn;
|
|
152
|
+
reportError: ReportErrorFn;
|
|
153
|
+
protected newApiRequest(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): XMLHttpRequest;
|
|
154
|
+
protected get ctx(): {
|
|
155
|
+
sdkVersion: string;
|
|
156
|
+
className: string;
|
|
157
|
+
environment: string;
|
|
158
|
+
};
|
|
94
159
|
}
|
|
95
160
|
|
|
96
161
|
interface BrowserDetails {
|
|
@@ -560,6 +625,7 @@ interface IWalletMeta {
|
|
|
560
625
|
refresh_token?: string;
|
|
561
626
|
style?: WalletStyles;
|
|
562
627
|
wallets?: WALLET_TYPE[];
|
|
628
|
+
client_id?: string;
|
|
563
629
|
}
|
|
564
630
|
|
|
565
631
|
declare class Link {
|
|
@@ -605,6 +671,8 @@ declare class IFrame {
|
|
|
605
671
|
isExist(): boolean;
|
|
606
672
|
getElement(): HTMLIFrameElement;
|
|
607
673
|
setStyle(property: string, value: string): void;
|
|
674
|
+
setIframeHeight(iframeElement: HTMLIFrameElement, iFrameDocument: Document, selector: string): void;
|
|
675
|
+
private setStyles;
|
|
608
676
|
}
|
|
609
677
|
|
|
610
678
|
/**
|
|
@@ -628,7 +696,7 @@ interface IEventData$1 {
|
|
|
628
696
|
data?: any;
|
|
629
697
|
ref_id?: string;
|
|
630
698
|
}
|
|
631
|
-
declare const EVENT: {
|
|
699
|
+
declare const EVENT$1: {
|
|
632
700
|
AFTER_LOAD: string;
|
|
633
701
|
SUBMIT: string;
|
|
634
702
|
FINISH: string;
|
|
@@ -641,6 +709,8 @@ declare const EVENT: {
|
|
|
641
709
|
CHECKOUT_COMPLETED: string;
|
|
642
710
|
CHECKOUT_POPUP_OPEN: string;
|
|
643
711
|
CHECKOUT_POPUP_CLOSE: string;
|
|
712
|
+
RECOGNITION_TOKEN_REQUESTED: string;
|
|
713
|
+
RECOGNITION_TOKEN_DROPPED: string;
|
|
644
714
|
VALIDATION: string;
|
|
645
715
|
SELECT: string;
|
|
646
716
|
UNSELECT: string;
|
|
@@ -834,6 +904,7 @@ declare class Configuration {
|
|
|
834
904
|
declare class EventEmitter {
|
|
835
905
|
private events;
|
|
836
906
|
emit<T>(eventName: string, data?: T): void;
|
|
907
|
+
emitWithResult<T, R>(eventName: string, data?: T): Promise<R[]>;
|
|
837
908
|
subscribe<T>(eventName: string, handler: (data: T) => void): () => void;
|
|
838
909
|
}
|
|
839
910
|
|
|
@@ -1092,13 +1163,18 @@ interface IRunner {
|
|
|
1092
1163
|
setEnv(env: string, alias?: string): void;
|
|
1093
1164
|
}
|
|
1094
1165
|
|
|
1166
|
+
interface IDispatcherData {
|
|
1167
|
+
message_source: string;
|
|
1168
|
+
event: string;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1095
1171
|
interface IContextualRunner extends IRunner {
|
|
1096
1172
|
run(): void;
|
|
1097
1173
|
isRunning(): boolean;
|
|
1098
1174
|
continue(): void;
|
|
1099
1175
|
stop(): void;
|
|
1100
1176
|
onStop(cb: () => void): void;
|
|
1101
|
-
onCheckout(event: string, cb: (checkout: ICheckout) => void): void;
|
|
1177
|
+
onCheckout<T extends IDispatcherData>(event: string, cb: (checkout: ICheckout, data?: T) => void): void;
|
|
1102
1178
|
setBackgroundTitle(text: string): void;
|
|
1103
1179
|
setBackgroundDescription(text: string): void;
|
|
1104
1180
|
turnOffBackdrop(): void;
|
|
@@ -1703,6 +1779,7 @@ interface IClickToPayMeta extends IBaseSRCMeta {
|
|
|
1703
1779
|
};
|
|
1704
1780
|
customer?: Customer;
|
|
1705
1781
|
unaccepted_card_type?: 'CREDIT' | 'DEBIT';
|
|
1782
|
+
recognition_token?: string;
|
|
1706
1783
|
}
|
|
1707
1784
|
type MASTERCARD_DPA_SHIPPING_BILLING_PREFERENCE = 'FULL' | 'POSTAL_COUNTRY' | 'NONE';
|
|
1708
1785
|
type MASTERCARD_ORDER_TYPE = 'SPLIT_SHIPMENT' | 'PREFERRED_CARD';
|
|
@@ -1747,6 +1824,7 @@ interface WalletCaptureBody {
|
|
|
1747
1824
|
address_country?: string;
|
|
1748
1825
|
external_payer_id?: string;
|
|
1749
1826
|
ref_token?: string;
|
|
1827
|
+
wallet_express?: boolean;
|
|
1750
1828
|
};
|
|
1751
1829
|
};
|
|
1752
1830
|
}
|
|
@@ -1811,6 +1889,17 @@ interface ProcessAuthenticationResponse {
|
|
|
1811
1889
|
};
|
|
1812
1890
|
}
|
|
1813
1891
|
|
|
1892
|
+
declare class ApiGatewayInternal {
|
|
1893
|
+
protected api: ApiInternal;
|
|
1894
|
+
constructor(api: ApiInternal);
|
|
1895
|
+
getWalletConfig(gateway_id: string): Promise<GetWalletConfigResponse>;
|
|
1896
|
+
}
|
|
1897
|
+
interface GetWalletConfigResponse {
|
|
1898
|
+
type: string;
|
|
1899
|
+
mode: string;
|
|
1900
|
+
credentials?: object;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1814
1903
|
declare class ApiServiceInternal {
|
|
1815
1904
|
protected api: ApiInternal;
|
|
1816
1905
|
constructor(api: ApiInternal);
|
|
@@ -1825,9 +1914,19 @@ interface GetConfigResponse {
|
|
|
1825
1914
|
certificate_passphrase: string;
|
|
1826
1915
|
}
|
|
1827
1916
|
|
|
1917
|
+
declare class ApiCheckoutInternal {
|
|
1918
|
+
protected api: ApiInternal;
|
|
1919
|
+
constructor(api: ApiInternal);
|
|
1920
|
+
instructions(session_id: string): Observable<object>;
|
|
1921
|
+
callback(payload: Object): Promise<Object>;
|
|
1922
|
+
status(id: string): Promise<Object>;
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1828
1925
|
declare class ApiInternal extends ApiBase {
|
|
1829
1926
|
charge(): ApiChargeInternal;
|
|
1830
1927
|
service(): ApiServiceInternal;
|
|
1928
|
+
checkout(): ApiCheckoutInternal;
|
|
1929
|
+
gateway(): ApiGatewayInternal;
|
|
1831
1930
|
}
|
|
1832
1931
|
|
|
1833
1932
|
interface SRCProvider {
|
|
@@ -2057,51 +2156,6 @@ declare class VaultDisplayWidget {
|
|
|
2057
2156
|
load(): void;
|
|
2058
2157
|
}
|
|
2059
2158
|
|
|
2060
|
-
interface IWalletPaymentSuccessful {
|
|
2061
|
-
id: string;
|
|
2062
|
-
amount: number;
|
|
2063
|
-
currency: string;
|
|
2064
|
-
status: string;
|
|
2065
|
-
payer_name?: string;
|
|
2066
|
-
payer_email?: string;
|
|
2067
|
-
payer_phone?: string;
|
|
2068
|
-
}
|
|
2069
|
-
interface IWalletUnavailable {
|
|
2070
|
-
wallet?: WALLET_TYPE;
|
|
2071
|
-
}
|
|
2072
|
-
interface IWalletOnClick {
|
|
2073
|
-
attachResult: (result: Promise<void> | boolean) => void;
|
|
2074
|
-
}
|
|
2075
|
-
interface IWalletUpdate {
|
|
2076
|
-
wallet_response_code?: string;
|
|
2077
|
-
wallet_order_id?: string;
|
|
2078
|
-
wallet_session_id?: string;
|
|
2079
|
-
payment_source?: {
|
|
2080
|
-
wallet_payment_method_id?: string;
|
|
2081
|
-
card_number_last4?: string;
|
|
2082
|
-
card_scheme?: string;
|
|
2083
|
-
};
|
|
2084
|
-
wallet_loyalty_account?: {
|
|
2085
|
-
id?: string;
|
|
2086
|
-
barcode?: string;
|
|
2087
|
-
};
|
|
2088
|
-
shipping?: {
|
|
2089
|
-
address_line1?: string;
|
|
2090
|
-
address_line2?: string;
|
|
2091
|
-
address_postcode?: string;
|
|
2092
|
-
address_city?: string;
|
|
2093
|
-
address_state?: string;
|
|
2094
|
-
address_country?: string;
|
|
2095
|
-
address_company?: string;
|
|
2096
|
-
post_office_box_number?: string;
|
|
2097
|
-
wallet_address_id?: string;
|
|
2098
|
-
wallet_address_name?: string;
|
|
2099
|
-
wallet_address_created_timestamp?: string;
|
|
2100
|
-
wallet_address_updated_timestamp?: string;
|
|
2101
|
-
};
|
|
2102
|
-
selected_shipping_option?: IShippingOption;
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
2159
|
interface IWalletServiceUpdateData {
|
|
2106
2160
|
amount: number;
|
|
2107
2161
|
shipping_options?: IShippingOption[];
|
|
@@ -2171,6 +2225,51 @@ interface IWalletService {
|
|
|
2171
2225
|
on(eventName: string, cb?: (data: IUnavailableWalletEventBody | IPaymentMethodSelectedWalletEventBody | any) => void): any;
|
|
2172
2226
|
}
|
|
2173
2227
|
|
|
2228
|
+
interface IWalletPaymentSuccessful {
|
|
2229
|
+
id: string;
|
|
2230
|
+
amount: number;
|
|
2231
|
+
currency: string;
|
|
2232
|
+
status: string;
|
|
2233
|
+
payer_name?: string;
|
|
2234
|
+
payer_email?: string;
|
|
2235
|
+
payer_phone?: string;
|
|
2236
|
+
}
|
|
2237
|
+
interface IWalletUnavailable {
|
|
2238
|
+
wallet?: WALLET_TYPE;
|
|
2239
|
+
}
|
|
2240
|
+
interface IWalletOnClick {
|
|
2241
|
+
attachResult: (result: Promise<void> | boolean) => void;
|
|
2242
|
+
}
|
|
2243
|
+
interface IWalletUpdate {
|
|
2244
|
+
wallet_response_code?: string;
|
|
2245
|
+
wallet_order_id?: string;
|
|
2246
|
+
wallet_session_id?: string;
|
|
2247
|
+
payment_source?: {
|
|
2248
|
+
wallet_payment_method_id?: string;
|
|
2249
|
+
card_number_last4?: string;
|
|
2250
|
+
card_scheme?: string;
|
|
2251
|
+
};
|
|
2252
|
+
wallet_loyalty_account?: {
|
|
2253
|
+
id?: string;
|
|
2254
|
+
barcode?: string;
|
|
2255
|
+
};
|
|
2256
|
+
shipping?: {
|
|
2257
|
+
address_line1?: string;
|
|
2258
|
+
address_line2?: string;
|
|
2259
|
+
address_postcode?: string;
|
|
2260
|
+
address_city?: string;
|
|
2261
|
+
address_state?: string;
|
|
2262
|
+
address_country?: string;
|
|
2263
|
+
address_company?: string;
|
|
2264
|
+
post_office_box_number?: string;
|
|
2265
|
+
wallet_address_id?: string;
|
|
2266
|
+
wallet_address_name?: string;
|
|
2267
|
+
wallet_address_created_timestamp?: string;
|
|
2268
|
+
wallet_address_updated_timestamp?: string;
|
|
2269
|
+
};
|
|
2270
|
+
selected_shipping_option?: IShippingOption;
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2174
2273
|
interface IEventData {
|
|
2175
2274
|
event: string;
|
|
2176
2275
|
data: void | IWalletPaymentSuccessful | IWalletUpdate | IWalletUnavailable | IWalletOnClick | any;
|
|
@@ -2784,6 +2883,7 @@ interface IEventMetaData extends IEventData$1 {
|
|
|
2784
2883
|
}
|
|
2785
2884
|
interface IEventFinishData extends IEventData$1 {
|
|
2786
2885
|
payment_source: string;
|
|
2886
|
+
payment_source_token?: string;
|
|
2787
2887
|
}
|
|
2788
2888
|
/**
|
|
2789
2889
|
* Interface of data from validation event.
|
|
@@ -3203,4 +3303,719 @@ declare class HtmlWidget extends HtmlMultiWidget {
|
|
|
3203
3303
|
setGiftCardScheme(giftCardScheme: any, processingNetwork: any): void;
|
|
3204
3304
|
}
|
|
3205
3305
|
|
|
3206
|
-
|
|
3306
|
+
type Instruction = new (selector: string, formSelector: string, api: ApiInternal) => InstructionHandler & InstructionDestroyable & InstructionDecorated;
|
|
3307
|
+
interface InstructionHandleable {
|
|
3308
|
+
handle(payload: object, eventEmitter: EventEmitter): void;
|
|
3309
|
+
}
|
|
3310
|
+
interface InstructionDecorated {
|
|
3311
|
+
instruction: string;
|
|
3312
|
+
}
|
|
3313
|
+
interface InstructionDestroyable {
|
|
3314
|
+
destroy(): void;
|
|
3315
|
+
}
|
|
3316
|
+
declare abstract class InstructionHandler implements InstructionHandleable, InstructionDestroyable, InstructionDecorated {
|
|
3317
|
+
selector: string;
|
|
3318
|
+
formSelector: string;
|
|
3319
|
+
api: ApiInternal;
|
|
3320
|
+
constructor(selector: string, formSelector: string, api: ApiInternal);
|
|
3321
|
+
instruction: string;
|
|
3322
|
+
abstract handle(context: object, eventEmitter?: any): void;
|
|
3323
|
+
abstract destroy(): void;
|
|
3324
|
+
getEnv(instruction_token: string): string;
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3327
|
+
declare class InstructionModule {
|
|
3328
|
+
instructions: any[];
|
|
3329
|
+
getInstruction(id: string): Instruction | null;
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
interface IntentTokenPayload {
|
|
3333
|
+
env: string;
|
|
3334
|
+
intent_id: string;
|
|
3335
|
+
version: number;
|
|
3336
|
+
env_alias: string;
|
|
3337
|
+
}
|
|
3338
|
+
declare class InstructionDebugger {
|
|
3339
|
+
constructor(selector: string, formSelector: string, version: number, instructionName: string, context: object, token?: string);
|
|
3340
|
+
}
|
|
3341
|
+
/**
|
|
3342
|
+
* Class CheckoutButton transform usual button into checkout
|
|
3343
|
+
*
|
|
3344
|
+
* @constructor
|
|
3345
|
+
*
|
|
3346
|
+
* @param {string} selector - Selector of html element.
|
|
3347
|
+
* @param {string} intentToken - PayDock intent token
|
|
3348
|
+
* @example
|
|
3349
|
+
* var widget = new Checkout('#widget', 'intent_token');
|
|
3350
|
+
**/
|
|
3351
|
+
declare class Checkout {
|
|
3352
|
+
protected formSelector: string;
|
|
3353
|
+
protected intentToken: string;
|
|
3354
|
+
protected debug: boolean;
|
|
3355
|
+
protected window: Window;
|
|
3356
|
+
protected eventEmitter: EventEmitter;
|
|
3357
|
+
protected container: Container;
|
|
3358
|
+
protected intentTokenPayload: IntentTokenPayload;
|
|
3359
|
+
protected api: ApiInternal;
|
|
3360
|
+
protected instructions: InstructionModule;
|
|
3361
|
+
protected currentInstruction: InstructionDestroyable & InstructionHandleable;
|
|
3362
|
+
constructor(formSelector: string, intentToken: string, debug?: boolean);
|
|
3363
|
+
private extractIntentTokenPayload;
|
|
3364
|
+
private ready;
|
|
3365
|
+
private initContractVersion;
|
|
3366
|
+
private listenInstructions;
|
|
3367
|
+
private setEnv;
|
|
3368
|
+
private createWidgetStructure;
|
|
3369
|
+
/**
|
|
3370
|
+
* If the payment was successful, the function passed as parameter will be called.
|
|
3371
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3372
|
+
*
|
|
3373
|
+
* @example
|
|
3374
|
+
* widget.onPaymentSuccessful((data) => {
|
|
3375
|
+
* console.log('Payment successful!');
|
|
3376
|
+
* });
|
|
3377
|
+
*/
|
|
3378
|
+
onPaymentSuccessful(handler: (data: IEventData$1) => void): () => void;
|
|
3379
|
+
/**
|
|
3380
|
+
* If the payment was not successful, the function passed as parameter will be called.
|
|
3381
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3382
|
+
*
|
|
3383
|
+
* @example
|
|
3384
|
+
* widget.onPaymentError((err) => {
|
|
3385
|
+
* console.log('Payment not successful');
|
|
3386
|
+
* });
|
|
3387
|
+
*/
|
|
3388
|
+
onPaymentFailure(handler: (data: IEventData$1) => void): () => void;
|
|
3389
|
+
/**
|
|
3390
|
+
* If the payment was expired, the function passed as parameter will be called.
|
|
3391
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3392
|
+
*
|
|
3393
|
+
* @example
|
|
3394
|
+
* widget.onPaymentInReview((data) => {
|
|
3395
|
+
* console.log('Payment in fraud review');
|
|
3396
|
+
* });
|
|
3397
|
+
*/
|
|
3398
|
+
onPaymentExpired(handler: (data: IEventData$1) => void): () => void;
|
|
3399
|
+
private setStyles;
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
declare enum EVENT {
|
|
3403
|
+
UNAVAILABLE = "unavailable",
|
|
3404
|
+
ERROR = "error",
|
|
3405
|
+
PAYMENT_SUCCESSFUL = "paymentSuccessful",
|
|
3406
|
+
PAYMENT_ERROR = "paymentError",
|
|
3407
|
+
PAYMENT_IN_REVIEW = "paymentInReview",
|
|
3408
|
+
ON_CLICK = "onClick",
|
|
3409
|
+
ON_CHECKOUT_CLOSE = "onCheckoutClose"
|
|
3410
|
+
}
|
|
3411
|
+
|
|
3412
|
+
interface BaseEventData<T> {
|
|
3413
|
+
event: string;
|
|
3414
|
+
chargeId?: string;
|
|
3415
|
+
data?: T | undefined;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
interface OnClickEventData extends BaseEventData<undefined> {
|
|
3419
|
+
event: EVENT.ON_CLICK;
|
|
3420
|
+
}
|
|
3421
|
+
|
|
3422
|
+
interface OnPaymentSuccessfulEventData extends BaseEventData<{
|
|
3423
|
+
id: string;
|
|
3424
|
+
amount: number;
|
|
3425
|
+
currency: string;
|
|
3426
|
+
status: string;
|
|
3427
|
+
}> {
|
|
3428
|
+
event: EVENT.PAYMENT_SUCCESSFUL;
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
interface OnCloseEventData extends BaseEventData<undefined> {
|
|
3432
|
+
event: EVENT.ON_CHECKOUT_CLOSE;
|
|
3433
|
+
}
|
|
3434
|
+
|
|
3435
|
+
interface OnPaymentInReviewEventData extends Omit<OnPaymentSuccessfulEventData, 'event'> {
|
|
3436
|
+
event: EVENT.PAYMENT_IN_REVIEW;
|
|
3437
|
+
}
|
|
3438
|
+
|
|
3439
|
+
interface OnPaymentErrorEventData extends BaseEventData<{
|
|
3440
|
+
message?: string;
|
|
3441
|
+
code?: string;
|
|
3442
|
+
}> {
|
|
3443
|
+
event: EVENT.PAYMENT_ERROR;
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3446
|
+
interface WalletCaptureRequest {
|
|
3447
|
+
payment_method_id?: string;
|
|
3448
|
+
customer: {
|
|
3449
|
+
email?: string;
|
|
3450
|
+
phone?: string;
|
|
3451
|
+
first_name?: string;
|
|
3452
|
+
last_name?: string;
|
|
3453
|
+
payment_source?: {
|
|
3454
|
+
wallet_type?: string;
|
|
3455
|
+
address_line1?: string;
|
|
3456
|
+
address_line2?: string;
|
|
3457
|
+
address_country?: string;
|
|
3458
|
+
address_city?: string;
|
|
3459
|
+
address_postcode?: string;
|
|
3460
|
+
address_state?: string;
|
|
3461
|
+
ref_token?: string;
|
|
3462
|
+
external_payer_id?: string;
|
|
3463
|
+
wallet_express?: boolean;
|
|
3464
|
+
};
|
|
3465
|
+
};
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
interface OnUnavailableEventData extends BaseEventData<undefined> {
|
|
3469
|
+
event: EVENT.UNAVAILABLE;
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
interface BaseGatewayConfig<T> {
|
|
3473
|
+
type: string;
|
|
3474
|
+
mode: string;
|
|
3475
|
+
credentials?: T;
|
|
3476
|
+
}
|
|
3477
|
+
|
|
3478
|
+
interface BaseWalletMeta {
|
|
3479
|
+
amount: number;
|
|
3480
|
+
currency: string;
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3483
|
+
interface OnErrorEventData extends BaseEventData<Error> {
|
|
3484
|
+
event: EVENT.ERROR;
|
|
3485
|
+
}
|
|
3486
|
+
|
|
3487
|
+
declare abstract class BaseWalletButton<T extends BaseWalletMeta> {
|
|
3488
|
+
protected container: Container;
|
|
3489
|
+
protected api: ApiInternal;
|
|
3490
|
+
protected env: string;
|
|
3491
|
+
protected gatewayId: string;
|
|
3492
|
+
protected meta: T;
|
|
3493
|
+
private eventEmitter;
|
|
3494
|
+
private chargeWalletTokenMeta?;
|
|
3495
|
+
constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: T, requiredMetaFields: string[]);
|
|
3496
|
+
private getApiAuthType;
|
|
3497
|
+
/**
|
|
3498
|
+
* Current method can change environment. By default environment = sandbox.
|
|
3499
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
3500
|
+
* Bear in mind that you must set an environment before calling `button.load()`.
|
|
3501
|
+
*
|
|
3502
|
+
* @example
|
|
3503
|
+
* button.setEnv('production', 'paydock.com');
|
|
3504
|
+
* @param {string} env - sandbox, production
|
|
3505
|
+
* @param {string} [alias] - Own domain alias
|
|
3506
|
+
*/
|
|
3507
|
+
setEnv(env: string, alias?: string): void;
|
|
3508
|
+
/**
|
|
3509
|
+
* Callback for onClick method.
|
|
3510
|
+
*
|
|
3511
|
+
* @callback OnClickCallback
|
|
3512
|
+
* @param {OnClickEventData} data
|
|
3513
|
+
* @return {Promise<string>} walletToken string result
|
|
3514
|
+
*/
|
|
3515
|
+
/**
|
|
3516
|
+
* Registers a callback function to be invoked when the wallet button gets clicked.
|
|
3517
|
+
* **Note:** is mandatory to handle this event to perform the wallet initialization (and optionally any validation logic).
|
|
3518
|
+
* 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.
|
|
3519
|
+
* **Note:** this callback may be called multiple times as the customer closes the payment checkout and re-clicks the button.
|
|
3520
|
+
* 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.
|
|
3521
|
+
* In case a new one needs to be generated, remember it will need to be preceded by a `setMeta` call.
|
|
3522
|
+
*
|
|
3523
|
+
* @example
|
|
3524
|
+
* button.onClick(async (data) => {
|
|
3525
|
+
* const responseData = await fetch('https://your-server.com/init-wallet-charge');
|
|
3526
|
+
* return responseData.walletToken;
|
|
3527
|
+
* });
|
|
3528
|
+
*
|
|
3529
|
+
* @param {OnClickCallback} handler - Function to be called when the wallet button is clicked.
|
|
3530
|
+
*/
|
|
3531
|
+
onClick(handler: (data: OnClickEventData) => Promise<string>): () => void;
|
|
3532
|
+
/**
|
|
3533
|
+
* Callback for onPaymentSuccessful method.
|
|
3534
|
+
*
|
|
3535
|
+
* @callback OnPaymentSuccessfulCallback
|
|
3536
|
+
* @param {OnPaymentSuccessfulEventData} data
|
|
3537
|
+
*/
|
|
3538
|
+
/**
|
|
3539
|
+
* If the payment was successful, the function passed as parameter will be called.
|
|
3540
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3541
|
+
*
|
|
3542
|
+
* @example
|
|
3543
|
+
* button.onPaymentSuccessful((data) => {
|
|
3544
|
+
* console.log('Payment successful!');
|
|
3545
|
+
* });
|
|
3546
|
+
*
|
|
3547
|
+
* @example
|
|
3548
|
+
* button.onPaymentSuccessful().then((data) => console.log('Payment successful!'));
|
|
3549
|
+
*
|
|
3550
|
+
* @param {OnPaymentSuccessfulCallback} [handler] - Function to be called when the payment was successful.
|
|
3551
|
+
*/
|
|
3552
|
+
onPaymentSuccessful(handler?: (data: OnPaymentSuccessfulEventData) => void): Promise<unknown> | (() => void);
|
|
3553
|
+
/**
|
|
3554
|
+
* Callback for onPaymentInReview method.
|
|
3555
|
+
*
|
|
3556
|
+
* @callback OnPaymentInReviewCallback
|
|
3557
|
+
* @param {OnPaymentInReviewEventData} data
|
|
3558
|
+
*/
|
|
3559
|
+
/**
|
|
3560
|
+
* If the payment was left in fraud review, the function passed as parameter will be called.
|
|
3561
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3562
|
+
*
|
|
3563
|
+
* @example
|
|
3564
|
+
* button.onPaymentInReview((data) => {
|
|
3565
|
+
* console.log('Payment in fraud review');
|
|
3566
|
+
* });
|
|
3567
|
+
*
|
|
3568
|
+
* @example
|
|
3569
|
+
* button.onPaymentInReview().then((data) => console.log('Payment in fraud review'));
|
|
3570
|
+
*
|
|
3571
|
+
* @param {OnPaymentInReviewCallback} [handler] - Function to be called when the payment was left in fraud review status.
|
|
3572
|
+
*/
|
|
3573
|
+
onPaymentInReview(handler?: (err: OnPaymentInReviewEventData) => void): Promise<unknown> | (() => void);
|
|
3574
|
+
/**
|
|
3575
|
+
* Callback for onPaymentError method.
|
|
3576
|
+
*
|
|
3577
|
+
* @callback OnPaymentErrorCallback
|
|
3578
|
+
* @param {OnPaymentErrorEventData} data
|
|
3579
|
+
*/
|
|
3580
|
+
/**
|
|
3581
|
+
* If the payment was not successful, the function passed as parameter will be called.
|
|
3582
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3583
|
+
*
|
|
3584
|
+
* @example
|
|
3585
|
+
* button.onPaymentError((err) => {
|
|
3586
|
+
* console.log('Payment not successful');
|
|
3587
|
+
* });
|
|
3588
|
+
*
|
|
3589
|
+
* @example
|
|
3590
|
+
* button.onPaymentError().then((err) => console.log('Payment not successful'));
|
|
3591
|
+
*
|
|
3592
|
+
* @param {OnPaymentErrorCallback} [handler] - Function to be called when the payment was not successful.
|
|
3593
|
+
*/
|
|
3594
|
+
onPaymentError(handler?: (err: OnPaymentErrorEventData) => void): Promise<unknown> | (() => void);
|
|
3595
|
+
/**
|
|
3596
|
+
* Callback for onCheckoutClose method.
|
|
3597
|
+
*
|
|
3598
|
+
* @callback OnCheckoutCloseCallback
|
|
3599
|
+
* @param {OnCloseEventData} data
|
|
3600
|
+
*/
|
|
3601
|
+
/**
|
|
3602
|
+
* Registers a callback function to be invoked when the wallet checkout closes.
|
|
3603
|
+
*
|
|
3604
|
+
* @example
|
|
3605
|
+
* button.onCheckoutClose(() => {
|
|
3606
|
+
* console.log('Wallet checkout closes');
|
|
3607
|
+
* });
|
|
3608
|
+
*
|
|
3609
|
+
* @param {OnCheckoutCloseCallback} handler - Function to be called when the wallet checkout closes.
|
|
3610
|
+
*/
|
|
3611
|
+
onCheckoutClose(handler?: (err: OnCloseEventData) => void): Promise<unknown> | (() => void);
|
|
3612
|
+
/**
|
|
3613
|
+
* Callback for onUnavailable method.
|
|
3614
|
+
*
|
|
3615
|
+
* @callback OnUnavailableCallback
|
|
3616
|
+
* @param {OnUnavailableEventData} data
|
|
3617
|
+
*/
|
|
3618
|
+
/**
|
|
3619
|
+
* Registers a callback function to be invoked when the wallet is not available in the current context.
|
|
3620
|
+
*
|
|
3621
|
+
* @example
|
|
3622
|
+
* button.onUnavailable(() => {
|
|
3623
|
+
* console.log('Wallet not available');
|
|
3624
|
+
* });
|
|
3625
|
+
*
|
|
3626
|
+
* @param {OnUnavailableCallback} handler - Function to be called when the wallet is not available in the current context.
|
|
3627
|
+
*/
|
|
3628
|
+
onUnavailable(handler?: (err: OnUnavailableEventData) => void): Promise<unknown> | (() => void);
|
|
3629
|
+
/**
|
|
3630
|
+
* Callback for onError method.
|
|
3631
|
+
*
|
|
3632
|
+
* @callback OnErrorCallback
|
|
3633
|
+
* @param {OnErrorEventData} data
|
|
3634
|
+
*/
|
|
3635
|
+
/**
|
|
3636
|
+
* Registers a callback function to be invoked when an error that is not related to payment execution occurs.
|
|
3637
|
+
* 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.
|
|
3638
|
+
*
|
|
3639
|
+
* @example
|
|
3640
|
+
* button.onError((error) => {
|
|
3641
|
+
* console.log('WalletButtonExpress error', error);
|
|
3642
|
+
* });
|
|
3643
|
+
*
|
|
3644
|
+
* @param {OnErrorCallback} handler - Function to be called when the WalletButton has an error.
|
|
3645
|
+
*/
|
|
3646
|
+
onError(handler?: (err: OnErrorEventData) => void): Promise<unknown> | (() => void);
|
|
3647
|
+
/**
|
|
3648
|
+
* Add docs on each child class
|
|
3649
|
+
*/
|
|
3650
|
+
abstract load(): void;
|
|
3651
|
+
/**
|
|
3652
|
+
* Add docs on each child class
|
|
3653
|
+
*/
|
|
3654
|
+
abstract setMeta(meta: object): void;
|
|
3655
|
+
protected getGatewayWalletConfig<T>(): Promise<BaseGatewayConfig<T>>;
|
|
3656
|
+
protected executeWalletCallback<T, U extends {
|
|
3657
|
+
request_type: string;
|
|
3658
|
+
}>(data: U): Promise<T>;
|
|
3659
|
+
protected executeWalletCapture<T>(data: WalletCaptureRequest): Promise<T>;
|
|
3660
|
+
protected handleMerchantOnExpressButtonClickEvent(): Promise<void>;
|
|
3661
|
+
private setWalletToken;
|
|
3662
|
+
protected handleCheckoutClose(): void;
|
|
3663
|
+
protected handleOnUnavailable(): void;
|
|
3664
|
+
protected handleOnError(error?: Error): void;
|
|
3665
|
+
protected eventDataFromApiError(err: any): OnPaymentErrorEventData['data'];
|
|
3666
|
+
protected validateRequiredMetaFields(requiredMetaFields: string[]): void;
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
type ApplePayButtonStyle = 'black' | 'white' | 'white-outline';
|
|
3670
|
+
|
|
3671
|
+
type ApplePayButtonType = 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'plain' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
|
|
3672
|
+
|
|
3673
|
+
interface ApplePayWalletMeta extends BaseWalletMeta {
|
|
3674
|
+
amount_label: string;
|
|
3675
|
+
country: string;
|
|
3676
|
+
merchant_capabilities?: Array<'supports3DS' | 'supportsEMV' | 'supportsCredit' | 'supportsDebit'>;
|
|
3677
|
+
supported_networks?: Array<'visa' | 'masterCard' | 'amex' | 'chinaUnionPay' | 'discover' | 'interac' | 'jcb' | 'privateLabel'>;
|
|
3678
|
+
required_billing_contact_fields?: Array<'email' | 'name' | 'phone' | 'postalAddress'>;
|
|
3679
|
+
required_shipping_contact_fields?: Array<'email' | 'phone'>;
|
|
3680
|
+
supported_countries?: string[];
|
|
3681
|
+
style?: {
|
|
3682
|
+
button_type?: ApplePayButtonType;
|
|
3683
|
+
button_style?: ApplePayButtonStyle;
|
|
3684
|
+
};
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3687
|
+
/**
|
|
3688
|
+
* Class ApplePayWalletButtonExpress to work with Apple Pay Wallet.
|
|
3689
|
+
*
|
|
3690
|
+
* @extends BaseWalletButton
|
|
3691
|
+
*
|
|
3692
|
+
* @constructor
|
|
3693
|
+
*
|
|
3694
|
+
* @example
|
|
3695
|
+
* var button = new ApplePayWalletButtonExpress('#wallet-buttons', 'publicKeyOrAccessToken', 'gatewayId', meta);
|
|
3696
|
+
*
|
|
3697
|
+
* @param {string} selector - Selector of html element. Container for the ApplePayWalletButtonExpress.
|
|
3698
|
+
* @param {string} publicKeyOrAccessToken - Public key or Access token for the ApplePayWalletButtonExpress.
|
|
3699
|
+
* @param {string} gatewayId - Gateway ID for the ApplePayWalletButtonExpress.
|
|
3700
|
+
* @param {ApplePayWalletMeta} meta - data that configures the Apple Pay Wallet.
|
|
3701
|
+
*/
|
|
3702
|
+
declare class ApplePayWalletButtonExpress extends BaseWalletButton<ApplePayWalletMeta> {
|
|
3703
|
+
private paymentSession;
|
|
3704
|
+
/** @constructs */ constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: ApplePayWalletMeta);
|
|
3705
|
+
/**
|
|
3706
|
+
* Initializes the availability checks and inserts the button if possible.
|
|
3707
|
+
* Otherwise function onUnavailable(handler: VoidFunction) will be called.
|
|
3708
|
+
* **Important**: Is required to invoke this method to render the wallet button.
|
|
3709
|
+
*
|
|
3710
|
+
* @example
|
|
3711
|
+
* button.load();
|
|
3712
|
+
*/
|
|
3713
|
+
load(): void;
|
|
3714
|
+
/**
|
|
3715
|
+
* Call this method if updating the originally-provided meta object after order information changed.
|
|
3716
|
+
* For example, if the order amount has changed from the time where the button was originally rendered.
|
|
3717
|
+
*
|
|
3718
|
+
* @example
|
|
3719
|
+
* button.setMeta(meta);
|
|
3720
|
+
*
|
|
3721
|
+
* @param {ApplePayWalletMeta} meta - // data that configures the Apple Pay Wallet.
|
|
3722
|
+
*/
|
|
3723
|
+
setMeta(meta: ApplePayWalletMeta): void;
|
|
3724
|
+
private checkAvailability;
|
|
3725
|
+
private mount;
|
|
3726
|
+
private onApplePayButtonClicked;
|
|
3727
|
+
private createRequest;
|
|
3728
|
+
private onValidateMerchant;
|
|
3729
|
+
private getMerchantSession;
|
|
3730
|
+
private onPaymentAuthorized;
|
|
3731
|
+
private onCancelPayment;
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
interface PaypalWalletMeta extends BaseWalletMeta {
|
|
3735
|
+
pay_later?: boolean;
|
|
3736
|
+
standalone?: boolean;
|
|
3737
|
+
capture?: boolean;
|
|
3738
|
+
style?: {
|
|
3739
|
+
layout?: 'vertical' | 'horizontal';
|
|
3740
|
+
color?: 'gold' | 'blue' | 'silver' | 'black' | 'white';
|
|
3741
|
+
shape?: 'rect' | 'pill' | 'sharp';
|
|
3742
|
+
borderRadius?: number;
|
|
3743
|
+
height?: number;
|
|
3744
|
+
disableMaxWidth?: boolean;
|
|
3745
|
+
label?: 'paypal' | 'checkout' | 'buynow' | 'pay' | 'installment';
|
|
3746
|
+
tagline?: boolean;
|
|
3747
|
+
messages?: {
|
|
3748
|
+
layout?: 'text' | 'flex';
|
|
3749
|
+
logo?: {
|
|
3750
|
+
type?: 'primary' | 'alternative' | 'inline' | 'none';
|
|
3751
|
+
position?: 'left' | 'right' | 'top';
|
|
3752
|
+
};
|
|
3753
|
+
text?: {
|
|
3754
|
+
color?: 'black' | 'white' | 'monochrome' | 'grayscale';
|
|
3755
|
+
size?: 10 | 11 | 12 | 13 | 14 | 15 | 16;
|
|
3756
|
+
align?: 'left' | 'center' | 'right';
|
|
3757
|
+
};
|
|
3758
|
+
color?: 'blue' | 'black' | 'white' | 'white-no-border' | 'gray' | 'monochrome' | 'grayscale';
|
|
3759
|
+
ratio?: '1x1' | '1x4' | '8x1' | '20x1';
|
|
3760
|
+
};
|
|
3761
|
+
};
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
/**
|
|
3765
|
+
* Class PaypalWalletButtonExpress to work with Paypal Wallet.
|
|
3766
|
+
*
|
|
3767
|
+
* @extends BaseWalletButton
|
|
3768
|
+
*
|
|
3769
|
+
* @constructor
|
|
3770
|
+
*
|
|
3771
|
+
* @example
|
|
3772
|
+
* var button = new PaypalWalletButtonExpress('#wallet-buttons', 'publicKeyOrAccessToken', 'gatewayId', meta);
|
|
3773
|
+
*
|
|
3774
|
+
* @param {string} selector - Selector of html element. Container for the PaypalWalletButtonExpress.
|
|
3775
|
+
* @param {string} publicKeyOrAccessToken - Public key or Access token for the PaypalWalletButtonExpress.
|
|
3776
|
+
* @param {string} gatewayId - Gateway ID for the PaypalWalletButtonExpress.
|
|
3777
|
+
* @param {PaypalWalletMeta} meta - data that configures the Paypal Wallet.
|
|
3778
|
+
*/
|
|
3779
|
+
declare class PaypalWalletButtonExpress extends BaseWalletButton<PaypalWalletMeta> {
|
|
3780
|
+
private config;
|
|
3781
|
+
protected paypal: any;
|
|
3782
|
+
protected pendingApprovalPromise?: Promise<any>;
|
|
3783
|
+
/** @constructs */ constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: PaypalWalletMeta);
|
|
3784
|
+
/**
|
|
3785
|
+
* Initializes the availability checks and inserts the button if possible.
|
|
3786
|
+
* Otherwise function onUnavailable(handler: VoidFunction) will be called.
|
|
3787
|
+
* **Important**: Is required to invoke this method to render the wallet button.
|
|
3788
|
+
*
|
|
3789
|
+
* @example
|
|
3790
|
+
* button.load();
|
|
3791
|
+
*/
|
|
3792
|
+
load(): void;
|
|
3793
|
+
/**
|
|
3794
|
+
* Call this method if updating the originally-provided meta object after order information changed.
|
|
3795
|
+
* For example, if the order amount has changed from the time where the button was originally rendered.
|
|
3796
|
+
*
|
|
3797
|
+
* @example
|
|
3798
|
+
* button.setMeta(meta);
|
|
3799
|
+
* @param {PaypalWalletMeta} meta - // data that configures the Paypal Wallet.
|
|
3800
|
+
*/
|
|
3801
|
+
setMeta(meta: PaypalWalletMeta): void;
|
|
3802
|
+
private renderPaypalButton;
|
|
3803
|
+
private renderPaypalCommonComponent;
|
|
3804
|
+
private renderPaypalStandaloneComponent;
|
|
3805
|
+
private paypalSharedProps;
|
|
3806
|
+
}
|
|
3807
|
+
|
|
3808
|
+
declare enum ErrorCodes$1 {
|
|
3809
|
+
PROMISE_NOT_ENABLED = "promise_not_enabled",
|
|
3810
|
+
SCRIPT_ERROR = "script_error"
|
|
3811
|
+
}
|
|
3812
|
+
interface PayPalDataCollectorConfig {
|
|
3813
|
+
mouse_movement?: boolean;
|
|
3814
|
+
}
|
|
3815
|
+
interface IPayPalDataCollector {
|
|
3816
|
+
collectDeviceData(): Promise<CollectedDeviceData>;
|
|
3817
|
+
setEnv(env: string): void;
|
|
3818
|
+
}
|
|
3819
|
+
interface CollectedDeviceData {
|
|
3820
|
+
correlation_id: string;
|
|
3821
|
+
}
|
|
3822
|
+
interface IOnErrorEventData$1 {
|
|
3823
|
+
error_code: ErrorCodes$1;
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
/**
|
|
3827
|
+
* PayPal Data Collector Widget constructor
|
|
3828
|
+
*
|
|
3829
|
+
* @param {string} flowId - This string identifies the source website of the FraudNet request.
|
|
3830
|
+
* @param {PayPalDataCollectorConfig} config - Extra configuration for the widget.
|
|
3831
|
+
*
|
|
3832
|
+
* @example
|
|
3833
|
+
* var payPalDataCollector = new PayPalDataCollector('FLOW_ID', {});
|
|
3834
|
+
*/
|
|
3835
|
+
declare class PayPalDataCollector {
|
|
3836
|
+
protected service: IPayPalDataCollector;
|
|
3837
|
+
protected eventEmitter: EventEmitter;
|
|
3838
|
+
private widgetActionLogger;
|
|
3839
|
+
/** @constructs */ constructor(flowId?: string, config?: PayPalDataCollectorConfig);
|
|
3840
|
+
/**
|
|
3841
|
+
* After configuring the PayPalDataCollector Widget, starts the process and returns
|
|
3842
|
+
* the correlation id used among the requests.
|
|
3843
|
+
*
|
|
3844
|
+
* @returns {Promise<CollectedDeviceData>} Promise when resolved, returnsa an object
|
|
3845
|
+
* that contains the `correlation_id` key.
|
|
3846
|
+
*
|
|
3847
|
+
* @example
|
|
3848
|
+
* const collectedDeviceData = await payPalDataCollectorWidget.collectDeviceData();
|
|
3849
|
+
* console.log(collectedDeviceData.correlation_id)
|
|
3850
|
+
*/
|
|
3851
|
+
collectDeviceData(): Promise<CollectedDeviceData>;
|
|
3852
|
+
/**
|
|
3853
|
+
* Callback for onError method.
|
|
3854
|
+
*
|
|
3855
|
+
* @callback OnErrorCallback
|
|
3856
|
+
* @param {IOnErrorEventData|null} data
|
|
3857
|
+
*/
|
|
3858
|
+
/**
|
|
3859
|
+
* If the process fails, the function passed as parameter will be called.
|
|
3860
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3861
|
+
*
|
|
3862
|
+
* @example
|
|
3863
|
+
* PayPalDataCollector.onError((eventData) => console.log('Some error occur'));
|
|
3864
|
+
*
|
|
3865
|
+
* @param {OnErrorCallback} [callback] - Function to be called when there is an error in the flow.
|
|
3866
|
+
*/
|
|
3867
|
+
onError(callback?: (data?: IOnErrorEventData$1) => void): () => void;
|
|
3868
|
+
/**
|
|
3869
|
+
* Current method can change environment. By default environment = test.
|
|
3870
|
+
* This method does not affect Paydock's API calls or environments, is only for PayPal Data Collector
|
|
3871
|
+
* script, in order to know if the script is injected on a live server or is a testing
|
|
3872
|
+
* environment. The available values are `test` and `live`. This should match with the used
|
|
3873
|
+
* `gateway.mode` in Paydock to process the transaction.
|
|
3874
|
+
*
|
|
3875
|
+
* @example
|
|
3876
|
+
* PayPalDataCollector.setEnv('live');
|
|
3877
|
+
* @param {string} env - test, live
|
|
3878
|
+
*/
|
|
3879
|
+
setEnv(env: string): void;
|
|
3880
|
+
}
|
|
3881
|
+
|
|
3882
|
+
interface PayPalStyleConfig {
|
|
3883
|
+
layout?: 'vertical' | 'horizontal';
|
|
3884
|
+
color?: 'blue' | 'gold' | 'silver' | 'black' | 'white';
|
|
3885
|
+
shape?: 'rect' | 'sharp' | 'pill';
|
|
3886
|
+
label?: 'paypal' | 'checkout' | 'buynow' | 'pay';
|
|
3887
|
+
disableMaxWidth?: boolean;
|
|
3888
|
+
disableMaxHeight?: boolean;
|
|
3889
|
+
height?: number;
|
|
3890
|
+
borderRadius?: number;
|
|
3891
|
+
tagline?: boolean;
|
|
3892
|
+
}
|
|
3893
|
+
interface PayPalMessageConfig {
|
|
3894
|
+
amount?: number;
|
|
3895
|
+
align?: 'center' | 'left' | 'right';
|
|
3896
|
+
color?: 'black' | 'white';
|
|
3897
|
+
position?: 'top' | 'bottom';
|
|
3898
|
+
}
|
|
3899
|
+
interface PayPalSavePaymentSourceWidgetConfig {
|
|
3900
|
+
style?: PayPalStyleConfig;
|
|
3901
|
+
message?: PayPalMessageConfig;
|
|
3902
|
+
}
|
|
3903
|
+
interface IPayPalSavePaymentSourceWidget {
|
|
3904
|
+
load(container: Container): void;
|
|
3905
|
+
setEnv(env: string, alias?: string): void;
|
|
3906
|
+
}
|
|
3907
|
+
declare enum ErrorCodes {
|
|
3908
|
+
UNAVAILABLE = "unavailable",
|
|
3909
|
+
ON_PAYPAL_VAULT_SETUP_TOKEN_ERROR = "onPaypalVaultSetupTokenError",
|
|
3910
|
+
ON_GET_ID_TOKEN_ERROR = "onGetIdTokenError",
|
|
3911
|
+
ON_GET_WALLET_CONFIG_ERROR = "onGetWalletConfigError",
|
|
3912
|
+
ON_GET_SETUP_TOKEN_ERROR = "onGetSetupTokenError",
|
|
3913
|
+
ON_ONE_TIME_TOKEN_ERROR = "onOneTimeTokenError"
|
|
3914
|
+
}
|
|
3915
|
+
declare enum EVENTS {
|
|
3916
|
+
ON_SUCCESS = "ON_SUCCESS",
|
|
3917
|
+
ON_ERROR = "ON_ERROR",
|
|
3918
|
+
ON_CANCEL = "ON_CANCEL"
|
|
3919
|
+
}
|
|
3920
|
+
interface IOnSuccessEventData {
|
|
3921
|
+
event: EVENTS.ON_SUCCESS;
|
|
3922
|
+
data: {
|
|
3923
|
+
token: string;
|
|
3924
|
+
email: string;
|
|
3925
|
+
};
|
|
3926
|
+
}
|
|
3927
|
+
interface IOnErrorEventData {
|
|
3928
|
+
event: EVENTS.ON_ERROR;
|
|
3929
|
+
data: {
|
|
3930
|
+
error_code: ErrorCodes;
|
|
3931
|
+
details?: string;
|
|
3932
|
+
message?: string;
|
|
3933
|
+
};
|
|
3934
|
+
}
|
|
3935
|
+
interface IOnCancelEventData {
|
|
3936
|
+
event: EVENTS.ON_CANCEL;
|
|
3937
|
+
}
|
|
3938
|
+
|
|
3939
|
+
/**
|
|
3940
|
+
* PayPal Save Payment Source Widget constructor
|
|
3941
|
+
*
|
|
3942
|
+
* @param {string} selector - Selector of html element. Container for PayPal Save Payment Source Widget.
|
|
3943
|
+
* @param {string} publicKey - PayDock users public key.
|
|
3944
|
+
* @param {string} gatewayId - PayDock's PayPal gatewayId.
|
|
3945
|
+
* @param {PayPalSavePaymentSourceWidgetConfig} config - Extra configuration for the widget, like styles.
|
|
3946
|
+
*
|
|
3947
|
+
* @example
|
|
3948
|
+
* var payPalSavePaymentSourceWidget = new PayPalSavePaymentSourceWidget('#paypalButton', 'public_key', 'gateway_id');
|
|
3949
|
+
*/
|
|
3950
|
+
declare class PayPalSavePaymentSourceWidget {
|
|
3951
|
+
protected container: Container;
|
|
3952
|
+
protected service: IPayPalSavePaymentSourceWidget;
|
|
3953
|
+
protected eventEmitter: EventEmitter;
|
|
3954
|
+
private widgetActionLogger;
|
|
3955
|
+
/** @constructs */ constructor(selector: string, publicKey: string, gatewayId: string, config?: PayPalSavePaymentSourceWidgetConfig);
|
|
3956
|
+
/**
|
|
3957
|
+
* The final method after configuring the PayPalSavePaymentSource Widget to
|
|
3958
|
+
* start the load process.
|
|
3959
|
+
*/
|
|
3960
|
+
load(): void;
|
|
3961
|
+
/**
|
|
3962
|
+
* Current method can change environment. By default environment = sandbox.
|
|
3963
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
3964
|
+
*
|
|
3965
|
+
* @example
|
|
3966
|
+
* payPalSavePaymentSourceWidget.setEnv('production');
|
|
3967
|
+
* @param {string} env - sandbox, production
|
|
3968
|
+
* @param {string} [alias] - Own domain alias
|
|
3969
|
+
*/
|
|
3970
|
+
setEnv(env: string, alias?: string): void;
|
|
3971
|
+
/**
|
|
3972
|
+
* Callback for onSuccess method.
|
|
3973
|
+
*
|
|
3974
|
+
* @callback OnSuccessCallback
|
|
3975
|
+
* @param {IOnSuccessEventData} data
|
|
3976
|
+
*/
|
|
3977
|
+
/**
|
|
3978
|
+
* If the setup token was successfully approved and a OTT was generated, the function passed as parameter will be called.
|
|
3979
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3980
|
+
*
|
|
3981
|
+
* @example
|
|
3982
|
+
* payPalSavePaymentSourceWidget.onSuccess((eventData) => console.log('One time token and email obtained successfully'));
|
|
3983
|
+
*
|
|
3984
|
+
* @param {OnSuccessCallback} [callback] - Function to be called when the result is successful.
|
|
3985
|
+
*/
|
|
3986
|
+
onSuccess(callback?: (data: IOnSuccessEventData) => void): () => void;
|
|
3987
|
+
/**
|
|
3988
|
+
* Callback for onError method.
|
|
3989
|
+
*
|
|
3990
|
+
* @callback OnErrorCallback
|
|
3991
|
+
* @param {IOnErrorEventData} data
|
|
3992
|
+
*/
|
|
3993
|
+
/**
|
|
3994
|
+
* If in the process for obtaining the setup token fails, the function passed as parameter will be called.
|
|
3995
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
3996
|
+
*
|
|
3997
|
+
* @example
|
|
3998
|
+
* payPalSavePaymentSourceWidget.onError((eventData) => console.log('Some error occurred'));
|
|
3999
|
+
*
|
|
4000
|
+
* @param {OnErrorCallback} [callback] - Function to be called when there is an error in the flow.
|
|
4001
|
+
*/
|
|
4002
|
+
onError(callback?: (data: IOnErrorEventData) => void): () => void;
|
|
4003
|
+
/**
|
|
4004
|
+
* Callback for onCancel method.
|
|
4005
|
+
*
|
|
4006
|
+
* @callback OnCancelCallback
|
|
4007
|
+
* @param {IOnCancelEventData} data
|
|
4008
|
+
*/
|
|
4009
|
+
/**
|
|
4010
|
+
* If in the process for obtaining the setup token was cancelled, the function passed as parameter will be called.
|
|
4011
|
+
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
4012
|
+
*
|
|
4013
|
+
* @example
|
|
4014
|
+
* payPalSavePaymentSourceWidget.onCancel(() => console.log('Operation cancelled'));
|
|
4015
|
+
*
|
|
4016
|
+
* @param {OnCancelCallback} [callback] - Function to be called when the operation is cancelled.
|
|
4017
|
+
*/
|
|
4018
|
+
onCancel(callback?: (data?: IOnCancelEventData) => void): () => void;
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
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, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, type ICheckout, type IDetails, type IElementStyleInput, type IEventCheckoutFinishData, type IPayPalMeta, type IStyles$1 as IStyles, type ITexts, 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 };
|