Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pm_list): add required fields for giropay #3194

Merged
merged 42 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bd1c1dc
add dynamic fields for sofort aci
AkshayaFoiger Dec 21, 2023
b3d0f99
add dynamic field changes for sofort aci
AkshayaFoiger Dec 21, 2023
dd67fee
add dynamic field changes for sofort aci
AkshayaFoiger Dec 21, 2023
0bd5824
add globalpay and mollie dynamic fields for sofort
AkshayaFoiger Dec 21, 2023
588c6b3
add dynamic fields for sofort
AkshayaFoiger Dec 21, 2023
8679744
chore: run formatter
hyperswitch-bot[bot] Dec 21, 2023
eb36df4
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Dec 21, 2023
289503c
add dynamic fields for aci and adyen giropay
AkshayaFoiger Dec 21, 2023
333ee50
add dynamic fields for giropay
AkshayaFoiger Dec 21, 2023
2bfb7ba
chore: run formatter
hyperswitch-bot[bot] Dec 21, 2023
701affa
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Dec 21, 2023
e790955
add mandate req field for stripe sofort
AkshayaFoiger Jan 1, 2024
678eb53
chore: run formatter
hyperswitch-bot[bot] Jan 1, 2024
4c4e0c0
Merge branch 'main' into dynamic_field/sofort
AkshayaFoiger Jan 9, 2024
bd59a2e
make fields manditory
AkshayaFoiger Jan 9, 2024
3f52d5f
Merge branch 'main' into dynamic_field/sofort
AkshayaFoiger Jan 11, 2024
51fc9a0
add mandate config and refactor stripe sofort
AkshayaFoiger Jan 11, 2024
4737bf5
refactor stripe transformer
AkshayaFoiger Jan 11, 2024
8749233
remove extra field
AkshayaFoiger Jan 11, 2024
28cb2cd
correct field path
AkshayaFoiger Jan 11, 2024
17ee23d
Update crates/router/src/connector/paypal/transformers.rs
AkshayaFoiger Jan 12, 2024
9bc80d4
Merge branch 'main' into dynamic_field/sofort
AkshayaFoiger Jan 12, 2024
1b7c138
fix clippy error
AkshayaFoiger Jan 12, 2024
2bc92a4
fix clippy error
AkshayaFoiger Jan 17, 2024
1717524
chore: run formatter
hyperswitch-bot[bot] Jan 17, 2024
6d65743
resolve comment: make stripe country req
AkshayaFoiger Jan 18, 2024
cb87d75
Update crates/router/src/configs/defaults.rs
AkshayaFoiger Jan 18, 2024
ea7eb37
add comment
AkshayaFoiger Jan 18, 2024
9c0af54
add re field for stripe
AkshayaFoiger Jan 18, 2024
5821804
chore: run formatter
hyperswitch-bot[bot] Jan 18, 2024
ab92bbf
resolve comment
AkshayaFoiger Jan 18, 2024
b5b9fc7
update default.rs
AkshayaFoiger Jan 18, 2024
29c16bd
Merge branch 'dynamic_field/sofort' into dynamic_field/giropay
AkshayaFoiger Jan 18, 2024
3a3585d
chore: run formatter
hyperswitch-bot[bot] Jan 18, 2024
c0ccd99
Merge branch 'main' into dynamic_field/sofort
AkshayaFoiger Jan 25, 2024
f8f868d
make aci country a mandatory field
AkshayaFoiger Jan 29, 2024
bdf11fc
refactor giropay required fields
AkshayaFoiger Jan 29, 2024
f87f157
Merge branch 'dynamic_field/sofort' into dynamic_field/giropay
AkshayaFoiger Jan 29, 2024
845121c
add configs
AkshayaFoiger Jan 29, 2024
d988c81
Merge branch 'main' into dynamic_field/giropay
AkshayaFoiger Jan 31, 2024
d740753
Merge branch 'main' into dynamic_field/giropay
AkshayaFoiger Feb 1, 2024
457bb72
correct the typo
AkshayaFoiger Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment
bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"} # Mandate supported payment method type and connector for bank_redirect
bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon" }
bank_redirect.giropay = {connector_list = "adyen,globalpay"}



