feat(events): Add events framework for registering events (#4115)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sampras Lopes
2024-04-10 18:08:40 +05:30
committed by GitHub
parent c99e038a48
commit 3963219e44
53 changed files with 756 additions and 291 deletions

View File

@ -122,7 +122,7 @@ pub mod routes {
state,
&req,
domain.into_inner(),
|_, _, domain: analytics::AnalyticsDomain| async {
|_, _, domain: analytics::AnalyticsDomain, _| async {
analytics::core::get_domain_info(domain)
.await
.map(ApplicationResponse::Json)
@ -154,7 +154,7 @@ pub mod routes {
state,
&req,
payload,
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::payments::get_metrics(
&state.pool,
&auth.merchant_account.merchant_id,
@ -190,7 +190,7 @@ pub mod routes {
state,
&req,
payload,
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::refunds::get_metrics(
&state.pool,
&auth.merchant_account.merchant_id,
@ -226,7 +226,7 @@ pub mod routes {
state,
&req,
payload,
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::sdk_events::get_metrics(
&state.pool,
auth.merchant_account.publishable_key.as_ref(),
@ -252,7 +252,7 @@ pub mod routes {
state,
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::payments::get_filters(
&state.pool,
req,
@ -278,7 +278,7 @@ pub mod routes {
state,
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req: GetRefundFilterRequest| async move {
|state, auth: AuthenticationData, req: GetRefundFilterRequest, _| async move {
analytics::refunds::get_filters(
&state.pool,
req,
@ -304,7 +304,7 @@ pub mod routes {
state,
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::sdk_events::get_filters(
&state.pool,
req,
@ -330,7 +330,7 @@ pub mod routes {
state,
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
api_events_core(&state.pool, req, auth.merchant_account.merchant_id)
.await
.map(ApplicationResponse::Json)
@ -354,7 +354,7 @@ pub mod routes {
state,
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
outgoing_webhook_events_core(&state.pool, req, auth.merchant_account.merchant_id)
.await
.map(ApplicationResponse::Json)
@ -376,7 +376,7 @@ pub mod routes {
state,
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
sdk_events_core(
&state.pool,
req,
@ -402,7 +402,7 @@ pub mod routes {
state.clone(),
&req,
json_payload.into_inner(),
|state, (auth, user_id): auth::AuthenticationDataWithUserId, payload| async move {
|state, (auth, user_id): auth::AuthenticationDataWithUserId, payload, _| async move {
let user = UserInterface::find_user_by_id(&*state.store, &user_id)
.await
.change_context(AnalyticsError::UnknownError)?;
@ -444,7 +444,7 @@ pub mod routes {
state.clone(),
&req,
json_payload.into_inner(),
|state, (auth, user_id): auth::AuthenticationDataWithUserId, payload| async move {
|state, (auth, user_id): auth::AuthenticationDataWithUserId, payload, _| async move {
let user = UserInterface::find_user_by_id(&*state.store, &user_id)
.await
.change_context(AnalyticsError::UnknownError)?;
@ -486,7 +486,7 @@ pub mod routes {
state.clone(),
&req,
json_payload.into_inner(),
|state, (auth, user_id): auth::AuthenticationDataWithUserId, payload| async move {
|state, (auth, user_id): auth::AuthenticationDataWithUserId, payload, _| async move {
let user = UserInterface::find_user_by_id(&*state.store, &user_id)
.await
.change_context(AnalyticsError::UnknownError)?;
@ -538,7 +538,7 @@ pub mod routes {
state.clone(),
&req,
payload,
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::api_event::get_api_event_metrics(
&state.pool,
&auth.merchant_account.merchant_id,
@ -564,7 +564,7 @@ pub mod routes {
state.clone(),
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::api_event::get_filters(
&state.pool,
req,
@ -590,7 +590,7 @@ pub mod routes {
state,
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
connector_events_core(&state.pool, req, auth.merchant_account.merchant_id)
.await
.map(ApplicationResponse::Json)
@ -612,7 +612,7 @@ pub mod routes {
state.clone(),
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::search::msearch_results(
req,
&auth.merchant_account.merchant_id,
@ -643,7 +643,7 @@ pub mod routes {
state.clone(),
&req,
indexed_req,
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::search::search_results(
req,
&auth.merchant_account.merchant_id,
@ -669,7 +669,7 @@ pub mod routes {
state,
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::disputes::get_filters(
&state.pool,
req,
@ -704,7 +704,7 @@ pub mod routes {
state,
&req,
payload,
|state, auth: AuthenticationData, req| async move {
|state, auth: AuthenticationData, req, _| async move {
analytics::disputes::get_metrics(
&state.pool,
&auth.merchant_account.merchant_id,