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
feat(core): send customer date of birth to UCS as a typed field (#13973)
Tushar Shukla2cd28cabc3ff
diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rsindex c8a52f1ea1..778e7a3eb5 100644--- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs+++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs@@ -182,6 +182,7 @@ enum RequiredField {CyptoPayCurrency(Vec<&'static str>),PixDocumentType(Vec<&'static str>),PixDocumentNumber,+ CustomerDateOfBirth,BoletoSocialSecurityNumber,UpiCollectVpaId,AchBankDebitAccountNumber,@@ -734,6 +735,17 @@ impl RequiredField {value: None,},),+ // Named for the customer, not the connector: unlike `MifinityDateOfBirth` the path+ // is payment-method agnostic, so any connector that needs a date of birth reuses it.+ Self::CustomerDateOfBirth => (+ "customer.date_of_birth".to_string(),+ RequiredFieldInfo {+ required_field: "customer.date_of_birth".to_string(),+ display_name: "date_of_birth".to_string(),+ field_type: FieldType::UserDateOfBirth,+ value: None,+ },+ ),Self::PixDocumentType(document_type) => ("customer.document_details.document_type".to_string(),RequiredFieldInfo {@@ -1853,7 +1865,12 @@ fn get_cards_required_fields() -> HashMap<Connector, RequiredFieldFinal> {),(Connector::Ilixium,+ // Everything here is `common`, not `non_mandate`: `non_mandate` is only merged when+ // the payment is not customer-initiated, so a save-card or+ // `setup_future_usage = off_session` payment would collect none of these. Ilixium+ // requires all of them on every authorisation.fields(+ vec![],vec![],vec![RequiredField::CardNumber,@@ -1861,6 +1878,8 @@ fn get_cards_required_fields() -> HashMap<Connector, RequiredFieldFinal> {RequiredField::CardExpYear,RequiredField::CardCvc,RequiredField::Email,+ // Schema-mandatory. Absent, Ilixium rejects the authorisation with `VA8`.+ RequiredField::CustomerDateOfBirth,RequiredField::BillingAddressCountries(vec!["ALL"]),// Ilixium requires `customer.firstName` and `customer.surname` on every// authorisation. On a 3DS payment the billing address is the *only* source:@@ -1869,7 +1888,6 @@ fn get_cards_required_fields() -> HashMap<Connector, RequiredFieldFinal> {RequiredField::BillingFirstName("first_name", FieldType::UserFullName),RequiredField::BillingLastName("last_name", FieldType::UserFullName),],- vec![],),),(@@ -4346,3 +4364,37 @@ fn test_required_fields_to_json() {.unwrap();}}++#[cfg(feature = "v1")]+#[test]+fn ilixium_collects_date_of_birth_on_every_card_payment() {+ let ilixium = get_cards_required_fields()+ .remove(&Connector::Ilixium)+ .expect("Ilixium has a card required-fields entry");++ // `common` is the only bucket merged for both customer-initiated and one-off payments+ // (see `cards.rs`, which extends `common` with either `mandate` or `non_mandate`). Ilixium+ // rejects an authorisation missing any of these, so none of them may sit in a bucket that+ // a save-card payment would skip.+ assert!(ilixium.mandate.is_empty());+ assert!(ilixium.non_mandate.is_empty());++ let date_of_birth = ilixium+ .common+ .get("customer.date_of_birth")+ .expect("date_of_birth is schema-mandatory for Ilixium; absent, it answers VA8");+ assert_eq!(date_of_birth.display_name, "date_of_birth");+ assert!(matches!(+ date_of_birth.field_type,+ FieldType::UserDateOfBirth+ ));++ for field in [+ "payment_method_data.card.card_number",+ "email",+ "billing.address.first_name",+ "billing.address.country",+ ] {+ assert!(ilixium.common.contains_key(field), "missing {field}");+ }+}