VGS - Add support for valid card brands#370
Merged
Merged
Conversation
StoneMoney
requested review from
MichaelT372 and
fernanDOTdo
and removed request for
MichaelT372
January 14, 2026 23:39
fernanDOTdo
approved these changes
Jan 17, 2026
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.
From: https://app.productive.io/2650-4site-interactive-studios-inc/tasks/15072056
This implements support in the VGS module to allow a client theme to specify supported card brands. By default, all brands are supported (with a value of null, rather than an exhaustive list). Because of this, I have made a special exception to the deepMerge, as deep merging with the defaultOptions having value of null or undefined would result in a failed merge, defaultOptions having all available card types would result in all available card types working regardless of client theme specification, and defaultOptions having a value of an empty array would require all client themes be updated to specify what card types are needed. This was my best approach to maximizing compatibility.
Test page: https://protect.worldwildlife.org/page/69817/donate/1?assets=deny-diner-jcb&debug=log
Testing steps:
Attempting any card only requires inputting the value into the credit card field, no other fields are needed to be filled to test validation.
4242424242424242, no error should occur for the credit card field when hitting submit.3056930009020004, a "Credit Card number is invalid" error should occur6200000000000005, no error should occur3566002020360505, a "Credit Card number is invalid" error should occurFurther testing could include pulling the
deny-diner-jcbbranch, and thisvgs-card-brandsbranch together locally and modifying the options inindex.ts:91such asJust remember to update the url such that
assets=localThe list of available brand codes is here: https://docs.verygoodsecurity.com/vault/developer-tools/vgs-collect/js/customization#card-brand-identification