Skip to content

Commit afae590

Browse files
refactor(connector): [Itaubank] add dynamic fields for pix (#5419)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
1 parent 94bb3e7 commit afae590

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

api-reference/openapi_spec.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9847,6 +9847,24 @@
98479847
}
98489848
}
98499849
}
9850+
},
9851+
{
9852+
"type": "string",
9853+
"enum": [
9854+
"user_pix_key"
9855+
]
9856+
},
9857+
{
9858+
"type": "string",
9859+
"enum": [
9860+
"user_cpf"
9861+
]
9862+
},
9863+
{
9864+
"type": "string",
9865+
"enum": [
9866+
"user_cnpj"
9867+
]
98509868
}
98519869
],
98529870
"description": "Possible field type of required fields in payment_method_data"

crates/api_models/src/enums.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@ pub enum FieldType {
476476
UserDateOfBirth,
477477
UserVpaId,
478478
LanguagePreference { options: Vec<String> },
479+
UserPixKey,
480+
UserCpf,
481+
UserCnpj,
479482
}
480483

481484
impl FieldType {
@@ -562,6 +565,9 @@ impl PartialEq for FieldType {
562565
) => options_self.eq(options_other),
563566
(Self::UserDateOfBirth, Self::UserDateOfBirth) => true,
564567
(Self::UserVpaId, Self::UserVpaId) => true,
568+
(Self::UserPixKey, Self::UserPixKey) => true,
569+
(Self::UserCpf, Self::UserCpf) => true,
570+
(Self::UserCnpj, Self::UserCnpj) => true,
565571
(Self::LanguagePreference { .. }, Self::LanguagePreference { .. }) => true,
566572
_unused => false,
567573
}

crates/router/src/configs/defaults.rs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8871,7 +8871,49 @@ impl Default for super::settings::RequiredFields {
88718871
}
88728872
),
88738873
])}),
8874-
])))
8874+
(enums::PaymentMethodType::Pix,
8875+
ConnectorFields {
8876+
fields: HashMap::from([
8877+
(
8878+
enums::Connector::Itaubank,
8879+
RequiredFieldFinal {
8880+
mandate: HashMap::new(),
8881+
non_mandate: HashMap::new(),
8882+
common: HashMap::from(
8883+
[
8884+
(
8885+
"payment_method_data.bank_transfer.pix.pix_key".to_string(),
8886+
RequiredFieldInfo {
8887+
required_field: "payment_method_data.bank_transfer.pix.pix_key".to_string(),
8888+
display_name: "pix_key".to_string(),
8889+
field_type: enums::FieldType::UserPixKey,
8890+
value: None,
8891+
}
8892+
),
8893+
(
8894+
"payment_method_data.bank_transfer.pix.cnpj".to_string(),
8895+
RequiredFieldInfo {
8896+
required_field: "payment_method_data.bank_transfer.pix.cnpj".to_string(),
8897+
display_name: "cnpj".to_string(),
8898+
field_type: enums::FieldType::UserCnpj,
8899+
value: None,
8900+
}
8901+
),
8902+
(
8903+
"payment_method_data.bank_transfer.pix.cpf".to_string(),
8904+
RequiredFieldInfo {
8905+
required_field: "payment_method_data.bank_transfer.pix.cpf".to_string(),
8906+
display_name: "cpf".to_string(),
8907+
field_type: enums::FieldType::UserCpf,
8908+
value: None,
8909+
}
8910+
),
8911+
]
8912+
),
8913+
}
8914+
),
8915+
])}),
8916+
])))
88758917
]))
88768918
}
88778919
}

0 commit comments

Comments
 (0)