Conversation
The Braintree manager, payment clients and the five provider handlers (credit card, PayPal, Venmo, Apple Pay, Google Pay) land under src/elements/ia-donation-form/braintree/, with the recaptcha manager, the Venmo session restoration handler and DonationFormError alongside. No custom elements in this rung. The flow handlers go with the modals next. The vendored 2020 braintree-web and paypal-checkout-components d.ts files are replaced by the real @types packages, which split the library module (typeof braintree.client) from the instance (braintree.Client), so the clients and handlers are typed that way. The fee_amount_covered custom field is calculated from the fields like the total already was, since donationInfo can arrive as a plain object. The hosted fields retry no longer uses an async promise executor and clears its timer whichever way the race goes. The recaptcha onload callback global is namespaced so it can't collide with the old package's on a page that loads both. Tests move from web-test-runner and sinon to Vitest, with the payment library mocks under test-helpers/. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QnX6VHo3EJRzcKfhzBChCf
jbuckner
added this pull request to stack #101
September 15, 2026 05:05
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## WEBDEV-9052-migrate-edit-donation #103 +/- ##
=====================================================================
+ Coverage 86.83% 87.86% +1.02%
=====================================================================
Files 78 100 +22
Lines 2530 3114 +584
Branches 548 611 +63
=====================================================================
+ Hits 2197 2736 +539
- Misses 178 212 +34
- Partials 155 166 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WEBDEV-9053. Stacked on #100. Fourth of the five in WEBDEV-8602.
The payment layer of
donation-form: the Braintree manager, payment clients, the five provider handlers (credit card, PayPal, Venmo, Apple Pay, Google Pay), the recaptcha manager and the Venmo session restoration handler. It lands undersrc/elements/ia-donation-form/braintree/. No custom elements in this one, so no story, it's the logic and its tests. The flow handlers go with the modals in the last rung since they render them.What changed beyond the move:
@typesinstead of the vendored 2020 copies.@types/braintree-web3.143 splits the library module (typeof braintree.client, the thing withcreate()) from the instance (braintree.Client), where the old copy conflated them.PaymentClientsInterfaceand the handlers are typed that way now, and everything imports the types (import type * as braintree from 'braintree-web') rather than leaning on the UMD global. Aglobals.d.tstypeswindow.braintreeandwindow.paypal, which the CDN scripts create. The@typespackages are regular dependencies because the published d.ts files reference them.fee_amount_coveredis calculated from the fields.submitDonationalready recomputed the total becausedonationInfocan arrive as a plain object (Venmo in Chrome) with none of the class getters. The fee custom field read thefeeAmountCoveredgetter and would have beenundefinedin that case. Both are calculated the same way now, with a test using a plain object.finallyso a lost race can't leave a rejection with nowhere to go. Same behavior: our own timer races Braintree's create, a timer win retries, up to the max.iaDonationFormGrecaptchaLoaded). The old package usesdonationFormGrecaptchaLoadedCallback, and a page loading both during the switch-over would have had them overwrite each other's callback and hang one form's recaptcha.HostedFieldContainerdoesn't importBadgedInput. It only ever set.erroron the parent, so it types the parent as an element with anerrorflag. The badged input element itself arrives with the form elements.as constobjects plus a type, as in the earlier rungs.Tests moved from web-test-runner and sinon to Vitest, 85 of them. The mocks for the payment libraries live in
braintree/test-helpers/*.test-helpers.ts, which the package's!dist/**/*.test*filter keeps out of the published tarball. The Apple Pay session mock now definesSTATUS_SUCCESSandSTATUS_FAILURE, which the old one didn't, so those assertions comparedundefinedtoundefinedand passed regardless.Verified locally: build, full suite 791 passing, eslint and prettier clean, no circular dependencies.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QnX6VHo3EJRzcKfhzBChCf