Skip to content

Commit

Permalink
fix: persist card network for non co-badged cards
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakilmostak committed Oct 3, 2024
1 parent 7a8ce3b commit d3f1688
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,18 +1150,6 @@ impl Card {
&self,
additional_card_info: AdditionalCardInfo,
) -> Result<Self, error_stack::Report<ValidationError>> {
let card_network = self
.card_network
.clone()
.or(additional_card_info.card_network.clone())
.map(|network| match self.card_number.is_cobadged_card() {
Ok(true) => Ok(Some(network)),
Ok(false) => Ok(None),
Err(e) => Err(e),
})
.transpose()?
.flatten();

Ok(Self {
card_number: self.card_number.clone(),
card_exp_month: self.card_exp_month.clone(),
Expand All @@ -1172,7 +1160,10 @@ impl Card {
.card_issuer
.clone()
.or(additional_card_info.card_issuer),
card_network,
card_network: self
.card_network
.clone()
.or(additional_card_info.card_network.clone()),
card_type: self.card_type.clone().or(additional_card_info.card_type),
card_issuing_country: self
.card_issuing_country
Expand Down

0 comments on commit d3f1688

Please # to comment.