Refactor CreditCard.SUPPORTED_NETWORKS to be an array of objects
Categories
(Toolkit :: Form Autofill, task, P3)
Tracking
()
People
(Reporter: tgiles, Unassigned)
References
(Blocks 1 open bug)
Details
Currently CreditCard.SUPPORTED_NETWORKS is an array of strings which we use to derive credit card logos, other aliases for particular network names. Instead of SUPPORTED_NETWORKS
being an array of strings, we should convert it to an array of objects. For example:
[
{
"names": ["amex", "AmericanExpress"], logo: "chrome://formautofill/content/third-party/cc-logo-amex.svg"
},
{
"names": ["mastercard", "master card"], logo: "chrome://formautofill/content/third-party/cc-logo-mastercard.svg"
},
...
]
This would allow use to remove some helper functions and simplify some operations when dealing with SUPPORTED_NETWORKS
, which should also simplify some testing scenarios involving this code.
Comment 1•3 years ago
|
||
We can possibly remove NETWORK_NAMES
as well, if we specify alternative names in SUPPORTED_NETWORKS.
Comment 2•3 years ago
|
||
We can create UnknownNetwork
object, that will be used if we fail to detect network. That way we can avoid having null
or undefined
and always expect a working object.
Comment 3•3 years ago
|
||
We can create a function getCreditCardNetwork(some_args_describing_what_we_know)
that will return proper cc-network object. So we won't need to expose array outside of module.
Updated•3 years ago
|
Description
•