Skip to content

Commit

Permalink
feat(payments): add outgoing payments webhooks (#3133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Narayanbhat166 authored and lsampras committed Dec 15, 2023
1 parent 79f6b9f commit fab5955
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions crates/router/src/core/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub async fn payments_operation_core<F, Req, Op, FData, Ctx>(
)>
where
F: Send + Clone + Sync,
Req: Authenticate,
Req: Authenticate + Clone,
Op: Operation<F, Req, Ctx> + Send + Sync,

// To create connector flow specific interface data
Expand Down Expand Up @@ -423,6 +423,23 @@ where
.await?;
}

let cloned_payment_data = payment_data.clone();
let cloned_customer = customer.clone();
let cloned_request = req.clone();

crate::utils::trigger_payments_webhook(
merchant_account,
business_profile,
cloned_payment_data,
Some(cloned_request),
cloned_customer,
state,
operation,
)
.await
.map_err(|error| logger::warn!(payments_outgoing_webhook_error=?error))
.ok();

Ok((
payment_data,
req,
Expand Down Expand Up @@ -624,7 +641,7 @@ where
F: Send + Clone + Sync,
FData: Send + Sync,
Op: Operation<F, Req, Ctx> + Send + Sync + Clone,
Req: Debug + Authenticate,
Req: Debug + Authenticate + Clone,
Res: transformers::ToResponse<Req, PaymentData<F>, Op>,
// To create connector flow specific interface data
PaymentData<F>: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
Expand Down

0 comments on commit fab5955

Please sign in to comment.