braintree-web-drop-in
braintree-web-drop-in copied to clipboard
Add ability to expand "other ways to pay" menu
Summary
Provides an option to auto-expand other ways to pay menu when using a client token with a customer id. This allows the full range of payment options that are available to be used in Drop-in to be shown, instead of just the saved ones.
Checklist
- [x] Added a changelog entry
dropin.js _setUpDependenciesAndViews needs to create this._mainView before the setup of dataCollector and 3dsecure, or asyncDependenciesReady can fire before this._mainView exists, which causes the expandPaymentOptions call there to fail against an undefined object.
This reveals a deeper problem that the individual setups of dataCollector and 3dsecure may finish before the other one queues, which can lead to asyncDependenciesReady firing while one is about to enter the queue. These should be changed so that the initialization is returned as a callback from the individual _setup functions and handled by a finalization step of _setUpDependenciesAndViews. This could explain the random failures of dropin to initialize that I have experienced in the past.
There is one other asyncDependency here that I have found that misses the timing for the event or causes it to be missed, because I'm not sure yet how to pass the result out to _setupDependenciesAndViews. That's the card-view, which starts async for hostedfields. If I can come up with a solution I'll do a pull request.
📕 (I trust y'all to handle this when you get to it) 📕