feat(connector): [Adyen] Add support for Samsung Pay (#1525)

This commit is contained in:
Sangamesh Kulkarni
2023-06-28 14:34:49 +05:30
committed by GitHub
parent 6bc4188ff9
commit 33309daf5c
6 changed files with 578 additions and 343 deletions

View File

@ -442,6 +442,7 @@ pub enum PaymentMethodType {
PayBright,
Paypal,
Przelewy24,
SamsungPay,
Sepa,
Sofort,
Swish,

View File

@ -845,10 +845,20 @@ pub enum WalletData {
PaypalRedirect(PaypalRedirection),
/// The wallet data for Paypal
PaypalSdk(PayPalWalletData),
/// The wallet data for Samsung Pay
SamsungPay(Box<SamsungPayWalletData>),
/// The wallet data for WeChat Pay Redirection
WeChatPayRedirect(Box<WeChatPayRedirection>),
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct SamsungPayWalletData {
/// The encrypted payment token from Samsung
#[schema(value_type = String)]
pub token: Secret<String>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct GooglePayWalletData {

View File

@ -284,6 +284,7 @@ pub enum AdyenPaymentMethod<'a> {
#[serde(rename = "sepadirectdebit")]
SepaDirectDebit(Box<SepaDirectDebitData>),
BacsDirectDebit(Box<BacsDirectDebitData>),
SamsungPay(Box<SamsungPayPmData>),
}
#[derive(Debug, Clone, Serialize)]
@ -360,6 +361,14 @@ pub struct WalleyData {
payment_type: PaymentType,
}
#[derive(Debug, Clone, Serialize)]
pub struct SamsungPayPmData {
#[serde(rename = "type")]
payment_type: PaymentType,
#[serde(rename = "samsungPayToken")]
samsung_pay_token: Secret<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct PayBrightData {
#[serde(rename = "type")]
@ -690,6 +699,7 @@ pub enum PaymentType {
SepaDirectDebit,
#[serde(rename = "directdebit_GB")]
BacsDirectDebit,
Samsungpay,
}
pub struct AdyenTestBankNames<'a>(&'a str);
@ -1097,6 +1107,13 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {
};
Ok(AdyenPaymentMethod::WeChatPayWeb(Box::new(data)))
}
api_models::payments::WalletData::SamsungPay(samsung_data) => {
let data = SamsungPayPmData {
payment_type: PaymentType::Samsungpay,
samsung_pay_token: samsung_data.token.to_owned(),
};
Ok(AdyenPaymentMethod::SamsungPay(Box::new(data)))
}
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
}
}

View File

@ -222,6 +222,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::ApplepaySessionTokenResponse,
api_models::payments::SdkNextAction,
api_models::payments::NextActionCall,
api_models::payments::SamsungPayWalletData,
api_models::payments::GpayTokenizationData,
api_models::payments::GooglePayPaymentMethodInfo,
api_models::payments::ApplePayWalletData,

View File

@ -701,6 +701,7 @@ pub enum PaymentMethodType {
PayBright,
Paypal,
Przelewy24,
SamsungPay,
Sepa,
Sofort,
Swish,

File diff suppressed because it is too large Load Diff