# Required fields info used while listing the payment_method_data
Expand Down
6 changes: 4 additions & 2 deletions config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon"
wallet.google_pay.connector_list = "stripe,adyen,cybersource"
wallet.paypal.connector_list = "adyen"
bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.ideal.connector_list = "stripe,adyen,globalpay"
bank_redirect.sofort.connector_list = "stripe,adyen,globalpay"
bank_redirect.giropay.connector_list = "adyen,globalpay"


[multiple_api_version_supported_connectors]
supported_connectors = "braintree"
Expand Down
5 changes: 3 additions & 2 deletions config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon"
wallet.google_pay.connector_list = "stripe,adyen,cybersource"
wallet.paypal.connector_list = "adyen"
bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.ideal.connector_list = "stripe,adyen,globalpay"
bank_redirect.sofort.connector_list = "stripe,adyen,globalpay"
bank_redirect.giropay.connector_list = "adyen,globalpay"

[multiple_api_version_supported_connectors]
supported_connectors = "braintree"
Expand Down
6 changes: 4 additions & 2 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ pay_later.klarna.connector_list = "adyen"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon"
wallet.google_pay.connector_list = "stripe,adyen,cybersource"
wallet.paypal.connector_list = "adyen"
bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.ideal.connector_list = "stripe,adyen,globalpay"
bank_redirect.sofort.connector_list = "stripe,adyen,globalpay"
bank_redirect.giropay.connector_list = "adyen,globalpay"


[multiple_api_version_supported_connectors]
supported_connectors = "braintree"
Expand Down
1 change: 1 addition & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ bank_debit.becs = { connector_list = "gocardless"}
bank_debit.sepa = { connector_list = "gocardless"}
bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.giropay = {connector_list = "adyen,globalpay"}

[connector_request_reference_id_config]
merchant_ids_send_payment_id_as_connector_request_id = []
Expand Down
2 changes: 2 additions & 0 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ bank_debit.becs = { connector_list = "gocardless"}
bank_debit.sepa = { connector_list = "gocardless"}
bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
bank_redirect.giropay = {connector_list = "adyen,globalpay"}


