-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
refactor(core): Use hyperswitch_domain_models within the Payments Core instead of api_models #5511
Conversation
…juspay/hyperswitch into add-network-token-data-in-domain-models
let mut updated_card = card.clone(); | ||
let mut is_card_updated = false; | ||
|
||
// The card_holder_name from locker retrieved card is considered if it is a non-empty string or else card_holder_name is picked | ||
// from payment_method_data.card_token object | ||
let name_on_card = if let Some(name) = card.card_holder_name.clone() { | ||
let name_on_card = if let Some(name) = card.nick_name.clone() { | ||
//todo! |
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 needed?
@@ -1770,7 +1772,7 @@ pub async fn retrieve_payment_method_with_temporary_token( | |||
}) | |||
.or(Some(name)) | |||
} else { | |||
card.card_holder_name.clone() | |||
card.nick_name.clone() //todo! |
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.
can we add details about what has to be done
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.
LGTM for connector changes
@@ -2028,7 +2030,7 @@ pub async fn make_pm_data<'a, F: Clone, R>( | |||
} | |||
|
|||
// TODO: Handle case where payment method and token both are present in request properly. | |||
let (payment_method, pm_id) = match (request, payment_data.token_data.as_ref()) { |
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 don't think this clone is required? u can match on reference of request
itself
@@ -2059,7 +2061,7 @@ pub async fn make_pm_data<'a, F: Clone, R>( | |||
|
|||
(Some(_), _) => { | |||
let (payment_method_data, payment_token) = payment_methods::retrieve_payment_method( | |||
request, | |||
&request.map(Into::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.
You can just pass request
if u make this a reference above. No type conversion required as request type is already Option<domain::PaymentMethodData>
@@ -314,7 +314,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Co | |||
payment_method_data: request | |||
.payment_method_data | |||
.as_ref() | |||
.and_then(|pmd| pmd.payment_method_data.clone()), | |||
.and_then(|pmd| pmd.payment_method_data.clone().map(Into::into).clone()), |
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.
.and_then(|pmd| pmd.payment_method_data.clone().map(Into::into).clone()), | |
.and_then(|pmd| pmd.payment_method_data.clone().map(Into::into)), |
Clone not required
|
||
// payment_data.payment_attempt.clone(); | ||
|
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.
remove this
let business_sub_label = payment_data | ||
.payment_attempt | ||
.clone() | ||
.business_sub_label | ||
.clone(); |
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.
let business_sub_label = payment_data | |
.payment_attempt | |
.clone() | |
.business_sub_label | |
.clone(); | |
let business_sub_label = payment_data | |
.payment_attempt | |
.business_sub_label | |
.clone(); |
same here
.clone() | ||
.business_sub_label | ||
.clone(); | ||
let authentication_type = payment_data.payment_attempt.clone().authentication_type; |
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.
let authentication_type = payment_data.payment_attempt.clone().authentication_type; | |
let authentication_type = payment_data.payment_attempt.authentication_type.clone(); |
same here
.payment_attempt | ||
.clone() | ||
.payment_method_billing_address_id | ||
.clone(), |
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.
.payment_attempt | |
.clone() | |
.payment_method_billing_address_id | |
.clone(), | |
.payment_attempt | |
.payment_method_billing_address_id | |
.clone(), |
same here
.clone() | ||
.and_then(|payment_method_data_request| payment_method_data_request.payment_method_data) | ||
.async_and_then(|payment_method_data| async { |
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.
No need to clone entire payment_method_data of request. Instead take request.payment_method_data
as reference and clone payment_method_data_request.payment_method_data
inside and_then
use crate::types::{ | ||
api::{self}, | ||
domain::{self}, | ||
}; |
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.
use crate::types::{ | |
api::{self}, | |
domain::{self}, | |
}; | |
use crate::types::{ | |
api,domain | |
}; |
…juspay/hyperswitch into add-network-token-data-in-domain-models
…juspay/hyperswitch into add-network-token-data-in-domain-models
dca748d
…juspay/hyperswitch into add-network-token-data-in-domain-models
1f91849
Type of Change
Description
Additional Changes
Motivation and Context
How did you test it?
TestCases:-
Sanity testing for all the payments flows including save card flow and pm_auth flow.
stripe testing -
cybersource -
saved card payment -
Checklist
cargo +nightly fmt --all
cargo clippy