Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(connector): Add dynamic required fields for Truelayer and Trustly (#12150)
Vani Gupta67b1b13745b1
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 45867f1ce1..fc78e13920 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -12414,12 +12414,14 @@"properties": {"trustly": {"type": "object",- "required": [- "country"- ],"properties": {"country": {- "$ref": "#/components/schemas/CountryAlpha2"+ "allOf": [+ {+ "$ref": "#/components/schemas/CountryAlpha2"+ }+ ],+ "nullable": true}}}diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex d87de66f6a..22fb385ce8 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -8154,12 +8154,14 @@"properties": {"trustly": {"type": "object",- "required": [- "country"- ],"properties": {"country": {- "$ref": "#/components/schemas/CountryAlpha2"+ "allOf": [+ {+ "$ref": "#/components/schemas/CountryAlpha2"+ }+ ],+ "nullable": true}}}diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 9b22da5060..e48f72d3a0 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -4413,9 +4413,9 @@ pub enum BankRedirectData {#[smithy(nested_value_type)]Trustly {/// The country for bank payment- #[schema(value_type = CountryAlpha2, example = "US")]- #[smithy(value_type = "CountryAlpha2")]- country: api_enums::CountryAlpha2,+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]+ #[smithy(value_type = "Option<CountryAlpha2>")]+ country: Option<api_enums::CountryAlpha2>,},#[smithy(nested_value_type)]OnlineBankingFpx {@@ -4547,7 +4547,7 @@ impl GetAddressFromPaymentMethodData for BankRedirectData {Self::Przelewy24 {billing_details, ..} => get_billing_address_inner(billing_details.as_ref(), None, None),- Self::Trustly { country } => get_billing_address_inner(None, Some(country), None),+ Self::Trustly { country } => get_billing_address_inner(None, country.as_ref(), None),Self::OnlineBankingFpx { .. }| Self::LocalBankRedirect {}| Self::OnlineBankingThailand { .. }diff --git a/crates/hyperswitch_connectors/src/connectors/truelayer.rs b/crates/hyperswitch_connectors/src/connectors/truelayer.rsindex 559cbf3e59..c4f260e51a 100644--- a/crates/hyperswitch_connectors/src/connectors/truelayer.rs+++ b/crates/hyperswitch_connectors/src/connectors/truelayer.rs@@ -1063,7 +1063,10 @@ impl webhooks::IncomingWebhook for Truelayer {static TRUELAYER_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =LazyLock::new(|| {- let supported_capture_methods = vec![enums::CaptureMethod::Automatic];+ let supported_capture_methods = vec![+ enums::CaptureMethod::Automatic,+ enums::CaptureMethod::Manual,+ ];let mut truelayer_supported_payment_methods = SupportedPaymentMethods::new();truelayer_supported_payment_methods.add(diff --git a/crates/hyperswitch_connectors/src/connectors/trustly.rs b/crates/hyperswitch_connectors/src/connectors/trustly.rsindex 1faca9f824..4d6209268e 100644--- a/crates/hyperswitch_connectors/src/connectors/trustly.rs+++ b/crates/hyperswitch_connectors/src/connectors/trustly.rs@@ -906,7 +906,10 @@ impl webhooks::IncomingWebhook for Trustly {}static TRUSTLY_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {- let supported_capture_methods = vec![enums::CaptureMethod::Automatic];+ let supported_capture_methods = vec![+ enums::CaptureMethod::Automatic,+ enums::CaptureMethod::Manual,+ ];let mut trustly_supported_payment_methods = SupportedPaymentMethods::new();trustly_supported_payment_methods.add(diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rsindex a361c7db37..414fb84b9c 100644--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs@@ -2512,9 +2512,9 @@ impl From<api_models::payments::BankRedirectData> for BankRedirectData {country,preferred_language,},- api_models::payments::BankRedirectData::Trustly { country } => Self::Trustly {- country: Some(country),- },+ api_models::payments::BankRedirectData::Trustly { country } => {+ Self::Trustly { country }+ }api_models::payments::BankRedirectData::OnlineBankingFpx { issuer } => {Self::OnlineBankingFpx { issuer }}diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rsindex 4fb9cba969..306473018b 100644--- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs+++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs@@ -1851,10 +1851,21 @@ fn get_bank_redirect_required_fields(),(enums::PaymentMethodType::OpenBanking,- connectors(vec![(- Connector::Volt,- fields(vec![], billing_name(), vec![]),- )]),+ connectors(vec![+ (Connector::Volt, fields(vec![], billing_name(), vec![])),+ (+ Connector::Truelayer,+ fields(+ vec![],+ vec![+ RequiredField::Email,+ RequiredField::BillingUserFirstName,+ RequiredField::BillingUserLastName,+ ],+ vec![],+ ),+ ),+ ]),),(enums::PaymentMethodType::Trustly,@@ -1876,6 +1887,17 @@ fn get_bank_redirect_required_fields(common: HashMap::new(),},),+ (+ Connector::Trustly,+ fields(+ vec![],+ vec![+ RequiredField::BillingAddressCountries(vec!["ALL"]),+ RequiredField::Email,+ ],+ vec![],+ ),+ ),]),),(