diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 6a06b76d0e47..3b01d73e74eb 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -868,7 +868,7 @@ pub enum BankRedirectData { Bizum {}, Blik { // Blik Code - blik_code: String, + blik_code: Option, }, Eps { /// The billing details for bank redirection diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs index cebb0014064e..ec06a6d7078f 100644 --- a/crates/router/src/configs/defaults.rs +++ b/crates/router/src/configs/defaults.rs @@ -3840,6 +3840,85 @@ impl Default for super::settings::RequiredFields { ]), }, ), + ( + enums::PaymentMethodType::Blik, + ConnectorFields { + fields: HashMap::from([ + ( + enums::Connector::Adyen, + RequiredFieldFinal { + mandate: HashMap::new(), + non_mandate: HashMap::new(), + common: HashMap::from([ + ( + "payment_method_data.bank_redirect.blik.blik_code".to_string(), + RequiredFieldInfo { + required_field: "payment_method_data.bank_redirect.blik.blik_code".to_string(), + display_name: "blik_code".to_string(), + field_type: enums::FieldType::UserBlikCode, + value: None, + } + ) + ]), + } + ), + ( + enums::Connector::Stripe, + RequiredFieldFinal { + mandate: HashMap::new(), + non_mandate: HashMap::new(), + common: HashMap::from([ + ( + "payment_method_data.bank_redirect.blik.blik_code".to_string(), + RequiredFieldInfo { + required_field: "payment_method_data.bank_redirect.blik.blik_code".to_string(), + display_name: "blik_code".to_string(), + field_type: enums::FieldType::UserBlikCode, + value: None, + } + ) + ]), + } + ), + ( + enums::Connector::Trustpay, + RequiredFieldFinal { + mandate: HashMap::new(), + non_mandate: HashMap::new(), + common: HashMap::from([ + ( + "billing.address.first_name".to_string(), + RequiredFieldInfo { + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, + value: None, + } + ), + ( + "billing.address.last_name".to_string(), + RequiredFieldInfo { + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, + value: None, + } + ), + ( + "email".to_string(), + RequiredFieldInfo { + required_field: "email".to_string(), + display_name: "email".to_string(), + field_type: enums::FieldType::UserEmailAddress, + value: None, + } + ), + ]), + } + ) + ]), + }, + ), ])), ), ( diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index 708d795db0e1..94c7f0c58778 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -2034,7 +2034,11 @@ impl<'a> TryFrom<&api_models::payments::BankRedirectData> for AdyenPaymentMethod api_models::payments::BankRedirectData::Blik { blik_code } => { Ok(AdyenPaymentMethod::Blik(Box::new(BlikRedirectionData { payment_type: PaymentType::Blik, - blik_code: blik_code.to_string(), + blik_code: blik_code.clone().ok_or( + errors::ConnectorError::MissingRequiredField { + field_name: "blik_code", + }, + )?, }))) } api_models::payments::BankRedirectData::Eps { bank_name, .. } => Ok( diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs index ce434aa8ba1d..488a7a295bd2 100644 --- a/crates/router/src/connector/stripe/transformers.rs +++ b/crates/router/src/connector/stripe/transformers.rs @@ -1582,7 +1582,7 @@ impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodData { type Error = error_stack::Report; fn try_from(bank_redirect_data: &payments::BankRedirectData) -> Result { let payment_method_data_type = StripePaymentMethodType::try_from(bank_redirect_data)?; - match bank_redirect_data.deref() { + match bank_redirect_data { payments::BankRedirectData::BancontactCard { .. } => Ok(Self::BankRedirect( StripeBankRedirectData::StripeBancontactCard(Box::new(StripeBancontactCard { payment_method_data_type, @@ -1591,7 +1591,11 @@ impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodData { payments::BankRedirectData::Blik { blik_code } => Ok(Self::BankRedirect( StripeBankRedirectData::StripeBlik(Box::new(StripeBlik { payment_method_data_type, - code: blik_code.to_owned(), + code: blik_code.clone().ok_or( + errors::ConnectorError::MissingRequiredField { + field_name: "blik_code", + }, + )?, })), )), payments::BankRedirectData::Eps { bank_name, .. } => Ok(Self::BankRedirect( diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index 2bce9585fdf4..18d93628aaa4 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -2911,12 +2911,10 @@ "properties": { "blik": { "type": "object", - "required": [ - "blik_code" - ], "properties": { "blik_code": { - "type": "string" + "type": "string", + "nullable": true } } }