-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): Create Payout Webhook Flow #4696
base: main
Are you sure you want to change the base?
Conversation
pub fn is_payout_event(event_code: &WebhookEventCode) -> bool { | ||
matches!( | ||
event_code, | ||
WebhookEventCode::PayoutThirdparty | WebhookEventCode::PayoutDecline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we not handling PAYOUT_REVERSED and PAYOUT_EXPIRE?
ref - https://docs.adyen.com/online-payments/online-payouts/payout-webhook/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added support for them
Self::PayoutDetails(payout_payload) => Some(OutgoingWebhookEventContent::Payout { | ||
payout_id: payout_payload.payout_id.clone(), | ||
content: masking::masked_serialize(&payout_payload) | ||
.unwrap_or(serde_json::json!({"error":"failed to serialize"})), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what we send to merchants if deserialization fails?
crates/router/src/types.rs
Outdated
@@ -420,7 +420,7 @@ impl PayoutIndividualDetailsExt for api_models::payouts::PayoutIndividualDetails | |||
#[derive(Clone, Debug, Default)] | |||
pub struct PayoutsResponseData { | |||
pub status: Option<storage_enums::PayoutStatus>, | |||
pub connector_payout_id: String, | |||
pub connector_payout_id: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO for later: make it non optional, and add new struct for connector integration if this field is not consumed in other flows
@@ -1107,6 +1108,10 @@ pub enum EventType { | |||
DisputeLost, | |||
MandateActive, | |||
MandateRevoked, | |||
PayoutSuccess, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to add PayoutCreated
? Trigger - when payout is created at connector's end.
) | ||
.await | ||
} | ||
MerchantStorageScheme::RedisKv => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dracarys18 can you review the reverse lookup bit?
Type of Change
Description
Create core flow for processing payout webhooks and send respective outgoing webhook
Additional Changes
Motivation and Context
How did you test it?
Checklist
cargo +nightly fmt --all
cargo clippy