Skip to content

fix(connectors): graceful response deserialization for zen#12727

Open
sai-harsha-vardhan wants to merge 3 commits into
mainfrom
fix-zen-response-deserialization
Open

fix(connectors): graceful response deserialization for zen#12727
sai-harsha-vardhan wants to merge 3 commits into
mainfrom
fix-zen-response-deserialization

Conversation

@sai-harsha-vardhan

Copy link
Copy Markdown
Contributor

Summary

Adds graceful response deserialization to the Zen connector to prevent HE_00 (server_not_available) on new enum variants and unknown fields.

Changes

  • Added #[serde(other)] Unknown variant to ZenPaymentStatus
  • Added #[serde(other)] Unknown variant to ZenActions
  • Added #[serde(other)] Unknown variant to RefundStatus
  • Handled all Unknown variants in business logic match arms with warning logs
  • Preserved existing state when unknown statuses are encountered instead of failing

Fixes Applied

  • Fix 1: No deny_unknown_fields on response structs (none were present)
  • Fix 2: Catch-all #[serde(other)] Unknown variants for all response enums used in business logic
  • Fix 3: N/A for this connector (all fields are used in business logic)

Testing

  • Manual review of match arms confirms no state mutation for Unknown variants
  • Existing state is preserved (returns Pending / EventNotSupported without writing to DB)

Connector Engineer added 2 commits June 11, 2026 21:02
- 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
@sai-harsha-vardhan sai-harsha-vardhan requested a review from a team as a code owner June 11, 2026 15:34
@semanticdiff-com

semanticdiff-com Bot commented Jun 11, 2026

Copy link
Copy Markdown

@XyneSpaces XyneSpaces left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Graceful Response Deserialization for Zen

✅ Approved

This PR applies the standard graceful deserialization fixes to the Zen connector:

  1. Fix 2 (Enum catch-alls): Added #[serde(other)] Unknown variants to:

    • ZenPaymentStatus
    • ZenActions
    • RefundStatus
  2. Warning logs and safe defaults: All Unknown variants log warnings and return safe fallback statuses:

    • ZenPaymentStatus::UnknownPending (preserves existing state)
    • ZenActions::UnknownPending (preserves existing state)
    • RefundStatus::UnknownPending (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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants