fix(payments): add connector metadata parsing and order category to payment router data (#9825)

This commit is contained in:
Ayush Anand
2025-10-16 15:11:40 +05:30
committed by GitHub
parent bd85334544
commit 6f045d84f1
8 changed files with 72 additions and 45 deletions

View File

@ -459,7 +459,7 @@ pub struct PaymentsUpdateIntentRequest {
/// Some connectors like Apple pay, Airwallex and Noon might require some additional information, find specific details in the child attributes below.
#[schema(value_type = Option<ConnectorMetadata>)]
pub connector_metadata: Option<pii::SecretSerdeValue>,
pub connector_metadata: Option<ConnectorMetadata>,
/// Additional data that might be required by hyperswitch based on the requested features by the merchants.
#[schema(value_type = Option<FeatureMetadata>)]
@ -634,7 +634,7 @@ pub struct PaymentsIntentResponse {
/// Some connectors like Apple pay, Airwallex and Noon might require some additional information, find specific details in the child attributes below.
#[schema(value_type = Option<ConnectorMetadata>)]
pub connector_metadata: Option<pii::SecretSerdeValue>,
pub connector_metadata: Option<ConnectorMetadata>,
/// Additional data that might be required by hyperswitch based on the requested features by the merchants.
#[schema(value_type = Option<FeatureMetadata>)]
@ -7558,7 +7558,7 @@ pub struct ApplepaySessionRequest {
}
/// Some connectors like Apple Pay, Airwallex and Noon might require some additional information, find specific details in the child attributes below.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ConnectorMetadata {
pub apple_pay: Option<ApplepayConnectorMetadataRequest>,
pub airwallex: Option<AirwallexData>,
@ -7593,18 +7593,18 @@ impl ConnectorMetadata {
}
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct AirwallexData {
/// payload required by airwallex
payload: Option<String>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct NoonData {
/// Information about the order category that merchant wants to specify at connector level. (e.g. In Noon Payments it can take values like "pay", "food", or any other custom string set by the merchant in Noon's Dashboard)
pub order_category: Option<String>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct BraintreeData {
/// Information about the merchant_account_id that merchant wants to specify at connector level.
#[schema(value_type = String)]
@ -7614,19 +7614,19 @@ pub struct BraintreeData {
pub merchant_config_currency: Option<api_enums::Currency>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct AdyenConnectorMetadata {
pub testing: AdyenTestingData,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct AdyenTestingData {
/// Holder name to be sent to Adyen for a card payment(CIT) or a generic payment(MIT). This value overrides the values for card.card_holder_name and applies during both CIT and MIT payment transactions.
#[schema(value_type = String)]
pub holder_name: Option<Secret<String>>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ApplepayConnectorMetadataRequest {
pub session_token_data: Option<SessionTokenInfo>,
}
@ -7674,7 +7674,7 @@ pub struct PaymentRequestMetadata {
pub label: String,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct SessionTokenInfo {
#[schema(value_type = String)]
pub certificate: Secret<String>,
@ -7690,14 +7690,14 @@ pub struct SessionTokenInfo {
pub payment_processing_details_at: Option<PaymentProcessingDetailsAt>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Display, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Display, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum ApplepayInitiative {
Web,
Ios,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
#[serde(tag = "payment_processing_details_at")]
pub enum PaymentProcessingDetailsAt {
Hyperswitch(PaymentProcessingDetails),