Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(connector): [Fiuu] Fix Fiuu refund webhook parsing for numeric IDs (#13257)
Vani Gupta48979643a80f
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rsindex c41d88c9b0..0191f9b237 100644--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs@@ -1862,7 +1862,10 @@ pub enum FiuuRefundSyncResponse {#[derive(Debug, Clone, Serialize, Deserialize)]#[serde(rename_all = "PascalCase")]pub struct RefundData {- #[serde(rename = "RefundID")]+ #[serde(+ rename = "RefundID",+ deserialize_with = "deserialize_string_from_number_or_string"+ )]refund_id: String,status: RefundStatus,}@@ -2015,15 +2018,38 @@ pub struct FiuuWebhooksRefundResponse {pub merchant_id: Secret<String>,#[serde(rename = "RefID")]pub ref_id: String,- #[serde(rename = "RefundID")]+ #[serde(+ rename = "RefundID",+ deserialize_with = "deserialize_string_from_number_or_string"+ )]pub refund_id: String,- #[serde(rename = "TxnID")]+ #[serde(+ rename = "TxnID",+ deserialize_with = "deserialize_string_from_number_or_string"+ )]pub txn_id: String,pub amount: StringMajorUnit,pub status: FiuuRefundsWebhookStatus,pub signature: Secret<String>,}+fn deserialize_string_from_number_or_string<'de, D>(deserializer: D) -> Result<String, D::Error>+where+ D: serde::Deserializer<'de>,+{+ #[derive(Deserialize)]+ #[serde(untagged)]+ enum StringOrNumber {+ String(String),+ Number(serde_json::Number),+ }++ match StringOrNumber::deserialize(deserializer)? {+ StringOrNumber::String(value) => Ok(value),+ StringOrNumber::Number(value) => Ok(value.to_string()),+ }+}+#[derive(Debug, Deserialize, Serialize, Clone, strum::Display)]pub enum FiuuRefundsWebhookStatus {#[strum(serialize = "00")]