Skip to content

Commit 1be7f29

Browse files
committed
Release braintree-web 3.129.0 source
1 parent 6333679 commit 1be7f29

File tree

7 files changed

+127
-12
lines changed

7 files changed

+127
-12
lines changed

.husky/pre-commit

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44
FILES=$(git diff --name-only --cached --diff-filter=ACM | grep -E '(js|jsx)$' | grep -Ev '^(tasks\/|test\/)' || true)
55

66
if [ ! -z "$FILES" ]; then
7-
for file in $FILES; do
8-
if ! npx eslint "$file"; then
9-
echo "ESLint failed on staged file '$file'. Please fix the errors and try again."
10-
exit 1
11-
fi
12-
done
7+
echo "$FILES" | xargs ./node_modules/.bin/eslint --cache
138

14-
# Prettify all selected files
159
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --cache --check
1610
else
1711
echo -e "\033[1;31m You have no staged javascript files, skipping checks .. \033[0m"

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
## 3.129.0 (2025-09-04)
4+
5+
- PayPalCheckout
6+
- Change the URL of `teBraintree` environment to `www.braintree.stage.paypal.com`
7+
- PayPal Checkout
8+
- Improve observability for App Switch flow
9+
310
## 3.128.0 (2025-08-28)
411

512
- Hosted Fields

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "braintree-web",
3-
"version": "3.128.0",
3+
"version": "3.129.0",
44
"license": "MIT",
55
"main": "src/index.js",
66
"private": true,

src/paypal-checkout/paypal-checkout.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,12 @@ PayPalCheckout.prototype._attachPreloadPixel = function (options) {
15801580
}
15811581
if (options.merchantId) {
15821582
preloadOptions["merchant-id"] = options.merchantId;
1583+
} else if (
1584+
this._configuration &&
1585+
this._configuration.gatewayConfiguration.merchantId
1586+
) {
1587+
preloadOptions["merchant-id"] =
1588+
this._configuration.gatewayConfiguration.merchantId;
15831589
}
15841590

15851591
request = new XMLHttpRequest();
@@ -1612,6 +1618,13 @@ PayPalCheckout.prototype._formatPaymentResourceData = function (
16121618
},
16131619
shippingOptions: options.shippingOptions,
16141620
payer_email: options.userAuthenticationEmail, // eslint-disable-line camelcase
1621+
source: constants.BT_SOURCE,
1622+
merchant: gatewayConfiguration.merchantId,
1623+
1624+
flowType:
1625+
options.flow === "vault"
1626+
? constants.BT_FLOW_TYPES.VAULT
1627+
: constants.BT_FLOW_TYPES.EXPRESS_CHECKOUT,
16151628
};
16161629

