mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 20:23:43 +08:00
feat(connector): [ACI] Implement Trustly Bank Redirect (#1130)
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -2970,7 +2970,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opentelemetry"
|
||||
version = "0.18.0"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
dependencies = [
|
||||
"opentelemetry_api",
|
||||
"opentelemetry_sdk",
|
||||
@ -2979,7 +2979,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opentelemetry-otlp"
|
||||
version = "0.11.0"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"futures",
|
||||
@ -2996,7 +2996,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opentelemetry-proto"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"futures-util",
|
||||
@ -3008,7 +3008,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opentelemetry_api"
|
||||
version = "0.18.0"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"futures-channel",
|
||||
@ -3023,7 +3023,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opentelemetry_sdk"
|
||||
version = "0.18.0"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"crossbeam-channel",
|
||||
|
||||
@ -670,7 +670,11 @@ pub enum BankRedirectData {
|
||||
preferred_language: String,
|
||||
},
|
||||
Swish {},
|
||||
Trustly {},
|
||||
Trustly {
|
||||
/// The country for bank payment
|
||||
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||
country: api_enums::CountryAlpha2,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
|
||||
@ -74,8 +74,13 @@ pub struct BankRedirectionPMData {
|
||||
bank_account_bic: Option<Secret<String>>,
|
||||
#[serde(rename = "bankAccount.iban")]
|
||||
bank_account_iban: Option<Secret<String>>,
|
||||
#[serde(rename = "billing.country")]
|
||||
billing_country: Option<api_models::enums::CountryAlpha2>,
|
||||
#[serde(rename = "customer.email")]
|
||||
customer_email: Option<Email>,
|
||||
#[serde(rename = "customer.merchantCustomerId")]
|
||||
merchant_customer_id: Option<Secret<String>>,
|
||||
merchant_transaction_id: Option<Secret<String>>,
|
||||
shopper_result_url: Option<String>,
|
||||
}
|
||||
|
||||
@ -151,6 +156,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
||||
bank_account_bank_name: None,
|
||||
bank_account_bic: None,
|
||||
bank_account_iban: None,
|
||||
billing_country: None,
|
||||
merchant_customer_id: None,
|
||||
merchant_transaction_id: None,
|
||||
customer_email: None,
|
||||
shopper_result_url: item.request.router_return_url.clone(),
|
||||
}))
|
||||
@ -165,6 +173,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
||||
bank_account_bank_name: None,
|
||||
bank_account_bic: bank_account_bic.clone(),
|
||||
bank_account_iban: bank_account_iban.clone(),
|
||||
billing_country: None,
|
||||
merchant_customer_id: None,
|
||||
merchant_transaction_id: None,
|
||||
customer_email: None,
|
||||
shopper_result_url: item.request.router_return_url.clone(),
|
||||
})),
|
||||
@ -175,6 +186,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
||||
bank_account_bank_name: Some(bank_name.to_string()),
|
||||
bank_account_bic: None,
|
||||
bank_account_iban: None,
|
||||
billing_country: None,
|
||||
merchant_customer_id: None,
|
||||
merchant_transaction_id: None,
|
||||
customer_email: None,
|
||||
shopper_result_url: item.request.router_return_url.clone(),
|
||||
}))
|
||||
@ -186,6 +200,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
||||
bank_account_bank_name: None,
|
||||
bank_account_bic: None,
|
||||
bank_account_iban: None,
|
||||
billing_country: None,
|
||||
merchant_customer_id: None,
|
||||
merchant_transaction_id: None,
|
||||
customer_email: None,
|
||||
shopper_result_url: item.request.router_return_url.clone(),
|
||||
}))
|
||||
@ -197,6 +214,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
||||
bank_account_bank_name: None,
|
||||
bank_account_bic: None,
|
||||
bank_account_iban: None,
|
||||
billing_country: None,
|
||||
merchant_customer_id: None,
|
||||
merchant_transaction_id: None,
|
||||
customer_email: Some(email.to_owned()),
|
||||
|
||||
shopper_result_url: item.request.router_return_url.clone(),
|
||||
@ -209,10 +229,33 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
||||
bank_account_bank_name: None,
|
||||
bank_account_bic: None,
|
||||
bank_account_iban: None,
|
||||
billing_country: None,
|
||||
merchant_customer_id: None,
|
||||
merchant_transaction_id: None,
|
||||
customer_email: Some(email.to_owned()),
|
||||
shopper_result_url: item.request.router_return_url.clone(),
|
||||
}))
|
||||
}
|
||||
api_models::payments::BankRedirectData::Trustly { country } => {
|
||||
PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
|
||||
payment_brand: PaymentBrand::Trustly,
|
||||
bank_account_country: None,
|
||||
bank_account_bank_name: None,
|
||||
bank_account_bic: None,
|
||||
bank_account_iban: None,
|
||||
billing_country: Some(*country),
|
||||
merchant_customer_id: Some(Secret::new(
|
||||
item.customer_id.clone().ok_or(
|
||||
errors::ConnectorError::MissingRequiredField {
|
||||
field_name: "customer_id",
|
||||
},
|
||||
)?,
|
||||
)),
|
||||
merchant_transaction_id: Some(Secret::new(item.payment_id.clone())),
|
||||
customer_email: None,
|
||||
shopper_result_url: item.request.router_return_url.clone(),
|
||||
}))
|
||||
}
|
||||
_ => Err(errors::ConnectorError::NotImplemented(
|
||||
"Payment method".to_string(),
|
||||
))?,
|
||||
|
||||
@ -1165,11 +1165,11 @@ impl<'a> TryFrom<&api_models::payments::BankRedirectData> for AdyenPaymentMethod
|
||||
payment_type: PaymentType::Sofort,
|
||||
})),
|
||||
),
|
||||
api_models::payments::BankRedirectData::Trustly {} => Ok(AdyenPaymentMethod::Trustly(
|
||||
Box::new(BankRedirectionPMData {
|
||||
api_models::payments::BankRedirectData::Trustly { .. } => Ok(
|
||||
AdyenPaymentMethod::Trustly(Box::new(BankRedirectionPMData {
|
||||
payment_type: PaymentType::Trustly,
|
||||
}),
|
||||
)),
|
||||
})),
|
||||
),
|
||||
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user