mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	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:
		| @ -433,7 +433,7 @@ pub enum FieldType { | |||||||
|     UserFullName, |     UserFullName, | ||||||
|     UserEmailAddress, |     UserEmailAddress, | ||||||
|     UserPhoneNumber, |     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 |     UserCountry { options: Vec<String> }, //for country inside payment method data ex- bank redirect | ||||||
|     UserCurrency { options: Vec<String> }, |     UserCurrency { options: Vec<String> }, | ||||||
|     UserCryptoCurrencyNetwork, //for crypto network associated with the cryptopcurrency |     UserCryptoCurrencyNetwork, //for crypto network associated with the cryptopcurrency | ||||||
| @ -494,7 +494,7 @@ impl PartialEq for FieldType { | |||||||
|             (Self::UserFullName, Self::UserFullName) => true, |             (Self::UserFullName, Self::UserFullName) => true, | ||||||
|             (Self::UserEmailAddress, Self::UserEmailAddress) => true, |             (Self::UserEmailAddress, Self::UserEmailAddress) => true, | ||||||
|             (Self::UserPhoneNumber, Self::UserPhoneNumber) => true, |             (Self::UserPhoneNumber, Self::UserPhoneNumber) => true, | ||||||
|             (Self::UserCountryCode, Self::UserCountryCode) => true, |             (Self::UserPhoneNumberCountryCode, Self::UserPhoneNumberCountryCode) => true, | ||||||
|             ( |             ( | ||||||
|                 Self::UserCountry { |                 Self::UserCountry { | ||||||
|                     options: options_self, |                     options: options_self, | ||||||
|  | |||||||
| @ -8243,6 +8243,139 @@ impl Default for super::settings::RequiredFields { | |||||||
|                                         common : HashMap::new(), |                                         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, | ||||||
|  |                                                 } | ||||||
|  |                                             ), | ||||||
|  |                                         ]), | ||||||
|  |                                     } | ||||||
|  |                                 ) | ||||||
|                                 ]), |                                 ]), | ||||||
|                         }, |                         }, | ||||||
|                     ), |                     ), | ||||||
|  | |||||||
| @ -9262,7 +9262,7 @@ | |||||||
|           { |           { | ||||||
|             "type": "string", |             "type": "string", | ||||||
|             "enum": [ |             "enum": [ | ||||||
|               "user_country_code" |               "user_phone_number_country_code" | ||||||
|             ] |             ] | ||||||
|           }, |           }, | ||||||
|           { |           { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Swangi Kumari
					Swangi Kumari