[connector_customer]
connector_list = "gocardless,stax,stripe"
Expand Down
2 changes: 1 addition & 1 deletion crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ pub enum BankRedirectData {
},
Giropay {
/// The billing details for bank redirection
billing_details: BankRedirectBilling,
billing_details: Option<BankRedirectBilling>,
/// Bank account details for Giropay

#[schema(value_type = Option<String>)]
Expand Down
212 changes: 212 additions & 0 deletions crates/router/src/configs/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4480,14 +4480,226 @@ impl Default for super::settings::RequiredFields {
enums::PaymentMethodType::Giropay,
ConnectorFields {
fields: HashMap::from([
(
enums::Connector::Aci,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::from([
(
"payment_method_data.bank_redirect.giropay.country".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.bank_redirect.giropay.country".to_string(),
display_name: "country".to_string(),
field_type: enums::FieldType::UserCountry {
options: vec![
"DE".to_string(),
]},
value: None,
}
)
]),
common: HashMap::new(),
}
),
(
enums::Connector::Adyen,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
common: HashMap::new(),
}
),
Comment on lines +4504 to +4511
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if Adyen supports mandates, could you please confirm if this config is present in toml file?

[mandates.supported_payment_methods]
bank_redirect.giropay

Could you please check for other connectors?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adyen supports mandates. I will add it to the config files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, make sure you update the env files which is located at https://github.com/juspay/hyperswitch/tree/main/config/deployments

(
enums::Connector::Globalpay,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
common: HashMap::from([
("billing.address.country".to_string(),
RequiredFieldInfo {
required_field: "billing.address.country".to_string(),
display_name: "country".to_string(),
field_type: enums::FieldType::UserAddressCountry {
options: vec![
"DE".to_string(),
]
},
value: None,
}
)
]),
}
),
(
enums::Connector::Mollie,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
common: HashMap::new(),
}
),
(
enums::Connector::Nuvei,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate:HashMap::from([
(
"email".to_string(),
RequiredFieldInfo {
required_field: "email".to_string(),
display_name: "email".to_string(),
field_type: enums::FieldType::UserEmailAddress,
value: None,
}
),
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.first_name".to_string(),
display_name: "billing_first_name".to_string(),
field_type: enums::FieldType::UserBillingName,
value: None,
}
),
(
"billing.address.last_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.last_name".to_string(),
display_name: "billing_last_name".to_string(),
field_type: enums::FieldType::UserBillingName,
value: None,
}
),
(
"billing.address.country".to_string(),
RequiredFieldInfo {
required_field: "billing.address.country".to_string(),
display_name: "country".to_string(),
field_type: enums::FieldType::UserAddressCountry{
options: vec![
"DE".to_string(),
]
},
value: None,
}
)]
),
common: HashMap::new(),
}
),
(
enums::Connector::Paypal,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::from([
("payment_method_data.bank_redirect.giropay.country".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.bank_redirect.giropay.country".to_string(),
display_name: "country".to_string(),
field_type: enums::FieldType::UserCountry {
options: vec![
"DE".to_string(),
]
},
value: None,
}
),
(
"payment_method_data.bank_redirect.giropay.billing_details.billing_name".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.bank_redirect.giropay.billing_details.billing_name".to_string(),
display_name: "billing_name".to_string(),
field_type: enums::FieldType::UserBillingName,
value: None,
}
)
]),
common: HashMap::new(),
}
),
(
enums::Connector::Stripe,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::from([
("payment_method_data.bank_redirect.giropay.billing_details.billing_name".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.bank_redirect.giropay.billing_details.billing_name".to_string(),
display_name: "billing_name".to_string(),
field_type: enums::FieldType::UserBillingName,
value: None,
}
)
]),
common: HashMap::new(),
}
),
(
enums::Connector::Shift4,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
common: HashMap::new(),
}
),
(
enums::Connector::Trustpay,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::from([
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "billing.address.first_name".to_string(),
display_name: "billing_first_name".to_string(),
field_type: enums::FieldType::UserBillingName,
value: None,
}
),
(
"billing.address.line1".to_string(),
RequiredFieldInfo {
required_field: "billing.address.line1".to_string(),
display_name: "line1".to_string(),
field_type: enums::FieldType::UserAddressLine1,
value: None,
}
),
(
"billing.address.city".to_string(),
RequiredFieldInfo {
required_field: "billing.address.city".to_string(),
display_name: "city".to_string(),
field_type: enums::FieldType::UserAddressCity,
value: None,
}
),
(
"billing.address.zip".to_string(),
RequiredFieldInfo {
required_field: "billing.address.zip".to_string(),
display_name: "zip".to_string(),
field_type: enums::FieldType::UserAddressPincode,
value: None,
}
),
(
"billing.address.country".to_string(),
RequiredFieldInfo {
required_field: "billing.address.country".to_string(),
display_name: "country".to_string(),
field_type: enums::FieldType::UserAddressCountry {
options: vec![
"DE".to_string(),
]
},
value: None,
}
),
]),
common: HashMap::new(),
}
),
]),
},
),
Expand Down
7 changes: 6 additions & 1 deletion crates/router/src/connector/aci/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,15 @@ impl
api_models::payments::BankRedirectData::Giropay {
bank_account_bic,
bank_account_iban,
country,
..
} => Self::BankRedirect(Box::new(BankRedirectionPMData {
payment_brand: PaymentBrand::Giropay,
bank_account_country: Some(api_models::enums::CountryAlpha2::DE),
bank_account_country: Some(country.ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "giropay.country",
},
)?),
bank_account_bank_name: None,
bank_account_bic: bank_account_bic.clone(),
bank_account_iban: bank_account_iban.clone(),
Expand Down
7 changes: 6 additions & 1 deletion crates/router/src/connector/paypal/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@ fn get_payment_source(
country,
..
} => Ok(PaymentSourceItem::Giropay(RedirectRequest {
name: billing_details.get_billing_name()?,
name: billing_details
.clone()
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "giropay.billing_details",
})?
.get_billing_name()?,
country_code: country.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "giropay.country",
})?,
Expand Down
Loading
Loading