fix(connectors): graceful response deserialization for payme#12712
fix(connectors): graceful response deserialization for payme#12712sai-harsha-vardhan wants to merge 1 commit into
Conversation
Changed Files
|
XyneSpaces
left a comment
There was a problem hiding this comment.
Review: Payme Graceful Response Deserialization
✅ Approved
This PR applies the standard graceful response deserialization fixes to the Payme connector:
Fix 2 (Enum catch-alls):
SaleStatus: Added#[serde(other)] Unknown→ mapped toAttemptStatus::Pending/RefundStatus::PendingNotifyType: Added#[serde(other)] Unknown→ mapped toIncomingWebhookEvent::EventNotSupportedPaymePaymentsResponse: AddedUnknown(serde_json::Value)variant → preserves existing state
Fix 3 (Cleanup unused code):
- Removed unused
PaymeMetadatastruct
Webhook handlers updated:
get_webhook_object_reference_id: HandlesNotifyType::Unknownget_webhook_resource_object: HandlesNotifyType::Unknown
💡 Findings
1. Comprehensive webhook handling
Both webhook trait methods (get_webhook_object_reference_id and get_webhook_resource_object) now handle NotifyType::Unknown with appropriate warning logs.
2. Response variant handling
The PaymePaymentsResponse::Unknown variant correctly logs the received value and returns Ok(item.data) to preserve existing state.
3. Refund status mapping
SaleStatus::Unknown during refund processing maps to RefundStatus::Pending with a warning log.
Note: The PR description mentions Mollie connector changes but the diff shows only Payme changes. The Mollie changes may be in a separate commit or the description needs updating.
Verdict: Clean implementation following established patterns. Ready to merge.
Summary
This PR applies the three standard "graceful response deserialization" fixes to the Payme connector to prevent production SEV-1/SEV-2 incidents caused by unexpected connector API response changes.
Changes
PaymeMetadatastruct (Fix 3 — unused opaque fields)#[serde(other)] UnknowntoSaleStatusenum and mapped it toAttemptStatus::Pending/RefundStatus::Pendingwith logging (Fix 2)#[serde(other)] UnknowntoNotifyTypeenum and mapped it toIncomingWebhookEvent::EventNotSupportedwith logging (Fix 2)Unknown(serde_json::Value)variant toPaymePaymentsResponseenum and preserved existing state in match arm (Fix 2)get_webhook_object_reference_id,get_webhook_resource_object) to handleNotifyType::UnknownRefundStatus::try_from(SaleStatus)to handleSaleStatus::UnknownResponse structs affected (no
deny_unknown_fieldsfound):CaptureBuyerResponseGenerateSaleResponsePaymePaymentsResponseSaleQueryResponseSaleQueryPaymePaySaleResponsePaymeRefundResponsePaymeVoidResponsePaymeQueryTransactionResponseTransactionQueryPaymeErrorResponseWebhookEventDataResourceWebhookEventDataResourceEventWebhookEventDataResourceSignatureTesting
Related Issue
HYP-28