Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
refactor(events): Adding changes to type of API events to Kafka (#2992)
ShivanshMathurJuspayd63f6f7224f3
diff --git a/crates/router/src/events/api_logs.rs b/crates/router/src/events/api_logs.rsindex 3f0bf651c4..3f598e8839 100644--- a/crates/router/src/events/api_logs.rs+++ b/crates/router/src/events/api_logs.rs@@ -31,11 +31,11 @@ pub struct ApiEvent {status_code: i64,#[serde(flatten)]auth_type: AuthenticationType,- request: serde_json::Value,+ request: String,user_agent: Option<String>,ip_addr: Option<String>,url_path: String,- response: Option<serde_json::Value>,+ response: Option<String>,error: Option<serde_json::Value>,#[serde(flatten)]event_type: ApiEventsType,@@ -59,12 +59,12 @@ impl ApiEvent {) -> Self {Self {api_flow: api_flow.to_string(),- created_at_timestamp: OffsetDateTime::now_utc().unix_timestamp_nanos(),+ created_at_timestamp: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000,request_id: request_id.as_hyphenated().to_string(),latency,status_code,- request,- response,+ request: request.to_string(),+ response: response.map(|resp| resp.to_string()),auth_type,error,ip_addr: http_reqdiff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rsindex e24c7cebcb..b01e3762bf 100644--- a/crates/router/src/services/authentication.rs+++ b/crates/router/src/services/authentication.rs@@ -47,11 +47,11 @@ pub enum AuthenticationType {key_id: String,},AdminApiKey,- MerchantJWT {+ MerchantJwt {merchant_id: String,user_id: Option<String>,},- MerchantID {+ MerchantId {merchant_id: String,},PublishableKey {@@ -70,9 +70,9 @@ impl AuthenticationType {merchant_id,key_id: _,}- | Self::MerchantID { merchant_id }+ | Self::MerchantId { merchant_id }| Self::PublishableKey { merchant_id }- | Self::MerchantJWT {+ | Self::MerchantJwt {merchant_id,user_id: _,}@@ -352,7 +352,7 @@ where};Ok((auth.clone(),- AuthenticationType::MerchantID {+ AuthenticationType::MerchantId {merchant_id: auth.merchant_account.merchant_id.clone(),},))@@ -423,7 +423,7 @@ whereOk(((),- AuthenticationType::MerchantJWT {+ AuthenticationType::MerchantJwt {merchant_id: payload.merchant_id,user_id: Some(payload.user_id),},@@ -451,7 +451,7 @@ whereorg_id: payload.org_id,role_id: payload.role_id,},- AuthenticationType::MerchantJWT {+ AuthenticationType::MerchantJwt {merchant_id: payload.merchant_id,user_id: Some(payload.user_id),},@@ -479,13 +479,13 @@ wherelet permissions = authorization::get_permissions(&payload.role_id)?;authorization::check_authorization(&self.required_permission, permissions)?;- // Check if token has access to merchantID that has been requested through query param+ // Check if token has access to MerchantId that has been requested through query paramif payload.merchant_id != self.merchant_id {return Err(report!(errors::ApiErrorResponse::InvalidJwtToken));}Ok(((),- AuthenticationType::MerchantJWT {+ AuthenticationType::MerchantJwt {merchant_id: payload.merchant_id,user_id: Some(payload.user_id),},@@ -549,7 +549,7 @@ where};Ok((auth.clone(),- AuthenticationType::MerchantJWT {+ AuthenticationType::MerchantJwt {merchant_id: auth.merchant_account.merchant_id.clone(),user_id: None,},@@ -579,7 +579,7 @@ whereorg_id: payload.org_id,role_id: payload.role_id,},- AuthenticationType::MerchantJWT {+ AuthenticationType::MerchantJwt {merchant_id: payload.merchant_id,user_id: Some(payload.user_id),},