-
Notifications
You must be signed in to change notification settings - Fork 167
Add idv_resolution_default_vendor config #11515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,8 +24,36 @@ def call( | |
| end | ||
|
|
||
| def proofer | ||
| @proofer ||= | ||
| if IdentityConfig.store.proofer_mock_fallback | ||
| @proofer ||= begin | ||
| # Historically, proofer_mock_fallback has controlled whether we | ||
| # use mock implementations of the Resolution and Address proofers | ||
| # (true = use mock, false = don't use mock). | ||
| # We are transitioning to a place where we will have separate | ||
| # configs for both. For the time being, we want to keep support for | ||
| # proofer_mock_fallback here. This can be removed after this code | ||
| # has been deployed and configs have been updated in all relevant | ||
| # environments. | ||
|
|
||
| old_config_says_mock = IdentityConfig.store.proofer_mock_fallback | ||
| old_config_says_iv = !old_config_says_mock | ||
| new_config_says_mock = | ||
| IdentityConfig.store.idv_resolution_default_vendor == :mock | ||
| new_config_says_iv = | ||
| IdentityConfig.store.idv_resolution_default_vendor == :instant_verify | ||
|
|
||
| proofer_type = | ||
| if new_config_says_mock && old_config_says_iv | ||
| # This will be the case immediately after deployment, when | ||
| # environment configs have not been updated. We need to | ||
| # fall back to the old config here. | ||
| :instant_verify | ||
| elsif new_config_says_iv | ||
| :instant_verify | ||
| else | ||
| :mock | ||
| end | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a fan of really expressive code like this for this sort of thing. I think customarily we'd argue that |
||
|
|
||
| if proofer_type == :mock | ||
|
Comment on lines
+27
to
+56
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that these blocks (and the added specs) are identical for the two plugins--the intention is that this is temporary code (cleanup PR coming), soon to be further streamlined in another PR. |
||
| Proofing::Mock::ResolutionMockClient.new | ||
| else | ||
| Proofing::LexisNexis::InstantVerify::Proofer.new( | ||
|
|
@@ -39,6 +67,7 @@ def proofer | |
| request_mode: IdentityConfig.store.lexisnexis_request_mode, | ||
| ) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| def residential_address_unnecessary_result | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,6 +176,11 @@ def self.store | |
| config.add(:idv_contact_phone_number, type: :string) | ||
| config.add(:idv_max_attempts, type: :integer) | ||
| config.add(:idv_min_age_years, type: :integer) | ||
| config.add( | ||
| :idv_resolution_default_vendor, | ||
| type: :symbol, | ||
| enum: [:instant_verify, :mock], | ||
| ) | ||
|
Comment on lines
+179
to
+183
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This, it turns out, is a much better thing to do than raise errors in application code if the setting is misconfigured |
||
| config.add(:idv_send_link_attempt_window_in_minutes, type: :integer) | ||
| config.add(:idv_send_link_max_attempts, type: :integer) | ||
| config.add(:idv_socure_reason_code_download_enabled, type: :boolean) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor: the examples in the tests say "the new setting takes precedence," but here the comment says we "fall back to the old config" which suggests it's the other way around. They're not discussing the same thing and the behavior is actually consistent, but if you see an easy way to make the wording consistent, it might further prevent confusion for anyone looking at this first thing in the morning while under-caffeinated. (Hypothetically speaking.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a case of bad spec name. I changed it to
creates an Instant Verify proofer because the new setting takes precedence over the old one when the old one is set to its default value. The idea is that, when proofer_mock_fallback is false, that is an indication that it has (probably) not been actively configured. If the new setting is set to a non-default value, we should use that instead.