fix(connectors): graceful response deserialization for zen#12727
fix(connectors): graceful response deserialization for zen#12727sai-harsha-vardhan wants to merge 3 commits into
Conversation
- Add #[serde(other)] Unknown variant to ZenPaymentStatus enum - Add #[serde(other)] Unknown variant to ZenActions enum - Add #[serde(other)] Unknown variant to RefundStatus enum - Handle Unknown variants in business logic match arms with warning logs - Preserve existing state when unknown statuses are encountered - Prevent HE_00 server_not_available on new enum variants
Changed Files
|
XyneSpaces
left a comment
There was a problem hiding this comment.
Review: Graceful Response Deserialization for Zen
✅ Approved
This PR applies the standard graceful deserialization fixes to the Zen connector:
-
Fix 2 (Enum catch-alls): Added
#[serde(other)] Unknownvariants to:ZenPaymentStatusZenActionsRefundStatus
-
Warning logs and safe defaults: All
Unknownvariants log warnings and return safe fallback statuses:ZenPaymentStatus::Unknown→Pending(preserves existing state)ZenActions::Unknown→Pending(preserves existing state)RefundStatus::Unknown→Pending(safe default)
💡 Findings
1. Comprehensive webhook handling
The PR correctly handles Unknown status in webhook handlers by logging a warning and returning EventNotSupported, preventing webhook processing failures.
2. Nested match handling
The inner match on ZenActions within the Pending arm correctly handles Unknown with warning logs and returns Pending.
⚠️ Note on Scope
The PR diff includes changes to the Klarna connector as well. This appears to be due to stacked/dependent branches. The implementation is correct for both connectors.
Verdict: Clean implementation following established patterns. Ready to merge.
Summary
Adds graceful response deserialization to the Zen connector to prevent HE_00 (
server_not_available) on new enum variants and unknown fields.Changes
#[serde(other)] Unknownvariant toZenPaymentStatus#[serde(other)] Unknownvariant toZenActions#[serde(other)] Unknownvariant toRefundStatusUnknownvariants in business logic match arms with warning logsFixes Applied
deny_unknown_fieldson response structs (none were present)#[serde(other)] Unknownvariants for all response enums used in business logicTesting
Pending/EventNotSupportedwithout writing to DB)