Skip to content

Commit

Permalink
Release braintree-web 3.109.0 source
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Sep 24, 2024
1 parent d14f5a2 commit ee0c13a
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 3.109.0

- PayPal Checkout
- Add `userAuthenticationEmail` to `createPayment` to enable MPE

## 3.108.0

- PayPal
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "braintree-web",
"version": "3.108.0",
"version": "3.109.0",
"license": "MIT",
"main": "src/index.js",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion scripts/release
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ release_source() {
local CP_CMD="cp"
if [[ "$(uname)"="Darwin" ]]; then
# Coreutils version of cp supports --parents, mac default one doesn't
CP_CMD="cp"
CP_CMD="gcp"
fi

git ls-files | egrep -v "$(join '|' $SOURCE_IGNORES)" | xargs "$CP_CMD" --parents -t "$BRAINTREE_JS_SOURCE_DEST"
Expand Down
4 changes: 3 additions & 1 deletion src/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ Client.initialize = function (options) {
);
}

promise = getGatewayConfiguration(authData, options.sessionId).then(function (configuration) {
promise = getGatewayConfiguration(authData, options.sessionId).then(function (
configuration
) {
if (options.debug) {
configuration.isDebug = true;
}
Expand Down
3 changes: 2 additions & 1 deletion src/paypal-checkout/paypal-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ PayPalCheckout.prototype._setupFrameService = function (client) {
*
* @param {string} [options.planType] Determines the charge pattern for the Recurring Billing Agreement. Can be 'RECURRING', 'SUBSCRIPTION', 'UNSCHEDULED', or 'INSTALLMENTS'.
* @param {planMetadata} [options.planMetadata] When plan type is defined, allows for {@link PayPalCheckout~planMetadata|plan metadata} to be set for the Billing Agreement.
*
* @param {string} [options.userAuthenticationEmail] Optional merchant-provided buyer email, used to streamline the sign-in process for both one-time checkout and vault flows.
* @param {callback} [callback] The second argument is a PayPal `paymentId` or `billingToken` string, depending on whether `options.flow` is `checkout` or `vault`. This is also what is resolved by the promise if no callback is provided.
* @example
* // this paypal object is created by the PayPal JS SDK
Expand Down Expand Up @@ -1433,6 +1433,7 @@ PayPalCheckout.prototype._formatPaymentResourceData = function (
landingPageType: options.landingPageType,
},
shippingOptions: options.shippingOptions,
payer_email: options.userAuthenticationEmail, // eslint-disable-line camelcase
};

if (options.flow === "checkout") {
Expand Down
60 changes: 60 additions & 0 deletions test/paypal-checkout/unit/paypal-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3342,4 +3342,64 @@ describe("PayPalCheckout", () => {
expect(testContext.fakeFrameService.teardown).toBeCalledTimes(0);
});
});

describe("_formatPaymentResourceData", () => {
beforeEach(() => {
testContext.configuration = {
authorization: "development_testing_altpay_merchant",
gatewayConfiguration: {
paypal: {
assetsUrl: "https://paypal.assets.url",
displayName: "my brand",
},
},
};
testContext.config = {};
});

it("passes along payer_email if flow is vault and userAuthenticationEmail is passed", () => {
const options = {
flow: "vault",
userAuthenticationEmail: "[email protected]",
};

const actual = PayPalCheckout.prototype._formatPaymentResourceData.call(
{ _configuration: testContext.configuration },
options,
testContext.config
);

expect(actual.payer_email).toBe("[email protected]");
});

it("passes along payer_email if flow is checkout and userAuthenticationEmail is passed", () => {
const options = {
flow: "checkout",
userAuthenticationEmail: "[email protected]",
};

const actual = PayPalCheckout.prototype._formatPaymentResourceData.call(
{ _configuration: testContext.configuration },
options,
testContext.config
);

expect(actual.payer_email).toBe("[email protected]");
});

it("doesn't pass along payer_email if userAuthenticationEmail isn't passed", () => {
const options = {
flow: "vault",
};

const actual = PayPalCheckout.prototype._formatPaymentResourceData.call(
{ _configuration: testContext.configuration },
options,
testContext.config
);

// eslint-disable-next-line no-undefined
expect(actual.payer_email).toBe(undefined);
});
});
});

0 comments on commit ee0c13a

Please sign in to comment.