Skip to content

Commit

Permalink
add mandatory fields for blik pm for trustpay
Browse files Browse the repository at this point in the history
  • Loading branch information
prasunna09 committed Sep 28, 2023
1 parent fd4318c commit d03e0d7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 14 deletions.
44 changes: 36 additions & 8 deletions crates/router/src/configs/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3880,14 +3880,42 @@ impl Default for super::settings::RequiredFields {
]),
}
),
// (
// enums::Connector::Trustpay,
// RequiredFieldFinal {
// mandate: HashMap::new(),
// non_mandate: HashMap::new(),
// common: HashMap::new(),
// }
// )
(
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,
}
),
]),
}
)
]),
},
),
Expand Down
8 changes: 5 additions & 3 deletions crates/router/src/connector/adyen/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2034,9 +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.clone().ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "blik_code",
})?,
blik_code: blik_code.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "blik_code",
},
)?,
})))
}
api_models::payments::BankRedirectData::Eps { bank_name, .. } => Ok(
Expand Down
8 changes: 5 additions & 3 deletions crates/router/src/connector/stripe/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1591,9 +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.clone().ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "blik_code",
})?,
code: blik_code.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "blik_code",
},
)?,
})),
)),
payments::BankRedirectData::Eps { bank_name, .. } => Ok(Self::BankRedirect(
Expand Down

0 comments on commit d03e0d7

Please sign in to comment.