How does the Magento_BraintreeTwo module handle the list of accepted bank card types?

Interface

1. Default bank cards list

«Stores» → «Configuration» → «Sales» → «Payment Methods» → «BraintreeTwo» → «Advanced Braintree Settings» → «Credit Card Types»:

2. Country Specific Credit Card Types

The list of shown and available to a particular customer bank card types is calculated as a intersection of the default bank cards list and the country specific bank card list:

The collectTypes() method from the Magento_BraintreeTwo's validator.js can be simplified from 8 lines to 1

Implementation




How to get the system-wide list of bank card types?




How does a payment method pass its configuration to the client side (JavaScript)?




See also: