mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 17:47:54 +08:00
Merge branch 'main' into call-ucs-for-pre-authentication-in-authorize
This commit is contained in:
@ -3,7 +3,7 @@ use std::collections::HashMap;
|
|||||||
use api_models::{
|
use api_models::{
|
||||||
enums::{
|
enums::{
|
||||||
CountryAlpha2, FieldType,
|
CountryAlpha2, FieldType,
|
||||||
PaymentMethod::{BankTransfer, Card, Wallet},
|
PaymentMethod::{BankRedirect, BankTransfer, Card, Wallet},
|
||||||
PaymentMethodType, PayoutConnectors,
|
PaymentMethodType, PayoutConnectors,
|
||||||
},
|
},
|
||||||
payment_methods::RequiredFieldInfo,
|
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
|
// Bank Redirect
|
||||||
PaymentMethodType::Interac => {
|
PaymentMethodType::Interac => {
|
||||||
common_fields.extend(get_interac_fields(connector));
|
common_fields.extend(get_interac_fields());
|
||||||
(
|
(
|
||||||
payment_method_type,
|
payment_method_type,
|
||||||
ConnectorFields {
|
ConnectorFields {
|
||||||
@ -393,86 +412,16 @@ fn get_paypal_fields() -> HashMap<String, RequiredFieldInfo> {
|
|||||||
)])
|
)])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_interac_fields(connector: PayoutConnectors) -> HashMap<String, RequiredFieldInfo> {
|
fn get_interac_fields() -> HashMap<String, RequiredFieldInfo> {
|
||||||
match connector {
|
HashMap::from([(
|
||||||
PayoutConnectors::Loonio => HashMap::from([
|
"payout_method_data.bank_redirect.interac.email".to_string(),
|
||||||
(
|
RequiredFieldInfo {
|
||||||
"payout_method_data.bank_redirect.interac.email".to_string(),
|
required_field: "payout_method_data.bank_redirect.interac.email".to_string(),
|
||||||
RequiredFieldInfo {
|
display_name: "email".to_string(),
|
||||||
required_field: "payout_method_data.bank_redirect.interac.email".to_string(),
|
field_type: FieldType::Text,
|
||||||
display_name: "email".to_string(),
|
value: None,
|
||||||
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> {
|
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([]),
|
_ => HashMap::from([]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -360,6 +360,7 @@ pub async fn filter_payout_methods(
|
|||||||
let mut bank_transfer_hash_set: HashSet<common_enums::PaymentMethodType> = HashSet::new();
|
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 card_hash_set: HashSet<common_enums::PaymentMethodType> = HashSet::new();
|
||||||
let mut wallet_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();
|
let payout_filter_config = &state.conf.payout_method_filters.clone();
|
||||||
for mca in &filtered_mcas {
|
for mca in &filtered_mcas {
|
||||||
let payout_methods = match &mca.payment_methods_enabled {
|
let payout_methods = match &mca.payment_methods_enabled {
|
||||||
@ -408,9 +409,14 @@ pub async fn filter_payout_methods(
|
|||||||
payment_method_list_hm
|
payment_method_list_hm
|
||||||
.insert(payment_method, bank_transfer_hash_set.clone());
|
.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::CardRedirect
|
||||||
| common_enums::PaymentMethod::PayLater
|
| common_enums::PaymentMethod::PayLater
|
||||||
| common_enums::PaymentMethod::BankRedirect
|
|
||||||
| common_enums::PaymentMethod::Crypto
|
| common_enums::PaymentMethod::Crypto
|
||||||
| common_enums::PaymentMethod::BankDebit
|
| common_enums::PaymentMethod::BankDebit
|
||||||
| common_enums::PaymentMethod::Reward
|
| common_enums::PaymentMethod::Reward
|
||||||
|
|||||||
@ -20,7 +20,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- router_net
|
- router_net
|
||||||
volumes:
|
volumes:
|
||||||
- pg_data:/VAR/LIB/POSTGRESQL/DATA
|
- pg_data:/var/lib/postgresql
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=db_user
|
- POSTGRES_USER=db_user
|
||||||
- POSTGRES_PASSWORD=db_pass
|
- POSTGRES_PASSWORD=db_pass
|
||||||
|
|||||||
@ -31,7 +31,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- router_net
|
- router_net
|
||||||
volumes:
|
volumes:
|
||||||
- pg_data:/var/lib/postgresql/data
|
- pg_data:/var/lib/postgresql
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=db_user
|
- POSTGRES_USER=db_user
|
||||||
- POSTGRES_PASSWORD=db_pass
|
- POSTGRES_PASSWORD=db_pass
|
||||||
|
|||||||
Reference in New Issue
Block a user