fix(framework): Store Card Network In DB For Network Token Passthrough Request#13077
Open
Anurag-05-prog wants to merge 1 commit into
Open
fix(framework): Store Card Network In DB For Network Token Passthrough Request#13077Anurag-05-prog wants to merge 1 commit into
Anurag-05-prog wants to merge 1 commit into
Conversation
Changed Files
|
|
💡 Consider using Option flattening for cleaner card network extraction The current implementation uses nested .and_then(|obj| {
obj.get("card")
.and_then(|card| card.as_object())
.and_then(|card_data| card_data.get("card_network"))
.or_else(|| {
obj.get("network_token")
.and_then(|nt| nt.as_object())
.and_then(|nt_data| nt_data.get("card_network"))
})
})This is a minor style suggestion - the current code is functionally correct. |
|
💡 Nested JSON access pattern could be more robust In fn extract_card_network_from_payment_method_data(
obj: &serde_json::Map<String, Value>
) -> Option<String> {
["card", "network_token"]
.iter()
.find_map(|key| {
obj.get(key)
.and_then(|v| v.as_object())
.and_then(|data| data.get("card_network"))
.and_then(|v| v.as_str())
.map(String::from)
})
}This reduces duplication and makes the intent clearer. Same pattern applies to both locations (~lines 2915 and ~lines 3178). |
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.
Type of Change
Description
Storing card network in DB for network token passthrough request
Additional Changes
Motivation and Context
How did you test it?
Checklist
cargo +nightly fmt --allcargo clippy