feat(payouts): apple pay decrypt payout (#9857)

This commit is contained in:
Sakil Mostak
2025-10-16 12:29:32 +05:30
committed by GitHub
parent 1f34f89063
commit e7dee751b5
22 changed files with 818 additions and 4 deletions

View File

@ -56,6 +56,7 @@ pub enum PayoutConnectors {
Paypal,
Stripe,
Wise,
Worldpay,
}
#[cfg(feature = "v2")]
@ -85,6 +86,7 @@ impl From<PayoutConnectors> for RoutableConnectors {
PayoutConnectors::Paypal => Self::Paypal,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
PayoutConnectors::Worldpay => Self::Worldpay,
}
}
}
@ -105,6 +107,7 @@ impl From<PayoutConnectors> for Connector {
PayoutConnectors::Paypal => Self::Paypal,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
PayoutConnectors::Worldpay => Self::Worldpay,
}
}
}
@ -125,6 +128,7 @@ impl TryFrom<Connector> for PayoutConnectors {
Connector::Paypal => Ok(Self::Paypal),
Connector::Stripe => Ok(Self::Stripe),
Connector::Wise => Ok(Self::Wise),
Connector::Worldpay => Ok(Self::Worldpay),
_ => Err(format!("Invalid payout connector {value}")),
}
}

View File

@ -375,6 +375,7 @@ pub struct PixBankTransfer {
#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum Wallet {
ApplePayDecrypt(ApplePayDecrypt),
Paypal(Paypal),
Venmo(Venmo),
}
@ -414,6 +415,25 @@ pub struct Venmo {
pub telephone_number: Option<Secret<String>>,
}
#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]
pub struct ApplePayDecrypt {
/// The dpan number associated with card number
#[schema(value_type = String, example = "4242424242424242")]
pub dpan: CardNumber,
/// The card's expiry month
#[schema(value_type = String)]
pub expiry_month: Secret<String>,
/// The card's expiry year
#[schema(value_type = String)]
pub expiry_year: Secret<String>,
/// The card holder's name
#[schema(value_type = String, example = "John Doe")]
pub card_holder_name: Option<Secret<String>>,
}
#[derive(Debug, ToSchema, Clone, Serialize, router_derive::PolymorphicSchema)]
#[serde(deny_unknown_fields)]
pub struct PayoutCreateResponse {
@ -1000,6 +1020,18 @@ impl From<Wallet> for payout_method_utils::WalletAdditionalData {
telephone_number: telephone_number.map(From::from),
}))
}
Wallet::ApplePayDecrypt(ApplePayDecrypt {
expiry_month,
expiry_year,
card_holder_name,
..
}) => Self::ApplePayDecrypt(Box::new(
payout_method_utils::ApplePayDecryptAdditionalData {
card_exp_month: expiry_month,
card_exp_year: expiry_year,
card_holder_name,
},
)),
}
}
}