mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
refactor: use CountryAlpha2 instead of CountryCode for country codes (#904)
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1157,7 +1157,7 @@ dependencies = [
|
|||||||
"masking",
|
"masking",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"time",
|
"time 0.3.20",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@ -254,7 +254,7 @@ pub enum RoutingAlgorithm {
|
|||||||
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct PrimaryBusinessDetails {
|
pub struct PrimaryBusinessDetails {
|
||||||
pub country: api_enums::CountryCode,
|
pub country: api_enums::CountryAlpha2,
|
||||||
pub business: String,
|
pub business: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,11 +385,11 @@ pub struct MerchantConnectorCreate {
|
|||||||
pub frm_configs: Option<FrmConfigs>,
|
pub frm_configs: Option<FrmConfigs>,
|
||||||
|
|
||||||
/// Business Country of the connector
|
/// Business Country of the connector
|
||||||
#[schema(example = "US")]
|
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||||
#[cfg(feature = "multiple_mca")]
|
#[cfg(feature = "multiple_mca")]
|
||||||
pub business_country: api_enums::CountryCode,
|
pub business_country: api_enums::CountryAlpha2,
|
||||||
#[cfg(not(feature = "multiple_mca"))]
|
#[cfg(not(feature = "multiple_mca"))]
|
||||||
pub business_country: Option<api_enums::CountryCode>,
|
pub business_country: Option<api_enums::CountryAlpha2>,
|
||||||
|
|
||||||
///Business Type of the merchant
|
///Business Type of the merchant
|
||||||
#[schema(example = "travel")]
|
#[schema(example = "travel")]
|
||||||
@ -466,8 +466,8 @@ pub struct MerchantConnectorResponse {
|
|||||||
pub metadata: Option<pii::SecretSerdeValue>,
|
pub metadata: Option<pii::SecretSerdeValue>,
|
||||||
|
|
||||||
/// Business Country of the connector
|
/// Business Country of the connector
|
||||||
#[schema(example = "US")]
|
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||||
pub business_country: api_enums::CountryCode,
|
pub business_country: api_enums::CountryAlpha2,
|
||||||
|
|
||||||
///Business Type of the merchant
|
///Business Type of the merchant
|
||||||
#[schema(example = "travel")]
|
#[schema(example = "travel")]
|
||||||
@ -603,8 +603,8 @@ pub enum AcceptedCurrencies {
|
|||||||
rename_all = "snake_case"
|
rename_all = "snake_case"
|
||||||
)]
|
)]
|
||||||
pub enum AcceptedCountries {
|
pub enum AcceptedCountries {
|
||||||
EnableOnly(Vec<api_enums::CountryCode>),
|
EnableOnly(Vec<api_enums::CountryAlpha2>),
|
||||||
DisableOnly(Vec<api_enums::CountryCode>),
|
DisableOnly(Vec<api_enums::CountryAlpha2>),
|
||||||
AllAccepted,
|
AllAccepted,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -283,8 +283,8 @@ pub struct PaymentMethodListRequest {
|
|||||||
pub client_secret: Option<String>,
|
pub client_secret: Option<String>,
|
||||||
|
|
||||||
/// The two-letter ISO currency code
|
/// The two-letter ISO currency code
|
||||||
#[schema(value_type = Option<Vec<Country>>, example = json!(["US", "UK", "IN"]))]
|
#[schema(value_type = Option<Vec<CountryAlpha2>>, example = json!(["US", "UK", "IN"]))]
|
||||||
pub accepted_countries: Option<Vec<api_enums::CountryCode>>,
|
pub accepted_countries: Option<Vec<api_enums::CountryAlpha2>>,
|
||||||
|
|
||||||
/// The three-letter ISO currency code
|
/// The three-letter ISO currency code
|
||||||
#[schema(value_type = Option<Vec<Currency>>,example = json!(["USD", "EUR"]))]
|
#[schema(value_type = Option<Vec<Currency>>,example = json!(["USD", "EUR"]))]
|
||||||
|
|||||||
@ -202,8 +202,8 @@ pub struct PaymentsRequest {
|
|||||||
pub payment_method_type: Option<api_enums::PaymentMethodType>,
|
pub payment_method_type: Option<api_enums::PaymentMethodType>,
|
||||||
|
|
||||||
/// Business country of the merchant for this payment
|
/// Business country of the merchant for this payment
|
||||||
#[schema(example = "US")]
|
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||||
pub business_country: Option<api_enums::CountryCode>,
|
pub business_country: Option<api_enums::CountryAlpha2>,
|
||||||
|
|
||||||
/// Business label of the merchant for this payment
|
/// Business label of the merchant for this payment
|
||||||
#[schema(example = "food")]
|
#[schema(example = "food")]
|
||||||
@ -439,8 +439,8 @@ pub enum PayLaterData {
|
|||||||
#[schema(value_type = String)]
|
#[schema(value_type = String)]
|
||||||
billing_email: Secret<String, pii::Email>,
|
billing_email: Secret<String, pii::Email>,
|
||||||
// The billing country code
|
// The billing country code
|
||||||
#[schema(value_type = Country)]
|
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||||
billing_country: api_enums::CountryCode,
|
billing_country: api_enums::CountryAlpha2,
|
||||||
},
|
},
|
||||||
/// For Klarna Sdk as PayLater Option
|
/// For Klarna Sdk as PayLater Option
|
||||||
KlarnaSdk {
|
KlarnaSdk {
|
||||||
@ -627,8 +627,8 @@ pub enum BankRedirectData {
|
|||||||
billing_details: BankRedirectBilling,
|
billing_details: BankRedirectBilling,
|
||||||
|
|
||||||
/// The country for bank payment
|
/// The country for bank payment
|
||||||
#[schema(value_type = Country, example = "US")]
|
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||||
country: api_enums::CountryCode,
|
country: api_enums::CountryAlpha2,
|
||||||
|
|
||||||
/// The preferred language
|
/// The preferred language
|
||||||
#[schema(example = "en")]
|
#[schema(example = "en")]
|
||||||
@ -645,7 +645,7 @@ pub struct CryptoData {}
|
|||||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||||
pub struct SofortBilling {
|
pub struct SofortBilling {
|
||||||
/// The country associated with the billing
|
/// The country associated with the billing
|
||||||
#[schema(example = "US")]
|
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||||
pub billing_country: String,
|
pub billing_country: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,8 +857,8 @@ pub struct AddressDetails {
|
|||||||
pub city: Option<String>,
|
pub city: Option<String>,
|
||||||
|
|
||||||
/// The two-letter ISO country code for the address
|
/// The two-letter ISO country code for the address
|
||||||
#[schema(value_type = Option<Country>, max_length = 2, min_length = 2, example = "US")]
|
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
|
||||||
pub country: Option<api_enums::CountryCode>,
|
pub country: Option<api_enums::CountryAlpha2>,
|
||||||
|
|
||||||
/// The first line of the address
|
/// The first line of the address
|
||||||
#[schema(value_type = Option<String>, max_length = 200, example = "123, King Street")]
|
#[schema(value_type = Option<String>, max_length = 200, example = "123, King Street")]
|
||||||
@ -1119,7 +1119,7 @@ pub struct PaymentsResponse {
|
|||||||
pub connector_label: Option<String>,
|
pub connector_label: Option<String>,
|
||||||
|
|
||||||
/// The business country of merchant for this payment
|
/// The business country of merchant for this payment
|
||||||
pub business_country: api_enums::CountryCode,
|
pub business_country: api_enums::CountryAlpha2,
|
||||||
|
|
||||||
/// The business label of merchant for this payment
|
/// The business label of merchant for this payment
|
||||||
pub business_label: String,
|
pub business_label: String,
|
||||||
@ -1449,8 +1449,8 @@ pub struct GpayAllowedPaymentMethods {
|
|||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||||
pub struct GpayTransactionInfo {
|
pub struct GpayTransactionInfo {
|
||||||
/// The country code
|
/// The country code
|
||||||
#[schema(value_type = Country)]
|
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||||
pub country_code: api_enums::CountryCode,
|
pub country_code: api_enums::CountryAlpha2,
|
||||||
/// The currency code
|
/// The currency code
|
||||||
pub currency_code: String,
|
pub currency_code: String,
|
||||||
/// The total price status (ex: 'FINAL')
|
/// The total price status (ex: 'FINAL')
|
||||||
@ -1597,8 +1597,8 @@ pub struct ApplePaySessionResponse {
|
|||||||
#[derive(Debug, Clone, serde::Serialize, ToSchema, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, ToSchema, serde::Deserialize)]
|
||||||
pub struct ApplePayPaymentRequest {
|
pub struct ApplePayPaymentRequest {
|
||||||
/// The code for country
|
/// The code for country
|
||||||
#[schema(value_type = Country)]
|
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||||
pub country_code: api_enums::CountryCode,
|
pub country_code: api_enums::CountryAlpha2,
|
||||||
/// The code for currency
|
/// The code for currency
|
||||||
pub currency_code: String,
|
pub currency_code: String,
|
||||||
/// Represents the total for the payment.
|
/// Represents the total for the payment.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,2 +1,4 @@
|
|||||||
pub mod enums;
|
pub mod enums;
|
||||||
pub use enums::*;
|
pub use enums::*;
|
||||||
|
pub mod transformers;
|
||||||
|
pub use transformers::*;
|
||||||
|
|||||||
1829
crates/common_enums/src/transformers.rs
Normal file
1829
crates/common_enums/src/transformers.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -127,12 +127,12 @@ pub struct CurrencyCountryFilter {
|
|||||||
#[serde(deserialize_with = "currency_set_deser")]
|
#[serde(deserialize_with = "currency_set_deser")]
|
||||||
pub currency: Option<HashSet<api_models::enums::Currency>>,
|
pub currency: Option<HashSet<api_models::enums::Currency>>,
|
||||||
#[serde(deserialize_with = "string_set_deser")]
|
#[serde(deserialize_with = "string_set_deser")]
|
||||||
pub country: Option<HashSet<api_models::enums::CountryCode>>,
|
pub country: Option<HashSet<api_models::enums::CountryAlpha2>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn string_set_deser<'a, D>(
|
fn string_set_deser<'a, D>(
|
||||||
deserializer: D,
|
deserializer: D,
|
||||||
) -> Result<Option<HashSet<api_models::enums::CountryCode>>, D::Error>
|
) -> Result<Option<HashSet<api_models::enums::CountryAlpha2>>, D::Error>
|
||||||
where
|
where
|
||||||
D: Deserializer<'a>,
|
D: Deserializer<'a>,
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ where
|
|||||||
let list = inner
|
let list = inner
|
||||||
.trim()
|
.trim()
|
||||||
.split(',')
|
.split(',')
|
||||||
.flat_map(api_models::enums::CountryCode::from_str)
|
.flat_map(api_models::enums::CountryAlpha2::from_str)
|
||||||
.collect::<HashSet<_>>();
|
.collect::<HashSet<_>>();
|
||||||
match list.len() {
|
match list.len() {
|
||||||
0 => None,
|
0 => None,
|
||||||
|
|||||||
@ -65,7 +65,7 @@ pub enum PaymentDetails {
|
|||||||
pub struct BankRedirectionPMData {
|
pub struct BankRedirectionPMData {
|
||||||
payment_brand: PaymentBrand,
|
payment_brand: PaymentBrand,
|
||||||
#[serde(rename = "bankAccount.country")]
|
#[serde(rename = "bankAccount.country")]
|
||||||
bank_account_country: Option<api_models::enums::CountryCode>,
|
bank_account_country: Option<api_models::enums::CountryAlpha2>,
|
||||||
#[serde(rename = "bankAccount.bankName")]
|
#[serde(rename = "bankAccount.bankName")]
|
||||||
bank_account_bank_name: Option<String>,
|
bank_account_bank_name: Option<String>,
|
||||||
#[serde(rename = "bankAccount.bic")]
|
#[serde(rename = "bankAccount.bic")]
|
||||||
@ -140,7 +140,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
|||||||
api_models::payments::BankRedirectData::Eps { .. } => {
|
api_models::payments::BankRedirectData::Eps { .. } => {
|
||||||
PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
|
PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
|
||||||
payment_brand: PaymentBrand::Eps,
|
payment_brand: PaymentBrand::Eps,
|
||||||
bank_account_country: Some(api_models::enums::CountryCode::AT),
|
bank_account_country: Some(api_models::enums::CountryAlpha2::AT),
|
||||||
bank_account_bank_name: None,
|
bank_account_bank_name: None,
|
||||||
bank_account_bic: None,
|
bank_account_bic: None,
|
||||||
bank_account_iban: None,
|
bank_account_iban: None,
|
||||||
@ -153,7 +153,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
|||||||
..
|
..
|
||||||
} => PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
|
} => PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
|
||||||
payment_brand: PaymentBrand::Giropay,
|
payment_brand: PaymentBrand::Giropay,
|
||||||
bank_account_country: Some(api_models::enums::CountryCode::DE),
|
bank_account_country: Some(api_models::enums::CountryAlpha2::DE),
|
||||||
bank_account_bank_name: None,
|
bank_account_bank_name: None,
|
||||||
bank_account_bic: bank_account_bic.clone(),
|
bank_account_bic: bank_account_bic.clone(),
|
||||||
bank_account_iban: bank_account_iban.clone(),
|
bank_account_iban: bank_account_iban.clone(),
|
||||||
@ -162,7 +162,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
|||||||
api_models::payments::BankRedirectData::Ideal { bank_name, .. } => {
|
api_models::payments::BankRedirectData::Ideal { bank_name, .. } => {
|
||||||
PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
|
PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
|
||||||
payment_brand: PaymentBrand::Ideal,
|
payment_brand: PaymentBrand::Ideal,
|
||||||
bank_account_country: Some(api_models::enums::CountryCode::NL),
|
bank_account_country: Some(api_models::enums::CountryAlpha2::NL),
|
||||||
bank_account_bank_name: Some(bank_name.to_string()),
|
bank_account_bank_name: Some(bank_name.to_string()),
|
||||||
bank_account_bic: None,
|
bank_account_bic: None,
|
||||||
bank_account_iban: None,
|
bank_account_iban: None,
|
||||||
|
|||||||
@ -62,7 +62,7 @@ pub struct ShopperName {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Address {
|
pub struct Address {
|
||||||
city: Option<String>,
|
city: Option<String>,
|
||||||
country: Option<api_enums::CountryCode>,
|
country: Option<api_enums::CountryAlpha2>,
|
||||||
house_number_or_name: Option<Secret<String>>,
|
house_number_or_name: Option<Secret<String>>,
|
||||||
postal_code: Option<Secret<String>>,
|
postal_code: Option<Secret<String>>,
|
||||||
state_or_province: Option<Secret<String>>,
|
state_or_province: Option<Secret<String>>,
|
||||||
@ -99,7 +99,7 @@ pub struct AdyenPaymentRequest<'a> {
|
|||||||
telephone_number: Option<Secret<String>>,
|
telephone_number: Option<Secret<String>>,
|
||||||
billing_address: Option<Address>,
|
billing_address: Option<Address>,
|
||||||
delivery_address: Option<Address>,
|
delivery_address: Option<Address>,
|
||||||
country_code: Option<api_enums::CountryCode>,
|
country_code: Option<api_enums::CountryAlpha2>,
|
||||||
line_items: Option<Vec<LineItem>>,
|
line_items: Option<Vec<LineItem>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ fn get_shopper_name(item: &types::PaymentsAuthorizeRouterData) -> Option<Shopper
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_country_code(item: &types::PaymentsAuthorizeRouterData) -> Option<api_enums::CountryCode> {
|
fn get_country_code(item: &types::PaymentsAuthorizeRouterData) -> Option<api_enums::CountryAlpha2> {
|
||||||
item.address
|
item.address
|
||||||
.billing
|
.billing
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -1107,7 +1107,7 @@ impl<'a>
|
|||||||
|
|
||||||
fn get_sofort_extra_details(
|
fn get_sofort_extra_details(
|
||||||
item: &types::PaymentsAuthorizeRouterData,
|
item: &types::PaymentsAuthorizeRouterData,
|
||||||
) -> (Option<String>, Option<api_enums::CountryCode>) {
|
) -> (Option<String>, Option<api_enums::CountryAlpha2>) {
|
||||||
match item.request.payment_method_data {
|
match item.request.payment_method_data {
|
||||||
api_models::payments::PaymentMethodData::BankRedirect(ref b) => {
|
api_models::payments::PaymentMethodData::BankRedirect(ref b) => {
|
||||||
if let api_models::payments::BankRedirectData::Sofort {
|
if let api_models::payments::BankRedirectData::Sofort {
|
||||||
|
|||||||
@ -80,7 +80,7 @@ pub struct BillTo {
|
|||||||
locality: String,
|
locality: String,
|
||||||
administrative_area: Secret<String>,
|
administrative_area: Secret<String>,
|
||||||
postal_code: Secret<String>,
|
postal_code: Secret<String>,
|
||||||
country: api_enums::CountryCode,
|
country: api_enums::CountryAlpha2,
|
||||||
email: Secret<String, pii::Email>,
|
email: Secret<String, pii::Email>,
|
||||||
phone_number: Secret<String>,
|
phone_number: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ pub struct GlobalpayPaymentsRequest {
|
|||||||
/// related currency.
|
/// related currency.
|
||||||
pub convenience_amount: Option<String>,
|
pub convenience_amount: Option<String>,
|
||||||
/// The country in ISO-3166-1(alpha-2 code) format.
|
/// The country in ISO-3166-1(alpha-2 code) format.
|
||||||
pub country: api_models::enums::CountryCode,
|
pub country: api_models::enums::CountryAlpha2,
|
||||||
/// The currency of the amount in ISO-4217(alpha-3)
|
/// The currency of the amount in ISO-4217(alpha-3)
|
||||||
pub currency: String,
|
pub currency: String,
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ pub struct Address {
|
|||||||
pub postal_code: Secret<String>,
|
pub postal_code: Secret<String>,
|
||||||
pub city: String,
|
pub city: String,
|
||||||
pub region: Option<Secret<String>>,
|
pub region: Option<Secret<String>>,
|
||||||
pub country: api_models::enums::CountryCode,
|
pub country: api_models::enums::CountryAlpha2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<&types::PaymentsAuthorizeRouterData> for MolliePaymentsRequest {
|
impl TryFrom<&types::PaymentsAuthorizeRouterData> for MolliePaymentsRequest {
|
||||||
|
|||||||
@ -132,7 +132,7 @@ pub struct DeliveryObject {
|
|||||||
house_number: Secret<String>,
|
house_number: Secret<String>,
|
||||||
zip_code: Secret<String>,
|
zip_code: Secret<String>,
|
||||||
city: String,
|
city: String,
|
||||||
country: api_models::enums::CountryCode,
|
country: api_models::enums::CountryAlpha2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
||||||
|
|||||||
@ -186,7 +186,7 @@ pub struct BillingAddress {
|
|||||||
pub email: Option<Secret<String, Email>>,
|
pub email: Option<Secret<String, Email>>,
|
||||||
pub first_name: Option<Secret<String>>,
|
pub first_name: Option<Secret<String>>,
|
||||||
pub last_name: Option<Secret<String>>,
|
pub last_name: Option<Secret<String>>,
|
||||||
pub country: api_models::enums::CountryCode,
|
pub country: api_models::enums::CountryAlpha2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[serde_with::skip_serializing_none]
|
#[serde_with::skip_serializing_none]
|
||||||
|
|||||||
@ -36,7 +36,7 @@ pub struct PurchaseUnitRequest {
|
|||||||
pub struct Address {
|
pub struct Address {
|
||||||
address_line_1: Option<Secret<String>>,
|
address_line_1: Option<Secret<String>>,
|
||||||
postal_code: Option<Secret<String>>,
|
postal_code: Option<Secret<String>>,
|
||||||
country_code: api_models::enums::CountryCode,
|
country_code: api_models::enums::CountryAlpha2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
@ -51,7 +51,7 @@ pub struct CardRequest {
|
|||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct RedirectRequest {
|
pub struct RedirectRequest {
|
||||||
name: Secret<String>,
|
name: Secret<String>,
|
||||||
country_code: api_models::enums::CountryCode,
|
country_code: api_models::enums::CountryAlpha2,
|
||||||
experience_context: ContextStruct,
|
experience_context: ContextStruct,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,7 @@ pub struct Address {
|
|||||||
zip: Option<Secret<String>>,
|
zip: Option<Secret<String>>,
|
||||||
state: Option<Secret<String>>,
|
state: Option<Secret<String>>,
|
||||||
city: Option<String>,
|
city: Option<String>,
|
||||||
country: Option<api_models::enums::CountryCode>,
|
country: Option<api_models::enums::CountryAlpha2>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
|
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
|
||||||
|
|||||||
@ -179,7 +179,7 @@ pub enum BankSpecificData {
|
|||||||
#[serde(rename = "payment_method_options[sofort][preferred_language]")]
|
#[serde(rename = "payment_method_options[sofort][preferred_language]")]
|
||||||
preferred_language: String,
|
preferred_language: String,
|
||||||
#[serde(rename = "payment_method_data[sofort][country]")]
|
#[serde(rename = "payment_method_data[sofort][country]")]
|
||||||
country: api_enums::CountryCode,
|
country: api_enums::CountryAlpha2,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,7 +1425,7 @@ pub struct StripeShippingAddress {
|
|||||||
#[serde(rename = "shipping[address][city]")]
|
#[serde(rename = "shipping[address][city]")]
|
||||||
pub city: Option<String>,
|
pub city: Option<String>,
|
||||||
#[serde(rename = "shipping[address][country]")]
|
#[serde(rename = "shipping[address][country]")]
|
||||||
pub country: Option<api_enums::CountryCode>,
|
pub country: Option<api_enums::CountryAlpha2>,
|
||||||
#[serde(rename = "shipping[address][line1]")]
|
#[serde(rename = "shipping[address][line1]")]
|
||||||
pub line1: Option<Secret<String>>,
|
pub line1: Option<Secret<String>>,
|
||||||
#[serde(rename = "shipping[address][line2]")]
|
#[serde(rename = "shipping[address][line2]")]
|
||||||
@ -1445,7 +1445,7 @@ pub struct StripeBillingAddress {
|
|||||||
#[serde(rename = "payment_method_data[billing_details][email]")]
|
#[serde(rename = "payment_method_data[billing_details][email]")]
|
||||||
pub email: Option<Secret<String, pii::Email>>,
|
pub email: Option<Secret<String, pii::Email>>,
|
||||||
#[serde(rename = "payment_method_data[billing_details][address][country]")]
|
#[serde(rename = "payment_method_data[billing_details][address][country]")]
|
||||||
pub country: Option<api_enums::CountryCode>,
|
pub country: Option<api_enums::CountryAlpha2>,
|
||||||
#[serde(rename = "payment_method_data[billing_details][name]")]
|
#[serde(rename = "payment_method_data[billing_details][name]")]
|
||||||
pub name: Option<Secret<String>>,
|
pub name: Option<Secret<String>>,
|
||||||
#[serde(rename = "payment_method_data[billing_details][address][city]")]
|
#[serde(rename = "payment_method_data[billing_details][address][city]")]
|
||||||
@ -1896,7 +1896,7 @@ pub struct DisputeObj {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_validate_shipping_address_against_payment_method {
|
mod test_validate_shipping_address_against_payment_method {
|
||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
use api_models::enums::CountryCode;
|
use api_models::enums::CountryAlpha2;
|
||||||
use masking::Secret;
|
use masking::Secret;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -1913,7 +1913,7 @@ mod test_validate_shipping_address_against_payment_method {
|
|||||||
let stripe_shipping_address = create_stripe_shipping_address(
|
let stripe_shipping_address = create_stripe_shipping_address(
|
||||||
Some("name".to_string()),
|
Some("name".to_string()),
|
||||||
Some("line1".to_string()),
|
Some("line1".to_string()),
|
||||||
Some(CountryCode::AD),
|
Some(CountryAlpha2::AD),
|
||||||
Some("zip".to_string()),
|
Some("zip".to_string()),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1935,7 +1935,7 @@ mod test_validate_shipping_address_against_payment_method {
|
|||||||
let stripe_shipping_address = create_stripe_shipping_address(
|
let stripe_shipping_address = create_stripe_shipping_address(
|
||||||
None,
|
None,
|
||||||
Some("line1".to_string()),
|
Some("line1".to_string()),
|
||||||
Some(CountryCode::AD),
|
Some(CountryAlpha2::AD),
|
||||||
Some("zip".to_string()),
|
Some("zip".to_string()),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1960,7 +1960,7 @@ mod test_validate_shipping_address_against_payment_method {
|
|||||||
let stripe_shipping_address = create_stripe_shipping_address(
|
let stripe_shipping_address = create_stripe_shipping_address(
|
||||||
Some("name".to_string()),
|
Some("name".to_string()),
|
||||||
None,
|
None,
|
||||||
Some(CountryCode::AD),
|
Some(CountryAlpha2::AD),
|
||||||
Some("zip".to_string()),
|
Some("zip".to_string()),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2010,7 +2010,7 @@ mod test_validate_shipping_address_against_payment_method {
|
|||||||
let stripe_shipping_address = create_stripe_shipping_address(
|
let stripe_shipping_address = create_stripe_shipping_address(
|
||||||
Some("name".to_string()),
|
Some("name".to_string()),
|
||||||
Some("line1".to_string()),
|
Some("line1".to_string()),
|
||||||
Some(CountryCode::AD),
|
Some(CountryAlpha2::AD),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
let payment_method = &StripePaymentMethodType::AfterpayClearpay;
|
let payment_method = &StripePaymentMethodType::AfterpayClearpay;
|
||||||
@ -2066,7 +2066,7 @@ mod test_validate_shipping_address_against_payment_method {
|
|||||||
fn create_stripe_shipping_address(
|
fn create_stripe_shipping_address(
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
line1: Option<String>,
|
line1: Option<String>,
|
||||||
country: Option<CountryCode>,
|
country: Option<CountryAlpha2>,
|
||||||
zip: Option<String>,
|
zip: Option<String>,
|
||||||
) -> StripeShippingAddress {
|
) -> StripeShippingAddress {
|
||||||
StripeShippingAddress {
|
StripeShippingAddress {
|
||||||
|
|||||||
@ -124,7 +124,7 @@ pub struct PaymentRequestCards {
|
|||||||
#[serde(rename = "billing[city]")]
|
#[serde(rename = "billing[city]")]
|
||||||
pub billing_city: String,
|
pub billing_city: String,
|
||||||
#[serde(rename = "billing[country]")]
|
#[serde(rename = "billing[country]")]
|
||||||
pub billing_country: api_models::enums::CountryCode,
|
pub billing_country: api_models::enums::CountryAlpha2,
|
||||||
#[serde(rename = "billing[street1]")]
|
#[serde(rename = "billing[street1]")]
|
||||||
pub billing_street1: Secret<String>,
|
pub billing_street1: Secret<String>,
|
||||||
#[serde(rename = "billing[postcode]")]
|
#[serde(rename = "billing[postcode]")]
|
||||||
@ -178,7 +178,7 @@ pub enum TrustpayPaymentsRequest {
|
|||||||
#[derive(Debug, Serialize, Eq, PartialEq)]
|
#[derive(Debug, Serialize, Eq, PartialEq)]
|
||||||
pub struct TrustpayMandatoryParams {
|
pub struct TrustpayMandatoryParams {
|
||||||
pub billing_city: String,
|
pub billing_city: String,
|
||||||
pub billing_country: api_models::enums::CountryCode,
|
pub billing_country: api_models::enums::CountryAlpha2,
|
||||||
pub billing_street1: Secret<String>,
|
pub billing_street1: Secret<String>,
|
||||||
pub billing_postcode: Secret<String>,
|
pub billing_postcode: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ impl AccessTokenRequestInfo for types::RefreshTokenRouterData {
|
|||||||
|
|
||||||
pub trait RouterData {
|
pub trait RouterData {
|
||||||
fn get_billing(&self) -> Result<&api::Address, Error>;
|
fn get_billing(&self) -> Result<&api::Address, Error>;
|
||||||
fn get_billing_country(&self) -> Result<api_models::enums::CountryCode, Error>;
|
fn get_billing_country(&self) -> Result<api_models::enums::CountryAlpha2, Error>;
|
||||||
fn get_billing_phone(&self) -> Result<&api::PhoneDetails, Error>;
|
fn get_billing_phone(&self) -> Result<&api::PhoneDetails, Error>;
|
||||||
fn get_description(&self) -> Result<String, Error>;
|
fn get_description(&self) -> Result<String, Error>;
|
||||||
fn get_return_url(&self) -> Result<String, Error>;
|
fn get_return_url(&self) -> Result<String, Error>;
|
||||||
@ -72,7 +72,7 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
|
|||||||
.ok_or_else(missing_field_err("billing"))
|
.ok_or_else(missing_field_err("billing"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_billing_country(&self) -> Result<api_models::enums::CountryCode, Error> {
|
fn get_billing_country(&self) -> Result<api_models::enums::CountryAlpha2, Error> {
|
||||||
self.address
|
self.address
|
||||||
.billing
|
.billing
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -440,7 +440,7 @@ pub trait AddressDetailsData {
|
|||||||
fn get_city(&self) -> Result<&String, Error>;
|
fn get_city(&self) -> Result<&String, Error>;
|
||||||
fn get_line2(&self) -> Result<&Secret<String>, Error>;
|
fn get_line2(&self) -> Result<&Secret<String>, Error>;
|
||||||
fn get_zip(&self) -> Result<&Secret<String>, Error>;
|
fn get_zip(&self) -> Result<&Secret<String>, Error>;
|
||||||
fn get_country(&self) -> Result<&api_models::enums::CountryCode, Error>;
|
fn get_country(&self) -> Result<&api_models::enums::CountryAlpha2, Error>;
|
||||||
fn get_combined_address_line(&self) -> Result<Secret<String>, Error>;
|
fn get_combined_address_line(&self) -> Result<Secret<String>, Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ impl AddressDetailsData for api::AddressDetails {
|
|||||||
.ok_or_else(missing_field_err("address.zip"))
|
.ok_or_else(missing_field_err("address.zip"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_country(&self) -> Result<&api_models::enums::CountryCode, Error> {
|
fn get_country(&self) -> Result<&api_models::enums::CountryAlpha2, Error> {
|
||||||
self.country
|
self.country
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(missing_field_err("address.country"))
|
.ok_or_else(missing_field_err("address.country"))
|
||||||
|
|||||||
@ -49,7 +49,7 @@ pub struct Order {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BillingAddress {
|
pub struct BillingAddress {
|
||||||
pub city: Option<String>,
|
pub city: Option<String>,
|
||||||
pub country_code: Option<api_enums::CountryCode>,
|
pub country_code: Option<api_enums::CountryAlpha2>,
|
||||||
pub house_number: Option<String>,
|
pub house_number: Option<String>,
|
||||||
pub state: Option<Secret<String>>,
|
pub state: Option<Secret<String>>,
|
||||||
pub state_code: Option<String>,
|
pub state_code: Option<String>,
|
||||||
@ -84,7 +84,7 @@ pub struct Name {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Shipping {
|
pub struct Shipping {
|
||||||
pub city: Option<String>,
|
pub city: Option<String>,
|
||||||
pub country_code: Option<api_enums::CountryCode>,
|
pub country_code: Option<api_enums::CountryAlpha2>,
|
||||||
pub house_number: Option<String>,
|
pub house_number: Option<String>,
|
||||||
pub name: Option<Name>,
|
pub name: Option<Name>,
|
||||||
pub state: Option<Secret<String>>,
|
pub state: Option<Secret<String>>,
|
||||||
|
|||||||
@ -50,7 +50,7 @@ fn get_primary_business_details(
|
|||||||
.to_owned()
|
.to_owned()
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
vec![PrimaryBusinessDetails {
|
vec![PrimaryBusinessDetails {
|
||||||
country: enums::CountryCode::US,
|
country: enums::CountryAlpha2::US,
|
||||||
business: "default".to_string(),
|
business: "default".to_string(),
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
@ -328,7 +328,7 @@ async fn validate_merchant_id<S: Into<String>>(
|
|||||||
fn get_business_details_wrapper(
|
fn get_business_details_wrapper(
|
||||||
request: &api::MerchantConnectorCreate,
|
request: &api::MerchantConnectorCreate,
|
||||||
_merchant_account: &MerchantAccount,
|
_merchant_account: &MerchantAccount,
|
||||||
) -> RouterResult<(enums::CountryCode, String)> {
|
) -> RouterResult<(enums::CountryAlpha2, String)> {
|
||||||
#[cfg(feature = "multiple_mca")]
|
#[cfg(feature = "multiple_mca")]
|
||||||
{
|
{
|
||||||
// The fields are mandatory
|
// The fields are mandatory
|
||||||
|
|||||||
@ -1163,7 +1163,7 @@ fn filter_pm_based_on_config<'a>(
|
|||||||
connector: &'a str,
|
connector: &'a str,
|
||||||
payment_method_type: &'a api_enums::PaymentMethodType,
|
payment_method_type: &'a api_enums::PaymentMethodType,
|
||||||
card_network: &mut Option<Vec<api_enums::CardNetwork>>,
|
card_network: &mut Option<Vec<api_enums::CardNetwork>>,
|
||||||
country: &Option<api_enums::CountryCode>,
|
country: &Option<api_enums::CountryAlpha2>,
|
||||||
currency: Option<api_enums::Currency>,
|
currency: Option<api_enums::Currency>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
config
|
config
|
||||||
@ -1185,7 +1185,7 @@ fn filter_pm_based_on_config<'a>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn card_network_filter(
|
fn card_network_filter(
|
||||||
country: &Option<api_enums::CountryCode>,
|
country: &Option<api_enums::CountryAlpha2>,
|
||||||
currency: Option<api_enums::Currency>,
|
currency: Option<api_enums::Currency>,
|
||||||
card_network: &mut Option<Vec<api_enums::CardNetwork>>,
|
card_network: &mut Option<Vec<api_enums::CardNetwork>>,
|
||||||
payment_method_filters: &settings::PaymentMethodFilters,
|
payment_method_filters: &settings::PaymentMethodFilters,
|
||||||
@ -1209,7 +1209,7 @@ fn card_network_filter(
|
|||||||
|
|
||||||
fn global_country_currency_filter(
|
fn global_country_currency_filter(
|
||||||
item: &settings::CurrencyCountryFilter,
|
item: &settings::CurrencyCountryFilter,
|
||||||
country: &Option<api_enums::CountryCode>,
|
country: &Option<api_enums::CountryAlpha2>,
|
||||||
currency: Option<api_enums::Currency>,
|
currency: Option<api_enums::Currency>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let country_condition = item
|
let country_condition = item
|
||||||
@ -1247,10 +1247,10 @@ fn filter_pm_card_network_based(
|
|||||||
}
|
}
|
||||||
fn filter_pm_country_based(
|
fn filter_pm_country_based(
|
||||||
accepted_countries: &Option<admin::AcceptedCountries>,
|
accepted_countries: &Option<admin::AcceptedCountries>,
|
||||||
req_country_list: &Option<Vec<api_enums::CountryCode>>,
|
req_country_list: &Option<Vec<api_enums::CountryAlpha2>>,
|
||||||
) -> (
|
) -> (
|
||||||
Option<admin::AcceptedCountries>,
|
Option<admin::AcceptedCountries>,
|
||||||
Option<Vec<api_enums::CountryCode>>,
|
Option<Vec<api_enums::CountryAlpha2>>,
|
||||||
bool,
|
bool,
|
||||||
) {
|
) {
|
||||||
match (accepted_countries, req_country_list) {
|
match (accepted_countries, req_country_list) {
|
||||||
|
|||||||
@ -1273,7 +1273,7 @@ fn connector_needs_business_sub_label(connector_name: &str) -> bool {
|
|||||||
/// Create the connector label
|
/// Create the connector label
|
||||||
/// {connector_name}_{country}_{business_label}
|
/// {connector_name}_{country}_{business_label}
|
||||||
pub fn get_connector_label(
|
pub fn get_connector_label(
|
||||||
business_country: api_models::enums::CountryCode,
|
business_country: api_models::enums::CountryAlpha2,
|
||||||
business_label: &str,
|
business_label: &str,
|
||||||
business_sub_label: Option<&String>,
|
business_sub_label: Option<&String>,
|
||||||
connector_name: &str,
|
connector_name: &str,
|
||||||
@ -1302,10 +1302,10 @@ pub fn get_connector_label(
|
|||||||
/// If there is more than one label or country configured in merchant account, then
|
/// If there is more than one label or country configured in merchant account, then
|
||||||
/// passing business details for payment is mandatory to avoid ambiguity
|
/// passing business details for payment is mandatory to avoid ambiguity
|
||||||
pub fn get_business_details(
|
pub fn get_business_details(
|
||||||
business_country: Option<api_enums::CountryCode>,
|
business_country: Option<api_enums::CountryAlpha2>,
|
||||||
business_label: Option<&String>,
|
business_label: Option<&String>,
|
||||||
merchant_account: &storage_models::merchant_account::MerchantAccount,
|
merchant_account: &storage_models::merchant_account::MerchantAccount,
|
||||||
) -> RouterResult<(api_enums::CountryCode, String)> {
|
) -> RouterResult<(api_enums::CountryAlpha2, String)> {
|
||||||
let (business_country, business_label) = match business_country.zip(business_label) {
|
let (business_country, business_label) = match business_country.zip(business_label) {
|
||||||
Some((business_country, business_label)) => {
|
Some((business_country, business_label)) => {
|
||||||
(business_country.to_owned(), business_label.to_owned())
|
(business_country.to_owned(), business_label.to_owned())
|
||||||
|
|||||||
@ -147,7 +147,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
|||||||
api_models::enums::CardNetwork,
|
api_models::enums::CardNetwork,
|
||||||
api_models::enums::DisputeStage,
|
api_models::enums::DisputeStage,
|
||||||
api_models::enums::DisputeStatus,
|
api_models::enums::DisputeStatus,
|
||||||
api_models::enums::CountryCode,
|
api_models::enums::CountryAlpha2,
|
||||||
api_models::admin::MerchantConnectorCreate,
|
api_models::admin::MerchantConnectorCreate,
|
||||||
api_models::admin::PaymentMethodsEnabled,
|
api_models::admin::PaymentMethodsEnabled,
|
||||||
api_models::disputes::DisputeResponse,
|
api_models::disputes::DisputeResponse,
|
||||||
|
|||||||
@ -261,7 +261,7 @@ pub struct PaymentsCancelData {
|
|||||||
pub struct PaymentsSessionData {
|
pub struct PaymentsSessionData {
|
||||||
pub amount: i64,
|
pub amount: i64,
|
||||||
pub currency: storage_enums::Currency,
|
pub currency: storage_enums::Currency,
|
||||||
pub country: Option<api::enums::CountryCode>,
|
pub country: Option<api::enums::CountryAlpha2>,
|
||||||
pub order_details: Option<api_models::payments::OrderDetails>,
|
pub order_details: Option<api_models::payments::OrderDetails>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ impl AdyenTest {
|
|||||||
address: Some(PaymentAddress {
|
address: Some(PaymentAddress {
|
||||||
billing: Some(Address {
|
billing: Some(Address {
|
||||||
address: Some(AddressDetails {
|
address: Some(AddressDetails {
|
||||||
country: Some(api_models::enums::CountryCode::US),
|
country: Some(api_models::enums::CountryAlpha2::US),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
phone: None,
|
phone: None,
|
||||||
|
|||||||
@ -42,7 +42,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
|
|||||||
line2: Some(Secret::new("line2".to_string())),
|
line2: Some(Secret::new("line2".to_string())),
|
||||||
city: Some("city".to_string()),
|
city: Some("city".to_string()),
|
||||||
zip: Some(Secret::new("zip".to_string())),
|
zip: Some(Secret::new("zip".to_string())),
|
||||||
country: Some(api_models::enums::CountryCode::IN),
|
country: Some(api_models::enums::CountryAlpha2::IN),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
phone: Some(api::PhoneDetails {
|
phone: Some(api::PhoneDetails {
|
||||||
|
|||||||
@ -443,7 +443,7 @@ pub fn get_payment_info() -> PaymentInfo {
|
|||||||
phone: None,
|
phone: None,
|
||||||
address: Some(api::AddressDetails {
|
address: Some(api::AddressDetails {
|
||||||
city: None,
|
city: None,
|
||||||
country: Some(api_models::enums::CountryCode::PA),
|
country: Some(api_models::enums::CountryAlpha2::PA),
|
||||||
line1: None,
|
line1: None,
|
||||||
line2: None,
|
line2: None,
|
||||||
line3: None,
|
line3: None,
|
||||||
|
|||||||
@ -41,7 +41,7 @@ fn get_default_payment_info() -> Option<PaymentInfo> {
|
|||||||
address: Some(types::PaymentAddress {
|
address: Some(types::PaymentAddress {
|
||||||
billing: Some(api::Address {
|
billing: Some(api::Address {
|
||||||
address: Some(api::AddressDetails {
|
address: Some(api::AddressDetails {
|
||||||
country: Some(api_models::enums::CountryCode::US),
|
country: Some(api_models::enums::CountryAlpha2::US),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
phone: None,
|
phone: None,
|
||||||
|
|||||||
@ -72,7 +72,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
|
|||||||
line2: Some(Secret::new("line2".to_string())),
|
line2: Some(Secret::new("line2".to_string())),
|
||||||
city: Some("city".to_string()),
|
city: Some("city".to_string()),
|
||||||
zip: Some(Secret::new("zip".to_string())),
|
zip: Some(Secret::new("zip".to_string())),
|
||||||
country: Some(api_models::enums::CountryCode::IN),
|
country: Some(api_models::enums::CountryAlpha2::IN),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
phone: None,
|
phone: None,
|
||||||
|
|||||||
@ -42,7 +42,7 @@ impl WorldlineTest {
|
|||||||
address: Some(PaymentAddress {
|
address: Some(PaymentAddress {
|
||||||
billing: Some(Address {
|
billing: Some(Address {
|
||||||
address: Some(AddressDetails {
|
address: Some(AddressDetails {
|
||||||
country: Some(api_models::enums::CountryCode::US),
|
country: Some(api_models::enums::CountryAlpha2::US),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
phone: None,
|
phone: None,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use crate::{enums, schema::address};
|
|||||||
pub struct AddressNew {
|
pub struct AddressNew {
|
||||||
pub address_id: String,
|
pub address_id: String,
|
||||||
pub city: Option<String>,
|
pub city: Option<String>,
|
||||||
pub country: Option<enums::CountryCode>,
|
pub country: Option<enums::CountryAlpha2>,
|
||||||
pub line1: Option<Secret<String>>,
|
pub line1: Option<Secret<String>>,
|
||||||
pub line2: Option<Secret<String>>,
|
pub line2: Option<Secret<String>>,
|
||||||
pub line3: Option<Secret<String>>,
|
pub line3: Option<Secret<String>>,
|
||||||
@ -34,7 +34,7 @@ pub struct Address {
|
|||||||
#[serde(skip_serializing)]
|
#[serde(skip_serializing)]
|
||||||
pub address_id: String,
|
pub address_id: String,
|
||||||
pub city: Option<String>,
|
pub city: Option<String>,
|
||||||
pub country: Option<enums::CountryCode>,
|
pub country: Option<enums::CountryAlpha2>,
|
||||||
pub line1: Option<Secret<String>>,
|
pub line1: Option<Secret<String>>,
|
||||||
pub line2: Option<Secret<String>>,
|
pub line2: Option<Secret<String>>,
|
||||||
pub line3: Option<Secret<String>>,
|
pub line3: Option<Secret<String>>,
|
||||||
@ -58,7 +58,7 @@ pub struct Address {
|
|||||||
pub enum AddressUpdate {
|
pub enum AddressUpdate {
|
||||||
Update {
|
Update {
|
||||||
city: Option<String>,
|
city: Option<String>,
|
||||||
country: Option<enums::CountryCode>,
|
country: Option<enums::CountryAlpha2>,
|
||||||
line1: Option<Secret<String>>,
|
line1: Option<Secret<String>>,
|
||||||
line2: Option<Secret<String>>,
|
line2: Option<Secret<String>>,
|
||||||
line3: Option<Secret<String>>,
|
line3: Option<Secret<String>>,
|
||||||
@ -75,7 +75,7 @@ pub enum AddressUpdate {
|
|||||||
#[diesel(table_name = address)]
|
#[diesel(table_name = address)]
|
||||||
pub struct AddressUpdateInternal {
|
pub struct AddressUpdateInternal {
|
||||||
city: Option<String>,
|
city: Option<String>,
|
||||||
country: Option<enums::CountryCode>,
|
country: Option<enums::CountryAlpha2>,
|
||||||
line1: Option<Secret<String>>,
|
line1: Option<Secret<String>>,
|
||||||
line2: Option<Secret<String>>,
|
line2: Option<Secret<String>>,
|
||||||
line3: Option<Secret<String>>,
|
line3: Option<Secret<String>>,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ pub mod diesel_exports {
|
|||||||
pub use super::{
|
pub use super::{
|
||||||
DbAttemptStatus as AttemptStatus, DbAuthenticationType as AuthenticationType,
|
DbAttemptStatus as AttemptStatus, DbAuthenticationType as AuthenticationType,
|
||||||
DbCaptureMethod as CaptureMethod, DbConnectorType as ConnectorType,
|
DbCaptureMethod as CaptureMethod, DbConnectorType as ConnectorType,
|
||||||
DbCountryCode as CountryCode, DbCurrency as Currency, DbDisputeStage as DisputeStage,
|
DbCountryAlpha2 as CountryAlpha2, DbCurrency as Currency, DbDisputeStage as DisputeStage,
|
||||||
DbDisputeStatus as DisputeStatus, DbEventClass as EventClass,
|
DbDisputeStatus as DisputeStatus, DbEventClass as EventClass,
|
||||||
DbEventObjectType as EventObjectType, DbEventType as EventType,
|
DbEventObjectType as EventObjectType, DbEventType as EventType,
|
||||||
DbFutureUsage as FutureUsage, DbIntentStatus as IntentStatus,
|
DbFutureUsage as FutureUsage, DbIntentStatus as IntentStatus,
|
||||||
|
|||||||
@ -29,7 +29,7 @@ pub struct MerchantConnectorAccount {
|
|||||||
pub connector_type: storage_enums::ConnectorType,
|
pub connector_type: storage_enums::ConnectorType,
|
||||||
pub metadata: Option<pii::SecretSerdeValue>,
|
pub metadata: Option<pii::SecretSerdeValue>,
|
||||||
pub connector_label: String,
|
pub connector_label: String,
|
||||||
pub business_country: storage_enums::CountryCode,
|
pub business_country: storage_enums::CountryAlpha2,
|
||||||
pub business_label: String,
|
pub business_label: String,
|
||||||
pub business_sub_label: Option<String>,
|
pub business_sub_label: Option<String>,
|
||||||
pub frm_configs: Option<Secret<serde_json::Value>>,
|
pub frm_configs: Option<Secret<serde_json::Value>>,
|
||||||
@ -50,7 +50,7 @@ pub struct MerchantConnectorAccountNew {
|
|||||||
pub payment_methods_enabled: Option<Vec<serde_json::Value>>,
|
pub payment_methods_enabled: Option<Vec<serde_json::Value>>,
|
||||||
pub metadata: Option<pii::SecretSerdeValue>,
|
pub metadata: Option<pii::SecretSerdeValue>,
|
||||||
pub connector_label: String,
|
pub connector_label: String,
|
||||||
pub business_country: storage_enums::CountryCode,
|
pub business_country: storage_enums::CountryAlpha2,
|
||||||
pub business_label: String,
|
pub business_label: String,
|
||||||
pub business_sub_label: Option<String>,
|
pub business_sub_label: Option<String>,
|
||||||
pub frm_configs: Option<Secret<serde_json::Value>>,
|
pub frm_configs: Option<Secret<serde_json::Value>>,
|
||||||
|
|||||||
@ -34,7 +34,7 @@ pub struct PaymentIntent {
|
|||||||
pub off_session: Option<bool>,
|
pub off_session: Option<bool>,
|
||||||
pub client_secret: Option<String>,
|
pub client_secret: Option<String>,
|
||||||
pub active_attempt_id: String,
|
pub active_attempt_id: String,
|
||||||
pub business_country: storage_enums::CountryCode,
|
pub business_country: storage_enums::CountryAlpha2,
|
||||||
pub business_label: String,
|
pub business_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ pub struct PaymentIntentNew {
|
|||||||
pub off_session: Option<bool>,
|
pub off_session: Option<bool>,
|
||||||
pub client_secret: Option<String>,
|
pub client_secret: Option<String>,
|
||||||
pub active_attempt_id: String,
|
pub active_attempt_id: String,
|
||||||
pub business_country: storage_enums::CountryCode,
|
pub business_country: storage_enums::CountryAlpha2,
|
||||||
pub business_label: String,
|
pub business_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ pub enum PaymentIntentUpdate {
|
|||||||
shipping_address_id: Option<String>,
|
shipping_address_id: Option<String>,
|
||||||
billing_address_id: Option<String>,
|
billing_address_id: Option<String>,
|
||||||
return_url: Option<String>,
|
return_url: Option<String>,
|
||||||
business_country: Option<storage_enums::CountryCode>,
|
business_country: Option<storage_enums::CountryAlpha2>,
|
||||||
business_label: Option<String>,
|
business_label: Option<String>,
|
||||||
},
|
},
|
||||||
PaymentAttemptUpdate {
|
PaymentAttemptUpdate {
|
||||||
@ -140,7 +140,7 @@ pub struct PaymentIntentUpdateInternal {
|
|||||||
pub shipping_address_id: Option<String>,
|
pub shipping_address_id: Option<String>,
|
||||||
pub modified_at: Option<PrimitiveDateTime>,
|
pub modified_at: Option<PrimitiveDateTime>,
|
||||||
pub active_attempt_id: Option<String>,
|
pub active_attempt_id: Option<String>,
|
||||||
pub business_country: Option<storage_enums::CountryCode>,
|
pub business_country: Option<storage_enums::CountryAlpha2>,
|
||||||
pub business_label: Option<String>,
|
pub business_label: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ diesel::table! {
|
|||||||
id -> Int4,
|
id -> Int4,
|
||||||
address_id -> Varchar,
|
address_id -> Varchar,
|
||||||
city -> Nullable<Varchar>,
|
city -> Nullable<Varchar>,
|
||||||
country -> Nullable<CountryCode>,
|
country -> Nullable<CountryAlpha2>,
|
||||||
line1 -> Nullable<Varchar>,
|
line1 -> Nullable<Varchar>,
|
||||||
line2 -> Nullable<Varchar>,
|
line2 -> Nullable<Varchar>,
|
||||||
line3 -> Nullable<Varchar>,
|
line3 -> Nullable<Varchar>,
|
||||||
@ -267,7 +267,7 @@ diesel::table! {
|
|||||||
connector_type -> ConnectorType,
|
connector_type -> ConnectorType,
|
||||||
metadata -> Nullable<Jsonb>,
|
metadata -> Nullable<Jsonb>,
|
||||||
connector_label -> Varchar,
|
connector_label -> Varchar,
|
||||||
business_country -> CountryCode,
|
business_country -> CountryAlpha2,
|
||||||
business_label -> Varchar,
|
business_label -> Varchar,
|
||||||
business_sub_label -> Nullable<Varchar>,
|
business_sub_label -> Nullable<Varchar>,
|
||||||
frm_configs -> Nullable<Jsonb>,
|
frm_configs -> Nullable<Jsonb>,
|
||||||
@ -347,7 +347,7 @@ diesel::table! {
|
|||||||
off_session -> Nullable<Bool>,
|
off_session -> Nullable<Bool>,
|
||||||
client_secret -> Nullable<Varchar>,
|
client_secret -> Nullable<Varchar>,
|
||||||
active_attempt_id -> Varchar,
|
active_attempt_id -> Varchar,
|
||||||
business_country -> CountryCode,
|
business_country -> CountryAlpha2,
|
||||||
business_label -> Varchar,
|
business_label -> Varchar,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,2 @@
|
|||||||
|
-- This file should undo anything in `up.sql`
|
||||||
|
ALTER TYPE "CountryAlpha2" RENAME TO "CountryCode";
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
-- Your SQL goes here
|
||||||
|
ALTER TYPE "CountryCode" RENAME TO "CountryAlpha2";
|
||||||
Reference in New Issue
Block a user