refactor(router): add revenue_recovery_metadata to payment intent in diesel and api model for v2 flow (#7176)

Co-authored-by: Nishanth Challa <nishanth.challa@Nishanth-Challa-C0WGKCFHLF.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
CHALLA NISHANTH BABU
2025-02-14 16:19:58 +05:30
committed by GitHub
parent fbbbe3eb90
commit 2ee22cdf8a
6 changed files with 285 additions and 3 deletions

View File

@ -5,6 +5,8 @@ use std::{
};
pub mod additional_info;
use cards::CardNumber;
#[cfg(feature = "v2")]
use common_enums::enums::PaymentConnectorTransmission;
use common_enums::ProductType;
#[cfg(feature = "v2")]
use common_utils::id_type::GlobalPaymentId;
@ -7111,12 +7113,28 @@ pub struct PaymentsStartRequest {
}
/// additional data that might be required by hyperswitch
#[cfg(feature = "v2")]
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct FeatureMetadata {
/// Redirection response coming in request as metadata field only for redirection scenarios
#[schema(value_type = Option<RedirectResponse>)]
pub redirect_response: Option<RedirectResponse>,
/// Additional tags to be used for global search
#[schema(value_type = Option<Vec<String>>)]
pub search_tags: Option<Vec<HashedString<WithType>>>,
/// Recurring payment details required for apple pay Merchant Token
pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
/// revenue recovery data for payment intent
pub payment_revenue_recovery_metadata: Option<PaymentRevenueRecoveryMetadata>,
}
/// additional data that might be required by hyperswitch
#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct FeatureMetadata {
/// Redirection response coming in request as metadata field only for redirection scenarios
#[schema(value_type = Option<RedirectResponse>)]
pub redirect_response: Option<RedirectResponse>,
// TODO: Convert this to hashedstrings to avoid PII sensitive data
/// Additional tags to be used for global search
#[schema(value_type = Option<Vec<String>>)]
pub search_tags: Option<Vec<HashedString<WithType>>>,
@ -7977,3 +7995,36 @@ mod billing_from_payment_method_data {
assert!(billing_details.is_none());
}
}
#[cfg(feature = "v2")]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct PaymentRevenueRecoveryMetadata {
/// Total number of billing connector + recovery retries for a payment intent.
#[schema(value_type = u16,example = "1")]
pub total_retry_count: u16,
/// Flag for the payment connector's call
pub payment_connector_transmission: PaymentConnectorTransmission,
/// Billing Connector Id to update the invoices
#[schema(value_type = String, example = "mca_1234567890")]
pub billing_connector_id: id_type::MerchantConnectorAccountId,
/// Payment Connector Id to retry the payments
#[schema(value_type = String, example = "mca_1234567890")]
pub active_attempt_payment_connector_id: id_type::MerchantConnectorAccountId,
/// Billing Connector Payment Details
#[schema(value_type = BillingConnectorPaymentDetails)]
pub billing_connector_payment_details: BillingConnectorPaymentDetails,
/// Payment Method Type
#[schema(example = "pay_later", value_type = PaymentMethod)]
pub payment_method_type: common_enums::PaymentMethod,
/// PaymentMethod Subtype
#[schema(example = "klarna", value_type = PaymentMethodType)]
pub payment_method_subtype: common_enums::PaymentMethodType,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[cfg(feature = "v2")]
pub struct BillingConnectorPaymentDetails {
/// Payment Processor Token to process the Revenue Recovery Payment
pub payment_processor_token: String,
/// Billing Connector's Customer Id
pub connector_customer_id: String,
}