-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(connector): send valid sdk information in authentication flow netcetera #4474
Conversation
crates/router/src/connector/utils.rs
Outdated
@@ -1228,6 +1233,7 @@ pub trait AddressDetailsData { | |||
fn get_country(&self) -> Result<&api_models::enums::CountryAlpha2, Error>; | |||
fn get_combined_address_line(&self) -> Result<Secret<String>, Error>; | |||
fn to_state_code(&self) -> Result<Secret<String>, Error>; | |||
fn to_state_code_option(&self) -> Result<Option<Secret<String>>, Error>; |
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.
fn to_state_code_option(&self) -> Result<Option<Secret<String>>, Error>; | |
fn to_state_code_as_optional(&self) -> Result<Option<Secret<String>>, Error>; |
crates/router/src/connector/utils.rs
Outdated
@@ -1186,6 +1186,7 @@ pub trait PhoneDetailsData { | |||
fn get_country_code(&self) -> Result<String, Error>; | |||
fn get_number_with_country_code(&self) -> Result<Secret<String>, Error>; | |||
fn get_number_with_hash_country_code(&self) -> Result<Secret<String>, Error>; | |||
fn get_country_code_without_plus(&self) -> Result<String, Error>; |
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.
Please find a better naming than without_plus
home_phone: billing_address | ||
.phone | ||
.clone() | ||
.map(TryInto::try_into) |
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.
Rather define the try_from
here so code navigation is easy
mobile_phone: billing_address | ||
.phone | ||
.clone() | ||
.map(TryInto::try_into) |
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.
Rather define the try_from
here so code navigation is easy
work_phone: billing_address | ||
.phone | ||
.clone() | ||
.map(TryInto::try_into) |
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.
Rather define the try_from
here so code navigation is easy
crates/router/src/connector/utils.rs
Outdated
fn to_state_code_option(&self) -> Result<Option<Secret<String>>, Error> { | ||
self.state | ||
.as_ref() | ||
.map(|_| self.to_state_code()) | ||
.transpose() | ||
} |
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.
Don't return a result, do a map_err
and return None
in case of error.
Return Option<<Secret> and then update wherever you are using transpose().transpose()?
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.
Unfortunately we cannot return None if Err occurs. to_state_code() will return Err when state
is an invalid string. We cannot ignore this Err.
@@ -716,11 +721,24 @@ impl | |||
bill_addr_state: billing_address | |||
.address | |||
.as_ref() | |||
.and_then(|add| add.state.clone()), | |||
.and_then(|add| add.to_state_code_as_optional().transpose()) |
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.
We need not call to_state_code_as_optional
here if it's already sent as state code, we should check and call this fn only if required (as state
in our request is a String and any value can be sent there)
api_models::payments::DeviceChannel::App => { | ||
Some(netcetera_types::DeviceRenderingOptionsSupported { | ||
// hard-coded until core provides these values. | ||
sdk_interface: netcetera_types::SdkInterface::Both, |
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.
This should always be Native
for us
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.
As per netcetera we are supposed to send this value.
Type of Change
Description
Two required params in SDK information were not serde renamed properly. This was causing SDK based authentication call to fail. Fixed it.
Other changes:
error_message
column inauthentication
table toTEXT
fromVARCHAR(64)
. Because when length of error_message was greater than 64 chars, update operation was failing.+
prefixAdditional Changes
Motivation and Context
How did you test it?
Manual
Checklist
cargo +nightly fmt --all
cargo clippy