Skip to content

Commit

Permalink
fix: remove error propagation if card name not found in locker in cas…
Browse files Browse the repository at this point in the history
…e of temporary token (#3006)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
Chethan-rao and hyperswitch-bot[bot] authored Nov 29, 2023
1 parent bb593ab commit 5c32b37
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions crates/router/src/core/payments/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1381,18 +1381,19 @@ pub async fn retrieve_payment_method_with_temporary_token(

let name_on_card = if card.card_holder_name.clone().expose().is_empty() {
card_token_data
.and_then(|token_data| {
.and_then(|token_data| token_data.card_holder_name.clone())
.filter(|name_on_card| !name_on_card.clone().expose().is_empty())
.map(|name_on_card| {
is_card_updated = true;
token_data.card_holder_name.clone()
name_on_card
})
.filter(|name_on_card| !name_on_card.clone().expose().is_empty())
.ok_or(errors::ApiErrorResponse::MissingRequiredField {
field_name: "card_holder_name",
})?
} else {
card.card_holder_name.clone()
Some(card.card_holder_name.clone())
};
updated_card.card_holder_name = name_on_card;

if let Some(name_on_card) = name_on_card {
updated_card.card_holder_name = name_on_card;
}

if let Some(cvc) = card_cvc {
is_card_updated = true;
Expand Down

0 comments on commit 5c32b37

Please sign in to comment.