Skip to content

Commit

Permalink
Add version 3.111.0
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Oct 23, 2024
1 parent af3f3a7 commit 258495b
Show file tree
Hide file tree
Showing 152 changed files with 122,144 additions and 67 deletions.
24 changes: 12 additions & 12 deletions 3.108.0/LocalPayment.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line31">line 31</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line32">line 32</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -346,7 +346,7 @@ <h4 class="name" id="closeWindow">
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line724">line 724</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line757">line 757</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -451,7 +451,7 @@ <h4 class="name" id="focusWindow">
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line741">line 741</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line774">line 774</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -556,7 +556,7 @@ <h4 class="name" id="hasTokenizationParams">
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line852">line 852</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line885">line 885</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -760,7 +760,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line403">line 403</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line408">line 408</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -1172,7 +1172,7 @@ <h5>Parameters:</h5>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line1072">line 1072</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line1115">line 1115</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -1505,7 +1505,7 @@ <h6>Properties</h6>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line637">line 637</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line670">line 670</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -1644,7 +1644,7 @@ <h5 class="subsection-title">Properties:</h5>


<td class="description last">
<p>Configuration for what to do when app switching back from a Bank app on a mobile device.</p>
<p>Configuration for what to do when app switching back from a Bank app on a mobile device. Only applicable to the popup flow.</p>

<h6>Properties</h6>

Expand Down Expand Up @@ -1823,7 +1823,7 @@ <h6>Properties</h6>


<td class="description last">
<p>The options for configuring the window that is opened when starting the payment.</p>
<p>The options for configuring the window that is opened when starting the payment. Only applicable to the popup flow.</p>

<h6>Properties</h6>

Expand Down Expand Up @@ -2708,7 +2708,7 @@ <h6>Properties</h6>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line76">line 76</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line81">line 81</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -3768,7 +3768,7 @@ <h6>Properties</h6>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line152">line 152</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line157">line 157</a>
</li>
</ul>
</dd>
Expand Down Expand Up @@ -5253,7 +5253,7 @@ <h6>Properties</h6>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line110">line 110</a>
<a href="local-payment_external_local-payment.js.html">local-payment/external/local-payment.js</a>, <a href="local-payment_external_local-payment.js.html#line115">line 115</a>
</li>
</ul>
</dd>
Expand Down
2 changes: 1 addition & 1 deletion 3.108.0/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h3>Classes</h3><ul><li id="AmericanExpress-nav"><a href="AmericanExpress.html">

<section class="readme">
<article>
<h1>Braintree Web Client Reference <span>v3.110.0</span></h1>
<h1>Braintree Web Client Reference <span>v3.111.0</span></h1>
<p><span class="rule"></span></p>
<ul>
<li><a href="#overview">Overview</a>
Expand Down
103 changes: 74 additions & 29 deletions 3.108.0/local-payment_external_local-payment.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ <h1 class="page-title">
var wrapPromise = require("@braintree/wrap-promise");
var constants = require("./constants");
var errors = require("../shared/errors");
var assign = require("../../lib/assign").assign;

var DEFAULT_WINDOW_WIDTH = 1282;
var DEFAULT_WINDOW_HEIGHT = 720;
Expand Down Expand Up @@ -146,6 +147,10 @@ <h1 class="page-title">
this._authorizationInProgress = false;
this._paymentType = "unknown";
this._merchantAccountId = options.merchantAccountId;
if (options.redirectUrl) {
this._redirectUrl = options.redirectUrl;
this._isRedirectFlow = true;
}
}

