From ac8ddd40208f3da5f65ca97bf5033cea5ca3ebe3 Mon Sep 17 00:00:00 2001 From: ivor-juspay <138492857+ivor-juspay@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:21:09 +0530 Subject: [PATCH] feat(global-search): dashboard globalsearch apis (#3831) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- Cargo.lock | 684 ++++++++++++++---- config/config.example.toml | 82 ++- config/deployments/env_specific.toml | 67 +- config/development.toml | 142 ++-- config/docker_compose.toml | 126 ++-- crates/analytics/Cargo.toml | 30 +- crates/analytics/src/lambda_utils.rs | 4 +- crates/analytics/src/lib.rs | 40 + crates/analytics/src/search.rs | 150 ++++ crates/api_models/src/analytics.rs | 2 +- crates/api_models/src/analytics/search.rs | 73 ++ crates/api_models/src/events.rs | 6 +- crates/router/src/analytics.rs | 68 +- .../src/configs/secrets_transformers.rs | 2 + crates/router/src/configs/settings.rs | 4 +- crates/router_env/src/lib.rs | 2 + 16 files changed, 1133 insertions(+), 349 deletions(-) create mode 100644 crates/analytics/src/search.rs create mode 100644 crates/api_models/src/analytics/search.rs diff --git a/Cargo.lock b/Cargo.lock index 7c7b2b9a76..e3c39b7184 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,7 +55,7 @@ dependencies = [ "flate2", "futures-core", "h2", - "http", + "http 0.2.9", "httparse", "httpdate", "itoa", @@ -128,7 +128,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" dependencies = [ "bytestring", - "http", + "http 0.2.9", "regex", "serde", "tracing", @@ -183,10 +183,10 @@ dependencies = [ "actix-service", "actix-utils", "futures-core", - "http", + "http 0.2.9", "impl-more", "pin-project-lite", - "rustls 0.21.7", + "rustls 0.21.10", "rustls-webpki", "tokio 1.36.0", "tokio-rustls 0.23.4", @@ -229,7 +229,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "http", + "http 0.2.9", "itoa", "language-tags", "log", @@ -340,9 +340,9 @@ dependencies = [ "actix-web", "api_models", "async-trait", - "aws-config", + "aws-config 1.1.7", "aws-sdk-lambda", - "aws-smithy-types", + "aws-smithy-types 1.1.7", "bigdecimal", "common_utils", "diesel_models", @@ -352,6 +352,7 @@ dependencies = [ "hyperswitch_interfaces", "masking", "once_cell", + "opensearch", "reqwest", "router_env", "serde", @@ -621,7 +622,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", + "http 0.2.9", "itoa", "log", "mime", @@ -641,23 +642,23 @@ version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcdcf0d683fe9c23d32cf5b53c9918ea0a500375a9fb20109802552658e576c9" dependencies = [ - "aws-credential-types", + "aws-credential-types 0.55.3", "aws-http", - "aws-sdk-sso", - "aws-sdk-sts", - "aws-smithy-async", + "aws-sdk-sso 0.28.0", + "aws-sdk-sts 0.28.0", + "aws-smithy-async 0.55.3", "aws-smithy-client", - "aws-smithy-http", + "aws-smithy-http 0.55.3", "aws-smithy-http-tower", - "aws-smithy-json", - "aws-smithy-types", - "aws-types", + "aws-smithy-json 0.55.3", + "aws-smithy-types 0.55.3", + "aws-types 0.55.3", "bytes 1.5.0", "fastrand 1.9.0", "hex", - "http", + "http 0.2.9", "hyper", - "ring", + "ring 0.16.20", "time", "tokio 1.36.0", "tower", @@ -665,30 +666,72 @@ dependencies = [ "zeroize", ] +[[package]] +name = "aws-config" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b96342ea8948ab9bef3e6234ea97fc32e2d8a88d8fb6a084e52267317f94b6b" +dependencies = [ + "aws-credential-types 1.1.7", + "aws-runtime", + "aws-sdk-sso 1.15.0", + "aws-sdk-ssooidc", + "aws-sdk-sts 1.15.0", + "aws-smithy-async 1.1.7", + "aws-smithy-http 0.60.6", + "aws-smithy-json 0.60.6", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "aws-types 1.1.7", + "bytes 1.5.0", + "fastrand 2.0.1", + "hex", + "http 0.2.9", + "hyper", + "ring 0.17.8", + "time", + "tokio 1.36.0", + "tracing", + "zeroize", +] + [[package]] name = "aws-credential-types" version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fcdb2f7acbc076ff5ad05e7864bdb191ca70a6fd07668dc3a1a8bcd051de5ae" dependencies = [ - "aws-smithy-async", - "aws-smithy-types", + "aws-smithy-async 0.55.3", + "aws-smithy-types 0.55.3", "fastrand 1.9.0", "tokio 1.36.0", "tracing", "zeroize", ] +[[package]] +name = "aws-credential-types" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "273fa47dafc9ef14c2c074ddddbea4561ff01b7f68d5091c0e9737ced605c01d" +dependencies = [ + "aws-smithy-async 1.1.7", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "zeroize", +] + [[package]] name = "aws-endpoint" version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cce1c41a6cfaa726adee9ebb9a56fcd2bbfd8be49fd8a04c5e20fd968330b04" dependencies = [ - "aws-smithy-http", - "aws-smithy-types", - "aws-types", - "http", + "aws-smithy-http 0.55.3", + "aws-smithy-types 0.55.3", + "aws-types 0.55.3", + "http 0.2.9", "regex", "tracing", ] @@ -699,12 +742,12 @@ version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aadbc44e7a8f3e71c8b374e03ecd972869eb91dd2bc89ed018954a52ba84bc44" dependencies = [ - "aws-credential-types", - "aws-smithy-http", - "aws-smithy-types", - "aws-types", + "aws-credential-types 0.55.3", + "aws-smithy-http 0.55.3", + "aws-smithy-types 0.55.3", + "aws-types 0.55.3", "bytes 1.5.0", - "http", + "http 0.2.9", "http-body", "lazy_static", "percent-encoding", @@ -712,25 +755,48 @@ dependencies = [ "tracing", ] +[[package]] +name = "aws-runtime" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e38bab716c8bf07da24be07ecc02e0f5656ce8f30a891322ecdcb202f943b85" +dependencies = [ + "aws-credential-types 1.1.7", + "aws-sigv4 1.1.7", + "aws-smithy-async 1.1.7", + "aws-smithy-http 0.60.6", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "aws-types 1.1.7", + "bytes 1.5.0", + "fastrand 2.0.1", + "http 0.2.9", + "http-body", + "percent-encoding", + "pin-project-lite", + "tracing", + "uuid", +] + [[package]] name = "aws-sdk-kms" version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "545335abd7c6ef7285d2972a67b9f8279ff5fec8bbb3ffc637fa436ba1e6e434" dependencies = [ - "aws-credential-types", + "aws-credential-types 0.55.3", "aws-endpoint", "aws-http", "aws-sig-auth", - "aws-smithy-async", + "aws-smithy-async 0.55.3", "aws-smithy-client", - "aws-smithy-http", + "aws-smithy-http 0.55.3", "aws-smithy-http-tower", - "aws-smithy-json", - "aws-smithy-types", - "aws-types", + "aws-smithy-json 0.55.3", + "aws-smithy-types 0.55.3", + "aws-types 0.55.3", "bytes 1.5.0", - "http", + "http 0.2.9", "regex", "tokio-stream", "tower", @@ -739,26 +805,23 @@ dependencies = [ [[package]] name = "aws-sdk-lambda" -version = "0.28.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3ad176ffaa3aafa532246eb6a9f18a7d68da19950704ecc95d33d9dc3c62a9b" +checksum = "0c4714bdfe1171542377f84c1034b1c64e3e7544119765f205402ae159b5b9b4" dependencies = [ - "aws-credential-types", - "aws-endpoint", - "aws-http", - "aws-sig-auth", - "aws-smithy-async", - "aws-smithy-client", - "aws-smithy-http", - "aws-smithy-http-tower", - "aws-smithy-json", - "aws-smithy-types", - "aws-types", + "aws-credential-types 1.1.7", + "aws-runtime", + "aws-smithy-async 1.1.7", + "aws-smithy-http 0.60.6", + "aws-smithy-json 0.60.6", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "aws-types 1.1.7", "bytes 1.5.0", - "http", - "regex", - "tokio-stream", - "tower", + "http 0.2.9", + "once_cell", + "regex-lite", "tracing", ] @@ -768,23 +831,23 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fba197193cbb4bcb6aad8d99796b2291f36fa89562ded5d4501363055b0de89f" dependencies = [ - "aws-credential-types", + "aws-credential-types 0.55.3", "aws-endpoint", "aws-http", "aws-sig-auth", - "aws-sigv4", - "aws-smithy-async", + "aws-sigv4 0.55.3", + "aws-smithy-async 0.55.3", "aws-smithy-checksums", "aws-smithy-client", "aws-smithy-eventstream", - "aws-smithy-http", + "aws-smithy-http 0.55.3", "aws-smithy-http-tower", - "aws-smithy-json", - "aws-smithy-types", - "aws-smithy-xml", - "aws-types", + "aws-smithy-json 0.55.3", + "aws-smithy-types 0.55.3", + "aws-smithy-xml 0.55.3", + "aws-types 0.55.3", "bytes 1.5.0", - "http", + "http 0.2.9", "http-body", "once_cell", "percent-encoding", @@ -801,19 +864,19 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4891169a246b580136f4d3682c11a68b710bdc1027dd7774023fa651a87f10b6" dependencies = [ - "aws-credential-types", + "aws-credential-types 0.55.3", "aws-endpoint", "aws-http", "aws-sig-auth", - "aws-smithy-async", + "aws-smithy-async 0.55.3", "aws-smithy-client", - "aws-smithy-http", + "aws-smithy-http 0.55.3", "aws-smithy-http-tower", - "aws-smithy-json", - "aws-smithy-types", - "aws-types", + "aws-smithy-json 0.55.3", + "aws-smithy-types 0.55.3", + "aws-types 0.55.3", "bytes 1.5.0", - "http", + "http 0.2.9", "regex", "tokio-stream", "tower", @@ -826,63 +889,130 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8b812340d86d4a766b2ca73f740dfd47a97c2dff0c06c8517a16d88241957e4" dependencies = [ - "aws-credential-types", + "aws-credential-types 0.55.3", "aws-endpoint", "aws-http", "aws-sig-auth", - "aws-smithy-async", + "aws-smithy-async 0.55.3", "aws-smithy-client", - "aws-smithy-http", + "aws-smithy-http 0.55.3", "aws-smithy-http-tower", - "aws-smithy-json", - "aws-smithy-types", - "aws-types", + "aws-smithy-json 0.55.3", + "aws-smithy-types 0.55.3", + "aws-types 0.55.3", "bytes 1.5.0", - "http", + "http 0.2.9", "regex", "tokio-stream", "tower", "tracing", ] +[[package]] +name = "aws-sdk-sso" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d84bd3925a17c9adbf6ec65d52104a44a09629d8f70290542beeee69a95aee7f" +dependencies = [ + "aws-credential-types 1.1.7", + "aws-runtime", + "aws-smithy-async 1.1.7", + "aws-smithy-http 0.60.6", + "aws-smithy-json 0.60.6", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "aws-types 1.1.7", + "bytes 1.5.0", + "http 0.2.9", + "once_cell", + "regex-lite", + "tracing", +] + +[[package]] +name = "aws-sdk-ssooidc" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c2dae39e997f58bc4d6292e6244b26ba630c01ab671b6f9f44309de3eb80ab8" +dependencies = [ + "aws-credential-types 1.1.7", + "aws-runtime", + "aws-smithy-async 1.1.7", + "aws-smithy-http 0.60.6", + "aws-smithy-json 0.60.6", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "aws-types 1.1.7", + "bytes 1.5.0", + "http 0.2.9", + "once_cell", + "regex-lite", + "tracing", +] + [[package]] name = "aws-sdk-sts" version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "265fac131fbfc188e5c3d96652ea90ecc676a934e3174eaaee523c6cec040b3b" dependencies = [ - "aws-credential-types", + "aws-credential-types 0.55.3", "aws-endpoint", "aws-http", "aws-sig-auth", - "aws-smithy-async", + "aws-smithy-async 0.55.3", "aws-smithy-client", - "aws-smithy-http", + "aws-smithy-http 0.55.3", "aws-smithy-http-tower", - "aws-smithy-json", - "aws-smithy-query", - "aws-smithy-types", - "aws-smithy-xml", - "aws-types", + "aws-smithy-json 0.55.3", + "aws-smithy-query 0.55.3", + "aws-smithy-types 0.55.3", + "aws-smithy-xml 0.55.3", + "aws-types 0.55.3", "bytes 1.5.0", - "http", + "http 0.2.9", "regex", "tower", "tracing", ] +[[package]] +name = "aws-sdk-sts" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17fd9a53869fee17cea77e352084e1aa71e2c5e323d974c13a9c2bcfd9544c7f" +dependencies = [ + "aws-credential-types 1.1.7", + "aws-runtime", + "aws-smithy-async 1.1.7", + "aws-smithy-http 0.60.6", + "aws-smithy-json 0.60.6", + "aws-smithy-query 0.60.6", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "aws-smithy-xml 0.60.6", + "aws-types 1.1.7", + "http 0.2.9", + "once_cell", + "regex-lite", + "tracing", +] + [[package]] name = "aws-sig-auth" version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b94acb10af0c879ecd5c7bdf51cda6679a0a4f4643ce630905a77673bfa3c61" dependencies = [ - "aws-credential-types", - "aws-sigv4", + "aws-credential-types 0.55.3", + "aws-sigv4 0.55.3", "aws-smithy-eventstream", - "aws-smithy-http", - "aws-types", - "http", + "aws-smithy-http 0.55.3", + "aws-types 0.55.3", + "http 0.2.9", "tracing", ] @@ -893,12 +1023,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d2ce6f507be68e968a33485ced670111d1cbad161ddbbab1e313c03d37d8f4c" dependencies = [ "aws-smithy-eventstream", - "aws-smithy-http", + "aws-smithy-http 0.55.3", "bytes 1.5.0", "form_urlencoded", "hex", "hmac", - "http", + "http 0.2.9", "once_cell", "percent-encoding", "regex", @@ -907,6 +1037,29 @@ dependencies = [ "tracing", ] +[[package]] +name = "aws-sigv4" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ada00a4645d7d89f296fe0ddbc3fe3554f03035937c849a05d37ddffc1f29a1" +dependencies = [ + "aws-credential-types 1.1.7", + "aws-smithy-http 0.60.6", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "bytes 1.5.0", + "form_urlencoded", + "hex", + "hmac", + "http 0.2.9", + "http 1.0.0", + "once_cell", + "percent-encoding", + "sha2", + "time", + "tracing", +] + [[package]] name = "aws-smithy-async" version = "0.55.3" @@ -919,19 +1072,30 @@ dependencies = [ "tokio-stream", ] +[[package]] +name = "aws-smithy-async" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf7f09a27286d84315dfb9346208abb3b0973a692454ae6d0bc8d803fcce3b4" +dependencies = [ + "futures-util", + "pin-project-lite", + "tokio 1.36.0", +] + [[package]] name = "aws-smithy-checksums" version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07ed8b96d95402f3f6b8b57eb4e0e45ee365f78b1a924faf20ff6e97abf1eae6" dependencies = [ - "aws-smithy-http", - "aws-smithy-types", + "aws-smithy-http 0.55.3", + "aws-smithy-types 0.55.3", "bytes 1.5.0", "crc32c", "crc32fast", "hex", - "http", + "http 0.2.9", "http-body", "md-5", "pin-project-lite", @@ -946,13 +1110,13 @@ version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a86aa6e21e86c4252ad6a0e3e74da9617295d8d6e374d552be7d3059c41cedd" dependencies = [ - "aws-smithy-async", - "aws-smithy-http", + "aws-smithy-async 0.55.3", + "aws-smithy-http 0.55.3", "aws-smithy-http-tower", - "aws-smithy-types", + "aws-smithy-types 0.55.3", "bytes 1.5.0", "fastrand 1.9.0", - "http", + "http 0.2.9", "http-body", "hyper", "hyper-rustls 0.23.2", @@ -970,7 +1134,7 @@ version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460c8da5110835e3d9a717c61f5556b20d03c32a1dec57f8fc559b360f733bb8" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 0.55.3", "bytes 1.5.0", "crc32fast", ] @@ -982,11 +1146,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b3b693869133551f135e1f2c77cb0b8277d9e3e17feaf2213f735857c4f0d28" dependencies = [ "aws-smithy-eventstream", - "aws-smithy-types", + "aws-smithy-types 0.55.3", "bytes 1.5.0", "bytes-utils", "futures-core", - "http", + "http 0.2.9", "http-body", "hyper", "once_cell", @@ -998,16 +1162,36 @@ dependencies = [ "tracing", ] +[[package]] +name = "aws-smithy-http" +version = "0.60.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6ca214a6a26f1b7ebd63aa8d4f5e2194095643023f9608edf99a58247b9d80d" +dependencies = [ + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "bytes 1.5.0", + "bytes-utils", + "futures-core", + "http 0.2.9", + "http-body", + "once_cell", + "percent-encoding", + "pin-project-lite", + "pin-utils", + "tracing", +] + [[package]] name = "aws-smithy-http-tower" version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ae4f6c5798a247fac98a867698197d9ac22643596dc3777f0c76b91917616b9" dependencies = [ - "aws-smithy-http", - "aws-smithy-types", + "aws-smithy-http 0.55.3", + "aws-smithy-types 0.55.3", "bytes 1.5.0", - "http", + "http 0.2.9", "http-body", "pin-project-lite", "tower", @@ -1020,7 +1204,16 @@ version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23f9f42fbfa96d095194a632fbac19f60077748eba536eb0b9fecc28659807f8" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 0.55.3", +] + +[[package]] +name = "aws-smithy-json" +version = "0.60.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1af80ecf3057fb25fe38d1687e94c4601a7817c6a1e87c1b0635f7ecb644ace5" +dependencies = [ + "aws-smithy-types 1.1.7", ] [[package]] @@ -1029,10 +1222,62 @@ version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98819eb0b04020a1c791903533b638534ae6c12e2aceda3e6e6fba015608d51d" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 0.55.3", "urlencoding", ] +[[package]] +name = "aws-smithy-query" +version = "0.60.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb27084f72ea5fc20033efe180618677ff4a2f474b53d84695cfe310a6526cbc" +dependencies = [ + "aws-smithy-types 1.1.7", + "urlencoding", +] + +[[package]] +name = "aws-smithy-runtime" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbb5fca54a532a36ff927fbd7407a7c8eb9c3b4faf72792ba2965ea2cad8ed55" +dependencies = [ + "aws-smithy-async 1.1.7", + "aws-smithy-http 0.60.6", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "bytes 1.5.0", + "fastrand 2.0.1", + "h2", + "http 0.2.9", + "http-body", + "hyper", + "hyper-rustls 0.24.2", + "once_cell", + "pin-project-lite", + "pin-utils", + "rustls 0.21.10", + "tokio 1.36.0", + "tracing", +] + +[[package]] +name = "aws-smithy-runtime-api" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22389cb6f7cac64f266fb9f137745a9349ced7b47e0d2ba503e9e40ede4f7060" +dependencies = [ + "aws-smithy-async 1.1.7", + "aws-smithy-types 1.1.7", + "bytes 1.5.0", + "http 0.2.9", + "http 1.0.0", + "pin-project-lite", + "tokio 1.36.0", + "tracing", + "zeroize", +] + [[package]] name = "aws-smithy-types" version = "0.55.3" @@ -1046,6 +1291,29 @@ dependencies = [ "time", ] +[[package]] +name = "aws-smithy-types" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f081da5481210523d44ffd83d9f0740320050054006c719eae0232d411f024d3" +dependencies = [ + "base64-simd", + "bytes 1.5.0", + "bytes-utils", + "futures-core", + "http 0.2.9", + "http-body", + "itoa", + "num-integer", + "pin-project-lite", + "pin-utils", + "ryu", + "serde", + "time", + "tokio 1.36.0", + "tokio-util", +] + [[package]] name = "aws-smithy-xml" version = "0.55.3" @@ -1055,18 +1323,42 @@ dependencies = [ "xmlparser", ] +[[package]] +name = "aws-smithy-xml" +version = "0.60.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fccd8f595d0ca839f9f2548e66b99514a85f92feb4c01cf2868d93eb4888a42" +dependencies = [ + "xmlparser", +] + [[package]] name = "aws-types" version = "0.55.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dd209616cc8d7bfb82f87811a5c655dc97537f592689b18743bddf5dc5c4829" dependencies = [ - "aws-credential-types", - "aws-smithy-async", + "aws-credential-types 0.55.3", + "aws-smithy-async 0.55.3", "aws-smithy-client", - "aws-smithy-http", - "aws-smithy-types", - "http", + "aws-smithy-http 0.55.3", + "aws-smithy-types 0.55.3", + "http 0.2.9", + "rustc_version 0.4.0", + "tracing", +] + +[[package]] +name = "aws-types" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07c63521aa1ea9a9f92a701f1a08ce3fd20b46c6efc0d5c8947c1fd879e3df1" +dependencies = [ + "aws-credential-types 1.1.7", + "aws-smithy-async 1.1.7", + "aws-smithy-runtime-api", + "aws-smithy-types 1.1.7", + "http 0.2.9", "rustc_version 0.4.0", "tracing", ] @@ -1082,7 +1374,7 @@ dependencies = [ "bitflags 1.3.2", "bytes 1.5.0", "futures-util", - "http", + "http 0.2.9", "http-body", "hyper", "itoa", @@ -1108,7 +1400,7 @@ dependencies = [ "async-trait", "bytes 1.5.0", "futures-util", - "http", + "http 0.2.9", "http-body", "mime", "rustversion", @@ -1663,7 +1955,7 @@ dependencies = [ "fake", "futures 0.3.28", "hex", - "http", + "http 0.2.9", "masking", "md5", "nanoid", @@ -1674,7 +1966,7 @@ dependencies = [ "rand 0.8.5", "regex", "reqwest", - "ring", + "ring 0.16.20", "router_env", "rustc-hash", "serde", @@ -2494,11 +2786,11 @@ name = "external_services" version = "0.1.0" dependencies = [ "async-trait", - "aws-config", + "aws-config 0.55.3", "aws-sdk-kms", "aws-sdk-s3", "aws-sdk-sesv2", - "aws-sdk-sts", + "aws-sdk-sts 0.28.0", "aws-smithy-client", "base64 0.21.5", "common_utils", @@ -2537,7 +2829,7 @@ dependencies = [ "cookie 0.16.2", "futures-core", "futures-util", - "http", + "http 0.2.9", "hyper", "hyper-rustls 0.23.2", "mime", @@ -2962,7 +3254,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.9", "indexmap 2.1.0", "slab", "tokio 1.36.0", @@ -3013,7 +3305,7 @@ dependencies = [ "base64 0.21.5", "bytes 1.5.0", "headers-core", - "http", + "http 0.2.9", "httpdate", "mime", "sha1", @@ -3025,7 +3317,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "http", + "http 0.2.9", ] [[package]] @@ -3078,6 +3370,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes 1.5.0", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.5" @@ -3085,7 +3388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes 1.5.0", - "http", + "http 0.2.9", "pin-project-lite", ] @@ -3099,7 +3402,7 @@ dependencies = [ "async-channel", "base64 0.13.1", "futures-lite", - "http", + "http 0.2.9", "infer 0.2.3", "pin-project-lite", "rand 0.7.3", @@ -3142,7 +3445,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", + "http 0.2.9", "http-body", "httparse", "httpdate", @@ -3164,7 +3467,7 @@ dependencies = [ "bytes 1.5.0", "futures 0.3.28", "headers", - "http", + "http 0.2.9", "hyper", "hyper-tls", "native-tls", @@ -3179,7 +3482,7 @@ version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ - "http", + "http 0.2.9", "hyper", "log", "rustls 0.20.9", @@ -3195,9 +3498,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", + "http 0.2.9", "hyper", - "rustls 0.21.7", + "log", + "rustls 0.21.10", + "rustls-native-certs", "tokio 1.36.0", "tokio-rustls 0.24.1", ] @@ -3508,7 +3813,7 @@ checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ "base64 0.21.5", "pem", - "ring", + "ring 0.16.20", "serde", "serde_json", "simple_asn1", @@ -4111,6 +4416,30 @@ dependencies = [ "utoipa", ] +[[package]] +name = "opensearch" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd2846759315751e04d8b45a0bdbd89ce442282ffb916cf54f6b0adf8df4b44c" +dependencies = [ + "aws-credential-types 1.1.7", + "aws-sigv4 1.1.7", + "aws-smithy-runtime-api", + "aws-types 1.1.7", + "base64 0.21.5", + "bytes 1.5.0", + "dyn-clone", + "lazy_static", + "percent-encoding", + "reqwest", + "rustc_version 0.4.0", + "serde", + "serde_json", + "serde_with", + "url", + "void", +] + [[package]] name = "openssl" version = "0.10.60" @@ -4174,7 +4503,7 @@ dependencies = [ "async-trait", "futures 0.3.28", "futures-util", - "http", + "http 0.2.9", "opentelemetry", "opentelemetry-proto", "prost", @@ -4569,7 +4898,7 @@ dependencies = [ "common_enums", "common_utils", "error-stack", - "http", + "http 0.2.9", "masking", "mime", "router_derive", @@ -5058,6 +5387,12 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-lite" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" + [[package]] name = "regex-syntax" version = "0.6.29" @@ -5098,7 +5433,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", + "http 0.2.9", "http-body", "hyper", "hyper-rustls 0.24.2", @@ -5112,7 +5447,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.7", + "rustls 0.21.10", "rustls-pemfile", "serde", "serde_json", @@ -5146,12 +5481,27 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", - "untrusted", + "spin 0.5.2", + "untrusted 0.7.1", "web-sys", "winapi 0.3.9", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if 1.0.0", + "getrandom 0.2.11", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.52.0", +] + [[package]] name = "rkyv" version = "0.7.42" @@ -5244,7 +5594,7 @@ dependencies = [ "external_services", "futures 0.3.28", "hex", - "http", + "http 0.2.9", "hyper", "hyperswitch_interfaces", "image", @@ -5272,7 +5622,7 @@ dependencies = [ "redis_interface", "regex", "reqwest", - "ring", + "ring 0.16.20", "router_derive", "router_env", "roxmltree", @@ -5429,7 +5779,7 @@ dependencies = [ "anyhow", "async-trait", "bytes 1.5.0", - "http", + "http 0.2.9", "reqwest", "rustify_derive", "serde", @@ -5474,19 +5824,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" dependencies = [ "log", - "ring", + "ring 0.16.20", "sct", "webpki", ] [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring", + "ring 0.17.8", "rustls-webpki", "sct", ] @@ -5514,12 +5864,12 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] @@ -5625,8 +5975,8 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -6025,6 +6375,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "sqlformat" version = "0.2.2" @@ -6149,13 +6505,13 @@ dependencies = [ "dyn-clone", "error-stack", "futures 0.3.28", - "http", + "http 0.2.9", "masking", "mime", "moka", "once_cell", "redis_interface", - "ring", + "ring 0.16.20", "router_derive", "router_env", "serde", @@ -6428,7 +6784,7 @@ dependencies = [ "cookie 0.16.2", "fantoccini", "futures 0.3.28", - "http", + "http 0.2.9", "log", "parking_lot 0.12.1", "serde", @@ -6710,7 +7066,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.7", + "rustls 0.21.10", "tokio 1.36.0", ] @@ -6895,7 +7251,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", + "http 0.2.9", "http-body", "hyper", "hyper-timeout", @@ -7211,6 +7567,12 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.4.1" @@ -7300,7 +7662,7 @@ dependencies = [ "async-trait", "bytes 1.5.0", "derive_builder", - "http", + "http 0.2.9", "reqwest", "rustify", "rustify_derive", @@ -7336,6 +7698,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + [[package]] name = "vsimd" version = "0.8.0" @@ -7473,7 +7841,7 @@ dependencies = [ "base64 0.13.1", "bytes 1.5.0", "cookie 0.16.2", - "http", + "http 0.2.9", "log", "serde", "serde_derive", @@ -7489,8 +7857,8 @@ version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07ecc0cd7cac091bf682ec5efa18b1cff79d617b84181f38b3951dbe135f607f" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] diff --git a/config/config.example.toml b/config/config.example.toml index 2ffb69c3e3..daf554f00a 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -54,10 +54,10 @@ use_legacy_version = false # Resp protocol for fred crate (set this to tr stream_read_count = 1 # Default number of entries to read from stream if not provided in stream read options auto_pipeline = true # Whether or not the client should automatically pipeline commands across tasks when possible. disable_auto_backpressure = false # Whether or not to disable the automatic backpressure features when pipelining is enabled. -max_in_flight_commands = 5000 # The maximum number of in-flight commands (per connection) before backpressure will be applied. -default_command_timeout = 30 # An optional timeout to apply to all commands. In seconds -unresponsive_timeout = 10 # An optional timeout for Unresponsive commands in seconds. This should be less than default_command_timeout. -max_feed_count = 200 # The maximum number of frames that will be fed to a socket before flushing. +max_in_flight_commands = 5000 # The maximum number of in-flight commands (per connection) before backpressure will be applied. +default_command_timeout = 30 # An optional timeout to apply to all commands. In seconds +unresponsive_timeout = 10 # An optional timeout for Unresponsive commands in seconds. This should be less than default_command_timeout. +max_feed_count = 200 # The maximum number of frames that will be fed to a socket before flushing. # This section provides configs for currency conversion api [forex_api] @@ -298,9 +298,9 @@ lock_ttl = 160 # the ttl being the expiry (in seconds) # Scheduler server configuration [scheduler.server] -port = 3000 # Port on which the server will listen for incoming requests -host = "127.0.0.1" # Host IP address to bind the server to -workers = 1 # Number of actix workers to handle incoming requests concurrently +port = 3000 # Port on which the server will listen for incoming requests +host = "127.0.0.1" # Host IP address to bind the server to +workers = 1 # Number of actix workers to handle incoming requests concurrently batch_size = 200 # Specifies the batch size the producer will push under a single entry in the redis queue @@ -321,10 +321,10 @@ paypal = { currency = "USD,INR", country = "US" } # If either currency or country isn't provided then, all possible values are accepted [cors] -max_age = 30 # Maximum time (in seconds) for which this CORS request may be cached. -origins = "http://localhost:8080" # List of origins that are allowed to make requests. +max_age = 30 # Maximum time (in seconds) for which this CORS request may be cached. +origins = "http://localhost:8080" # List of origins that are allowed to make requests. allowed_methods = "GET,POST,PUT,DELETE" # List of methods that are allowed -wildcard_origin = false # If true, allows any origin to make requests +wildcard_origin = false # If true, allows any origin to make requests # EmailClient configuration. Only applicable when the `email` feature flag is enabled. [email] @@ -357,7 +357,7 @@ bluesnap = { payment_method = "card" } bankofamerica = { payment_method = "card" } cybersource = { payment_method = "card" } nmi = { payment_method = "card" } -payme = {payment_method = "card" } +payme = { payment_method = "card" } [dummy_connector] enabled = true # Whether dummy connector is enabled or not @@ -380,21 +380,21 @@ slack_invite_url = "https://www.example.com/" # Slack invite url for hyperswit discord_invite_url = "https://www.example.com/" # Discord invite url for hyperswitch [mandates.supported_payment_methods] -card.credit = { connector_list = "stripe,adyen,cybersource" } # Mandate supported payment method type and connector for card -wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets -pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later -bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit -bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit -bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit -bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"} # Mandate supported payment method type and connector for bank_redirect -bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"} +card.credit = { connector_list = "stripe,adyen,cybersource" } # Mandate supported payment method type and connector for card +wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets +pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later +bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit +bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit +bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit +bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } # Mandate supported payment method type and connector for bank_redirect +bank_redirect.sofort = { connector_list = "stripe,adyen,globalpay" } wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon" } -bank_redirect.giropay = {connector_list = "adyen,globalpay"} +bank_redirect.giropay = { connector_list = "adyen,globalpay" } [mandates.update_mandate_supported] -card.credit ={connector_list ="cybersource"} # Update Mandate supported payment method type and connector for card -card.debit = {connector_list ="cybersource"} # Update Mandate supported payment method type and connector for card +card.credit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card +card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card # Required fields info used while listing the payment_method_data [required_fields.pay_later] # payment_method = "pay_later" @@ -412,9 +412,9 @@ afterpay_clearpay = { fields = { stripe = [ # payment_method_type = afterpay_cle payout_eligibility = true # Defaults the eligibility of a payout method to true in case connector does not provide checks for payout eligibility [pm_filters.adyen] -sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR"} +sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR" } paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD" } -klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD"} +klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD" } ideal = { country = "NL", currency = "EUR" } online_banking_fpx = { country = "MY", currency = "MYR" } online_banking_thailand = { country = "TH", currency = "THB" } @@ -442,7 +442,7 @@ pay_easy = { country = "JP", currency = "JPY" } boleto = { country = "BR", currency = "BRL" } [pm_filters.volt] -open_banking_uk = {country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL"} +open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" } [pm_filters.zen] credit = { not_available_flows = { capture_method = "manual" } } @@ -566,22 +566,36 @@ dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute event # File storage configuration [file_storage] -file_storage_backend = "aws_s3" # File storage backend to be used +file_storage_backend = "aws_s3" # File storage backend to be used [file_storage.aws_s3] -region = "us-east-1" # The AWS region used by the AWS S3 for file storage -bucket_name = "bucket1" # The AWS S3 bucket name for file storage +region = "us-east-1" # The AWS region used by the AWS S3 for file storage +bucket_name = "bucket1" # The AWS S3 bucket name for file storage [secrets_management] -secrets_manager = "aws_kms" # Secrets manager client to be used +secrets_manager = "aws_kms" # Secrets manager client to be used [secrets_management.aws_kms] -key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data. -region = "kms_region" # The AWS region used by the KMS SDK for decrypting data. +key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data. +region = "kms_region" # The AWS region used by the KMS SDK for decrypting data. [encryption_management] -encryption_manager = "aws_kms" # Encryption manager client to be used +encryption_manager = "aws_kms" # Encryption manager client to be used [encryption_management.aws_kms] -key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data. -region = "kms_region" # The AWS region used by the KMS SDK for decrypting data. +key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data. +region = "kms_region" # The AWS region used by the KMS SDK for decrypting data. + +[opensearch] +host = "https://localhost:9200" + +[opensearch.auth] +auth = "basic" +username = "admin" +password = "admin" +region = "eu-central-1" + +[opensearch.indexes] +payment_attempts = "hyperswitch-payment-attempt-events" +payment_intents = "hyperswitch-payment-intent-events" +refunds = "hyperswitch-refund-events" diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml index 990796c79b..cfe696e42c 100644 --- a/config/deployments/env_specific.toml +++ b/config/deployments/env_specific.toml @@ -42,13 +42,17 @@ client_secret = "paypal_client_secret" partner_id = "paypal_partner_id" [connector_request_reference_id_config] -merchant_ids_send_payment_id_as_connector_request_id = ["merchant_id_1", "merchant_id_2", "etc.,"] +merchant_ids_send_payment_id_as_connector_request_id = [ + "merchant_id_1", + "merchant_id_2", + "etc.,", +] [cors] -max_age = 30 # Maximum time (in seconds) for which this CORS request may be cached. -origins = "http://localhost:8080" # List of origins that are allowed to make requests. +max_age = 30 # Maximum time (in seconds) for which this CORS request may be cached. +origins = "http://localhost:8080" # List of origins that are allowed to make requests. allowed_methods = "GET,POST,PUT,DELETE" # List of methods that are allowed -wildcard_origin = false # If true, allows any origin to make requests +wildcard_origin = false # If true, allows any origin to make requests # EmailClient configuration. Only applicable when the `email` feature flag is enabled. [email] @@ -160,21 +164,24 @@ https_url = "https://proxy_https_url" # Outgoing proxy https URL to proxy the HT [redis] host = "127.0.0.1" port = 6379 -pool_size = 5 # Number of connections to keep open -reconnect_max_attempts = 5 # Maximum number of reconnection attempts to make before failing. Set to 0 to retry forever. -reconnect_delay = 5 # Delay between reconnection attempts, in milliseconds -default_ttl = 300 # Default TTL for entries, in seconds -default_hash_ttl = 900 # Default TTL for hashes entries, in seconds -use_legacy_version = false # RESP protocol for fred crate (set this to true if using RESPv2 or redis version < 6) -stream_read_count = 1 # Default number of entries to read from stream if not provided in stream read options -auto_pipeline = true # Whether or not the client should automatically pipeline commands across tasks when possible. -disable_auto_backpressure = false # Whether or not to disable the automatic backpressure features when pipelining is enabled. +pool_size = 5 # Number of connections to keep open +reconnect_max_attempts = 5 # Maximum number of reconnection attempts to make before failing. Set to 0 to retry forever. +reconnect_delay = 5 # Delay between reconnection attempts, in milliseconds +default_ttl = 300 # Default TTL for entries, in seconds +default_hash_ttl = 900 # Default TTL for hashes entries, in seconds +use_legacy_version = false # RESP protocol for fred crate (set this to true if using RESPv2 or redis version < 6) +stream_read_count = 1 # Default number of entries to read from stream if not provided in stream read options +auto_pipeline = true # Whether or not the client should automatically pipeline commands across tasks when possible. +disable_auto_backpressure = false # Whether or not to disable the automatic backpressure features when pipelining is enabled. max_in_flight_commands = 5000 # The maximum number of in-flight commands (per connection) before backpressure will be applied. -default_command_timeout = 30 # An optional timeout to apply to all commands. In seconds +default_command_timeout = 30 # An optional timeout to apply to all commands. In seconds unresponsive_timeout = 10 # An optional timeout for Unresponsive commands in seconds. This should be less than default_command_timeout. -max_feed_count = 200 # The maximum number of frames that will be fed to a socket before flushing. -cluster_enabled = true # boolean -cluster_urls = ["redis.cluster.uri-1:8080", "redis.cluster.uri-2:4115"] # List of redis cluster urls +max_feed_count = 200 # The maximum number of frames that will be fed to a socket before flushing. +cluster_enabled = true # boolean +cluster_urls = [ + "redis.cluster.uri-1:8080", + "redis.cluster.uri-2:4115", +] # List of redis cluster urls # Replica SQL data store credentials [replica_database] @@ -193,6 +200,20 @@ payment_function = "report_download_config_payment_function" # Config to downloa refund_function = "report_download_config_refund_function" # Config to download refund report region = "report_download_config_region" # Region of the bucket +[opensearch] +host = "https://localhost:9200" + +[opensearch.auth] +auth = "basic" +username = "admin" +password = "admin" +region = "eu-central-1" + +[opensearch.indexes] +payment_attempts = "hyperswitch-payment-attempt-events" +payment_intents = "hyperswitch-payment-intent-events" +refunds = "hyperswitch-refund-events" + # This section provides some secret values. [secrets] master_enc_key = "sample_key" # Master Encryption key used to encrypt merchant wise encryption key. Should be 32-byte long. @@ -213,15 +234,15 @@ shutdown_timeout = 30 request_body_limit = 32_768 [secrets_management] -secrets_manager = "aws_kms" # Secrets manager client to be used +secrets_manager = "aws_kms" # Secrets manager client to be used [secrets_management.aws_kms] -key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data. -region = "kms_region" # The AWS region used by the KMS SDK for decrypting data. +key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data. +region = "kms_region" # The AWS region used by the KMS SDK for decrypting data. [encryption_management] -encryption_manager = "aws_kms" # Encryption manager client to be used +encryption_manager = "aws_kms" # Encryption manager client to be used [encryption_management.aws_kms] -key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data. -region = "kms_region" # The AWS region used by the KMS SDK for decrypting data. +key_id = "kms_key_id" # The AWS key ID used by the KMS SDK for decrypting data. +region = "kms_region" # The AWS region used by the KMS SDK for decrypting data. diff --git a/config/development.toml b/config/development.toml index 16851c90cc..a7abec7fb7 100644 --- a/config/development.toml +++ b/config/development.toml @@ -273,7 +273,7 @@ adyen = { banks = "blik_psp,place_zipko,m_bank,pay_with_ing,santander_przelew24, stripe = { banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_pekao_sa,banki_spbdzielcze,blik,bnp_paribas,boz,citi,credit_agricole,e_transfer_pocztowy24,getin_bank,idea_bank,inteligo,mbank_mtransfer,nest_przelew,noble_pay,pbac_z_ipko,plus_bank,santander_przelew24,toyota_bank,volkswagen_bank" } [bank_config.open_banking_uk] -adyen = { banks = "aib,bank_of_scotland,danske_bank,first_direct,first_trust,halifax,lloyds,monzo,nat_west,nationwide_bank,royal_bank_of_scotland,starling,tsb_bank,tesco_bank,ulster_bank,barclays,hsbc_bank,revolut,santander_przelew24,open_bank_success,open_bank_failure,open_bank_cancelled"} +adyen = { banks = "aib,bank_of_scotland,danske_bank,first_direct,first_trust,halifax,lloyds,monzo,nat_west,nationwide_bank,royal_bank_of_scotland,starling,tsb_bank,tesco_bank,ulster_bank,barclays,hsbc_bank,revolut,santander_przelew24,open_bank_success,open_bank_failure,open_bank_cancelled" } [bank_config.online_banking_fpx] adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,maybank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank" @@ -306,7 +306,7 @@ ideal = { country = "NL", currency = "EUR" } cashapp = { country = "US", currency = "USD" } [pm_filters.volt] -open_banking_uk = {country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL"} +open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" } [pm_filters.adyen] google_pay = { country = "AU,NZ,JP,HK,SG,MY,TH,VN,BH,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,RO,HR,LI,MT,SI,GR,PT,IE,CZ,EE,LT,LV,IT,PL,TR,IS,CA,US", currency = "AED,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HTG,HUF,IDR,ILS,INR,IQD,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LYD,MAD,MDL,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLE,SOS,SRD,STN,SVC,SZL,THB,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" } @@ -316,54 +316,54 @@ mobile_pay = { country = "DK,FI", currency = "DKK,SEK,NOK,EUR" } ali_pay = { country = "AU,JP,HK,SG,MY,TH,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,FI,RO,MT,SI,GR,PT,IE,IT,CA,US", currency = "USD,EUR,GBP,JPY,AUD,SGD,CHF,SEK,NOK,NZD,THB,HKD,CAD" } we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD" } mb_way = { country = "PT", currency = "EUR" } -klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD"} +klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD" } affirm = { country = "US", currency = "USD" } afterpay_clearpay = { country = "AU,NZ,ES,GB,FR,IT,CA,US", currency = "GBP" } pay_bright = { country = "CA", currency = "CAD" } walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" } giropay = { country = "DE", currency = "EUR" } eps = { country = "AT", currency = "EUR" } -sofort = {not_available_flows = { capture_method = "manual" }, country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR"} +sofort = { not_available_flows = { capture_method = "manual" }, country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR" } ideal = { not_available_flows = { capture_method = "manual" }, country = "NL", currency = "EUR" } -blik = {country = "PL", currency = "PLN"} -trustly = {country = "ES,GB,SE,NO,AT,NL,DE,DK,FI,EE,LT,LV", currency = "CZK,DKK,EUR,GBP,NOK,SEK"} -online_banking_czech_republic = {country = "CZ", currency = "EUR,CZK"} -online_banking_finland = {country = "FI", currency = "EUR"} -online_banking_poland = {country = "PL", currency = "PLN"} -online_banking_slovakia = {country = "SK", currency = "EUR,CZK"} -bancontact_card = {country = "BE", currency = "EUR"} -ach = {country = "US", currency = "USD"} -bacs = {country = "GB", currency = "GBP"} -sepa = {country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT", currency = "EUR"} -ali_pay_hk = {country = "HK", currency = "HKD"} -bizum = {country = "ES", currency = "EUR"} -go_pay = {country = "ID", currency = "IDR"} -kakao_pay = {country = "KR", currency = "KRW"} -momo = {country = "VN", currency = "VND"} -gcash = {country = "PH", currency = "PHP"} -online_banking_fpx = {country = "MY", currency = "MYR"} -online_banking_thailand = {country = "TH", currency = "THB"} -touch_n_go = {country = "MY", currency = "MYR"} -atome = {country = "MY,SG", currency = "MYR,SGD"} -swish = {country = "SE", currency = "SEK"} -permata_bank_transfer = {country = "ID", currency = "IDR"} -bca_bank_transfer = {country = "ID", currency = "IDR"} -bni_va = {country = "ID", currency = "IDR"} -bri_va = {country = "ID", currency = "IDR"} -cimb_va = {country = "ID", currency = "IDR"} -danamon_va = {country = "ID", currency = "IDR"} -mandiri_va = {country = "ID", currency = "IDR"} -alfamart = {country = "ID", currency = "IDR"} -indomaret = {country = "ID", currency = "IDR"} -open_banking_uk = {country = "GB", currency = "GBP"} -oxxo = {country = "MX", currency = "MXN"} -pay_safe_card = {country = "AT,AU,BE,BR,BE,CA,HR,CY,CZ,DK,FI,FR,GE,DE,GI,HU,IS,IE,KW,LV,IE,LI,LT,LU,MT,MX,MD,ME,NL,NZ,NO,PY,PE,PL,PT,RO,SA,RS,SK,SI,ES,SE,CH,TR,AE,GB,US,UY", currency = "EUR,AUD,BRL,CAD,CZK,DKK,GEL,GIP,HUF,KWD,CHF,MXN,MDL,NZD,NOK,PYG,PEN,PLN,RON,SAR,RSD,SEK,TRY,AED,GBP,USD,UYU"} -seven_eleven = {country = "JP", currency = "JPY"} -lawson = {country = "JP", currency = "JPY"} -mini_stop = {country = "JP", currency = "JPY"} -family_mart = {country = "JP", currency = "JPY"} -seicomart = {country = "JP", currency = "JPY"} -pay_easy = {country = "JP", currency = "JPY"} +blik = { country = "PL", currency = "PLN" } +trustly = { country = "ES,GB,SE,NO,AT,NL,DE,DK,FI,EE,LT,LV", currency = "CZK,DKK,EUR,GBP,NOK,SEK" } +online_banking_czech_republic = { country = "CZ", currency = "EUR,CZK" } +online_banking_finland = { country = "FI", currency = "EUR" } +online_banking_poland = { country = "PL", currency = "PLN" } +online_banking_slovakia = { country = "SK", currency = "EUR,CZK" } +bancontact_card = { country = "BE", currency = "EUR" } +ach = { country = "US", currency = "USD" } +bacs = { country = "GB", currency = "GBP" } +sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT", currency = "EUR" } +ali_pay_hk = { country = "HK", currency = "HKD" } +bizum = { country = "ES", currency = "EUR" } +go_pay = { country = "ID", currency = "IDR" } +kakao_pay = { country = "KR", currency = "KRW" } +momo = { country = "VN", currency = "VND" } +gcash = { country = "PH", currency = "PHP" } +online_banking_fpx = { country = "MY", currency = "MYR" } +online_banking_thailand = { country = "TH", currency = "THB" } +touch_n_go = { country = "MY", currency = "MYR" } +atome = { country = "MY,SG", currency = "MYR,SGD" } +swish = { country = "SE", currency = "SEK" } +permata_bank_transfer = { country = "ID", currency = "IDR" } +bca_bank_transfer = { country = "ID", currency = "IDR" } +bni_va = { country = "ID", currency = "IDR" } +bri_va = { country = "ID", currency = "IDR" } +cimb_va = { country = "ID", currency = "IDR" } +danamon_va = { country = "ID", currency = "IDR" } +mandiri_va = { country = "ID", currency = "IDR" } +alfamart = { country = "ID", currency = "IDR" } +indomaret = { country = "ID", currency = "IDR" } +open_banking_uk = { country = "GB", currency = "GBP" } +oxxo = { country = "MX", currency = "MXN" } +pay_safe_card = { country = "AT,AU,BE,BR,BE,CA,HR,CY,CZ,DK,FI,FR,GE,DE,GI,HU,IS,IE,KW,LV,IE,LI,LT,LU,MT,MX,MD,ME,NL,NZ,NO,PY,PE,PL,PT,RO,SA,RS,SK,SI,ES,SE,CH,TR,AE,GB,US,UY", currency = "EUR,AUD,BRL,CAD,CZK,DKK,GEL,GIP,HUF,KWD,CHF,MXN,MDL,NZD,NOK,PYG,PEN,PLN,RON,SAR,RSD,SEK,TRY,AED,GBP,USD,UYU" } +seven_eleven = { country = "JP", currency = "JPY" } +lawson = { country = "JP", currency = "JPY" } +mini_stop = { country = "JP", currency = "JPY" } +family_mart = { country = "JP", currency = "JPY" } +seicomart = { country = "JP", currency = "JPY" } +pay_easy = { country = "JP", currency = "JPY" } pix = { country = "BR", currency = "BRL" } boleto = { country = "BR", currency = "BRL" } @@ -443,21 +443,21 @@ debit = { currency = "USD" } stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } } checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" } stax = { long_lived_token = true, payment_method = "card,bank_debit" } -mollie = {long_lived_token = false, payment_method = "card"} -square = {long_lived_token = false, payment_method = "card"} +mollie = { long_lived_token = false, payment_method = "card" } +square = { long_lived_token = false, payment_method = "card" } braintree = { long_lived_token = false, payment_method = "card" } -payme = {long_lived_token = false, payment_method = "card"} -gocardless = {long_lived_token = true, payment_method = "bank_debit"} +payme = { long_lived_token = false, payment_method = "card" } +gocardless = { long_lived_token = true, payment_method = "bank_debit" } [temp_locker_enable_config] -stripe = {payment_method = "bank_transfer"} -nuvei = {payment_method = "card"} -shift4 = {payment_method = "card"} -bluesnap = {payment_method = "card"} -bankofamerica = {payment_method = "card"} -cybersource = {payment_method = "card"} -nmi = {payment_method = "card"} -payme = {payment_method = "card"} +stripe = { payment_method = "bank_transfer" } +nuvei = { payment_method = "card" } +shift4 = { payment_method = "card" } +bluesnap = { payment_method = "card" } +bankofamerica = { payment_method = "card" } +cybersource = { payment_method = "card" } +nmi = { payment_method = "card" } +payme = { payment_method = "card" } [connector_customer] connector_list = "gocardless,stax,stripe" @@ -496,16 +496,16 @@ wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon" } wallet.paypal = { connector_list = "adyen" } card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon" } card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon" } -bank_debit.ach = { connector_list = "gocardless"} -bank_debit.becs = { connector_list = "gocardless"} -bank_debit.sepa = { connector_list = "gocardless"} -bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"} -bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"} -bank_redirect.giropay = {connector_list = "adyen,globalpay"} +bank_debit.ach = { connector_list = "gocardless" } +bank_debit.becs = { connector_list = "gocardless" } +bank_debit.sepa = { connector_list = "gocardless" } +bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } +bank_redirect.sofort = { connector_list = "stripe,adyen,globalpay" } +bank_redirect.giropay = { connector_list = "adyen,globalpay" } [mandates.update_mandate_supported] -card.credit ={connector_list ="cybersource"} -card.debit = {connector_list ="cybersource"} +card.credit = { connector_list = "cybersource" } +card.debit = { connector_list = "cybersource" } [connector_request_reference_id_config] merchant_ids_send_payment_id_as_connector_request_id = [] @@ -530,7 +530,7 @@ redis_expiry = 900 pm_auth_key = "Some_pm_auth_key" [lock_settings] -redis_lock_expiry_seconds = 180 # 3 * 60 seconds +redis_lock_expiry_seconds = 180 # 3 * 60 seconds delay_between_retries_in_milliseconds = 500 [kv_config] @@ -582,3 +582,17 @@ file_storage_backend = "file_system" [unmasked_headers] keys = "user-agent" + +[opensearch] +host = "https://localhost:9200" + +[opensearch.auth] +auth = "basic" +username = "admin" +password = "admin" +region = "eu-central-1" + +[opensearch.indexes] +payment_attempts = "hyperswitch-payment-attempt-events" +payment_intents = "hyperswitch-payment-intent-events" +refunds = "hyperswitch-refund-events" diff --git a/config/docker_compose.toml b/config/docker_compose.toml index 2f94d69790..4d1731b53f 100644 --- a/config/docker_compose.toml +++ b/config/docker_compose.toml @@ -15,7 +15,7 @@ level = "DEBUG" # What you see in your terminal. [log.telemetry] traces_enabled = false # Whether traces are enabled. -metrics_enabled = true # Whether metrics are enabled. +metrics_enabled = true # Whether metrics are enabled. ignore_errors = false # Whether to ignore errors during traces or metrics pipeline setup. otel_exporter_otlp_endpoint = "https://otel-collector:4317" # Endpoint to send metrics and traces to. use_xray_generator = false @@ -244,21 +244,21 @@ workers = 1 [tokenization] stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } } checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" } -mollie = {long_lived_token = false, payment_method = "card"} +mollie = { long_lived_token = false, payment_method = "card" } stax = { long_lived_token = true, payment_method = "card,bank_debit" } -square = {long_lived_token = false, payment_method = "card"} +square = { long_lived_token = false, payment_method = "card" } braintree = { long_lived_token = false, payment_method = "card" } -gocardless = {long_lived_token = true, payment_method = "bank_debit"} +gocardless = { long_lived_token = true, payment_method = "bank_debit" } [temp_locker_enable_config] -stripe = {payment_method = "bank_transfer"} -nuvei = {payment_method = "card"} -shift4 = {payment_method = "card"} -bluesnap = {payment_method = "card"} -bankofamerica = {payment_method = "card"} -cybersource = {payment_method = "card"} -nmi = {payment_method = "card"} -payme = {payment_method = "card"} +stripe = { payment_method = "bank_transfer" } +nuvei = { payment_method = "card" } +shift4 = { payment_method = "card" } +bluesnap = { payment_method = "card" } +bankofamerica = { payment_method = "card" } +cybersource = { payment_method = "card" } +nmi = { payment_method = "card" } +payme = { payment_method = "card" } [dummy_connector] enabled = true @@ -284,38 +284,38 @@ discord_invite_url = "https://discord.gg/wJZ7DVW8mm" payout_eligibility = true [pm_filters.adyen] -online_banking_fpx = {country = "MY", currency = "MYR"} -online_banking_thailand = {country = "TH", currency = "THB"} -touch_n_go = {country = "MY", currency = "MYR"} -atome = {country = "MY,SG", currency = "MYR,SGD"} -swish = {country = "SE", currency = "SEK"} -permata_bank_transfer = {country = "ID", currency = "IDR"} -bca_bank_transfer = {country = "ID", currency = "IDR"} -bni_va = {country = "ID", currency = "IDR"} -bri_va = {country = "ID", currency = "IDR"} -cimb_va = {country = "ID", currency = "IDR"} -danamon_va = {country = "ID", currency = "IDR"} -mandiri_va = {country = "ID", currency = "IDR"} -alfamart = {country = "ID", currency = "IDR"} -indomaret = {country = "ID", currency = "IDR"} -open_banking_uk = {country = "GB", currency = "GBP"} -oxxo = {country = "MX", currency = "MXN"} -pay_safe_card = {country = "AT,AU,BE,BR,BE,CA,HR,CY,CZ,DK,FI,FR,GE,DE,GI,HU,IS,IE,KW,LV,IE,LI,LT,LU,MT,MX,MD,ME,NL,NZ,NO,PY,PE,PL,PT,RO,SA,RS,SK,SI,ES,SE,CH,TR,AE,GB,US,UY", currency = "EUR,AUD,BRL,CAD,CZK,DKK,GEL,GIP,HUF,KWD,CHF,MXN,MDL,NZD,NOK,PYG,PEN,PLN,RON,SAR,RSD,SEK,TRY,AED,GBP,USD,UYU"} -seven_eleven = {country = "JP", currency = "JPY"} -lawson = {country = "JP", currency = "JPY"} -mini_stop = {country = "JP", currency = "JPY"} -family_mart = {country = "JP", currency = "JPY"} -seicomart = {country = "JP", currency = "JPY"} -pay_easy = {country = "JP", currency = "JPY"} +online_banking_fpx = { country = "MY", currency = "MYR" } +online_banking_thailand = { country = "TH", currency = "THB" } +touch_n_go = { country = "MY", currency = "MYR" } +atome = { country = "MY,SG", currency = "MYR,SGD" } +swish = { country = "SE", currency = "SEK" } +permata_bank_transfer = { country = "ID", currency = "IDR" } +bca_bank_transfer = { country = "ID", currency = "IDR" } +bni_va = { country = "ID", currency = "IDR" } +bri_va = { country = "ID", currency = "IDR" } +cimb_va = { country = "ID", currency = "IDR" } +danamon_va = { country = "ID", currency = "IDR" } +mandiri_va = { country = "ID", currency = "IDR" } +alfamart = { country = "ID", currency = "IDR" } +indomaret = { country = "ID", currency = "IDR" } +open_banking_uk = { country = "GB", currency = "GBP" } +oxxo = { country = "MX", currency = "MXN" } +pay_safe_card = { country = "AT,AU,BE,BR,BE,CA,HR,CY,CZ,DK,FI,FR,GE,DE,GI,HU,IS,IE,KW,LV,IE,LI,LT,LU,MT,MX,MD,ME,NL,NZ,NO,PY,PE,PL,PT,RO,SA,RS,SK,SI,ES,SE,CH,TR,AE,GB,US,UY", currency = "EUR,AUD,BRL,CAD,CZK,DKK,GEL,GIP,HUF,KWD,CHF,MXN,MDL,NZD,NOK,PYG,PEN,PLN,RON,SAR,RSD,SEK,TRY,AED,GBP,USD,UYU" } +seven_eleven = { country = "JP", currency = "JPY" } +lawson = { country = "JP", currency = "JPY" } +mini_stop = { country = "JP", currency = "JPY" } +family_mart = { country = "JP", currency = "JPY" } +seicomart = { country = "JP", currency = "JPY" } +pay_easy = { country = "JP", currency = "JPY" } boleto = { country = "BR", currency = "BRL" } ideal = { country = "NL", currency = "EUR" } -klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD"} +klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD" } paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD" } -sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR"} +sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR" } [pm_filters.volt] -open_banking_uk = {country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL"} +open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" } [pm_filters.zen] credit = { not_available_flows = { capture_method = "manual" } } @@ -330,7 +330,7 @@ red_compra = { country = "CL", currency = "CLP" } red_pagos = { country = "UY", currency = "UYU" } [pm_filters.stripe] -cashapp = {country = "US", currency = "USD"} +cashapp = { country = "US", currency = "USD" } [pm_filters.prophetpay] card_redirect = { currency = "USD" } @@ -357,25 +357,25 @@ adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamal adyen.banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank" [bank_config.open_banking_uk] -adyen = { banks = "aib,bank_of_scotland,danske_bank,first_direct,first_trust,halifax,lloyds,monzo,nat_west,nationwide_bank,royal_bank_of_scotland,starling,tsb_bank,tesco_bank,ulster_bank,barclays,hsbc_bank,revolut,santander_przelew24,open_bank_success,open_bank_failure,open_bank_cancelled"} +adyen = { banks = "aib,bank_of_scotland,danske_bank,first_direct,first_trust,halifax,lloyds,monzo,nat_west,nationwide_bank,royal_bank_of_scotland,starling,tsb_bank,tesco_bank,ulster_bank,barclays,hsbc_bank,revolut,santander_przelew24,open_bank_success,open_bank_failure,open_bank_cancelled" } [mandates.supported_payment_methods] -pay_later.klarna = {connector_list = "adyen"} -wallet.google_pay = {connector_list = "stripe,adyen"} -wallet.apple_pay = {connector_list = "stripe,adyen,cybersource,noon"} -wallet.paypal = {connector_list = "adyen"} -card.credit = {connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon"} -card.debit = {connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon"} -bank_debit.ach = { connector_list = "gocardless"} -bank_debit.becs = { connector_list = "gocardless"} -bank_debit.sepa = { connector_list = "gocardless"} -bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"} -bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"} -bank_redirect.giropay = {connector_list = "adyen,globalpay"} +pay_later.klarna = { connector_list = "adyen" } +wallet.google_pay = { connector_list = "stripe,adyen" } +wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon" } +wallet.paypal = { connector_list = "adyen" } +card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon" } +card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon" } +bank_debit.ach = { connector_list = "gocardless" } +bank_debit.becs = { connector_list = "gocardless" } +bank_debit.sepa = { connector_list = "gocardless" } +bank_redirect.ideal = { connector_list = "stripe,adyen,globalpay" } +bank_redirect.sofort = { connector_list = "stripe,adyen,globalpay" } +bank_redirect.giropay = { connector_list = "adyen,globalpay" } [mandates.update_mandate_supported] -card.credit ={connector_list ="cybersource"} -card.debit = {connector_list ="cybersource"} +card.credit = { connector_list = "cybersource" } +card.debit = { connector_list = "cybersource" } [connector_customer] connector_list = "gocardless,stax,stripe" @@ -389,7 +389,7 @@ redis_expiry = 900 pm_auth_key = "Some_pm_auth_key" [lock_settings] -redis_lock_expiry_seconds = 180 # 3 * 60 seconds +redis_lock_expiry_seconds = 180 # 3 * 60 seconds delay_between_retries_in_milliseconds = 500 [events.kafka] @@ -440,4 +440,18 @@ source = "logs" file_storage_backend = "file_system" [unmasked_headers] -keys = "user-agent" \ No newline at end of file +keys = "user-agent" + +[opensearch] +host = "https://opensearch:9200" + +[opensearch.auth] +auth = "basic" +username = "admin" +password = "admin" +region = "eu-central-1" + +[opensearch.indexes] +payment_attempts = "hyperswitch-payment-attempt-events" +payment_intents = "hyperswitch-payment-intent-events" +refunds = "hyperswitch-refund-events" \ No newline at end of file diff --git a/crates/analytics/Cargo.toml b/crates/analytics/Cargo.toml index f3e0149213..f07e0a94ea 100644 --- a/crates/analytics/Cargo.toml +++ b/crates/analytics/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "analytics" version = "0.1.0" -description = "Analytics / Reports related functionality" +description = "Analytics / Reports / Search related functionality" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -9,29 +9,43 @@ edition = "2021" [dependencies] # First party crates -api_models = { version = "0.1.0", path = "../api_models" , features = ["errors"]} +api_models = { version = "0.1.0", path = "../api_models", features = [ + "errors", +] } storage_impl = { version = "0.1.0", path = "../storage_impl", default-features = false } common_utils = { version = "0.1.0", path = "../common_utils" } external_services = { version = "0.1.0", path = "../external_services", default-features = false } hyperswitch_interfaces = { version = "0.1.0", path = "../hyperswitch_interfaces" } masking = { version = "0.1.0", path = "../masking" } -router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] } -diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"] } +router_env = { version = "0.1.0", path = "../router_env", features = [ + "log_extra_implicit_fields", + "log_custom_entries_to_extra", +] } +diesel_models = { version = "0.1.0", path = "../diesel_models", features = [ + "kv_store", +] } #Third Party dependencies actix-web = "4.3.1" async-trait = "0.1.68" -aws-config = { version = "0.55.3" } -aws-sdk-lambda = { version = "0.28.0" } -aws-smithy-types = { version = "0.55.3" } +aws-config = { version = "1.1.6", features = ["behavior-version-latest"] } +aws-sdk-lambda = { version = "1.1.4" } +aws-smithy-types = { version = "1.1.6" } bigdecimal = { version = "0.3.1", features = ["serde"] } error-stack = "0.3.1" futures = "0.3.28" +opensearch = { version = "2.2.0", features = ["aws-auth"] } once_cell = "1.18.0" reqwest = { version = "0.11.18", features = ["serde_json"] } serde = { version = "1.0.193", features = ["derive", "rc"] } serde_json = "1.0.108" -sqlx = { version = "0.6.3", features = ["postgres", "runtime-actix", "runtime-actix-native-tls", "time", "bigdecimal"] } +sqlx = { version = "0.6.3", features = [ + "postgres", + "runtime-actix", + "runtime-actix-native-tls", + "time", + "bigdecimal", +] } strum = { version = "0.25.0", features = ["derive"] } thiserror = "1.0.43" time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] } diff --git a/crates/analytics/src/lambda_utils.rs b/crates/analytics/src/lambda_utils.rs index f9446a402b..4f8320f29b 100644 --- a/crates/analytics/src/lambda_utils.rs +++ b/crates/analytics/src/lambda_utils.rs @@ -1,5 +1,5 @@ -use aws_config::{self, meta::region::RegionProviderChain}; -use aws_sdk_lambda::{config::Region, types::InvocationType::Event, Client}; +use aws_config::{self, meta::region::RegionProviderChain, Region}; +use aws_sdk_lambda::{types::InvocationType::Event, Client}; use aws_smithy_types::Blob; use common_utils::errors::CustomResult; use error_stack::{IntoReport, ResultExt}; diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs index d8de32a732..68ca51a0df 100644 --- a/crates/analytics/src/lib.rs +++ b/crates/analytics/src/lib.rs @@ -12,6 +12,7 @@ pub mod connector_events; pub mod health_check; pub mod outgoing_webhook_event; pub mod sdk_events; +pub mod search; mod sqlx; mod types; use api_event::metrics::{ApiEventMetric, ApiEventMetricRow}; @@ -664,3 +665,42 @@ pub struct ReportConfig { pub dispute_function: String, pub region: String, } + +#[derive(Clone, Debug, serde::Deserialize)] +#[serde(tag = "auth")] +#[serde(rename_all = "lowercase")] +pub enum OpensearchAuth { + Basic { username: String, password: String }, + Aws { region: String }, +} + +#[derive(Clone, Debug, serde::Deserialize)] +pub struct OpensearchIndexes { + pub payment_attempts: String, + pub payment_intents: String, + pub refunds: String, +} + +#[derive(Clone, Debug, serde::Deserialize)] +pub struct OpensearchConfig { + host: String, + auth: OpensearchAuth, + indexes: OpensearchIndexes, +} + +impl Default for OpensearchConfig { + fn default() -> Self { + Self { + host: "https://localhost:9200".to_string(), + auth: OpensearchAuth::Basic { + username: "admin".to_string(), + password: "admin".to_string(), + }, + indexes: OpensearchIndexes { + payment_attempts: "hyperswitch-payment-attempt-events".to_string(), + payment_intents: "hyperswitch-payment-intent-events".to_string(), + refunds: "hyperswitch-refund-events".to_string(), + }, + } + } +} diff --git a/crates/analytics/src/search.rs b/crates/analytics/src/search.rs new file mode 100644 index 0000000000..8637c9d110 --- /dev/null +++ b/crates/analytics/src/search.rs @@ -0,0 +1,150 @@ +use api_models::analytics::search::{ + GetGlobalSearchRequest, GetSearchRequestWithIndex, GetSearchResponse, OpenMsearchOutput, + OpensearchOutput, SearchIndex, +}; +use aws_config::{self, meta::region::RegionProviderChain, Region}; +use common_utils::errors::CustomResult; +use opensearch::{ + auth::Credentials, + cert::CertificateValidation, + http::{ + request::JsonBody, + transport::{SingleNodeConnectionPool, TransportBuilder}, + Url, + }, + MsearchParts, OpenSearch, SearchParts, +}; +use serde_json::{json, Value}; +use strum::IntoEnumIterator; + +use crate::{errors::AnalyticsError, OpensearchAuth, OpensearchConfig, OpensearchIndexes}; + +#[derive(Debug, thiserror::Error)] +pub enum OpensearchError { + #[error("Opensearch connection error")] + ConnectionError, + #[error("Opensearch NON-200 response content: '{0}'")] + ResponseNotOK(String), + #[error("Opensearch response error")] + ResponseError, +} + +pub fn search_index_to_opensearch_index(index: SearchIndex, config: &OpensearchIndexes) -> String { + match index { + SearchIndex::PaymentAttempts => config.payment_attempts.clone(), + SearchIndex::PaymentIntents => config.payment_intents.clone(), + SearchIndex::Refunds => config.refunds.clone(), + } +} + +async fn get_opensearch_client(config: OpensearchConfig) -> Result { + let url = Url::parse(&config.host).map_err(|_| OpensearchError::ConnectionError)?; + let transport = match config.auth { + OpensearchAuth::Basic { username, password } => { + let credentials = Credentials::Basic(username, password); + TransportBuilder::new(SingleNodeConnectionPool::new(url)) + .cert_validation(CertificateValidation::None) + .auth(credentials) + .build() + .map_err(|_| OpensearchError::ConnectionError)? + } + OpensearchAuth::Aws { region } => { + let region_provider = RegionProviderChain::first_try(Region::new(region)); + let sdk_config = aws_config::from_env().region(region_provider).load().await; + let conn_pool = SingleNodeConnectionPool::new(url); + TransportBuilder::new(conn_pool) + .auth( + sdk_config + .clone() + .try_into() + .map_err(|_| OpensearchError::ConnectionError)?, + ) + .service_name("es") + .build() + .map_err(|_| OpensearchError::ConnectionError)? + } + }; + Ok(OpenSearch::new(transport)) +} + +pub async fn msearch_results( + req: GetGlobalSearchRequest, + merchant_id: &String, + config: OpensearchConfig, +) -> CustomResult, AnalyticsError> { + let client = get_opensearch_client(config.clone()) + .await + .map_err(|_| AnalyticsError::UnknownError)?; + + let mut msearch_vector: Vec> = vec![]; + for index in SearchIndex::iter() { + msearch_vector + .push(json!({"index": search_index_to_opensearch_index(index,&config.indexes)}).into()); + msearch_vector.push(json!({"query": {"bool": {"must": {"query_string": {"query": req.query}}, "filter": {"match_phrase": {"merchant_id": merchant_id}}}}}).into()); + } + + let response = client + .msearch(MsearchParts::None) + .body(msearch_vector) + .send() + .await + .map_err(|_| AnalyticsError::UnknownError)?; + + let response_body = response + .json::>() + .await + .map_err(|_| AnalyticsError::UnknownError)?; + + Ok(response_body + .responses + .into_iter() + .zip(SearchIndex::iter()) + .map(|(index_hit, index)| GetSearchResponse { + count: index_hit.hits.total.value, + index, + hits: index_hit + .hits + .hits + .into_iter() + .map(|hit| hit._source) + .collect(), + }) + .collect()) +} + +pub async fn search_results( + req: GetSearchRequestWithIndex, + merchant_id: &String, + config: OpensearchConfig, +) -> CustomResult { + let search_req = req.search_req; + + let client = get_opensearch_client(config.clone()) + .await + .map_err(|_| AnalyticsError::UnknownError)?; + + let response = client + .search(SearchParts::Index(&[&search_index_to_opensearch_index(req.index.clone(),&config.indexes)])) + .from(search_req.offset) + .size(search_req.count) + .body(json!({"query": {"bool": {"must": {"query_string": {"query": search_req.query}}, "filter": {"match_phrase": {"merchant_id": merchant_id}}}}})) + .send() + .await + .map_err(|_| AnalyticsError::UnknownError)?; + + let response_body = response + .json::>() + .await + .map_err(|_| AnalyticsError::UnknownError)?; + + Ok(GetSearchResponse { + count: response_body.hits.total.value, + index: req.index, + hits: response_body + .hits + .hits + .into_iter() + .map(|hit| hit._source) + .collect(), + }) +} diff --git a/crates/api_models/src/analytics.rs b/crates/api_models/src/analytics.rs index 1434c35779..ad035c707c 100644 --- a/crates/api_models/src/analytics.rs +++ b/crates/api_models/src/analytics.rs @@ -19,6 +19,7 @@ pub mod outgoing_webhook_event; pub mod payments; pub mod refunds; pub mod sdk_events; +pub mod search; #[derive(Debug, serde::Serialize)] pub struct NameDescription { @@ -251,7 +252,6 @@ pub struct GetApiEventMetricRequest { #[derive(Debug, serde::Deserialize, serde::Serialize)] #[serde(rename_all = "camelCase")] - pub struct GetDisputeFilterRequest { pub time_range: TimeRange, #[serde(default)] diff --git a/crates/api_models/src/analytics/search.rs b/crates/api_models/src/analytics/search.rs new file mode 100644 index 0000000000..07223c9066 --- /dev/null +++ b/crates/api_models/src/analytics/search.rs @@ -0,0 +1,73 @@ +use serde_json::Value; + +#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] +pub struct SearchFilters { + pub payment_method: Option>, +} + +#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] +#[serde(rename_all = "camelCase")] +pub struct GetGlobalSearchRequest { + pub query: String, + #[serde(default)] + pub filters: Option, +} + +#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] +#[serde(rename_all = "camelCase")] +pub struct GetSearchRequest { + pub offset: i64, + pub count: i64, + pub query: String, + #[serde(default)] + pub filters: Option, +} + +#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] +#[serde(rename_all = "camelCase")] +pub struct GetSearchRequestWithIndex { + pub index: SearchIndex, + pub search_req: GetSearchRequest, +} + +#[derive(Debug, strum::EnumIter, Clone, serde::Deserialize, serde::Serialize)] +#[serde(rename_all = "snake_case")] +pub enum SearchIndex { + PaymentAttempts, + PaymentIntents, + Refunds, +} + +#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] +#[serde(rename_all = "camelCase")] +pub struct GetSearchResponse { + pub count: u64, + pub index: SearchIndex, + pub hits: Vec, +} + +#[derive(Debug, serde::Deserialize)] +pub struct OpenMsearchOutput { + pub responses: Vec>, +} + +#[derive(Debug, serde::Deserialize)] +pub struct OpensearchOutput { + pub hits: OpensearchResults, +} + +#[derive(Debug, serde::Deserialize)] +pub struct OpensearchResults { + pub total: OpensearchResultsTotal, + pub hits: Vec>, +} + +#[derive(Debug, serde::Deserialize)] +pub struct OpensearchResultsTotal { + pub value: u64, +} + +#[derive(Debug, serde::Deserialize)] +pub struct OpensearchHits { + pub _source: T, +} diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs index 218881389d..46fa8caa6d 100644 --- a/crates/api_models/src/events.rs +++ b/crates/api_models/src/events.rs @@ -23,7 +23,7 @@ use crate::{ admin::*, analytics::{ api_event::*, connector_events::ConnectorEventsRequest, - outgoing_webhook_event::OutgoingWebhookLogsRequest, sdk_events::*, *, + outgoing_webhook_event::OutgoingWebhookLogsRequest, sdk_events::*, search::*, *, }, api_keys::*, cards_info::*, @@ -96,6 +96,10 @@ impl_misc_api_event_type!( ReportRequest, ConnectorEventsRequest, OutgoingWebhookLogsRequest, + GetGlobalSearchRequest, + GetSearchRequest, + GetSearchResponse, + GetSearchRequestWithIndex, GetDisputeFilterRequest, DisputeFiltersResponse, GetDisputeMetricRequest diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs index f7bee88b8c..a9c2b8995b 100644 --- a/crates/router/src/analytics.rs +++ b/crates/router/src/analytics.rs @@ -8,6 +8,9 @@ pub mod routes { outgoing_webhook_event::outgoing_webhook_events_core, sdk_events::sdk_events_core, }; use api_models::analytics::{ + search::{ + GetGlobalSearchRequest, GetSearchRequest, GetSearchRequestWithIndex, SearchIndex, + }, GenerateReportRequest, GetApiEventFiltersRequest, GetApiEventMetricRequest, GetDisputeMetricRequest, GetPaymentFiltersRequest, GetPaymentMetricRequest, GetRefundFilterRequest, GetRefundMetricRequest, GetSdkEventFiltersRequest, @@ -89,6 +92,12 @@ pub mod routes { web::resource("metrics/api_events") .route(web::post().to(get_api_events_metrics)), ) + .service( + web::resource("search").route(web::post().to(get_global_search_results)), + ) + .service( + web::resource("search/{domain}").route(web::post().to(get_search_results)), + ) .service( web::resource("filters/disputes") .route(web::post().to(get_dispute_filters)), @@ -113,7 +122,7 @@ pub mod routes { state, &req, domain.into_inner(), - |_, _, domain| async { + |_, _, domain: analytics::AnalyticsDomain| async { analytics::core::get_domain_info(domain) .await .map(ApplicationResponse::Json) @@ -592,6 +601,63 @@ pub mod routes { .await } + pub async fn get_global_search_results( + state: web::Data, + req: actix_web::HttpRequest, + json_payload: web::Json, + ) -> impl Responder { + let flow = AnalyticsFlow::GetGlobalSearchResults; + Box::pin(api::server_wrap( + flow, + state.clone(), + &req, + json_payload.into_inner(), + |state, auth: AuthenticationData, req| async move { + analytics::search::msearch_results( + req, + &auth.merchant_account.merchant_id, + state.conf.opensearch.clone(), + ) + .await + .map(ApplicationResponse::Json) + }, + &auth::JWTAuth(Permission::Analytics), + api_locking::LockAction::NotApplicable, + )) + .await + } + + pub async fn get_search_results( + state: web::Data, + req: actix_web::HttpRequest, + json_payload: web::Json, + index: actix_web::web::Path, + ) -> impl Responder { + let flow = AnalyticsFlow::GetSearchResults; + let indexed_req = GetSearchRequestWithIndex { + search_req: json_payload.into_inner(), + index: index.into_inner(), + }; + Box::pin(api::server_wrap( + flow, + state.clone(), + &req, + indexed_req, + |state, auth: AuthenticationData, req| async move { + analytics::search::search_results( + req, + &auth.merchant_account.merchant_id, + state.conf.opensearch.clone(), + ) + .await + .map(ApplicationResponse::Json) + }, + &auth::JWTAuth(Permission::Analytics), + api_locking::LockAction::NotApplicable, + )) + .await + } + pub async fn get_dispute_filters( state: web::Data, req: actix_web::HttpRequest, diff --git a/crates/router/src/configs/secrets_transformers.rs b/crates/router/src/configs/secrets_transformers.rs index f89d181198..6906b5a3e7 100644 --- a/crates/router/src/configs/secrets_transformers.rs +++ b/crates/router/src/configs/secrets_transformers.rs @@ -350,6 +350,8 @@ pub(crate) async fn fetch_raw_secrets( payment_link: conf.payment_link, #[cfg(feature = "olap")] analytics, + #[cfg(feature = "olap")] + opensearch: conf.opensearch, #[cfg(feature = "kv_store")] kv_config: conf.kv_config, #[cfg(feature = "frm")] diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs index dc4826dfed..2f87c5c21d 100644 --- a/crates/router/src/configs/settings.rs +++ b/crates/router/src/configs/settings.rs @@ -4,7 +4,7 @@ use std::{ }; #[cfg(feature = "olap")] -use analytics::ReportConfig; +use analytics::{OpensearchConfig, ReportConfig}; use api_models::{enums, payment_methods::RequiredFieldInfo}; use common_utils::ext_traits::ConfigExt; use config::{Environment, File}; @@ -112,6 +112,8 @@ pub struct Settings { pub frm: Frm, #[cfg(feature = "olap")] pub report_download_config: ReportConfig, + #[cfg(feature = "olap")] + pub opensearch: OpensearchConfig, pub events: EventsConfig, #[cfg(feature = "olap")] pub connector_onboarding: SecretStateContainer, diff --git a/crates/router_env/src/lib.rs b/crates/router_env/src/lib.rs index b68cdcc6fc..5ad0f70670 100644 --- a/crates/router_env/src/lib.rs +++ b/crates/router_env/src/lib.rs @@ -54,6 +54,8 @@ pub enum AnalyticsFlow { GetApiEventFilters, GetConnectorEvents, GetOutgoingWebhookEvents, + GetGlobalSearchResults, + GetSearchResults, GetDisputeFilters, GetDisputeMetrics, }