refactor(connector): [KLARNA] Add dynamic fields for klarna payment method (#4891)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Swangi Kumari
2024-06-06 00:34:57 +05:30
committed by GitHub
parent 3d53fd018a
commit dae1413960
3 changed files with 136 additions and 3 deletions

View File

@ -433,7 +433,7 @@ pub enum FieldType {
UserFullName,
UserEmailAddress,
UserPhoneNumber,
UserCountryCode, //phone number's country code
UserPhoneNumberCountryCode, //phone number's country code
UserCountry { options: Vec<String> }, //for country inside payment method data ex- bank redirect
UserCurrency { options: Vec<String> },
UserCryptoCurrencyNetwork, //for crypto network associated with the cryptopcurrency
@ -494,7 +494,7 @@ impl PartialEq for FieldType {
(Self::UserFullName, Self::UserFullName) => true,
(Self::UserEmailAddress, Self::UserEmailAddress) => true,
(Self::UserPhoneNumber, Self::UserPhoneNumber) => true,
(Self::UserCountryCode, Self::UserCountryCode) => true,
(Self::UserPhoneNumberCountryCode, Self::UserPhoneNumberCountryCode) => true,
(
Self::UserCountry {
options: options_self,

View File

@ -8243,6 +8243,139 @@ impl Default for super::settings::RequiredFields {
common : HashMap::new(),
}
),
(
enums::Connector::Klarna,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
common: HashMap::from([
(
"shipping.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "shipping.address.first_name".to_string(),
display_name: "shipping_first_name".to_string(),
field_type: enums::FieldType::UserShippingName,
value: None,
}
),
(
"shipping.address.last_name".to_string(),
RequiredFieldInfo {
required_field: "shipping.address.last_name".to_string(),
display_name: "shipping_last_name".to_string(),
field_type: enums::FieldType::UserShippingName,
value: None,
}
),
(
"shipping.address.city".to_string(),
RequiredFieldInfo {
required_field: "shipping.address.city".to_string(),
display_name: "city".to_string(),
field_type: enums::FieldType::UserShippingAddressCity,
value: None,
}
),
(
"shipping.address.line1".to_string(),
RequiredFieldInfo {
required_field: "shipping.address.line1".to_string(),
display_name: "line1".to_string(),
field_type: enums::FieldType::UserShippingAddressLine1,
value: None,
}
),
(
"shipping.address.line2".to_string(),
RequiredFieldInfo {
required_field: "shipping.address.line2".to_string(),
display_name: "line2".to_string(),
field_type: enums::FieldType::UserShippingAddressLine2,
value: None,
}
),
(
"shipping.address.zip".to_string(),
RequiredFieldInfo {
required_field: "shipping.address.zip".to_string(),
display_name: "zip".to_string(),
field_type: enums::FieldType::UserShippingAddressPincode,
value: None,
}
),
(
"shipping.address.state".to_string(),
RequiredFieldInfo {
required_field: "shipping.address.state".to_string(),
display_name: "state".to_string(),
field_type: enums::FieldType::UserShippingAddressState,
value: None,
}
),
(
"shipping.email".to_string(),
RequiredFieldInfo {
required_field: "shipping.email".to_string(),
display_name: "email".to_string(),
field_type: enums::FieldType::UserEmailAddress,
value: None,
}
),
(
"shipping.phone.number".to_string(),
RequiredFieldInfo {
required_field: "shipping.phone.number".to_string(),
display_name: "phone_number".to_string(),
field_type: enums::FieldType::UserPhoneNumber,
value: None,
}
),
(
"shipping.phone.country_code".to_string(),
RequiredFieldInfo {
required_field: "shipping.phone.country_code".to_string(),
display_name: "phone_country_code".to_string(),
field_type: enums::FieldType::UserPhoneNumberCountryCode,
value: None,
}
),
(
"shipping.address.country".to_string(),
RequiredFieldInfo {
required_field: "shipping.address.country".to_string(),
display_name: "country".to_string(),
field_type: enums::FieldType::UserShippingAddressCountry{
options: vec![
"AU".to_string(),
"AT".to_string(),
"BE".to_string(),
"CA".to_string(),
"CZ".to_string(),
"DK".to_string(),
"FI".to_string(),
"FR".to_string(),
"DE".to_string(),
"GR".to_string(),
"IE".to_string(),
"IT".to_string(),
"NL".to_string(),
"NZ".to_string(),
"NO".to_string(),
"PL".to_string(),
"PT".to_string(),
"ES".to_string(),
"SE".to_string(),
"CH".to_string(),
"GB".to_string(),
"US".to_string(),
]
},
value: None,
}
),
]),
}
)
]),
},
),

View File

@ -9262,7 +9262,7 @@
{
"type": "string",
"enum": [
"user_country_code"
"user_phone_number_country_code"
]
},
{