LocalPayment.prototype._initialize = function () {
Expand Down Expand Up @@ -179,12 +184,12 @@ <h1 class="page-title">
/**
* Options used for most local payment types.
* @typedef {object} LocalPayment~StartPaymentOptions
* @property {object} fallback Configuration for what to do when app switching back from a Bank app on a mobile device.
* @property {object} fallback Configuration for what to do when app switching back from a Bank app on a mobile device. Only applicable to the popup flow.
* @property {string} fallback.buttonText The text to display in a button to redirect back to the merchant page.
* @property {string} fallback.url The url to redirect to when the redirect button is pressed. Query params will be added to the url to process the data returned from the bank.
* @property {string} fallback.cancelButtonText The text to display in a button to redirect back to the merchant page when the customer cancels. If no `cancelButtonText` is provided, `buttonText` will be used.
* @property {string} fallback.cancelUrl The url to redirect to when the redirect button is pressed when the customer cancels. Query params will be added to the url to check the state of the payment. If no `cancelUrl` is provided, `url` will be used.
* @property {object} [windowOptions] The options for configuring the window that is opened when starting the payment.
* @property {object} [windowOptions] The options for configuring the window that is opened when starting the payment. Only applicable to the popup flow.
* @property {number} [windowOptions.width=1282] The width in pixels of the window opened when starting the payment. The default width size is this large to allow various banking partner landing pages to display the QR Code to be scanned by the bank's mobile app. Many will not display the QR code when the window size is smaller than a standard desktop screen.
* @property {number} [windowOptions.height=720] The height in pixels of the window opened when starting the payment.
* @property {string} amount The amount to authorize for the transaction.
Expand Down Expand Up @@ -512,10 +517,17 @@ <h1 class="page-title">
promise,
billingAddress,
windowOptions,
onPaymentStartPromise;
onPaymentStartPromise,
serviceId,
cancelUrl,
returnUrl;
var self = this; // eslint-disable-line no-invalid-this
var serviceId = this._frameService._serviceId; // eslint-disable-line no-invalid-this

if (self._isRedirectFlow) {
options.redirectUrl = self._redirectUrl;
} else {
serviceId = self._frameService._serviceId;
}
// In order to provide the merchant with appropriate error messaging,
// more robust validation is being done on the client-side, since some
// option names are mapped to legacy names for the sake of the API.
Expand Down Expand Up @@ -551,18 +563,6 @@ <h1 class="page-title">
},
birthDate: options.birthDate,
blikOptions: options.blikOptions,
cancelUrl: querystring.queryify(
self._assetsUrl +
"/html/local-payment-redirect-frame" +
useMin(self._isDebug) +
".html",
{
channel: serviceId,
r: fallback.cancelUrl || fallback.url,
t: fallback.cancelButtonText || fallback.buttonText,
c: 1, // indicating we went through the cancel flow
}
),
city: address.locality,
correlationId: options.correlationId,
countryCode: address.countryCode,
Expand All @@ -589,7 +589,29 @@ <h1 class="page-title">
phoneCountryCode: options.phoneCountryCode,
postalCode: address.postalCode,
recurrent: options.recurrent,
returnUrl: querystring.queryify(
shippingAmount: options.shippingAmount,
state: address.region,
};

if (self._isRedirectFlow) {
cancelUrl = querystring.queryify(self._redirectUrl, {
wasCanceled: true,
});
returnUrl = self._redirectUrl;
} else {
cancelUrl = querystring.queryify(
self._assetsUrl +
"/html/local-payment-redirect-frame" +
useMin(self._isDebug) +
".html",
{
channel: serviceId,
r: fallback.cancelUrl || fallback.url,
t: fallback.cancelButtonText || fallback.buttonText,
c: 1, // indicating we went through the cancel flow
}
);
returnUrl = querystring.queryify(
self._assetsUrl +
"/html/local-payment-redirect-frame" +
useMin(self._isDebug) +
Expand All @@ -599,13 +621,13 @@ <h1 class="page-title">
r: fallback.url,
t: fallback.buttonText,
}
),
shippingAmount: options.shippingAmount,
state: address.region,
};
);
}
assign(params, { cancelUrl: cancelUrl, returnUrl: returnUrl });

self._paymentType = options.paymentType.toLowerCase();
if (self._authorizationInProgress) {

if (self._authorizationInProgress &amp;&amp; !self._isRedirectFlow) {
analytics.sendEvent(
self._client,
self._paymentType + ".local-payment.start-payment.error.already-opened"
Expand All @@ -622,7 +644,7 @@ <h1 class="page-title">

// For deferred payment types, the popup window should not be opened,
// since the actual payment will be done outside of this session.
if (!isDeferredPaymentTypeOptions(options)) {
if (!isDeferredPaymentTypeOptions(options) &amp;&amp; !self._isRedirectFlow) {
self._startPaymentCallback = self._createStartPaymentCallback(
function (val) {
promise.resolve(val);
Expand Down Expand Up @@ -650,10 +672,17 @@ <h1 class="page-title">
.then(function (response) {
var redirectUrl = response.paymentResource.redirectUrl;

analytics.sendEvent(
self._client,
self._paymentType + ".local-payment.start-payment.opened"
);
if (self._isRedirectFlow) {
analytics.sendEvent(
self._client,
self._paymentType + ".local-payment.start-payment.redirected"
);
} else {
analytics.sendEvent(
self._client,
self._paymentType + ".local-payment.start-payment.opened"
);
}
self._startPaymentOptions = options;

if (isDeferredPaymentTypeOptions(options)) {
Expand All @@ -678,6 +707,8 @@ <h1 class="page-title">
promise.resolve();
}
}
} else if (self._isRedirectFlow) {
window.location.href = response.paymentResource.redirectUrl;
} else {
options.onPaymentStart(
{ paymentId: response.paymentResource.paymentToken },
Expand All @@ -690,7 +721,9 @@ <h1 class="page-title">
.catch(function (err) {
var status = err.details &amp;&amp; err.details.httpStatus;

self._frameService.close();
if (!self._isRedirectFlow) {
self._frameService.close();
}
self._authorizationInProgress = false;

if (status === 422) {
Expand Down Expand Up @@ -1039,6 +1072,12 @@ <h1 class="page-title">
var i, option, oneClick;
var blikOptions = options.blikOptions || {};

if (!options.redirectUrl) {
constants.REQUIRED_OPTIONS_FOR_BLIK_SEAMLESS_PAYMENT_TYPE.push(
"onPaymentStart"
);
}

for (
i = 0;
i &lt; constants.REQUIRED_OPTIONS_FOR_BLIK_SEAMLESS_PAYMENT_TYPE.length;
Expand Down Expand Up @@ -1138,6 +1177,10 @@ <h1 class="page-title">
return hasMissingBlikOptions(options);
}
} else {
if (!options.redirectUrl) {
constants.REQUIRED_OPTIONS_FOR_START_PAYMENT.push("onPaymentStart");
}

for (i = 0; i &lt; constants.REQUIRED_OPTIONS_FOR_START_PAYMENT.length; i++) {
option = constants.REQUIRED_OPTIONS_FOR_START_PAYMENT[i];

Expand Down Expand Up @@ -1175,7 +1218,9 @@ <h1 class="page-title">
LocalPayment.prototype.teardown = function () {
var self = this; // eslint-disable-line no-invalid-this

self._frameService.teardown();
if (!self._isRedirectFlow) {
self._frameService.teardown();
}

convertMethodsToError(self, methods(LocalPayment.prototype));

Expand Down
24 changes: 23 additions & 1 deletion 3.108.0/local-payment_index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ <h1 class="page-title">
var wrapPromise = require("@braintree/wrap-promise");
var BraintreeError = require("../lib/braintree-error");
var errors = require("./shared/errors");
var parse = require("../lib/querystring").parse;

/**
* @static
Expand All @@ -124,6 +125,7 @@ <h1 class="page-title">
* @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 {string} [options.merchantAccountId] A non-default merchant account ID to use for tokenization and creation of the authorizing transaction. Braintree strongly recommends specifying this parameter.
* @param {redirectUrl} When provided, triggers full page redirect flow instead of popup flow.
* @param {callback} callback The second argument, `data`, is the {@link LocalPayment} instance.
* @example &lt;caption>Using the local payment component to set up an iDEAL button&lt;/caption>
* var idealButton = document.querySelector('.ideal-button');
Expand Down Expand Up @@ -205,7 +207,7 @@ <h1 class="page-title">
});
})
.then(function (client) {
var localPaymentInstance;
var localPaymentInstance, params;
var config = client.getConfiguration();

options.client = client;
Expand All @@ -219,6 +221,26 @@ <h1 class="page-title">
analytics.sendEvent(client, "local-payment.initialized");

localPaymentInstance = new LocalPayment(options);
if (options.redirectUrl) {
params = parse(window.location.href);

if (params.token || params.wasCanceled) {
return localPaymentInstance
.tokenize(params)
.then(function (payload) {
localPaymentInstance.tokenizePayload = payload;

return localPaymentInstance;
})
.catch(function (err) {
console.log("Error while tokenizing: ", err);

return localPaymentInstance;
});
}

return localPaymentInstance;
}

return localPaymentInstance._initialize();
});
Expand Down
Loading

0 comments on commit 258495b

Please sign in to comment.