Merge branch 'main' into call-ucs-for-pre-authentication-in-authorize

This commit is contained in:
Hrithikesh
2025-10-24 19:16:24 +05:30
committed by GitHub
4 changed files with 98 additions and 85 deletions

View File

@ -3,7 +3,7 @@ use std::collections::HashMap;
use api_models::{
enums::{
CountryAlpha2, FieldType,
PaymentMethod::{BankTransfer, Card, Wallet},
PaymentMethod::{BankRedirect, BankTransfer, Card, Wallet},
PaymentMethodType, PayoutConnectors,
},
payment_methods::RequiredFieldInfo,
@ -62,6 +62,25 @@ impl Default for PayoutRequiredFields {
),
])),
),
(
// TODO: Refactor to support multiple connectors, each having its own set of required fields.
BankRedirect,
PaymentMethodTypeInfo(HashMap::from([{
let (pmt, mut gidadat_fields) = get_connector_payment_method_type_fields(
PayoutConnectors::Gigadat,
PaymentMethodType::Interac,
);
let (_, loonio_fields) = get_connector_payment_method_type_fields(
PayoutConnectors::Loonio,
PaymentMethodType::Interac,
);
gidadat_fields.fields.extend(loonio_fields.fields);
(pmt, gidadat_fields)
}])),
),
]))
}
}
@ -246,7 +265,7 @@ fn get_connector_payment_method_type_fields(
// Bank Redirect
PaymentMethodType::Interac => {
common_fields.extend(get_interac_fields(connector));
common_fields.extend(get_interac_fields());
(
payment_method_type,
ConnectorFields {
@ -393,10 +412,8 @@ fn get_paypal_fields() -> HashMap<String, RequiredFieldInfo> {
)])
}
fn get_interac_fields(connector: PayoutConnectors) -> HashMap<String, RequiredFieldInfo> {
match connector {
PayoutConnectors::Loonio => HashMap::from([
(
fn get_interac_fields() -> HashMap<String, RequiredFieldInfo> {
HashMap::from([(
"payout_method_data.bank_redirect.interac.email".to_string(),
RequiredFieldInfo {
required_field: "payout_method_data.bank_redirect.interac.email".to_string(),
@ -404,75 +421,7 @@ fn get_interac_fields(connector: PayoutConnectors) -> HashMap<String, RequiredFi
field_type: FieldType::Text,
value: None,
},
),
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.first_name".to_string(),
display_name: "billing_address_first_name".to_string(),
field_type: FieldType::Text,
value: None,
},
),
(
"billing.address.last_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.last_name".to_string(),
display_name: "billing_address_last_name".to_string(),
field_type: FieldType::Text,
value: None,
},
),
]),
PayoutConnectors::Gigadat => HashMap::from([
(
"payout_method_data.bank_redirect.interac.email".to_string(),
RequiredFieldInfo {
required_field: "payout_method_data.bank_redirect.interac.email".to_string(),
display_name: "email".to_string(),
field_type: FieldType::Text,
value: None,
},
),
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.first_name".to_string(),
display_name: "billing_address_first_name".to_string(),
field_type: FieldType::Text,
value: None,
},
),
(
"billing.address.last_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.last_name".to_string(),
display_name: "billing_address_last_name".to_string(),
field_type: FieldType::Text,
value: None,
},
),
(
"billing.phone.number".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.phone.number".to_string(),
display_name: "phone".to_string(),
field_type: FieldType::UserPhoneNumber,
value: None,
},
),
(
"billing.phone.country_code".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.phone.country_code".to_string(),
display_name: "dialing_code".to_string(),
field_type: FieldType::UserPhoneNumberCountryCode,
value: None,
},
),
]),
_ => HashMap::from([]),
}
)])
}
fn get_countries_for_connector(connector: PayoutConnectors) -> Vec<CountryAlpha2> {
@ -639,6 +588,64 @@ fn get_billing_details(connector: PayoutConnectors) -> HashMap<String, RequiredF
},
),
]),
PayoutConnectors::Loonio => HashMap::from([
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.first_name".to_string(),
display_name: "billing_address_first_name".to_string(),
field_type: FieldType::Text,
value: None,
},
),
(
"billing.address.last_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.last_name".to_string(),
display_name: "billing_address_last_name".to_string(),
field_type: FieldType::Text,
value: None,
},
),
]),
PayoutConnectors::Gigadat => HashMap::from([
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.first_name".to_string(),
display_name: "billing_address_first_name".to_string(),
field_type: FieldType::Text,
value: None,
},
),
(
"billing.address.last_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.last_name".to_string(),
display_name: "billing_address_last_name".to_string(),
field_type: FieldType::Text,
value: None,
},
),
(
"billing.phone.number".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.phone.number".to_string(),
display_name: "phone".to_string(),
field_type: FieldType::UserPhoneNumber,
value: None,
},
),
(
"billing.phone.country_code".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.phone.country_code".to_string(),
display_name: "dialing_code".to_string(),
field_type: FieldType::UserPhoneNumberCountryCode,
value: None,
},
),
]),
_ => HashMap::from([]),
}
}

View File

@ -360,6 +360,7 @@ pub async fn filter_payout_methods(
let mut bank_transfer_hash_set: HashSet<common_enums::PaymentMethodType> = HashSet::new();
let mut card_hash_set: HashSet<common_enums::PaymentMethodType> = HashSet::new();
let mut wallet_hash_set: HashSet<common_enums::PaymentMethodType> = HashSet::new();
let mut bank_redirect_hash_set: HashSet<common_enums::PaymentMethodType> = HashSet::new();
let payout_filter_config = &state.conf.payout_method_filters.clone();
for mca in &filtered_mcas {
let payout_methods = match &mca.payment_methods_enabled {
@ -408,9 +409,14 @@ pub async fn filter_payout_methods(
payment_method_list_hm
.insert(payment_method, bank_transfer_hash_set.clone());
}
common_enums::PaymentMethod::BankRedirect => {
bank_redirect_hash_set
.insert(request_payout_method_type.payment_method_type);
payment_method_list_hm
.insert(payment_method, bank_redirect_hash_set.clone());
}
common_enums::PaymentMethod::CardRedirect
| common_enums::PaymentMethod::PayLater
| common_enums::PaymentMethod::BankRedirect
| common_enums::PaymentMethod::Crypto
| common_enums::PaymentMethod::BankDebit
| common_enums::PaymentMethod::Reward

View File

@ -20,7 +20,7 @@ services:
networks:
- router_net
volumes:
- pg_data:/VAR/LIB/POSTGRESQL/DATA
- pg_data:/var/lib/postgresql
environment:
- POSTGRES_USER=db_user
- POSTGRES_PASSWORD=db_pass

View File

@ -31,7 +31,7 @@ services:
networks:
- router_net
volumes:
- pg_data:/var/lib/postgresql/data
- pg_data:/var/lib/postgresql
environment:
- POSTGRES_USER=db_user
- POSTGRES_PASSWORD=db_pass