16171630
if (options.hasOwnProperty("returnUrl")) {

src/paypal/shared/constants.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ module.exports = {
1010
ENVIRONMENT: {
1111
stage: "https://www.msmaster.qa.paypal.com/sdk/js?",
1212
sandbox: "https://www.sandbox.paypal.com/sdk/js?",
13-
teBraintree: "https://www.te-braintree.qa.paypal.com/sdk/js?",
13+
teBraintree: "https://www.braintree.stage.paypal.com/sdk/js?",
14+
},
15+
BT_SOURCE: "bsdk",
16+
BT_FLOW_TYPES: {
17+
VAULT: "va",
18+
EXPRESS_CHECKOUT: "ecs",
1419
},
1520
};

test/paypal-checkout/unit/paypal-checkout.js

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const frameService = require("../../../src/lib/frame-service/external");
1212
const { fake, yieldsAsync } = require("../../helpers");
1313
const methods = require("../../../src/lib/methods");
1414
const errors = require("../../../src/paypal-checkout/errors");
15+
const constants = require("../../../src/paypal/shared/constants");
1516

1617
describe("PayPalCheckout", () => {
1718
let testContext;
@@ -3268,7 +3269,7 @@ describe("PayPalCheckout", () => {
32683269
firstHeadElement
32693270
);
32703271
expect(fakeScript.src).toMatch(
3271-
"https://www.te-braintree.qa.paypal.com/sdk/js?"
3272+
"https://www.braintree.stage.paypal.com/sdk/js?"
32723273
);
32733274
});
32743275
});
@@ -3845,6 +3846,7 @@ describe("PayPalCheckout", () => {
38453846
testContext.configuration = {
38463847
authorization: "development_testing_altpay_merchant",
38473848
gatewayConfiguration: {
3849+
merchantId: "merchant-id",
38483850
paypal: {
38493851
assetsUrl: "https://paypal.assets.url",
38503852
displayName: "my brand",
@@ -3946,6 +3948,100 @@ describe("PayPalCheckout", () => {
39463948
expect(actual.cancelUrl).toBe("www.example.com/cancel");
39473949
});
39483950

3951+
it("includes BT source parameter with value 'bsdk'", () => {
3952+
const options = {
3953+
flow: "checkout",
3954+
};
3955+
3956+
const actual = PayPalCheckout.prototype._formatPaymentResourceData.call(
3957+
{
3958+
_configuration: testContext.configuration,
3959+
_formatPaymentResourceCheckoutData: jest.fn(),
3960+
_formatPaymentResourceVaultData: jest.fn(),
3961+
},
3962+
options,
3963+
testContext.config
3964+
);
3965+
3966+
expect(actual.source).toBe(constants.BT_SOURCE);
3967+
});
3968+
3969+
it("includes BT merchant parameter from gateway configuration", () => {
3970+
const options = {
3971+
flow: "checkout",
3972+
};
3973+
3974+
const actual = PayPalCheckout.prototype._formatPaymentResourceData.call(
3975+
{
3976+
_configuration: testContext.configuration,
3977+
_merchantAccountId: "DEFAULT_MERCHANT_ID",
3978+
_formatPaymentResourceCheckoutData: jest.fn(),
3979+
_formatPaymentResourceVaultData: jest.fn(),
3980+
},
3981+
options,
3982+
testContext.config
3983+
);
3984+
3985+
expect(actual.merchant).toBe("merchant-id");
3986+
});
3987+
3988+
it("includes BT flowType parameter as 'ecs' for checkout flow", () => {
3989+
const options = {
3990+
flow: "checkout",
3991+
};
3992+
3993+
const actual = PayPalCheckout.prototype._formatPaymentResourceData.call(
3994+
{
3995+
_configuration: testContext.configuration,
3996+
_formatPaymentResourceCheckoutData: jest.fn(),
3997+
_formatPaymentResourceVaultData: jest.fn(),
3998+
},
3999+
options,
4000+
testContext.config
4001+
);
4002+
4003+
expect(actual.flowType).toBe(constants.BT_FLOW_TYPES.EXPRESS_CHECKOUT);
4004+
});
4005+
4006+
it("includes BT flowType parameter as 'va' for vault flow", () => {
4007+
const options = {
4008+
flow: "vault",
4009+
};
4010+
4011+
const actual = PayPalCheckout.prototype._formatPaymentResourceData.call(
4012+
{
4013+
_configuration: testContext.configuration,
4014+
_formatPaymentResourceCheckoutData: jest.fn(),
4015+
_formatPaymentResourceVaultData: jest.fn(),
4016+
},
4017+
options,
4018+
testContext.config
4019+
);
4020+
4021+
expect(actual.flowType).toBe(constants.BT_FLOW_TYPES.VAULT);
4022+
});
4023+
4024+
it("includes all BT parameters together", () => {
4025+
const options = {
4026+
flow: "checkout",
4027+
};
4028+
4029+
const actual = PayPalCheckout.prototype._formatPaymentResourceData.call(
4030+
{
4031+
_configuration: testContext.configuration,
4032+
_merchantAccountId: "DEFAULT_MERCHANT_ID",
4033+
_formatPaymentResourceCheckoutData: jest.fn(),
4034+
_formatPaymentResourceVaultData: jest.fn(),
4035+
},
4036+
options,
4037+
testContext.config
4038+
);
4039+
4040+
expect(actual.source).toBe(constants.BT_SOURCE);
4041+
expect(actual.merchant).toBe("merchant-id");
4042+
expect(actual.flowType).toBe(constants.BT_FLOW_TYPES.EXPRESS_CHECKOUT);
4043+
});
4044+
39494045
it("passes along appSwitchPreference when passed", () => {
39504046
const options = {
39514047
appSwitchPreference: {

0 commit comments

Comments
 (0)