enhance(core): replace string with enum for country (#735)

This commit is contained in:
Narayan Bhat
2023-03-30 21:45:38 +05:30
committed by GitHub
parent 442bed0f6b
commit e18bfb2ae1
45 changed files with 734 additions and 649 deletions

View File

@ -27,7 +27,9 @@ impl From<StripeBillingDetails> for payments::Address {
Self {
phone: Some(payments::PhoneDetails {
number: details.phone,
country_code: details.address.as_ref().and_then(|a| a.country.clone()),
country_code: details.address.as_ref().and_then(|address| {
address.country.as_ref().map(|country| country.to_string())
}),
}),
address: details.address,
@ -109,7 +111,9 @@ impl From<Shipping> for payments::Address {
Self {
phone: Some(payments::PhoneDetails {
number: details.phone,
country_code: details.address.as_ref().and_then(|a| a.country.clone()),
country_code: details.address.as_ref().and_then(|address| {
address.country.as_ref().map(|country| country.to_string())
}),
}),
address: details.address,
}