Skip to content

Commit

Permalink
Release braintree-web 3.99.2 source
Browse files Browse the repository at this point in the history
Co-authored-by: Joe Plukarski <jplukarski@paypal.com>
  • Loading branch information
braintreeps committed Jan 26, 2024
1 parent a6b3268 commit 288ea4f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 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.99.2

- Venmo
- Fix race condition in previous bug fix.

# 3.99.1

- Venmo
Expand Down
2 changes: 1 addition & 1 deletion 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.99.1",
"version": "3.99.2",
"license": "MIT",
"main": "src/index.js",
"private": true,
Expand Down
33 changes: 17 additions & 16 deletions src/venmo/shared/web-login-backdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,26 @@ function openPopup(options) {
extendedPromise.resolve(data);
})
.catch(function (statusCheckError) {
extendedPromise.reject(statusCheckError);
// We add this check here because at this point
// the status should not be in CREATED status.
// However, there is an edge case where if a buyer
// cancels in the popup, the popup might close itself
// before it can send the graphQL mutation to update its status.
// In these cases, the status will be stuck in CREATED status, and
// tokenization would fail, incorrectly throwing a tokenization error
// instead of informing the merchant that the customer canceled.
checkPaymentContextStatus().then(function (node) {
if (node.status === "CREATED") {
extendedPromise.reject(
new BraintreeError(errors.VENMO_CUSTOMER_CANCELED)
);
} else {
extendedPromise.reject(statusCheckError);
}
});
});
}

// We add this check here because at this point
// the status should not be in CREATED status.
// However, there is an edge case where if a buyer
// cancels in the popup, the popup might close itself
// before it can send the graphQL mutation to update its status.
// In these cases, the status will be stuck in CREATED status, and
// tokenization would fail, incorrectly throwing a tokenization error
// instead of informing the merchant that the customer canceled.
checkPaymentContextStatus().then(function (status) {
if (status === "CREATED") {
extendedPromise.reject(
new BraintreeError(errors.VENMO_CUSTOMER_CANCELED)
);
}
});
frameServiceInstance.close();
closeBackdrop();
});
Expand Down
1 change: 1 addition & 0 deletions test/venmo/unit/web-login-backdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ describe("web-login-backdrop", () => {
const expectedRejectedValue = "some err";

mockStatusCheck.mockRejectedValue(expectedRejectedValue);
mockPaymentContextStatus.mockResolvedValue({ status: "FAILED" });

await openPopup(openOptions).catch((err) => {
expect(err).toBe(expectedRejectedValue);
Expand Down

0 comments on commit 288ea4f

Please sign in to comment.