mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
feat(router): add network transaction id support for mit payments (#6245)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -121,6 +121,10 @@ pub enum RecurringDetails {
|
||||
MandateId(String),
|
||||
PaymentMethodId(String),
|
||||
ProcessorPaymentToken(ProcessorPaymentToken),
|
||||
|
||||
/// Network transaction ID and Card Details for MIT payments when payment_method_data
|
||||
/// is not stored in the application
|
||||
NetworkTransactionIdAndCardDetails(NetworkTransactionIdAndCardDetails),
|
||||
}
|
||||
|
||||
/// Processor payment token for MIT payments where payment_method_data is not available
|
||||
@ -130,3 +134,54 @@ pub struct ProcessorPaymentToken {
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq)]
|
||||
pub struct NetworkTransactionIdAndCardDetails {
|
||||
/// The card number
|
||||
#[schema(value_type = String, example = "4242424242424242")]
|
||||
pub card_number: cards::CardNumber,
|
||||
|
||||
/// The card's expiry month
|
||||
#[schema(value_type = String, example = "24")]
|
||||
pub card_exp_month: Secret<String>,
|
||||
|
||||
/// The card's expiry year
|
||||
#[schema(value_type = String, example = "24")]
|
||||
pub card_exp_year: Secret<String>,
|
||||
|
||||
/// The card holder's name
|
||||
#[schema(value_type = String, example = "John Test")]
|
||||
pub card_holder_name: Option<Secret<String>>,
|
||||
|
||||
/// The name of the issuer of card
|
||||
#[schema(example = "chase")]
|
||||
pub card_issuer: Option<String>,
|
||||
|
||||
/// The card network for the card
|
||||
#[schema(value_type = Option<CardNetwork>, example = "Visa")]
|
||||
pub card_network: Option<api_enums::CardNetwork>,
|
||||
|
||||
#[schema(example = "CREDIT")]
|
||||
pub card_type: Option<String>,
|
||||
|
||||
#[schema(example = "INDIA")]
|
||||
pub card_issuing_country: Option<String>,
|
||||
|
||||
#[schema(example = "JP_AMEX")]
|
||||
pub bank_code: Option<String>,
|
||||
|
||||
/// The card holder's nick name
|
||||
#[schema(value_type = Option<String>, example = "John Test")]
|
||||
pub nick_name: Option<Secret<String>>,
|
||||
|
||||
/// The network transaction ID provided by the card network during a CIT (Customer Initiated Transaction),
|
||||
/// where `setup_future_usage` is set to `off_session`.
|
||||
#[schema(value_type = String)]
|
||||
pub network_transaction_id: Secret<String>,
|
||||
}
|
||||
|
||||
impl RecurringDetails {
|
||||
pub fn is_network_transaction_id_and_card_details_flow(self) -> bool {
|
||||
matches!(self, Self::NetworkTransactionIdAndCardDetails(_))
|
||||
}
|
||||
}
|
||||
|
||||
@ -1133,6 +1133,15 @@ pub struct MandateIds {
|
||||
pub mandate_reference_id: Option<MandateReferenceId>,
|
||||
}
|
||||
|
||||
impl MandateIds {
|
||||
pub fn is_network_transaction_id_flow(&self) -> bool {
|
||||
matches!(
|
||||
self.mandate_reference_id,
|
||||
Some(MandateReferenceId::NetworkMandateId(_))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone)]
|
||||
pub enum MandateReferenceId {
|
||||
ConnectorMandateId(ConnectorMandateReferenceId), // mandate_id send by connector
|
||||
@ -4969,7 +4978,7 @@ pub struct PazeMetadata {
|
||||
pub enum SamsungPayCombinedMetadata {
|
||||
// This is to support the Samsung Pay decryption flow with application credentials,
|
||||
// where the private key, certificates, or any other information required for decryption
|
||||
// will be obtained from the environment variables.
|
||||
// will be obtained from the application configuration.
|
||||
ApplicationCredentials(SamsungPayApplicationCredentials),
|
||||
MerchantCredentials(SamsungPayMerchantCredentials),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user