fix(compatibility): map stripe country_code to payment_request country code (#667)

This commit is contained in:
Abhishek
2023-02-27 16:42:36 +05:30
committed by GitHub
parent a2616d87b1
commit 7044b80b33

View File

@ -24,11 +24,12 @@ pub struct StripeBillingDetails {
impl From<StripeBillingDetails> for payments::Address { impl From<StripeBillingDetails> for payments::Address {
fn from(details: StripeBillingDetails) -> Self { fn from(details: StripeBillingDetails) -> Self {
Self { Self {
address: details.address,
phone: Some(payments::PhoneDetails { phone: Some(payments::PhoneDetails {
number: details.phone, number: details.phone,
country_code: None, country_code: details.address.as_ref().and_then(|a| a.country.clone()),
}), }),
address: details.address,
} }
} }
} }
@ -104,11 +105,11 @@ pub struct Shipping {
impl From<Shipping> for payments::Address { impl From<Shipping> for payments::Address {
fn from(details: Shipping) -> Self { fn from(details: Shipping) -> Self {
Self { Self {
address: details.address,
phone: Some(payments::PhoneDetails { phone: Some(payments::PhoneDetails {
number: details.phone, number: details.phone,
country_code: None, country_code: details.address.as_ref().and_then(|a| a.country.clone()),
}), }),
address: details.address,
} }
} }
} }