feat(router): add payment incoming webhooks support for v2 (#6551)

Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in>
This commit is contained in:
Sai Harsha Vardhan
2024-11-19 13:13:58 +05:30
committed by GitHub
parent 65bf75a75e
commit 8e9c3ec893
25 changed files with 1271 additions and 9 deletions

View File

@ -60,10 +60,16 @@ pub enum ApiEventsType {
PaymentMethodList {
payment_id: Option<String>,
},
#[cfg(feature = "v1")]
Webhooks {
connector: String,
payment_id: Option<id_type::PaymentId>,
},
#[cfg(feature = "v2")]
Webhooks {
connector: id_type::MerchantConnectorAccountId,
payment_id: Option<id_type::GlobalPaymentId>,
},
Routing,
ResourceListAPI,
#[cfg(feature = "v1")]

View File

@ -66,3 +66,16 @@ impl GlobalAttemptId {
self.0.get_string_repr()
}
}
impl TryFrom<std::borrow::Cow<'static, str>> for GlobalAttemptId {
type Error = error_stack::Report<errors::ValidationError>;
fn try_from(value: std::borrow::Cow<'static, str>) -> Result<Self, Self::Error> {
use error_stack::ResultExt;
let global_attempt_id = super::GlobalId::from_string(value).change_context(
errors::ValidationError::IncorrectValueProvided {
field_name: "payment_id",
},
)?;
Ok(Self(global_attempt_id))
}
}