-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:juspay/hyperswitch into env_split
* 'main' of github.com:juspay/hyperswitch: (22 commits) chore(version): 2024.01.12.1 chore: add api reference for blocklist (#3336) chore(config): add merchant_secret config for webhooks for cashtocode and volt in wasm dashboard (#3333) chore(version): 2024.01.12.0 fix: update amount_capturable based on intent_status and payment flow (#3278) feat: add support for card extended bin in payment attempt (#3312) feat(connector): [cybersource] Implement 3DS flow for cards (#3290) chore: remove connector auth TOML files from `.gitignore` and `.dockerignore` (#3330) fix(refund): add merchant_connector_id in refund (#3303) feat(connector): [BOA/CYB] Store AVS response in connector_metadata (#3271) feat(outgoingwebhookevent): adding api for query to fetch outgoing webhook events log (#3310) feat(router): payment_method block (#3056) feat(connector): [Volt] Add support for refund webhooks (#3326) feat(users): invite user without email (#3328) feat(euclid_wasm): config changes for NMI (#3329) refactor(router): restricted list payment method Customer to api-key based (#3100) feat(connector): [BOA/Cyb] Include merchant metadata in capture and void requests (#3308) fix(router): add config to avoid connector tokenization for `apple pay` `simplified flow` (#3234) refactor(router): flagged order_details validation to skip validation (#3116) fix(core): surcharge with saved card failure (#3318) ...
- Loading branch information
Showing
117 changed files
with
4,214 additions
and
508 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,7 +261,3 @@ result* | |
|
||
# node_modules | ||
node_modules/ | ||
|
||
**/connector_auth.toml | ||
**/sample_auth.toml | ||
**/auth.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,7 +261,3 @@ result* | |
|
||
# node_modules | ||
node_modules/ | ||
|
||
**/connector_auth.toml | ||
**/sample_auth.toml | ||
**/auth.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
mod core; | ||
pub mod events; | ||
|
||
pub trait OutgoingWebhookEventAnalytics: events::OutgoingWebhookLogsFilterAnalytics {} | ||
|
||
pub use self::core::outgoing_webhook_events_core; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use api_models::analytics::outgoing_webhook_event::OutgoingWebhookLogsRequest; | ||
use common_utils::errors::ReportSwitchExt; | ||
use error_stack::{IntoReport, ResultExt}; | ||
|
||
use super::events::{get_outgoing_webhook_event, OutgoingWebhookLogsResult}; | ||
use crate::{errors::AnalyticsResult, types::FiltersError, AnalyticsProvider}; | ||
|
||
pub async fn outgoing_webhook_events_core( | ||
pool: &AnalyticsProvider, | ||
req: OutgoingWebhookLogsRequest, | ||
merchant_id: String, | ||
) -> AnalyticsResult<Vec<OutgoingWebhookLogsResult>> { | ||
let data = match pool { | ||
AnalyticsProvider::Sqlx(_) => Err(FiltersError::NotImplemented( | ||
"Outgoing Webhook Events Logs not implemented for SQLX", | ||
)) | ||
.into_report() | ||
.attach_printable("SQL Analytics is not implemented for Outgoing Webhook Events"), | ||
AnalyticsProvider::Clickhouse(ckh_pool) | ||
| AnalyticsProvider::CombinedSqlx(_, ckh_pool) | ||
| AnalyticsProvider::CombinedCkh(_, ckh_pool) => { | ||
get_outgoing_webhook_event(&merchant_id, req, ckh_pool).await | ||
} | ||
} | ||
.switch()?; | ||
Ok(data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
use api_models::analytics::{outgoing_webhook_event::OutgoingWebhookLogsRequest, Granularity}; | ||
use common_utils::errors::ReportSwitchExt; | ||
use error_stack::ResultExt; | ||
use time::PrimitiveDateTime; | ||
|
||
use crate::{ | ||
query::{Aggregate, GroupByClause, QueryBuilder, ToSql, Window}, | ||
types::{AnalyticsCollection, AnalyticsDataSource, FiltersError, FiltersResult, LoadRow}, | ||
}; | ||
pub trait OutgoingWebhookLogsFilterAnalytics: LoadRow<OutgoingWebhookLogsResult> {} | ||
|
||
pub async fn get_outgoing_webhook_event<T>( | ||
merchant_id: &String, | ||
query_param: OutgoingWebhookLogsRequest, | ||
pool: &T, | ||
) -> FiltersResult<Vec<OutgoingWebhookLogsResult>> | ||
where | ||
T: AnalyticsDataSource + OutgoingWebhookLogsFilterAnalytics, | ||
PrimitiveDateTime: ToSql<T>, | ||
AnalyticsCollection: ToSql<T>, | ||
Granularity: GroupByClause<T>, | ||
Aggregate<&'static str>: ToSql<T>, | ||
Window<&'static str>: ToSql<T>, | ||
{ | ||
let mut query_builder: QueryBuilder<T> = | ||
QueryBuilder::new(AnalyticsCollection::OutgoingWebhookEvent); | ||
query_builder.add_select_column("*").switch()?; | ||
|
||
query_builder | ||
.add_filter_clause("merchant_id", merchant_id) | ||
.switch()?; | ||
query_builder | ||
.add_filter_clause("payment_id", query_param.payment_id) | ||
.switch()?; | ||
|
||
if let Some(event_id) = query_param.event_id { | ||
query_builder | ||
.add_filter_clause("event_id", &event_id) | ||
.switch()?; | ||
} | ||
if let Some(refund_id) = query_param.refund_id { | ||
query_builder | ||
.add_filter_clause("refund_id", &refund_id) | ||
.switch()?; | ||
} | ||
if let Some(dispute_id) = query_param.dispute_id { | ||
query_builder | ||
.add_filter_clause("dispute_id", &dispute_id) | ||
.switch()?; | ||
} | ||
if let Some(mandate_id) = query_param.mandate_id { | ||
query_builder | ||
.add_filter_clause("mandate_id", &mandate_id) | ||
.switch()?; | ||
} | ||
if let Some(payment_method_id) = query_param.payment_method_id { | ||
query_builder | ||
.add_filter_clause("payment_method_id", &payment_method_id) | ||
.switch()?; | ||
} | ||
if let Some(attempt_id) = query_param.attempt_id { | ||
query_builder | ||
.add_filter_clause("attempt_id", &attempt_id) | ||
.switch()?; | ||
} | ||
//TODO!: update the execute_query function to return reports instead of plain errors... | ||
query_builder | ||
.execute_query::<OutgoingWebhookLogsResult, _>(pool) | ||
.await | ||
.change_context(FiltersError::QueryBuildingError)? | ||
.change_context(FiltersError::QueryExecutionFailure) | ||
} | ||
#[derive(Debug, serde::Serialize, serde::Deserialize)] | ||
pub struct OutgoingWebhookLogsResult { | ||
pub merchant_id: String, | ||
pub event_id: String, | ||
pub event_type: String, | ||
pub outgoing_webhook_event_type: String, | ||
pub payment_id: String, | ||
pub refund_id: Option<String>, | ||
pub attempt_id: Option<String>, | ||
pub dispute_id: Option<String>, | ||
pub payment_method_id: Option<String>, | ||
pub mandate_id: Option<String>, | ||
pub content: Option<String>, | ||
pub is_error: bool, | ||
pub error: Option<String>, | ||
#[serde(with = "common_utils::custom_serde::iso8601")] | ||
pub created_at: PrimitiveDateTime, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] | ||
pub struct OutgoingWebhookLogsRequest { | ||
pub payment_id: String, | ||
pub event_id: Option<String>, | ||
pub refund_id: Option<String>, | ||
pub dispute_id: Option<String>, | ||
pub mandate_id: Option<String>, | ||
pub payment_method_id: Option<String>, | ||
pub attempt_id: Option<String>, | ||
} |
Oops, something went wrong.