fix(braintree-web): add missing propertes to factory methods (#43433)

* fix(braintree-web): add missing propertes to factory methods

- `authorization`
- `version`

https://braintree.github.io/braintree-web/current/module-braintree-web_hosted-fields.html#.create
https://braintree.github.io/braintree-web/current/module-braintree-web_three-d-secure.html#.create

/cc @jbojcic1

Thanks!

Fixes: #43346

* Add missing `authorization` option as per PR comment
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-04-03 22:12:28 +02:00 committed by GitHub
parent fb647dc611
commit 2729c1ac01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 80 additions and 5 deletions

View File

@ -653,6 +653,7 @@ declare namespace braintree {
* @function create
* @param {object} options Creation options:
* @param {Client} options.client A {@link Client} instance.
* @param {string} options.authorization A tokenizationKey or clientToken. Can be used in place of `options.client`.
* @param {fieldOptions} options.fields A {@link module:braintree-web/hosted-fields~fieldOptions set of options for each field}.
* @param {styleOptions} options.styles {@link module:braintree-web/hosted-fields~styleOptions Styles} applied to each field.
* @param {callback} callback The second argument, `data`, is the {@link HostedFields} instance.
@ -685,8 +686,8 @@ declare namespace braintree {
* }
* }, callback);
*/
create(options: { client: Client, fields: HostedFieldFieldOptions, styles?: any }): Promise<HostedFields>;
create(options: { client: Client, fields: HostedFieldFieldOptions, styles?: any }, callback: callback): void;
create(options: { client?: Client, authorization?: string, fields: HostedFieldFieldOptions, styles?: any }): Promise<HostedFields>;
create(options: { client?: Client, authorization?: string, fields: HostedFieldFieldOptions, styles?: any }, callback: callback): void;
/**
@ -1154,6 +1155,7 @@ declare namespace braintree {
* @static
* @function create
* @param {object} options Creation options:
* @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
* @param {Version} options.version=1 The version of 3DS to use. Pass in 2 to use 3DS 2.0.
* @param {Client} options.client A {@link Client} instance.
* @param {callback} callback The second argument, `data`, is the {@link ThreeDSecure} instance.
@ -1165,8 +1167,8 @@ declare namespace braintree {
*/
create(options: { client: Client }): Promise<ThreeDSecure>;
create(options: { client: Client }, callback: callback): void;
create(options: { version: number, client: Client }): Promise<ThreeDSecure>;
create(options: { version: number, client: Client }, callback: callback): void;
create(options: { authorization?: string, version?: 1 | '1' | 2 | '2' | '2-bootstrap3-modal' | '2-inline-iframe', client?: Client }): Promise<ThreeDSecure>;
create(options: { authorization?: string, version?: 1 | '1' | 2 | '2' | '2-bootstrap3-modal' | '2-inline-iframe', client?: Client }, callback: callback): void;
/**
* @description The current version of the SDK, i.e. `3.0.2`.

View File

@ -47,6 +47,7 @@ braintree.client.create({
braintree.hostedFields.create({
client: clientInstance,
authorization: clientToken,
styles: {
'input': {
'font-size': '16pt',
@ -409,6 +410,41 @@ braintree.client.create({
let existingNonce = "fake-valid-nonce";
let submitNonceToServer: (nonce: string) => void;
braintree.client.create(
{
authorization: clientToken,
},
(error: braintree.BraintreeError, clientInstance: braintree.Client) => {
braintree.threeDSecure.create(
{
client: clientInstance,
version: '2',
},
(createError, threeDSecure) => {
// implementation
},
);
braintree.threeDSecure.create(
{
client: clientInstance,
version: 1,
},
(createError, threeDSecure) => {
// implementation
},
);
braintree.threeDSecure.create(
{
client: clientInstance,
version: '2-bootstrap3-modal',
},
(createError, threeDSecure) => {
// implementation
},
);
},
);
braintree.threeDSecure.verifyCard({
nonce: existingNonce,
amount: 123.45, // $ExpectType number

View File

@ -48,6 +48,7 @@ braintree.client.create({
braintree.hostedFields.create({
client: clientInstance,
authorization: clientToken,
styles: {
'input': {
'font-size': '16pt',
@ -410,6 +411,41 @@ braintree.client.create({
let existingNonce = "fake-valid-nonce";
let submitNonceToServer: (nonce: string) => void;
braintree.client.create(
{
authorization: clientToken,
},
(error: braintree.BraintreeError, clientInstance: braintree.Client) => {
braintree.threeDSecure.create(
{
client: clientInstance,
version: '2',
},
(createError, threeDSecure) => {
// implementation
},
);
braintree.threeDSecure.create(
{
client: clientInstance,
version: 1,
},
(createError, threeDSecure) => {
// implementation
},
);
braintree.threeDSecure.create(
{
client: clientInstance,
version: '2-bootstrap3-modal',
},
(createError, threeDSecure) => {
// implementation
},
);
},
);
braintree.threeDSecure.verifyCard({
nonce: existingNonce,
amount: 123.45, // $ExpectType number

View File

@ -13,6 +13,7 @@
"no-mergeable-namespace": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-var-keyword": false,
@ -27,4 +28,4 @@
"trim-file": false,
"unified-signatures": false
}
}
}