mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +08:00
feat(connector): [ADYEN] Integrate Paze (#6545)
This commit is contained in:
@ -131,6 +131,7 @@ impl ConnectorValidation for Adyen {
|
||||
},
|
||||
PaymentMethodType::Ach
|
||||
| PaymentMethodType::SamsungPay
|
||||
| PaymentMethodType::Paze
|
||||
| PaymentMethodType::Alma
|
||||
| PaymentMethodType::Bacs
|
||||
| PaymentMethodType::Givex
|
||||
@ -218,7 +219,6 @@ impl ConnectorValidation for Adyen {
|
||||
| PaymentMethodType::Pse
|
||||
| PaymentMethodType::LocalBankTransfer
|
||||
| PaymentMethodType::Efecty
|
||||
| PaymentMethodType::Paze
|
||||
| PaymentMethodType::PagoEfectivo
|
||||
| PaymentMethodType::PromptPay
|
||||
| PaymentMethodType::RedCompra
|
||||
|
||||
@ -143,6 +143,8 @@ pub struct AdyenPaymentRequest<'a> {
|
||||
amount: Amount,
|
||||
merchant_account: Secret<String>,
|
||||
payment_method: AdyenPaymentMethod<'a>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
mpi_data: Option<AdyenMpiData>,
|
||||
reference: String,
|
||||
return_url: String,
|
||||
browser_info: Option<AdyenBrowserInfo>,
|
||||
@ -168,6 +170,16 @@ pub struct AdyenPaymentRequest<'a> {
|
||||
merchant_order_reference: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct AdyenMpiData {
|
||||
directory_response: String,
|
||||
authentication_response: String,
|
||||
token_authentication_verification_value: Secret<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
eci: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct AdyenBrowserInfo {
|
||||
@ -2139,6 +2151,29 @@ impl<'a> TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)>
|
||||
};
|
||||
Ok(AdyenPaymentMethod::SamsungPay(Box::new(data)))
|
||||
}
|
||||
domain::WalletData::Paze(_) => match item.payment_method_token.clone() {
|
||||
Some(types::PaymentMethodToken::PazeDecrypt(paze_decrypted_data)) => {
|
||||
let data = AdyenCard {
|
||||
payment_type: PaymentType::NetworkToken,
|
||||
number: paze_decrypted_data.token.payment_token,
|
||||
expiry_month: paze_decrypted_data.token.token_expiration_month,
|
||||
expiry_year: paze_decrypted_data.token.token_expiration_year,
|
||||
cvc: None,
|
||||
holder_name: paze_decrypted_data
|
||||
.billing_address
|
||||
.name
|
||||
.or(item.get_optional_billing_full_name()),
|
||||
brand: Some(paze_decrypted_data.payment_card_network.clone())
|
||||
.and_then(get_adyen_card_network),
|
||||
network_payment_reference: None,
|
||||
};
|
||||
Ok(AdyenPaymentMethod::AdyenCard(Box::new(data)))
|
||||
}
|
||||
_ => Err(errors::ConnectorError::NotImplemented(
|
||||
utils::get_unimplemented_payment_method_error_message("Cybersource"),
|
||||
)
|
||||
.into()),
|
||||
},
|
||||
domain::WalletData::TwintRedirect { .. } => Ok(AdyenPaymentMethod::Twint),
|
||||
domain::WalletData::VippsRedirect { .. } => Ok(AdyenPaymentMethod::Vipps),
|
||||
domain::WalletData::DanaRedirect { .. } => Ok(AdyenPaymentMethod::Dana),
|
||||
@ -2149,7 +2184,6 @@ impl<'a> TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)>
|
||||
| domain::WalletData::GooglePayRedirect(_)
|
||||
| domain::WalletData::GooglePayThirdPartySdk(_)
|
||||
| domain::WalletData::PaypalSdk(_)
|
||||
| domain::WalletData::Paze(_)
|
||||
| domain::WalletData::WeChatPayQr(_)
|
||||
| domain::WalletData::CashappQr(_)
|
||||
| domain::WalletData::Mifinity(_) => Err(errors::ConnectorError::NotImplemented(
|
||||
@ -2655,6 +2689,7 @@ impl<'a>
|
||||
recurring_processing_model,
|
||||
browser_info,
|
||||
additional_data,
|
||||
mpi_data: None,
|
||||
telephone_number: None,
|
||||
shopper_name: None,
|
||||
shopper_email: None,
|
||||
@ -2718,6 +2753,7 @@ impl<'a>
|
||||
recurring_processing_model,
|
||||
browser_info,
|
||||
additional_data,
|
||||
mpi_data: None,
|
||||
telephone_number: None,
|
||||
shopper_name,
|
||||
shopper_email,
|
||||
@ -2773,6 +2809,7 @@ impl<'a>
|
||||
shopper_interaction,
|
||||
recurring_processing_model,
|
||||
additional_data,
|
||||
mpi_data: None,
|
||||
shopper_name: None,
|
||||
shopper_locale: None,
|
||||
shopper_email: item.router_data.get_optional_billing_email(),
|
||||
@ -2836,6 +2873,7 @@ impl<'a>
|
||||
shopper_locale: None,
|
||||
shopper_email: item.router_data.get_optional_billing_email(),
|
||||
social_security_number,
|
||||
mpi_data: None,
|
||||
telephone_number: None,
|
||||
billing_address,
|
||||
delivery_address: None,
|
||||
@ -2883,6 +2921,7 @@ impl<'a>
|
||||
shopper_interaction,
|
||||
recurring_processing_model: None,
|
||||
additional_data: None,
|
||||
mpi_data: None,
|
||||
shopper_name: None,
|
||||
shopper_locale: None,
|
||||
shopper_email: item.router_data.get_optional_billing_email(),
|
||||
@ -2934,6 +2973,7 @@ impl<'a>
|
||||
shopper_interaction,
|
||||
recurring_processing_model: None,
|
||||
additional_data: None,
|
||||
mpi_data: None,
|
||||
shopper_name: None,
|
||||
shopper_locale: None,
|
||||
shopper_email: item.router_data.get_optional_billing_email(),
|
||||
@ -2997,6 +3037,7 @@ impl<'a>
|
||||
recurring_processing_model,
|
||||
browser_info,
|
||||
additional_data,
|
||||
mpi_data: None,
|
||||
telephone_number: None,
|
||||
shopper_name: None,
|
||||
shopper_email: item.router_data.get_optional_billing_email(),
|
||||
@ -3086,6 +3127,23 @@ impl<'a>
|
||||
let shopper_email = get_shopper_email(item.router_data, store_payment_method.is_some())?;
|
||||
let billing_address =
|
||||
get_address_info(item.router_data.get_optional_billing()).and_then(Result::ok);
|
||||
let mpi_data = if let domain::WalletData::Paze(_) = wallet_data {
|
||||
match item.router_data.payment_method_token.clone() {
|
||||
Some(types::PaymentMethodToken::PazeDecrypt(paze_decrypted_data)) => {
|
||||
Some(AdyenMpiData {
|
||||
directory_response: "Y".to_string(),
|
||||
authentication_response: "Y".to_string(),
|
||||
token_authentication_verification_value: paze_decrypted_data
|
||||
.token
|
||||
.payment_account_reference,
|
||||
eci: paze_decrypted_data.eci,
|
||||
})
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
Ok(AdyenPaymentRequest {
|
||||
amount,
|
||||
merchant_account: auth_type.merchant_account,
|
||||
@ -3096,6 +3154,7 @@ impl<'a>
|
||||
recurring_processing_model,
|
||||
browser_info,
|
||||
additional_data,
|
||||
mpi_data,
|
||||
telephone_number: None,
|
||||
shopper_name: None,
|
||||
shopper_email,
|
||||
@ -3174,6 +3233,7 @@ impl<'a>
|
||||
telephone_number,
|
||||
shopper_name,
|
||||
shopper_email,
|
||||
mpi_data: None,
|
||||
shopper_locale: None,
|
||||
social_security_number: None,
|
||||
billing_address,
|
||||
@ -3230,6 +3290,7 @@ impl<'a>
|
||||
recurring_processing_model: None,
|
||||
browser_info: None,
|
||||
additional_data: None,
|
||||
mpi_data: None,
|
||||
telephone_number,
|
||||
shopper_name,
|
||||
shopper_email,
|
||||
|
||||
Reference in New Issue
Block a user