braintree-web-drop-in icon indicating copy to clipboard operation
braintree-web-drop-in copied to clipboard

Add ability to expand "other ways to pay" menu

Open crookedneighbor opened this issue 5 years ago • 2 comments

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

crookedneighbor avatar Feb 25 '19 15:02 crookedneighbor

expand

crookedneighbor avatar Feb 25 '19 15:02 crookedneighbor

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.

crackedeggs1 avatar Feb 25 '21 01:02 crackedeggs1

📕 (I trust y'all to handle this when you get to it) 📕

crookedneighbor avatar Apr 27 '23 02:04 crookedneighbor