@internetarchive/donation-form 1.0.2 → 1.0.3-alpha-webdev7960.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -661
- package/README.md +115 -115
- package/dist/demo/braintree-endpoint-manager.js.map +1 -1
- package/dist/demo/demo-analytics-handler.js.map +1 -1
- package/dist/demo/submit-form-with.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/braintree-manager/braintree-interfaces.js.map +1 -1
- package/dist/src/braintree-manager/braintree-manager.js.map +1 -1
- package/dist/src/braintree-manager/payment-clients.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-interface.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-delegate.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-interface.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-manager.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/credit-card/credit-card-interface.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/credit-card/credit-card.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/credit-card/hosted-field-configuration.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/credit-card/hosted-field-container.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/google-pay-interface.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/google-pay.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/paypal/paypal-button-datasource.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/paypal/paypal-interface.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/paypal/paypal.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/venmo-interface.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers/venmo.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers-interface.js.map +1 -1
- package/dist/src/braintree-manager/payment-providers.js.map +1 -1
- package/dist/src/donation-form-controller.js +123 -123
- package/dist/src/donation-form-controller.js.map +1 -1
- package/dist/src/donation-form-error.js.map +1 -1
- package/dist/src/donation-form.js +107 -107
- package/dist/src/donation-form.js.map +1 -1
- package/dist/src/form-elements/badged-input.js +47 -47
- package/dist/src/form-elements/badged-input.js.map +1 -1
- package/dist/src/form-elements/contact-form/autocomplete-field-options.js.map +1 -1
- package/dist/src/form-elements/contact-form/contact-form.js +157 -157
- package/dist/src/form-elements/contact-form/contact-form.js.map +1 -1
- package/dist/src/form-elements/contact-form/countries.js.map +1 -1
- package/dist/src/form-elements/header/donation-form-header.js +14 -14
- package/dist/src/form-elements/header/donation-form-header.js.map +1 -1
- package/dist/src/form-elements/header/donation-summary.js +15 -15
- package/dist/src/form-elements/header/donation-summary.js.map +1 -1
- package/dist/src/form-elements/payment-selector.js +164 -164
- package/dist/src/form-elements/payment-selector.js.map +1 -1
- package/dist/src/form-elements/total-amount.js +16 -16
- package/dist/src/form-elements/total-amount.js.map +1 -1
- package/dist/src/modals/confirm-donation-modal-content.js +51 -51
- package/dist/src/modals/confirm-donation-modal-content.js.map +1 -1
- package/dist/src/modals/error-modal-content.js +22 -22
- package/dist/src/modals/error-modal-content.js.map +1 -1
- package/dist/src/modals/upsell-modal-content.js +182 -182
- package/dist/src/modals/upsell-modal-content.js.map +1 -1
- package/dist/src/payment-flow-handlers/donation-flow-modal-manager.js +20 -20
- package/dist/src/payment-flow-handlers/donation-flow-modal-manager.js.map +1 -1
- package/dist/src/payment-flow-handlers/handlers/applepay-flow-handler.js.map +1 -1
- package/dist/src/payment-flow-handlers/handlers/creditcard-flow-handler.js.map +1 -1
- package/dist/src/payment-flow-handlers/handlers/googlepay-flow-handler.js.map +1 -1
- package/dist/src/payment-flow-handlers/handlers/paypal-flow-handler.js.map +1 -1
- package/dist/src/payment-flow-handlers/handlers/venmo-flow-handler.js.map +1 -1
- package/dist/src/payment-flow-handlers/handlers/venmo-restoration-state-handler.js.map +1 -1
- package/dist/src/payment-flow-handlers/payment-flow-handlers.js.map +1 -1
- package/dist/src/recaptcha-manager/recaptcha-manager.js.map +1 -1
- package/dist/src/util/promisedSleep.js.map +1 -1
- package/dist/test/helpers/fillInContactForm.js.map +1 -1
- package/dist/test/mocks/flow-handlers/individual-handlers/mock-applepay-flow-handler.js.map +1 -1
- package/dist/test/mocks/flow-handlers/individual-handlers/mock-creditcard-flow-handler.js.map +1 -1
- package/dist/test/mocks/flow-handlers/individual-handlers/mock-googlepay-flow-handler.js.map +1 -1
- package/dist/test/mocks/flow-handlers/individual-handlers/mock-paypal-flow-handler.js.map +1 -1
- package/dist/test/mocks/flow-handlers/individual-handlers/mock-venmo-flow-handler.js.map +1 -1
- package/dist/test/mocks/flow-handlers/mock-payment-flow-handlers.js.map +1 -1
- package/dist/test/mocks/mock-braintree-manager.js.map +1 -1
- package/dist/test/mocks/mock-donation-info.js.map +1 -1
- package/dist/test/mocks/mock-endpoint-manager.js.map +1 -1
- package/dist/test/mocks/mock-hosted-fields-config.js.map +1 -1
- package/dist/test/mocks/mock-hosted-fields-container.js.map +1 -1
- package/dist/test/mocks/mock-lazy-loader.js.map +1 -1
- package/dist/test/mocks/mock-modal-manager.js.map +1 -1
- package/dist/test/mocks/mock-payment-clients.js.map +1 -1
- package/dist/test/mocks/mock-paypal-button-renderer.js.map +1 -1
- package/dist/test/mocks/mock-recaptcha-manager.js.map +1 -1
- package/dist/test/mocks/models/mock-billing-info.js.map +1 -1
- package/dist/test/mocks/models/mock-custom-fields.js.map +1 -1
- package/dist/test/mocks/models/mock-customer-info.js.map +1 -1
- package/dist/test/mocks/models/mock-donation-request.js.map +1 -1
- package/dist/test/mocks/models/mock-success-response.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-applepay-client.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-applepay-payment.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-applepay-paymentauthorizedevent.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-applepay-session.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-applepay-sessionmanager.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-applepay-validatemerchantevent.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-braintree-client.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-data-collector.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-googlepay-client.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-googlepay-library.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-grecaptcha.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-hostedfields-client.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-hostedfieldstateobject-generator.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-hostedfieldtokenizepayload.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-paypal-client.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-paypal-library.js.map +1 -1
- package/dist/test/mocks/payment-clients/mock-venmo-client.js.map +1 -1
- package/dist/test/mocks/payment-providers/individual-providers/mock-applepay-datasource-delegate.js.map +1 -1
- package/dist/test/mocks/payment-providers/individual-providers/mock-applepay-handler.js.map +1 -1
- package/dist/test/mocks/payment-providers/individual-providers/mock-creditcard-handler.js.map +1 -1
- package/dist/test/mocks/payment-providers/individual-providers/mock-googlepay-handler.js.map +1 -1
- package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-button-datasource-delegate.js.map +1 -1
- package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-button-datasource.js.map +1 -1
- package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-handler.js.map +1 -1
- package/dist/test/mocks/payment-providers/individual-providers/mock-venmo-handler.js.map +1 -1
- package/dist/test/mocks/payment-providers/mock-payment-providers.js.map +1 -1
- package/dist/test/tests/braintree-manager.test.js.map +1 -1
- package/dist/test/tests/donation-form-controller.test.js +39 -39
- package/dist/test/tests/donation-form-controller.test.js.map +1 -1
- package/dist/test/tests/donation-form.test.js +4 -4
- package/dist/test/tests/donation-form.test.js.map +1 -1
- package/dist/test/tests/flow-handlers/donation-flow-modal-manager.test.js +14 -14
- package/dist/test/tests/flow-handlers/donation-flow-modal-manager.test.js.map +1 -1
- package/dist/test/tests/form-elements/donation-summary.test.js.map +1 -1
- package/dist/test/tests/form-elements/payment-selector.test.js.map +1 -1
- package/dist/test/tests/modals/error-modal-content.test.js +2 -2
- package/dist/test/tests/modals/error-modal-content.test.js.map +1 -1
- package/dist/test/tests/modals/upsell-modal-content.test.js +31 -31
- package/dist/test/tests/modals/upsell-modal-content.test.js.map +1 -1
- package/dist/test/tests/models/donation-payment-info.test.js.map +1 -1
- package/dist/test/tests/payment-clients.test.js.map +1 -1
- package/dist/test/tests/payment-providers/applepay-sessiondatasource.test.js.map +1 -1
- package/dist/test/tests/payment-providers/applepay-sessionmanager.test.js.map +1 -1
- package/dist/test/tests/payment-providers/applepay.test.js.map +1 -1
- package/dist/test/tests/payment-providers/creditcard.test.js.map +1 -1
- package/dist/test/tests/payment-providers/googlepay.test.js.map +1 -1
- package/dist/test/tests/payment-providers/payment-providers.test.js.map +1 -1
- package/dist/test/tests/payment-providers/paypal-button-datasource.test.js.map +1 -1
- package/dist/test/tests/payment-providers/paypal.test.js.map +1 -1
- package/dist/test/tests/payment-providers/venmo.test.js.map +1 -1
- package/dist/test/tests/recaptcha-manager.test.js.map +1 -1
- package/package.json +107 -107
- package/src/@types/analytics-handler/index.d.ts +8 -8
- package/src/@types/braintree-web/LICENSE +21 -21
- package/src/@types/braintree-web/index.d.ts +93 -93
- package/src/@types/braintree-web/modules/american-express.d.ts +50 -50
- package/src/@types/braintree-web/modules/apple-pay.d.ts +213 -213
- package/src/@types/braintree-web/modules/client.d.ts +103 -103
- package/src/@types/braintree-web/modules/core.d.ts +34 -34
- package/src/@types/braintree-web/modules/data-collector.d.ts +13 -13
- package/src/@types/braintree-web/modules/google-payment.d.ts +269 -269
- package/src/@types/braintree-web/modules/hosted-fields.d.ts +366 -366
- package/src/@types/braintree-web/modules/paypal-checkout.d.ts +262 -262
- package/src/@types/braintree-web/modules/paypal.d.ts +177 -177
- package/src/@types/braintree-web/modules/three-d-secure.d.ts +141 -141
- package/src/@types/braintree-web/modules/unionpay.d.ts +224 -224
- package/src/@types/braintree-web/modules/us-bank-account.d.ts +81 -81
- package/src/@types/braintree-web/modules/venmo.d.ts +110 -110
- package/src/@types/braintree-web/package.json +64 -64
- package/src/@types/paypal-checkout-components/LICENSE +21 -21
- package/src/@types/paypal-checkout-components/index.d.ts +67 -67
- package/src/@types/paypal-checkout-components/modules/button.d.ts +50 -50
- package/src/@types/paypal-checkout-components/modules/callback-data.d.ts +244 -244
- package/src/@types/paypal-checkout-components/modules/configuration.d.ts +114 -114
- package/src/@types/paypal-checkout-components/package.json +58 -58
- package/src/braintree-manager/braintree-interfaces.ts +172 -172
- package/src/braintree-manager/braintree-manager.ts +281 -281
- package/src/braintree-manager/payment-clients.ts +146 -146
- package/src/braintree-manager/payment-providers/apple-pay/apple-pay-interface.ts +13 -13
- package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-delegate.ts +8 -8
- package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-interface.ts +10 -10
- package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource.ts +119 -119
- package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-manager.ts +21 -21
- package/src/braintree-manager/payment-providers/apple-pay/apple-pay.ts +97 -97
- package/src/braintree-manager/payment-providers/credit-card/credit-card-interface.ts +21 -21
- package/src/braintree-manager/payment-providers/credit-card/credit-card.ts +130 -130
- package/src/braintree-manager/payment-providers/credit-card/hosted-field-configuration.ts +19 -19
- package/src/braintree-manager/payment-providers/credit-card/hosted-field-container.ts +85 -85
- package/src/braintree-manager/payment-providers/google-pay-interface.ts +8 -8
- package/src/braintree-manager/payment-providers/google-pay.ts +59 -59
- package/src/braintree-manager/payment-providers/paypal/paypal-button-datasource.ts +218 -218
- package/src/braintree-manager/payment-providers/paypal/paypal-interface.ts +13 -13
- package/src/braintree-manager/payment-providers/paypal/paypal.ts +78 -78
- package/src/braintree-manager/payment-providers/venmo-interface.ts +8 -8
- package/src/braintree-manager/payment-providers/venmo.ts +67 -67
- package/src/braintree-manager/payment-providers-interface.ts +25 -25
- package/src/braintree-manager/payment-providers.ts +147 -147
- package/src/donation-form-controller.ts +623 -623
- package/src/donation-form-error.ts +6 -6
- package/src/donation-form.ts +576 -576
- package/src/form-elements/badged-input.ts +109 -109
- package/src/form-elements/contact-form/autocomplete-field-options.ts +63 -63
- package/src/form-elements/contact-form/contact-form.ts +434 -434
- package/src/form-elements/contact-form/countries.ts +252 -252
- package/src/form-elements/header/donation-form-header.ts +98 -98
- package/src/form-elements/header/donation-summary.ts +61 -61
- package/src/form-elements/payment-selector.ts +365 -365
- package/src/form-elements/total-amount.ts +46 -46
- package/src/modals/confirm-donation-modal-content.ts +168 -168
- package/src/modals/error-modal-content.ts +48 -48
- package/src/modals/upsell-modal-content.ts +284 -284
- package/src/payment-flow-handlers/donation-flow-modal-manager.ts +439 -439
- package/src/payment-flow-handlers/handlers/applepay-flow-handler.ts +109 -109
- package/src/payment-flow-handlers/handlers/creditcard-flow-handler.ts +232 -232
- package/src/payment-flow-handlers/handlers/googlepay-flow-handler.ts +111 -111
- package/src/payment-flow-handlers/handlers/paypal-flow-handler.ts +331 -331
- package/src/payment-flow-handlers/handlers/venmo-flow-handler.ts +119 -119
- package/src/payment-flow-handlers/handlers/venmo-restoration-state-handler.ts +127 -127
- package/src/payment-flow-handlers/payment-flow-handlers.ts +218 -218
- package/src/recaptcha-manager/recaptcha-manager.ts +123 -123
- package/src/util/promisedSleep.ts +3 -3
- package/dist/demo/app-root.d.ts +0 -0
- package/dist/demo/app-root.js +0 -2
- package/dist/demo/app-root.js.map +0 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/**
|
|
3
|
-
* @description The current version of the SDK, i.e. `3.0.2`.
|
|
4
|
-
*/
|
|
5
|
-
export const VERSION: string;
|
|
6
|
-
|
|
7
|
-
export type callback = (err?: BraintreeError, data?: any) => void;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Enum for {@link BraintreeError} types.
|
|
11
|
-
*/
|
|
12
|
-
export type BraintreeErrorTypes = 'CUSTOMER' | 'MERCHANT' | 'NETWORK' | 'INTERNAL' | 'UNKNOWN';
|
|
13
|
-
|
|
14
|
-
export interface BraintreeError {
|
|
15
|
-
/**
|
|
16
|
-
* @description A code that corresponds to specific errors.
|
|
17
|
-
*/
|
|
18
|
-
code: string;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @description A short description of the error.
|
|
22
|
-
*/
|
|
23
|
-
message: string;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @description The type of error.
|
|
27
|
-
*/
|
|
28
|
-
type: BraintreeErrorTypes;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @description Additional information about the error, such as an underlying network error response.
|
|
32
|
-
*/
|
|
33
|
-
details: any;
|
|
34
|
-
}
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/**
|
|
3
|
+
* @description The current version of the SDK, i.e. `3.0.2`.
|
|
4
|
+
*/
|
|
5
|
+
export const VERSION: string;
|
|
6
|
+
|
|
7
|
+
export type callback = (err?: BraintreeError, data?: any) => void;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Enum for {@link BraintreeError} types.
|
|
11
|
+
*/
|
|
12
|
+
export type BraintreeErrorTypes = 'CUSTOMER' | 'MERCHANT' | 'NETWORK' | 'INTERNAL' | 'UNKNOWN';
|
|
13
|
+
|
|
14
|
+
export interface BraintreeError {
|
|
15
|
+
/**
|
|
16
|
+
* @description A code that corresponds to specific errors.
|
|
17
|
+
*/
|
|
18
|
+
code: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @description A short description of the error.
|
|
22
|
+
*/
|
|
23
|
+
message: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @description The type of error.
|
|
27
|
+
*/
|
|
28
|
+
type: BraintreeErrorTypes;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @description Additional information about the error, such as an underlying network error response.
|
|
32
|
+
*/
|
|
33
|
+
details: any;
|
|
34
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { callback } from './core';
|
|
2
|
-
import { Client } from './client';
|
|
3
|
-
|
|
4
|
-
export interface DataCollector {
|
|
5
|
-
create(options: { client: Client; kount: boolean; paypal: boolean }): Promise<DataCollector>;
|
|
6
|
-
create(options: { client: Client; kount: boolean; paypal: boolean }, callback: callback): void;
|
|
7
|
-
|
|
8
|
-
VERSION: string;
|
|
9
|
-
|
|
10
|
-
deviceData: string;
|
|
11
|
-
|
|
12
|
-
teardown(callback?: callback): void;
|
|
13
|
-
}
|
|
1
|
+
import { callback } from './core';
|
|
2
|
+
import { Client } from './client';
|
|
3
|
+
|
|
4
|
+
export interface DataCollector {
|
|
5
|
+
create(options: { client: Client; kount: boolean; paypal: boolean }): Promise<DataCollector>;
|
|
6
|
+
create(options: { client: Client; kount: boolean; paypal: boolean }, callback: callback): void;
|
|
7
|
+
|
|
8
|
+
VERSION: string;
|
|
9
|
+
|
|
10
|
+
deviceData: string;
|
|
11
|
+
|
|
12
|
+
teardown(callback?: callback): void;
|
|
13
|
+
}
|
|
@@ -1,269 +1,269 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/// <reference types="googlepay" />
|
|
3
|
-
|
|
4
|
-
import { callback } from './core';
|
|
5
|
-
import { Client } from './client';
|
|
6
|
-
|
|
7
|
-
export type GooglePaymentTokenizeValues = 'Yes' | 'No' | 'Unknown';
|
|
8
|
-
|
|
9
|
-
export interface GooglePaymentTokenizePayload {
|
|
10
|
-
nonce: string;
|
|
11
|
-
details: {
|
|
12
|
-
cardType: string;
|
|
13
|
-
lastFour: string;
|
|
14
|
-
lastTow: string;
|
|
15
|
-
isNetworkTokenized: boolean;
|
|
16
|
-
bin: string;
|
|
17
|
-
};
|
|
18
|
-
description: string;
|
|
19
|
-
type: string;
|
|
20
|
-
binData: {
|
|
21
|
-
commercial: GooglePaymentTokenizeValues;
|
|
22
|
-
countryOfIssuance: string;
|
|
23
|
-
debit: GooglePaymentTokenizeValues;
|
|
24
|
-
durbinRegulated: GooglePaymentTokenizeValues;
|
|
25
|
-
healthcare: GooglePaymentTokenizeValues;
|
|
26
|
-
issuingBank: GooglePaymentTokenizeValues;
|
|
27
|
-
payroll: GooglePaymentTokenizeValues;
|
|
28
|
-
prepaid: GooglePaymentTokenizeValues;
|
|
29
|
-
productId: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface GooglePayment {
|
|
34
|
-
/**
|
|
35
|
-
* // include https://pay.google.com/gp/p/js/pay.js in a script tag
|
|
36
|
-
* // on your page to load the `google.payments.api.PaymentsClient` global object.
|
|
37
|
-
*
|
|
38
|
-
* var paymentButton = document.querySelector('#google-pay-button');
|
|
39
|
-
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
40
|
-
* environment: 'TEST' // or 'PRODUCTION'
|
|
41
|
-
* });
|
|
42
|
-
*
|
|
43
|
-
* braintree.client.create({
|
|
44
|
-
* authorization: 'tokenization-key-or-client-token'
|
|
45
|
-
* }).then(function (clientInstance) {
|
|
46
|
-
* return braintree.googlePayment.create({
|
|
47
|
-
* client: clientInstance,
|
|
48
|
-
* googlePayVersion: 2,
|
|
49
|
-
* googleMerchantId: 'your-merchant-id-from-google'
|
|
50
|
-
* });
|
|
51
|
-
* }).then(function (googlePaymentInstance) {
|
|
52
|
-
* paymentButton.addEventListener('click', function (event) {
|
|
53
|
-
* var paymentDataRequest;
|
|
54
|
-
*
|
|
55
|
-
* event.preventDefault();
|
|
56
|
-
*
|
|
57
|
-
* paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
|
|
58
|
-
* transactionInfo: {
|
|
59
|
-
* currencyCode: 'USD',
|
|
60
|
-
* totalPriceStatus: 'FINAL',
|
|
61
|
-
* totalPrice: '100.00'
|
|
62
|
-
* }
|
|
63
|
-
* });
|
|
64
|
-
*
|
|
65
|
-
* paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) {
|
|
66
|
-
* return googlePaymentInstance.parseResponse(paymentData);
|
|
67
|
-
* }).then(function (result) {
|
|
68
|
-
* // send result.nonce to your server
|
|
69
|
-
* }).catch(function (err) {
|
|
70
|
-
* // handle err
|
|
71
|
-
* });
|
|
72
|
-
* });
|
|
73
|
-
* });
|
|
74
|
-
*
|
|
75
|
-
* @example <caption>Check Browser and Customer Compatibility</caption>
|
|
76
|
-
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
77
|
-
* environment: 'TEST' // or 'PRODUCTION'
|
|
78
|
-
* });
|
|
79
|
-
*
|
|
80
|
-
* function setupGooglePayButton(googlePaymentInstance) {
|
|
81
|
-
* var button = document.createElement('button');
|
|
82
|
-
*
|
|
83
|
-
* button.id = 'google-pay';
|
|
84
|
-
* button.appendChild(document.createTextNode('Google Pay'));
|
|
85
|
-
* button.addEventListener('click', function (event) {
|
|
86
|
-
* var paymentRequestData;
|
|
87
|
-
*
|
|
88
|
-
* event.preventDefault();
|
|
89
|
-
*
|
|
90
|
-
* paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
|
|
91
|
-
* transactionInfo: {
|
|
92
|
-
* currencyCode: 'USD',
|
|
93
|
-
* totalPriceStatus: 'FINAL',
|
|
94
|
-
* totalPrice: '100.00' // your amount
|
|
95
|
-
* }
|
|
96
|
-
* });
|
|
97
|
-
*
|
|
98
|
-
* paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) {
|
|
99
|
-
* return googlePaymentInstance.parseResponse(paymentData);
|
|
100
|
-
* }).then(function (result) {
|
|
101
|
-
* // send result.nonce to your server
|
|
102
|
-
* }).catch(function (err) {
|
|
103
|
-
* // handle errors
|
|
104
|
-
* });
|
|
105
|
-
* });
|
|
106
|
-
*
|
|
107
|
-
* document.getElementById('container').appendChild(button);
|
|
108
|
-
* }
|
|
109
|
-
*
|
|
110
|
-
* braintree.client.create({
|
|
111
|
-
* authorization: 'tokenization-key-or-client-token'
|
|
112
|
-
* }).then(function (clientInstance) {
|
|
113
|
-
* return braintree.googlePayment.create({
|
|
114
|
-
* client: clientInstance,
|
|
115
|
-
* googlePayVersion: 2,
|
|
116
|
-
* googleMerchantId: 'your-merchant-id-from-google'
|
|
117
|
-
* });
|
|
118
|
-
* }).then(function (googlePaymentInstance) {
|
|
119
|
-
*
|
|
120
|
-
* return paymentsClient.isReadyToPay({
|
|
121
|
-
* // see https://developers.google.com/pay/api/web/reference/object#IsReadyToPayRequest for all options
|
|
122
|
-
* apiVersion: 2,
|
|
123
|
-
* apiVersionMinor: 0,
|
|
124
|
-
* allowedPaymentMethods: googlePaymentInstance.createPaymentDataRequest().allowedPaymentMethods,
|
|
125
|
-
* existingPaymentMethodRequired: true
|
|
126
|
-
* });
|
|
127
|
-
* }).then(function (response) {
|
|
128
|
-
* if (response.result) {
|
|
129
|
-
* setupGooglePayButton(googlePaymentInstance);
|
|
130
|
-
* }
|
|
131
|
-
* }).catch(function (err) {
|
|
132
|
-
* // handle setup errors
|
|
133
|
-
* });
|
|
134
|
-
*
|
|
135
|
-
*/
|
|
136
|
-
create(options: {
|
|
137
|
-
client?: Client;
|
|
138
|
-
authorization?: string;
|
|
139
|
-
useDeferredClient?: boolean;
|
|
140
|
-
googlePayVersion?: number;
|
|
141
|
-
googleMerchantId?: string;
|
|
142
|
-
}): Promise<GooglePayment>;
|
|
143
|
-
create(
|
|
144
|
-
options: {
|
|
145
|
-
client?: Client;
|
|
146
|
-
authorization?: string;
|
|
147
|
-
useDeferredClient?: boolean;
|
|
148
|
-
googlePayVersion?: number;
|
|
149
|
-
googleMerchantId?: string;
|
|
150
|
-
},
|
|
151
|
-
callback?: callback,
|
|
152
|
-
): void;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Create a configuration object for use in the `loadPaymentData` method.
|
|
156
|
-
*
|
|
157
|
-
* **Note**: Version 1 of the Google Pay Api is deprecated and will become unsupported in a future version.
|
|
158
|
-
* Until then, version 1 will continue to be used by default, and version 1 schema parameters and overrides will
|
|
159
|
-
* remain functional on existing integrations. However, new integrations and all following examples will be
|
|
160
|
-
* presented in the GooglePay version 2 schema.
|
|
161
|
-
* See [Google Pay's upgrade guide](https://developers.google.com/pay/api/web/guides/resources/update-to-latest-version)
|
|
162
|
-
* to see how to update your integration.
|
|
163
|
-
*
|
|
164
|
-
* If `options.googlePayVersion === 2` was set during the initial {@link module:braintree-web/google-payment.create|create} call,
|
|
165
|
-
* overrides must match the Google Pay v2 schema to be valid.
|
|
166
|
-
* Optionally, any of the parameters in the [PaymentDataRequest](https://developers.google.com/pay/api/web/reference/object#PaymentDataRequest)
|
|
167
|
-
* parameters can be overridden, but note that it is recommended only to override top level parameters to avoid
|
|
168
|
-
* squashing deeply nested configuration objects.
|
|
169
|
-
* An example can be found below showing how to safely edit these deeply nested objects.
|
|
170
|
-
* @example
|
|
171
|
-
* var paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
|
|
172
|
-
* merchantInfo: {
|
|
173
|
-
* merchantId: 'my-merchant-id-from-google'
|
|
174
|
-
* },
|
|
175
|
-
* transactionInfo: {
|
|
176
|
-
* currencyCode: 'USD',
|
|
177
|
-
* totalPriceStatus: 'FINAL',
|
|
178
|
-
* totalPrice: '100.00'
|
|
179
|
-
* }
|
|
180
|
-
* });
|
|
181
|
-
*
|
|
182
|
-
* // Update card payment methods to require billing address
|
|
183
|
-
* var cardPaymentMethod = paymentDataRequest.allowedPaymentMethods;
|
|
184
|
-
* cardPaymentMethod.parameters.billingAddressRequired = true;
|
|
185
|
-
* cardPaymentMethod.parameters.billingAddressParameters = {
|
|
186
|
-
* format: 'FULL',
|
|
187
|
-
* phoneNumberRequired: true
|
|
188
|
-
* };
|
|
189
|
-
*
|
|
190
|
-
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
191
|
-
* environment: 'TEST' // or 'PRODUCTION'
|
|
192
|
-
* })
|
|
193
|
-
*
|
|
194
|
-
* paymentsClient.loadPaymentData(paymentDataRequest).then(function (response) {
|
|
195
|
-
* // handle response with googlePaymentInstance.parseResponse
|
|
196
|
-
* // (see below)
|
|
197
|
-
* });
|
|
198
|
-
* @example <caption>With deferred client</caption>
|
|
199
|
-
* googlePaymentInstance.createPaymentDataRequest({
|
|
200
|
-
* merchantInfo: {
|
|
201
|
-
* merchantId: 'my-merchant-id-from-google'
|
|
202
|
-
* },
|
|
203
|
-
* transactionInfo: {
|
|
204
|
-
* currencyCode: 'USD',
|
|
205
|
-
* totalPriceStatus: 'FINAL',
|
|
206
|
-
* totalPrice: '100.00'
|
|
207
|
-
* }
|
|
208
|
-
* }).then(function (paymentDataRequest) {
|
|
209
|
-
* // Update card payment methods to require billing address
|
|
210
|
-
* var cardPaymentMethod = paymentDataRequest.allowedPaymentMethods;
|
|
211
|
-
* cardPaymentMethod.parameters.billingAddressRequired = true;
|
|
212
|
-
* cardPaymentMethod.parameters.billingAddressParameters = {
|
|
213
|
-
* format: 'FULL',
|
|
214
|
-
* phoneNumberRequired: true
|
|
215
|
-
* };
|
|
216
|
-
*
|
|
217
|
-
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
218
|
-
* environment: 'TEST' // or 'PRODUCTION'
|
|
219
|
-
* })
|
|
220
|
-
*
|
|
221
|
-
* return paymentsClient.loadPaymentData(paymentDataRequest);
|
|
222
|
-
* }).then(function (response) {
|
|
223
|
-
* // handle response with googlePaymentInstance.parseResponse
|
|
224
|
-
* // (see below)
|
|
225
|
-
* });
|
|
226
|
-
*/
|
|
227
|
-
createPaymentDataRequest(overrides?: {
|
|
228
|
-
emailRequired?: boolean;
|
|
229
|
-
merchantInfo?: {
|
|
230
|
-
merchantId: string;
|
|
231
|
-
};
|
|
232
|
-
transactionInfo: {
|
|
233
|
-
currencyCode: string;
|
|
234
|
-
totalPriceStatus: string;
|
|
235
|
-
totalPrice: string;
|
|
236
|
-
};
|
|
237
|
-
}): Promise<google.payments.api.PaymentDataRequest>;
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Parse the response from the tokenization.
|
|
241
|
-
* @example with callback
|
|
242
|
-
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
243
|
-
* environment: 'TEST' // or 'PRODUCTION'
|
|
244
|
-
* })
|
|
245
|
-
*
|
|
246
|
-
* paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) {
|
|
247
|
-
* googlePaymentInstance.parseResponse(response, function (err, data) {
|
|
248
|
-
* if (err) {
|
|
249
|
-
* // handle errors
|
|
250
|
-
* }
|
|
251
|
-
* // send parsedResponse.nonce to your server
|
|
252
|
-
* });
|
|
253
|
-
* });
|
|
254
|
-
* @example with promise
|
|
255
|
-
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
256
|
-
* environment: 'TEST' // or 'PRODUCTION'
|
|
257
|
-
* })
|
|
258
|
-
*
|
|
259
|
-
* paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) {
|
|
260
|
-
* return googlePaymentInstance.parseResponse(response);
|
|
261
|
-
* }).then(function (parsedResponse) {
|
|
262
|
-
* // send parsedResponse.nonce to your server
|
|
263
|
-
* }).catch(function (err) {
|
|
264
|
-
* // handle errors
|
|
265
|
-
* });
|
|
266
|
-
*/
|
|
267
|
-
parseResponse(response: any): Promise<GooglePaymentTokenizePayload>;
|
|
268
|
-
parseResponse(response: any, callback?: callback): void;
|
|
269
|
-
}
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/// <reference types="googlepay" />
|
|
3
|
+
|
|
4
|
+
import { callback } from './core';
|
|
5
|
+
import { Client } from './client';
|
|
6
|
+
|
|
7
|
+
export type GooglePaymentTokenizeValues = 'Yes' | 'No' | 'Unknown';
|
|
8
|
+
|
|
9
|
+
export interface GooglePaymentTokenizePayload {
|
|
10
|
+
nonce: string;
|
|
11
|
+
details: {
|
|
12
|
+
cardType: string;
|
|
13
|
+
lastFour: string;
|
|
14
|
+
lastTow: string;
|
|
15
|
+
isNetworkTokenized: boolean;
|
|
16
|
+
bin: string;
|
|
17
|
+
};
|
|
18
|
+
description: string;
|
|
19
|
+
type: string;
|
|
20
|
+
binData: {
|
|
21
|
+
commercial: GooglePaymentTokenizeValues;
|
|
22
|
+
countryOfIssuance: string;
|
|
23
|
+
debit: GooglePaymentTokenizeValues;
|
|
24
|
+
durbinRegulated: GooglePaymentTokenizeValues;
|
|
25
|
+
healthcare: GooglePaymentTokenizeValues;
|
|
26
|
+
issuingBank: GooglePaymentTokenizeValues;
|
|
27
|
+
payroll: GooglePaymentTokenizeValues;
|
|
28
|
+
prepaid: GooglePaymentTokenizeValues;
|
|
29
|
+
productId: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface GooglePayment {
|
|
34
|
+
/**
|
|
35
|
+
* // include https://pay.google.com/gp/p/js/pay.js in a script tag
|
|
36
|
+
* // on your page to load the `google.payments.api.PaymentsClient` global object.
|
|
37
|
+
*
|
|
38
|
+
* var paymentButton = document.querySelector('#google-pay-button');
|
|
39
|
+
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
40
|
+
* environment: 'TEST' // or 'PRODUCTION'
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* braintree.client.create({
|
|
44
|
+
* authorization: 'tokenization-key-or-client-token'
|
|
45
|
+
* }).then(function (clientInstance) {
|
|
46
|
+
* return braintree.googlePayment.create({
|
|
47
|
+
* client: clientInstance,
|
|
48
|
+
* googlePayVersion: 2,
|
|
49
|
+
* googleMerchantId: 'your-merchant-id-from-google'
|
|
50
|
+
* });
|
|
51
|
+
* }).then(function (googlePaymentInstance) {
|
|
52
|
+
* paymentButton.addEventListener('click', function (event) {
|
|
53
|
+
* var paymentDataRequest;
|
|
54
|
+
*
|
|
55
|
+
* event.preventDefault();
|
|
56
|
+
*
|
|
57
|
+
* paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
|
|
58
|
+
* transactionInfo: {
|
|
59
|
+
* currencyCode: 'USD',
|
|
60
|
+
* totalPriceStatus: 'FINAL',
|
|
61
|
+
* totalPrice: '100.00'
|
|
62
|
+
* }
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) {
|
|
66
|
+
* return googlePaymentInstance.parseResponse(paymentData);
|
|
67
|
+
* }).then(function (result) {
|
|
68
|
+
* // send result.nonce to your server
|
|
69
|
+
* }).catch(function (err) {
|
|
70
|
+
* // handle err
|
|
71
|
+
* });
|
|
72
|
+
* });
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* @example <caption>Check Browser and Customer Compatibility</caption>
|
|
76
|
+
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
77
|
+
* environment: 'TEST' // or 'PRODUCTION'
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* function setupGooglePayButton(googlePaymentInstance) {
|
|
81
|
+
* var button = document.createElement('button');
|
|
82
|
+
*
|
|
83
|
+
* button.id = 'google-pay';
|
|
84
|
+
* button.appendChild(document.createTextNode('Google Pay'));
|
|
85
|
+
* button.addEventListener('click', function (event) {
|
|
86
|
+
* var paymentRequestData;
|
|
87
|
+
*
|
|
88
|
+
* event.preventDefault();
|
|
89
|
+
*
|
|
90
|
+
* paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
|
|
91
|
+
* transactionInfo: {
|
|
92
|
+
* currencyCode: 'USD',
|
|
93
|
+
* totalPriceStatus: 'FINAL',
|
|
94
|
+
* totalPrice: '100.00' // your amount
|
|
95
|
+
* }
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) {
|
|
99
|
+
* return googlePaymentInstance.parseResponse(paymentData);
|
|
100
|
+
* }).then(function (result) {
|
|
101
|
+
* // send result.nonce to your server
|
|
102
|
+
* }).catch(function (err) {
|
|
103
|
+
* // handle errors
|
|
104
|
+
* });
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* document.getElementById('container').appendChild(button);
|
|
108
|
+
* }
|
|
109
|
+
*
|
|
110
|
+
* braintree.client.create({
|
|
111
|
+
* authorization: 'tokenization-key-or-client-token'
|
|
112
|
+
* }).then(function (clientInstance) {
|
|
113
|
+
* return braintree.googlePayment.create({
|
|
114
|
+
* client: clientInstance,
|
|
115
|
+
* googlePayVersion: 2,
|
|
116
|
+
* googleMerchantId: 'your-merchant-id-from-google'
|
|
117
|
+
* });
|
|
118
|
+
* }).then(function (googlePaymentInstance) {
|
|
119
|
+
*
|
|
120
|
+
* return paymentsClient.isReadyToPay({
|
|
121
|
+
* // see https://developers.google.com/pay/api/web/reference/object#IsReadyToPayRequest for all options
|
|
122
|
+
* apiVersion: 2,
|
|
123
|
+
* apiVersionMinor: 0,
|
|
124
|
+
* allowedPaymentMethods: googlePaymentInstance.createPaymentDataRequest().allowedPaymentMethods,
|
|
125
|
+
* existingPaymentMethodRequired: true
|
|
126
|
+
* });
|
|
127
|
+
* }).then(function (response) {
|
|
128
|
+
* if (response.result) {
|
|
129
|
+
* setupGooglePayButton(googlePaymentInstance);
|
|
130
|
+
* }
|
|
131
|
+
* }).catch(function (err) {
|
|
132
|
+
* // handle setup errors
|
|
133
|
+
* });
|
|
134
|
+
*
|
|
135
|
+
*/
|
|
136
|
+
create(options: {
|
|
137
|
+
client?: Client;
|
|
138
|
+
authorization?: string;
|
|
139
|
+
useDeferredClient?: boolean;
|
|
140
|
+
googlePayVersion?: number;
|
|
141
|
+
googleMerchantId?: string;
|
|
142
|
+
}): Promise<GooglePayment>;
|
|
143
|
+
create(
|
|
144
|
+
options: {
|
|
145
|
+
client?: Client;
|
|
146
|
+
authorization?: string;
|
|
147
|
+
useDeferredClient?: boolean;
|
|
148
|
+
googlePayVersion?: number;
|
|
149
|
+
googleMerchantId?: string;
|
|
150
|
+
},
|
|
151
|
+
callback?: callback,
|
|
152
|
+
): void;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Create a configuration object for use in the `loadPaymentData` method.
|
|
156
|
+
*
|
|
157
|
+
* **Note**: Version 1 of the Google Pay Api is deprecated and will become unsupported in a future version.
|
|
158
|
+
* Until then, version 1 will continue to be used by default, and version 1 schema parameters and overrides will
|
|
159
|
+
* remain functional on existing integrations. However, new integrations and all following examples will be
|
|
160
|
+
* presented in the GooglePay version 2 schema.
|
|
161
|
+
* See [Google Pay's upgrade guide](https://developers.google.com/pay/api/web/guides/resources/update-to-latest-version)
|
|
162
|
+
* to see how to update your integration.
|
|
163
|
+
*
|
|
164
|
+
* If `options.googlePayVersion === 2` was set during the initial {@link module:braintree-web/google-payment.create|create} call,
|
|
165
|
+
* overrides must match the Google Pay v2 schema to be valid.
|
|
166
|
+
* Optionally, any of the parameters in the [PaymentDataRequest](https://developers.google.com/pay/api/web/reference/object#PaymentDataRequest)
|
|
167
|
+
* parameters can be overridden, but note that it is recommended only to override top level parameters to avoid
|
|
168
|
+
* squashing deeply nested configuration objects.
|
|
169
|
+
* An example can be found below showing how to safely edit these deeply nested objects.
|
|
170
|
+
* @example
|
|
171
|
+
* var paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
|
|
172
|
+
* merchantInfo: {
|
|
173
|
+
* merchantId: 'my-merchant-id-from-google'
|
|
174
|
+
* },
|
|
175
|
+
* transactionInfo: {
|
|
176
|
+
* currencyCode: 'USD',
|
|
177
|
+
* totalPriceStatus: 'FINAL',
|
|
178
|
+
* totalPrice: '100.00'
|
|
179
|
+
* }
|
|
180
|
+
* });
|
|
181
|
+
*
|
|
182
|
+
* // Update card payment methods to require billing address
|
|
183
|
+
* var cardPaymentMethod = paymentDataRequest.allowedPaymentMethods;
|
|
184
|
+
* cardPaymentMethod.parameters.billingAddressRequired = true;
|
|
185
|
+
* cardPaymentMethod.parameters.billingAddressParameters = {
|
|
186
|
+
* format: 'FULL',
|
|
187
|
+
* phoneNumberRequired: true
|
|
188
|
+
* };
|
|
189
|
+
*
|
|
190
|
+
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
191
|
+
* environment: 'TEST' // or 'PRODUCTION'
|
|
192
|
+
* })
|
|
193
|
+
*
|
|
194
|
+
* paymentsClient.loadPaymentData(paymentDataRequest).then(function (response) {
|
|
195
|
+
* // handle response with googlePaymentInstance.parseResponse
|
|
196
|
+
* // (see below)
|
|
197
|
+
* });
|
|
198
|
+
* @example <caption>With deferred client</caption>
|
|
199
|
+
* googlePaymentInstance.createPaymentDataRequest({
|
|
200
|
+
* merchantInfo: {
|
|
201
|
+
* merchantId: 'my-merchant-id-from-google'
|
|
202
|
+
* },
|
|
203
|
+
* transactionInfo: {
|
|
204
|
+
* currencyCode: 'USD',
|
|
205
|
+
* totalPriceStatus: 'FINAL',
|
|
206
|
+
* totalPrice: '100.00'
|
|
207
|
+
* }
|
|
208
|
+
* }).then(function (paymentDataRequest) {
|
|
209
|
+
* // Update card payment methods to require billing address
|
|
210
|
+
* var cardPaymentMethod = paymentDataRequest.allowedPaymentMethods;
|
|
211
|
+
* cardPaymentMethod.parameters.billingAddressRequired = true;
|
|
212
|
+
* cardPaymentMethod.parameters.billingAddressParameters = {
|
|
213
|
+
* format: 'FULL',
|
|
214
|
+
* phoneNumberRequired: true
|
|
215
|
+
* };
|
|
216
|
+
*
|
|
217
|
+
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
218
|
+
* environment: 'TEST' // or 'PRODUCTION'
|
|
219
|
+
* })
|
|
220
|
+
*
|
|
221
|
+
* return paymentsClient.loadPaymentData(paymentDataRequest);
|
|
222
|
+
* }).then(function (response) {
|
|
223
|
+
* // handle response with googlePaymentInstance.parseResponse
|
|
224
|
+
* // (see below)
|
|
225
|
+
* });
|
|
226
|
+
*/
|
|
227
|
+
createPaymentDataRequest(overrides?: {
|
|
228
|
+
emailRequired?: boolean;
|
|
229
|
+
merchantInfo?: {
|
|
230
|
+
merchantId: string;
|
|
231
|
+
};
|
|
232
|
+
transactionInfo: {
|
|
233
|
+
currencyCode: string;
|
|
234
|
+
totalPriceStatus: string;
|
|
235
|
+
totalPrice: string;
|
|
236
|
+
};
|
|
237
|
+
}): Promise<google.payments.api.PaymentDataRequest>;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Parse the response from the tokenization.
|
|
241
|
+
* @example with callback
|
|
242
|
+
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
243
|
+
* environment: 'TEST' // or 'PRODUCTION'
|
|
244
|
+
* })
|
|
245
|
+
*
|
|
246
|
+
* paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) {
|
|
247
|
+
* googlePaymentInstance.parseResponse(response, function (err, data) {
|
|
248
|
+
* if (err) {
|
|
249
|
+
* // handle errors
|
|
250
|
+
* }
|
|
251
|
+
* // send parsedResponse.nonce to your server
|
|
252
|
+
* });
|
|
253
|
+
* });
|
|
254
|
+
* @example with promise
|
|
255
|
+
* var paymentsClient = new google.payments.api.PaymentsClient({
|
|
256
|
+
* environment: 'TEST' // or 'PRODUCTION'
|
|
257
|
+
* })
|
|
258
|
+
*
|
|
259
|
+
* paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) {
|
|
260
|
+
* return googlePaymentInstance.parseResponse(response);
|
|
261
|
+
* }).then(function (parsedResponse) {
|
|
262
|
+
* // send parsedResponse.nonce to your server
|
|
263
|
+
* }).catch(function (err) {
|
|
264
|
+
* // handle errors
|
|
265
|
+
* });
|
|
266
|
+
*/
|
|
267
|
+
parseResponse(response: any): Promise<GooglePaymentTokenizePayload>;
|
|
268
|
+
parseResponse(response: any, callback?: callback): void;
|
|
269
|
+
}
|