From 5d3f09844cb2a26e655b1a9876ee5fa1d58c4ab2 Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:44:50 +0530 Subject: [PATCH 01/14] chore(deps): [test_utils] bump reqwest from v0.11.18 to v0.12.2 --- Cargo.lock | 258 +++++++++++++++++++++++++++-------- crates/test_utils/Cargo.toml | 2 +- 2 files changed, 200 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d8d1e8c6a3..502644fd04d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,7 +31,7 @@ dependencies = [ "futures-util", "log", "once_cell", - "smallvec 1.11.1", + "smallvec 1.13.2", ] [[package]] @@ -54,7 +54,7 @@ dependencies = [ "encoding_rs", "flate2", "futures-core", - "h2", + "h2 0.3.24", "http 0.2.9", "httparse", "httpdate", @@ -66,7 +66,7 @@ dependencies = [ "pin-project-lite", "rand 0.8.5", "sha1", - "smallvec 1.11.1", + "smallvec 1.13.2", "tokio 1.36.0", "tokio-util", "tracing", @@ -240,7 +240,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "smallvec 1.11.1", + "smallvec 1.13.2", "socket2 0.4.9", "time", "url", @@ -353,7 +353,7 @@ dependencies = [ "masking", "once_cell", "opensearch", - "reqwest", + "reqwest 0.11.22", "router_env", "serde", "serde_json", @@ -412,7 +412,7 @@ dependencies = [ "frunk_core", "masking", "mime", - "reqwest", + "reqwest 0.11.22", "router_derive", "serde", "serde_json", @@ -621,7 +621,7 @@ dependencies = [ "derive_more", "futures-core", "futures-util", - "h2", + "h2 0.3.24", "http 0.2.9", "itoa", "log", @@ -657,7 +657,7 @@ dependencies = [ "fastrand 1.9.0", "hex", "http 0.2.9", - "hyper", + "hyper 0.14.27", "ring 0.16.20", "time", "tokio 1.36.0", @@ -688,7 +688,7 @@ dependencies = [ "fastrand 2.0.1", "hex", "http 0.2.9", - "hyper", + "hyper 0.14.27", "ring 0.17.8", "time", "tokio 1.36.0", @@ -748,7 +748,7 @@ dependencies = [ "aws-types 0.55.3", "bytes 1.5.0", "http 0.2.9", - "http-body", + "http-body 0.4.5", "lazy_static", "percent-encoding", "pin-project-lite", @@ -772,7 +772,7 @@ dependencies = [ "bytes 1.5.0", "fastrand 2.0.1", "http 0.2.9", - "http-body", + "http-body 0.4.5", "percent-encoding", "pin-project-lite", "tracing", @@ -850,7 +850,7 @@ dependencies = [ "aws-types 0.55.3", "bytes 1.5.0", "http 0.2.9", - "http-body", + "http-body 0.4.5", "once_cell", "percent-encoding", "regex", @@ -1099,7 +1099,7 @@ dependencies = [ "crc32fast", "hex", "http 0.2.9", - "http-body", + "http-body 0.4.5", "md-5", "pin-project-lite", "sha1", @@ -1120,8 +1120,8 @@ dependencies = [ "bytes 1.5.0", "fastrand 1.9.0", "http 0.2.9", - "http-body", - "hyper", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-rustls 0.23.2", "lazy_static", "pin-project-lite", @@ -1165,8 +1165,8 @@ dependencies = [ "bytes-utils", "futures-core", "http 0.2.9", - "http-body", - "hyper", + "http-body 0.4.5", + "hyper 0.14.27", "once_cell", "percent-encoding", "pin-project-lite", @@ -1189,7 +1189,7 @@ dependencies = [ "bytes-utils", "futures-core", "http 0.2.9", - "http-body", + "http-body 0.4.5", "once_cell", "percent-encoding", "pin-project-lite", @@ -1207,7 +1207,7 @@ dependencies = [ "aws-smithy-types 0.55.3", "bytes 1.5.0", "http 0.2.9", - "http-body", + "http-body 0.4.5", "pin-project-lite", "tower", "tracing", @@ -1263,10 +1263,10 @@ dependencies = [ "aws-smithy-types 1.1.8", "bytes 1.5.0", "fastrand 2.0.1", - "h2", + "h2 0.3.24", "http 0.2.9", - "http-body", - "hyper", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-rustls 0.24.2", "once_cell", "pin-project-lite", @@ -1317,7 +1317,7 @@ dependencies = [ "bytes-utils", "futures-core", "http 0.2.9", - "http-body", + "http-body 0.4.5", "itoa", "num-integer", "pin-project-lite", @@ -1390,8 +1390,8 @@ dependencies = [ "bytes 1.5.0", "futures-util", "http 0.2.9", - "http-body", - "hyper", + "http-body 0.4.5", + "hyper 0.14.27", "itoa", "matchit", "memchr", @@ -1416,7 +1416,7 @@ dependencies = [ "bytes 1.5.0", "futures-util", "http 0.2.9", - "http-body", + "http-body 0.4.5", "mime", "rustversion", "tower-layer", @@ -1980,7 +1980,7 @@ dependencies = [ "quick-xml 0.28.2", "rand 0.8.5", "regex", - "reqwest", + "reqwest 0.11.22", "ring 0.16.20", "router_env", "rustc-hash", @@ -2667,7 +2667,7 @@ dependencies = [ "mime", "once_cell", "redis_interface", - "reqwest", + "reqwest 0.11.22", "router_env", "serde", "serde_json", @@ -2814,7 +2814,7 @@ dependencies = [ "dyn-clone", "error-stack", "hex", - "hyper", + "hyper 0.14.27", "hyper-proxy", "hyperswitch_interfaces", "masking", @@ -2847,7 +2847,7 @@ dependencies = [ "futures-core", "futures-util", "http 0.2.9", - "hyper", + "hyper 0.14.27", "hyper-rustls 0.23.2", "mime", "serde", @@ -3279,6 +3279,25 @@ dependencies = [ "tracing", ] +[[package]] +name = "h2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" +dependencies = [ + "bytes 1.5.0", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.1.0", + "indexmap 2.1.0", + "slab", + "tokio 1.36.0", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "1.8.2" @@ -3409,6 +3428,29 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes 1.5.0", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes 1.5.0", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", + "pin-project-lite", +] + [[package]] name = "http-types" version = "2.12.0" @@ -3461,9 +3503,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", + "h2 0.3.24", "http 0.2.9", - "http-body", + "http-body 0.4.5", "httparse", "httpdate", "itoa", @@ -3475,6 +3517,26 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" +dependencies = [ + "bytes 1.5.0", + "futures-channel", + "futures-util", + "h2 0.4.3", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "itoa", + "pin-project-lite", + "smallvec 1.13.2", + "tokio 1.36.0", + "want", +] + [[package]] name = "hyper-proxy" version = "0.9.1" @@ -3485,8 +3547,8 @@ dependencies = [ "futures 0.3.28", "headers", "http 0.2.9", - "hyper", - "hyper-tls", + "hyper 0.14.27", + "hyper-tls 0.5.0", "native-tls", "tokio 1.36.0", "tokio-native-tls", @@ -3500,7 +3562,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ "http 0.2.9", - "hyper", + "hyper 0.14.27", "log", "rustls 0.20.9", "rustls-native-certs", @@ -3516,7 +3578,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.9", - "hyper", + "hyper 0.14.27", "log", "rustls 0.21.10", "rustls-native-certs", @@ -3530,7 +3592,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.27", "pin-project-lite", "tokio 1.36.0", "tokio-io-timeout", @@ -3543,10 +3605,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes 1.5.0", - "hyper", + "hyper 0.14.27", + "native-tls", + "tokio 1.36.0", + "tokio-native-tls", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes 1.5.0", + "http-body-util", + "hyper 1.2.0", + "hyper-util", "native-tls", "tokio 1.36.0", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes 1.5.0", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.2.0", + "pin-project-lite", + "socket2 0.5.5", + "tokio 1.36.0", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -4227,7 +4325,7 @@ dependencies = [ "quanta", "rustc_version 0.4.0", "skeptic", - "smallvec 1.11.1", + "smallvec 1.13.2", "tagptr", "thiserror", "triomphe", @@ -4448,7 +4546,7 @@ dependencies = [ "dyn-clone", "lazy_static", "percent-encoding", - "reqwest", + "reqwest 0.11.22", "rustc_version 0.4.0", "serde", "serde_json", @@ -4665,7 +4763,7 @@ dependencies = [ "instant", "libc", "redox_syscall 0.2.16", - "smallvec 1.11.1", + "smallvec 1.13.2", "winapi 0.3.9", ] @@ -4678,7 +4776,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.3.5", - "smallvec 1.11.1", + "smallvec 1.13.2", "windows-targets 0.48.5", ] @@ -5449,12 +5547,12 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", + "h2 0.3.24", "http 0.2.9", - "http-body", - "hyper", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-rustls 0.24.2", - "hyper-tls", + "hyper-tls 0.5.0", "ipnet", "js-sys", "log", @@ -5483,6 +5581,48 @@ dependencies = [ "winreg", ] +[[package]] +name = "reqwest" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338" +dependencies = [ + "base64 0.21.5", + "bytes 1.5.0", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.4.3", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.2.0", + "hyper-tls 0.6.0", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio 1.36.0", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "retain_mut" version = "0.1.9" @@ -5612,7 +5752,7 @@ dependencies = [ "futures 0.3.28", "hex", "http 0.2.9", - "hyper", + "hyper 0.14.27", "hyperswitch_interfaces", "image", "infer 0.13.0", @@ -5638,7 +5778,7 @@ dependencies = [ "rdkafka", "redis_interface", "regex", - "reqwest", + "reqwest 0.11.22", "ring 0.16.20", "router_derive", "router_env", @@ -5797,7 +5937,7 @@ dependencies = [ "async-trait", "bytes 1.5.0", "http 0.2.9", - "reqwest", + "reqwest 0.11.22", "rustify_derive", "serde", "serde_json", @@ -6362,9 +6502,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -6461,7 +6601,7 @@ dependencies = [ "serde_json", "sha1", "sha2", - "smallvec 1.11.1", + "smallvec 1.13.2", "sqlformat", "sqlx-rt", "stringprep", @@ -6778,7 +6918,7 @@ dependencies = [ "masking", "rand 0.8.5", "regex", - "reqwest", + "reqwest 0.12.2", "serde", "serde_json", "serde_urlencoded", @@ -7267,10 +7407,10 @@ dependencies = [ "bytes 1.5.0", "futures-core", "futures-util", - "h2", + "h2 0.3.24", "http 0.2.9", - "http-body", - "hyper", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-timeout", "percent-encoding", "pin-project", @@ -7436,7 +7576,7 @@ dependencies = [ "serde", "serde_json", "sharded-slab", - "smallvec 1.11.1", + "smallvec 1.13.2", "thread_local", "tracing", "tracing-core", @@ -7679,7 +7819,7 @@ dependencies = [ "bytes 1.5.0", "derive_builder", "http 0.2.9", - "reqwest", + "reqwest 0.11.22", "rustify", "rustify_derive", "serde", @@ -8124,7 +8264,7 @@ dependencies = [ "futures 0.3.28", "futures-timer", "http-types", - "hyper", + "hyper 0.14.27", "log", "once_cell", "regex", diff --git a/crates/test_utils/Cargo.toml b/crates/test_utils/Cargo.toml index 59ff36e6cc5..60b6ed8a9d7 100644 --- a/crates/test_utils/Cargo.toml +++ b/crates/test_utils/Cargo.toml @@ -18,7 +18,7 @@ base64 = "0.21.2" clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] } rand = "0.8.5" regex = "1.10.3" -reqwest = { version = "0.11.18", features = ["native-tls"] } +reqwest = { version = "0.12.2", features = ["native-tls"] } serde = { version = "1.0.193", features = ["derive"] } serde_json = "1.0.108" serde_urlencoded = "0.7.1" From a23b5973c5dfd3cf654a0e2e24959e167134ec4b Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:32:38 +0530 Subject: [PATCH 02/14] chore(deps): [analytics] bump reqwest from v0.11.18 to v0.12.2 --- Cargo.lock | 4 ++-- crates/analytics/Cargo.toml | 10 +++------- crates/analytics/src/clickhouse.rs | 16 +++++++++------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 502644fd04d..f1b5192ed17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -353,7 +353,7 @@ dependencies = [ "masking", "once_cell", "opensearch", - "reqwest 0.11.22", + "reqwest 0.12.2", "router_env", "serde", "serde_json", @@ -412,7 +412,7 @@ dependencies = [ "frunk_core", "masking", "mime", - "reqwest 0.11.22", + "reqwest 0.12.2", "router_derive", "serde", "serde_json", diff --git a/crates/analytics/Cargo.toml b/crates/analytics/Cargo.toml index f07e0a94ea5..ba2a40dec77 100644 --- a/crates/analytics/Cargo.toml +++ b/crates/analytics/Cargo.toml @@ -9,9 +9,7 @@ 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 } @@ -21,9 +19,7 @@ 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", -] } +diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"] } #Third Party dependencies actix-web = "4.3.1" @@ -36,7 +32,7 @@ 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"] } +reqwest = { version = "0.12.2" } serde = { version = "1.0.193", features = ["derive", "rc"] } serde_json = "1.0.108" sqlx = { version = "0.6.3", features = [ diff --git a/crates/analytics/src/clickhouse.rs b/crates/analytics/src/clickhouse.rs index 6ebac7c1d92..549b3a4d72a 100644 --- a/crates/analytics/src/clickhouse.rs +++ b/crates/analytics/src/clickhouse.rs @@ -1,8 +1,8 @@ use std::sync::Arc; -use actix_web::http::StatusCode; use common_utils::errors::ParsingError; use error_stack::{IntoReport, Report, ResultExt}; +use reqwest::StatusCode; use router_env::logger; use time::PrimitiveDateTime; @@ -85,12 +85,14 @@ impl ClickhouseClient { |t| Err(ClickhouseError::ResponseNotOK(t)).into_report(), ) } else { - Ok(response - .json::>() - .await - .into_report() - .change_context(ClickhouseError::ResponseError)? - .data) + let ckh_output: CkhOutput = + match serde_json::from_str(response.text().await.unwrap_or_default().as_str()) { + Ok(output) => output, + Err(_) => { + return Err(ClickhouseError::ResponseError.into()); + } + }; + Ok(ckh_output.data) } } } From e9eff0d42b8eec2af04b53d297ec8dd8500adc55 Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:41:22 +0530 Subject: [PATCH 03/14] chore(deps): [api_models] bump reqwest from v0.11.18 to v0.12.2 --- crates/api_models/Cargo.toml | 2 +- crates/api_models/src/errors/actix.rs | 4 ++-- crates/api_models/src/errors/types.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml index 94202935c55..0fff79f3558 100644 --- a/crates/api_models/Cargo.toml +++ b/crates/api_models/Cargo.toml @@ -26,7 +26,7 @@ recon = [] actix-web = { version = "4.3.1", optional = true } error-stack = "0.3.1" mime = "0.3.17" -reqwest = { version = "0.11.18", optional = true } +reqwest = { version = "0.12.2", optional = true } serde = { version = "1.0.193", features = ["derive"] } serde_json = "1.0.108" strum = { version = "0.25", features = ["derive"] } diff --git a/crates/api_models/src/errors/actix.rs b/crates/api_models/src/errors/actix.rs index 5c05b6e80d2..1b9944eb27d 100644 --- a/crates/api_models/src/errors/actix.rs +++ b/crates/api_models/src/errors/actix.rs @@ -1,8 +1,8 @@ use super::types::ApiErrorResponse; impl actix_web::ResponseError for ApiErrorResponse { - fn status_code(&self) -> reqwest::StatusCode { - use reqwest::StatusCode; + fn status_code(&self) -> actix_web::http::StatusCode { + use actix_web::http::StatusCode; match self { Self::Unauthorized(_) => StatusCode::UNAUTHORIZED, diff --git a/crates/api_models/src/errors/types.rs b/crates/api_models/src/errors/types.rs index 538a75e1b2b..5e9745e07de 100644 --- a/crates/api_models/src/errors/types.rs +++ b/crates/api_models/src/errors/types.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use reqwest::StatusCode; +use actix_web::http::StatusCode; use serde::Serialize; #[derive(Debug, serde::Serialize)] From 2331b8fc8672d3a56e60a94a044c49a624ac341e Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:46:57 +0530 Subject: [PATCH 04/14] chore(deps): [drainer] bump reqwest from v0.11.18 to v0.12.2 --- Cargo.lock | 2 +- crates/drainer/Cargo.toml | 2 +- crates/drainer/src/errors.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f1b5192ed17..fd282dd37a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2667,7 +2667,7 @@ dependencies = [ "mime", "once_cell", "redis_interface", - "reqwest 0.11.22", + "reqwest 0.12.2", "router_env", "serde", "serde_json", diff --git a/crates/drainer/Cargo.toml b/crates/drainer/Cargo.toml index 2eea5b513cc..a8651c747e4 100644 --- a/crates/drainer/Cargo.toml +++ b/crates/drainer/Cargo.toml @@ -21,7 +21,7 @@ diesel = { version = "2.1.0", features = ["postgres"] } error-stack = "0.3.1" mime = "0.3.17" once_cell = "1.18.0" -reqwest = { version = "0.11.18" } +reqwest = { version = "0.12.2" } serde = "1.0.193" serde_json = "1.0.108" serde_path_to_error = "0.1.14" diff --git a/crates/drainer/src/errors.rs b/crates/drainer/src/errors.rs index 8605ee2ba04..c00cf7e33b5 100644 --- a/crates/drainer/src/errors.rs +++ b/crates/drainer/src/errors.rs @@ -48,8 +48,8 @@ impl From> for DrainerError { } impl actix_web::ResponseError for HealthCheckError { - fn status_code(&self) -> reqwest::StatusCode { - use reqwest::StatusCode; + fn status_code(&self) -> actix_web::http::StatusCode { + use actix_web::http::StatusCode; match self { Self::DbError { .. } | Self::RedisError { .. } => StatusCode::INTERNAL_SERVER_ERROR, From ea973f42d1376abc09d2f45af774ab2d8b92bcd8 Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Tue, 26 Mar 2024 15:53:42 +0530 Subject: [PATCH 05/14] chore(deps): [common_utils & router] [unfixed] bump reqwest from v0.11.18 to v0.12.2 --- Cargo.lock | 8 +++++--- crates/common_utils/Cargo.toml | 2 +- crates/router/Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd282dd37a7..2640f6e83c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1980,7 +1980,7 @@ dependencies = [ "quick-xml 0.28.2", "rand 0.8.5", "regex", - "reqwest 0.11.22", + "reqwest 0.12.2", "ring 0.16.20", "router_env", "rustc-hash", @@ -5557,7 +5557,6 @@ dependencies = [ "js-sys", "log", "mime", - "mime_guess", "native-tls", "once_cell", "percent-encoding", @@ -5587,6 +5586,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338" dependencies = [ + "async-compression", "base64 0.21.5", "bytes 1.5.0", "encoding_rs", @@ -5603,6 +5603,7 @@ dependencies = [ "js-sys", "log", "mime", + "mime_guess", "native-tls", "once_cell", "percent-encoding", @@ -5615,6 +5616,7 @@ dependencies = [ "system-configuration", "tokio 1.36.0", "tokio-native-tls", + "tokio-util", "tower-service", "url", "wasm-bindgen", @@ -5778,7 +5780,7 @@ dependencies = [ "rdkafka", "redis_interface", "regex", - "reqwest 0.11.22", + "reqwest 0.12.2", "ring 0.16.20", "router_derive", "router_env", diff --git a/crates/common_utils/Cargo.toml b/crates/common_utils/Cargo.toml index e8b3b726cec..8a1fa1379ac 100644 --- a/crates/common_utils/Cargo.toml +++ b/crates/common_utils/Cargo.toml @@ -27,7 +27,7 @@ phonenumber = "0.3.3" quick-xml = { version = "0.28.2", features = ["serialize"] } rand = "0.8.5" regex = "1.8.4" -reqwest = { version = "0.11.18", features = ["json", "native-tls", "gzip", "multipart"] } +reqwest = { version = "0.12.2", features = ["json", "native-tls", "gzip", "multipart"] } ring = { version = "0.16.20", features = ["std"] } rustc-hash = "1.1.0" serde = { version = "1.0.193", features = ["derive"] } diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index df3097d9e57..93e7f804475 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -76,7 +76,7 @@ qrcode = "0.12.0" rand = "0.8.5" rand_chacha = "0.3.1" regex = "1.8.4" -reqwest = { version = "0.11.18", features = ["json", "native-tls", "gzip", "multipart"] } +reqwest = { version = "0.12.2", features = ["json", "native-tls", "gzip", "multipart"] } ring = "0.16.20" roxmltree = "0.18.0" rust_decimal = { version = "1.30.0", features = ["serde-with-float", "serde-with-str"] } From 82cabea2b948006c975aa7ff85f903ad98bd485b Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Tue, 26 Mar 2024 19:12:55 +0530 Subject: [PATCH 06/14] chore(deps): [pm_auth & router] [unfixed] bump reqwest from v0.11.18 to v0.12.2 --- Cargo.lock | 1 + crates/pm_auth/Cargo.toml | 1 + crates/pm_auth/src/types.rs | 2 +- crates/router/src/compatibility/stripe/errors.rs | 4 ++-- crates/router/src/connector/paypal/transformers.rs | 2 +- crates/router/src/connector/stripe.rs | 2 +- crates/router/src/connector/utils.rs | 6 +++--- crates/router/src/connector/worldline.rs | 2 +- crates/router/src/services/api/client.rs | 3 ++- crates/router/src/types.rs | 4 ++-- crates/router/src/types/api/webhooks.rs | 2 +- 11 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2640f6e83c5..cf6e8fb91a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5016,6 +5016,7 @@ dependencies = [ "http 0.2.9", "masking", "mime", + "reqwest 0.12.2", "router_derive", "router_env", "serde", diff --git a/crates/pm_auth/Cargo.toml b/crates/pm_auth/Cargo.toml index 9654932d5ef..fcea583729a 100644 --- a/crates/pm_auth/Cargo.toml +++ b/crates/pm_auth/Cargo.toml @@ -21,6 +21,7 @@ bytes = "1.4.0" error-stack = "0.3.1" http = "0.2.9" mime = "0.3.17" +reqwest = "0.12.2" serde = "1.0.193" serde_json = "1.0.108" strum = { version = "0.24.1", features = ["derive"] } diff --git a/crates/pm_auth/src/types.rs b/crates/pm_auth/src/types.rs index 51fd796072b..d21cff75508 100644 --- a/crates/pm_auth/src/types.rs +++ b/crates/pm_auth/src/types.rs @@ -165,7 +165,7 @@ pub enum ConnectorAuthType { #[derive(Clone, Debug)] pub struct Response { - pub headers: Option, + pub headers: Option, pub response: bytes::Bytes, pub status_code: u16, } diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs index 60f4391bdf2..9559ca38ed9 100644 --- a/crates/router/src/compatibility/stripe/errors.rs +++ b/crates/router/src/compatibility/stripe/errors.rs @@ -630,8 +630,8 @@ impl From for StripeErrorCode { } impl actix_web::ResponseError for StripeErrorCode { - fn status_code(&self) -> reqwest::StatusCode { - use reqwest::StatusCode; + fn status_code(&self) -> actix_http::StatusCode { + use actix_http::StatusCode; match self { Self::Unauthorized => StatusCode::UNAUTHORIZED, diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs index d2d3989a692..6f6bc053471 100644 --- a/crates/router/src/connector/paypal/transformers.rs +++ b/crates/router/src/connector/paypal/transformers.rs @@ -2161,7 +2161,7 @@ impl TryFrom<&types::VerifyWebhookSourceRequestData> for PaypalSourceVerificatio } fn get_headers( - header: &actix_web::http::header::HeaderMap, + header: &reqwest::header::HeaderMap, key: &'static str, ) -> CustomResult { let header_value = header diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs index bf942ea1b3f..ab4ad9dc9e9 100644 --- a/crates/router/src/connector/stripe.rs +++ b/crates/router/src/connector/stripe.rs @@ -1908,7 +1908,7 @@ impl } fn get_signature_elements_from_header( - headers: &actix_web::http::header::HeaderMap, + headers: &reqwest::header::HeaderMap, ) -> CustomResult>, errors::ConnectorError> { let security_header = headers .get("Stripe-Signature") diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index e510f3bfafc..a9c58959718 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -1188,20 +1188,20 @@ impl MandateReferenceData for api_models::payments::ConnectorMandateReferenceId pub fn get_header_key_value<'a>( key: &str, - headers: &'a actix_web::http::header::HeaderMap, + headers: &'a reqwest::header::HeaderMap, ) -> CustomResult<&'a str, errors::ConnectorError> { get_header_field(headers.get(key)) } pub fn get_http_header<'a>( key: &str, - headers: &'a http::HeaderMap, + headers: &'a reqwest::header::HeaderMap, ) -> CustomResult<&'a str, errors::ConnectorError> { get_header_field(headers.get(key)) } fn get_header_field( - field: Option<&http::HeaderValue>, + field: Option<&reqwest::header::HeaderValue>, ) -> CustomResult<&str, errors::ConnectorError> { field .map(|header_value| { diff --git a/crates/router/src/connector/worldline.rs b/crates/router/src/connector/worldline.rs index 410d096d20a..417b6bfde6f 100644 --- a/crates/router/src/connector/worldline.rs +++ b/crates/router/src/connector/worldline.rs @@ -761,7 +761,7 @@ impl ConnectorIntegration bool { +fn is_endpoint_verification(headers: &reqwest::header::HeaderMap) -> bool { headers .get("x-gcs-webhooks-endpoint-verification") .is_some() diff --git a/crates/router/src/services/api/client.rs b/crates/router/src/services/api/client.rs index a2cf65ce66b..a4e1efb5278 100644 --- a/crates/router/src/services/api/client.rs +++ b/crates/router/src/services/api/client.rs @@ -1,10 +1,11 @@ use std::time::Duration; use error_stack::{IntoReport, ResultExt}; -use http::{HeaderValue, Method}; +use http::HeaderValue; use masking::PeekInterface; use once_cell::sync::OnceCell; use reqwest::multipart::Form; +use reqwest::Method; use router_env::tracing_actix_web::RequestId; use super::{request::Maskable, Request}; diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs index e0ab8131199..74311376cbd 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -1035,7 +1035,7 @@ pub enum Redirection { #[derive(Debug, Clone)] pub struct VerifyWebhookSourceRequestData { - pub webhook_headers: actix_web::http::header::HeaderMap, + pub webhook_headers: reqwest::header::HeaderMap, pub webhook_body: Vec, pub merchant_secret: api_models::webhooks::ConnectorWebhookSecrets, } @@ -1285,7 +1285,7 @@ pub struct ConnectorsList { #[derive(Clone, Debug)] pub struct Response { - pub headers: Option, + pub headers: Option, pub response: bytes::Bytes, pub status_code: u16, } diff --git a/crates/router/src/types/api/webhooks.rs b/crates/router/src/types/api/webhooks.rs index 52f5300d9be..88219d301b3 100644 --- a/crates/router/src/types/api/webhooks.rs +++ b/crates/router/src/types/api/webhooks.rs @@ -23,7 +23,7 @@ use crate::{ pub struct IncomingWebhookRequestDetails<'a> { pub method: actix_web::http::Method, pub uri: actix_web::http::Uri, - pub headers: &'a actix_web::http::header::HeaderMap, + pub headers: &'a reqwest::header::HeaderMap, pub body: &'a [u8], pub query_params: String, } From dd4afb4fa3828e8553152f489102b7856096f250 Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Thu, 28 Mar 2024 12:48:27 +0530 Subject: [PATCH 07/14] chore(deps): [pm_auth & router] [fixed] bump reqwest from v0.11.18 to v0.12.2 --- crates/router/src/connector/square.rs | 2 +- crates/router/src/core/webhooks.rs | 20 +++++++++++++++++++- crates/router/src/services/api/client.rs | 13 +++++++------ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/crates/router/src/connector/square.rs b/crates/router/src/connector/square.rs index 8bfc9582d0c..7015e959d99 100644 --- a/crates/router/src/connector/square.rs +++ b/crates/router/src/connector/square.rs @@ -911,7 +911,7 @@ impl api::IncomingWebhook for Square { ) -> CustomResult, errors::ConnectorError> { let header_value = request .headers - .get(actix_web::http::header::HOST) + .get(reqwest::header::HOST) .ok_or(errors::ConnectorError::WebhookSourceVerificationFailed)?; let authority = header_value .to_str() diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs index 6049c8c5081..d56ead7e5b9 100644 --- a/crates/router/src/core/webhooks.rs +++ b/crates/router/src/core/webhooks.rs @@ -1213,6 +1213,24 @@ pub async fn webhooks_wrapper reqwest::header::HeaderMap { + let mut reqwest_headers = reqwest::header::HeaderMap::new(); + for (name, value) in actix_headers.iter() { + if let Ok(name) = reqwest::header::HeaderName::from_str(name.as_str()) { + if let Ok(value) = reqwest::header::HeaderValue::from_bytes(value.as_bytes()) { + reqwest_headers.insert(name, value); + } + } + } + reqwest_headers +} + #[instrument(skip_all)] pub async fn webhooks_core( state: AppState, @@ -1237,7 +1255,7 @@ pub async fn webhooks_core) -> CustomResult<(), ApiClientError> { let header_value = match value { - Maskable::Masked(hvalue) => HeaderValue::from_str(hvalue.peek()).map(|mut h| { - h.set_sensitive(true); - h - }), - Maskable::Normal(hvalue) => HeaderValue::from_str(&hvalue), + Maskable::Masked(hvalue) => { + reqwest::header::HeaderValue::from_str(hvalue.peek()).map(|mut h| { + h.set_sensitive(true); + h + }) + } + Maskable::Normal(hvalue) => reqwest::header::HeaderValue::from_str(&hvalue), } .into_report() .change_context(ApiClientError::HeaderMapConstructionFailed)?; From 560d2a5009e4a538941ff6e79c82f9ffb9a1e797 Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Thu, 28 Mar 2024 14:39:57 +0530 Subject: [PATCH 08/14] chore(fmt-clippy): address rust fmt and clippy warning --- crates/router/src/core/webhooks.rs | 4 ++-- crates/router/src/services/api/client.rs | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs index d56ead7e5b9..ed819903165 100644 --- a/crates/router/src/core/webhooks.rs +++ b/crates/router/src/core/webhooks.rs @@ -1217,7 +1217,7 @@ pub async fn webhooks_wrapper reqwest::header::HeaderMap { let mut reqwest_headers = reqwest::header::HeaderMap::new(); @@ -1255,7 +1255,7 @@ pub async fn webhooks_core Date: Mon, 1 Apr 2024 16:38:22 +0530 Subject: [PATCH 09/14] chore: address comments and stackoverflows --- crates/analytics/Cargo.toml | 2 +- crates/router/build.rs | 2 +- crates/router/src/core/webhooks.rs | 17 +++++++++-------- crates/router/src/services/api/client.rs | 1 - 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/analytics/Cargo.toml b/crates/analytics/Cargo.toml index 2ad03971ace..e9df6435b90 100644 --- a/crates/analytics/Cargo.toml +++ b/crates/analytics/Cargo.toml @@ -32,7 +32,7 @@ error-stack = "0.4.1" futures = "0.3.28" opensearch = { version = "2.2.0", features = ["aws-auth"] } once_cell = "1.18.0" -reqwest = { version = "0.12.2" } +reqwest = { version = "0.12.2", features = ["json"] } serde = { version = "1.0.193", features = ["derive", "rc"] } serde_json = "1.0.108" sqlx = { version = "0.6.3", features = [ diff --git a/crates/router/build.rs b/crates/router/build.rs index 167ca918407..cc4d2ea8d15 100644 --- a/crates/router/build.rs +++ b/crates/router/build.rs @@ -2,7 +2,7 @@ fn main() { // Set thread stack size to 4 MiB for debug builds // Reference: https://doc.rust-lang.org/std/thread/#stack-size #[cfg(debug_assertions)] - println!("cargo:rustc-env=RUST_MIN_STACK=6291456"); // 6 * 1024 * 1024 = 6 MiB + println!("cargo:rustc-env=RUST_MIN_STACK=8388608"); // 6 * 1024 * 1024 = 6 MiB #[cfg(feature = "vergen")] router_env::vergen::generate_cargo_instructions(); diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs index e31501e5492..c4e880ab8b3 100644 --- a/crates/router/src/core/webhooks.rs +++ b/crates/router/src/core/webhooks.rs @@ -1205,16 +1205,17 @@ Once actix_web upgrades the http version from v0.2.9 to 1.x, this can be removed */ fn convert_headers( actix_headers: &actix_web::http::header::HeaderMap, -) -> reqwest::header::HeaderMap { +) -> Result { let mut reqwest_headers = reqwest::header::HeaderMap::new(); for (name, value) in actix_headers.iter() { - if let Ok(name) = reqwest::header::HeaderName::from_str(name.as_str()) { - if let Ok(value) = reqwest::header::HeaderValue::from_bytes(value.as_bytes()) { - reqwest_headers.insert(name, value); - } - } + let name_result = reqwest::header::HeaderName::from_str(name.as_str()) + .map_err(|_err| errors::ApiErrorResponse::InternalServerError)?; + let value_result = reqwest::header::HeaderValue::from_bytes(value.as_bytes()) + .map_err(|_err| errors::ApiErrorResponse::InternalServerError)?; + + reqwest_headers.insert(name_result, value_result); } - reqwest_headers + Ok(reqwest_headers) } #[instrument(skip_all)] @@ -1241,7 +1242,7 @@ pub async fn webhooks_core Date: Mon, 1 Apr 2024 17:01:41 +0530 Subject: [PATCH 10/14] refactor: log the error --- crates/router/src/core/webhooks.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs index c4e880ab8b3..66d318f07ad 100644 --- a/crates/router/src/core/webhooks.rs +++ b/crates/router/src/core/webhooks.rs @@ -1208,10 +1208,15 @@ fn convert_headers( ) -> Result { let mut reqwest_headers = reqwest::header::HeaderMap::new(); for (name, value) in actix_headers.iter() { - let name_result = reqwest::header::HeaderName::from_str(name.as_str()) - .map_err(|_err| errors::ApiErrorResponse::InternalServerError)?; - let value_result = reqwest::header::HeaderValue::from_bytes(value.as_bytes()) - .map_err(|_err| errors::ApiErrorResponse::InternalServerError)?; + let name_result = reqwest::header::HeaderName::from_str(name.as_str()).map_err(|err| { + logger::error!("Invalid Header Name: {}", err.as_str()); + errors::ApiErrorResponse::InternalServerError + })?; + let value_result = + reqwest::header::HeaderValue::from_bytes(value.as_bytes()).map_err(|err| { + logger::error!("Invalid Header Value: {}", err.as_str()); + errors::ApiErrorResponse::InternalServerError + })?; reqwest_headers.insert(name_result, value_result); } From 25b30a675daeaa6edebd39118e5217abcfb23977 Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Mon, 1 Apr 2024 17:03:39 +0530 Subject: [PATCH 11/14] Revert "refactor: log the error" This reverts commit 8f6f98bf8b8fab63082c13377d4b15fc49dd4686. --- crates/router/src/core/webhooks.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs index 66d318f07ad..c4e880ab8b3 100644 --- a/crates/router/src/core/webhooks.rs +++ b/crates/router/src/core/webhooks.rs @@ -1208,15 +1208,10 @@ fn convert_headers( ) -> Result { let mut reqwest_headers = reqwest::header::HeaderMap::new(); for (name, value) in actix_headers.iter() { - let name_result = reqwest::header::HeaderName::from_str(name.as_str()).map_err(|err| { - logger::error!("Invalid Header Name: {}", err.as_str()); - errors::ApiErrorResponse::InternalServerError - })?; - let value_result = - reqwest::header::HeaderValue::from_bytes(value.as_bytes()).map_err(|err| { - logger::error!("Invalid Header Value: {}", err.as_str()); - errors::ApiErrorResponse::InternalServerError - })?; + let name_result = reqwest::header::HeaderName::from_str(name.as_str()) + .map_err(|_err| errors::ApiErrorResponse::InternalServerError)?; + let value_result = reqwest::header::HeaderValue::from_bytes(value.as_bytes()) + .map_err(|_err| errors::ApiErrorResponse::InternalServerError)?; reqwest_headers.insert(name_result, value_result); } From 6ee0327acc42ea13dbfb36b194fd6425ae5eb22a Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Mon, 1 Apr 2024 17:07:57 +0530 Subject: [PATCH 12/14] refactor: log the error --- crates/router/src/core/webhooks.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs index c4e880ab8b3..6b25edda702 100644 --- a/crates/router/src/core/webhooks.rs +++ b/crates/router/src/core/webhooks.rs @@ -1208,10 +1208,15 @@ fn convert_headers( ) -> Result { let mut reqwest_headers = reqwest::header::HeaderMap::new(); for (name, value) in actix_headers.iter() { - let name_result = reqwest::header::HeaderName::from_str(name.as_str()) - .map_err(|_err| errors::ApiErrorResponse::InternalServerError)?; - let value_result = reqwest::header::HeaderValue::from_bytes(value.as_bytes()) - .map_err(|_err| errors::ApiErrorResponse::InternalServerError)?; + let name_result = reqwest::header::HeaderName::from_str(name.as_str()).map_err(|err| { + logger::error!("Invalid Header Name: {}", err); + errors::ApiErrorResponse::InternalServerError + })?; + let value_result = + reqwest::header::HeaderValue::from_bytes(value.as_bytes()).map_err(|err| { + logger::error!("Invalid Header Value: {}", err); + errors::ApiErrorResponse::InternalServerError + })?; reqwest_headers.insert(name_result, value_result); } From b960e9fe095a93f40206bd0edb695582858ae222 Mon Sep 17 00:00:00 2001 From: "PiX@work" <69745008+pixincreate@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:01:48 +0530 Subject: [PATCH 13/14] chore(fmt-clippy): revert rustminstack to 6mib and update http to 1.1.0 instead of adding additional dependency --- Cargo.lock | 3 +-- crates/pm_auth/Cargo.toml | 3 +-- crates/pm_auth/src/types.rs | 2 +- crates/router/build.rs | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 21775b9b467..c36eadd47ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5013,10 +5013,9 @@ dependencies = [ "common_enums", "common_utils", "error-stack", - "http 0.2.9", + "http 1.1.0", "masking", "mime", - "reqwest 0.12.2", "router_derive", "router_env", "serde", diff --git a/crates/pm_auth/Cargo.toml b/crates/pm_auth/Cargo.toml index 3c0a7922952..1aa0e782083 100644 --- a/crates/pm_auth/Cargo.toml +++ b/crates/pm_auth/Cargo.toml @@ -19,9 +19,8 @@ router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra async-trait = "0.1.66" bytes = "1.4.0" error-stack = "0.4.1" -http = "0.2.9" +http = "1.1.0" mime = "0.3.17" -reqwest = "0.12.2" serde = "1.0.193" serde_json = "1.0.108" strum = { version = "0.24.1", features = ["derive"] } diff --git a/crates/pm_auth/src/types.rs b/crates/pm_auth/src/types.rs index d21cff75508..51fd796072b 100644 --- a/crates/pm_auth/src/types.rs +++ b/crates/pm_auth/src/types.rs @@ -165,7 +165,7 @@ pub enum ConnectorAuthType { #[derive(Clone, Debug)] pub struct Response { - pub headers: Option, + pub headers: Option, pub response: bytes::Bytes, pub status_code: u16, } diff --git a/crates/router/build.rs b/crates/router/build.rs index cc4d2ea8d15..167ca918407 100644 --- a/crates/router/build.rs +++ b/crates/router/build.rs @@ -2,7 +2,7 @@ fn main() { // Set thread stack size to 4 MiB for debug builds // Reference: https://doc.rust-lang.org/std/thread/#stack-size #[cfg(debug_assertions)] - println!("cargo:rustc-env=RUST_MIN_STACK=8388608"); // 6 * 1024 * 1024 = 6 MiB + println!("cargo:rustc-env=RUST_MIN_STACK=6291456"); // 6 * 1024 * 1024 = 6 MiB #[cfg(feature = "vergen")] router_env::vergen::generate_cargo_instructions(); From 59138b9c084fd476c0cafb4f17fe2abb25e0400b Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Sat, 4 May 2024 10:47:22 +0530 Subject: [PATCH 14/14] Revert "Merge branch 'main' into update-reqwest" This reverts commit ab976565519a6b48820ce1c3d0f8a8ae9bba4e05, reversing changes made to b960e9fe095a93f40206bd0edb695582858ae222. --- .github/PULL_REQUEST_TEMPLATE.md | 1 + .github/workflows/release-stable-version.yml | 10 +- .gitignore | 3 - .typos.toml | 48 +- CHANGELOG.md | 514 --- Cargo.lock | 3491 ++++++++--------- INSTALL_dependencies.sh | 4 +- config/config.example.toml | 19 +- config/deployments/env_specific.toml | 1 - config/deployments/integration_test.toml | 90 +- config/deployments/production.toml | 87 +- config/deployments/sandbox.toml | 89 +- config/deployments/scheduler/consumer.toml | 2 +- config/deployments/scheduler/producer.toml | 2 +- config/development.toml | 25 +- config/docker_compose.toml | 25 +- config/tempo.yaml | 2 +- connector-template/test.rs | 2 +- crates/analytics/Cargo.toml | 46 +- .../docs/clickhouse/scripts/payouts.sql | 146 - crates/analytics/src/lib.rs | 68 +- crates/analytics/src/opensearch.rs | 397 -- crates/analytics/src/query.rs | 2 - .../analytics/src/sdk_events/accumulator.rs | 16 +- crates/analytics/src/sdk_events/core.rs | 24 +- crates/analytics/src/sdk_events/metrics.rs | 112 +- .../authentication_unsuccessful_count.rs | 122 - ...sful_count.rs => payment_success_count.rs} | 12 +- .../sdk_events/metrics/sdk_initiated_count.rs | 2 +- .../metrics/three_ds_challenge_flow_count.rs | 124 - .../three_ds_frictionless_flow_count.rs | 126 - .../metrics/three_ds_method_invoked_count.rs | 124 - .../metrics/three_ds_method_skipped_count.rs | 124 - .../three_ds_method_unsuccessful_count.rs | 122 - crates/analytics/src/search.rs | 129 +- crates/analytics/src/sqlx.rs | 4 +- crates/api_models/Cargo.toml | 20 +- crates/api_models/src/admin.rs | 76 - crates/api_models/src/analytics/sdk_events.rs | 33 +- crates/api_models/src/analytics/search.rs | 2 +- crates/api_models/src/conditional_configs.rs | 2 +- crates/api_models/src/enums.rs | 262 +- crates/api_models/src/events/payment.rs | 12 +- crates/api_models/src/events/user.rs | 16 +- crates/api_models/src/health_check.rs | 2 - crates/api_models/src/lib.rs | 1 - crates/api_models/src/payment_methods.rs | 121 +- crates/api_models/src/payments.rs | 487 +-- crates/api_models/src/payouts.rs | 83 +- crates/api_models/src/poll.rs | 28 - crates/api_models/src/refunds.rs | 4 +- crates/api_models/src/routing.rs | 32 +- crates/api_models/src/user.rs | 45 +- .../api_models/src/user/dashboard_metadata.rs | 17 - crates/api_models/src/user_role.rs | 1 - crates/api_models/src/webhook_events.rs | 36 +- crates/api_models/src/webhooks.rs | 10 - crates/cards/Cargo.toml | 8 +- crates/common_enums/Cargo.toml | 12 +- crates/common_enums/src/enums.rs | 259 +- crates/common_enums/src/transformers.rs | 2 - crates/common_utils/Cargo.toml | 40 +- crates/common_utils/src/access_token.rs | 11 - crates/common_utils/src/consts.rs | 17 +- crates/common_utils/src/custom_serde.rs | 19 - crates/common_utils/src/events.rs | 3 - crates/common_utils/src/lib.rs | 16 +- crates/common_utils/src/request.rs | 16 +- crates/common_utils/src/types.rs | 6 +- crates/config_importer/Cargo.toml | 12 +- crates/connector_configs/Cargo.toml | 8 +- crates/connector_configs/src/common_config.rs | 6 - crates/connector_configs/src/connector.rs | 25 +- .../src/response_modifier.rs | 4 - crates/connector_configs/src/transformer.rs | 14 +- .../connector_configs/toml/development.toml | 128 +- crates/connector_configs/toml/production.toml | 50 +- crates/connector_configs/toml/sandbox.toml | 128 +- crates/currency_conversion/Cargo.toml | 8 +- .../Cargo.toml | 12 +- .../README.md | 2 +- .../src/errors.rs | 0 .../src/lib.rs | 0 .../src/mandates.rs | 0 .../src/payments.rs | 4 - .../src/payments/payment_attempt.rs | 12 +- .../src/payments/payment_intent.rs | 11 - .../src/payouts.rs | 0 .../src/payouts/payout_attempt.rs | 4 +- .../src/payouts/payouts.rs | 31 +- crates/diesel_models/Cargo.toml | 18 +- crates/diesel_models/src/authentication.rs | 10 +- crates/diesel_models/src/business_profile.rs | 98 +- crates/diesel_models/src/customers.rs | 70 +- crates/diesel_models/src/enums.rs | 136 +- crates/diesel_models/src/fraud_check.rs | 7 - crates/diesel_models/src/kv.rs | 67 +- crates/diesel_models/src/mandate.rs | 77 +- crates/diesel_models/src/payment_attempt.rs | 27 +- crates/diesel_models/src/payment_intent.rs | 3 - crates/diesel_models/src/payment_method.rs | 155 +- crates/diesel_models/src/payouts.rs | 22 +- crates/diesel_models/src/process_tracker.rs | 1 - .../diesel_models/src/query/authentication.rs | 14 - .../src/query/business_profile.rs | 8 +- crates/diesel_models/src/query/mandate.rs | 4 +- .../src/query/payment_attempt.rs | 14 +- .../diesel_models/src/query/payment_method.rs | 4 +- crates/diesel_models/src/query/user.rs | 8 +- crates/diesel_models/src/query/user_role.rs | 4 +- crates/diesel_models/src/schema.rs | 19 +- crates/drainer/Cargo.toml | 22 +- crates/euclid/Cargo.toml | 19 +- crates/euclid/src/dssa/analyzer.rs | 2 +- crates/euclid/src/dssa/graph.rs | 4 +- crates/euclid/src/enums.rs | 12 +- crates/euclid/src/frontend/dir.rs | 12 +- crates/euclid/src/frontend/dir/enums.rs | 26 +- crates/euclid/src/frontend/dir/lowering.rs | 2 - .../euclid/src/frontend/dir/transformers.rs | 4 - crates/euclid/src/types.rs | 2 +- crates/euclid_macros/Cargo.toml | 9 +- crates/euclid_wasm/Cargo.toml | 13 +- crates/events/Cargo.toml | 19 - crates/events/src/actix.rs | 15 - crates/events/src/lib.rs | 268 -- crates/external_services/Cargo.toml | 20 +- crates/external_services/src/email.rs | 2 +- crates/hyperswitch_interfaces/Cargo.toml | 8 +- crates/kgraph_utils/Cargo.toml | 7 +- crates/kgraph_utils/src/mca.rs | 2 - crates/kgraph_utils/src/transformers.rs | 4 - crates/masking/Cargo.toml | 12 +- crates/openapi/Cargo.toml | 4 +- crates/openapi/src/openapi.rs | 14 - crates/openapi/src/routes.rs | 3 +- crates/openapi/src/routes/poll.rs | 16 - crates/openapi/src/routes/webhook_events.rs | 24 - crates/pm_auth/Cargo.toml | 13 +- crates/redis_interface/Cargo.toml | 10 +- crates/redis_interface/src/commands.rs | 71 +- crates/router/Cargo.toml | 126 +- crates/router/build.rs | 4 +- crates/router/src/analytics.rs | 46 +- crates/router/src/bin/scheduler.rs | 17 - .../src/compatibility/stripe/customers.rs | 15 +- .../router/src/compatibility/stripe/errors.rs | 15 +- .../compatibility/stripe/payment_intents.rs | 40 +- .../stripe/payment_intents/types.rs | 18 +- .../src/compatibility/stripe/refunds.rs | 12 +- .../src/compatibility/stripe/setup_intents.rs | 16 +- .../stripe/setup_intents/types.rs | 18 +- crates/router/src/compatibility/wrap.rs | 16 +- crates/router/src/configs/defaults.rs | 798 ++-- .../src/configs/secrets_transformers.rs | 2 - crates/router/src/configs/settings.rs | 19 +- crates/router/src/connector.rs | 20 +- .../router/src/connector/aci/transformers.rs | 182 +- crates/router/src/connector/adyen.rs | 2 - .../src/connector/adyen/transformers.rs | 1020 +++-- crates/router/src/connector/airwallex.rs | 4 +- .../src/connector/airwallex/transformers.rs | 96 +- .../router/src/connector/authorizedotnet.rs | 4 +- .../connector/authorizedotnet/transformers.rs | 133 +- crates/router/src/connector/bambora.rs | 54 +- .../src/connector/bambora/transformers.rs | 109 +- crates/router/src/connector/bankofamerica.rs | 142 +- .../connector/bankofamerica/transformers.rs | 1674 ++------ crates/router/src/connector/billwerk.rs | 310 +- .../src/connector/billwerk/transformers.rs | 351 +- crates/router/src/connector/bluesnap.rs | 5 +- .../src/connector/bluesnap/transformers.rs | 127 +- .../router/src/connector/boku/transformers.rs | 106 +- crates/router/src/connector/braintree.rs | 3 +- .../braintree_graphql_transformers.rs | 104 +- .../src/connector/braintree/transformers.rs | 88 +- crates/router/src/connector/checkout.rs | 40 +- .../src/connector/checkout/transformers.rs | 216 +- crates/router/src/connector/cryptopay.rs | 26 +- .../src/connector/cryptopay/transformers.rs | 80 +- crates/router/src/connector/cybersource.rs | 33 +- .../src/connector/cybersource/transformers.rs | 506 +-- .../src/connector/dlocal/transformers.rs | 44 +- .../connector/dummyconnector/transformers.rs | 51 +- crates/router/src/connector/ebanx.rs | 455 --- .../src/connector/ebanx/transformers.rs | 406 -- .../src/connector/fiserv/transformers.rs | 30 +- .../src/connector/forte/transformers.rs | 40 +- crates/router/src/connector/globalpay.rs | 4 +- .../src/connector/globalpay/requests.rs | 4 +- .../src/connector/globalpay/transformers.rs | 42 +- .../src/connector/globepay/transformers.rs | 88 +- .../src/connector/gocardless/transformers.rs | 171 +- .../src/connector/helcim/transformers.rs | 74 +- .../src/connector/iatapay/transformers.rs | 30 +- crates/router/src/connector/klarna.rs | 249 +- crates/router/src/connector/mollie.rs | 4 +- .../src/connector/mollie/transformers.rs | 45 +- crates/router/src/connector/multisafepay.rs | 19 +- .../connector/multisafepay/transformers.rs | 449 +-- crates/router/src/connector/netcetera.rs | 453 --- .../connector/netcetera/netcetera_types.rs | 1643 -------- .../src/connector/netcetera/transformers.rs | 696 ---- .../src/connector/nexinets/transformers.rs | 134 +- crates/router/src/connector/nmi.rs | 5 +- .../router/src/connector/nmi/transformers.rs | 202 +- crates/router/src/connector/noon.rs | 4 +- .../router/src/connector/noon/transformers.rs | 108 +- crates/router/src/connector/nuvei.rs | 5 +- .../src/connector/nuvei/transformers.rs | 517 ++- .../src/connector/opayo/transformers.rs | 44 +- .../src/connector/payeezy/transformers.rs | 38 +- crates/router/src/connector/payme.rs | 4 +- .../src/connector/payme/transformers.rs | 170 +- crates/router/src/connector/paypal.rs | 130 +- .../src/connector/paypal/transformers.rs | 513 +-- .../router/src/connector/payu/transformers.rs | 10 +- .../src/connector/placetopay/transformers.rs | 31 +- crates/router/src/connector/powertranz.rs | 2 +- .../src/connector/powertranz/transformers.rs | 55 +- .../src/connector/prophetpay/transformers.rs | 6 +- .../src/connector/rapyd/transformers.rs | 19 +- crates/router/src/connector/riskified.rs | 2 +- .../connector/riskified/transformers/api.rs | 33 +- .../src/connector/shift4/transformers.rs | 244 +- crates/router/src/connector/signifyd.rs | 6 +- .../connector/signifyd/transformers/api.rs | 59 +- .../src/connector/square/transformers.rs | 181 +- .../router/src/connector/stax/transformers.rs | 106 +- crates/router/src/connector/stripe.rs | 575 +-- .../src/connector/stripe/transformers.rs | 965 ++--- .../connector/stripe/transformers/connect.rs | 480 --- crates/router/src/connector/threedsecureio.rs | 2 +- .../connector/threedsecureio/transformers.rs | 25 +- crates/router/src/connector/trustpay.rs | 4 +- .../src/connector/trustpay/transformers.rs | 83 +- .../router/src/connector/tsys/transformers.rs | 36 +- crates/router/src/connector/utils.rs | 389 +- .../router/src/connector/volt/transformers.rs | 69 +- crates/router/src/connector/wise.rs | 2 +- .../router/src/connector/wise/transformers.rs | 23 +- .../src/connector/worldline/transformers.rs | 126 +- .../src/connector/worldpay/transformers.rs | 108 +- crates/router/src/connector/zen.rs | 8 +- .../router/src/connector/zen/transformers.rs | 277 +- crates/router/src/connector/zsl.rs | 468 --- .../router/src/connector/zsl/transformers.rs | 933 ----- crates/router/src/consts.rs | 11 - crates/router/src/core.rs | 1 - crates/router/src/core/admin.rs | 71 +- crates/router/src/core/authentication.rs | 74 +- .../src/core/authentication/transformers.rs | 5 +- .../router/src/core/authentication/types.rs | 11 +- .../router/src/core/authentication/utils.rs | 6 - .../router/src/core/connector_onboarding.rs | 6 +- crates/router/src/core/customers.rs | 40 +- crates/router/src/core/errors.rs | 2 +- .../src/core/errors/api_error_response.rs | 11 - crates/router/src/core/errors/transformers.rs | 12 - .../src/core/errors/user/sample_data.rs | 2 +- crates/router/src/core/errors/utils.rs | 12 +- crates/router/src/core/fraud_check.rs | 241 +- .../core/fraud_check/flows/checkout_flow.rs | 1 + .../fraud_check/flows/fulfillment_flow.rs | 1 + .../core/fraud_check/flows/record_return.rs | 1 + .../src/core/fraud_check/flows/sale_flow.rs | 1 + .../fraud_check/flows/transaction_flow.rs | 2 +- .../router/src/core/fraud_check/operation.rs | 6 +- .../fraud_check/operation/fraud_check_post.rs | 137 +- .../fraud_check/operation/fraud_check_pre.rs | 6 - crates/router/src/core/fraud_check/types.rs | 18 +- crates/router/src/core/health_check.rs | 17 - crates/router/src/core/locker_migration.rs | 4 +- crates/router/src/core/mandate.rs | 325 +- crates/router/src/core/mandate/helpers.rs | 39 +- crates/router/src/core/mandate/utils.rs | 1 + crates/router/src/core/metrics.rs | 2 +- crates/router/src/core/payment_link.rs | 63 +- .../payment_link_initiate/payment_link.css | 84 + .../payment_link_initiate/payment_link.html | 90 +- .../payment_link_initiate/payment_link.js | 77 +- crates/router/src/core/payment_methods.rs | 8 +- .../router/src/core/payment_methods/cards.rs | 742 +--- .../src/core/payment_methods/transformers.rs | 24 +- .../router/src/core/payment_methods/vault.rs | 166 +- crates/router/src/core/payments.rs | 960 +---- .../router/src/core/payments/access_token.rs | 33 +- crates/router/src/core/payments/flows.rs | 232 +- .../src/core/payments/flows/approve_flow.rs | 3 + .../src/core/payments/flows/authorize_flow.rs | 81 +- .../src/core/payments/flows/cancel_flow.rs | 3 + .../src/core/payments/flows/capture_flow.rs | 3 + .../payments/flows/complete_authorize_flow.rs | 3 + .../flows/incremental_authorization_flow.rs | 3 + .../src/core/payments/flows/psync_flow.rs | 3 + .../src/core/payments/flows/reject_flow.rs | 3 + .../src/core/payments/flows/session_flow.rs | 45 +- .../core/payments/flows/setup_mandate_flow.rs | 296 +- crates/router/src/core/payments/helpers.rs | 450 +-- crates/router/src/core/payments/operations.rs | 45 +- .../payments/operations/payment_approve.rs | 27 +- .../payments/operations/payment_cancel.rs | 17 +- .../payments/operations/payment_capture.rs | 7 +- .../operations/payment_complete_authorize.rs | 73 +- .../payments/operations/payment_confirm.rs | 352 +- .../payments/operations/payment_create.rs | 152 +- .../payments/operations/payment_reject.rs | 7 +- .../payments/operations/payment_response.rs | 412 +- .../payments/operations/payment_session.rs | 9 +- .../core/payments/operations/payment_start.rs | 12 +- .../payments/operations/payment_status.rs | 40 +- .../payments/operations/payment_update.rs | 87 +- .../payments_incremental_authorization.rs | 11 +- crates/router/src/core/payments/retry.rs | 18 +- crates/router/src/core/payments/routing.rs | 8 +- .../router/src/core/payments/tokenization.rs | 374 +- .../router/src/core/payments/transformers.rs | 568 +-- crates/router/src/core/payments/types.rs | 2 +- crates/router/src/core/payouts.rs | 1010 ++--- .../router/src/core/payouts/access_token.rs | 194 - crates/router/src/core/payouts/helpers.rs | 429 +- crates/router/src/core/payouts/retry.rs | 50 +- crates/router/src/core/payouts/validator.rs | 2 +- crates/router/src/core/pm_auth.rs | 23 +- crates/router/src/core/poll.rs | 45 - crates/router/src/core/refunds/validator.rs | 2 +- crates/router/src/core/routing.rs | 32 +- crates/router/src/core/routing/helpers.rs | 36 +- crates/router/src/core/user.rs | 393 +- .../src/core/user/dashboard_metadata.rs | 23 +- crates/router/src/core/user/sample_data.rs | 6 +- crates/router/src/core/user_role.rs | 31 +- crates/router/src/core/user_role/role.rs | 3 +- crates/router/src/core/utils.rs | 146 +- crates/router/src/core/verification.rs | 4 +- crates/router/src/core/webhooks.rs | 458 +-- crates/router/src/core/webhooks/utils.rs | 1 + .../src/core/webhooks/webhook_events.rs | 170 +- crates/router/src/db.rs | 16 +- crates/router/src/db/address.rs | 22 +- crates/router/src/db/authentication.rs | 32 - crates/router/src/db/business_profile.rs | 6 +- crates/router/src/db/customers.rs | 629 +-- crates/router/src/db/kafka_store.rs | 232 +- crates/router/src/db/mandate.rs | 514 +-- .../src/db/merchant_connector_account.rs | 28 +- crates/router/src/db/payment_method.rs | 649 +-- crates/router/src/db/refund.rs | 53 +- crates/router/src/db/reverse_lookup.rs | 13 +- crates/router/src/db/user.rs | 29 +- crates/router/src/db/user/sample_data.rs | 8 +- crates/router/src/db/user_role.rs | 28 +- crates/router/src/events.rs | 27 +- crates/router/src/events/api_logs.rs | 10 +- crates/router/src/events/audit_events.rs | 60 +- crates/router/src/events/event_logger.rs | 23 +- crates/router/src/lib.rs | 2 - crates/router/src/routes.rs | 3 +- crates/router/src/routes/admin.rs | 60 +- crates/router/src/routes/api_keys.rs | 10 +- crates/router/src/routes/app.rs | 96 +- crates/router/src/routes/blocklist.rs | 8 +- crates/router/src/routes/cache.rs | 2 +- crates/router/src/routes/cards_info.rs | 2 +- crates/router/src/routes/configs.rs | 8 +- crates/router/src/routes/currency.rs | 4 +- crates/router/src/routes/customers.rs | 14 +- crates/router/src/routes/disputes.rs | 16 +- crates/router/src/routes/dummy_connector.rs | 12 +- crates/router/src/routes/ephemeral_key.rs | 4 +- crates/router/src/routes/files.rs | 8 +- crates/router/src/routes/fraud_check.rs | 2 +- crates/router/src/routes/gsm.rs | 8 +- crates/router/src/routes/health.rs | 26 +- crates/router/src/routes/lock_utils.rs | 21 +- crates/router/src/routes/locker_migration.rs | 2 +- crates/router/src/routes/mandates.rs | 8 +- crates/router/src/routes/payment_link.rs | 10 +- crates/router/src/routes/payment_methods.rs | 71 +- crates/router/src/routes/payments.rs | 122 +- crates/router/src/routes/payouts.rs | 33 +- crates/router/src/routes/pm_auth.rs | 4 +- crates/router/src/routes/poll.rs | 46 - crates/router/src/routes/recon.rs | 6 +- crates/router/src/routes/refunds.rs | 12 +- crates/router/src/routes/routing.rs | 73 +- crates/router/src/routes/user.rs | 119 +- crates/router/src/routes/user_role.rs | 13 +- crates/router/src/routes/verification.rs | 4 +- crates/router/src/routes/verify_connector.rs | 2 +- crates/router/src/routes/webhook_events.rs | 44 +- crates/router/src/routes/webhooks.rs | 7 +- crates/router/src/services.rs | 2 +- crates/router/src/services/api.rs | 63 +- crates/router/src/services/api/client.rs | 20 +- crates/router/src/services/authentication.rs | 112 +- .../src/services/authentication/blacklist.rs | 7 +- .../src/services/authentication/cookies.rs | 44 +- .../authorization/permission_groups.rs | 3 +- .../src/services/authorization/permissions.rs | 2 - crates/router/src/services/email/types.rs | 9 +- crates/router/src/services/kafka.rs | 91 +- .../src/services/kafka/payment_attempt.rs | 4 +- .../src/services/kafka/payment_intent.rs | 2 +- crates/router/src/services/kafka/payout.rs | 90 - crates/router/src/types.rs | 126 +- crates/router/src/types/api.rs | 11 +- crates/router/src/types/api/admin.rs | 2 - crates/router/src/types/api/authentication.rs | 8 - crates/router/src/types/api/mandates.rs | 15 +- .../router/src/types/api/payment_methods.rs | 21 +- crates/router/src/types/api/payments.rs | 10 +- crates/router/src/types/api/payouts.rs | 10 +- crates/router/src/types/api/poll.rs | 6 - .../router/src/types/api/verify_connector.rs | 7 +- crates/router/src/types/api/webhook_events.rs | 1 - crates/router/src/types/api/webhooks.rs | 14 +- crates/router/src/types/authentication.rs | 8 +- crates/router/src/types/domain.rs | 2 - crates/router/src/types/domain/payments.rs | 1076 ----- crates/router/src/types/domain/user.rs | 45 +- .../types/domain/user/dashboard_metadata.rs | 2 - .../src/types/domain/user/decision_manager.rs | 257 -- crates/router/src/types/fraud_check.rs | 2 - crates/router/src/types/storage.rs | 10 +- .../src/types/storage/business_profile.rs | 2 +- .../src/types/storage/payment_attempt.rs | 6 +- crates/router/src/types/transformers.rs | 91 +- crates/router/src/utils.rs | 221 +- crates/router/src/utils/db_utils.rs | 70 - crates/router/src/utils/user.rs | 44 +- .../src/utils/user/dashboard_metadata.rs | 1 - crates/router/src/utils/user/sample_data.rs | 6 +- crates/router/src/utils/user_role.rs | 22 +- crates/router/src/utils/verify_connector.rs | 11 +- crates/router/src/workflows.rs | 2 - .../attach_payout_account_workflow.rs | 72 - .../src/workflows/outgoing_webhook_retry.rs | 10 +- crates/router/src/workflows/payment_sync.rs | 15 +- crates/router/tests/connectors/aci.rs | 26 +- crates/router/tests/connectors/adyen.rs | 44 +- crates/router/tests/connectors/airwallex.rs | 29 +- .../tests/connectors/authorizedotnet.rs | 59 +- crates/router/tests/connectors/bambora.rs | 17 +- .../router/tests/connectors/bankofamerica.rs | 10 +- crates/router/tests/connectors/billwerk.rs | 10 +- crates/router/tests/connectors/bitpay.rs | 5 +- crates/router/tests/connectors/bluesnap.rs | 11 +- crates/router/tests/connectors/boku.rs | 10 +- crates/router/tests/connectors/cashtocode.rs | 8 +- crates/router/tests/connectors/checkout.rs | 10 +- crates/router/tests/connectors/coinbase.rs | 5 +- crates/router/tests/connectors/cryptopay.rs | 5 +- crates/router/tests/connectors/cybersource.rs | 8 +- crates/router/tests/connectors/dlocal.rs | 12 +- .../router/tests/connectors/dummyconnector.rs | 12 +- crates/router/tests/connectors/ebanx.rs | 420 -- crates/router/tests/connectors/fiserv.rs | 17 +- crates/router/tests/connectors/forte.rs | 17 +- crates/router/tests/connectors/globalpay.rs | 8 +- crates/router/tests/connectors/globepay.rs | 10 +- crates/router/tests/connectors/gocardless.rs | 10 +- crates/router/tests/connectors/helcim.rs | 10 +- crates/router/tests/connectors/main.rs | 3 - .../router/tests/connectors/multisafepay.rs | 10 +- crates/router/tests/connectors/netcetera.rs | 352 -- crates/router/tests/connectors/nexinets.rs | 11 +- crates/router/tests/connectors/nmi.rs | 4 +- crates/router/tests/connectors/noon.rs | 12 +- crates/router/tests/connectors/nuvei.rs | 14 +- crates/router/tests/connectors/opayo.rs | 12 +- crates/router/tests/connectors/opennode.rs | 5 +- crates/router/tests/connectors/payeezy.rs | 14 +- crates/router/tests/connectors/payme.rs | 13 +- crates/router/tests/connectors/paypal.rs | 14 +- crates/router/tests/connectors/payu.rs | 10 +- crates/router/tests/connectors/placetopay.rs | 10 +- crates/router/tests/connectors/powertranz.rs | 10 +- crates/router/tests/connectors/prophetpay.rs | 10 +- crates/router/tests/connectors/rapyd.rs | 26 +- .../router/tests/connectors/sample_auth.toml | 16 - crates/router/tests/connectors/shift4.rs | 12 +- crates/router/tests/connectors/square.rs | 12 +- crates/router/tests/connectors/stax.rs | 12 +- crates/router/tests/connectors/stripe.rs | 12 +- crates/router/tests/connectors/trustpay.rs | 10 +- crates/router/tests/connectors/tsys.rs | 12 +- crates/router/tests/connectors/utils.rs | 39 +- crates/router/tests/connectors/volt.rs | 10 +- crates/router/tests/connectors/worldline.rs | 5 +- crates/router/tests/connectors/worldpay.rs | 16 +- crates/router/tests/connectors/zen.rs | 14 +- crates/router/tests/connectors/zsl.rs | 59 - crates/router/tests/payments.rs | 14 +- crates/router/tests/payments2.rs | 14 +- crates/router_derive/Cargo.toml | 17 +- crates/router_env/Cargo.toml | 28 +- crates/router_env/src/lib.rs | 32 + crates/router_env/src/logger/types.rs | 24 +- crates/router_env/src/metrics.rs | 2 +- crates/scheduler/Cargo.toml | 26 +- .../src/consumer/types/process_data.rs | 25 +- crates/scheduler/src/utils.rs | 30 +- crates/storage_impl/Cargo.toml | 37 +- crates/storage_impl/src/customers.rs | 5 - crates/storage_impl/src/database/store.rs | 2 +- crates/storage_impl/src/errors.rs | 36 +- crates/storage_impl/src/lib.rs | 39 +- crates/storage_impl/src/lookup.rs | 12 +- crates/storage_impl/src/mandate.rs | 5 - crates/storage_impl/src/mock_db.rs | 10 +- .../src/mock_db/payment_attempt.rs | 13 +- .../src/mock_db/payment_intent.rs | 16 +- .../src/mock_db/payout_attempt.rs | 22 +- crates/storage_impl/src/mock_db/payouts.rs | 18 +- crates/storage_impl/src/payment_method.rs | 5 - .../src/payments/payment_attempt.rs | 118 +- .../src/payments/payment_intent.rs | 127 +- .../src/payouts/payout_attempt.rs | 63 +- crates/storage_impl/src/payouts/payouts.rs | 92 +- crates/storage_impl/src/redis/cache.rs | 2 +- crates/storage_impl/src/redis/kv_store.rs | 59 +- crates/storage_impl/src/utils.rs | 2 +- crates/test_utils/Cargo.toml | 20 +- crates/test_utils/src/connector_auth.rs | 3 - .../tests/connectors/adyen_uk_wh_ui.rs | 2 + .../tests/connectors/authorizedotnet_ui.rs | 2 +- .../tests/connectors/authorizedotnet_wh_ui.rs | 4 +- .../tests/connectors/bluesnap_wh_ui.rs | 2 + .../tests/connectors/checkout_wh_ui.rs | 2 + .../tests/connectors/stripe_wh_ui.rs | 3 + cypress-tests/.gitignore | 2 - cypress-tests/cypress.config.js | 23 - cypress-tests/cypress.env.json | 1 - .../ConnectorTest/00000-AccountCreate.cy.js | 27 - .../ConnectorTest/00001-CustomerCreate.cy.js | 24 - .../ConnectorTest/00002-ConnectorCreate.cy.js | 23 - .../00003-NoThreeDSAutoCapture.cy.js | 60 - .../00004-ThreeDSAutoCapture.cy.js | 48 - .../00005-NoThreeDSManualCapture.cy.js | 147 - .../e2e/ConnectorTest/00006-VoidPayment.cy.js | 82 - .../e2e/ConnectorTest/00007-SyncPayment.cy.js | 42 - .../ConnectorTest/00008-RefundPayment.cy.js | 344 -- .../e2e/ConnectorTest/00009-SyncRefund.cy.js | 54 - .../00010-CreateSingleuseMandate.cy.js | 91 - .../00011-CreateMultiuseMandate.cy.js | 97 - .../00012-ListAndRevokeMandate.cy.js | 50 - .../ConnectorTest/00013-SaveCardFlow.cy.js | 126 - .../ConnectorTest/00014-ZeroAuthMandate.cy.js | 49 - .../cypress/e2e/ConnectorUtils/Adyen.js | 112 - .../e2e/ConnectorUtils/BankOfAmerica.js | 113 - .../cypress/e2e/ConnectorUtils/Bluesnap.js | 111 - .../cypress/e2e/ConnectorUtils/Cybersource.js | 111 - .../cypress/e2e/ConnectorUtils/Nmi.js | 112 - .../cypress/e2e/ConnectorUtils/Paypal.js | 102 - .../cypress/e2e/ConnectorUtils/Stripe.js | 114 - .../cypress/e2e/ConnectorUtils/Trustpay.js | 111 - .../cypress/e2e/ConnectorUtils/utils.js | 37 - .../cypress/fixtures/capture-flow-body.json | 5 - .../cypress/fixtures/confirm-body.json | 52 - .../cypress/fixtures/create-api-key-body.json | 5 - .../cypress/fixtures/create-confirm-body.json | 82 - .../fixtures/create-connector-body.json | 62 - .../fixtures/create-customer-body.json | 23 - .../cypress/fixtures/create-mandate-cit.json | 90 - .../cypress/fixtures/create-mandate-mit.json | 36 - .../cypress/fixtures/create-payment-body.json | 20 - .../fixtures/list-refund-call-body.json | 3 - .../fixtures/merchant-create-body.json | 44 - .../cypress/fixtures/refund-flow-body.json | 11 - .../fixtures/save-card-confirm-body.json | 6 - .../cypress/fixtures/void-payment-body.json | 3 - cypress-tests/cypress/support/commands.js | 733 ---- cypress-tests/cypress/support/e2e.js | 20 - .../cypress/utils/RequestBodyUtils.js | 27 - cypress-tests/cypress/utils/State.js | 20 - cypress-tests/package-lock.json | 1981 ---------- cypress-tests/package.json | 13 - cypress-tests/readme.md | 242 -- docker-compose.yml | 33 +- docker/fluentd/Dockerfile | 7 - docker/fluentd/conf/fluent.conf | 137 - docker/wasm-build.Dockerfile | 2 +- docs/building_docker_images.md | 155 - docs/try_local_system.md | 3 - loadtest/config/development.toml | 19 +- loadtest/config/tempo.yaml | 2 +- loadtest/k6/helper/k6-summary.js | 26 +- .../down.sql | 3 - .../up.sql | 3 - .../down.sql | 3 - .../2024-03-15-133951_pm-client-secret/up.sql | 3 - .../down.sql | 1 - .../up.sql | 2 - .../down.sql | 1 - .../up.sql | 2 - .../down.sql | 1 - .../up.sql | 1 - .../down.sql | 1 - .../up.sql | 1 - .../down.sql | 2 - .../up.sql | 3 - .../down.sql | 1 - .../up.sql | 2 - .../down.sql | 3 - .../up.sql | 3 - .../down.sql | 3 - .../up.sql | 3 - .../down.sql | 2 - .../up.sql | 2 - .../down.sql | 2 - .../up.sql | 2 - openapi/openapi_spec.json | 676 +--- .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../Payments - Create/request.json | 16 +- .../Payments - Capture/event.test.js | 6 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.prerequest.js | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 7 +- .../.meta.json | 11 + .../List - Mandates-copy}/.event.meta.json | 0 .../List - Mandates-copy/event.test.js | 46 + .../List - Mandates-copy/request.json | 27 + .../List - Mandates-copy}/response.json | 0 .../List - Mandates}/.event.meta.json | 0 .../List - Mandates/event.test.js | 46 + .../List - Mandates/request.json | 27 + .../List - Mandates}/response.json | 0 .../Mandate - Update}/.event.meta.json | 0 .../Mandate - Update/event.test.js | 80 + .../Mandate - Update}/request.json | 84 +- .../Mandate - Update}/response.json | 0 .../Payments - Create}/.event.meta.json | 0 .../Payments - Create/event.test.js | 109 + .../Payments - Create/request.json | 106 + .../Payments - Create}/response.json | 0 .../.event.meta.json | 0 .../Payments - Retrieve-copy/event.test.js | 0 .../Payments - Retrieve-copy}/request.json | 0 .../Payments - Retrieve-copy}/response.json | 0 .../Payments - Retrieve}/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 87 + .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../.event.meta.json | 0 .../Recurring Payments - Create/event.test.js | 0 .../Recurring Payments - Create/request.json | 0 .../response.json | 0 .../.meta.json | 0 .../Payments - Create}/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve}/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve}/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../.meta.json | 0 .../Payments - Create}/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve}/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.prerequest.js | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create}/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../.event.meta.json | 0 .../Payments - Retrieve-copy/event.test.js | 75 + .../Payments - Retrieve-copy/request.json | 33 + .../Payments - Retrieve-copy}/response.json | 0 .../Payments - Retrieve}/.event.meta.json | 1 - .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 33 + .../Payments - Retrieve/response.json | 0 .../.event.meta.json | 5 + .../Recurring Payments - Create/event.test.js | 95 + .../Recurring Payments - Create}/request.json | 63 +- .../response.json | 0 .../Hackathon/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../Payments - Capture/event.test.js | 4 +- .../Payments - Retrieve/event.test.js | 4 +- .../Payments - Capture/event.test.js | 4 +- .../Payments - Retrieve/event.test.js | 4 +- .../Payments - Capture/event.test.js | 14 +- .../Payments - Retrieve/event.test.js | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../Payments - Capture/event.test.js | 4 +- .../Payments - Retrieve/event.test.js | 4 +- .../collection-dir/paypal/event.prerequest.js | 43 +- .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../Payments - Create/event.test.js | 11 +- .../Payments - Create/request.json | 12 - .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.prerequest.js | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.prerequest.js | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 5 + .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 5 + .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve}/response.json | 0 .../zen/Flow Testcases/Happy Cases/.meta.json | 4 +- .../.meta.json | 0 .../Payments - Confirm/.event.meta.json | 0 .../Payments - Confirm/event.test.js | 0 .../Payments - Confirm/request.json | 0 .../Payments - Confirm}/response.json | 0 .../Payments - Create/.event.meta.json | 0 .../Payments - Create/event.test.js | 0 .../Payments - Create/request.json | 0 .../Payments - Create}/response.json | 0 .../Payments - Retrieve/.event.meta.json | 0 .../Payments - Retrieve/event.test.js | 0 .../Payments - Retrieve/request.json | 0 .../Payments - Retrieve/response.json | 1 + postman/collection-dir/zsl/.auth.json | 22 - postman/collection-dir/zsl/.info.json | 9 - postman/collection-dir/zsl/.meta.json | 6 - postman/collection-dir/zsl/.variable.json | 94 - .../zsl/Flow Testcases/.meta.json | 6 - .../zsl/Flow Testcases/Happy Cases/.meta.json | 5 - .../.meta.json | 5 - .../Payments - Create/.event.meta.json | 6 - .../Payments - Create/event.prerequest.js | 0 .../Payments - Create/event.test.js | 58 - .../zsl/Flow Testcases/QuickStart/.meta.json | 8 - .../QuickStart/API Key - Create/event.test.js | 46 - .../QuickStart/API Key - Create/request.json | 52 - .../.event.meta.json | 6 - .../event.prerequest.js | 0 .../Merchant Account - Create/event.test.js | 55 - .../Merchant Account - Create/request.json | 95 - .../Payment Connector - Create/event.test.js | 39 - .../Payment Connector - Create/request.json | 95 - .../Payments - Create/.event.meta.json | 6 - .../Payments - Create/event.prerequest.js | 0 .../Payments - Create/event.test.js | 58 - .../zsl/Health check/.meta.json | 5 - .../Health check/New Request/event.test.js | 4 - .../zsl/Health check/New Request/request.json | 13 - .../collection-dir/zsl/event.prerequest.js | 0 postman/collection-dir/zsl/event.test.js | 13 - .../adyen_uk.postman_collection.json | 10 +- .../airwallex.postman_collection.json | 2 +- .../bambora_3ds.postman_collection.json | 2 +- .../bluesnap.postman_collection.json | 2 +- .../cybersource.postman_collection.json | 870 +++- .../hyperswitch.postman_collection.json | 2 +- .../mollie.postman_collection.json | 2 +- .../multisafepay.postman_collection.json | 2 +- .../nexinets.postman_collection.json | 2 +- .../paypal.postman_collection.json | 88 +- .../powertranz.postman_collection.json | 2 +- .../rapyd.postman_collection.json | 2 +- .../shift4.postman_collection.json | 2 +- .../stripe.postman_collection.json | 15 +- .../trustpay.postman_collection.json | 2 +- .../zen.postman_collection.json | 2 +- .../zsl.postman_collection.json | 796 ---- scripts/add_connector.sh | 2 +- 954 files changed, 14430 insertions(+), 42589 deletions(-) delete mode 100644 crates/analytics/docs/clickhouse/scripts/payouts.sql delete mode 100644 crates/analytics/src/opensearch.rs delete mode 100644 crates/analytics/src/sdk_events/metrics/authentication_unsuccessful_count.rs rename crates/analytics/src/sdk_events/metrics/{three_ds_method_successful_count.rs => payment_success_count.rs} (91%) delete mode 100644 crates/analytics/src/sdk_events/metrics/three_ds_challenge_flow_count.rs delete mode 100644 crates/analytics/src/sdk_events/metrics/three_ds_frictionless_flow_count.rs delete mode 100644 crates/analytics/src/sdk_events/metrics/three_ds_method_invoked_count.rs delete mode 100644 crates/analytics/src/sdk_events/metrics/three_ds_method_skipped_count.rs delete mode 100644 crates/analytics/src/sdk_events/metrics/three_ds_method_unsuccessful_count.rs delete mode 100644 crates/api_models/src/poll.rs delete mode 100644 crates/common_utils/src/access_token.rs rename crates/{hyperswitch_domain_models => data_models}/Cargo.toml (76%) rename crates/{hyperswitch_domain_models => data_models}/README.md (70%) rename crates/{hyperswitch_domain_models => data_models}/src/errors.rs (100%) rename crates/{hyperswitch_domain_models => data_models}/src/lib.rs (100%) rename crates/{hyperswitch_domain_models => data_models}/src/mandates.rs (100%) rename crates/{hyperswitch_domain_models => data_models}/src/payments.rs (90%) rename crates/{hyperswitch_domain_models => data_models}/src/payments/payment_attempt.rs (97%) rename crates/{hyperswitch_domain_models => data_models}/src/payments/payment_intent.rs (97%) rename crates/{hyperswitch_domain_models => data_models}/src/payouts.rs (100%) rename crates/{hyperswitch_domain_models => data_models}/src/payouts/payout_attempt.rs (98%) rename crates/{hyperswitch_domain_models => data_models}/src/payouts/payouts.rs (90%) delete mode 100644 crates/events/Cargo.toml delete mode 100644 crates/events/src/actix.rs delete mode 100644 crates/events/src/lib.rs delete mode 100644 crates/openapi/src/routes/poll.rs delete mode 100644 crates/router/src/connector/ebanx.rs delete mode 100644 crates/router/src/connector/ebanx/transformers.rs delete mode 100644 crates/router/src/connector/netcetera.rs delete mode 100644 crates/router/src/connector/netcetera/netcetera_types.rs delete mode 100644 crates/router/src/connector/netcetera/transformers.rs delete mode 100644 crates/router/src/connector/stripe/transformers/connect.rs delete mode 100644 crates/router/src/connector/zsl.rs delete mode 100644 crates/router/src/connector/zsl/transformers.rs delete mode 100644 crates/router/src/core/payouts/access_token.rs delete mode 100644 crates/router/src/core/poll.rs delete mode 100644 crates/router/src/routes/poll.rs delete mode 100644 crates/router/src/services/kafka/payout.rs delete mode 100644 crates/router/src/types/api/poll.rs delete mode 100644 crates/router/src/types/domain/payments.rs delete mode 100644 crates/router/src/types/domain/user/decision_manager.rs delete mode 100644 crates/router/src/workflows/attach_payout_account_workflow.rs delete mode 100644 crates/router/tests/connectors/ebanx.rs delete mode 100644 crates/router/tests/connectors/netcetera.rs delete mode 100644 crates/router/tests/connectors/zsl.rs delete mode 100644 crates/storage_impl/src/customers.rs delete mode 100644 crates/storage_impl/src/mandate.rs delete mode 100644 crates/storage_impl/src/payment_method.rs delete mode 100644 cypress-tests/.gitignore delete mode 100644 cypress-tests/cypress.config.js delete mode 100644 cypress-tests/cypress.env.json delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00001-CustomerCreate.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00002-ConnectorCreate.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js delete mode 100644 cypress-tests/cypress/e2e/ConnectorUtils/utils.js delete mode 100644 cypress-tests/cypress/fixtures/capture-flow-body.json delete mode 100644 cypress-tests/cypress/fixtures/confirm-body.json delete mode 100644 cypress-tests/cypress/fixtures/create-api-key-body.json delete mode 100644 cypress-tests/cypress/fixtures/create-confirm-body.json delete mode 100644 cypress-tests/cypress/fixtures/create-connector-body.json delete mode 100644 cypress-tests/cypress/fixtures/create-customer-body.json delete mode 100644 cypress-tests/cypress/fixtures/create-mandate-cit.json delete mode 100644 cypress-tests/cypress/fixtures/create-mandate-mit.json delete mode 100644 cypress-tests/cypress/fixtures/create-payment-body.json delete mode 100644 cypress-tests/cypress/fixtures/list-refund-call-body.json delete mode 100644 cypress-tests/cypress/fixtures/merchant-create-body.json delete mode 100644 cypress-tests/cypress/fixtures/refund-flow-body.json delete mode 100644 cypress-tests/cypress/fixtures/save-card-confirm-body.json delete mode 100644 cypress-tests/cypress/fixtures/void-payment-body.json delete mode 100644 cypress-tests/cypress/support/commands.js delete mode 100644 cypress-tests/cypress/support/e2e.js delete mode 100644 cypress-tests/cypress/utils/RequestBodyUtils.js delete mode 100644 cypress-tests/cypress/utils/State.js delete mode 100644 cypress-tests/package-lock.json delete mode 100644 cypress-tests/package.json delete mode 100644 cypress-tests/readme.md delete mode 100644 docker/fluentd/Dockerfile delete mode 100644 docker/fluentd/conf/fluent.conf delete mode 100644 docs/building_docker_images.md delete mode 100644 migrations/2024-03-07-102620_add-network-transaction-id/down.sql delete mode 100644 migrations/2024-03-07-102620_add-network-transaction-id/up.sql delete mode 100644 migrations/2024-03-15-133951_pm-client-secret/down.sql delete mode 100644 migrations/2024-03-15-133951_pm-client-secret/up.sql delete mode 100644 migrations/2024-04-03-090257_add_profile_id_in_authentication_table/down.sql delete mode 100644 migrations/2024-04-03-090257_add_profile_id_in_authentication_table/up.sql delete mode 100644 migrations/2024-04-04-080427_add_payment_id_in_authentication_table/down.sql delete mode 100644 migrations/2024-04-04-080427_add_payment_id_in_authentication_table/up.sql delete mode 100644 migrations/2024-04-09-202926_add_confirm_to_payouts/down.sql delete mode 100644 migrations/2024-04-09-202926_add_confirm_to_payouts/up.sql delete mode 100644 migrations/2024-04-10-034442_alter_payout_status/down.sql delete mode 100644 migrations/2024-04-10-034442_alter_payout_status/up.sql delete mode 100644 migrations/2024-04-12-100908_add_dashboard_metadata_key_onboarding_survey/down.sql delete mode 100644 migrations/2024-04-12-100908_add_dashboard_metadata_key_onboarding_survey/up.sql delete mode 100644 migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/down.sql delete mode 100644 migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/up.sql delete mode 100644 migrations/2024-04-23-132120_add-extended-card-info-to-business-profile/down.sql delete mode 100644 migrations/2024-04-23-132120_add-extended-card-info-to-business-profile/up.sql delete mode 100644 migrations/2024-04-24-075735_add-merchant-pkey-ttl-to-business-profile/down.sql delete mode 100644 migrations/2024-04-24-075735_add-merchant-pkey-ttl-to-business-profile/up.sql delete mode 100644 migrations/2024-04-24-104042_add_capture_method_in_fraud_check_table/down.sql delete mode 100644 migrations/2024-04-24-104042_add_capture_method_in_fraud_check_table/up.sql delete mode 100644 migrations/2024-04-28-095920_make_error_message_field_text/down.sql delete mode 100644 migrations/2024-04-28-095920_make_error_message_field_text/up.sql rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/response.json (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/response.json (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/response.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/response.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.prerequest.js (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/response.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/airwallex/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/response.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/response.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/response.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/response.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/response.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/response.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/response.json (100%) create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/.meta.json rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario18-Create 3ds payment/Payments - Create => Scenario18-Update mandate card details/List - Mandates-copy}/.event.meta.json (100%) create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/event.test.js create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/request.json rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario18-Create 3ds payment/Payments - Create => Scenario18-Update mandate card details/List - Mandates-copy}/response.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario18-Create 3ds payment/Payments - Retrieve => Scenario18-Update mandate card details/List - Mandates}/.event.meta.json (100%) create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/event.test.js create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/request.json rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario18-Create 3ds payment/Payments - Retrieve => Scenario18-Update mandate card details/List - Mandates}/response.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario19-Create 3ds mandate/Payments - Create => Scenario18-Update mandate card details/Mandate - Update}/.event.meta.json (100%) create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/event.test.js rename postman/collection-dir/{zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create => cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update}/request.json (60%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario19-Create 3ds mandate/Payments - Create => Scenario18-Update mandate card details/Mandate - Update}/response.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario19-Create 3ds mandate/Payments - Retrieve => Scenario18-Update mandate card details/Payments - Create}/.event.meta.json (100%) create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/event.test.js create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/request.json rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario19-Create 3ds mandate/Payments - Retrieve => Scenario18-Update mandate card details/Payments - Create}/response.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Payments - Create => Scenario18-Update mandate card details/Payments - Retrieve-copy}/.event.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario18-Update mandate card details}/Payments - Retrieve-copy/event.test.js (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario18-Create 3ds payment/Payments - Retrieve => Scenario18-Update mandate card details/Payments - Retrieve-copy}/request.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Payments - Confirm => Scenario18-Update mandate card details/Payments - Retrieve-copy}/response.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy => Scenario18-Update mandate card details/Payments - Retrieve}/.event.meta.json (100%) create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/event.test.js rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario19-Create 3ds mandate => Scenario18-Update mandate card details}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Payments - Create => Scenario18-Update mandate card details/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Payments - Retrieve => Scenario18-Update mandate card details/Recurring Payments - Create}/.event.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario18-Update mandate card details}/Recurring Payments - Create/event.test.js (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario18-Update mandate card details}/Recurring Payments - Create/request.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy => Scenario18-Update mandate card details/Recurring Payments - Create}/response.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario18-Create 3ds payment => Scenario19-Create 3ds payment}/.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create => Scenario19-Create 3ds payment/Payments - Create}/.event.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario18-Create 3ds payment => Scenario19-Create 3ds payment}/Payments - Create/event.test.js (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario18-Create 3ds payment => Scenario19-Create 3ds payment}/Payments - Create/request.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Payments - Retrieve => Scenario19-Create 3ds payment/Payments - Create}/response.json (100%) rename postman/collection-dir/{trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create => cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve}/.event.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario18-Create 3ds payment => Scenario19-Create 3ds payment}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy => Scenario19-Create 3ds payment/Payments - Retrieve}/request.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create => Scenario19-Create 3ds payment/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario19-Create 3ds mandate => Scenario20-Create 3ds mandate}/.meta.json (100%) rename postman/collection-dir/{trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve => cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create}/.event.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario19-Create 3ds mandate => Scenario20-Create 3ds mandate}/Payments - Create/event.test.js (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario19-Create 3ds mandate => Scenario20-Create 3ds mandate}/Payments - Create/request.json (100%) rename postman/collection-dir/{hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm => cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create}/response.json (100%) rename postman/collection-dir/{zsl/Flow Testcases/QuickStart/API Key - Create => cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve}/.event.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario19-Create 3ds mandate => Scenario20-Create 3ds mandate}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario20-Create 3ds mandate}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create => cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario21-Create a mandate without customer acceptance}/.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario21-Create a mandate without customer acceptance}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario21-Create a mandate without customer acceptance}/Payments - Confirm/event.prerequest.js (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario21-Create a mandate without customer acceptance}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario21-Create a mandate without customer acceptance}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve => cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm}/response.json (100%) rename postman/collection-dir/{zsl/Flow Testcases/QuickStart/Payment Connector - Create => cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create}/.event.meta.json (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario21-Create a mandate without customer acceptance}/Payments - Create/event.test.js (100%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario21-Create a mandate without customer acceptance}/Payments - Create/request.json (100%) rename postman/collection-dir/{mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm => cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create}/response.json (100%) rename postman/collection-dir/{zsl/Health check/New Request => cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy}/.event.meta.json (100%) create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json rename postman/collection-dir/{mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create => cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy}/response.json (100%) rename postman/collection-dir/{zsl => cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve}/.event.meta.json (63%) rename postman/collection-dir/cybersource/Flow Testcases/Happy Cases/{Scenario20-Create a mandate without customer acceptance => Scenario21-Create a mandate without customer acceptance}/Payments - Retrieve/event.test.js (100%) create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json rename postman/collection-dir/{mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false => cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance}/Payments - Retrieve/response.json (100%) create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json create mode 100644 postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js rename postman/collection-dir/{zsl/Flow Testcases/QuickStart/Payments - Create => cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create}/request.json (69%) rename postman/collection-dir/{multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Confirm => cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create}/response.json (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Create => hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Retrieve => hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/hyperswitch/Hackathon/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm => hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create => mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve => mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/mollie/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Confirm => mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Create => multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Retrieve => multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/{Scenario3-Create 3DS payment with confirm false => Scenario3-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Confirm => multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Create => nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Retrieve => nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/nexinets/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm => nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/.meta.json (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create => paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve => paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/paypal/Flow Testcases/Happy Cases/{Scenario7-Create Wallet - Paypal with confirm false => Scenario7-Create Wallet - Paypal with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm => paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create => powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve => powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/powertranz/Flow Testcases/Happy Cases/{Scenario6-Create 3DS payment with confirm false => Scenario6-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm => powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create => rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve => rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/rapyd/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm => rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create => shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve => shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/shift4/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm => shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.prerequest.js (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create => stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve => stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/stripe/Flow Testcases/Happy Cases/{Scenario7-Create 3DS payment with confirm false => Scenario7-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create => stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/trustpay/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/trustpay/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/trustpay/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/event.prerequest.js (100%) rename postman/collection-dir/trustpay/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/trustpay/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{zsl/Flow Testcases/QuickStart/API Key - Create => trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) create mode 100644 postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json rename postman/collection-dir/trustpay/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/trustpay/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{zsl/Flow Testcases/QuickStart/Merchant Account - Create => trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) create mode 100644 postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json rename postman/collection-dir/trustpay/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/trustpay/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) rename postman/collection-dir/{zsl/Flow Testcases/QuickStart/Payment Connector - Create => trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve}/response.json (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/.meta.json (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/.event.meta.json (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/event.test.js (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Confirm/request.json (100%) rename postman/collection-dir/{zsl/Flow Testcases/QuickStart/Payments - Create => zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm}/response.json (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Create/.event.meta.json (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Create/event.test.js (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Create/request.json (100%) rename postman/collection-dir/{zsl/Health check/New Request => zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create}/response.json (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Retrieve/.event.meta.json (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Retrieve/event.test.js (100%) rename postman/collection-dir/zen/Flow Testcases/Happy Cases/{Scenario5-Create 3DS payment with confirm false => Scenario5-Create 3DS payment with confrm false}/Payments - Retrieve/request.json (100%) create mode 100644 postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/response.json delete mode 100644 postman/collection-dir/zsl/.auth.json delete mode 100644 postman/collection-dir/zsl/.info.json delete mode 100644 postman/collection-dir/zsl/.meta.json delete mode 100644 postman/collection-dir/zsl/.variable.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/.meta.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.prerequest.js delete mode 100644 postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.prerequest.js delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js delete mode 100644 postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js delete mode 100644 postman/collection-dir/zsl/Health check/.meta.json delete mode 100644 postman/collection-dir/zsl/Health check/New Request/event.test.js delete mode 100644 postman/collection-dir/zsl/Health check/New Request/request.json delete mode 100644 postman/collection-dir/zsl/event.prerequest.js delete mode 100644 postman/collection-dir/zsl/event.test.js delete mode 100644 postman/collection-json/zsl.postman_collection.json diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f74bd829443..9d34f8eaaee 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -54,3 +54,4 @@ Or did you test this change manually (provide relevant screenshots)? - [ ] I addressed lints thrown by `cargo clippy` - [ ] I reviewed the submitted code - [ ] I added unit tests for my changes where possible +- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable diff --git a/.github/workflows/release-stable-version.yml b/.github/workflows/release-stable-version.yml index 64609aed863..93bd71ef779 100644 --- a/.github/workflows/release-stable-version.yml +++ b/.github/workflows/release-stable-version.yml @@ -103,17 +103,17 @@ jobs: crate: git-cliff version: 1.4.0 - - name: Install cocogitto + - name: Install convco uses: baptiste0928/cargo-install@v2.2.0 with: - crate: cocogitto - version: 6.1.0 + crate: convco + version: 0.5.0 - name: Obtain previous and next tag information shell: bash run: | - PREVIOUS_TAG="v$(cog --verbose get-version)" - NEXT_TAG="$(cog --verbose bump --dry-run "--${{ inputs.bump_type }}")" + PREVIOUS_TAG="v$(convco version --prefix 'v')" + NEXT_TAG="v$(convco version --prefix 'v' "--${{ inputs.bump_type }}")" echo "PREVIOUS_TAG=${PREVIOUS_TAG}" >> $GITHUB_ENV echo "NEXT_TAG=${NEXT_TAG}" >> $GITHUB_ENV diff --git a/.gitignore b/.gitignore index 1aa3faf2c1d..81ef10ad213 100644 --- a/.gitignore +++ b/.gitignore @@ -261,6 +261,3 @@ result* # node_modules node_modules/ - -# cypress credentials -creds.json \ No newline at end of file diff --git a/.typos.toml b/.typos.toml index 642eaded60e..58e48220bd7 100644 --- a/.typos.toml +++ b/.typos.toml @@ -3,62 +3,44 @@ check-filename = true [default.extend-identifiers] "ABD" = "ABD" # Aberdeenshire, UK ISO 3166-2 code -AER = "AER" # An alias to Api Error Response -ANG = "ANG" # Netherlands Antillean guilder currency code BA = "BA" # Bosnia and Herzegovina country code -bottm = "bottm" # name of a css class for nexinets ui test CAF = "CAF" # Central African Republic country code -FO = "FO" # Faroe Islands (the) country code flate2 = "flate2" -hd = "hd" # animation data parameter +FO = "FO" # Faroe Islands (the) country code HypoNoeLbFurNiederosterreichUWien = "HypoNoeLbFurNiederosterreichUWien" hypo_noe_lb_fur_niederosterreich_u_wien = "hypo_noe_lb_fur_niederosterreich_u_wien" -IOT = "IOT" # British Indian Ocean Territory country code -klick = "klick" # Swedish word for clicks -LSO = "LSO" # Lesotho country code NAM = "NAM" # Namibia country code ND = "ND" # North Dakota state code -optin = "optin" # Boku preflow name -optin_id = "optin_id" # Boku's id for optin flow -passord = "passord" # name of a css class for adyen ui test payment_vas = "payment_vas" PaymentVas = "PaymentVas" -PN = "PN" # Pitcairn country code RegioBank = "RegioBank" -RO = "RO" # Romania country code -skip_ws = "skip_ws" # skip white space SOM = "SOM" # Somalia country code -SUR = "SUR" # Single South American currency code THA = "THA" # Thailand country code -TTO = "TTO" # Trinidad and Tobago country code -WS = "WS" # Samoa country code -ws = "ws" # Web socket -ws2ipdef = "ws2ipdef" # WinSock Extension -ws2tcpip = "ws2tcpip" # WinSock Extension ZAR = "ZAR" # South African Rand currency code - +SUR = "SUR" # Single South American currency code +passord = "passord" # name of a css class for adyen ui test +bottm = "bottm" # name of a css class for nexinets ui test +klick = "klick" # Swedish word for clicks +optin = "optin" # Boku preflow name +optin_id = "optin_id" # Boku's id for optin flow [default.extend-words] -aci = "aci" # Name of a connector -afe = "afe" # Commit id +aci = "aci" # Name of a connector +encrypter = "encrypter" # Used by the `ring` crate +nin = "nin" # National identification number, a field used by PayU connector +substituters = "substituters" # Present in `flake.nix` +unsuccess = "unsuccess" # Used in cryptopay request ba = "ba" # ignore minor commit conversions -daa = "daa" # Commit id -deriver = "deriver" ede = "ede" # ignore minor commit conversions -encrypter = "encrypter" # Used by the `ring` crate -guid = "guid" # globally unique identifier +daa = "daa" # Commit id +afe = "afe" # Commit id Hashi = "Hashi" # HashiCorp -iin = "iin" # Card iin -kms = "kms" # Key management service -nin = "nin" # National identification number, a field used by PayU connector requestor = "requestor" #Used in external 3ds flows -substituters = "substituters" # Present in `flake.nix` -unsuccess = "unsuccess" # Used in cryptopay request +deriver = "deriver" [files] extend-exclude = [ "config/redis.conf", # `typos` also checked "AKE" in the file, which is present as a quoted string "openapi/open_api_spec.yaml", # no longer updated "crates/router/src/utils/user/blocker_emails.txt", # this file contains various email domains - "CHANGELOG.md", # This file contains all the commits ] diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e961ee0b79..3ead87751c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,520 +4,6 @@ All notable changes to HyperSwitch will be documented here. - - - -## 2024.05.03.1 - -### Bug Fixes - -- **api_request:** Make `payment_method_data` as optional ([#4527](https://github.com/juspay/hyperswitch/pull/4527)) ([`83a1924`](https://github.com/juspay/hyperswitch/commit/83a192466849c5fd201296e7554644a025ced888)) - -### Miscellaneous Tasks - -- **postman:** Update Postman collection files ([`e3af9d0`](https://github.com/juspay/hyperswitch/commit/e3af9d0cfbf5e73822f3a097d8a36736efae3d3a)) - -**Full Changelog:** [`2024.05.03.0...2024.05.03.1`](https://github.com/juspay/hyperswitch/compare/2024.05.03.0...2024.05.03.1) - -- - - - -## 2024.05.03.0 - -### Features - -- **connector:** - - [Ebanx] Add payout flows ([#4146](https://github.com/juspay/hyperswitch/pull/4146)) ([`4f4cbdf`](https://github.com/juspay/hyperswitch/commit/4f4cbdff21b956b5939cdbe6a4f88f663e6b1281)) - - [Paypal] Add payout flow for wallet(Paypal and Venmo) ([#4406](https://github.com/juspay/hyperswitch/pull/4406)) ([`e4ed1e6`](https://github.com/juspay/hyperswitch/commit/e4ed1e63951873f299f076332671f4a043aa86ab)) -- **core:** Rename crate data_models to hyperswitch_domain_models ([#4504](https://github.com/juspay/hyperswitch/pull/4504)) ([`86e93cd`](https://github.com/juspay/hyperswitch/commit/86e93cd3a0f050c89a82be409b80dc2894143c9e)) -- **opensearch:** Refactoring ([#4244](https://github.com/juspay/hyperswitch/pull/4244)) ([`22cb01a`](https://github.com/juspay/hyperswitch/commit/22cb01ac1ecc90eee464561e4e944aad5cb3ed61)) -- **user:** Add route to get user details ([#4510](https://github.com/juspay/hyperswitch/pull/4510)) ([`be44447`](https://github.com/juspay/hyperswitch/commit/be44447c09ea8814dc8b88aa971e08cc749db5f3)) -- **users:** Create Decision manager for User Flows ([#4518](https://github.com/juspay/hyperswitch/pull/4518)) ([`4b3faf6`](https://github.com/juspay/hyperswitch/commit/4b3faf6781f8ab3198ca86b924f3225256d34b52)) -- Store encrypted extended card info in redis ([#4493](https://github.com/juspay/hyperswitch/pull/4493)) ([`6c59d24`](https://github.com/juspay/hyperswitch/commit/6c59d2434ce5067611d85d37b7ec6f551b7ad81a)) - -### Bug Fixes - -- **users:** Add password validations ([#4489](https://github.com/juspay/hyperswitch/pull/4489)) ([`67794da`](https://github.com/juspay/hyperswitch/commit/67794da36ec25531cbf991034452369b17da8063)) - -### Refactors - -- **Connectors:** [BOA] enhance response objects ([#4508](https://github.com/juspay/hyperswitch/pull/4508)) ([`3ed0e8b`](https://github.com/juspay/hyperswitch/commit/3ed0e8b764d1f1bc7d249122dba39be7dfdcac8b)) -- **user:** Use single purpose token and auth to accept invite ([#4498](https://github.com/juspay/hyperswitch/pull/4498)) ([`4b0cf9c`](https://github.com/juspay/hyperswitch/commit/4b0cf9ce3b793c370e754c159f7f2bf2f8b2a310)) - -### Miscellaneous Tasks - -- **payouts:** Update deployment configs for connector_customer ([#4499](https://github.com/juspay/hyperswitch/pull/4499)) ([`5a447af`](https://github.com/juspay/hyperswitch/commit/5a447afd749c170bfe9f1a106fa28a4819a671dc)) - -**Full Changelog:** [`2024.05.02.0...2024.05.03.0`](https://github.com/juspay/hyperswitch/compare/2024.05.02.0...2024.05.03.0) - -- - - - -## 2024.05.02.0 - -### Features - -- **FRM:** Add shipping details for signifyd ([#4500](https://github.com/juspay/hyperswitch/pull/4500)) ([`bda749d`](https://github.com/juspay/hyperswitch/commit/bda749d097ee9cfe80bc509491bec229da3725c3)) -- Add support for merchant to pass public key and ttl for encrypting payload ([#4456](https://github.com/juspay/hyperswitch/pull/4456)) ([`b562e62`](https://github.com/juspay/hyperswitch/commit/b562e62ac895c34574bcc8c3fcce8e5b49d0f923)) -- Add an api for retrieving the extended card info from redis ([#4484](https://github.com/juspay/hyperswitch/pull/4484)) ([`dfa4b50`](https://github.com/juspay/hyperswitch/commit/dfa4b50dbd5cfc927fbbd6a68725d2c51625e6d1)) - -### Bug Fixes - -- **access_token:** Use fallback to `connector_name` if `merchant_connector_id` is not present ([#4503](https://github.com/juspay/hyperswitch/pull/4503)) ([`632a00c`](https://github.com/juspay/hyperswitch/commit/632a00cb6803e3e6f94099e48fb4198a0ea49f99)) -- **connector:** Send valid sdk information in authentication flow netcetera ([#4474](https://github.com/juspay/hyperswitch/pull/4474)) ([`8f0d4d4`](https://github.com/juspay/hyperswitch/commit/8f0d4d4191bb96efd8700fb115d91213c2872ad8)) -- **euclid_wasm:** Connector config wasm metadata update ([#4460](https://github.com/juspay/hyperswitch/pull/4460)) ([`28df646`](https://github.com/juspay/hyperswitch/commit/28df646830f544179b7cf00eb8f51de2a606bdbc)) - -### Refactors - -- **core:** Remove payment_method_id from RouterData struct ([#4485](https://github.com/juspay/hyperswitch/pull/4485)) ([`3077a0d`](https://github.com/juspay/hyperswitch/commit/3077a0d31e8d36f18e359f1edf9a742969601f6b)) -- **cypress:** Read creds from env instead of hardcoding the path ([#4430](https://github.com/juspay/hyperswitch/pull/4430)) ([`0c9ba1e`](https://github.com/juspay/hyperswitch/commit/0c9ba1e848c757cf3e0708f2ed4694259a5344aa)) -- **user:** Deprecate Signin, Verify email and Invite v1 APIs ([#4465](https://github.com/juspay/hyperswitch/pull/4465)) ([`b0133f3`](https://github.com/juspay/hyperswitch/commit/b0133f33693575f2145d295eff78dd07b61efcda)) - -### Miscellaneous Tasks - -- Make client certificate and private key secret across codebase ([#4490](https://github.com/juspay/hyperswitch/pull/4490)) ([`dd7b10a`](https://github.com/juspay/hyperswitch/commit/dd7b10a8bdad4c509a4fbae429f3abd21a5d6758)) - -**Full Changelog:** [`2024.04.30.0...2024.05.02.0`](https://github.com/juspay/hyperswitch/compare/2024.04.30.0...2024.05.02.0) - -- - - - -## 2024.04.30.0 - -### Features - -- **FRM:** Revise post FRM core flows ([#4394](https://github.com/juspay/hyperswitch/pull/4394)) ([`01ec7c6`](https://github.com/juspay/hyperswitch/commit/01ec7c64a4e0536b11052a6d5f3b398216d7b1e3)) -- **router:** - - Send poll_config in next_action of confirm response for external 3ds flow ([#4443](https://github.com/juspay/hyperswitch/pull/4443)) ([`c3a1db1`](https://github.com/juspay/hyperswitch/commit/c3a1db16f32bd0b5aa49dfc831156a10d6d15838)) - - Handle authorization for frictionless flow in external 3ds flow ([#4471](https://github.com/juspay/hyperswitch/pull/4471)) ([`79d8949`](https://github.com/juspay/hyperswitch/commit/79d8949413c8007e261b66b01596d257fb5959f9)) -- **user:** Add single purpose token and auth ([#4470](https://github.com/juspay/hyperswitch/pull/4470)) ([`c20ecb8`](https://github.com/juspay/hyperswitch/commit/c20ecb855aa3c4b3ce1798dcc19910fb38345b46)) -- Stripe connect integration for payouts ([#2041](https://github.com/juspay/hyperswitch/pull/2041)) ([`ac9d856`](https://github.com/juspay/hyperswitch/commit/ac9d856add0220701f809c8eb0668afe77003ef7)) - -**Full Changelog:** [`2024.04.29.0...2024.04.30.0`](https://github.com/juspay/hyperswitch/compare/2024.04.29.0...2024.04.30.0) - -- - - - -## 2024.04.29.0 - -### Features - -- **connector:** [CRYPTOPAY] Report underpaid/overpaid amount in outgoing webhooks ([#4468](https://github.com/juspay/hyperswitch/pull/4468)) ([`cc1051d`](https://github.com/juspay/hyperswitch/commit/cc1051da99c1b4e007d7f730e2fe3cb08b078d80)) -- **users:** Use cookie for auth ([#4434](https://github.com/juspay/hyperswitch/pull/4434)) ([`b2b9fab`](https://github.com/juspay/hyperswitch/commit/b2b9fab31dc838958e59a7a6755a0585d5a10302)) - -### Refactors - -- **access_token:** Use `merchant_connector_id` for storing access token ([#4462](https://github.com/juspay/hyperswitch/pull/4462)) ([`d98551d`](https://github.com/juspay/hyperswitch/commit/d98551d80a14e2878fbac93e4ba0ecb537018802)) -- **required_fields:** Change required fields for billing address ([#4258](https://github.com/juspay/hyperswitch/pull/4258)) ([`e730030`](https://github.com/juspay/hyperswitch/commit/e730030e24d177b3e696b446e5ccb964cc07ee37)) -- **scheduler:** Join frequency and count in `RetryMapping` ([#4313](https://github.com/juspay/hyperswitch/pull/4313)) ([`3335195`](https://github.com/juspay/hyperswitch/commit/33351953baf32be96f6ec11982c05f2bb1edb989)) - -**Full Changelog:** [`2024.04.26.0...2024.04.29.0`](https://github.com/juspay/hyperswitch/compare/2024.04.26.0...2024.04.29.0) - -- - - - -## 2024.04.26.0 - -### Features - -- **core:** [Payouts] Add access_token flow for Payout Create and Fulfill flow ([#4375](https://github.com/juspay/hyperswitch/pull/4375)) ([`7f0d04f`](https://github.com/juspay/hyperswitch/commit/7f0d04fe3782cf6777c67e40e708c7abb5c4f45e)) -- Add an api for toggling extended card info feature ([#4444](https://github.com/juspay/hyperswitch/pull/4444)) ([`87d9fce`](https://github.com/juspay/hyperswitch/commit/87d9fced07e5cc1366eb6d16d2584bd920ad16fe)) - -### Bug Fixes - -- **connector:** [CYBERSOURCE] Handle HTML Error Response and add Descriptor field in ApplePay payments request ([#4451](https://github.com/juspay/hyperswitch/pull/4451)) ([`dbd3160`](https://github.com/juspay/hyperswitch/commit/dbd3160fcf310b2942ef096bfb091881bfeec902)) - -### Refactors - -- **configs:** Add comments to configs for deployments to environments ([#4458](https://github.com/juspay/hyperswitch/pull/4458)) ([`9d096e6`](https://github.com/juspay/hyperswitch/commit/9d096e6b4883e34908eca0d5aa134a88bec22b40)) -- **connector:** Pass optional browser_info to stripe for increased trust ([#4374](https://github.com/juspay/hyperswitch/pull/4374)) ([`4c793c3`](https://github.com/juspay/hyperswitch/commit/4c793c3c00e93ebf4a4db3439a213474ff57b54d)) -- **core:** Make save_payment_method as post_update_tracker trait function ([#4307](https://github.com/juspay/hyperswitch/pull/4307)) ([`5f40eee`](https://github.com/juspay/hyperswitch/commit/5f40eee3fa264390ea6ac7feaca7737d83dccb3a)) -- **payment_methods:** Store `card_network` in locker ([#4425](https://github.com/juspay/hyperswitch/pull/4425)) ([`5b54d55`](https://github.com/juspay/hyperswitch/commit/5b54d55c5e0d2c8ae1090fb566434efb50120857)) -- **voucher:** Remove billing details from voucher pmd ([#4361](https://github.com/juspay/hyperswitch/pull/4361)) ([`2dd0ee6`](https://github.com/juspay/hyperswitch/commit/2dd0ee68bf23e5f49d22011f0294f44f4e97423b)) - -### Documentation - -- **cypress:** Update Cypress README Documentation ([#4380](https://github.com/juspay/hyperswitch/pull/4380)) ([`8ee1a58`](https://github.com/juspay/hyperswitch/commit/8ee1a58c386fc5f08025c6ac90c96468e6d26bc7)) -- Add documentation page for building Docker images ([#4457](https://github.com/juspay/hyperswitch/pull/4457)) ([`705e827`](https://github.com/juspay/hyperswitch/commit/705e82779a2b7bfd0cb1cd856b4a760d487cd8c5)) - -### Miscellaneous Tasks - -- **postman:** Update Postman collection files ([`047f917`](https://github.com/juspay/hyperswitch/commit/047f9171a5ae5e8211e18b1c882672dab0c26d07)) - -**Full Changelog:** [`2024.04.25.0...2024.04.26.0`](https://github.com/juspay/hyperswitch/compare/2024.04.25.0...2024.04.26.0) - -- - - - -## 2024.04.25.0 - -### Features - -- **router:** Handle authorize redirection after webhook processing for external 3ds flow ([#4452](https://github.com/juspay/hyperswitch/pull/4452)) ([`131e487`](https://github.com/juspay/hyperswitch/commit/131e487c662985737e9b50a8e62295ed9d23ca83)) - -### Bug Fixes - -- **routing/tests:** Fix unit tests for routing ([#4438](https://github.com/juspay/hyperswitch/pull/4438)) ([`1d0d94d`](https://github.com/juspay/hyperswitch/commit/1d0d94d5e6528534ce461db39620f35490582ecb)) - -### Documentation - -- **try_local_system:** Update WSL setup guide to address a memory issue ([#4431](https://github.com/juspay/hyperswitch/pull/4431)) ([`56f14b9`](https://github.com/juspay/hyperswitch/commit/56f14b935d5e9742a894408a714033318ecb6f2a)) - -### Miscellaneous Tasks - -- Remove repetitive words ([#4448](https://github.com/juspay/hyperswitch/pull/4448)) ([`f49b0b3`](https://github.com/juspay/hyperswitch/commit/f49b0b3aabdf72030cb893ce479214eccd5a6e0f)) - -**Full Changelog:** [`2024.04.24.0...2024.04.25.0`](https://github.com/juspay/hyperswitch/compare/2024.04.24.0...2024.04.25.0) - -- - - - -## 2024.04.24.0 - -### Features - -- **connector:** - - Implement authentication flow for netcetera ([#4334](https://github.com/juspay/hyperswitch/pull/4334)) ([`5ce0535`](https://github.com/juspay/hyperswitch/commit/5ce0535bb6798af16057c1323541ee4789dbceb1)) - - Add webhook support for netcetera ([#4382](https://github.com/juspay/hyperswitch/pull/4382)) ([`776c1a7`](https://github.com/juspay/hyperswitch/commit/776c1a7a24b494bf767c5524d1b8ac90472d32e2)) - -### Bug Fixes - -- **masking:** Mask email while logging SQL query ([#4436](https://github.com/juspay/hyperswitch/pull/4436)) ([`4c81a66`](https://github.com/juspay/hyperswitch/commit/4c81a664c90ad749e80c372296c844b39dded334)) -- **user:** Blacklist token after delete user role ([#4428](https://github.com/juspay/hyperswitch/pull/4428)) ([`b67e07f`](https://github.com/juspay/hyperswitch/commit/b67e07fb9ee576c57dcbca21c52aa1e4ed2d2818)) - -### Refactors - -- **router:** Enable saved payment method for payment link bug fix ([#4435](https://github.com/juspay/hyperswitch/pull/4435)) ([`213ff06`](https://github.com/juspay/hyperswitch/commit/213ff063a0f6182f9ccd7cdb268aad1ec0372cc9)) - -### Miscellaneous Tasks - -- **configs:** Add wasm changes for pull_mechanism_enabled config for 3dsecureio connector ([#4433](https://github.com/juspay/hyperswitch/pull/4433)) ([`b2248fe`](https://github.com/juspay/hyperswitch/commit/b2248fe08b0b075a9d326e862a18f50e5bef12f8)) - -**Full Changelog:** [`2024.04.23.0...2024.04.24.0`](https://github.com/juspay/hyperswitch/compare/2024.04.23.0...2024.04.24.0) - -- - - - -## 2024.04.23.0 - -### Features - -- **euclied_wasm:** [NMI] Add configs for extended 3DS ([#4422](https://github.com/juspay/hyperswitch/pull/4422)) ([`b8be10d`](https://github.com/juspay/hyperswitch/commit/b8be10de52e40d2327819d33c6c1ec40a459bdd5)) -- **router:** Add poll ability in external 3ds authorization flow ([#4393](https://github.com/juspay/hyperswitch/pull/4393)) ([`4476553`](https://github.com/juspay/hyperswitch/commit/447655382bcf2fdd69a1ec6a56e5e4df8a8feef2)) - -### Refactors - -- **wallet:** Use `billing.phone` instead of `telephone_number` ([#4329](https://github.com/juspay/hyperswitch/pull/4329)) ([`3e6bc19`](https://github.com/juspay/hyperswitch/commit/3e6bc191fd5804feface9ee1a0cb7ddbbe025569)) - -### Miscellaneous Tasks - -- Add wasm toml configs for netcetera authnetication connector ([#4426](https://github.com/juspay/hyperswitch/pull/4426)) ([`4851da1`](https://github.com/juspay/hyperswitch/commit/4851da1595074dbb2760e76f83403e8ac9f7895f)) - -**Full Changelog:** [`2024.04.22.0...2024.04.23.0`](https://github.com/juspay/hyperswitch/compare/2024.04.22.0...2024.04.23.0) - -- - - - -## 2024.04.22.0 - -### Features - -- **payment_methods:** Client secret implementation in payment method… ([#4134](https://github.com/juspay/hyperswitch/pull/4134)) ([`4330781`](https://github.com/juspay/hyperswitch/commit/43307815e0200caf2e9517ec1374d09696356fbc)) -- **router:** [BOA/CYBS] add avs_response and cvv validation result in the response ([#4376](https://github.com/juspay/hyperswitch/pull/4376)) ([`e458e49`](https://github.com/juspay/hyperswitch/commit/e458e4907e39961f386900f21382c9ace3b7c392)) - -### Bug Fixes - -- **connectors:** Mask fields for webhook_resource_object ([#4400](https://github.com/juspay/hyperswitch/pull/4400)) ([`110bf22`](https://github.com/juspay/hyperswitch/commit/110bf22511cf4994c7325fb105fee60f910c1210)) -- **core:** Fix 3DS mandates, for the connector _mandate_details to be stored in the payment_methods table ([#4323](https://github.com/juspay/hyperswitch/pull/4323)) ([`f4e5784`](https://github.com/juspay/hyperswitch/commit/f4e5784f6ce57b4a205c164889242bfa1bc1fde2)) -- **user:** Add onboarding_survey enum in dashboard metadata type ([#4353](https://github.com/juspay/hyperswitch/pull/4353)) ([`f6fccaf`](https://github.com/juspay/hyperswitch/commit/f6fccafb3d43ce4b2865cf4b3cba7ad8a9619e5b)) - -**Full Changelog:** [`2024.04.19.0...2024.04.22.0`](https://github.com/juspay/hyperswitch/compare/2024.04.19.0...2024.04.22.0) - -- - - - -## 2024.04.19.0 - -### Features - -- **connector:** [NMI] External 3DS flow for Cards ([#4385](https://github.com/juspay/hyperswitch/pull/4385)) ([`4feda8f`](https://github.com/juspay/hyperswitch/commit/4feda8f89049b830f974e82f414720fd12608170)) -- **payments:** Add amount and connector id filter in list ([#4354](https://github.com/juspay/hyperswitch/pull/4354)) ([`53e5307`](https://github.com/juspay/hyperswitch/commit/53e5307c3cc3ae2b9f1d93d6c1e4d8e7827def7c)) - -### Testing - -- **cypress:** Update ConnectorAuth Details ([#4386](https://github.com/juspay/hyperswitch/pull/4386)) ([`ef1914e`](https://github.com/juspay/hyperswitch/commit/ef1914ec9b75240628ad0c6367499ec063d31e3d)) - -**Full Changelog:** [`2024.04.18.0...2024.04.19.0`](https://github.com/juspay/hyperswitch/compare/2024.04.18.0...2024.04.19.0) - -- - - - -## 2024.04.18.0 - -### Features - -- **payment_link:** Add support for saved payment method option for payment link ([#4373](https://github.com/juspay/hyperswitch/pull/4373)) ([`14341ca`](https://github.com/juspay/hyperswitch/commit/14341cad27c635d35a7804752a7dd9db4ad45503)) -- **router:** Add retrieve poll status api ([#4358](https://github.com/juspay/hyperswitch/pull/4358)) ([`ca47ea9`](https://github.com/juspay/hyperswitch/commit/ca47ea9b13ff29085f7cc4e408f2b6498b1d6e8a)) - -### Bug Fixes - -- **config:** Remove `merchant_business_country` from the connector configs as enums can not be handled in this toml file ([#4383](https://github.com/juspay/hyperswitch/pull/4383)) ([`2f59143`](https://github.com/juspay/hyperswitch/commit/2f5914392be9bb4c59c9bf5be9f5d4b6c99ef682)) -- **router:** Make payment_instrument optional ([#4389](https://github.com/juspay/hyperswitch/pull/4389)) ([`450dd0f`](https://github.com/juspay/hyperswitch/commit/450dd0fe0d7c2283fbb43b7dfbe0b6214265d124)) - -**Full Changelog:** [`2024.04.17.0...2024.04.18.0`](https://github.com/juspay/hyperswitch/compare/2024.04.17.0...2024.04.18.0) - -- - - - -## 2024.04.17.0 - -### Features - -- **payment_link:** Added display_sdk_only option for displaying only sdk without payment details ([#4363](https://github.com/juspay/hyperswitch/pull/4363)) ([`4d99098`](https://github.com/juspay/hyperswitch/commit/4d9909899f493ee28fec08846fde9737867df52b)) - -### Refactors - -- **payment_methods:** Revamp payment methods update endpoint ([#4305](https://github.com/juspay/hyperswitch/pull/4305)) ([`3333bbf`](https://github.com/juspay/hyperswitch/commit/3333bbfe7f5af30b872809629f9942a76a823638)) - -**Full Changelog:** [`2024.04.16.1...2024.04.17.0`](https://github.com/juspay/hyperswitch/compare/2024.04.16.1...2024.04.17.0) - -- - - - -## 2024.04.16.1 - -### Features - -- **connector:** Integrate netcetera connector with pre authentication flow ([#4293](https://github.com/juspay/hyperswitch/pull/4293)) ([`d4dbaad`](https://github.com/juspay/hyperswitch/commit/d4dbaadb06f74835235c0deb53835a8f97fa26b6)) -- **mandate_kv:** Add kv support for mandate ([#4275](https://github.com/juspay/hyperswitch/pull/4275)) ([`00340a3`](https://github.com/juspay/hyperswitch/commit/00340a3369a08d93b7fe7a2c1c7ba244ee5b6248)) -- **payments:** Get new filters for payments list ([#4174](https://github.com/juspay/hyperswitch/pull/4174)) ([`c3361ef`](https://github.com/juspay/hyperswitch/commit/c3361ef5ebed09b24df73221faaa6d6178fda070)) -- **pm_list:** Add dynamic fields for local bank transfer ([#4349](https://github.com/juspay/hyperswitch/pull/4349)) ([`60d244c`](https://github.com/juspay/hyperswitch/commit/60d244cbe860fd13749ac8b4f6adfd85aefb8dde)) -- **router:** Add external authentication webhooks flow ([#4339](https://github.com/juspay/hyperswitch/pull/4339)) ([`00cd96d`](https://github.com/juspay/hyperswitch/commit/00cd96d0979244d71abfa0a20c7a5125997c73d6)) - -### Bug Fixes - -- **address:** Use first_name if last_name is not passed ([#4360](https://github.com/juspay/hyperswitch/pull/4360)) ([`1b7cde2`](https://github.com/juspay/hyperswitch/commit/1b7cde2d1b687e9c5ca8e3c02eef5c7d3fb7da8f)) -- Added find all support for pm kv ([#4357](https://github.com/juspay/hyperswitch/pull/4357)) ([`5b811aa`](https://github.com/juspay/hyperswitch/commit/5b811aac00493f2368716265418f1c547450222c)) - -**Full Changelog:** [`2024.04.16.0...2024.04.16.1`](https://github.com/juspay/hyperswitch/compare/2024.04.16.0...2024.04.16.1) - -- - - - -## 2024.04.16.0 - -### Features - -- **events:** Add payment cancel events ([#4166](https://github.com/juspay/hyperswitch/pull/4166)) ([`dea21c6`](https://github.com/juspay/hyperswitch/commit/dea21c65ffc872394caa39e29bcd6674d2e4f174)) -- **router:** Add `merchant_business_country` field in apple pay `session_token_data` ([#4236](https://github.com/juspay/hyperswitch/pull/4236)) ([`c3c8d09`](https://github.com/juspay/hyperswitch/commit/c3c8d094531df8092c1e9b772af75b22a7c2dccb)) - -### Miscellaneous Tasks - -- **configs:** [Zsl] Add configs for wasm ([#4346](https://github.com/juspay/hyperswitch/pull/4346)) ([`2f7faca`](https://github.com/juspay/hyperswitch/commit/2f7faca97e0ad47341e73a261fb9faff9043de13)) - -**Full Changelog:** [`2024.04.15.0...2024.04.16.0`](https://github.com/juspay/hyperswitch/compare/2024.04.15.0...2024.04.16.0) - -- - - - -## 2024.04.15.0 - -### Bug Fixes - -- **logger:** Use specified log level only for first-party crates ([#4356](https://github.com/juspay/hyperswitch/pull/4356)) ([`b204be0`](https://github.com/juspay/hyperswitch/commit/b204be0e919d0ffd97b383e6a654982f78f9fa3d)) - -### Refactors - -- **router:** Change stack size ([#4355](https://github.com/juspay/hyperswitch/pull/4355)) ([`4c2e972`](https://github.com/juspay/hyperswitch/commit/4c2e97273ab07917477ce016f7f04400e7e5df9a)) - -**Full Changelog:** [`2024.04.12.1...2024.04.15.0`](https://github.com/juspay/hyperswitch/compare/2024.04.12.1...2024.04.15.0) - -- - - - -## 2024.04.12.1 - -### Features - -- **core:** Create mandates with payment_token ([#4342](https://github.com/juspay/hyperswitch/pull/4342)) ([`53697fb`](https://github.com/juspay/hyperswitch/commit/53697fb472d6e236d57aef6883a6b11a0e9232f1)) -- **customer:** Customer kv impl ([#4267](https://github.com/juspay/hyperswitch/pull/4267)) ([`c980f01`](https://github.com/juspay/hyperswitch/commit/c980f016918144290ea98df2860644249c7b2e03)) - -### Bug Fixes - -- **connector:** [ZSL] Add base_url to Environments ([#4344](https://github.com/juspay/hyperswitch/pull/4344)) ([`91830f6`](https://github.com/juspay/hyperswitch/commit/91830f6d7965f1ba9c23925a1399fdf810a7b31a)) -- **payouts:** Update payout's state in app after DB operations ([#4341](https://github.com/juspay/hyperswitch/pull/4341)) ([`0fe93d6`](https://github.com/juspay/hyperswitch/commit/0fe93d65b40acf169ec333bc238505e3381f9842)) -- **router:** Capture billing country in payments request ([#4347](https://github.com/juspay/hyperswitch/pull/4347)) ([`986ed2a`](https://github.com/juspay/hyperswitch/commit/986ed2a923444a38960462ec03f5e7cd8a2c249a)) -- Revert payment method kv changes ([#4351](https://github.com/juspay/hyperswitch/pull/4351)) ([`bb202e3`](https://github.com/juspay/hyperswitch/commit/bb202e39bfc10cfc5ea6e15805ba28e2699284c8)) - -### Refactors - -- **payment_methods:** Add BankTransfer payment method data to new domain type to be used in connector module ([#4260](https://github.com/juspay/hyperswitch/pull/4260)) ([`08d0811`](https://github.com/juspay/hyperswitch/commit/08d08114be0792614ce8fb990d6a9f45420cae33)) - -**Full Changelog:** [`2024.04.12.0...2024.04.12.1`](https://github.com/juspay/hyperswitch/compare/2024.04.12.0...2024.04.12.1) - -- - - - -## 2024.04.12.0 - -### Features - -- **connector:** [ZSL] add connector template code ([#4285](https://github.com/juspay/hyperswitch/pull/4285)) ([`086516b`](https://github.com/juspay/hyperswitch/commit/086516b7b307e074b4301bd14a4c65595b6e142c)) -- **events:** Add events framework for registering events ([#4115](https://github.com/juspay/hyperswitch/pull/4115)) ([`3963219`](https://github.com/juspay/hyperswitch/commit/3963219e44bd771353d754aa356097e2d78a1392)) -- **payment_methods:** Added kv support for payment_methods table ([#4311](https://github.com/juspay/hyperswitch/pull/4311)) ([`eb3cecd`](https://github.com/juspay/hyperswitch/commit/eb3cecdd74b4c758948f9de82727af76b9ba9fb0)) -- **payouts:** Add kafka events ([#4264](https://github.com/juspay/hyperswitch/pull/4264)) ([`a2958c3`](https://github.com/juspay/hyperswitch/commit/a2958c33b5c4ed627c97e97e791ca2cfbfcecd5e)) -- **router:** - - Add `ApiKeyAuth` support for `upsert_connector_agnostic_mandate_config` ([#4335](https://github.com/juspay/hyperswitch/pull/4335)) ([`963a10c`](https://github.com/juspay/hyperswitch/commit/963a10c877cf7e63cef2c05093cc2c3d4eab66ec)) - - Add support for accepting an existing `payment_method_id` as the `payment_method_data` in `/payments` request ([#4328](https://github.com/juspay/hyperswitch/pull/4328)) ([`92e19af`](https://github.com/juspay/hyperswitch/commit/92e19af275c615db77e3ae398bfd487529210ba4)) -- **users:** Add role specific fields for list merchants API ([#4326](https://github.com/juspay/hyperswitch/pull/4326)) ([`018c5b1`](https://github.com/juspay/hyperswitch/commit/018c5b10646a68a9898c47ade4874d52250231a8)) - -### Bug Fixes - -- **compatibility:** Generate payment_id if not sent ([#4125](https://github.com/juspay/hyperswitch/pull/4125)) ([`9448673`](https://github.com/juspay/hyperswitch/commit/9448673c1c49fe1419f47c28f59e30268b9691c5)) -- **connectors:** Amount received should be zero for `pending` and `failed` status ([#4331](https://github.com/juspay/hyperswitch/pull/4331)) ([`6aa66c4`](https://github.com/juspay/hyperswitch/commit/6aa66c4243fd2a55c9df5420fd2dc85ef156561b)) -- **mandate:** Add validation for currency in MIT recurring payments ([#4308](https://github.com/juspay/hyperswitch/pull/4308)) ([`07c917c`](https://github.com/juspay/hyperswitch/commit/07c917c0559da1774848d0deb95a2725fc0d6503)) - -### Refactors - -- **card:** Use `billing.first_name` instead of `card_holder_name` ([#4239](https://github.com/juspay/hyperswitch/pull/4239)) ([`8b66cda`](https://github.com/juspay/hyperswitch/commit/8b66cdaaf384bb0d5ce986334a7b32bb3cb13581)) -- **connector:** [Ebanx] Add base_url to Integ Environment ([#4332](https://github.com/juspay/hyperswitch/pull/4332)) ([`13ba3cb`](https://github.com/juspay/hyperswitch/commit/13ba3cbd9627ff53b701084d8d4c0b800793a3e3)) -- **connectors:** [ZSL] add Local bank Transfer ([#4337](https://github.com/juspay/hyperswitch/pull/4337)) ([`266a075`](https://github.com/juspay/hyperswitch/commit/266a075ab653b96505a4f8f26688153ced952c8f)) -- **payment_methods:** - - Add some payment method data to new domain type to be used in connector module ([#4234](https://github.com/juspay/hyperswitch/pull/4234)) ([`ce1e165`](https://github.com/juspay/hyperswitch/commit/ce1e165cecade481ce6002795049d6a9ffec96e2)) - - Add BankDebit payment method data to new domain type to be used in connector module ([#4238](https://github.com/juspay/hyperswitch/pull/4238)) ([`2bf775a`](https://github.com/juspay/hyperswitch/commit/2bf775a97e331cde2cad3e3d2a325850d969add9)) -- **router:** Add `updated` field to `PaymentsResponse` ([#4292](https://github.com/juspay/hyperswitch/pull/4292)) ([`c99e038`](https://github.com/juspay/hyperswitch/commit/c99e038a4813aa68b7a0a6ad3458c93a0e3c27ba)) - -### Miscellaneous Tasks - -- **deps:** Update time crate to 0.3.35 ([#4338](https://github.com/juspay/hyperswitch/pull/4338)) ([`44e7456`](https://github.com/juspay/hyperswitch/commit/44e7456a1088f8c413ff3694357822328bbc29bb)) - -**Full Changelog:** [`2024.04.10.0...2024.04.12.0`](https://github.com/juspay/hyperswitch/compare/2024.04.10.0...2024.04.12.0) - -- - - - -## 2024.04.10.0 - -### Features - -- **connector:** [Ebanx] Template for ebanx payout ([#4141](https://github.com/juspay/hyperswitch/pull/4141)) ([`ed186a5`](https://github.com/juspay/hyperswitch/commit/ed186a5a9343c1d735749eb9ec90cb0d0f6094cd)) -- **router:** Add local bank transfer payment method ([#4294](https://github.com/juspay/hyperswitch/pull/4294)) ([`06440eb`](https://github.com/juspay/hyperswitch/commit/06440eb6400adf166b203d7e4f587c1e2d5fe4f8)) - -### Bug Fixes - -- **psync:** Log the error if payment method retrieve fails in the `psync flow` ([#4321](https://github.com/juspay/hyperswitch/pull/4321)) ([`5b89209`](https://github.com/juspay/hyperswitch/commit/5b89209b6f48691ee5ae2f9ede0d913abc9105f9)) - -### Refactors - -- **payment_methods:** Add BankRedirect payment method data to new domain type to be used in connector module ([#4175](https://github.com/juspay/hyperswitch/pull/4175)) ([`e0e8437`](https://github.com/juspay/hyperswitch/commit/e0e843715cd02ac8b2eff2f645fe8471551ee914)) - -**Full Changelog:** [`2024.04.08.0...2024.04.10.0`](https://github.com/juspay/hyperswitch/compare/2024.04.08.0...2024.04.10.0) - -- - - - -## 2024.04.08.0 - -### Features - -- **users:** Implemented cookie parsing for auth ([#4298](https://github.com/juspay/hyperswitch/pull/4298)) ([`2d394f9`](https://github.com/juspay/hyperswitch/commit/2d394f98e96d0beafca24abe2ac9f10a05460993)) - -### Bug Fixes - -- **locker:** Handle card duplication in payouts flow ([#4013](https://github.com/juspay/hyperswitch/pull/4013)) ([`2fac436`](https://github.com/juspay/hyperswitch/commit/2fac436683060b8e7c81b210dfdf468f5194f24c)) -- **mandates:** Store network transaction id only when `pg_agnostic` config is enabled in the `authorize_flow` ([#4318](https://github.com/juspay/hyperswitch/pull/4318)) ([`7b4c4fe`](https://github.com/juspay/hyperswitch/commit/7b4c4fea332d56f81a73b496fa0fefdbb64b3648)) -- **redis_interface:** Remove mget function from redis interface ([#4303](https://github.com/juspay/hyperswitch/pull/4303)) ([`14035d2`](https://github.com/juspay/hyperswitch/commit/14035d2f838d88c56fe37f78caab6c88bc8b33e4)) - -### Refactors - -- **payment_methods:** Add PayLater payment method data to new domain type to be used in connector module ([#4165](https://github.com/juspay/hyperswitch/pull/4165)) ([`6694852`](https://github.com/juspay/hyperswitch/commit/669485275db192b0e8e30f3528c0d61150d91847)) - -**Full Changelog:** [`2024.04.05.0...2024.04.08.0`](https://github.com/juspay/hyperswitch/compare/2024.04.05.0...2024.04.08.0) - -- - - - -## 2024.04.05.0 - -### Features - -- **payout-events:** Add kafka events for payout analytics ([#4211](https://github.com/juspay/hyperswitch/pull/4211)) ([`bc25f3f`](https://github.com/juspay/hyperswitch/commit/bc25f3fa40e807cc92d2d53a2287b92eff727d3c)) -- **router:** - - Store `network_reference_id` against the `payment_method_id` in the `payment_method_table` ([#4041](https://github.com/juspay/hyperswitch/pull/4041)) ([`21e2d78`](https://github.com/juspay/hyperswitch/commit/21e2d78117a9e25708b8c6a2280f6a836ee86072)) - - Use `NTID` in `MIT` payments if the `pg_agnostic_mit` config is enabled ([#4113](https://github.com/juspay/hyperswitch/pull/4113)) ([`b58d7a8`](https://github.com/juspay/hyperswitch/commit/b58d7a8e62eef9880f717731063101bf92af3f34)) - - Add NTID flow for cybersource ([#4193](https://github.com/juspay/hyperswitch/pull/4193)) ([`071462f`](https://github.com/juspay/hyperswitch/commit/071462f2af8efeb16e48d351bbae68fd2fd64179)) -- **webhooks:** Allow manually retrying delivery of outgoing webhooks ([#4176](https://github.com/juspay/hyperswitch/pull/4176)) ([`63d2b68`](https://github.com/juspay/hyperswitch/commit/63d2b6855acee1adeae2efff10f424e056af0bcb)) - -### Bug Fixes - -- **payouts:** Persist status updates in payouts table ([#4280](https://github.com/juspay/hyperswitch/pull/4280)) ([`02ffe7e`](https://github.com/juspay/hyperswitch/commit/02ffe7e48068a43d319d67e0e976420d201776db)) - -### Refactors - -- **connector:** - - [Multisafepay] handle authorize and psync 2xx failure error response ([#4124](https://github.com/juspay/hyperswitch/pull/4124)) ([`9ebe0f4`](https://github.com/juspay/hyperswitch/commit/9ebe0f4371f13c7527972242424af2d926c84b5e)) - - Add support for GooglePay recurring payments ([#4300](https://github.com/juspay/hyperswitch/pull/4300)) ([`622aac3`](https://github.com/juspay/hyperswitch/commit/622aac3015e95de55e83abd047b5c680ecd8d662)) -- **core:** Log the appropriate error message if the card fails to get saved in locker ([#4296](https://github.com/juspay/hyperswitch/pull/4296)) ([`9de3cdb`](https://github.com/juspay/hyperswitch/commit/9de3cdb7d37dd1d18c6a84368e70ceb52b7ae53a)) -- **payment_link:** Decouple shimmer css from main payment_link css for better performance ([#4286](https://github.com/juspay/hyperswitch/pull/4286)) ([`9453e8f`](https://github.com/juspay/hyperswitch/commit/9453e8fcfac49fc399343ee7c4c1598412b370c7)) - -**Full Changelog:** [`2024.04.04.0...2024.04.05.0`](https://github.com/juspay/hyperswitch/compare/2024.04.04.0...2024.04.05.0) - -- - - - -## 2024.04.04.0 - -### Features - -- **api:** Add browser information in payments response ([#3963](https://github.com/juspay/hyperswitch/pull/3963)) ([`4051cbb`](https://github.com/juspay/hyperswitch/commit/4051cbb4e7f708267b26439061e001bb00342cad)) -- **core:** Update connector_mandate_details in payment_method ([#4155](https://github.com/juspay/hyperswitch/pull/4155)) ([`d8028ce`](https://github.com/juspay/hyperswitch/commit/d8028cefd53219ce15ba31ff3ea5ada3c0e217e7)) -- **cypress:** Add cypress test cases ([#4271](https://github.com/juspay/hyperswitch/pull/4271)) ([`06e30e0`](https://github.com/juspay/hyperswitch/commit/06e30e04b06779862dd493ecaa7285875ffb402b)) -- **router:** Create a merchant config for enable processor agnostic MIT ([#4025](https://github.com/juspay/hyperswitch/pull/4025)) ([`2a691a5`](https://github.com/juspay/hyperswitch/commit/2a691a5c05573b0a9caa8b2d7e57bc90c49280fe)) - -### Refactors - -- **connector:** [Stripe] fix mandate flow ([#4281](https://github.com/juspay/hyperswitch/pull/4281)) ([`ea706f8`](https://github.com/juspay/hyperswitch/commit/ea706f81debd13a44a49ac3d1d3ef7f1882b683b)) -- **core:** Locker call made synchronous for updation of pm_id ([#4289](https://github.com/juspay/hyperswitch/pull/4289)) ([`6e94a56`](https://github.com/juspay/hyperswitch/commit/6e94a5636462a8071e69f072ec058c6068e5d1f7)) -- **mandates:** Add validations for recurring mandates using payment_method_id ([#4263](https://github.com/juspay/hyperswitch/pull/4263)) ([`49cfe72`](https://github.com/juspay/hyperswitch/commit/49cfe72cd2a20ba25c3323fca81bba7ea48b591b)) -- **payment_methods:** - - Add Wallets payment method data to new domain type to be used in connector module ([#4160](https://github.com/juspay/hyperswitch/pull/4160)) ([`8efd468`](https://github.com/juspay/hyperswitch/commit/8efd468ac150ff8d28f5b44b25701ba1837f243d)) - - Add `network_transaction_id` column in the `payment_methods` table ([#4005](https://github.com/juspay/hyperswitch/pull/4005)) ([`179f5ff`](https://github.com/juspay/hyperswitch/commit/179f5ff052aa530f2b429aaf20ea326bdc7f7ce0)) -- **payout:** Handle saving wallet in temp locker ([#4230](https://github.com/juspay/hyperswitch/pull/4230)) ([`ae37b05`](https://github.com/juspay/hyperswitch/commit/ae37b059e09d9e6b597914536359fbdd5dd777d2)) -- Fix typos ([#4277](https://github.com/juspay/hyperswitch/pull/4277)) ([`36f4112`](https://github.com/juspay/hyperswitch/commit/36f4112a6fa07c53a0b0c101539e4bf36d18893f)) -- Fix typos in stripe transformers ([#4287](https://github.com/juspay/hyperswitch/pull/4287)) ([`4445a86`](https://github.com/juspay/hyperswitch/commit/4445a86207a31fd84553c70959a1341143759bc3)) - -### Miscellaneous Tasks - -- **postman:** Update Postman collection files ([`70eb294`](https://github.com/juspay/hyperswitch/commit/70eb2940ecef503cbf9a898d0f8382f9abe83057)) - -**Full Changelog:** [`2024.04.03.0...2024.04.04.0`](https://github.com/juspay/hyperswitch/compare/2024.04.03.0...2024.04.04.0) - -- - - - -## 2024.04.03.0 - -### Features - -- **analytics:** Three_ds and authentication events in sdkevents ([#4251](https://github.com/juspay/hyperswitch/pull/4251)) ([`88b53b0`](https://github.com/juspay/hyperswitch/commit/88b53b0d5ccfb16b03fc17c453f2c7afa26ec92e)) -- **payment_link:** Add payment info metadata to payment link ([#4270](https://github.com/juspay/hyperswitch/pull/4270)) ([`97fbc89`](https://github.com/juspay/hyperswitch/commit/97fbc899c12a0c66ac89a7feaa6d45d39239a746)) -- **router:** [BOA] implement mandates for cards and wallets ([#4232](https://github.com/juspay/hyperswitch/pull/4232)) ([`2f304e6`](https://github.com/juspay/hyperswitch/commit/2f304e601607980e7e536d94411ddf0f9023c605)) - -### Bug Fixes - -- **connector:** [Cryptopay]fix redirection for cryptopay ([#4272](https://github.com/juspay/hyperswitch/pull/4272)) ([`1023f46`](https://github.com/juspay/hyperswitch/commit/1023f46c885dc2b70ccbb3931e667740695f448e)) - -### Refactors - -- **payment_methods:** Add a new domain type for payment method data to be used in connector module ([#4140](https://github.com/juspay/hyperswitch/pull/4140)) ([`9cce152`](https://github.com/juspay/hyperswitch/commit/9cce1520e3b0c7c1d1ae70ca8cc30787ff96dded)) -- **postman:** Paypal test cases for Capture ([#4265](https://github.com/juspay/hyperswitch/pull/4265)) ([`a071463`](https://github.com/juspay/hyperswitch/commit/a071463b29f9794e7069d57057d3bcc3a238f89b)) - -### Build System / Dependencies - -- **deps:** Update dependencies ([#4268](https://github.com/juspay/hyperswitch/pull/4268)) ([`1f0d60e`](https://github.com/juspay/hyperswitch/commit/1f0d60e64fc9379d8a07a0c72970afc7b491dafa)) - -**Full Changelog:** [`2024.04.02.0...2024.04.03.0`](https://github.com/juspay/hyperswitch/compare/2024.04.02.0...2024.04.03.0) - -- - - - -## 2024.04.02.0 - -### Features - -- **connector:** [billwerk] implement payment and refund flows ([#4245](https://github.com/juspay/hyperswitch/pull/4245)) ([`aecf4ae`](https://github.com/juspay/hyperswitch/commit/aecf4aeacce33c3dc03e089ef6d62af93e29ca9a)) -- Return customer details in payments response body ([#4237](https://github.com/juspay/hyperswitch/pull/4237)) ([`740749e`](https://github.com/juspay/hyperswitch/commit/740749e18ae4458726cdf2501f3d3b789c819f7a)) - -### Refactors - -- **core:** Removed the processing status for payment_method_status ([#4213](https://github.com/juspay/hyperswitch/pull/4213)) ([`a843713`](https://github.com/juspay/hyperswitch/commit/a843713126cea102064b342b6fc82429d89d758a)) - -### Documentation - -- **README:** Remove link to outdated early access form ([`78befb4`](https://github.com/juspay/hyperswitch/commit/78befb42a35b1f98b1bd47b253d3c06e50bb2ee4)) - -### Build System / Dependencies - -- **deps:** Bump `error-stack` from version `0.3.1` to `0.4.1` ([#4188](https://github.com/juspay/hyperswitch/pull/4188)) ([`ea730d4`](https://github.com/juspay/hyperswitch/commit/ea730d4ffc712cdf264492db109836fcde9b2b03)) - -**Full Changelog:** [`2024.04.01.0...2024.04.02.0`](https://github.com/juspay/hyperswitch/compare/2024.04.01.0...2024.04.02.0) - -- - - - ## 2024.04.01.0 ### Features diff --git a/Cargo.lock b/Cargo.lock index 898c28daa0d..c36eadd47ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,26 +4,26 @@ version = 3 [[package]] name = "actix-codec" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" +checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8" dependencies = [ - "bitflags 2.5.0", - "bytes 1.6.0", + "bitflags 1.3.2", + "bytes 1.5.0", "futures-core", "futures-sink", "memchr", "pin-project-lite", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-util", "tracing", ] [[package]] name = "actix-cors" -version = "0.6.5" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0346d8c1f762b41b458ed3145eea914966bb9ad20b9be0d6d463b20d45586370" +checksum = "b340e9cfa5b08690aae90fb61beb44e9b06f44fe3d0f93781aaa58cfba86245e" dependencies = [ "actix-utils", "actix-web", @@ -36,26 +36,26 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.6.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d223b13fd481fc0d1f83bb12659ae774d9e3601814c68a0bc539731698cca743" +checksum = "c2079246596c18b4a33e274ae10c0e50613f4d32a4198e09c7b93771013fed74" dependencies = [ "actix-codec", "actix-rt", "actix-service", "actix-utils", - "ahash 0.8.11", - "base64 0.21.7", - "bitflags 2.5.0", + "ahash 0.8.6", + "base64 0.21.5", + "bitflags 1.3.2", "brotli", - "bytes 1.6.0", + "bytes 1.5.0", "bytestring", "derive_more", "encoding_rs", "flate2", "futures-core", - "h2 0.3.26", - "http 0.2.12", + "h2 0.3.24", + "http 0.2.9", "httparse", "httpdate", "itoa", @@ -64,10 +64,10 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", - "rand", + "rand 0.8.5", "sha1", "smallvec 1.13.2", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-util", "tracing", "zstd", @@ -80,7 +80,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -92,7 +92,7 @@ dependencies = [ "actix-multipart-derive", "actix-utils", "actix-web", - "bytes 1.6.0", + "bytes 1.5.0", "derive_more", "futures-core", "futures-util", @@ -105,7 +105,7 @@ dependencies = [ "serde_json", "serde_plain", "tempfile", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] @@ -114,21 +114,21 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a0a77f836d869f700e5b47ac7c3c8b9c8bc82e4aec861954c6198abee3ebd4d" dependencies = [ - "darling 0.20.8", + "darling 0.20.3", "parse-size", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "actix-router" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" +checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" dependencies = [ "bytestring", - "http 0.2.12", + "http 0.2.9", "regex", "serde", "tracing", @@ -142,7 +142,7 @@ checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" dependencies = [ "actix-macros", "futures-core", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] @@ -156,9 +156,9 @@ dependencies = [ "actix-utils", "futures-core", "futures-util", - "mio 0.8.11", - "socket2", - "tokio 1.37.0", + "mio 0.8.10", + "socket2 0.5.5", + "tokio 1.36.0", "tracing", ] @@ -175,19 +175,20 @@ dependencies = [ [[package]] name = "actix-tls" -version = "3.3.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4cce60a2f2b477bc72e5cde0af1812a6e82d8fd85b5570a5dcf2a5bf2c5be5f" +checksum = "72616e7fbec0aa99c6f3164677fa48ff5a60036d0799c98cab894a44f3e0efc3" dependencies = [ "actix-rt", "actix-service", "actix-utils", "futures-core", - "http 0.2.12", - "http 1.1.0", + "http 0.2.9", "impl-more", "pin-project-lite", - "tokio 1.37.0", + "rustls 0.21.10", + "rustls-webpki", + "tokio 1.36.0", "tokio-rustls 0.23.4", "tokio-util", "tracing", @@ -206,9 +207,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.5.1" +version = "4.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a6556ddebb638c2358714d853257ed226ece6023ef9364f23f0c70737ea984" +checksum = "cd3cb42f9566ab176e1ef0b8b3a896529062b4efc6be0123046095914c4c1c96" dependencies = [ "actix-codec", "actix-http", @@ -219,8 +220,8 @@ dependencies = [ "actix-service", "actix-utils", "actix-web-codegen", - "ahash 0.8.11", - "bytes 1.6.0", + "ahash 0.7.7", + "bytes 1.5.0", "bytestring", "cfg-if 1.0.0", "cookie 0.16.2", @@ -228,6 +229,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", + "http 0.2.9", "itoa", "language-tags", "log", @@ -239,7 +241,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "smallvec 1.13.2", - "socket2", + "socket2 0.4.9", "time", "url", ] @@ -253,7 +255,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -271,25 +273,31 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + [[package]] name = "ahash" -version = "0.7.8" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ - "getrandom", + "getrandom 0.2.11", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if 1.0.0", - "getrandom", + "getrandom 0.2.11", "once_cell", "version_check", "zerocopy", @@ -297,9 +305,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -321,9 +329,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "analytics" @@ -332,7 +340,7 @@ dependencies = [ "actix-web", "api_models", "async-trait", - "aws-config 1.3.0", + "aws-config 1.1.8", "aws-sdk-lambda", "aws-smithy-types 1.1.8", "bigdecimal", @@ -340,22 +348,21 @@ dependencies = [ "diesel_models", "error-stack", "external_services", - "futures 0.3.30", - "hyperswitch_domain_models", + "futures 0.3.28", "hyperswitch_interfaces", "masking", "once_cell", "opensearch", - "reqwest 0.11.27", + "reqwest 0.12.2", "router_env", "serde", "serde_json", "sqlx", "storage_impl", - "strum 0.26.2", + "strum 0.25.0", "thiserror", "time", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] @@ -381,15 +388,15 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "api_models" @@ -405,11 +412,11 @@ dependencies = [ "frunk_core", "masking", "mime", - "reqwest 0.12.4", + "reqwest 0.12.2", "router_derive", "serde", "serde_json", - "strum 0.26.2", + "strum 0.25.0", "time", "url", "utoipa", @@ -417,15 +424,15 @@ dependencies = [ [[package]] name = "arc-swap" -version = "1.7.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" [[package]] name = "argon2" -version = "0.5.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072" +checksum = "17ba4cac0a46bc1d2912652a751c47f2a9f3a7fe89bcae2275d418f5270402f9" dependencies = [ "base64ct", "blake2", @@ -447,9 +454,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "asn1-rs" -version = "0.6.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ad1373757efa0f70ec53939aabc7152e1591cb485208052993070ac8d2429d" +checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" dependencies = [ "asn1-rs-derive", "asn1-rs-impl", @@ -463,25 +470,25 @@ dependencies = [ [[package]] name = "asn1-rs-derive" -version = "0.5.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", - "synstructure 0.13.1", + "syn 1.0.109", + "synstructure", ] [[package]] name = "asn1-rs-impl" -version = "0.2.0" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 1.0.109", ] [[package]] @@ -503,32 +510,41 @@ dependencies = [ "bb8", "diesel", "thiserror", - "tokio 1.37.0", + "tokio 1.36.0", "tracing", ] +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + [[package]] name = "async-compression" -version = "0.4.9" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9eabd7a98fe442131a17c316bd9349c43695e49e730c3c8e12cfb5f4da2693" +checksum = "bb42b2197bf15ccb092b62c74515dbd8b86d0effd934795f6687c93b6e679a2c" dependencies = [ "flate2", "futures-core", "memchr", "pin-project-lite", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] name = "async-lock" -version = "3.3.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ - "event-listener 4.0.3", - "event-listener-strategy", - "pin-project-lite", + "event-listener", ] [[package]] @@ -550,25 +566,25 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "atoi" -version = "2.0.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e" dependencies = [ "num-traits", ] @@ -581,15 +597,15 @@ checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "awc" -version = "3.4.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c09cc97310b926f01621faee652f3d1b0962545a3cec6c9ac07def9ea36c2c" +checksum = "87ef547a81796eb2dfe9b345aba34c2e08391a0502493711395b36dd64052b69" dependencies = [ "actix-codec", "actix-http", @@ -597,26 +613,27 @@ dependencies = [ "actix-service", "actix-tls", "actix-utils", - "base64 0.21.7", - "bytes 1.6.0", + "ahash 0.7.7", + "base64 0.21.5", + "bytes 1.5.0", "cfg-if 1.0.0", "cookie 0.16.2", "derive_more", "futures-core", "futures-util", - "h2 0.3.26", - "http 0.2.12", + "h2 0.3.24", + "http 0.2.9", "itoa", "log", "mime", "percent-encoding", "pin-project-lite", - "rand", + "rand 0.8.5", "rustls 0.20.9", "serde", "serde_json", "serde_urlencoded", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] @@ -636,14 +653,14 @@ dependencies = [ "aws-smithy-json 0.55.3", "aws-smithy-types 0.55.3", "aws-types 0.55.3", - "bytes 1.6.0", + "bytes 1.5.0", "fastrand 1.9.0", "hex", - "http 0.2.12", - "hyper 0.14.28", + "http 0.2.9", + "hyper 0.14.27", "ring 0.16.20", "time", - "tokio 1.37.0", + "tokio 1.36.0", "tower", "tracing", "zeroize", @@ -651,32 +668,31 @@ dependencies = [ [[package]] name = "aws-config" -version = "1.3.0" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baaa0be6ee7d90b775ae6ccb6d2ba182b91219ec2001f92338773a094246af1d" +checksum = "4f4084d18094aec9f79d509f4cb6ccf6b613c5037e32f32e74312e52b836e366" dependencies = [ - "aws-credential-types 1.2.0", + "aws-credential-types 1.1.8", "aws-runtime", - "aws-sdk-sso 1.22.0", + "aws-sdk-sso 1.17.0", "aws-sdk-ssooidc", - "aws-sdk-sts 1.22.0", - "aws-smithy-async 1.2.1", - "aws-smithy-http 0.60.8", + "aws-sdk-sts 1.17.0", + "aws-smithy-async 1.1.8", + "aws-smithy-http 0.60.7", "aws-smithy-json 0.60.7", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "aws-types 1.2.0", - "bytes 1.6.0", - "fastrand 2.1.0", + "aws-types 1.1.8", + "bytes 1.5.0", + "fastrand 2.0.1", "hex", - "http 0.2.12", - "hyper 0.14.28", + "http 0.2.9", + "hyper 0.14.27", "ring 0.17.8", "time", - "tokio 1.37.0", + "tokio 1.36.0", "tracing", - "url", "zeroize", ] @@ -689,18 +705,18 @@ dependencies = [ "aws-smithy-async 0.55.3", "aws-smithy-types 0.55.3", "fastrand 1.9.0", - "tokio 1.37.0", + "tokio 1.36.0", "tracing", "zeroize", ] [[package]] name = "aws-credential-types" -version = "1.2.0" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16838e6c9e12125face1c1eff1343c75e3ff540de98ff7ebd61874a89bcfeb9" +checksum = "fa8587ae17c8e967e4b05a62d495be2fb7701bec52a97f7acfe8a29f938384c8" dependencies = [ - "aws-smithy-async 1.2.1", + "aws-smithy-async 1.1.8", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", "zeroize", @@ -715,7 +731,7 @@ dependencies = [ "aws-smithy-http 0.55.3", "aws-smithy-types 0.55.3", "aws-types 0.55.3", - "http 0.2.12", + "http 0.2.9", "regex", "tracing", ] @@ -730,9 +746,9 @@ dependencies = [ "aws-smithy-http 0.55.3", "aws-smithy-types 0.55.3", "aws-types 0.55.3", - "bytes 1.6.0", - "http 0.2.12", - "http-body 0.4.6", + "bytes 1.5.0", + "http 0.2.9", + "http-body 0.4.5", "lazy_static", "percent-encoding", "pin-project-lite", @@ -741,22 +757,22 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.2.0" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4963ac9ff2d33a4231b3806c1c69f578f221a9cabb89ad2bde62ce2b442c8a7" +checksum = "b13dc54b4b49f8288532334bba8f87386a40571c47c37b1304979b556dc613c8" dependencies = [ - "aws-credential-types 1.2.0", - "aws-sigv4 1.2.1", - "aws-smithy-async 1.2.1", + "aws-credential-types 1.1.8", + "aws-sigv4 1.2.0", + "aws-smithy-async 1.1.8", "aws-smithy-eventstream 0.60.4", - "aws-smithy-http 0.60.8", + "aws-smithy-http 0.60.7", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "aws-types 1.2.0", - "bytes 1.6.0", - "fastrand 2.1.0", - "http 0.2.12", - "http-body 0.4.6", + "aws-types 1.1.8", + "bytes 1.5.0", + "fastrand 2.0.1", + "http 0.2.9", + "http-body 0.4.5", "percent-encoding", "pin-project-lite", "tracing", @@ -780,8 +796,8 @@ dependencies = [ "aws-smithy-json 0.55.3", "aws-smithy-types 0.55.3", "aws-types 0.55.3", - "bytes 1.6.0", - "http 0.2.12", + "bytes 1.5.0", + "http 0.2.9", "regex", "tokio-stream", "tower", @@ -790,22 +806,22 @@ dependencies = [ [[package]] name = "aws-sdk-lambda" -version = "1.23.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15be53d9a8408242d70b88ddd3d2c6e9d79ae01f390847b91f1d85fb77a6a05a" +checksum = "a2e4c45d7ce6e957489b9be24963c7fb04a6b0d2e8c7dfcbca032f9bf25b0d4d" dependencies = [ - "aws-credential-types 1.2.0", + "aws-credential-types 1.1.8", "aws-runtime", - "aws-smithy-async 1.2.1", + "aws-smithy-async 1.1.8", "aws-smithy-eventstream 0.60.4", - "aws-smithy-http 0.60.8", + "aws-smithy-http 0.60.7", "aws-smithy-json 0.60.7", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "aws-types 1.2.0", - "bytes 1.6.0", - "http 0.2.12", + "aws-types 1.1.8", + "bytes 1.5.0", + "http 0.2.9", "once_cell", "regex-lite", "tracing", @@ -832,9 +848,9 @@ dependencies = [ "aws-smithy-types 0.55.3", "aws-smithy-xml 0.55.3", "aws-types 0.55.3", - "bytes 1.6.0", - "http 0.2.12", - "http-body 0.4.6", + "bytes 1.5.0", + "http 0.2.9", + "http-body 0.4.5", "once_cell", "percent-encoding", "regex", @@ -861,8 +877,8 @@ dependencies = [ "aws-smithy-json 0.55.3", "aws-smithy-types 0.55.3", "aws-types 0.55.3", - "bytes 1.6.0", - "http 0.2.12", + "bytes 1.5.0", + "http 0.2.9", "regex", "tokio-stream", "tower", @@ -886,8 +902,8 @@ dependencies = [ "aws-smithy-json 0.55.3", "aws-smithy-types 0.55.3", "aws-types 0.55.3", - "bytes 1.6.0", - "http 0.2.12", + "bytes 1.5.0", + "http 0.2.9", "regex", "tokio-stream", "tower", @@ -896,21 +912,21 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "1.22.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3d6c4cba4e009391b72b0fcf12aff04ea3c9c3aa2ecaafa330326a8bd7e601" +checksum = "c5cc34f5925899739a3f125bd3f7d37d081234a3df218feb9c9d337fd4c70e72" dependencies = [ - "aws-credential-types 1.2.0", + "aws-credential-types 1.1.8", "aws-runtime", - "aws-smithy-async 1.2.1", - "aws-smithy-http 0.60.8", + "aws-smithy-async 1.1.8", + "aws-smithy-http 0.60.7", "aws-smithy-json 0.60.7", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "aws-types 1.2.0", - "bytes 1.6.0", - "http 0.2.12", + "aws-types 1.1.8", + "bytes 1.5.0", + "http 0.2.9", "once_cell", "regex-lite", "tracing", @@ -918,21 +934,21 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.22.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73400dc239d14f63d932f4ca7b55af5e9ef1f857f7d70655249ccc287adb2570" +checksum = "7327cddd32b1a6f2aaeaadb1336b671a7975e96a999d3b1bcf5aa47932dc6ddb" dependencies = [ - "aws-credential-types 1.2.0", + "aws-credential-types 1.1.8", "aws-runtime", - "aws-smithy-async 1.2.1", - "aws-smithy-http 0.60.8", + "aws-smithy-async 1.1.8", + "aws-smithy-http 0.60.7", "aws-smithy-json 0.60.7", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "aws-types 1.2.0", - "bytes 1.6.0", - "http 0.2.12", + "aws-types 1.1.8", + "bytes 1.5.0", + "http 0.2.9", "once_cell", "regex-lite", "tracing", @@ -957,8 +973,8 @@ dependencies = [ "aws-smithy-types 0.55.3", "aws-smithy-xml 0.55.3", "aws-types 0.55.3", - "bytes 1.6.0", - "http 0.2.12", + "bytes 1.5.0", + "http 0.2.9", "regex", "tower", "tracing", @@ -966,22 +982,22 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.22.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f8858308af76fba3e5ffcf1bb56af5471574d2bdfaf0159470c25bc2f760e5" +checksum = "6c11981cdb80e8e205e22beb6630a8bdec380a1256bd29efaab34aaebd07cfb9" dependencies = [ - "aws-credential-types 1.2.0", + "aws-credential-types 1.1.8", "aws-runtime", - "aws-smithy-async 1.2.1", - "aws-smithy-http 0.60.8", + "aws-smithy-async 1.1.8", + "aws-smithy-http 0.60.7", "aws-smithy-json 0.60.7", "aws-smithy-query 0.60.7", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "aws-smithy-xml 0.60.8", - "aws-types 1.2.0", - "http 0.2.12", + "aws-smithy-xml 0.60.7", + "aws-types 1.1.8", + "http 0.2.9", "once_cell", "regex-lite", "tracing", @@ -998,7 +1014,7 @@ dependencies = [ "aws-smithy-eventstream 0.55.3", "aws-smithy-http 0.55.3", "aws-types 0.55.3", - "http 0.2.12", + "http 0.2.9", "tracing", ] @@ -1010,11 +1026,11 @@ checksum = "9d2ce6f507be68e968a33485ced670111d1cbad161ddbbab1e313c03d37d8f4c" dependencies = [ "aws-smithy-eventstream 0.55.3", "aws-smithy-http 0.55.3", - "bytes 1.6.0", + "bytes 1.5.0", "form_urlencoded", "hex", "hmac", - "http 0.2.12", + "http 0.2.9", "once_cell", "percent-encoding", "regex", @@ -1025,20 +1041,20 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "1.2.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58b56f1cbe6fd4d0c2573df72868f20ab1c125ca9c9dbce17927a463433a2e57" +checksum = "11d6f29688a4be9895c0ba8bef861ad0c0dac5c15e9618b9b7a6c233990fc263" dependencies = [ - "aws-credential-types 1.2.0", + "aws-credential-types 1.1.8", "aws-smithy-eventstream 0.60.4", - "aws-smithy-http 0.60.8", + "aws-smithy-http 0.60.7", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "bytes 1.6.0", + "bytes 1.5.0", "form_urlencoded", "hex", "hmac", - "http 0.2.12", + "http 0.2.9", "http 1.1.0", "once_cell", "percent-encoding", @@ -1055,19 +1071,19 @@ checksum = "13bda3996044c202d75b91afeb11a9afae9db9a721c6a7a427410018e286b880" dependencies = [ "futures-util", "pin-project-lite", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-stream", ] [[package]] name = "aws-smithy-async" -version = "1.2.1" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62220bc6e97f946ddd51b5f1361f78996e704677afc518a4ff66b7a72ea1378c" +checksum = "d26ea8fa03025b2face2b3038a63525a10891e3d8829901d502e5384a0d8cd46" dependencies = [ "futures-util", "pin-project-lite", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] @@ -1078,12 +1094,12 @@ checksum = "07ed8b96d95402f3f6b8b57eb4e0e45ee365f78b1a924faf20ff6e97abf1eae6" dependencies = [ "aws-smithy-http 0.55.3", "aws-smithy-types 0.55.3", - "bytes 1.6.0", + "bytes 1.5.0", "crc32c", "crc32fast", "hex", - "http 0.2.12", - "http-body 0.4.6", + "http 0.2.9", + "http-body 0.4.5", "md-5", "pin-project-lite", "sha1", @@ -1101,16 +1117,16 @@ dependencies = [ "aws-smithy-http 0.55.3", "aws-smithy-http-tower", "aws-smithy-types 0.55.3", - "bytes 1.6.0", + "bytes 1.5.0", "fastrand 1.9.0", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-rustls 0.23.2", "lazy_static", "pin-project-lite", "rustls 0.20.9", - "tokio 1.37.0", + "tokio 1.36.0", "tower", "tracing", ] @@ -1122,7 +1138,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460c8da5110835e3d9a717c61f5556b20d03c32a1dec57f8fc559b360f733bb8" dependencies = [ "aws-smithy-types 0.55.3", - "bytes 1.6.0", + "bytes 1.5.0", "crc32fast", ] @@ -1133,7 +1149,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6363078f927f612b970edf9d1903ef5cef9a64d1e8423525ebb1f0a1633c858" dependencies = [ "aws-smithy-types 1.1.8", - "bytes 1.6.0", + "bytes 1.5.0", "crc32fast", ] @@ -1145,35 +1161,35 @@ checksum = "2b3b693869133551f135e1f2c77cb0b8277d9e3e17feaf2213f735857c4f0d28" dependencies = [ "aws-smithy-eventstream 0.55.3", "aws-smithy-types 0.55.3", - "bytes 1.6.0", + "bytes 1.5.0", "bytes-utils", "futures-core", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.27", "once_cell", "percent-encoding", "pin-project-lite", "pin-utils", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-util", "tracing", ] [[package]] name = "aws-smithy-http" -version = "0.60.8" +version = "0.60.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a7de001a1b9a25601016d8057ea16e31a45fdca3751304c8edf4ad72e706c08" +checksum = "3f10fa66956f01540051b0aa7ad54574640f748f9839e843442d99b970d3aff9" dependencies = [ "aws-smithy-eventstream 0.60.4", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "bytes 1.6.0", + "bytes 1.5.0", "bytes-utils", "futures-core", - "http 0.2.12", - "http-body 0.4.6", + "http 0.2.9", + "http-body 0.4.5", "once_cell", "percent-encoding", "pin-project-lite", @@ -1189,9 +1205,9 @@ checksum = "3ae4f6c5798a247fac98a867698197d9ac22643596dc3777f0c76b91917616b9" dependencies = [ "aws-smithy-http 0.55.3", "aws-smithy-types 0.55.3", - "bytes 1.6.0", - "http 0.2.12", - "http-body 0.4.6", + "bytes 1.5.0", + "http 0.2.9", + "http-body 0.4.5", "pin-project-lite", "tower", "tracing", @@ -1237,43 +1253,42 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.4.0" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cf64e73ef8d4dac6c933230d56d136b75b252edcf82ed36e37d603090cd7348" +checksum = "ec81002d883e5a7fd2bb063d6fb51c4999eb55d404f4fff3dd878bf4733b9f01" dependencies = [ - "aws-smithy-async 1.2.1", - "aws-smithy-http 0.60.8", + "aws-smithy-async 1.1.8", + "aws-smithy-http 0.60.7", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "bytes 1.6.0", - "fastrand 2.1.0", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "http-body 1.0.0", - "hyper 0.14.28", + "bytes 1.5.0", + "fastrand 2.0.1", + "h2 0.3.24", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-rustls 0.24.2", "once_cell", "pin-project-lite", "pin-utils", - "rustls 0.21.12", - "tokio 1.37.0", + "rustls 0.21.10", + "tokio 1.36.0", "tracing", ] [[package]] name = "aws-smithy-runtime-api" -version = "1.5.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c19fdae6e3d5ac9cd01f2d6e6c359c5f5a3e028c2d148a8f5b90bf3399a18a7" +checksum = "9acb931e0adaf5132de878f1398d83f8677f90ba70f01f65ff87f6d7244be1c5" dependencies = [ - "aws-smithy-async 1.2.1", + "aws-smithy-async 1.1.8", "aws-smithy-types 1.1.8", - "bytes 1.6.0", - "http 0.2.12", + "bytes 1.5.0", + "http 0.2.9", "http 1.1.0", "pin-project-lite", - "tokio 1.37.0", + "tokio 1.36.0", "tracing", "zeroize", ] @@ -1298,14 +1313,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abe14dceea1e70101d38fbf2a99e6a34159477c0fb95e68e05c66bd7ae4c3729" dependencies = [ "base64-simd", - "bytes 1.6.0", + "bytes 1.5.0", "bytes-utils", "futures-core", - "http 0.2.12", - "http 1.1.0", - "http-body 0.4.6", - "http-body 1.0.0", - "http-body-util", + "http 0.2.9", + "http-body 0.4.5", "itoa", "num-integer", "pin-project-lite", @@ -1313,7 +1325,7 @@ dependencies = [ "ryu", "serde", "time", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-util", ] @@ -1328,9 +1340,9 @@ dependencies = [ [[package]] name = "aws-smithy-xml" -version = "0.60.8" +version = "0.60.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d123fbc2a4adc3c301652ba8e149bf4bc1d1725affb9784eb20c953ace06bf55" +checksum = "872c68cf019c0e4afc5de7753c4f7288ce4b71663212771bf5e4542eb9346ca9" dependencies = [ "xmlparser", ] @@ -1346,22 +1358,22 @@ dependencies = [ "aws-smithy-client", "aws-smithy-http 0.55.3", "aws-smithy-types 0.55.3", - "http 0.2.12", + "http 0.2.9", "rustc_version 0.4.0", "tracing", ] [[package]] name = "aws-types" -version = "1.2.0" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a43b56df2c529fe44cb4d92bd64d0479883fb9608ff62daede4df5405381814" +checksum = "0dbf2f3da841a8930f159163175cf6a3d16ddde517c1b0fba7aa776822800f40" dependencies = [ - "aws-credential-types 1.2.0", - "aws-smithy-async 1.2.1", + "aws-credential-types 1.1.8", + "aws-smithy-async 1.1.8", "aws-smithy-runtime-api", "aws-smithy-types 1.1.8", - "http 0.2.12", + "http 0.2.9", "rustc_version 0.4.0", "tracing", ] @@ -1375,11 +1387,11 @@ dependencies = [ "async-trait", "axum-core", "bitflags 1.3.2", - "bytes 1.6.0", + "bytes 1.5.0", "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.27", "itoa", "matchit", "memchr", @@ -1401,10 +1413,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" dependencies = [ "async-trait", - "bytes 1.6.0", + "bytes 1.5.0", "futures-util", - "http 0.2.12", - "http-body 0.4.6", + "http 0.2.9", + "http-body 0.4.5", "mime", "rustversion", "tower-layer", @@ -1413,15 +1425,15 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", "cfg-if 1.0.0", "libc", - "miniz_oxide", + "miniz_oxide 0.7.1", "object", "rustc-demangle", ] @@ -1434,15 +1446,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "base64" -version = "0.22.1" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64-simd" @@ -1462,15 +1468,15 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bb8" -version = "0.8.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7c2093d15d6a1d33b1f972e1c5ea3177748742b97a5f392aa83a65262c6780" +checksum = "98b4b0f25f18bcdc3ac72bdb486ed0acf7e185221fd4dc985bc15db5800b0ba2" dependencies = [ "async-trait", "futures-channel", "futures-util", - "parking_lot 0.12.2", - "tokio 1.37.0", + "parking_lot 0.12.1", + "tokio 1.36.0", ] [[package]] @@ -1517,12 +1523,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" -dependencies = [ - "serde", -] +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bitvec" @@ -1542,20 +1545,30 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] name = "blake3" -version = "1.5.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if 1.0.0", "constant_time_eq", + "digest 0.10.7", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", ] [[package]] @@ -1569,9 +1582,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe5b10e214954177fb1dc9fbd20a1a2608fe99e6c832033bdc7cea287a20d77" +checksum = "bf617fabf5cdbdc92f774bfe5062d870f228b80056d41180797abf48bed4056e" dependencies = [ "borsh-derive", "cfg_aliases", @@ -1579,23 +1592,23 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a8646f94ab393e43e8b35a2558b1624bed28b97ee09c5d15456e3c9463f46d" +checksum = "f404657a7ea7b5249e36808dff544bc88a28f26e0ac40009f674b7a009d14be3" dependencies = [ "once_cell", - "proc-macro-crate 3.1.0", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", "syn_derive", ] [[package]] name = "brotli" -version = "3.5.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" +checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -1604,9 +1617,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.5.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +checksum = "da74e2b81409b1b743f8f0c62cc6254afefb8b8e50bbfe3735550f7aeefa3448" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -1614,9 +1627,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.9.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", "serde", @@ -1624,15 +1637,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytecheck" -version = "0.6.12" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -1641,20 +1654,26 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.12" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "bytecount" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad152d03a2c813c80bb94fedbf3a3f02b28f793e39e7c214c8a0bcc196343de7" + [[package]] name = "bytemuck" -version = "1.15.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" @@ -1674,27 +1693,27 @@ dependencies = [ [[package]] name = "bytes" -version = "1.6.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "bytes-utils" -version = "0.1.4" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dafe3a8757b027e2be6e4e5601ed563c55989fcf1546e933c66c8eb3a058d35" +checksum = "e47d3a8076e283f3acd27400535992edb3ba4b5bb72f8891ad8fbe7932a7d4b9" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "either", ] [[package]] name = "bytestring" -version = "1.3.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d80203ea6b29df88012294f62733de21cfeab47f17b41af3a38bc30a03ee72" +checksum = "238e4886760d98c4f899360c834fa93e62cf7f721ac3c2da375cbdf4b8679aae" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", ] [[package]] @@ -1723,11 +1742,24 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.8" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.22", "serde", + "serde_json", ] [[package]] @@ -1752,13 +1784,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.96" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", "libc", - "once_cell", ] [[package]] @@ -1790,11 +1821,17 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "checked_int_cast" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17cc5e6b5ab06331c33589842070416baa137e8b0eb912b008cfd4a78ada7919" + [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1802,14 +1839,14 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.5", + "windows-targets 0.48.5", ] [[package]] name = "chrono-tz" -version = "0.8.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59ae0466b83e838b81a54256c39d5d7c20b9d7daa10510a242d9b75abd5936e" +checksum = "f1369bc6b9e9a7dfdae2055f6ec151fe9c554a9d23d357c0237cee2e25eaabb7" dependencies = [ "chrono", "chrono-tz-build", @@ -1818,9 +1855,9 @@ dependencies = [ [[package]] name = "chrono-tz-build" -version = "0.2.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f" +checksum = "e2f5ebdc942f57ed96d560a6d1a459bae5851102a25d5bf89dc04ae453e31ecf" dependencies = [ "parse-zoneinfo", "phf", @@ -1829,9 +1866,9 @@ dependencies = [ [[package]] name = "ciborium" -version = "0.2.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" dependencies = [ "ciborium-io", "ciborium-ll", @@ -1840,15 +1877,15 @@ dependencies = [ [[package]] name = "ciborium-io" -version = "0.2.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" +checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" [[package]] name = "ciborium-ll" -version = "0.2.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" dependencies = [ "ciborium-io", "half", @@ -1856,41 +1893,43 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "401a4694d2bf92537b6867d94de48c4842089645fdcdf6c71865b175d836e9c2" dependencies = [ "clap_builder", "clap_derive", + "once_cell", ] [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980" dependencies = [ "anstyle", + "bitflags 1.3.2", "clap_lex", ] [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "cloudabi" @@ -1901,6 +1940,12 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "common_enums" version = "0.1.0" @@ -1909,7 +1954,7 @@ dependencies = [ "router_derive", "serde", "serde_json", - "strum 0.26.2", + "strum 0.25.0", "utoipa", ] @@ -1918,25 +1963,25 @@ name = "common_utils" version = "0.1.0" dependencies = [ "async-trait", - "bytes 1.6.0", + "bytes 1.5.0", "common_enums", "diesel", "error-stack", "fake", - "futures 0.3.30", + "futures 0.3.28", "hex", - "http 0.2.12", + "http 0.2.9", "masking", "md5", "nanoid", "once_cell", "phonenumber", "proptest", - "quick-xml", - "rand", + "quick-xml 0.28.2", + "rand 0.8.5", "regex", - "reqwest 0.12.4", - "ring 0.17.8", + "reqwest 0.12.2", + "ring 0.16.20", "router_env", "rustc-hash", "semver 1.0.22", @@ -1945,31 +1990,30 @@ dependencies = [ "serde_urlencoded", "signal-hook", "signal-hook-tokio", - "strum 0.26.2", + "strum 0.24.1", "test-case", "thiserror", "time", - "tokio 1.37.0", + "tokio 1.36.0", "uuid", ] [[package]] name = "concurrent-queue" -version = "2.5.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" dependencies = [ - "crossbeam-utils 0.8.19", + "crossbeam-utils 0.8.16", ] [[package]] name = "config" -version = "0.14.0" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7328b20597b53c2454f0b1919720c25c7339051c02b72b7e05409e00b14132be" +checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" dependencies = [ "async-trait", - "convert_case 0.6.0", "json5", "lazy_static", "nom", @@ -1978,7 +2022,7 @@ dependencies = [ "rust-ini", "serde", "serde_json", - "toml", + "toml 0.5.11", "yaml-rust", ] @@ -1988,10 +2032,10 @@ version = "0.1.0" dependencies = [ "anyhow", "clap", - "indexmap 2.2.6", + "indexmap 2.1.0", "serde", "serde_json", - "toml", + "toml 0.7.4", ] [[package]] @@ -2001,41 +2045,15 @@ dependencies = [ "api_models", "serde", "serde_with", - "toml", + "toml 0.7.4", "utoipa", ] -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "const-random" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" -dependencies = [ - "const-random-macro", -] - -[[package]] -name = "const-random-macro" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" -dependencies = [ - "getrandom", - "once_cell", - "tiny-keccak", -] - [[package]] name = "constant_time_eq" -version = "0.3.0" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" [[package]] name = "convert_case" @@ -2043,15 +2061,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "cookie" version = "0.16.2" @@ -2065,9 +2074,9 @@ dependencies = [ [[package]] name = "cookie" -version = "0.18.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" dependencies = [ "time", "version_check", @@ -2075,18 +2084,15 @@ dependencies = [ [[package]] name = "cookie-factory" -version = "0.3.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2" -dependencies = [ - "futures 0.3.30", -] +checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b" [[package]] name = "core-foundation" -version = "0.9.4" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", @@ -2094,24 +2100,24 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] [[package]] name = "crc" -version = "3.2.1" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" dependencies = [ "crc-catalog", ] @@ -2130,18 +2136,18 @@ checksum = "338089f42c427b86394a5ee60ff321da23a5c89c9d89514c829687b26359fcff" [[package]] name = "crc32c" -version = "0.6.5" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89254598aa9b9fa608de44b3ae54c810f0f06d755e24c50177f1f8f31ff50ce2" +checksum = "d8f48d60e5b4d2c53d5c2b1d8a58c849a70ae5e5509b08a48d047e3b65714a74" dependencies = [ "rustc_version 0.4.0", ] [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if 1.0.0", ] @@ -2184,11 +2190,12 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ - "crossbeam-utils 0.8.19", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.16", ] [[package]] @@ -2204,12 +2211,13 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ - "crossbeam-epoch 0.9.18", - "crossbeam-utils 0.8.19", + "cfg-if 1.0.0", + "crossbeam-epoch 0.9.15", + "crossbeam-utils 0.8.16", ] [[package]] @@ -2223,17 +2231,21 @@ dependencies = [ "crossbeam-utils 0.7.2", "lazy_static", "maybe-uninit", - "memoffset", + "memoffset 0.5.6", "scopeguard", ] [[package]] name = "crossbeam-epoch" -version = "0.9.18" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ - "crossbeam-utils 0.8.19", + "autocfg", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.16", + "memoffset 0.9.0", + "scopeguard", ] [[package]] @@ -2249,11 +2261,12 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.11" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ - "crossbeam-utils 0.8.19", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.16", ] [[package]] @@ -2269,15 +2282,12 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" - -[[package]] -name = "crunchy" -version = "0.2.2" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if 1.0.0", +] [[package]] name = "crypto-common" @@ -2312,12 +2322,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.8" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ - "darling_core 0.20.8", - "darling_macro 0.20.8", + "darling_core 0.20.3", + "darling_macro 0.20.3", ] [[package]] @@ -2336,16 +2346,16 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -2361,13 +2371,13 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ - "darling_core 0.20.8", + "darling_core 0.20.3", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -2377,28 +2387,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if 1.0.0", - "hashbrown 0.14.5", - "lock_api 0.4.12", + "hashbrown 0.14.3", + "lock_api 0.4.10", "once_cell", - "parking_lot_core 0.9.10", + "parking_lot_core 0.9.8", ] [[package]] name = "data-encoding" -version = "2.6.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + +[[package]] +name = "data_models" +version = "0.1.0" +dependencies = [ + "api_models", + "async-trait", + "common_enums", + "common_utils", + "diesel_models", + "error-stack", + "masking", + "serde", + "serde_json", + "thiserror", + "time", +] [[package]] name = "deadpool" -version = "0.10.0" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" +checksum = "421fe0f90f2ab22016f32a9881be5134fdd71c65298917084b0c7477cbc3856e" dependencies = [ "async-trait", "deadpool-runtime", "num_cpus", - "tokio 1.37.0", + "retain_mut", + "tokio 1.36.0", ] [[package]] @@ -2408,21 +2436,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63dfa964fe2a66f3fde91fc70b267fe193d822c7e603e2a675a49a7f46ad3f49" [[package]] -name = "der" -version = "0.7.9" +name = "deflate" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" dependencies = [ - "const-oid", - "pem-rfc7468", - "zeroize", + "adler32", + "byteorder", ] [[package]] name = "der-parser" -version = "9.0.0" +version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" +checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" dependencies = [ "asn1-rs", "displaydoc", @@ -2432,16 +2459,6 @@ dependencies = [ "rusticata-macros", ] -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", - "serde", -] - [[package]] name = "derive_builder" version = "0.12.0" @@ -2490,7 +2507,7 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case 0.4.0", + "convert_case", "proc-macro2", "quote", "rustc_version 0.4.0", @@ -2499,17 +2516,17 @@ dependencies = [ [[package]] name = "deunicode" -version = "1.4.4" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322ef0094744e63628e6f0eb2295517f79276a5b342a4c2ff3042566ca181d4e" +checksum = "d95203a6a50906215a502507c0f879a0ce7ff205a6111e2db2a5ef8e4bb92e43" [[package]] name = "diesel" -version = "2.1.6" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff236accb9a5069572099f0b350a92e9560e8e63a9b8d546162f4a5e03026bb2" +checksum = "2268a214a6f118fce1838edba3d1561cf0e78d8de785475957a580a7f8c69d33" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.4.0", "byteorder", "diesel_derives", "itoa", @@ -2521,14 +2538,14 @@ dependencies = [ [[package]] name = "diesel_derives" -version = "2.1.4" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14701062d6bed917b5c7103bdffaee1e4609279e240488ad24e7bd979ca6866c" +checksum = "ef8337737574f55a468005a83499da720f20c65586241ffea339db9ecdfd2b44" dependencies = [ "diesel_table_macro_syntax", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -2547,7 +2564,7 @@ dependencies = [ "router_env", "serde", "serde_json", - "strum 0.26.2", + "strum 0.24.1", "thiserror", "time", ] @@ -2558,7 +2575,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" dependencies = [ - "syn 2.0.60", + "syn 2.0.55", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", ] [[package]] @@ -2567,8 +2593,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", - "const-oid", + "block-buffer 0.10.4", "crypto-common", "subtle", ] @@ -2580,24 +2605,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af83450b771231745d43edf36dc9b7813ab83be5e8cbea344ccced1a09dfebcd" [[package]] -name = "displaydoc" -version = "0.2.4" +name = "dirs" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi 0.3.9", +] + +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "dlv-list" -version = "0.5.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "442039f5147480ba31067cb00ada1adae6892028e40e45fc5de7b7df6dcc1b5f" -dependencies = [ - "const-random", -] +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" [[package]] name = "dotenvy" @@ -2625,35 +2667,32 @@ dependencies = [ "mime", "once_cell", "redis_interface", - "reqwest 0.12.4", + "reqwest 0.12.2", "router_env", "serde", "serde_json", "serde_path_to_error", "thiserror", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] name = "dyn-clone" -version = "1.0.17" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" [[package]] name = "either" -version = "1.11.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" -dependencies = [ - "serde", -] +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if 1.0.0", ] @@ -2666,9 +2705,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.4.4" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b73807008a3c7f171cc40312f37d95ef0396e048b5848d775f54b1a4dd4a0d3" +checksum = "6c138974f9d5e7fe373eb04df7cae98833802ae4b11c24ac7039a21d5af4b26c" dependencies = [ "serde", ] @@ -2683,6 +2722,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "version_check", +] + [[package]] name = "error-stack" version = "0.4.1" @@ -2694,17 +2742,6 @@ dependencies = [ "serde", ] -[[package]] -name = "etcetera" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" -dependencies = [ - "cfg-if 1.0.0", - "home", - "windows-sys 0.48.0", -] - [[package]] name = "euclid" version = "0.1.0" @@ -2720,7 +2757,7 @@ dependencies = [ "rustc-hash", "serde", "serde_json", - "strum 0.26.2", + "strum 0.25.0", "thiserror", "utoipa", ] @@ -2732,8 +2769,8 @@ dependencies = [ "proc-macro2", "quote", "rustc-hash", - "strum 0.26.2", - "syn 2.0.60", + "strum 0.24.1", + "syn 1.0.109", ] [[package]] @@ -2745,13 +2782,13 @@ dependencies = [ "connector_configs", "currency_conversion", "euclid", - "getrandom", + "getrandom 0.2.11", "kgraph_utils", "once_cell", "ron-parser", "serde", - "serde-wasm-bindgen 0.6.5", - "strum 0.26.2", + "serde-wasm-bindgen", + "strum 0.25.0", "wasm-bindgen", ] @@ -2761,51 +2798,6 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" -[[package]] -name = "event-listener" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9944b8ca13534cdfb2800775f8dd4902ff3fc75a50101466decadfdf322a24" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" -dependencies = [ - "event-listener 4.0.3", - "pin-project-lite", -] - -[[package]] -name = "events" -version = "0.1.0" -dependencies = [ - "error-stack", - "masking", - "router_env", - "serde", - "serde_json", - "thiserror", - "time", -] - [[package]] name = "external_services" version = "0.1.0" @@ -2817,12 +2809,12 @@ dependencies = [ "aws-sdk-sesv2", "aws-sdk-sts 0.28.0", "aws-smithy-client", - "base64 0.22.1", + "base64 0.21.5", "common_utils", "dyn-clone", "error-stack", "hex", - "hyper 0.14.28", + "hyper 0.14.27", "hyper-proxy", "hyperswitch_interfaces", "masking", @@ -2830,18 +2822,18 @@ dependencies = [ "router_env", "serde", "thiserror", - "tokio 1.37.0", + "tokio 1.36.0", "vaultrs", ] [[package]] name = "fake" -version = "2.9.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c25829bde82205da46e1823b2259db6273379f626fc211f126f65654a2669be" +checksum = "9af7b0c58ac9d03169e27f080616ce9f64004edca3d2ef4147a811c21b23b319" dependencies = [ - "deunicode", - "rand", + "rand 0.8.5", + "unidecode", ] [[package]] @@ -2854,14 +2846,14 @@ dependencies = [ "cookie 0.16.2", "futures-core", "futures-util", - "http 0.2.12", - "hyper 0.14.28", + "http 0.2.9", + "hyper 0.14.27", "hyper-rustls 0.23.2", "mime", "serde", "serde_json", "time", - "tokio 1.37.0", + "tokio 1.36.0", "url", "webdriver", ] @@ -2877,18 +2869,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" - -[[package]] -name = "fdeflate" -version = "0.3.4" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" -dependencies = [ - "simd-adler32", -] +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "finl_unicode" @@ -2898,12 +2881,12 @@ checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.7.1", ] [[package]] @@ -2915,17 +2898,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "flume" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" -dependencies = [ - "futures-core", - "futures-sink", - "spin 0.9.8", -] - [[package]] name = "fnv" version = "1.0.7" @@ -2949,9 +2921,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -2964,18 +2936,18 @@ checksum = "b99c2b48934cd02a81032dd7428b7ae831a27794275bc94eba367418db8a9e55" dependencies = [ "arc-swap", "async-trait", - "bytes 1.6.0", + "bytes 1.5.0", "bytes-utils", "float-cmp", - "futures 0.3.30", + "futures 0.3.28", "lazy_static", "log", - "parking_lot 0.12.2", - "rand", + "parking_lot 0.12.1", + "rand 0.8.5", "redis-protocol", "semver 1.0.22", - "socket2", - "tokio 1.37.0", + "socket2 0.5.5", + "tokio 1.36.0", "tokio-stream", "tokio-util", "tracing", @@ -3009,7 +2981,7 @@ checksum = "b0fa992f1656e1707946bbba340ad244f0814009ef8c0118eb7b658395f19a2e" dependencies = [ "frunk_proc_macro_helpers", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -3021,7 +2993,7 @@ dependencies = [ "frunk_core", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -3033,7 +3005,7 @@ dependencies = [ "frunk_core", "frunk_proc_macro_helpers", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -3066,9 +3038,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ "futures-channel", "futures-core", @@ -3097,9 +3069,9 @@ checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -3108,13 +3080,13 @@ dependencies = [ [[package]] name = "futures-intrusive" -version = "0.5.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" dependencies = [ "futures-core", - "lock_api 0.4.12", - "parking_lot 0.12.2", + "lock_api 0.4.10", + "parking_lot 0.11.2", ] [[package]] @@ -3123,6 +3095,21 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -3131,7 +3118,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -3146,6 +3133,12 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" + [[package]] name = "futures-util" version = "0.3.30" @@ -3186,47 +3179,74 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if 1.0.0", "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] +[[package]] +name = "gif" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" +dependencies = [ + "color_quant", + "weezl", +] + [[package]] name = "gimli" -version = "0.28.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "git2" -version = "0.18.3" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70" +checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044" dependencies = [ - "bitflags 2.5.0", + "bitflags 1.3.2", "libc", "libgit2-sys", "log", "url", ] +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "globset" -version = "0.4.14" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" dependencies = [ "aho-corasick", "bstr", + "fnv", "log", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex", ] [[package]] @@ -3242,51 +3262,47 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.26" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.12", - "indexmap 2.2.6", + "http 0.2.9", + "indexmap 2.1.0", "slab", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-util", "tracing", ] [[package]] name = "h2" -version = "0.4.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "fnv", "futures-core", "futures-sink", "futures-util", "http 1.1.0", - "indexmap 2.2.6", + "indexmap 2.1.0", "slab", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-util", "tracing", ] [[package]] name = "half" -version = "2.4.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" -dependencies = [ - "cfg-if 1.0.0", - "crunchy", -] +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" @@ -3294,22 +3310,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.8", + "ahash 0.7.7", ] [[package]] name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" - -[[package]] -name = "hashbrown" -version = "0.14.5" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.11", + "ahash 0.8.6", "allocator-api2", ] @@ -3319,7 +3329,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.14.3", ] [[package]] @@ -3328,10 +3338,10 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.21.7", - "bytes 1.6.0", + "base64 0.21.5", + "bytes 1.5.0", "headers-core", - "http 0.2.12", + "http 0.2.9", "httpdate", "mime", "sha1", @@ -3343,7 +3353,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "http 0.2.12", + "http 0.2.9", ] [[package]] @@ -3355,17 +3365,11 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - [[package]] name = "hermit-abi" -version = "0.3.9" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -3375,9 +3379,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hkdf" -version = "0.12.4" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" dependencies = [ "hmac", ] @@ -3388,25 +3392,16 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", -] - -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", + "digest 0.10.7", ] [[package]] name = "http" -version = "0.2.12" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "fnv", "itoa", ] @@ -3417,19 +3412,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "fnv", "itoa", ] [[package]] name = "http-body" -version = "0.4.6" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes 1.6.0", - "http 0.2.12", + "bytes 1.5.0", + "http 0.2.9", "pin-project-lite", ] @@ -3439,7 +3434,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "http 1.1.0", ] @@ -3449,13 +3444,34 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "futures-core", "http 1.1.0", "http-body 1.0.0", "pin-project-lite", ] +[[package]] +name = "http-types" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad" +dependencies = [ + "anyhow", + "async-channel", + "base64 0.13.1", + "futures-lite", + "http 0.2.9", + "infer 0.2.3", + "pin-project-lite", + "rand 0.7.3", + "serde", + "serde_json", + "serde_qs 0.8.5", + "serde_urlencoded", + "url", +] + [[package]] name = "httparse" version = "1.8.0" @@ -3479,23 +3495,23 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "futures-channel", "futures-core", "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", + "h2 0.3.24", + "http 0.2.9", + "http-body 0.4.5", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2", - "tokio 1.37.0", + "socket2 0.4.9", + "tokio 1.36.0", "tower-service", "tracing", "want", @@ -3503,22 +3519,21 @@ dependencies = [ [[package]] name = "hyper" -version = "1.3.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "futures-channel", "futures-util", - "h2 0.4.4", + "h2 0.4.3", "http 1.1.0", "http-body 1.0.0", "httparse", - "httpdate", "itoa", "pin-project-lite", "smallvec 1.13.2", - "tokio 1.37.0", + "tokio 1.36.0", "want", ] @@ -3528,14 +3543,14 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca815a891b24fdfb243fa3239c86154392b0953ee584aa1a2a1f66d20cbe75cc" dependencies = [ - "bytes 1.6.0", - "futures 0.3.30", + "bytes 1.5.0", + "futures 0.3.28", "headers", - "http 0.2.12", - "hyper 0.14.28", + "http 0.2.9", + "hyper 0.14.27", "hyper-tls 0.5.0", "native-tls", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-native-tls", "tower-service", ] @@ -3546,12 +3561,12 @@ version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ - "http 0.2.12", - "hyper 0.14.28", + "http 0.2.9", + "hyper 0.14.27", "log", "rustls 0.20.9", "rustls-native-certs", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-rustls 0.23.4", ] @@ -3562,41 +3577,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.12", - "hyper 0.14.28", + "http 0.2.9", + "hyper 0.14.27", "log", - "rustls 0.21.12", + "rustls 0.21.10", "rustls-native-certs", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-rustls 0.24.1", ] -[[package]] -name = "hyper-rustls" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" -dependencies = [ - "futures-util", - "http 1.1.0", - "hyper 1.3.1", - "hyper-util", - "rustls 0.22.4", - "rustls-pki-types", - "tokio 1.37.0", - "tokio-rustls 0.25.0", - "tower-service", -] - [[package]] name = "hyper-timeout" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.28", + "hyper 0.14.27", "pin-project-lite", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-io-timeout", ] @@ -3606,10 +3604,10 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.6.0", - "hyper 0.14.28", + "bytes 1.5.0", + "hyper 0.14.27", "native-tls", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-native-tls", ] @@ -3619,12 +3617,12 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "http-body-util", - "hyper 1.3.1", + "hyper 1.2.0", "hyper-util", "native-tls", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-native-tls", "tower-service", ] @@ -3635,37 +3633,20 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "futures-channel", "futures-util", "http 1.1.0", "http-body 1.0.0", - "hyper 1.3.1", + "hyper 1.2.0", "pin-project-lite", - "socket2", - "tokio 1.37.0", + "socket2 0.5.5", + "tokio 1.36.0", "tower", "tower-service", "tracing", ] -[[package]] -name = "hyperswitch_domain_models" -version = "0.1.0" -dependencies = [ - "api_models", - "async-trait", - "common_enums", - "common_utils", - "diesel_models", - "error-stack", - "masking", - "serde", - "serde_json", - "thiserror", - "time", -] - [[package]] name = "hyperswitch_interfaces" version = "0.1.0" @@ -3680,9 +3661,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -3709,9 +3690,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -3719,30 +3700,38 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.22" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" dependencies = [ - "crossbeam-deque 0.8.5", "globset", + "lazy_static", "log", "memchr", - "regex-automata 0.4.6", + "regex", "same-file", + "thread_local", "walkdir", "winapi-util", ] [[package]] name = "image" -version = "0.25.1" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd54d660e773627692c524beaad361aca785a4f9f5730ce91f42aabe5bce3d11" +checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1" dependencies = [ "bytemuck", "byteorder", + "color_quant", + "gif", + "jpeg-decoder", + "num-iter", + "num-rational", "num-traits", "png", + "scoped_threadpool", + "tiff", ] [[package]] @@ -3764,20 +3753,26 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.14.3", "serde", ] [[package]] name = "infer" -version = "0.15.0" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac" + +[[package]] +name = "infer" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb33622da908807a06f9513c19b3c1ad50fab3e4137d82a78107d502075aa199" +checksum = "f551f8c3a39f68f986517db0d1759de85881894fdc7db798bd2a9df9cb04b7fc" dependencies = [ "cfb", ] @@ -3802,19 +3797,19 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.12" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "libc", - "windows-sys 0.52.0", + "rustix", + "windows-sys 0.48.0", ] [[package]] @@ -3856,36 +3851,36 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" dependencies = [ "libc", ] [[package]] name = "josekit" -version = "0.8.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0953340cf63354cec4a385f1fbcb3f409a5823778cae236078892f6030ed4565" +checksum = "33a96c4f2128a6f44ecf7c36df2b03dddf5a07b060a4d5ebc0a81e9821f7c60e" dependencies = [ "anyhow", - "base64 0.21.7", + "base64 0.21.5", "flate2", "once_cell", "openssl", @@ -3896,11 +3891,20 @@ dependencies = [ "time", ] +[[package]] +name = "jpeg-decoder" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" +dependencies = [ + "rayon", +] + [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -3918,14 +3922,13 @@ dependencies = [ [[package]] name = "jsonwebtoken" -version = "9.3.0" +version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.21.7", - "js-sys", + "base64 0.21.5", "pem", - "ring 0.17.8", + "ring 0.16.20", "serde", "serde_json", "simple_asn1", @@ -3966,21 +3969,18 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -dependencies = [ - "spin 0.5.2", -] [[package]] name = "libc" -version = "0.2.154" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libgit2-sys" -version = "0.16.2+1.7.2" +version = "0.15.2+1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" +checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa" dependencies = [ "cc", "libc", @@ -3996,30 +3996,19 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libmimalloc-sys" -version = "0.1.37" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81eb4061c0582dedea1cbc7aff2240300dd6982e0239d1c99e65c1dbf4a30ba7" +checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" dependencies = [ "cc", "libc", ] -[[package]] -name = "libsqlite3-sys" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - [[package]] name = "libz-sys" -version = "1.1.16" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "libc", @@ -4041,9 +4030,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "local-channel" -version = "0.1.5" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" +checksum = "e0a493488de5f18c8ffcba89eebb8532ffc562dc400490eb65b84893fae0b178" dependencies = [ "futures-core", "futures-sink", @@ -4052,9 +4041,9 @@ dependencies = [ [[package]] name = "local-waker" -version = "0.1.4" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" +checksum = "e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1" [[package]] name = "lock_api" @@ -4067,9 +4056,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -4077,9 +4066,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lru-cache" @@ -4099,11 +4088,20 @@ dependencies = [ "digits_iterator", ] +[[package]] +name = "mach2" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" +dependencies = [ + "libc", +] + [[package]] name = "masking" version = "0.1.0" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "diesel", "erased-serde", "serde", @@ -4129,9 +4127,9 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "maud" -version = "0.26.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df518b75016b4289cdddffa1b01f2122f4a49802c93191f3133f6dc2472ebcaa" +checksum = "b0bab19cef8a7fe1c18a43e881793bfc9d4ea984befec3ae5bd0415abf3ecf00" dependencies = [ "actix-web", "futures-util", @@ -4141,14 +4139,14 @@ dependencies = [ [[package]] name = "maud_macros" -version = "0.26.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa453238ec218da0af6b11fc5978d3b5c3a45ed97b722391a2a11f3306274e18" +checksum = "0be95d66c3024ffce639216058e5bae17a83ecaf266ffc6e4d060ad447c9eed2" dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.60", + "syn 1.0.109", ] [[package]] @@ -4164,7 +4162,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ "cfg-if 1.0.0", - "digest", + "digest 0.10.7", ] [[package]] @@ -4175,9 +4173,9 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.7.2" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memoffset" @@ -4188,11 +4186,20 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "mimalloc" -version = "0.1.41" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f41a2280ded0da56c8cf898babb86e8f10651a34adcfff190ae9a1159c6908d" +checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" dependencies = [ "libmimalloc-sys", ] @@ -4221,12 +4228,30 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +dependencies = [ + "adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", - "simd-adler32", ] [[package]] @@ -4250,13 +4275,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.11" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] @@ -4285,21 +4310,21 @@ dependencies = [ [[package]] name = "moka" -version = "0.12.7" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e0d88686dc561d743b40de8269b26eaf0dc58781bde087b0984646602021d08" +checksum = "d8017ec3548ffe7d4cef7ac0e12b044c01164a74c0f3119420faeaf13490ad8b" dependencies = [ "async-lock", "async-trait", "crossbeam-channel", - "crossbeam-epoch 0.9.18", - "crossbeam-utils 0.8.19", - "event-listener 5.3.0", + "crossbeam-epoch 0.9.15", + "crossbeam-utils 0.8.16", "futures-util", "once_cell", - "parking_lot 0.12.2", + "parking_lot 0.12.1", "quanta", "rustc_version 0.4.0", + "skeptic", "smallvec 1.13.2", "tagptr", "thiserror", @@ -4319,7 +4344,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8" dependencies = [ - "rand", + "rand 0.8.5", ] [[package]] @@ -4383,42 +4408,31 @@ dependencies = [ ] [[package]] -name = "num-bigint-dig" -version = "0.8.4" +name = "num-integer" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "byteorder", - "lazy_static", - "libm", - "num-integer", - "num-iter", + "autocfg", "num-traits", - "rand", - "smallvec 1.13.2", - "zeroize", ] [[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-integer" -version = "0.1.46" +name = "num-iter" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ + "autocfg", + "num-integer", "num-traits", ] [[package]] -name = "num-iter" -version = "0.1.45" +name = "num-rational" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ "autocfg", "num-integer", @@ -4427,9 +4441,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.19" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", "libm", @@ -4466,38 +4480,29 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "num_threads" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" -dependencies = [ - "libc", -] - [[package]] name = "object" -version = "0.32.2" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] [[package]] name = "oid-registry" -version = "0.7.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c958dd45046245b9c3c2547369bb634eb461670b2e7e0de552905801a648d1d" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" dependencies = [ "asn1-rs", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "oncemutex" @@ -4511,6 +4516,12 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "openapi" version = "0.1.0" @@ -4526,16 +4537,16 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd2846759315751e04d8b45a0bdbd89ce442282ffb916cf54f6b0adf8df4b44c" dependencies = [ - "aws-credential-types 1.2.0", - "aws-sigv4 1.2.1", + "aws-credential-types 1.1.8", + "aws-sigv4 1.2.0", "aws-smithy-runtime-api", - "aws-types 1.2.0", - "base64 0.21.7", - "bytes 1.6.0", + "aws-types 1.1.8", + "base64 0.21.5", + "bytes 1.5.0", "dyn-clone", "lazy_static", "percent-encoding", - "reqwest 0.11.27", + "reqwest 0.11.22", "rustc_version 0.4.0", "serde", "serde_json", @@ -4546,11 +4557,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.4.0", "cfg-if 1.0.0", "foreign-types", "libc", @@ -4567,7 +4578,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -4578,9 +4589,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" dependencies = [ "cc", "libc", @@ -4605,14 +4616,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8af72d59a4484654ea8eb183fea5ae4eb6a41d7ac3e3bae5f4d2a282a3a7d3ca" dependencies = [ "async-trait", - "futures 0.3.30", + "futures 0.3.28", "futures-util", - "http 0.2.12", + "http 0.2.9", "opentelemetry", "opentelemetry-proto", "prost", "thiserror", - "tokio 1.37.0", + "tokio 1.36.0", "tonic", ] @@ -4622,7 +4633,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "045f8eea8c0fa19f7d48e7bc3128a39c2e5c533d5c61298c548dfefc1064474c" dependencies = [ - "futures 0.3.30", + "futures 0.3.28", "futures-util", "opentelemetry", "prost", @@ -4661,20 +4672,20 @@ dependencies = [ "once_cell", "opentelemetry_api", "percent-encoding", - "rand", + "rand 0.8.5", "thiserror", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-stream", ] [[package]] name = "ordered-multimap" -version = "0.6.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ed8acf08e98e744e5384c8bc63ceb0364e68a6854187221c18df61c4797690e" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" dependencies = [ "dlv-list", - "hashbrown 0.13.2", + "hashbrown 0.12.3", ] [[package]] @@ -4691,9 +4702,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parking" -version = "2.2.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" [[package]] name = "parking_lot" @@ -4708,12 +4719,23 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ - "lock_api 0.4.12", - "parking_lot_core 0.9.10", + "instant", + "lock_api 0.4.10", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api 0.4.10", + "parking_lot_core 0.9.8", ] [[package]] @@ -4733,15 +4755,29 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec 1.13.2", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.5.1", + "redox_syscall 0.3.5", "smallvec 1.13.2", - "windows-targets 0.52.5", + "windows-targets 0.48.5", ] [[package]] @@ -4752,9 +4788,9 @@ checksum = "944553dd59c802559559161f9816429058b869003836120e262e8caec061b7ae" [[package]] name = "parse-zoneinfo" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" +checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" dependencies = [ "regex", ] @@ -4766,7 +4802,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -4784,34 +4820,24 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[package]] name = "pem" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" -dependencies = [ - "base64 0.22.1", - "serde", -] - -[[package]] -name = "pem-rfc7468" -version = "0.7.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" dependencies = [ - "base64ct", + "base64 0.13.1", ] [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.10" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" +checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" dependencies = [ "memchr", "thiserror", @@ -4820,9 +4846,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.10" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" +checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8" dependencies = [ "pest", "pest_generator", @@ -4830,22 +4856,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.10" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" +checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "pest_meta" -version = "2.7.10" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" +checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d" dependencies = [ "once_cell", "pest", @@ -4878,7 +4904,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ "phf_shared", - "rand", + "rand 0.8.5", ] [[package]] @@ -4892,50 +4918,50 @@ dependencies = [ [[package]] name = "phonenumber" -version = "0.3.4+8.13.34" +version = "0.3.3+8.13.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d888d375f2963bf06c5079665fbe53db69860879ff5a78524fe3c93c54fb7b8" +checksum = "635f3e6288e4f01c049d89332a031bd74f25d64b6fb94703ca966e819488cd06" dependencies = [ "bincode", "either", "fnv", - "itertools 0.12.1", + "itertools 0.11.0", "lazy_static", "nom", - "quick-xml", + "quick-xml 0.28.2", "regex", "regex-cache", "serde", "serde_derive", - "strum 0.25.0", + "strum 0.24.1", "thiserror", ] [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -4943,32 +4969,11 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs1" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" -dependencies = [ - "der", - "pkcs8", - "spki", -] - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "plotters" @@ -5004,7 +5009,7 @@ version = "0.1.0" dependencies = [ "api_models", "async-trait", - "bytes 1.6.0", + "bytes 1.5.0", "common_enums", "common_utils", "error-stack", @@ -5015,29 +5020,22 @@ dependencies = [ "router_env", "serde", "serde_json", - "strum 0.26.2", + "strum 0.24.1", "thiserror", ] [[package]] name = "png" -version = "0.17.13" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" +checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" dependencies = [ "bitflags 1.3.2", "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", + "deflate", + "miniz_oxide 0.3.7", ] -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -5060,16 +5058,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit 0.19.15", + "toml_edit 0.19.14", ] [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" dependencies = [ - "toml_edit 0.21.1", + "toml_edit 0.20.2", ] [[package]] @@ -5098,28 +5096,28 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.4.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.5.0", + "bitflags 2.4.0", "lazy_static", "num-traits", - "rand", - "rand_chacha", + "rand 0.8.5", + "rand_chacha 0.3.1", "rand_xorshift", - "regex-syntax 0.8.3", + "regex-syntax 0.7.5", "rusty-fork", "tempfile", "unarray", @@ -5131,7 +5129,7 @@ version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "prost-derive", ] @@ -5168,26 +5166,39 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "pulldown-cmark" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +dependencies = [ + "bitflags 1.3.2", + "memchr", + "unicase", +] + [[package]] name = "qrcode" -version = "0.14.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e719ca51966ff9f5a8436edb00d6115b3c606a0bb27c8f8ca74a38ff2b036d" +checksum = "16d2f1455f3630c6e5107b4f2b94e74d76dea80736de0981fd27644216cff57f" dependencies = [ + "checked_int_cast", "image", ] [[package]] name = "quanta" -version = "0.12.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" dependencies = [ - "crossbeam-utils 0.8.19", + "crossbeam-utils 0.8.16", "libc", + "mach2", "once_cell", "raw-cpuid", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "web-sys", "winapi 0.3.9", ] @@ -5198,6 +5209,16 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quick-xml" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "quick-xml" version = "0.31.0" @@ -5210,9 +5231,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -5224,7 +5245,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" dependencies = [ "log", - "parking_lot 0.12.2", + "parking_lot 0.12.1", "scheduled-thread-pool", ] @@ -5234,6 +5255,19 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + [[package]] name = "rand" version = "0.8.5" @@ -5241,8 +5275,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] @@ -5252,7 +5296,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", ] [[package]] @@ -5261,7 +5314,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.11", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", ] [[package]] @@ -5270,23 +5332,23 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" dependencies = [ - "rand_core", + "rand_core 0.6.4", ] [[package]] name = "raw-cpuid" -version = "11.0.2" +version = "10.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e29830cbb1290e404f24c73af91c5d8d631ce7e128691e9477556b540cd01ecd" +checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" dependencies = [ - "bitflags 2.5.0", + "bitflags 1.3.2", ] [[package]] name = "rayon" -version = "1.10.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -5294,19 +5356,19 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-deque 0.8.5", - "crossbeam-utils 0.8.19", + "crossbeam-deque 0.8.3", + "crossbeam-utils 0.8.16", ] [[package]] name = "rdkafka" -version = "0.36.2" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1beea247b9a7600a81d4cc33f659ce1a77e1988323d7d2809c7ed1c21f4c316d" +checksum = "d54f02a5a40220f8a2dfa47ddb38ba9064475a5807a69504b6f91711df2eea63" dependencies = [ "futures-channel", "futures-util", @@ -5317,7 +5379,7 @@ dependencies = [ "serde_derive", "serde_json", "slab", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] @@ -5338,7 +5400,7 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c31deddf734dc0a39d3112e73490e88b61a05e83e074d211f348404cee4d2c6" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "bytes-utils", "cookie-factory", "crc16", @@ -5353,11 +5415,11 @@ dependencies = [ "common_utils", "error-stack", "fred", - "futures 0.3.30", + "futures 0.3.28", "router_env", "serde", "thiserror", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-stream", ] @@ -5369,32 +5431,43 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "bitflags 2.5.0", + "getrandom 0.2.11", + "redox_syscall 0.2.16", + "thiserror", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.5", + "regex-syntax 0.8.2", ] [[package]] @@ -5408,13 +5481,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.2", ] [[package]] @@ -5443,35 +5516,41 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "regex-syntax" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rend" -version = "0.4.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" dependencies = [ "bytecheck", ] [[package]] name = "reqwest" -version = "0.11.27" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "async-compression", - "base64 0.21.7", - "bytes 1.6.0", + "base64 0.21.5", + "bytes 1.5.0", "encoding_rs", "futures-core", "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "h2 0.3.24", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-rustls 0.24.2", "hyper-tls 0.5.0", "ipnet", @@ -5482,14 +5561,13 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.12", - "rustls-pemfile 1.0.4", + "rustls 0.21.10", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", "system-configuration", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-native-tls", "tokio-rustls 0.24.1", "tokio-util", @@ -5498,28 +5576,27 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.25.4", - "winreg 0.50.0", + "webpki-roots 0.25.3", + "winreg", ] [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338" dependencies = [ "async-compression", - "base64 0.22.1", - "bytes 1.6.0", + "base64 0.21.5", + "bytes 1.5.0", "encoding_rs", "futures-core", "futures-util", - "h2 0.4.4", + "h2 0.4.3", "http 1.1.0", "http-body 1.0.0", "http-body-util", - "hyper 1.3.1", - "hyper-rustls 0.26.0", + "hyper 1.2.0", "hyper-tls 0.6.0", "hyper-util", "ipnet", @@ -5531,27 +5608,29 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.22.4", - "rustls-pemfile 2.1.2", - "rustls-pki-types", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", "system-configuration", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-native-tls", - "tokio-rustls 0.25.0", "tokio-util", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.26.1", - "winreg 0.52.0", + "winreg", ] +[[package]] +name = "retain_mut" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" + [[package]] name = "ring" version = "0.16.20" @@ -5575,7 +5654,7 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if 1.0.0", - "getrandom", + "getrandom 0.2.11", "libc", "spin 0.9.8", "untrusted 0.9.0", @@ -5584,13 +5663,12 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.44" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" dependencies = [ "bitvec", "bytecheck", - "bytes 1.6.0", "hashbrown 0.12.3", "ptr_meta", "rend", @@ -5602,9 +5680,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.44" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ "proc-macro2", "quote", @@ -5613,14 +5691,13 @@ dependencies = [ [[package]] name = "ron" -version = "0.8.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" +checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" dependencies = [ - "base64 0.21.7", - "bitflags 2.5.0", + "base64 0.13.1", + "bitflags 1.3.2", "serde", - "serde_derive", ] [[package]] @@ -5631,7 +5708,7 @@ checksum = "1c7280c46017fafbe4275179689e446a9b0db3bd91ea61aaee22841ef618405a" dependencies = [ "nom", "serde", - "serde-wasm-bindgen 0.5.0", + "serde-wasm-bindgen", "serde_json", "wasm-bindgen", ] @@ -5651,37 +5728,36 @@ dependencies = [ "async-bb8-diesel", "async-trait", "awc", - "base64 0.22.1", + "base64 0.21.5", "bb8", "bigdecimal", "blake3", - "bytes 1.6.0", + "bytes 1.5.0", "cards", "clap", "common_enums", "common_utils", "config", - "cookie 0.18.1", + "cookie 0.18.0", "currency_conversion", + "data_models", "derive_deref", "diesel", "diesel_models", - "digest", + "digest 0.9.0", "dyn-clone", "encoding_rs", "erased-serde", "error-stack", "euclid", - "events", "external_services", - "futures 0.3.30", + "futures 0.3.28", "hex", - "http 0.2.12", - "hyper 0.14.28", - "hyperswitch_domain_models", + "http 0.2.9", + "hyper 0.14.27", "hyperswitch_interfaces", "image", - "infer", + "infer 0.13.0", "iso_currency", "isocountry", "josekit", @@ -5698,14 +5774,14 @@ dependencies = [ "openssl", "pm_auth", "qrcode", - "quick-xml", - "rand", - "rand_chacha", + "quick-xml 0.31.0", + "rand 0.8.5", + "rand_chacha 0.3.1", "rdkafka", "redis_interface", "regex", - "reqwest 0.12.4", - "ring 0.17.8", + "reqwest 0.12.2", + "ring 0.16.20", "router_derive", "router_env", "roxmltree", @@ -5715,19 +5791,19 @@ dependencies = [ "serde", "serde_json", "serde_path_to_error", - "serde_qs", + "serde_qs 0.12.0", "serde_urlencoded", "serde_with", "serial_test", - "sha1", + "sha-1", "sqlx", "storage_impl", - "strum 0.26.2", + "strum 0.25.0", "tera", "test_utils", "thiserror", "time", - "tokio 1.37.0", + "tokio 1.36.0", "tracing-futures", "unicode-segmentation", "url", @@ -5743,20 +5819,20 @@ name = "router_derive" version = "0.1.0" dependencies = [ "diesel", - "indexmap 2.2.6", + "indexmap 2.1.0", "proc-macro2", "quote", "serde", "serde_json", - "strum 0.26.2", - "syn 2.0.60", + "strum 0.24.1", + "syn 2.0.55", ] [[package]] name = "router_env" version = "0.1.0" dependencies = [ - "cargo_metadata", + "cargo_metadata 0.18.1", "config", "error-stack", "gethostname", @@ -5767,9 +5843,9 @@ dependencies = [ "serde", "serde_json", "serde_path_to_error", - "strum 0.26.2", + "strum 0.24.1", "time", - "tokio 1.37.0", + "tokio 1.36.0", "tracing", "tracing-actix-web", "tracing-appender", @@ -5781,35 +5857,18 @@ dependencies = [ [[package]] name = "roxmltree" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f" - -[[package]] -name = "rsa" -version = "0.9.6" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "862340e351ce1b271a378ec53f304a5558f7db87f3769dc655a8f6ecbb68b302" dependencies = [ - "const-oid", - "digest", - "num-bigint-dig", - "num-integer", - "num-traits", - "pkcs1", - "pkcs8", - "rand_core", - "signature", - "spki", - "subtle", - "zeroize", + "xmlparser", ] [[package]] name = "rust-ini" -version = "0.19.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e2a3bcec1f113553ef1c88aae6c020a369d03d55b58de9869a0908930385091" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" dependencies = [ "cfg-if 1.0.0", "ordered-multimap", @@ -5817,15 +5876,15 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.35.0" +version = "1.33.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a" +checksum = "06676aec5ccb8fc1da723cc8c0f9a46549f21ebb8753d3915c6c41db1e7f1dc4" dependencies = [ "arrayvec", "borsh", - "bytes 1.6.0", + "bytes 1.5.0", "num-traits", - "rand", + "rand 0.8.5", "rkyv", "serde", "serde_json", @@ -5872,15 +5931,15 @@ dependencies = [ [[package]] name = "rustify" -version = "0.5.4" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7dd9d821401c8cbb6866421843c08021d1b9780b583cc28ae2adc1e79a12c5d" +checksum = "e9c02e25271068de581e03ac3bb44db60165ff1a10d92b9530192ccb898bc706" dependencies = [ "anyhow", "async-trait", - "bytes 1.6.0", - "http 1.1.0", - "reqwest 0.12.4", + "bytes 1.5.0", + "http 0.2.9", + "reqwest 0.11.22", "rustify_derive", "serde", "serde_json", @@ -5892,25 +5951,25 @@ dependencies = [ [[package]] name = "rustify_derive" -version = "0.5.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7345f32672da54338227b727bd578c897859ddfaad8952e0b0d787fb4e58f07d" +checksum = "58135536c18c04f4634bedad182a3f41baf33ef811cc38a3ec7b7061c57134c8" dependencies = [ "proc-macro2", "quote", "regex", "serde_urlencoded", "syn 1.0.109", - "synstructure 0.12.6", + "synstructure", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.4.0", "errno", "libc", "linux-raw-sys", @@ -5931,30 +5990,16 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.12" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring 0.17.8", - "rustls-webpki 0.101.7", + "rustls-webpki", "sct", ] -[[package]] -name = "rustls" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" -dependencies = [ - "log", - "ring 0.17.8", - "rustls-pki-types", - "rustls-webpki 0.102.3", - "subtle", - "zeroize", -] - [[package]] name = "rustls-native-certs" version = "0.6.3" @@ -5962,36 +6007,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", - "rustls-pemfile 1.0.4", + "rustls-pemfile", "schannel", "security-framework", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - -[[package]] -name = "rustls-pemfile" -version = "2.1.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.22.1", - "rustls-pki-types", + "base64 0.21.5", ] -[[package]] -name = "rustls-pki-types" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" - [[package]] name = "rustls-webpki" version = "0.101.7" @@ -6002,22 +6031,11 @@ dependencies = [ "untrusted 0.9.0", ] -[[package]] -name = "rustls-webpki" -version = "0.102.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" -dependencies = [ - "ring 0.17.8", - "rustls-pki-types", - "untrusted 0.9.0", -] - [[package]] name = "rustversion" -version = "1.0.15" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rusty-fork" @@ -6041,9 +6059,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -6054,22 +6072,13 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scc" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ad2bbb0ae5100a07b7a6f2ed7ab5fd0045551a4c507989b7a620046ea3efdc" -dependencies = [ - "sdd", -] - [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -6078,7 +6087,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" dependencies = [ - "parking_lot 0.12.2", + "parking_lot 0.12.1", ] [[package]] @@ -6090,23 +6099,29 @@ dependencies = [ "diesel_models", "error-stack", "external_services", - "futures 0.3.30", + "futures 0.3.28", "masking", "num_cpus", "once_cell", - "rand", + "rand 0.8.5", "redis_interface", "router_env", "serde", "serde_json", "storage_impl", - "strum 0.26.2", + "strum 0.24.1", "thiserror", "time", - "tokio 1.37.0", + "tokio 1.36.0", "uuid", ] +[[package]] +name = "scoped_threadpool" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" + [[package]] name = "scopeguard" version = "1.2.0" @@ -6115,20 +6130,14 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "ring 0.16.20", + "untrusted 0.7.1", ] -[[package]] -name = "sdd" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84345e4c9bd703274a082fb80caaa99b7612be48dfaa1dd9266577ec412309d" - [[package]] name = "seahash" version = "4.1.0" @@ -6137,9 +6146,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "security-framework" -version = "2.10.0" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -6150,9 +6159,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.10.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -6184,9 +6193,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.200" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -6202,35 +6211,24 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "serde-wasm-bindgen" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.1.0", "itoa", "ryu", "serde", @@ -6238,9 +6236,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.16" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" dependencies = [ "itoa", "serde", @@ -6255,6 +6253,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_qs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" +dependencies = [ + "percent-encoding", + "serde", + "thiserror", +] + [[package]] name = "serde_qs" version = "0.12.0" @@ -6268,20 +6277,20 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.19" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" dependencies = [ "serde", ] @@ -6300,17 +6309,16 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" +checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" dependencies = [ - "base64 0.22.1", + "base64 0.21.5", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.6", + "indexmap 2.1.0", "serde", - "serde_derive", "serde_json", "serde_with_macros", "time", @@ -6318,39 +6326,52 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" +checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" dependencies = [ - "darling 0.20.8", + "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "serial_test" -version = "3.1.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" +checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d" dependencies = [ - "futures 0.3.30", + "dashmap", + "futures 0.3.28", + "lazy_static", "log", - "once_cell", - "parking_lot 0.12.2", - "scc", + "parking_lot 0.12.1", "serial_test_derive", ] [[package]] name = "serial_test_derive" -version = "3.1.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" +checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", +] + +[[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", ] [[package]] @@ -6361,7 +6382,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -6372,7 +6393,7 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -6396,9 +6417,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] @@ -6412,25 +6433,9 @@ dependencies = [ "futures-core", "libc", "signal-hook", - "tokio 1.37.0", + "tokio 1.36.0", ] -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest", - "rand_core", -] - -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - [[package]] name = "simdutf8" version = "0.1.4" @@ -6455,6 +6460,21 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "skeptic" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" +dependencies = [ + "bytecount", + "cargo_metadata 0.14.2", + "error-chain", + "glob", + "pulldown-cmark", + "tempfile", + "walkdir", +] + [[package]] name = "slab" version = "0.4.9" @@ -6466,12 +6486,11 @@ dependencies = [ [[package]] name = "slug" -version = "0.1.5" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd94acec9c8da640005f8e135a39fc0372e74535e6b368b7a04b875f784c8c4" +checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" dependencies = [ "deunicode", - "wasm-bindgen", ] [[package]] @@ -6491,12 +6510,22 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", - "windows-sys 0.52.0", + "winapi 0.3.9", +] + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", ] [[package]] @@ -6510,232 +6539,110 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api 0.4.12", -] - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] [[package]] name = "sqlformat" -version = "0.2.3" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" dependencies = [ - "itertools 0.12.1", + "itertools 0.11.0", "nom", "unicode_categories", ] [[package]] name = "sqlx" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" -dependencies = [ - "sqlx-core", - "sqlx-macros", - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", -] - -[[package]] -name = "sqlx-core" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" -dependencies = [ - "ahash 0.8.11", - "atoi", - "bigdecimal", - "byteorder", - "bytes 1.6.0", - "crc", - "crossbeam-queue 0.3.11", - "either", - "event-listener 2.5.3", - "futures-channel", - "futures-core", - "futures-intrusive", - "futures-io", - "futures-util", - "hashlink", - "hex", - "indexmap 2.2.6", - "log", - "memchr", - "native-tls", - "once_cell", - "paste", - "percent-encoding", - "serde", - "serde_json", - "sha2", - "smallvec 1.13.2", - "sqlformat", - "thiserror", - "time", - "tokio 1.37.0", - "tokio-stream", - "tracing", - "url", -] - -[[package]] -name = "sqlx-macros" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" -dependencies = [ - "proc-macro2", - "quote", - "sqlx-core", - "sqlx-macros-core", - "syn 1.0.109", -] - -[[package]] -name = "sqlx-macros-core" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" -dependencies = [ - "dotenvy", - "either", - "heck 0.4.1", - "hex", - "once_cell", - "proc-macro2", - "quote", - "serde", - "serde_json", - "sha2", +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8de3b03a925878ed54a954f621e64bf55a3c1bd29652d0d1a17830405350188" +dependencies = [ "sqlx-core", - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", - "syn 1.0.109", - "tempfile", - "tokio 1.37.0", - "url", + "sqlx-macros", ] [[package]] -name = "sqlx-mysql" -version = "0.7.4" +name = "sqlx-core" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" dependencies = [ + "ahash 0.7.7", "atoi", - "base64 0.21.7", + "base64 0.13.1", "bigdecimal", - "bitflags 2.5.0", + "bitflags 1.3.2", "byteorder", - "bytes 1.6.0", + "bytes 1.5.0", "crc", - "digest", + "crossbeam-queue 0.3.8", + "dirs", "dotenvy", "either", + "event-listener", "futures-channel", "futures-core", - "futures-io", + "futures-intrusive", "futures-util", - "generic-array", + "hashlink", "hex", "hkdf", "hmac", + "indexmap 1.9.3", "itoa", + "libc", "log", "md-5", "memchr", + "num-bigint", "once_cell", + "paste", "percent-encoding", - "rand", - "rsa", + "rand 0.8.5", "serde", + "serde_json", "sha1", "sha2", "smallvec 1.13.2", - "sqlx-core", + "sqlformat", + "sqlx-rt", "stringprep", "thiserror", "time", - "tracing", + "tokio-stream", + "url", "whoami", ] [[package]] -name = "sqlx-postgres" -version = "0.7.4" +name = "sqlx-macros" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +checksum = "9966e64ae989e7e575b19d7265cb79d7fc3cbbdf179835cb0d716f294c2049c9" dependencies = [ - "atoi", - "base64 0.21.7", - "bigdecimal", - "bitflags 2.5.0", - "byteorder", - "crc", "dotenvy", - "etcetera", - "futures-channel", - "futures-core", - "futures-io", - "futures-util", - "hex", - "hkdf", - "hmac", - "home", - "itoa", - "log", - "md-5", - "memchr", - "num-bigint", + "either", + "heck", "once_cell", - "rand", - "serde", - "serde_json", + "proc-macro2", + "quote", "sha2", - "smallvec 1.13.2", "sqlx-core", - "stringprep", - "thiserror", - "time", - "tracing", - "whoami", + "sqlx-rt", + "syn 1.0.109", + "url", ] [[package]] -name = "sqlx-sqlite" -version = "0.7.4" +name = "sqlx-rt" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" +checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024" dependencies = [ - "atoi", - "flume", - "futures-channel", - "futures-core", - "futures-executor", - "futures-intrusive", - "futures-util", - "libsqlite3-sys", - "log", - "percent-encoding", - "serde", - "sqlx-core", - "time", - "tracing", - "url", - "urlencoding", + "native-tls", + "once_cell", + "tokio 1.36.0", + "tokio-native-tls", ] [[package]] @@ -6747,28 +6654,29 @@ dependencies = [ "async-bb8-diesel", "async-trait", "bb8", - "bytes 1.6.0", + "bytes 1.5.0", "common_utils", "config", "crc32fast", + "data_models", "diesel", "diesel_models", "dyn-clone", "error-stack", - "futures 0.3.30", - "http 0.2.12", - "hyperswitch_domain_models", + "futures 0.3.28", + "http 0.2.9", "masking", "mime", "moka", "once_cell", "redis_interface", + "ring 0.16.20", "router_derive", "router_env", "serde", "serde_json", "thiserror", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] @@ -6799,53 +6707,53 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.25.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" dependencies = [ - "strum_macros 0.25.3", + "strum_macros 0.24.3", ] [[package]] name = "strum" -version = "0.26.2" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ - "strum_macros 0.26.2", + "strum_macros 0.25.2", ] [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.60", + "syn 1.0.109", ] [[package]] name = "strum_macros" -version = "0.26.2" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" @@ -6860,9 +6768,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", @@ -6878,7 +6786,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -6899,17 +6807,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.60", -] - [[package]] name = "system-configuration" version = "0.5.1" @@ -6945,14 +6842,15 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if 1.0.0", - "fastrand 2.1.0", + "fastrand 2.0.1", + "redox_syscall 0.3.5", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -6969,7 +6867,7 @@ dependencies = [ "percent-encoding", "pest", "pest_derive", - "rand", + "rand 0.8.5", "regex", "serde", "serde_json", @@ -6979,34 +6877,36 @@ dependencies = [ [[package]] name = "test-case" -version = "3.3.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2550dd13afcd286853192af8601920d959b14c401fcece38071d53bf0768a8" +checksum = "c8f1e820b7f1d95a0cdbf97a5df9de10e1be731983ab943e56703ac1b8e9d425" dependencies = [ "test-case-macros", ] [[package]] name = "test-case-core" -version = "3.3.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcb7fd841cd518e279be3d5a3eb0636409487998a4aff22f3de87b81e88384f" +checksum = "54c25e2cb8f5fcd7318157634e8838aa6f7e4715c96637f969fabaccd1ef5462" dependencies = [ "cfg-if 1.0.0", + "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "test-case-macros" -version = "3.3.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" +checksum = "37cfd7bbc88a0104e304229fba519bdc45501a30b760fb72240342f1289ad257" dependencies = [ + "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", "test-case-core", ] @@ -7015,20 +6915,20 @@ name = "test_utils" version = "0.1.0" dependencies = [ "async-trait", - "base64 0.22.1", + "base64 0.21.5", "clap", "masking", - "rand", + "rand 0.8.5", "regex", - "reqwest 0.12.4", + "reqwest 0.12.2", "serde", "serde_json", "serde_urlencoded", "serial_test", "thirtyfour", "time", - "tokio 1.37.0", - "toml", + "tokio 1.36.0", + "toml 0.7.4", ] [[package]] @@ -7042,26 +6942,26 @@ dependencies = [ "chrono", "cookie 0.16.2", "fantoccini", - "futures 0.3.30", - "http 0.2.12", + "futures 0.3.28", + "http 0.2.9", "log", - "parking_lot 0.12.2", + "parking_lot 0.12.1", "serde", "serde_json", "serde_repr", "stringmatch", "thirtyfour-macros", "thiserror", - "tokio 1.37.0", + "tokio 1.36.0", "url", "urlparse", ] [[package]] name = "thirtyfour-macros" -version = "0.1.2" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c98f6ff7045a00ce7ef2fb2f5ebd5c3c6dfe8fc0c1858249e32555fa8059df" +checksum = "9cae91d1c7c61ec65817f1064954640ee350a50ae6548ff9a1bdd2489d6ffbb0" dependencies = [ "proc-macro-error", "proc-macro2", @@ -7071,46 +6971,52 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.59" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.59" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "thread_local" -version = "1.1.8" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ "cfg-if 1.0.0", "once_cell", ] +[[package]] +name = "tiff" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437" +dependencies = [ + "jpeg-decoder", + "miniz_oxide 0.4.4", + "weezl", +] + [[package]] name = "time" -version = "0.3.36" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" dependencies = [ - "deranged", "itoa", - "libc", - "num-conv", - "num_threads", - "powerfmt", "serde", "time-core", "time-macros", @@ -7118,29 +7024,19 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" dependencies = [ - "num-conv", "time-core", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinytemplate" version = "1.2.1" @@ -7192,19 +7088,19 @@ dependencies = [ [[package]] name = "tokio" -version = "1.37.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", - "bytes 1.6.0", + "bytes 1.5.0", "libc", - "mio 0.8.11", + "mio 0.8.10", "num_cpus", - "parking_lot 0.12.2", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -7269,7 +7165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" dependencies = [ "pin-project-lite", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] @@ -7280,7 +7176,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -7290,7 +7186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", - "tokio 1.37.0", + "tokio 1.36.0", ] [[package]] @@ -7319,7 +7215,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ "rustls 0.20.9", - "tokio 1.37.0", + "tokio 1.36.0", "webpki", ] @@ -7329,30 +7225,19 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.12", - "tokio 1.37.0", -] - -[[package]] -name = "tokio-rustls" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" -dependencies = [ - "rustls 0.22.4", - "rustls-pki-types", - "tokio 1.37.0", + "rustls 0.21.10", + "tokio 1.36.0", ] [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", "pin-project-lite", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-util", ] @@ -7444,73 +7329,71 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ - "bytes 1.6.0", + "bytes 1.5.0", "futures-core", "futures-sink", "pin-project-lite", - "tokio 1.37.0", + "tokio 1.36.0", "tracing", ] [[package]] name = "toml" -version = "0.8.12" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ - "indexmap 2.2.6", "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.22.12", ] [[package]] -name = "toml_datetime" -version = "0.6.5" +name = "toml" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" dependencies = [ + "indexmap 1.9.3", "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.19.14", ] [[package]] -name = "toml_edit" -version = "0.19.15" +name = "toml_datetime" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ - "indexmap 2.2.6", - "toml_datetime", - "winnow 0.5.40", + "serde", ] [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.1.0", + "serde", + "serde_spanned", "toml_datetime", - "winnow 0.5.40", + "winnow", ] [[package]] name = "toml_edit" -version = "0.22.12" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.2.6", - "serde", - "serde_spanned", + "indexmap 2.1.0", "toml_datetime", - "winnow 0.6.7", + "winnow", ] [[package]] @@ -7523,19 +7406,19 @@ dependencies = [ "async-trait", "axum", "base64 0.13.1", - "bytes 1.6.0", + "bytes 1.5.0", "futures-core", "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "h2 0.3.24", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-timeout", "percent-encoding", "pin-project", "prost", "prost-derive", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-stream", "tokio-util", "tower", @@ -7556,9 +7439,9 @@ dependencies = [ "indexmap 1.9.3", "pin-project", "pin-project-lite", - "rand", + "rand 0.8.5", "slab", - "tokio 1.37.0", + "tokio 1.36.0", "tokio-util", "tower-layer", "tower-service", @@ -7606,12 +7489,11 @@ dependencies = [ [[package]] name = "tracing-appender" -version = "0.2.3" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" +checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" dependencies = [ "crossbeam-channel", - "thiserror", "time", "tracing-subscriber", ] @@ -7624,7 +7506,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] @@ -7650,23 +7532,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" dependencies = [ + "lazy_static", "log", - "once_cell", "tracing-core", ] @@ -7680,7 +7551,7 @@ dependencies = [ "opentelemetry", "tracing", "tracing-core", - "tracing-log 0.1.4", + "tracing-log", "tracing-subscriber", ] @@ -7696,9 +7567,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" dependencies = [ "matchers", "nu-ansi-term", @@ -7711,21 +7582,21 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log 0.2.0", + "tracing-log", "tracing-serde", ] [[package]] name = "triomphe" -version = "0.1.11" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" +checksum = "0eee8098afad3fb0c54a9007aab6804558410503ad676d4633f9c2559a00ac0f" [[package]] name = "try-lock" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typenum" @@ -7806,9 +7677,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" @@ -7818,18 +7689,18 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-xid" @@ -7843,6 +7714,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "unidecode" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402bb19d8e03f1d1a7450e2bd613980869438e0666331be3e073089124aa1adc" + [[package]] name = "untrusted" version = "0.7.1" @@ -7857,9 +7734,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -7881,11 +7758,11 @@ checksum = "110352d4e9076c67839003c7788d8604e24dcded13e0b375af3efaa8cf468517" [[package]] name = "utoipa" -version = "4.2.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "272ebdfbc99111033031d2f10e018836056e4d2c8e2acda76450ec7974269fa7" +checksum = "d82b1bc5417102a73e8464c686eef947bdfb99fcdfc0a4f228e81afa9526470a" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.1.0", "serde", "serde_json", "utoipa-gen", @@ -7893,34 +7770,34 @@ dependencies = [ [[package]] name = "utoipa-gen" -version = "4.2.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3c9f4d08338c1bfa70dde39412a040a884c6f318b3d09aaaf3437a1e52027fc" +checksum = "05d96dcd6fc96f3df9b3280ef480770af1b7c5d14bc55192baa9b067976d920c" dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "uuid" -version = "1.8.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "atomic", - "getrandom", + "getrandom 0.2.11", ] [[package]] name = "validator" -version = "0.17.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da339118f018cc70ebf01fafc103360528aad53717e4bf311db929cb01cb9345" +checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd" dependencies = [ "idna", - "once_cell", + "lazy_static", "regex", "serde", "serde_derive", @@ -7936,15 +7813,15 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vaultrs" -version = "0.7.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb996bb053adadc767f8b0bda2a80bc2b67d24fe89f2b959ae919e200d79a19" +checksum = "28084ac780b443e7f3514df984a2933bd3ab39e71914d951cdf8e4d298a7c9bc" dependencies = [ "async-trait", - "bytes 1.6.0", + "bytes 1.5.0", "derive_builder", - "http 0.2.12", - "reqwest 0.11.27", + "http 0.2.9", + "reqwest 0.11.22", "rustify", "rustify_derive", "serde", @@ -7962,15 +7839,12 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vergen" -version = "8.3.1" +version = "8.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525" +checksum = "8b3c89c2c7e50f33e4d35527e5bf9c11d6d132226dbbd1753f0fbe9f19ef88c6" dependencies = [ "anyhow", - "cargo_metadata", - "cfg-if 1.0.0", "git2", - "regex", "rustc_version 0.4.0", "rustversion", "time", @@ -8003,11 +7877,17 @@ dependencies = [ "libc", ] +[[package]] +name = "waker-fn" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" + [[package]] name = "walkdir" -version = "2.5.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -8024,21 +7904,21 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] -name = "wasite" -version = "0.1.0" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -8046,24 +7926,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -8073,9 +7953,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -8083,28 +7963,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -8117,9 +7997,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9973cb72c8587d5ad5efdb91e663d36177dc37725e6c90ca86c626b0cc45c93f" dependencies = [ "base64 0.13.1", - "bytes 1.6.0", + "bytes 1.5.0", "cookie 0.16.2", - "http 0.2.12", + "http 0.2.9", "log", "serde", "serde_derive", @@ -8131,12 +8011,12 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.4" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" +checksum = "07ecc0cd7cac091bf682ec5efa18b1cff79d617b84181f38b3951dbe135f607f" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -8150,27 +8030,24 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.4" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] -name = "webpki-roots" -version = "0.26.1" +name = "weezl" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" -dependencies = [ - "rustls-pki-types", -] +checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "whoami" -version = "1.5.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" dependencies = [ - "redox_syscall 0.4.1", - "wasite", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -8203,11 +8080,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ - "windows-sys 0.52.0", + "winapi 0.3.9", ] [[package]] @@ -8218,11 +8095,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.52.0" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.48.5", ] [[package]] @@ -8240,7 +8117,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.0", ] [[package]] @@ -8260,18 +8137,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -8282,9 +8158,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" @@ -8294,9 +8170,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" @@ -8306,15 +8182,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" @@ -8324,9 +8194,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" @@ -8336,9 +8206,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" @@ -8348,9 +8218,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" @@ -8360,24 +8230,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" - -[[package]] -name = "winnow" -version = "0.5.40" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.6.7" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578" +checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" dependencies = [ "memchr", ] @@ -8392,38 +8253,26 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if 1.0.0", - "windows-sys 0.48.0", -] - [[package]] name = "wiremock" -version = "0.6.0" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec874e1eef0df2dcac546057fe5e29186f09c378181cd7b635b4b7bcc98e9d81" +checksum = "bd7b0b5b253ebc0240d6aac6dd671c495c467420577bf634d3064ae7e6fa2b4c" dependencies = [ "assert-json-diff", "async-trait", - "base64 0.21.7", + "base64 0.21.5", "deadpool", - "futures 0.3.30", - "http 1.1.0", - "http-body-util", - "hyper 1.3.1", - "hyper-util", + "futures 0.3.28", + "futures-timer", + "http-types", + "hyper 0.14.27", "log", "once_cell", "regex", "serde", "serde_json", - "tokio 1.37.0", - "url", + "tokio 1.36.0", ] [[package]] @@ -8447,9 +8296,9 @@ dependencies = [ [[package]] name = "x509-parser" -version = "0.16.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" +checksum = "7069fba5b66b9193bd2c5d3d4ff12b839118f6bcbef5328efafafb5395cf63da" dependencies = [ "asn1-rs", "data-encoding", @@ -8479,54 +8328,56 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.55", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" [[package]] name = "zstd" -version = "0.13.1" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.1.0" +version = "6.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" dependencies = [ + "libc", "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.10+zstd.1.5.6" +version = "2.0.8+zstd.1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" dependencies = [ "cc", + "libc", "pkg-config", ] diff --git a/INSTALL_dependencies.sh b/INSTALL_dependencies.sh index 8f893f54459..288dea1bd44 100755 --- a/INSTALL_dependencies.sh +++ b/INSTALL_dependencies.sh @@ -67,8 +67,8 @@ need_cmd () { } prompt () { - read -p "$*? [y/N] :" ANSWER - case $ANSWER in + read -p "$*? [y/N] :" ANS + case $ANS in [Yy]*) return 1;; *) return 0;; esac diff --git a/config/config.example.toml b/config/config.example.toml index b2e1fe3c458..ee868beb092 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -171,7 +171,6 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/" billwerk.base_url = "https://api.reepay.com/" -billwerk.secondary_base_url = "https://card.reepay.com/" bitpay.base_url = "https://test.bitpay.com" bluesnap.base_url = "https://sandbox.bluesnap.com/" bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" @@ -185,7 +184,6 @@ cryptopay.base_url = "https://business-sandbox.cryptopay.me" cybersource.base_url = "https://apitest.cybersource.com/" dlocal.base_url = "https://sandbox.dlocal.com/" dummyconnector.base_url = "http://localhost:8080/dummy-connector" -ebanx.base_url = "https://sandbox.ebanxpay.com/" fiserv.base_url = "https://cert.api.fiservapps.com/" forte.base_url = "https://sandbox.forte.net/api/v3" globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/" @@ -197,7 +195,6 @@ klarna.base_url = "https://api-na.playground.klarna.com/" mollie.base_url = "https://api.mollie.com/v2/" mollie.secondary_base_url = "https://api.cc.mollie.com/v1/" multisafepay.base_url = "https://testapi.multisafepay.com/" -netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netcetera-cloud-payment.ch" nexinets.base_url = "https://apitest.payengine.de/v1" nmi.base_url = "https://secure.nmi.com/" noon.base_url = "https://api-test.noonpayments.com/" @@ -229,7 +226,6 @@ volt.base_url = "https://api.sandbox.volt.io/" wise.base_url = "https://api.sandbox.transferwise.tech/" worldline.base_url = "https://eu.sandbox.api-ingenico.com/" worldpay.base_url = "https://try.access.worldpay.com/" -zsl.base_url = "https://api.sitoffalb.net/" zen.base_url = "https://api.zen-test.com/" zen.secondary_base_url = "https://secure.zen-test.com/" @@ -282,11 +278,10 @@ cards = [ "threedsecureio", "worldpay", "zen", - "zsl", ] # Scheduler settings provides a point to modify the behaviour of scheduler flow. -# It defines the streams/queues name and configuration as well as event selection variables +# It defines the the streams/queues name and configuration as well as event selection variables [scheduler] stream = "SCHEDULER_STREAM" graceful_shutdown_interval = 60000 # Specifies how much time to wait while re-attempting shutdown for a service (in milliseconds) @@ -354,7 +349,6 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" } 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" } -billwerk = {long_lived_token = false, payment_method = "card"} [temp_locker_enable_config] stripe = { payment_method = "bank_transfer" } @@ -387,7 +381,7 @@ 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,bankofamerica"} # Mandate supported payment method type and connector for card +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 @@ -395,8 +389,7 @@ bank_debit.becs = { connector_list = "gocardless" } # Mandat 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,bankofamerica" } -wallet.google_pay = { connector_list = "bankofamerica"} +wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon" } bank_redirect.giropay = { connector_list = "adyen,globalpay" } @@ -464,9 +457,6 @@ pix = { country = "BR", currency = "BRL" } red_compra = { country = "CL", currency = "CLP" } red_pagos = { country = "UY", currency = "UYU" } -[pm_filters.zsl] -local_bank_transfer = { country = "CN", currency = "CNY" } - [pm_filters.bankofamerica] credit = { currency = "USD" } debit = { currency = "USD" } @@ -487,7 +477,7 @@ debit = { currency = "USD" } [connector_customer] connector_list = "gocardless,stax,stripe" -payout_connector_list = "stripe,wise" +payout_connector_list = "wise" [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" @@ -575,7 +565,6 @@ connector_logs_topic = "topic" # Kafka topic to be used for connector api outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webhook events dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events -payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events # File storage configuration [file_storage] diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml index c725a8bd69d..8472076dc0c 100644 --- a/config/deployments/env_specific.toml +++ b/config/deployments/env_specific.toml @@ -80,7 +80,6 @@ connector_logs_topic = "topic" # Kafka topic to be used for connector api outgoing_webhook_logs_topic = "topic" # Kafka topic to be used for outgoing webhook events dispute_analytics_topic = "topic" # Kafka topic to be used for Dispute events audit_events_topic = "topic" # Kafka topic to be used for Payment Audit events -payout_analytics_topic = "topic" # Kafka topic to be used for Payouts and PayoutAttempt events # File storage configuration [file_storage] diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml index 8edfef7485e..10776c76678 100644 --- a/config/deployments/integration_test.toml +++ b/config/deployments/integration_test.toml @@ -1,4 +1,3 @@ -# Bank redirect configs for allowed banks [bank_config] eps.adyen.banks = "bank_austria,bawag_psk_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_tirol_bank_ag,posojilnica_bank_e_gen,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag" eps.stripe.banks = "arzte_und_apotheker_bank,austrian_anadi_bank_ag,bank_austria,bankhaus_carl_spangler,bankhaus_schelhammer_und_schattera_ag,bawag_psk_ag,bks_bank_ag,brull_kallmus_bank_ag,btv_vier_lander_bank,capital_bank_grawe_gruppe_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_alpeadriabank_international_ag,hypo_noe_lb_fur_niederosterreich_u_wien,hypo_oberosterreich_salzburg_steiermark,hypo_tirol_bank_ag,hypo_vorarlberg_bank_ag,hypo_bank_burgenland_aktiengesellschaft,marchfelder_bank,oberbank_ag,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag,vr_bank_braunau" @@ -12,10 +11,6 @@ online_banking_thailand.adyen.banks = "bangkok_bank,krungsri_bank,krung_thai_ban 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" przelewy24.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" -# Connector configuration, provided attributes will be used to fulfill API requests. -# Examples provided here are sandbox/test base urls, can be replaced by live or mock -# base urls based on your need. -# Note: These are not optional attributes. hyperswitch request can fail due to invalid/empty values. [connectors] aci.base_url = "https://eu-test.oppwa.com/" adyen.base_url = "https://checkout-test.adyen.com/" @@ -26,7 +21,6 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/" billwerk.base_url = "https://api.reepay.com/" -billwerk.secondary_base_url = "https://card.reepay.com/" bitpay.base_url = "https://test.bitpay.com" bluesnap.base_url = "https://sandbox.bluesnap.com/" bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" @@ -40,7 +34,6 @@ cryptopay.base_url = "https://business-sandbox.cryptopay.me" cybersource.base_url = "https://apitest.cybersource.com/" dlocal.base_url = "https://sandbox.dlocal.com/" dummyconnector.base_url = "http://localhost:8080/dummy-connector" -ebanx.base_url = "https://sandbox.ebanxpay.com/" fiserv.base_url = "https://cert.api.fiservapps.com/" forte.base_url = "https://sandbox.forte.net/api/v3" globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/" @@ -84,69 +77,63 @@ worldline.base_url = "https://eu.sandbox.api-ingenico.com/" worldpay.base_url = "https://try.access.worldpay.com/" zen.base_url = "https://api.zen-test.com/" zen.secondary_base_url = "https://secure.zen-test.com/" -zsl.base_url = "https://api.sitoffalb.net/" threedsecureio.base_url = "https://service.sandbox.3dsecure.io" -netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netcetera-cloud-payment.ch" [dummy_connector] -enabled = true # Whether dummy connector is enabled or not -assets_base_url = "https://app.hyperswitch.io/assets/TestProcessor/" # Base url for dummy connector assets -authorize_ttl = 36000 # Time to live for dummy connector authorize request in redis -default_return_url = "https://app.hyperswitch.io/" # Default return url when no return url is passed while payment -discord_invite_url = "https://discord.gg/wJZ7DVW8mm" # Discord invite url for hyperswitch -payment_complete_duration = 500 # Fake delay duration for dummy connector payment complete -payment_complete_tolerance = 100 # Fake delay tolerance for dummy connector payment complete -payment_duration = 1000 # Fake delay duration for dummy connector payment -payment_retrieve_duration = 500 # Fake delay duration for dummy connector payment sync -payment_retrieve_tolerance = 100 # Fake delay tolerance for dummy connector payment sync -payment_tolerance = 100 # Fake delay tolerance for dummy connector payment -payment_ttl = 172800 # Time to live for dummy connector payment in redis -refund_duration = 1000 # Fake delay duration for dummy connector refund -refund_retrieve_duration = 500 # Fake delay duration for dummy connector refund sync -refund_retrieve_tolerance = 100 # Fake delay tolerance for dummy connector refund sync -refund_tolerance = 100 # Fake delay tolerance for dummy connector refund -refund_ttl = 172800 # Time to live for dummy connector refund in redis -slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg" # Slack invite url for hyperswitch +enabled = true +assets_base_url = "https://app.hyperswitch.io/assets/TestProcessor/" +authorize_ttl = 36000 +default_return_url = "https://app.hyperswitch.io/" +discord_invite_url = "https://discord.gg/wJZ7DVW8mm" +payment_complete_duration = 500 +payment_complete_tolerance = 100 +payment_duration = 1000 +payment_retrieve_duration = 500 +payment_retrieve_tolerance = 100 +payment_tolerance = 100 +payment_ttl = 172800 +refund_duration = 1000 +refund_retrieve_duration = 500 +refund_retrieve_tolerance = 100 +refund_tolerance = 100 +refund_ttl = 172800 +slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg" [frm] enabled = true [connector_customer] connector_list = "gocardless,stax,stripe" -payout_connector_list = "stripe,wise" +payout_connector_list = "wise" [delayed_session_response] -connectors_with_delayed_session_response = "trustpay,payme" # List of connectors which have delayed session response +connectors_with_delayed_session_response = "trustpay,payme" [mandates.supported_payment_methods] -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 -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" # Mandate supported payment method type and connector for card -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" # Mandate supported payment method type and connector for card -pay_later.klarna.connector_list = "adyen" # Mandate supported payment method type and connector for pay_later -wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica" # Mandate supported payment method type and connector for wallets -wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica" # Mandate supported payment method type and connector for wallets -wallet.paypal.connector_list = "adyen" # Mandate supported payment method type and connector for wallets -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" # Mandate supported payment method type and connector for bank_redirect -bank_redirect.giropay.connector_list = "adyen,globalpay" # Mandate supported payment method type and connector for bank_redirect +bank_debit.ach.connector_list = "gocardless" +bank_debit.becs.connector_list = "gocardless" +bank_debit.sepa.connector_list = "gocardless" +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" +pay_later.klarna.connector_list = "adyen" +wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon" +wallet.google_pay.connector_list = "stripe,adyen,cybersource" +wallet.paypal.connector_list = "adyen" +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" } # 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 - -[network_transaction_id_supported_connectors] -connector_list = "stripe,adyen,cybersource" +card.credit ={connector_list ="cybersource"} +card.debit = {connector_list ="cybersource"} [multiple_api_version_supported_connectors] supported_connectors = "braintree" [payouts] -payout_eligibility = true # Defaults the eligibility of a payout method to true in case connector does not provide checks for payout eligibility +payout_eligibility = true -#Payment Method Filters Based on Country and Currency [pm_filters.default] affirm = { country = "US", currency = "USD" } afterpay_clearpay = { country = "US,CA,GB,AU,NZ,FR,ES", currency = "GBP" } @@ -286,9 +273,6 @@ pse = { country = "CO", currency = "COP" } red_compra = { country = "CL", currency = "CLP" } red_pagos = { country = "UY", currency = "UYU" } -[pm_filters.zsl] -local_bank_transfer = { country = "CN", currency = "CNY" } - [temp_locker_enable_config] bluesnap.payment_method = "card" nuvei.payment_method = "card" @@ -299,7 +283,6 @@ cybersource = { payment_method = "card" } nmi.payment_method = "card" payme.payment_method = "card" -#tokenization configuration which describe token lifetime and payment method for specific connector [tokenization] braintree = { long_lived_token = false, payment_method = "card" } checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" } @@ -309,13 +292,12 @@ payme = { long_lived_token = false, payment_method = "card" } square = { long_lived_token = false, payment_method = "card" } stax = { long_lived_token = true, payment_method = "card,bank_debit" } stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { list = "google_pay", type = "disable_only" } } -billwerk = {long_lived_token = false, payment_method = "card"} [webhooks] outgoing_enabled = true [webhook_source_verification_call] -connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call +connectors_with_webhook_source_verification_call = "paypal" [unmasked_headers] keys = "user-agent" diff --git a/config/deployments/production.toml b/config/deployments/production.toml index 12724485ea1..a6405e4a3b2 100644 --- a/config/deployments/production.toml +++ b/config/deployments/production.toml @@ -1,4 +1,3 @@ -# Bank redirect configs for allowed banks [bank_config] eps.adyen.banks = "bank_austria,bawag_psk_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_tirol_bank_ag,posojilnica_bank_e_gen,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag" eps.stripe.banks = "arzte_und_apotheker_bank,austrian_anadi_bank_ag,bank_austria,bankhaus_carl_spangler,bankhaus_schelhammer_und_schattera_ag,bawag_psk_ag,bks_bank_ag,brull_kallmus_bank_ag,btv_vier_lander_bank,capital_bank_grawe_gruppe_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_alpeadriabank_international_ag,hypo_noe_lb_fur_niederosterreich_u_wien,hypo_oberosterreich_salzburg_steiermark,hypo_tirol_bank_ag,hypo_vorarlberg_bank_ag,hypo_bank_burgenland_aktiengesellschaft,marchfelder_bank,oberbank_ag,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag,vr_bank_braunau" @@ -14,12 +13,8 @@ przelewy24.stripe.banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_peka [connector_customer] connector_list = "stax,stripe,gocardless" -payout_connector_list = "stripe,wise" +payout_connector_list = "wise" -# Connector configuration, provided attributes will be used to fulfill API requests. -# Examples provided here are sandbox/test base urls, can be replaced by live or mock -# base urls based on your need. -# Note: These are not optional attributes. hyperswitch request can fail due to invalid/empty values. [connectors] aci.base_url = "https://eu-test.oppwa.com/" adyen.base_url = "https://{{merchant_endpoint_prefix}}-checkout-live.adyenpayments.com/checkout/" @@ -30,7 +25,6 @@ authorizedotnet.base_url = "https://api.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bankofamerica.base_url = "https://api.merchant-services.bankofamerica.com/" billwerk.base_url = "https://api.reepay.com/" -billwerk.secondary_base_url = "https://card.reepay.com/" bitpay.base_url = "https://bitpay.com" bluesnap.base_url = "https://ws.bluesnap.com/" bluesnap.secondary_base_url = "https://pay.bluesnap.com/" @@ -44,7 +38,6 @@ cryptopay.base_url = "https://business.cryptopay.me/" cybersource.base_url = "https://api.cybersource.com/" dlocal.base_url = "https://sandbox.dlocal.com/" dummyconnector.base_url = "http://localhost:8080/dummy-connector" -ebanx.base_url = "https://sandbox.ebanxpay.com/" fiserv.base_url = "https://cert.api.fiservapps.com/" forte.base_url = "https://sandbox.forte.net/api/v3" globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/" @@ -88,61 +81,58 @@ worldline.base_url = "https://eu.sandbox.api-ingenico.com/" worldpay.base_url = "https://try.access.worldpay.com/" zen.base_url = "https://api.zen.com/" zen.secondary_base_url = "https://secure.zen.com/" -zsl.base_url = "https://api.sitoffalb.net/" threedsecureio.base_url = "https://service.3dsecure.io" -netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netcetera-cloud-payment.ch" [delayed_session_response] -connectors_with_delayed_session_response = "trustpay,payme" # List of connectors which have delayed session response +connectors_with_delayed_session_response = "trustpay,payme" [dummy_connector] -enabled = false # Whether dummy connector is enabled or not -assets_base_url = "https://app.hyperswitch.io/assets/TestProcessor/" # Base url for dummy connector assets -authorize_ttl = 36000 # Time to live for dummy connector authorize request in redis -default_return_url = "https://app.hyperswitch.io/" # Default return url when no return url is passed while payment -discord_invite_url = "https://discord.gg/wJZ7DVW8mm" # Discord invite url for hyperswitch -payment_complete_duration = 500 # Fake delay duration for dummy connector payment complete -payment_complete_tolerance = 100 # Fake delay tolerance for dummy connector payment complete -payment_duration = 1000 # Fake delay duration for dummy connector payment -payment_retrieve_duration = 500 # Fake delay duration for dummy connector payment sync -payment_retrieve_tolerance = 100 # Fake delay tolerance for dummy connector payment sync -payment_tolerance = 100 # Fake delay tolerance for dummy connector payment -payment_ttl = 172800 # Time to live for dummy connector payment in redis -refund_duration = 1000 # Fake delay duration for dummy connector refund -refund_retrieve_duration = 500 # Fake delay duration for dummy connector refund sync -refund_retrieve_tolerance = 100 # Fake delay tolerance for dummy connector refund sync -refund_tolerance = 100 # Fake delay tolerance for dummy connector refund -refund_ttl = 172800 # Time to live for dummy connector refund in redis -slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg" # Slack invite url for hyperswitch +assets_base_url = "https://app.hyperswitch.io/assets/TestProcessor/" +authorize_ttl = 36000 +default_return_url = "https://app.hyperswitch.io/" +discord_invite_url = "https://discord.gg/wJZ7DVW8mm" +enabled = false +payment_complete_duration = 500 +payment_complete_tolerance = 100 +payment_duration = 1000 +payment_retrieve_duration = 500 +payment_retrieve_tolerance = 100 +payment_tolerance = 100 +payment_ttl = 172800 +refund_duration = 1000 +refund_retrieve_duration = 500 +refund_retrieve_tolerance = 100 +refund_tolerance = 100 +refund_ttl = 172800 +slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg" [frm] enabled = false [mandates.supported_payment_methods] -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 -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" # Mandate supported payment method type and connector for card -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" # Mandate supported payment method type and connector for card -pay_later.klarna.connector_list = "adyen" # Mandate supported payment method type and connector for pay_later -wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica" # Mandate supported payment method type and connector for wallets -wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica" # Mandate supported payment method type and connector for wallets -wallet.paypal.connector_list = "adyen" # Mandate supported payment method type and connector for wallets -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" # Mandate supported payment method type and connector for bank_redirect -bank_redirect.giropay.connector_list = "adyen,globalpay" # Mandate supported payment method type and connector for bank_redirect +bank_debit.ach.connector_list = "gocardless" +bank_debit.becs.connector_list = "gocardless" +bank_debit.sepa.connector_list = "gocardless" +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" +pay_later.klarna.connector_list = "adyen" +wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon" +wallet.google_pay.connector_list = "stripe,adyen,cybersource" +wallet.paypal.connector_list = "adyen" +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" } # 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"} +card.debit = {connector_list ="cybersource"} [multiple_api_version_supported_connectors] supported_connectors = "braintree" [payouts] -payout_eligibility = true # Defaults the eligibility of a payout method to true in case connector does not provide checks for payout eligibility +payout_eligibility = true -#Payment Method Filters Based on Country and Currency [pm_filters.default] ach = { country = "US", currency = "USD" } affirm = { country = "US", currency = "USD" } @@ -297,9 +287,6 @@ pse = { country = "CO", currency = "COP" } red_compra = { country = "CL", currency = "CLP" } red_pagos = { country = "UY", currency = "UYU" } -[pm_filters.zsl] -local_bank_transfer = { country = "CN", currency = "CNY" } - [temp_locker_enable_config] bluesnap.payment_method = "card" nuvei.payment_method = "card" @@ -310,7 +297,6 @@ cybersource = { payment_method = "card" } nmi.payment_method = "card" payme.payment_method = "card" -#tokenization configuration which describe token lifetime and payment method for specific connector [tokenization] braintree = { long_lived_token = false, payment_method = "card" } checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" } @@ -320,13 +306,12 @@ payme = { long_lived_token = false, payment_method = "card" } square = { long_lived_token = false, payment_method = "card" } stax = { long_lived_token = true, payment_method = "card,bank_debit" } stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { list = "google_pay", type = "disable_only" } } -billwerk = {long_lived_token = false, payment_method = "card"} [webhooks] outgoing_enabled = true [webhook_source_verification_call] -connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call +connectors_with_webhook_source_verification_call = "paypal" [unmasked_headers] keys = "user-agent" diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml index 6c830c389a6..035c90af378 100644 --- a/config/deployments/sandbox.toml +++ b/config/deployments/sandbox.toml @@ -1,4 +1,3 @@ -# Bank redirect configs for allowed banks [bank_config] eps.adyen.banks = "bank_austria,bawag_psk_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_tirol_bank_ag,posojilnica_bank_e_gen,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag" eps.stripe.banks = "arzte_und_apotheker_bank,austrian_anadi_bank_ag,bank_austria,bankhaus_carl_spangler,bankhaus_schelhammer_und_schattera_ag,bawag_psk_ag,bks_bank_ag,brull_kallmus_bank_ag,btv_vier_lander_bank,capital_bank_grawe_gruppe_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_alpeadriabank_international_ag,hypo_noe_lb_fur_niederosterreich_u_wien,hypo_oberosterreich_salzburg_steiermark,hypo_tirol_bank_ag,hypo_vorarlberg_bank_ag,hypo_bank_burgenland_aktiengesellschaft,marchfelder_bank,oberbank_ag,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag,vr_bank_braunau" @@ -14,12 +13,8 @@ przelewy24.stripe.banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_peka [connector_customer] connector_list = "stax,stripe,gocardless" -payout_connector_list = "stripe,wise" +payout_connector_list = "wise" -# Connector configuration, provided attributes will be used to fulfill API requests. -# Examples provided here are sandbox/test base urls, can be replaced by live or mock -# base urls based on your need. -# Note: These are not optional attributes. hyperswitch request can fail due to invalid/empty values. [connectors] aci.base_url = "https://eu-test.oppwa.com/" adyen.base_url = "https://checkout-test.adyen.com/" @@ -30,7 +25,6 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/" billwerk.base_url = "https://api.reepay.com/" -billwerk.secondary_base_url = "https://card.reepay.com/" bitpay.base_url = "https://test.bitpay.com" bluesnap.base_url = "https://sandbox.bluesnap.com/" bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" @@ -44,7 +38,6 @@ cryptopay.base_url = "https://business-sandbox.cryptopay.me" cybersource.base_url = "https://apitest.cybersource.com/" dlocal.base_url = "https://sandbox.dlocal.com/" dummyconnector.base_url = "http://localhost:8080/dummy-connector" -ebanx.base_url = "https://sandbox.ebanxpay.com/" fiserv.base_url = "https://cert.api.fiservapps.com/" forte.base_url = "https://sandbox.forte.net/api/v3" globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/" @@ -88,64 +81,58 @@ worldline.base_url = "https://eu.sandbox.api-ingenico.com/" worldpay.base_url = "https://try.access.worldpay.com/" zen.base_url = "https://api.zen-test.com/" zen.secondary_base_url = "https://secure.zen-test.com/" -zsl.base_url = "https://api.sitoffalb.net/" threedsecureio.base_url = "https://service.sandbox.3dsecure.io" -netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netcetera-cloud-payment.ch" [delayed_session_response] -connectors_with_delayed_session_response = "trustpay,payme" # List of connectors which have delayed session response +connectors_with_delayed_session_response = "trustpay,payme" [dummy_connector] -enabled = true # Whether dummy connector is enabled or not -assets_base_url = "https://app.hyperswitch.io/assets/TestProcessor/" # Base url for dummy connector assets -authorize_ttl = 36000 # Time to live for dummy connector authorize request in redis -default_return_url = "https://app.hyperswitch.io/" # Default return url when no return url is passed while payment -discord_invite_url = "https://discord.gg/wJZ7DVW8mm" # Discord invite url for hyperswitch -payment_complete_duration = 500 # Fake delay duration for dummy connector payment complete -payment_complete_tolerance = 100 # Fake delay tolerance for dummy connector payment complete -payment_duration = 1000 # Fake delay duration for dummy connector payment -payment_retrieve_duration = 500 # Fake delay duration for dummy connector payment sync -payment_retrieve_tolerance = 100 # Fake delay tolerance for dummy connector payment sync -payment_tolerance = 100 # Fake delay tolerance for dummy connector payment -payment_ttl = 172800 # Time to live for dummy connector payment in redis -refund_duration = 1000 # Fake delay duration for dummy connector refund -refund_retrieve_duration = 500 # Fake delay duration for dummy connector refund sync -refund_retrieve_tolerance = 100 # Fake delay tolerance for dummy connector refund sync -refund_tolerance = 100 # Fake delay tolerance for dummy connector refund -refund_ttl = 172800 # Time to live for dummy connector refund in redis -slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg" # Slack invite url for hyperswitch +enabled = true +assets_base_url = "https://app.hyperswitch.io/assets/TestProcessor/" +authorize_ttl = 36000 +default_return_url = "https://app.hyperswitch.io/" +discord_invite_url = "https://discord.gg/wJZ7DVW8mm" +payment_complete_duration = 500 +payment_complete_tolerance = 100 +payment_duration = 1000 +payment_retrieve_duration = 500 +payment_retrieve_tolerance = 100 +payment_tolerance = 100 +payment_ttl = 172800 +refund_duration = 1000 +refund_retrieve_duration = 500 +refund_retrieve_tolerance = 100 +refund_tolerance = 100 +refund_ttl = 172800 +slack_invite_url = "https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2awm23agh-p_G5xNpziv6yAiedTkkqLg" [frm] enabled = true [mandates.supported_payment_methods] -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 -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" # Mandate supported payment method type and connector for card -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" # Mandate supported payment method type and connector for card -pay_later.klarna.connector_list = "adyen" # Mandate supported payment method type and connector for pay_later -wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica" # Mandate supported payment method type and connector for wallets -wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica" # Mandate supported payment method type and connector for wallets -wallet.paypal.connector_list = "adyen" # Mandate supported payment method type and connector for wallets -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" # Mandate supported payment method type and connector for bank_redirect -bank_redirect.giropay.connector_list = "adyen,globalpay" # Mandate supported payment method type and connector for bank_redirect +bank_debit.ach.connector_list = "gocardless" +bank_debit.becs.connector_list = "gocardless" +bank_debit.sepa.connector_list = "gocardless" +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" +pay_later.klarna.connector_list = "adyen" +wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon" +wallet.google_pay.connector_list = "stripe,adyen,cybersource" +wallet.paypal.connector_list = "adyen" +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" } # 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 - -[network_transaction_id_supported_connectors] -connector_list = "stripe,adyen,cybersource" +card.credit = { connector_list = "cybersource" } +card.debit = { connector_list = "cybersource" } [multiple_api_version_supported_connectors] supported_connectors = "braintree" [payouts] -payout_eligibility = true # Defaults the eligibility of a payout method to true in case connector does not provide checks for payout eligibility +payout_eligibility = true -#Payment Method Filters Based on Country and Currency [pm_filters.default] ach = { country = "US", currency = "USD" } affirm = { country = "US", currency = "USD" } @@ -301,8 +288,6 @@ pse = { country = "CO", currency = "COP" } red_compra = { country = "CL", currency = "CLP" } red_pagos = { country = "UY", currency = "UYU" } -[pm_filters.zsl] -local_bank_transfer = { country = "CN", currency = "CNY" } [temp_locker_enable_config] bluesnap.payment_method = "card" @@ -314,7 +299,6 @@ cybersource = { payment_method = "card" } nmi.payment_method = "card" payme.payment_method = "card" -#tokenization configuration which describe token lifetime and payment method for specific connector [tokenization] braintree = { long_lived_token = false, payment_method = "card" } checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" } @@ -324,13 +308,12 @@ payme = { long_lived_token = false, payment_method = "card" } square = { long_lived_token = false, payment_method = "card" } stax = { long_lived_token = true, payment_method = "card,bank_debit" } stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { list = "google_pay", type = "disable_only" } } -billwerk = {long_lived_token = false, payment_method = "card"} [webhooks] outgoing_enabled = true [webhook_source_verification_call] -connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call +connectors_with_webhook_source_verification_call = "paypal" [unmasked_headers] keys = "user-agent" diff --git a/config/deployments/scheduler/consumer.toml b/config/deployments/scheduler/consumer.toml index 0251b6a764f..cdd60552668 100644 --- a/config/deployments/scheduler/consumer.toml +++ b/config/deployments/scheduler/consumer.toml @@ -1,5 +1,5 @@ # Scheduler settings provides a point to modify the behaviour of scheduler flow. -# It defines the streams/queues name and configuration as well as event selection variables +# It defines the the streams/queues name and configuration as well as event selection variables [scheduler] consumer_group = "scheduler_group" graceful_shutdown_interval = 60000 # Specifies how much time to wait while re-attempting shutdown for a service (in milliseconds) diff --git a/config/deployments/scheduler/producer.toml b/config/deployments/scheduler/producer.toml index 0b16b8ffb8a..9cbaee96f03 100644 --- a/config/deployments/scheduler/producer.toml +++ b/config/deployments/scheduler/producer.toml @@ -1,5 +1,5 @@ # Scheduler settings provides a point to modify the behaviour of scheduler flow. -# It defines the streams/queues name and configuration as well as event selection variables +# It defines the the streams/queues name and configuration as well as event selection variables [scheduler] consumer_group = "scheduler_group" graceful_shutdown_interval = 60000 # Specifies how much time to wait while re-attempting shutdown for a service (in milliseconds) diff --git a/config/development.toml b/config/development.toml index 92e13f24fec..5c063acf2f7 100644 --- a/config/development.toml +++ b/config/development.toml @@ -108,7 +108,6 @@ cards = [ "cybersource", "dlocal", "dummyconnector", - "ebanx", "fiserv", "forte", "globalpay", @@ -118,7 +117,6 @@ cards = [ "iatapay", "mollie", "multisafepay", - "netcetera", "nexinets", "nmi", "noon", @@ -144,7 +142,6 @@ cards = [ "worldline", "worldpay", "zen", - "zsl", ] [refund] @@ -170,7 +167,6 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/" billwerk.base_url = "https://api.reepay.com/" -billwerk.secondary_base_url = "https://card.reepay.com/" bitpay.base_url = "https://test.bitpay.com" bluesnap.base_url = "https://sandbox.bluesnap.com/" bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" @@ -184,7 +180,6 @@ cryptopay.base_url = "https://business-sandbox.cryptopay.me" cybersource.base_url = "https://apitest.cybersource.com/" dlocal.base_url = "https://sandbox.dlocal.com/" dummyconnector.base_url = "http://localhost:8080/dummy-connector" -ebanx.base_url = "https://sandbox.ebanxpay.com/" fiserv.base_url = "https://cert.api.fiservapps.com/" forte.base_url = "https://sandbox.forte.net/api/v3" globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/" @@ -196,7 +191,6 @@ klarna.base_url = "https://api-na.playground.klarna.com/" mollie.base_url = "https://api.mollie.com/v2/" mollie.secondary_base_url = "https://api.cc.mollie.com/v1/" multisafepay.base_url = "https://testapi.multisafepay.com/" -netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netcetera-cloud-payment.ch" nexinets.base_url = "https://apitest.payengine.de/v1" nmi.base_url = "https://secure.nmi.com/" noon.base_url = "https://api-test.noonpayments.com/" @@ -230,7 +224,6 @@ volt.base_url = "https://api.sandbox.volt.io/" trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/" zen.base_url = "https://api.zen-test.com/" zen.secondary_base_url = "https://secure.zen-test.com/" -zsl.base_url = "https://api.sitoffalb.net/" [scheduler] stream = "SCHEDULER_STREAM" @@ -408,9 +401,6 @@ pix = { country = "BR", currency = "BRL" } red_compra = { country = "CL", currency = "CLP" } red_pagos = { country = "UY", currency = "UYU" } -[pm_filters.zsl] -local_bank_transfer = { country = "CN", currency = "CNY" } - [pm_filters.aci] credit = { not_available_flows = { capture_method = "manual" } } debit = { not_available_flows = { capture_method = "manual" } } @@ -460,7 +450,6 @@ 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" } -billwerk = { long_lived_token = false, payment_method = "card" } [temp_locker_enable_config] stripe = { payment_method = "bank_transfer" } @@ -474,7 +463,7 @@ payme = { payment_method = "card" } [connector_customer] connector_list = "gocardless,stax,stripe" -payout_connector_list = "stripe,wise" +payout_connector_list = "wise" [dummy_connector] enabled = true @@ -504,11 +493,11 @@ connectors_with_webhook_source_verification_call = "paypal" [mandates.supported_payment_methods] pay_later.klarna = { connector_list = "adyen" } -wallet.google_pay = { connector_list = "stripe,adyen,cybersource,bankofamerica" } -wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" } +wallet.google_pay = { connector_list = "stripe,adyen,cybersource" } +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,bankofamerica" } -card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" } +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" } @@ -520,9 +509,6 @@ bank_redirect.giropay = { connector_list = "adyen,globalpay" } card.credit = { connector_list = "cybersource" } card.debit = { connector_list = "cybersource" } -[network_transaction_id_supported_connectors] -connector_list = "stripe,adyen,cybersource" - [connector_request_reference_id_config] merchant_ids_send_payment_id_as_connector_request_id = [] @@ -568,7 +554,6 @@ connector_logs_topic = "hyperswitch-connector-api-events" outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events" dispute_analytics_topic = "hyperswitch-dispute-events" audit_events_topic = "hyperswitch-audit-events" -payout_analytics_topic = "hyperswitch-payout-events" [analytics] source = "sqlx" diff --git a/config/docker_compose.toml b/config/docker_compose.toml index d99ab473501..0e034f2e145 100644 --- a/config/docker_compose.toml +++ b/config/docker_compose.toml @@ -105,7 +105,6 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/" billwerk.base_url = "https://api.reepay.com/" -billwerk.secondary_base_url = "https://card.reepay.com/" bitpay.base_url = "https://test.bitpay.com" bluesnap.base_url = "https://sandbox.bluesnap.com/" bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" @@ -119,7 +118,6 @@ cryptopay.base_url = "https://business-sandbox.cryptopay.me" cybersource.base_url = "https://apitest.cybersource.com/" dlocal.base_url = "https://sandbox.dlocal.com/" dummyconnector.base_url = "http://localhost:8080/dummy-connector" -ebanx.base_url = "https://sandbox.ebanxpay.com/" fiserv.base_url = "https://cert.api.fiservapps.com/" forte.base_url = "https://sandbox.forte.net/api/v3" globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/" @@ -131,7 +129,6 @@ klarna.base_url = "https://api-na.playground.klarna.com/" mollie.base_url = "https://api.mollie.com/v2/" mollie.secondary_base_url = "https://api.cc.mollie.com/v1/" multisafepay.base_url = "https://testapi.multisafepay.com/" -netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netcetera-cloud-payment.ch" nexinets.base_url = "https://apitest.payengine.de/v1" nmi.base_url = "https://secure.nmi.com/" noon.base_url = "https://api-test.noonpayments.com/" @@ -165,7 +162,6 @@ worldline.base_url = "https://eu.sandbox.api-ingenico.com/" worldpay.base_url = "https://try.access.worldpay.com/" zen.base_url = "https://api.zen-test.com/" zen.secondary_base_url = "https://secure.zen-test.com/" -zsl.base_url = "https://api.sitoffalb.net/" [pm_filters.default] @@ -192,7 +188,6 @@ cards = [ "cybersource", "dlocal", "dummyconnector", - "ebanx", "fiserv", "forte", "globalpay", @@ -202,7 +197,6 @@ cards = [ "iatapay", "mollie", "multisafepay", - "netcetera", "nexinets", "nmi", "noon", @@ -228,7 +222,6 @@ cards = [ "worldline", "worldpay", "zen", - "zsl" ] [delayed_session_response] @@ -258,7 +251,6 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" } 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" } -billwerk = {long_lived_token = false, payment_method = "card"} [temp_locker_enable_config] stripe = { payment_method = "bank_transfer" } @@ -339,9 +331,6 @@ pix = { country = "BR", currency = "BRL" } red_compra = { country = "CL", currency = "CLP" } red_pagos = { country = "UY", currency = "UYU" } -[pm_filters.zsl] -local_bank_transfer = { country = "CN", currency = "CNY" } - [pm_filters.stripe] cashapp = { country = "US", currency = "USD" } @@ -374,11 +363,11 @@ adyen = { banks = "aib,bank_of_scotland,danske_bank,first_direct,first_trust,hal [mandates.supported_payment_methods] pay_later.klarna = { connector_list = "adyen" } -wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica" } -wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica" } +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,bankofamerica" } -card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica" } +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" } @@ -390,12 +379,9 @@ bank_redirect.giropay = { connector_list = "adyen,globalpay" } card.credit = { connector_list = "cybersource" } card.debit = { connector_list = "cybersource" } -[network_transaction_id_supported_connectors] -connector_list = "stripe,adyen,cybersource" - [connector_customer] connector_list = "gocardless,stax,stripe" -payout_connector_list = "stripe,wise" +payout_connector_list = "wise" [multiple_api_version_supported_connectors] supported_connectors = "braintree" @@ -418,7 +404,6 @@ connector_logs_topic = "hyperswitch-connector-api-events" outgoing_webhook_logs_topic = "hyperswitch-outgoing-webhook-events" dispute_analytics_topic = "hyperswitch-dispute-events" audit_events_topic = "hyperswitch-audit-events" -payout_analytics_topic = "hyperswitch-payout-events" [analytics] source = "sqlx" diff --git a/config/tempo.yaml b/config/tempo.yaml index 76dd45c497a..679d6431f5b 100644 --- a/config/tempo.yaml +++ b/config/tempo.yaml @@ -27,7 +27,7 @@ storage: v2_index_downsample_bytes: 1000 # number of bytes per index record v2_encoding: zstd # block encoding/compression. options: none, gzip, lz4-64k, lz4-256k, lz4-1M, lz4, snappy, zstd, s2 wal: - path: /tmp/tempo/wal # where to store the wal locally + path: /tmp/tempo/wal # where to store the the wal locally v2_encoding: snappy # wal encoding/compression. options: none, gzip, lz4-64k, lz4-256k, lz4-1M, lz4, snappy, zstd, s2 local: path: /tmp/tempo/blocks diff --git a/connector-template/test.rs b/connector-template/test.rs index f408070fe3c..7b093ddb6ef 100644 --- a/connector-template/test.rs +++ b/connector-template/test.rs @@ -281,7 +281,7 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { diff --git a/crates/analytics/Cargo.toml b/crates/analytics/Cargo.toml index 6ca0c1663a7..e9df6435b90 100644 --- a/crates/analytics/Cargo.toml +++ b/crates/analytics/Cargo.toml @@ -2,9 +2,7 @@ name = "analytics" version = "0.1.0" description = "Analytics / Reports / Search related functionality" -edition.workspace = true -rust-version.workspace = true -license.workspace = true +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -17,26 +15,34 @@ 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"] } +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"] } -hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false } #Third Party dependencies -actix-web = "4.5.1" -async-trait = "0.1.79" -aws-config = { version = "1.1.9", features = ["behavior-version-latest"] } -aws-sdk-lambda = { version = "1.18.0" } -aws-smithy-types = { version = "1.1.8" } +actix-web = "4.3.1" +async-trait = "0.1.68" +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.4.1" -futures = "0.3.30" +futures = "0.3.28" opensearch = { version = "2.2.0", features = ["aws-auth"] } -once_cell = "1.19.0" -reqwest = { version = "0.11.27", features = ["serde_json"] } -serde = { version = "1.0.197", features = ["derive", "rc"] } -serde_json = "1.0.115" -sqlx = { version = "0.7.3", features = ["postgres", "runtime-tokio", "runtime-tokio-native-tls", "time", "bigdecimal"] } -strum = { version = "0.26.2", features = ["derive"] } -thiserror = "1.0.58" -time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] } -tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } +once_cell = "1.18.0" +reqwest = { version = "0.12.2", features = ["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", +] } +strum = { version = "0.25.0", features = ["derive"] } +thiserror = "1.0.43" +time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] } +tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] } diff --git a/crates/analytics/docs/clickhouse/scripts/payouts.sql b/crates/analytics/docs/clickhouse/scripts/payouts.sql deleted file mode 100644 index 68d109f7b9b..00000000000 --- a/crates/analytics/docs/clickhouse/scripts/payouts.sql +++ /dev/null @@ -1,146 +0,0 @@ -CREATE TABLE payout_queue ( - `payout_id` String, - `payout_attempt_id` String, - `merchant_id` String, - `customer_id` String, - `address_id` String, - `profile_id` String, - `payout_method_id` Nullable(String), - `payout_type` LowCardinality(String), - `amount` UInt64, - `destination_currency` LowCardinality(String), - `source_currency` LowCardinality(String), - `description` Nullable(String), - `recurring` Bool, - `auto_fulfill` Bool, - `return_url` Nullable(String), - `entity_type` LowCardinality(String), - `metadata` Nullable(String), - `created_at` DateTime CODEC(T64, LZ4), - `last_modified_at` DateTime CODEC(T64, LZ4), - `attempt_count` UInt16, - `status` LowCardinality(String), - `connector` Nullable(String), - `connector_payout_id` String, - `is_eligible` Nullable(Bool), - `error_message` Nullable(String), - `error_code` Nullable(String), - `business_country` Nullable(LowCardinality(String)), - `business_label` Nullable(String), - `merchant_connector_id` Nullable(String), - `sign_flag` Int8 -) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092', -kafka_topic_list = 'hyperswitch-payout-events', -kafka_group_name = 'hyper-c1', -kafka_format = 'JSONEachRow', -kafka_handle_error_mode = 'stream'; - -CREATE TABLE payout ( - `payout_id` String, - `payout_attempt_id` String, - `merchant_id` String, - `customer_id` String, - `address_id` String, - `profile_id` String, - `payout_method_id` String, - `payout_type` LowCardinality(String), - `amount` UInt64, - `destination_currency` LowCardinality(String), - `source_currency` LowCardinality(String), - `description` Nullable(String), - `recurring` Bool, - `auto_fulfill` Bool, - `return_url` Nullable(String), - `entity_type` LowCardinality(String), - `metadata` Nullable(String), - `created_at` DateTime DEFAULT now() CODEC(T64, LZ4), - `last_modified_at` DateTime DEFAULT now() CODEC(T64, LZ4), - `attempt_count` UInt16, - `status` LowCardinality(String), - `connector` Nullable(String), - `connector_payout_id` String, - `is_eligible` Nullable(Bool), - `error_message` Nullable(String), - `error_code` Nullable(String), - `business_country` Nullable(LowCardinality(String)), - `business_label` Nullable(String), - `merchant_connector_id` Nullable(String), - `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4), - `sign_flag` Int8, - INDEX payoutTypeIndex payout_type TYPE bloom_filter GRANULARITY 1, - INDEX destinationCurrencyIndex destination_currency TYPE bloom_filter GRANULARITY 1, - INDEX sourceCurrencyIndex source_currency TYPE bloom_filter GRANULARITY 1, - INDEX entityTypeIndex entity_type TYPE bloom_filter GRANULARITY 1, - INDEX statusIndex status TYPE bloom_filter GRANULARITY 1, - INDEX businessCountryIndex business_country TYPE bloom_filter GRANULARITY 1 -) ENGINE = CollapsingMergeTree(sign_flag) PARTITION BY toStartOfDay(created_at) -ORDER BY - (created_at, merchant_id, payout_id) TTL created_at + toIntervalMonth(6); - -CREATE MATERIALIZED VIEW kafka_parse_payout TO payout ( - `payout_id` String, - `payout_attempt_id` String, - `merchant_id` String, - `customer_id` String, - `address_id` String, - `profile_id` String, - `payout_method_id` String, - `payout_type` LowCardinality(String), - `amount` UInt64, - `destination_currency` LowCardinality(String), - `source_currency` LowCardinality(String), - `description` Nullable(String), - `recurring` Bool, - `auto_fulfill` Bool, - `return_url` Nullable(String), - `entity_type` LowCardinality(String), - `metadata` Nullable(String), - `created_at` DateTime64(3), - `last_modified_at` DateTime64(3), - `attempt_count` UInt16, - `status` LowCardinality(String), - `connector` Nullable(String), - `connector_payout_id` String, - `is_eligible` Nullable(Bool), - `error_message` Nullable(String), - `error_code` Nullable(String), - `business_country` Nullable(LowCardinality(String)), - `business_label` Nullable(String), - `merchant_connector_id` Nullable(String), - `inserted_at` DateTime64(3), - `sign_flag` Int8 -) AS -SELECT - payout_id, - payout_attempt_id, - merchant_id, - customer_id, - address_id, - profile_id, - payout_method_id, - payout_type, - amount, - destination_currency, - source_currency, - description, - recurring, - auto_fulfill, - return_url, - entity_type, - metadata, - created_at, - last_modified_at, - attempt_count, - status, - connector, - connector_payout_id, - is_eligible, - error_message, - error_code, - business_country, - business_label, - merchant_connector_id, - now() as inserted_at, - sign_flag -FROM - payout_queue; \ No newline at end of file diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs index 2a7075a0f29..3b3cbc9c039 100644 --- a/crates/analytics/src/lib.rs +++ b/crates/analytics/src/lib.rs @@ -10,7 +10,6 @@ pub mod refunds; pub mod api_event; pub mod connector_events; pub mod health_check; -pub mod opensearch; pub mod outgoing_webhook_event; pub mod sdk_events; pub mod search; @@ -48,10 +47,8 @@ use error_stack::report; use router_env::{ logger, tracing::{self, instrument}, - types::FlowMetric, }; use storage_impl::config::Database; -use strum::Display; use self::{ payments::{ @@ -669,32 +666,43 @@ pub struct ReportConfig { pub region: String, } -/// Analytics Flow routes Enums -/// Info - Dimensions and filters available for the domain -/// Filters - Set of values present for the dimension -/// Metrics - Analytical data on dimensions and metrics -#[derive(Debug, Display, Clone, PartialEq, Eq)] -pub enum AnalyticsFlow { - GetInfo, - GetPaymentMetrics, - GetRefundsMetrics, - GetSdkMetrics, - GetPaymentFilters, - GetRefundFilters, - GetSdkEventFilters, - GetApiEvents, - GetSdkEvents, - GeneratePaymentReport, - GenerateDisputeReport, - GenerateRefundReport, - GetApiEventMetrics, - GetApiEventFilters, - GetConnectorEvents, - GetOutgoingWebhookEvents, - GetGlobalSearchResults, - GetSearchResults, - GetDisputeFilters, - GetDisputeMetrics, +#[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, + pub disputes: String, +} + +#[derive(Clone, Debug, serde::Deserialize)] +pub struct OpensearchConfig { + host: String, + auth: OpensearchAuth, + indexes: OpensearchIndexes, } -impl FlowMetric for AnalyticsFlow {} +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(), + disputes: "hyperswitch-dispute-events".to_string(), + }, + } + } +} diff --git a/crates/analytics/src/opensearch.rs b/crates/analytics/src/opensearch.rs deleted file mode 100644 index 7b19ba0ed06..00000000000 --- a/crates/analytics/src/opensearch.rs +++ /dev/null @@ -1,397 +0,0 @@ -use api_models::{ - analytics::search::SearchIndex, - errors::types::{ApiError, ApiErrorResponse}, -}; -use aws_config::{self, meta::region::RegionProviderChain, Region}; -use common_utils::errors::{CustomResult, ErrorSwitch}; -use error_stack::ResultExt; -use hyperswitch_domain_models::errors::{StorageError, StorageResult}; -use opensearch::{ - auth::Credentials, - cert::CertificateValidation, - cluster::{Cluster, ClusterHealthParts}, - http::{ - request::JsonBody, - response::Response, - transport::{SingleNodeConnectionPool, Transport, TransportBuilder}, - Url, - }, - MsearchParts, OpenSearch, SearchParts, -}; -use serde_json::{json, Value}; -use storage_impl::errors::ApplicationError; -use strum::IntoEnumIterator; - -use super::{health_check::HealthCheck, query::QueryResult, types::QueryExecutionError}; -use crate::query::QueryBuildingError; - -#[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, - pub disputes: 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(), - disputes: "hyperswitch-dispute-events".to_string(), - }, - } - } -} - -#[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, - #[error("Opensearch query building error")] - QueryBuildingError, -} - -impl ErrorSwitch for QueryBuildingError { - fn switch(&self) -> OpenSearchError { - OpenSearchError::QueryBuildingError - } -} - -impl ErrorSwitch for OpenSearchError { - fn switch(&self) -> ApiErrorResponse { - match self { - Self::ConnectionError => ApiErrorResponse::InternalServerError(ApiError::new( - "IR", - 0, - "Connection error", - None, - )), - Self::ResponseNotOK(response) => ApiErrorResponse::InternalServerError(ApiError::new( - "IR", - 0, - format!("Something went wrong {}", response), - None, - )), - Self::ResponseError => ApiErrorResponse::InternalServerError(ApiError::new( - "IR", - 0, - "Something went wrong", - None, - )), - Self::QueryBuildingError => ApiErrorResponse::InternalServerError(ApiError::new( - "IR", - 0, - "Query building error", - None, - )), - } - } -} - -#[derive(Clone, Debug)] -pub struct OpenSearchClient { - pub client: OpenSearch, - pub transport: Transport, - pub indexes: OpenSearchIndexes, -} - -impl OpenSearchClient { - pub async fn create(conf: &OpenSearchConfig) -> CustomResult { - let url = Url::parse(&conf.host).map_err(|_| OpenSearchError::ConnectionError)?; - let transport = match &conf.auth { - OpenSearchAuth::Basic { username, password } => { - let credentials = Credentials::Basic(username.clone(), password.clone()); - 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.clone())); - 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(Self { - transport: transport.clone(), - client: OpenSearch::new(transport), - indexes: conf.indexes.clone(), - }) - } - - pub fn search_index_to_opensearch_index(&self, index: SearchIndex) -> String { - match index { - SearchIndex::PaymentAttempts => self.indexes.payment_attempts.clone(), - SearchIndex::PaymentIntents => self.indexes.payment_intents.clone(), - SearchIndex::Refunds => self.indexes.refunds.clone(), - SearchIndex::Disputes => self.indexes.disputes.clone(), - } - } - - pub async fn execute( - &self, - query_builder: OpenSearchQueryBuilder, - ) -> CustomResult { - match query_builder.query_type { - OpenSearchQuery::Msearch => { - let search_indexes = SearchIndex::iter(); - - let payload = query_builder - .construct_payload(search_indexes.clone().collect()) - .change_context(OpenSearchError::QueryBuildingError)?; - - let payload_with_indexes = payload.into_iter().zip(search_indexes).fold( - Vec::new(), - |mut payload_with_indexes, (index_hit, index)| { - payload_with_indexes.push( - json!({"index": self.search_index_to_opensearch_index(index)}).into(), - ); - payload_with_indexes.push(JsonBody::new(index_hit.clone())); - payload_with_indexes - }, - ); - - self.client - .msearch(MsearchParts::None) - .body(payload_with_indexes) - .send() - .await - .change_context(OpenSearchError::ResponseError) - } - OpenSearchQuery::Search(index) => { - let payload = query_builder - .clone() - .construct_payload(vec![index]) - .change_context(OpenSearchError::QueryBuildingError)?; - - let final_payload = payload.first().unwrap_or(&Value::Null); - - self.client - .search(SearchParts::Index(&[ - &self.search_index_to_opensearch_index(index) - ])) - .from(query_builder.offset.unwrap_or(0)) - .size(query_builder.count.unwrap_or(10)) - .body(final_payload) - .send() - .await - .change_context(OpenSearchError::ResponseError) - } - } - } -} - -#[async_trait::async_trait] -impl HealthCheck for OpenSearchClient { - async fn deep_health_check(&self) -> CustomResult<(), QueryExecutionError> { - let health = Cluster::new(&self.transport) - .health(ClusterHealthParts::None) - .send() - .await - .change_context(QueryExecutionError::DatabaseError)? - .json::() - .await - .change_context(QueryExecutionError::DatabaseError)?; - - if health.status != OpenSearchHealthStatus::Red { - Ok(()) - } else { - Err(QueryExecutionError::DatabaseError.into()) - } - } -} - -impl OpenSearchIndexes { - pub fn validate(&self) -> Result<(), ApplicationError> { - use common_utils::{ext_traits::ConfigExt, fp_utils::when}; - - when(self.payment_attempts.is_default_or_empty(), || { - Err(ApplicationError::InvalidConfigurationValueError( - "Opensearch Payment Attempts index must not be empty".into(), - )) - })?; - - when(self.payment_intents.is_default_or_empty(), || { - Err(ApplicationError::InvalidConfigurationValueError( - "Opensearch Payment Intents index must not be empty".into(), - )) - })?; - - when(self.refunds.is_default_or_empty(), || { - Err(ApplicationError::InvalidConfigurationValueError( - "Opensearch Refunds index must not be empty".into(), - )) - })?; - - when(self.disputes.is_default_or_empty(), || { - Err(ApplicationError::InvalidConfigurationValueError( - "Opensearch Disputes index must not be empty".into(), - )) - })?; - - Ok(()) - } -} - -impl OpenSearchAuth { - pub fn validate(&self) -> Result<(), ApplicationError> { - use common_utils::{ext_traits::ConfigExt, fp_utils::when}; - - match self { - Self::Basic { username, password } => { - when(username.is_default_or_empty(), || { - Err(ApplicationError::InvalidConfigurationValueError( - "Opensearch Basic auth username must not be empty".into(), - )) - })?; - - when(password.is_default_or_empty(), || { - Err(ApplicationError::InvalidConfigurationValueError( - "Opensearch Basic auth password must not be empty".into(), - )) - })?; - } - - Self::Aws { region } => { - when(region.is_default_or_empty(), || { - Err(ApplicationError::InvalidConfigurationValueError( - "Opensearch Aws auth region must not be empty".into(), - )) - })?; - } - }; - - Ok(()) - } -} - -impl OpenSearchConfig { - pub async fn get_opensearch_client(&self) -> StorageResult { - Ok(OpenSearchClient::create(self) - .await - .map_err(|_| StorageError::InitializationError)?) - } - - pub fn validate(&self) -> Result<(), ApplicationError> { - use common_utils::{ext_traits::ConfigExt, fp_utils::when}; - - when(self.host.is_default_or_empty(), || { - Err(ApplicationError::InvalidConfigurationValueError( - "Opensearch host must not be empty".into(), - )) - })?; - - self.indexes.validate()?; - - self.auth.validate()?; - - Ok(()) - } -} -#[derive(Debug, serde::Deserialize, PartialEq)] -#[serde(rename_all = "lowercase")] -pub enum OpenSearchHealthStatus { - Red, - Green, - Yellow, -} - -#[derive(Debug, serde::Deserialize)] -pub struct OpenSearchHealth { - pub status: OpenSearchHealthStatus, -} - -#[derive(Debug, Clone)] -pub enum OpenSearchQuery { - Msearch, - Search(SearchIndex), -} - -#[derive(Debug, Clone)] -pub struct OpenSearchQueryBuilder { - pub query_type: OpenSearchQuery, - pub query: String, - pub offset: Option, - pub count: Option, - pub filters: Vec<(String, String)>, -} - -impl OpenSearchQueryBuilder { - pub fn new(query_type: OpenSearchQuery, query: String) -> Self { - Self { - query_type, - query, - offset: Default::default(), - count: Default::default(), - filters: Default::default(), - } - } - - pub fn set_offset_n_count(&mut self, offset: i64, count: i64) -> QueryResult<()> { - self.offset = Some(offset); - self.count = Some(count); - Ok(()) - } - - pub fn add_filter_clause(&mut self, lhs: String, rhs: String) -> QueryResult<()> { - self.filters.push((lhs, rhs)); - Ok(()) - } - - pub fn construct_payload(&self, indexes: Vec) -> QueryResult> { - let mut query = - vec![json!({"multi_match": {"type": "phrase", "query": self.query, "lenient": true}})]; - - let mut filters = self - .filters - .iter() - .map(|(k, v)| json!({"match_phrase" : {k : v}})) - .collect::>(); - - query.append(&mut filters); - - // TODO add index specific filters - Ok(indexes - .iter() - .map(|_index| json!({"query": {"bool": {"filter": query}}})) - .collect::>()) - } -} diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs index d5296152076..a7ef0d993e8 100644 --- a/crates/analytics/src/query.rs +++ b/crates/analytics/src/query.rs @@ -388,7 +388,6 @@ impl_to_sql_for_to_string!(&DisputeDimensions, DisputeDimensions, DisputeStage); #[derive(Debug)] pub enum FilterTypes { Equal, - NotEqual, EqualBool, In, Gte, @@ -403,7 +402,6 @@ pub fn filter_type_to_sql(l: &String, op: &FilterTypes, r: &String) -> String { match op { FilterTypes::EqualBool => format!("{l} = {r}"), FilterTypes::Equal => format!("{l} = '{r}'"), - FilterTypes::NotEqual => format!("{l} != '{r}'"), FilterTypes::In => format!("{l} IN ({r})"), FilterTypes::Gte => format!("{l} >= '{r}'"), FilterTypes::Gt => format!("{l} > {r}"), diff --git a/crates/analytics/src/sdk_events/accumulator.rs b/crates/analytics/src/sdk_events/accumulator.rs index fc90ae48eb3..ab9e9309434 100644 --- a/crates/analytics/src/sdk_events/accumulator.rs +++ b/crates/analytics/src/sdk_events/accumulator.rs @@ -6,19 +6,13 @@ use super::metrics::SdkEventMetricRow; #[derive(Debug, Default)] pub struct SdkEventMetricsAccumulator { pub payment_attempts: CountAccumulator, + pub payment_success: CountAccumulator, pub payment_methods_call_count: CountAccumulator, pub average_payment_time: AverageAccumulator, pub sdk_initiated_count: CountAccumulator, pub sdk_rendered_count: CountAccumulator, pub payment_method_selected_count: CountAccumulator, pub payment_data_filled_count: CountAccumulator, - pub three_ds_method_invoked_count: CountAccumulator, - pub three_ds_method_skipped_count: CountAccumulator, - pub three_ds_method_successful_count: CountAccumulator, - pub three_ds_method_unsuccessful_count: CountAccumulator, - pub authentication_unsuccessful_count: CountAccumulator, - pub three_ds_challenge_flow_count: CountAccumulator, - pub three_ds_frictionless_flow_count: CountAccumulator, } #[derive(Debug, Default)] @@ -92,19 +86,13 @@ impl SdkEventMetricsAccumulator { pub fn collect(self) -> SdkEventMetricsBucketValue { SdkEventMetricsBucketValue { payment_attempts: self.payment_attempts.collect(), + payment_success_count: self.payment_success.collect(), payment_methods_call_count: self.payment_methods_call_count.collect(), average_payment_time: self.average_payment_time.collect(), sdk_initiated_count: self.sdk_initiated_count.collect(), sdk_rendered_count: self.sdk_rendered_count.collect(), payment_method_selected_count: self.payment_method_selected_count.collect(), payment_data_filled_count: self.payment_data_filled_count.collect(), - three_ds_method_invoked_count: self.three_ds_method_invoked_count.collect(), - three_ds_method_skipped_count: self.three_ds_method_skipped_count.collect(), - three_ds_method_successful_count: self.three_ds_method_successful_count.collect(), - three_ds_method_unsuccessful_count: self.three_ds_method_unsuccessful_count.collect(), - authentication_unsuccessful_count: self.authentication_unsuccessful_count.collect(), - three_ds_challenge_flow_count: self.three_ds_challenge_flow_count.collect(), - three_ds_frictionless_flow_count: self.three_ds_frictionless_flow_count.collect(), } } } diff --git a/crates/analytics/src/sdk_events/core.rs b/crates/analytics/src/sdk_events/core.rs index 2ffc7f1aed6..a5d2900e54d 100644 --- a/crates/analytics/src/sdk_events/core.rs +++ b/crates/analytics/src/sdk_events/core.rs @@ -88,6 +88,9 @@ pub async fn get_metrics( SdkEventMetrics::PaymentAttempts => { metrics_builder.payment_attempts.add_metrics_bucket(&value) } + SdkEventMetrics::PaymentSuccessCount => { + metrics_builder.payment_success.add_metrics_bucket(&value) + } SdkEventMetrics::PaymentMethodsCallCount => metrics_builder .payment_methods_call_count .add_metrics_bucket(&value), @@ -106,27 +109,6 @@ pub async fn get_metrics( SdkEventMetrics::AveragePaymentTime => metrics_builder .average_payment_time .add_metrics_bucket(&value), - SdkEventMetrics::ThreeDsMethodInvokedCount => metrics_builder - .three_ds_method_invoked_count - .add_metrics_bucket(&value), - SdkEventMetrics::ThreeDsMethodSkippedCount => metrics_builder - .three_ds_method_skipped_count - .add_metrics_bucket(&value), - SdkEventMetrics::ThreeDsMethodSuccessfulCount => metrics_builder - .three_ds_method_successful_count - .add_metrics_bucket(&value), - SdkEventMetrics::ThreeDsMethodUnsuccessfulCount => metrics_builder - .three_ds_method_unsuccessful_count - .add_metrics_bucket(&value), - SdkEventMetrics::AuthenticationUnsuccessfulCount => metrics_builder - .authentication_unsuccessful_count - .add_metrics_bucket(&value), - SdkEventMetrics::ThreeDsChallengeFlowCount => metrics_builder - .three_ds_challenge_flow_count - .add_metrics_bucket(&value), - SdkEventMetrics::ThreeDsFrictionlessFlowCount => metrics_builder - .three_ds_frictionless_flow_count - .add_metrics_bucket(&value), } } diff --git a/crates/analytics/src/sdk_events/metrics.rs b/crates/analytics/src/sdk_events/metrics.rs index 70d29a2eb63..354d2270d18 100644 --- a/crates/analytics/src/sdk_events/metrics.rs +++ b/crates/analytics/src/sdk_events/metrics.rs @@ -11,35 +11,23 @@ use crate::{ types::{AnalyticsCollection, AnalyticsDataSource, LoadRow, MetricsResult}, }; -mod authentication_unsuccessful_count; mod average_payment_time; mod payment_attempts; mod payment_data_filled_count; mod payment_method_selected_count; mod payment_methods_call_count; +mod payment_success_count; mod sdk_initiated_count; mod sdk_rendered_count; -mod three_ds_challenge_flow_count; -mod three_ds_frictionless_flow_count; -mod three_ds_method_invoked_count; -mod three_ds_method_skipped_count; -mod three_ds_method_successful_count; -mod three_ds_method_unsuccessful_count; -use authentication_unsuccessful_count::AuthenticationUnsuccessfulCount; use average_payment_time::AveragePaymentTime; use payment_attempts::PaymentAttempts; use payment_data_filled_count::PaymentDataFilledCount; use payment_method_selected_count::PaymentMethodSelectedCount; use payment_methods_call_count::PaymentMethodsCallCount; +use payment_success_count::PaymentSuccessCount; use sdk_initiated_count::SdkInitiatedCount; use sdk_rendered_count::SdkRenderedCount; -use three_ds_challenge_flow_count::ThreeDsChallengeFlowCount; -use three_ds_frictionless_flow_count::ThreeDsFrictionlessFlowCount; -use three_ds_method_invoked_count::ThreeDsMethodInvokedCount; -use three_ds_method_skipped_count::ThreeDsMethodSkippedCount; -use three_ds_method_successful_count::ThreeDsMethodSuccessfulCount; -use three_ds_method_unsuccessful_count::ThreeDsMethodUnsuccessfulCount; #[derive(Debug, PartialEq, Eq, serde::Deserialize)] pub struct SdkEventMetricRow { @@ -104,6 +92,18 @@ where ) .await } + Self::PaymentSuccessCount => { + PaymentSuccessCount + .load_metrics( + dimensions, + publishable_key, + filters, + granularity, + time_range, + pool, + ) + .await + } Self::PaymentMethodsCallCount => { PaymentMethodsCallCount .load_metrics( @@ -176,90 +176,6 @@ where ) .await } - Self::ThreeDsMethodSkippedCount => { - ThreeDsMethodSkippedCount - .load_metrics( - dimensions, - publishable_key, - filters, - granularity, - time_range, - pool, - ) - .await - } - Self::ThreeDsMethodInvokedCount => { - ThreeDsMethodInvokedCount - .load_metrics( - dimensions, - publishable_key, - filters, - granularity, - time_range, - pool, - ) - .await - } - Self::ThreeDsMethodSuccessfulCount => { - ThreeDsMethodSuccessfulCount - .load_metrics( - dimensions, - publishable_key, - filters, - granularity, - time_range, - pool, - ) - .await - } - Self::ThreeDsMethodUnsuccessfulCount => { - ThreeDsMethodUnsuccessfulCount - .load_metrics( - dimensions, - publishable_key, - filters, - granularity, - time_range, - pool, - ) - .await - } - Self::AuthenticationUnsuccessfulCount => { - AuthenticationUnsuccessfulCount - .load_metrics( - dimensions, - publishable_key, - filters, - granularity, - time_range, - pool, - ) - .await - } - Self::ThreeDsChallengeFlowCount => { - ThreeDsChallengeFlowCount - .load_metrics( - dimensions, - publishable_key, - filters, - granularity, - time_range, - pool, - ) - .await - } - Self::ThreeDsFrictionlessFlowCount => { - ThreeDsFrictionlessFlowCount - .load_metrics( - dimensions, - publishable_key, - filters, - granularity, - time_range, - pool, - ) - .await - } } } } diff --git a/crates/analytics/src/sdk_events/metrics/authentication_unsuccessful_count.rs b/crates/analytics/src/sdk_events/metrics/authentication_unsuccessful_count.rs deleted file mode 100644 index c2fe777d827..00000000000 --- a/crates/analytics/src/sdk_events/metrics/authentication_unsuccessful_count.rs +++ /dev/null @@ -1,122 +0,0 @@ -use api_models::analytics::{ - sdk_events::{ - SdkEventDimensions, SdkEventFilters, SdkEventMetricsBucketIdentifier, SdkEventNames, - }, - Granularity, TimeRange, -}; -use common_utils::errors::ReportSwitchExt; -use error_stack::ResultExt; -use time::PrimitiveDateTime; - -use super::SdkEventMetricRow; -use crate::{ - query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window}, - types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, -}; - -#[derive(Default)] -pub(super) struct AuthenticationUnsuccessfulCount; - -#[async_trait::async_trait] -impl super::SdkEventMetric for AuthenticationUnsuccessfulCount -where - T: AnalyticsDataSource + super::SdkEventMetricAnalytics, - PrimitiveDateTime: ToSql, - AnalyticsCollection: ToSql, - Granularity: GroupByClause, - Aggregate<&'static str>: ToSql, - Window<&'static str>: ToSql, -{ - async fn load_metrics( - &self, - dimensions: &[SdkEventDimensions], - publishable_key: &str, - filters: &SdkEventFilters, - granularity: &Option, - time_range: &TimeRange, - pool: &T, - ) -> MetricsResult> { - let mut query_builder: QueryBuilder = QueryBuilder::new(AnalyticsCollection::SdkEvents); - let dimensions = dimensions.to_vec(); - - for dim in dimensions.iter() { - query_builder.add_select_column(dim).switch()?; - } - - query_builder - .add_select_column(Aggregate::Count { - field: None, - alias: Some("count"), - }) - .switch()?; - - if let Some(granularity) = granularity.as_ref() { - query_builder - .add_granularity_in_mins(granularity) - .switch()?; - } - - filters.set_filter_clause(&mut query_builder).switch()?; - - query_builder - .add_filter_clause("merchant_id", publishable_key) - .switch()?; - - query_builder - .add_filter_clause("event_name", SdkEventNames::AuthenticationCall) - .switch()?; - - query_builder - .add_filter_clause("log_type", "ERROR") - .switch()?; - - query_builder - .add_filter_clause("category", "USER_EVENT") - .switch()?; - - time_range - .set_filter_clause(&mut query_builder) - .attach_printable("Error filtering time range") - .switch()?; - - for dim in dimensions.iter() { - query_builder - .add_group_by_clause(dim) - .attach_printable("Error grouping by dimensions") - .switch()?; - } - - if let Some(_granularity) = granularity.as_ref() { - query_builder - .add_group_by_clause("time_bucket") - .attach_printable("Error adding granularity") - .switch()?; - } - - query_builder - .execute_query::(pool) - .await - .change_context(MetricsError::QueryBuildingError)? - .change_context(MetricsError::QueryExecutionFailure)? - .into_iter() - .map(|i| { - Ok(( - SdkEventMetricsBucketIdentifier::new( - i.payment_method.clone(), - i.platform.clone(), - i.browser_name.clone(), - i.source.clone(), - i.component.clone(), - i.payment_experience.clone(), - i.time_bucket.clone(), - ), - i, - )) - }) - .collect::, - crate::query::PostProcessingError, - >>() - .change_context(MetricsError::PostProcessingFailure) - } -} diff --git a/crates/analytics/src/sdk_events/metrics/three_ds_method_successful_count.rs b/crates/analytics/src/sdk_events/metrics/payment_success_count.rs similarity index 91% rename from crates/analytics/src/sdk_events/metrics/three_ds_method_successful_count.rs rename to crates/analytics/src/sdk_events/metrics/payment_success_count.rs index 5a8305e8ab8..3faf8213632 100644 --- a/crates/analytics/src/sdk_events/metrics/three_ds_method_successful_count.rs +++ b/crates/analytics/src/sdk_events/metrics/payment_success_count.rs @@ -15,10 +15,10 @@ use crate::{ }; #[derive(Default)] -pub(super) struct ThreeDsMethodSuccessfulCount; +pub(super) struct PaymentSuccessCount; #[async_trait::async_trait] -impl super::SdkEventMetric for ThreeDsMethodSuccessfulCount +impl super::SdkEventMetric for PaymentSuccessCount where T: AnalyticsDataSource + super::SdkEventMetricAnalytics, PrimitiveDateTime: ToSql, @@ -63,15 +63,11 @@ where .switch()?; query_builder - .add_filter_clause("event_name", SdkEventNames::ThreeDsMethodResult) + .add_bool_filter_clause("first_event", 1) .switch()?; query_builder - .add_filter_clause("log_type", "INFO") - .switch()?; - - query_builder - .add_filter_clause("category", "USER_EVENT") + .add_filter_clause("event_name", SdkEventNames::PaymentSuccess) .switch()?; time_range diff --git a/crates/analytics/src/sdk_events/metrics/sdk_initiated_count.rs b/crates/analytics/src/sdk_events/metrics/sdk_initiated_count.rs index ecbca81acf4..a525e7890b7 100644 --- a/crates/analytics/src/sdk_events/metrics/sdk_initiated_count.rs +++ b/crates/analytics/src/sdk_events/metrics/sdk_initiated_count.rs @@ -67,7 +67,7 @@ where .switch()?; query_builder - .add_filter_clause("event_name", SdkEventNames::OrcaElementsCalled) + .add_filter_clause("event_name", SdkEventNames::StripeElementsCalled) .switch()?; time_range diff --git a/crates/analytics/src/sdk_events/metrics/three_ds_challenge_flow_count.rs b/crates/analytics/src/sdk_events/metrics/three_ds_challenge_flow_count.rs deleted file mode 100644 index eb2eab60461..00000000000 --- a/crates/analytics/src/sdk_events/metrics/three_ds_challenge_flow_count.rs +++ /dev/null @@ -1,124 +0,0 @@ -use api_models::analytics::{ - sdk_events::{ - SdkEventDimensions, SdkEventFilters, SdkEventMetricsBucketIdentifier, SdkEventNames, - }, - Granularity, TimeRange, -}; -use common_utils::errors::ReportSwitchExt; -use error_stack::ResultExt; -use time::PrimitiveDateTime; - -use super::SdkEventMetricRow; -use crate::{ - query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window}, - types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, -}; - -#[derive(Default)] -pub(super) struct ThreeDsChallengeFlowCount; - -#[async_trait::async_trait] -impl super::SdkEventMetric for ThreeDsChallengeFlowCount -where - T: AnalyticsDataSource + super::SdkEventMetricAnalytics, - PrimitiveDateTime: ToSql, - AnalyticsCollection: ToSql, - Granularity: GroupByClause, - Aggregate<&'static str>: ToSql, - Window<&'static str>: ToSql, -{ - async fn load_metrics( - &self, - dimensions: &[SdkEventDimensions], - publishable_key: &str, - filters: &SdkEventFilters, - granularity: &Option, - time_range: &TimeRange, - pool: &T, - ) -> MetricsResult> { - let mut query_builder: QueryBuilder = QueryBuilder::new(AnalyticsCollection::SdkEvents); - let dimensions = dimensions.to_vec(); - - for dim in dimensions.iter() { - query_builder.add_select_column(dim).switch()?; - } - - query_builder - .add_select_column(Aggregate::Count { - field: None, - alias: Some("count"), - }) - .switch()?; - - if let Some(granularity) = granularity.as_ref() { - query_builder - .add_granularity_in_mins(granularity) - .switch()?; - } - - filters.set_filter_clause(&mut query_builder).switch()?; - - query_builder - .add_filter_clause("merchant_id", publishable_key) - .switch()?; - - query_builder - .add_filter_clause("event_name", SdkEventNames::DisplayThreeDsSdk) - .switch()?; - - query_builder - .add_filter_clause("log_type", "INFO") - .switch()?; - - query_builder - .add_filter_clause("category", "USER_EVENT") - .switch()?; - - query_builder.add_filter_clause("value", "C").switch()?; - - time_range - .set_filter_clause(&mut query_builder) - .attach_printable("Error filtering time range") - .switch()?; - - for dim in dimensions.iter() { - query_builder - .add_group_by_clause(dim) - .attach_printable("Error grouping by dimensions") - .switch()?; - } - - if let Some(_granularity) = granularity.as_ref() { - query_builder - .add_group_by_clause("time_bucket") - .attach_printable("Error adding granularity") - .switch()?; - } - - query_builder - .execute_query::(pool) - .await - .change_context(MetricsError::QueryBuildingError)? - .change_context(MetricsError::QueryExecutionFailure)? - .into_iter() - .map(|i| { - Ok(( - SdkEventMetricsBucketIdentifier::new( - i.payment_method.clone(), - i.platform.clone(), - i.browser_name.clone(), - i.source.clone(), - i.component.clone(), - i.payment_experience.clone(), - i.time_bucket.clone(), - ), - i, - )) - }) - .collect::, - crate::query::PostProcessingError, - >>() - .change_context(MetricsError::PostProcessingFailure) - } -} diff --git a/crates/analytics/src/sdk_events/metrics/three_ds_frictionless_flow_count.rs b/crates/analytics/src/sdk_events/metrics/three_ds_frictionless_flow_count.rs deleted file mode 100644 index ec40cf50c23..00000000000 --- a/crates/analytics/src/sdk_events/metrics/three_ds_frictionless_flow_count.rs +++ /dev/null @@ -1,126 +0,0 @@ -use api_models::analytics::{ - sdk_events::{ - SdkEventDimensions, SdkEventFilters, SdkEventMetricsBucketIdentifier, SdkEventNames, - }, - Granularity, TimeRange, -}; -use common_utils::errors::ReportSwitchExt; -use error_stack::ResultExt; -use time::PrimitiveDateTime; - -use super::SdkEventMetricRow; -use crate::{ - query::{Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window}, - types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, -}; - -#[derive(Default)] -pub(super) struct ThreeDsFrictionlessFlowCount; - -#[async_trait::async_trait] -impl super::SdkEventMetric for ThreeDsFrictionlessFlowCount -where - T: AnalyticsDataSource + super::SdkEventMetricAnalytics, - PrimitiveDateTime: ToSql, - AnalyticsCollection: ToSql, - Granularity: GroupByClause, - Aggregate<&'static str>: ToSql, - Window<&'static str>: ToSql, -{ - async fn load_metrics( - &self, - dimensions: &[SdkEventDimensions], - publishable_key: &str, - filters: &SdkEventFilters, - granularity: &Option, - time_range: &TimeRange, - pool: &T, - ) -> MetricsResult> { - let mut query_builder: QueryBuilder = QueryBuilder::new(AnalyticsCollection::SdkEvents); - let dimensions = dimensions.to_vec(); - - for dim in dimensions.iter() { - query_builder.add_select_column(dim).switch()?; - } - - query_builder - .add_select_column(Aggregate::Count { - field: None, - alias: Some("count"), - }) - .switch()?; - - if let Some(granularity) = granularity.as_ref() { - query_builder - .add_granularity_in_mins(granularity) - .switch()?; - } - - filters.set_filter_clause(&mut query_builder).switch()?; - - query_builder - .add_filter_clause("merchant_id", publishable_key) - .switch()?; - - query_builder - .add_filter_clause("event_name", SdkEventNames::DisplayThreeDsSdk) - .switch()?; - - query_builder - .add_filter_clause("log_type", "INFO") - .switch()?; - - query_builder - .add_filter_clause("category", "USER_EVENT") - .switch()?; - - query_builder - .add_custom_filter_clause("value", "C", FilterTypes::NotEqual) - .switch()?; - - time_range - .set_filter_clause(&mut query_builder) - .attach_printable("Error filtering time range") - .switch()?; - - for dim in dimensions.iter() { - query_builder - .add_group_by_clause(dim) - .attach_printable("Error grouping by dimensions") - .switch()?; - } - - if let Some(_granularity) = granularity.as_ref() { - query_builder - .add_group_by_clause("time_bucket") - .attach_printable("Error adding granularity") - .switch()?; - } - - query_builder - .execute_query::(pool) - .await - .change_context(MetricsError::QueryBuildingError)? - .change_context(MetricsError::QueryExecutionFailure)? - .into_iter() - .map(|i| { - Ok(( - SdkEventMetricsBucketIdentifier::new( - i.payment_method.clone(), - i.platform.clone(), - i.browser_name.clone(), - i.source.clone(), - i.component.clone(), - i.payment_experience.clone(), - i.time_bucket.clone(), - ), - i, - )) - }) - .collect::, - crate::query::PostProcessingError, - >>() - .change_context(MetricsError::PostProcessingFailure) - } -} diff --git a/crates/analytics/src/sdk_events/metrics/three_ds_method_invoked_count.rs b/crates/analytics/src/sdk_events/metrics/three_ds_method_invoked_count.rs deleted file mode 100644 index 17368d8a74f..00000000000 --- a/crates/analytics/src/sdk_events/metrics/three_ds_method_invoked_count.rs +++ /dev/null @@ -1,124 +0,0 @@ -use api_models::analytics::{ - sdk_events::{ - SdkEventDimensions, SdkEventFilters, SdkEventMetricsBucketIdentifier, SdkEventNames, - }, - Granularity, TimeRange, -}; -use common_utils::errors::ReportSwitchExt; -use error_stack::ResultExt; -use time::PrimitiveDateTime; - -use super::SdkEventMetricRow; -use crate::{ - query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window}, - types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, -}; - -#[derive(Default)] -pub(super) struct ThreeDsMethodInvokedCount; - -#[async_trait::async_trait] -impl super::SdkEventMetric for ThreeDsMethodInvokedCount -where - T: AnalyticsDataSource + super::SdkEventMetricAnalytics, - PrimitiveDateTime: ToSql, - AnalyticsCollection: ToSql, - Granularity: GroupByClause, - Aggregate<&'static str>: ToSql, - Window<&'static str>: ToSql, -{ - async fn load_metrics( - &self, - dimensions: &[SdkEventDimensions], - publishable_key: &str, - filters: &SdkEventFilters, - granularity: &Option, - time_range: &TimeRange, - pool: &T, - ) -> MetricsResult> { - let mut query_builder: QueryBuilder = QueryBuilder::new(AnalyticsCollection::SdkEvents); - let dimensions = dimensions.to_vec(); - - for dim in dimensions.iter() { - query_builder.add_select_column(dim).switch()?; - } - - query_builder - .add_select_column(Aggregate::Count { - field: None, - alias: Some("count"), - }) - .switch()?; - - if let Some(granularity) = granularity.as_ref() { - query_builder - .add_granularity_in_mins(granularity) - .switch()?; - } - - filters.set_filter_clause(&mut query_builder).switch()?; - - query_builder - .add_filter_clause("merchant_id", publishable_key) - .switch()?; - - query_builder - .add_filter_clause("event_name", SdkEventNames::ThreeDsMethod) - .switch()?; - - query_builder - .add_filter_clause("log_type", "INFO") - .switch()?; - - query_builder - .add_filter_clause("category", "USER_EVENT") - .switch()?; - - query_builder.add_filter_clause("value", "Y").switch()?; - - time_range - .set_filter_clause(&mut query_builder) - .attach_printable("Error filtering time range") - .switch()?; - - for dim in dimensions.iter() { - query_builder - .add_group_by_clause(dim) - .attach_printable("Error grouping by dimensions") - .switch()?; - } - - if let Some(_granularity) = granularity.as_ref() { - query_builder - .add_group_by_clause("time_bucket") - .attach_printable("Error adding granularity") - .switch()?; - } - - query_builder - .execute_query::(pool) - .await - .change_context(MetricsError::QueryBuildingError)? - .change_context(MetricsError::QueryExecutionFailure)? - .into_iter() - .map(|i| { - Ok(( - SdkEventMetricsBucketIdentifier::new( - i.payment_method.clone(), - i.platform.clone(), - i.browser_name.clone(), - i.source.clone(), - i.component.clone(), - i.payment_experience.clone(), - i.time_bucket.clone(), - ), - i, - )) - }) - .collect::, - crate::query::PostProcessingError, - >>() - .change_context(MetricsError::PostProcessingFailure) - } -} diff --git a/crates/analytics/src/sdk_events/metrics/three_ds_method_skipped_count.rs b/crates/analytics/src/sdk_events/metrics/three_ds_method_skipped_count.rs deleted file mode 100644 index 9ffb2a1c696..00000000000 --- a/crates/analytics/src/sdk_events/metrics/three_ds_method_skipped_count.rs +++ /dev/null @@ -1,124 +0,0 @@ -use api_models::analytics::{ - sdk_events::{ - SdkEventDimensions, SdkEventFilters, SdkEventMetricsBucketIdentifier, SdkEventNames, - }, - Granularity, TimeRange, -}; -use common_utils::errors::ReportSwitchExt; -use error_stack::ResultExt; -use time::PrimitiveDateTime; - -use super::SdkEventMetricRow; -use crate::{ - query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window}, - types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, -}; - -#[derive(Default)] -pub(super) struct ThreeDsMethodSkippedCount; - -#[async_trait::async_trait] -impl super::SdkEventMetric for ThreeDsMethodSkippedCount -where - T: AnalyticsDataSource + super::SdkEventMetricAnalytics, - PrimitiveDateTime: ToSql, - AnalyticsCollection: ToSql, - Granularity: GroupByClause, - Aggregate<&'static str>: ToSql, - Window<&'static str>: ToSql, -{ - async fn load_metrics( - &self, - dimensions: &[SdkEventDimensions], - publishable_key: &str, - filters: &SdkEventFilters, - granularity: &Option, - time_range: &TimeRange, - pool: &T, - ) -> MetricsResult> { - let mut query_builder: QueryBuilder = QueryBuilder::new(AnalyticsCollection::SdkEvents); - let dimensions = dimensions.to_vec(); - - for dim in dimensions.iter() { - query_builder.add_select_column(dim).switch()?; - } - - query_builder - .add_select_column(Aggregate::Count { - field: None, - alias: Some("count"), - }) - .switch()?; - - if let Some(granularity) = granularity.as_ref() { - query_builder - .add_granularity_in_mins(granularity) - .switch()?; - } - - filters.set_filter_clause(&mut query_builder).switch()?; - - query_builder - .add_filter_clause("merchant_id", publishable_key) - .switch()?; - - query_builder - .add_filter_clause("event_name", SdkEventNames::ThreeDsMethod) - .switch()?; - - query_builder - .add_filter_clause("log_type", "INFO") - .switch()?; - - query_builder - .add_filter_clause("category", "USER_EVENT") - .switch()?; - - query_builder.add_filter_clause("value", "N").switch()?; - - time_range - .set_filter_clause(&mut query_builder) - .attach_printable("Error filtering time range") - .switch()?; - - for dim in dimensions.iter() { - query_builder - .add_group_by_clause(dim) - .attach_printable("Error grouping by dimensions") - .switch()?; - } - - if let Some(_granularity) = granularity.as_ref() { - query_builder - .add_group_by_clause("time_bucket") - .attach_printable("Error adding granularity") - .switch()?; - } - - query_builder - .execute_query::(pool) - .await - .change_context(MetricsError::QueryBuildingError)? - .change_context(MetricsError::QueryExecutionFailure)? - .into_iter() - .map(|i| { - Ok(( - SdkEventMetricsBucketIdentifier::new( - i.payment_method.clone(), - i.platform.clone(), - i.browser_name.clone(), - i.source.clone(), - i.component.clone(), - i.payment_experience.clone(), - i.time_bucket.clone(), - ), - i, - )) - }) - .collect::, - crate::query::PostProcessingError, - >>() - .change_context(MetricsError::PostProcessingFailure) - } -} diff --git a/crates/analytics/src/sdk_events/metrics/three_ds_method_unsuccessful_count.rs b/crates/analytics/src/sdk_events/metrics/three_ds_method_unsuccessful_count.rs deleted file mode 100644 index b18d025bd09..00000000000 --- a/crates/analytics/src/sdk_events/metrics/three_ds_method_unsuccessful_count.rs +++ /dev/null @@ -1,122 +0,0 @@ -use api_models::analytics::{ - sdk_events::{ - SdkEventDimensions, SdkEventFilters, SdkEventMetricsBucketIdentifier, SdkEventNames, - }, - Granularity, TimeRange, -}; -use common_utils::errors::ReportSwitchExt; -use error_stack::ResultExt; -use time::PrimitiveDateTime; - -use super::SdkEventMetricRow; -use crate::{ - query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window}, - types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, -}; - -#[derive(Default)] -pub(super) struct ThreeDsMethodUnsuccessfulCount; - -#[async_trait::async_trait] -impl super::SdkEventMetric for ThreeDsMethodUnsuccessfulCount -where - T: AnalyticsDataSource + super::SdkEventMetricAnalytics, - PrimitiveDateTime: ToSql, - AnalyticsCollection: ToSql, - Granularity: GroupByClause, - Aggregate<&'static str>: ToSql, - Window<&'static str>: ToSql, -{ - async fn load_metrics( - &self, - dimensions: &[SdkEventDimensions], - publishable_key: &str, - filters: &SdkEventFilters, - granularity: &Option, - time_range: &TimeRange, - pool: &T, - ) -> MetricsResult> { - let mut query_builder: QueryBuilder = QueryBuilder::new(AnalyticsCollection::SdkEvents); - let dimensions = dimensions.to_vec(); - - for dim in dimensions.iter() { - query_builder.add_select_column(dim).switch()?; - } - - query_builder - .add_select_column(Aggregate::Count { - field: None, - alias: Some("count"), - }) - .switch()?; - - if let Some(granularity) = granularity.as_ref() { - query_builder - .add_granularity_in_mins(granularity) - .switch()?; - } - - filters.set_filter_clause(&mut query_builder).switch()?; - - query_builder - .add_filter_clause("merchant_id", publishable_key) - .switch()?; - - query_builder - .add_filter_clause("event_name", SdkEventNames::ThreeDsMethodResult) - .switch()?; - - query_builder - .add_filter_clause("log_type", "ERROR") - .switch()?; - - query_builder - .add_filter_clause("category", "USER_EVENT") - .switch()?; - - time_range - .set_filter_clause(&mut query_builder) - .attach_printable("Error filtering time range") - .switch()?; - - for dim in dimensions.iter() { - query_builder - .add_group_by_clause(dim) - .attach_printable("Error grouping by dimensions") - .switch()?; - } - - if let Some(_granularity) = granularity.as_ref() { - query_builder - .add_group_by_clause("time_bucket") - .attach_printable("Error adding granularity") - .switch()?; - } - - query_builder - .execute_query::(pool) - .await - .change_context(MetricsError::QueryBuildingError)? - .change_context(MetricsError::QueryExecutionFailure)? - .into_iter() - .map(|i| { - Ok(( - SdkEventMetricsBucketIdentifier::new( - i.payment_method.clone(), - i.platform.clone(), - i.browser_name.clone(), - i.source.clone(), - i.component.clone(), - i.payment_experience.clone(), - i.time_bucket.clone(), - ), - i, - )) - }) - .collect::, - crate::query::PostProcessingError, - >>() - .change_context(MetricsError::PostProcessingFailure) - } -} diff --git a/crates/analytics/src/search.rs b/crates/analytics/src/search.rs index dc802ff6948..4c42e96250b 100644 --- a/crates/analytics/src/search.rs +++ b/crates/analytics/src/search.rs @@ -2,33 +2,99 @@ use api_models::analytics::search::{ GetGlobalSearchRequest, GetSearchRequestWithIndex, GetSearchResponse, OpenMsearchOutput, OpensearchOutput, SearchIndex, }; -use common_utils::errors::{CustomResult, ReportSwitchExt}; -use error_stack::ResultExt; -use serde_json::Value; +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::opensearch::{ - OpenSearchClient, OpenSearchError, OpenSearchQuery, OpenSearchQueryBuilder, -}; +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(), + SearchIndex::Disputes => config.disputes.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( - client: &OpenSearchClient, req: GetGlobalSearchRequest, merchant_id: &String, -) -> CustomResult, OpenSearchError> { - let mut query_builder = OpenSearchQueryBuilder::new(OpenSearchQuery::Msearch, req.query); + config: OpensearchConfig, +) -> CustomResult, AnalyticsError> { + let client = get_opensearch_client(config.clone()) + .await + .map_err(|_| AnalyticsError::UnknownError)?; - query_builder - .add_filter_clause("merchant_id".to_string(), merchant_id.to_string()) - .switch()?; + 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": {"filter": [{"multi_match": {"type": "phrase", "query": req.query, "lenient": true}},{"match_phrase": {"merchant_id": merchant_id}}]}}}).into()); + } - let response_body = client - .execute(query_builder) + let response = client + .msearch(MsearchParts::None) + .body(msearch_vector) + .send() .await - .change_context(OpenSearchError::ConnectionError)? + .map_err(|_| AnalyticsError::UnknownError)?; + + let response_body = response .json::>() .await - .change_context(OpenSearchError::ResponseError)?; + .map_err(|_| AnalyticsError::UnknownError)?; Ok(response_body .responses @@ -48,30 +114,29 @@ pub async fn msearch_results( } pub async fn search_results( - client: &OpenSearchClient, req: GetSearchRequestWithIndex, merchant_id: &String, -) -> CustomResult { + config: OpensearchConfig, +) -> CustomResult { let search_req = req.search_req; - let mut query_builder = - OpenSearchQueryBuilder::new(OpenSearchQuery::Search(req.index), search_req.query); - - query_builder - .add_filter_clause("merchant_id".to_string(), merchant_id.to_string()) - .switch()?; - - query_builder - .set_offset_n_count(search_req.offset, search_req.count) - .switch()?; + let client = get_opensearch_client(config.clone()) + .await + .map_err(|_| AnalyticsError::UnknownError)?; - let response_body = client - .execute(query_builder) + 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": {"filter": [{"multi_match": {"type": "phrase", "query": search_req.query, "lenient": true}},{"match_phrase": {"merchant_id": merchant_id}}]}}})) + .send() .await - .change_context(OpenSearchError::ConnectionError)? + .map_err(|_| AnalyticsError::UnknownError)?; + + let response_body = response .json::>() .await - .change_context(OpenSearchError::ResponseError)?; + .map_err(|_| AnalyticsError::UnknownError)?; Ok(GetSearchResponse { count: response_body.hits.total.value, diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs index 86782c5f750..586ec1bfb17 100644 --- a/crates/analytics/src/sqlx.rs +++ b/crates/analytics/src/sqlx.rs @@ -100,10 +100,10 @@ where Type: DbType + FromStr + Display, { fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> sqlx::encode::IsNull { - >::encode(self.0.to_string(), buf) + self.0.to_string().encode(buf) } fn size_hint(&self) -> usize { - >::size_hint(&self.0.to_string()) + self.0.to_string().size_hint() } } diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml index 024cd44ef3b..571d629bae5 100644 --- a/crates/api_models/Cargo.toml +++ b/crates/api_models/Cargo.toml @@ -23,22 +23,22 @@ openapi = ["common_enums/openapi", "olap", "backwards_compatibility", "business_ recon = [] [dependencies] -actix-web = { version = "4.5.1", optional = true } +actix-web = { version = "4.3.1", optional = true } error-stack = "0.4.1" mime = "0.3.17" reqwest = { version = "0.12.2", optional = true } -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" -strum = { version = "0.26", features = ["derive"] } -time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] } -url = { version = "2.5.0", features = ["serde"] } -utoipa = { version = "4.2.0", features = ["preserve_order", "preserve_path_order"] } -frunk = "0.4.2" -frunk_core = "0.4.2" +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" +strum = { version = "0.25", features = ["derive"] } +time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] } +url = { version = "2.4.0", features = ["serde"] } +utoipa = { version = "3.5.0", features = ["preserve_order", "preserve_path_order"] } +frunk = "0.4.1" +frunk_core = "0.4.1" # First party crates cards = { version = "0.1.0", path = "../cards" } -common_enums = { version = "0.1.0", path = "../common_enums" } +common_enums = { path = "../common_enums" } common_utils = { version = "0.1.0", path = "../common_utils" } euclid = { version = "0.1.0", path = "../euclid" } masking = { version = "0.1.0", path = "../masking", default-features = false, features = ["alloc", "serde"] } diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index fde693a3700..10a68ef1a44 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use common_utils::{ - consts, crypto::{Encryptable, OptionalEncryptableName}, pii, }; @@ -506,10 +505,6 @@ pub enum ConnectorAuthType { CurrencyAuthKey { auth_key_map: HashMap, }, - CertificateAuth { - certificate: Secret, - private_key: Secret, - }, #[default] NoKey, } @@ -523,12 +518,6 @@ pub struct MerchantConnectorWebhookDetails { pub additional_secret: Option>, } -#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] -pub struct MerchantConnectorInfo { - pub connector_label: String, - pub merchant_connector_id: String, -} - /// Response of creating a new Merchant Connector for the merchant account." #[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] #[serde(deny_unknown_fields)] @@ -1043,9 +1032,6 @@ pub struct BusinessProfileUpdate { /// External 3DS authentication details pub authentication_connector_details: Option, - - /// Merchant's config to support extended card info feature - pub extended_card_info_config: Option, } #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq, ToSchema)] @@ -1069,12 +1055,6 @@ pub struct PaymentLinkConfigRequest { /// Custom layout for sdk #[schema(value_type = Option, max_length = 255, example = "accordion")] pub sdk_layout: Option, - /// Display only the sdk for payment link - #[schema(default = false, example = true)] - pub display_sdk_only: Option, - /// Enable saved payment method option for payment link - #[schema(default = false, example = true)] - pub enabled_saved_payment_method: Option, } #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, ToSchema)] @@ -1087,60 +1067,4 @@ pub struct PaymentLinkConfig { pub seller_name: String, /// Custom layout for sdk pub sdk_layout: String, - /// Display only the sdk for payment link - pub display_sdk_only: bool, - /// Enable saved payment method option for payment link - pub enabled_saved_payment_method: bool, -} - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)] -pub struct ExtendedCardInfoChoice { - pub enabled: bool, -} - -impl common_utils::events::ApiEventMetric for ExtendedCardInfoChoice {} - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] -pub struct ExtendedCardInfoConfig { - /// Merchant public key - #[schema(value_type = String)] - pub public_key: Secret, - /// TTL for extended card info - #[schema(default = 900, maximum = 3600, value_type = u16)] - #[serde(default)] - pub ttl_in_secs: TtlForExtendedCardInfo, -} - -#[derive(Debug, serde::Serialize, Clone)] -pub struct TtlForExtendedCardInfo(u16); - -impl Default for TtlForExtendedCardInfo { - fn default() -> Self { - Self(consts::DEFAULT_TTL_FOR_EXTENDED_CARD_INFO) - } -} - -impl<'de> Deserialize<'de> for TtlForExtendedCardInfo { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let value = u16::deserialize(deserializer)?; - - // Check if value exceeds the maximum allowed - if value > consts::MAX_TTL_FOR_EXTENDED_CARD_INFO { - Err(serde::de::Error::custom( - "ttl_in_secs must be less than or equal to 3600 (1hr)", - )) - } else { - Ok(Self(value)) - } - } -} - -impl std::ops::Deref for TtlForExtendedCardInfo { - type Target = u16; - fn deref(&self) -> &Self::Target { - &self.0 - } } diff --git a/crates/api_models/src/analytics/sdk_events.rs b/crates/api_models/src/analytics/sdk_events.rs index 2eacaa655da..76ccb29867f 100644 --- a/crates/api_models/src/analytics/sdk_events.rs +++ b/crates/api_models/src/analytics/sdk_events.rs @@ -71,14 +71,8 @@ pub enum SdkEventDimensions { #[serde(rename_all = "snake_case")] pub enum SdkEventMetrics { PaymentAttempts, + PaymentSuccessCount, PaymentMethodsCallCount, - ThreeDsMethodInvokedCount, - ThreeDsMethodSkippedCount, - ThreeDsMethodSuccessfulCount, - ThreeDsMethodUnsuccessfulCount, - AuthenticationUnsuccessfulCount, - ThreeDsChallengeFlowCount, - ThreeDsFrictionlessFlowCount, SdkRenderedCount, SdkInitiatedCount, PaymentMethodSelectedCount, @@ -101,11 +95,12 @@ pub enum SdkEventMetrics { #[strum(serialize_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum SdkEventNames { - OrcaElementsCalled, + StripeElementsCalled, AppRendered, PaymentMethodChanged, PaymentDataFilled, PaymentAttempt, + PaymentSuccess, PaymentMethodsCall, ConfirmCall, SessionsCall, @@ -113,24 +108,12 @@ pub enum SdkEventNames { RedirectingUser, DisplayBankTransferInfoPage, DisplayQrCodeInfoPage, - AuthenticationCall, - ThreeDsMethodCall, - ThreeDsMethodResult, - ThreeDsMethod, - LoaderChanged, - DisplayThreeDsSdk, } pub mod metric_behaviour { pub struct PaymentAttempts; + pub struct PaymentSuccessCount; pub struct PaymentMethodsCallCount; - pub struct ThreeDsMethodInvokedCount; - pub struct ThreeDsMethodSkippedCount; - pub struct ThreeDsMethodSuccessfulCount; - pub struct ThreeDsMethodUnsuccessfulCount; - pub struct AuthenticationUnsuccessfulCount; - pub struct ThreeDsChallengeFlowCount; - pub struct ThreeDsFrictionlessFlowCount; pub struct SdkRenderedCount; pub struct SdkInitiatedCount; pub struct PaymentMethodSelectedCount; @@ -214,19 +197,13 @@ impl PartialEq for SdkEventMetricsBucketIdentifier { #[derive(Debug, serde::Serialize)] pub struct SdkEventMetricsBucketValue { pub payment_attempts: Option, + pub payment_success_count: Option, pub payment_methods_call_count: Option, pub average_payment_time: Option, pub sdk_rendered_count: Option, pub sdk_initiated_count: Option, pub payment_method_selected_count: Option, pub payment_data_filled_count: Option, - pub three_ds_method_invoked_count: Option, - pub three_ds_method_skipped_count: Option, - pub three_ds_method_successful_count: Option, - pub three_ds_method_unsuccessful_count: Option, - pub authentication_unsuccessful_count: Option, - pub three_ds_challenge_flow_count: Option, - pub three_ds_frictionless_flow_count: Option, } #[derive(Debug, serde::Serialize)] diff --git a/crates/api_models/src/analytics/search.rs b/crates/api_models/src/analytics/search.rs index 6f6a3f22812..3a5b3c307e6 100644 --- a/crates/api_models/src/analytics/search.rs +++ b/crates/api_models/src/analytics/search.rs @@ -30,7 +30,7 @@ pub struct GetSearchRequestWithIndex { pub search_req: GetSearchRequest, } -#[derive(Debug, strum::EnumIter, Clone, serde::Deserialize, serde::Serialize, Copy)] +#[derive(Debug, strum::EnumIter, Clone, serde::Deserialize, serde::Serialize)] #[serde(rename_all = "snake_case")] pub enum SearchIndex { PaymentAttempts, diff --git a/crates/api_models/src/conditional_configs.rs b/crates/api_models/src/conditional_configs.rs index 46bad3e9e86..f8ed13421ac 100644 --- a/crates/api_models/src/conditional_configs.rs +++ b/crates/api_models/src/conditional_configs.rs @@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize}; PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, Serialize, diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs index 02fac0fbfa5..b29377886d5 100644 --- a/crates/api_models/src/enums.rs +++ b/crates/api_models/src/enums.rs @@ -35,7 +35,7 @@ pub enum RoutingAlgorithm { ToSchema, serde::Deserialize, serde::Serialize, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::Display, strum::EnumString, @@ -78,7 +78,7 @@ pub enum Connector { Authorizedotnet, Bambora, Bankofamerica, - Billwerk, + // Billwerk, Added as template code for future usage Bitpay, Bluesnap, Boku, @@ -89,7 +89,6 @@ pub enum Connector { Cryptopay, Cybersource, Dlocal, - Ebanx, Fiserv, Forte, Globalpay, @@ -100,7 +99,6 @@ pub enum Connector { Klarna, Mollie, Multisafepay, - Netcetera, Nexinets, Nmi, Noon, @@ -127,37 +125,13 @@ pub enum Connector { Wise, Worldline, Worldpay, + Zen, Signifyd, Plaid, Riskified, - Zen, - Zsl, } impl Connector { - #[cfg(feature = "payouts")] - pub fn supports_instant_payout(&self, payout_method: PayoutType) -> bool { - matches!( - (self, payout_method), - (Self::Paypal, PayoutType::Wallet) | (_, PayoutType::Card) - ) - } - #[cfg(feature = "payouts")] - pub fn supports_create_recipient(&self, payout_method: PayoutType) -> bool { - matches!((self, payout_method), (_, PayoutType::Bank)) - } - #[cfg(feature = "payouts")] - pub fn supports_payout_eligibility(&self, payout_method: PayoutType) -> bool { - matches!((self, payout_method), (_, PayoutType::Card)) - } - #[cfg(feature = "payouts")] - pub fn supports_access_token_for_payout(&self, payout_method: PayoutType) -> bool { - matches!((self, payout_method), (Self::Paypal, _)) - } - #[cfg(feature = "payouts")] - pub fn supports_vendor_disburse_account_create_for_payout(&self) -> bool { - matches!(self, Self::Stripe) - } pub fn supports_access_token(&self, payment_method: PaymentMethod) -> bool { matches!( (self, payment_method), @@ -192,7 +166,7 @@ impl Connector { | Self::Authorizedotnet | Self::Bambora | Self::Bankofamerica - | Self::Billwerk + // | Self::Billwerk Added as template code for future usage | Self::Bitpay | Self::Bluesnap | Self::Boku @@ -201,7 +175,6 @@ impl Connector { | Self::Coinbase | Self::Cryptopay | Self::Dlocal - | Self::Ebanx | Self::Fiserv | Self::Forte | Self::Globalpay @@ -213,6 +186,7 @@ impl Connector { | Self::Mollie | Self::Multisafepay | Self::Nexinets + | Self::Nmi | Self::Nuvei | Self::Opennode | Self::Payme @@ -232,16 +206,14 @@ impl Connector { | Self::Worldline | Self::Worldpay | Self::Zen - | Self::Zsl | Self::Signifyd | Self::Plaid | Self::Riskified | Self::Threedsecureio - | Self::Netcetera | Self::Cybersource | Self::Noon | Self::Stripe => false, - Self::Checkout | Self::Nmi => true, + Self::Checkout => true, } #[cfg(not(feature = "dummy_connector"))] match self { @@ -251,7 +223,7 @@ impl Connector { | Self::Authorizedotnet | Self::Bambora | Self::Bankofamerica - | Self::Billwerk + // | Self::Billwerk Added as template for future usage | Self::Bitpay | Self::Bluesnap | Self::Boku @@ -260,7 +232,6 @@ impl Connector { | Self::Coinbase | Self::Cryptopay | Self::Dlocal - | Self::Ebanx | Self::Fiserv | Self::Forte | Self::Globalpay @@ -292,14 +263,12 @@ impl Connector { | Self::Worldline | Self::Worldpay | Self::Zen - | Self::Zsl | Self::Signifyd | Self::Plaid | Self::Riskified | Self::Threedsecureio | Self::Cybersource | Self::Noon - | Self::Netcetera | Self::Stripe => false, Self::Checkout => true, } @@ -323,7 +292,6 @@ impl Connector { #[strum(serialize_all = "snake_case")] pub enum AuthenticationConnectors { Threedsecureio, - Netcetera, } #[cfg(feature = "payouts")] @@ -344,10 +312,7 @@ pub enum AuthenticationConnectors { #[strum(serialize_all = "snake_case")] pub enum PayoutConnectors { Adyen, - Stripe, Wise, - Paypal, - Ebanx, } #[cfg(feature = "payouts")] @@ -355,10 +320,7 @@ impl From for RoutableConnectors { fn from(value: PayoutConnectors) -> Self { match value { PayoutConnectors::Adyen => Self::Adyen, - PayoutConnectors::Stripe => Self::Stripe, PayoutConnectors::Wise => Self::Wise, - PayoutConnectors::Paypal => Self::Paypal, - PayoutConnectors::Ebanx => Self::Ebanx, } } } @@ -368,10 +330,7 @@ impl From for Connector { fn from(value: PayoutConnectors) -> Self { match value { PayoutConnectors::Adyen => Self::Adyen, - PayoutConnectors::Stripe => Self::Stripe, PayoutConnectors::Wise => Self::Wise, - PayoutConnectors::Paypal => Self::Paypal, - PayoutConnectors::Ebanx => Self::Ebanx, } } } @@ -382,10 +341,7 @@ impl TryFrom for PayoutConnectors { fn try_from(value: Connector) -> Result { match value { Connector::Adyen => Ok(Self::Adyen), - Connector::Stripe => Ok(Self::Stripe), Connector::Wise => Ok(Self::Wise), - Connector::Paypal => Ok(Self::Paypal), - Connector::Ebanx => Ok(Self::Ebanx), _ => Err(format!("Invalid payout connector {}", value)), } } @@ -413,6 +369,210 @@ pub enum FrmConnectors { Riskified, } +#[derive( + Clone, + Copy, + Debug, + Eq, + Hash, + PartialEq, + serde::Deserialize, + serde::Serialize, + strum::Display, + strum::EnumString, + ToSchema, +)] +#[strum(serialize_all = "snake_case")] +#[serde(rename_all = "snake_case")] +pub enum BankType { + Checking, + Savings, +} + +#[derive( + Clone, + Copy, + Debug, + Eq, + Hash, + PartialEq, + serde::Deserialize, + serde::Serialize, + strum::Display, + strum::EnumString, + ToSchema, +)] +#[strum(serialize_all = "snake_case")] +#[serde(rename_all = "snake_case")] +pub enum BankHolderType { + Personal, + Business, +} + +/// Name of banks supported by Hyperswitch +#[derive( + Clone, + Copy, + Debug, + Eq, + Hash, + PartialEq, + serde::Deserialize, + serde::Serialize, + strum::Display, + strum::EnumString, + ToSchema, +)] +#[strum(serialize_all = "snake_case")] +#[serde(rename_all = "snake_case")] +pub enum BankNames { + AmericanExpress, + AffinBank, + AgroBank, + AllianceBank, + AmBank, + BankOfAmerica, + BankIslam, + BankMuamalat, + BankRakyat, + BankSimpananNasional, + Barclays, + BlikPSP, + CapitalOne, + Chase, + Citi, + CimbBank, + Discover, + NavyFederalCreditUnion, + PentagonFederalCreditUnion, + SynchronyBank, + WellsFargo, + AbnAmro, + AsnBank, + Bunq, + Handelsbanken, + HongLeongBank, + HsbcBank, + Ing, + Knab, + KuwaitFinanceHouse, + Moneyou, + Rabobank, + Regiobank, + Revolut, + SnsBank, + TriodosBank, + VanLanschot, + ArzteUndApothekerBank, + AustrianAnadiBankAg, + BankAustria, + Bank99Ag, + BankhausCarlSpangler, + BankhausSchelhammerUndSchatteraAg, + BankMillennium, + BankPEKAOSA, + BawagPskAg, + BksBankAg, + BrullKallmusBankAg, + BtvVierLanderBank, + CapitalBankGraweGruppeAg, + CeskaSporitelna, + Dolomitenbank, + EasybankAg, + EPlatbyVUB, + ErsteBankUndSparkassen, + FrieslandBank, + HypoAlpeadriabankInternationalAg, + HypoNoeLbFurNiederosterreichUWien, + HypoOberosterreichSalzburgSteiermark, + HypoTirolBankAg, + HypoVorarlbergBankAg, + HypoBankBurgenlandAktiengesellschaft, + KomercniBanka, + MBank, + MarchfelderBank, + Maybank, + OberbankAg, + OsterreichischeArzteUndApothekerbank, + OcbcBank, + PayWithING, + PlaceZIPKO, + PlatnoscOnlineKartaPlatnicza, + PosojilnicaBankEGen, + PostovaBanka, + PublicBank, + RaiffeisenBankengruppeOsterreich, + RhbBank, + SchelhammerCapitalBankAg, + StandardCharteredBank, + SchoellerbankAg, + SpardaBankWien, + SporoPay, + SantanderPrzelew24, + TatraPay, + Viamo, + VolksbankGruppe, + VolkskreditbankAg, + VrBankBraunau, + UobBank, + PayWithAliorBank, + BankiSpoldzielcze, + PayWithInteligo, + BNPParibasPoland, + BankNowySA, + CreditAgricole, + PayWithBOS, + PayWithCitiHandlowy, + PayWithPlusBank, + ToyotaBank, + VeloBank, + ETransferPocztowy24, + PlusBank, + EtransferPocztowy24, + BankiSpbdzielcze, + BankNowyBfgSa, + GetinBank, + Blik, + NoblePay, + IdeaBank, + EnveloBank, + NestPrzelew, + MbankMtransfer, + Inteligo, + PbacZIpko, + BnpParibas, + BankPekaoSa, + VolkswagenBank, + AliorBank, + Boz, + BangkokBank, + KrungsriBank, + KrungThaiBank, + TheSiamCommercialBank, + KasikornBank, + OpenBankSuccess, + OpenBankFailure, + OpenBankCancelled, + Aib, + BankOfScotland, + DanskeBank, + FirstDirect, + FirstTrust, + Halifax, + Lloyds, + Monzo, + NatWest, + NationwideBank, + RoyalBankOfScotland, + Starling, + TsbBank, + TescoBank, + UlsterBank, + Yoursafe, + N26, + NationaleNederlanden, +} + #[derive( Clone, Debug, serde::Deserialize, serde::Serialize, strum::Display, strum::EnumString, ToSchema, )] diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs index 59e65c0605f..b26ee0ae68e 100644 --- a/crates/api_models/src/events/payment.rs +++ b/crates/api_models/src/events/payment.rs @@ -8,8 +8,7 @@ use crate::{ PaymentMethodResponse, PaymentMethodUpdate, }, payments::{ - ExtendedCardInfoResponse, PaymentIdType, PaymentListConstraints, - PaymentListFilterConstraints, PaymentListFilters, PaymentListFiltersV2, + PaymentIdType, PaymentListConstraints, PaymentListFilterConstraints, PaymentListFilters, PaymentListResponse, PaymentListResponseV2, PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest, PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest, @@ -91,7 +90,7 @@ impl ApiEventMetric for PaymentMethodResponse { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_id.clone(), - payment_method: self.payment_method, + payment_method: Some(self.payment_method), payment_method_type: self.payment_method_type, }) } @@ -159,11 +158,6 @@ impl ApiEventMetric for PaymentListFilters { Some(ApiEventsType::ResourceListAPI) } } -impl ApiEventMetric for PaymentListFiltersV2 { - fn get_api_event_type(&self) -> Option { - Some(ApiEventsType::ResourceListAPI) - } -} impl ApiEventMetric for PaymentListConstraints { fn get_api_event_type(&self) -> Option { @@ -202,5 +196,3 @@ impl ApiEventMetric for PaymentsExternalAuthenticationRequest { }) } } - -impl ApiEventMetric for ExtendedCardInfoResponse {} diff --git a/crates/api_models/src/events/user.rs b/crates/api_models/src/events/user.rs index 594b60b5816..4ef04981572 100644 --- a/crates/api_models/src/events/user.rs +++ b/crates/api_models/src/events/user.rs @@ -12,11 +12,10 @@ use crate::user::{ }, AcceptInviteFromEmailRequest, AuthorizeResponse, ChangePasswordRequest, ConnectAccountRequest, CreateInternalUserRequest, DashboardEntryResponse, ForgotPasswordRequest, - GetUserDetailsResponse, GetUserRoleDetailsRequest, GetUserRoleDetailsResponse, - InviteUserRequest, ListUsersResponse, ReInviteUserRequest, ResetPasswordRequest, - SendVerifyEmailRequest, SignInResponse, SignInWithTokenResponse, SignUpRequest, - SignUpWithMerchantIdRequest, SwitchMerchantIdRequest, UpdateUserAccountDetailsRequest, - UserMerchantCreate, VerifyEmailRequest, + GetUserDetailsRequest, GetUserDetailsResponse, InviteUserRequest, InviteUserResponse, + ListUsersResponse, ReInviteUserRequest, ResetPasswordRequest, SendVerifyEmailRequest, + SignInResponse, SignUpRequest, SignUpWithMerchantIdRequest, SwitchMerchantIdRequest, + UpdateUserAccountDetailsRequest, UserMerchantCreate, VerifyEmailRequest, }; impl ApiEventMetric for DashboardEntryResponse { @@ -55,16 +54,15 @@ common_utils::impl_misc_api_event_type!( ForgotPasswordRequest, ResetPasswordRequest, InviteUserRequest, + InviteUserResponse, ReInviteUserRequest, VerifyEmailRequest, SendVerifyEmailRequest, AcceptInviteFromEmailRequest, SignInResponse, UpdateUserAccountDetailsRequest, - GetUserDetailsResponse, - SignInWithTokenResponse, - GetUserRoleDetailsRequest, - GetUserRoleDetailsResponse + GetUserDetailsRequest, + GetUserDetailsResponse ); #[cfg(feature = "dummy_connector")] diff --git a/crates/api_models/src/health_check.rs b/crates/api_models/src/health_check.rs index 1e86e2964c7..29a59df397e 100644 --- a/crates/api_models/src/health_check.rs +++ b/crates/api_models/src/health_check.rs @@ -6,8 +6,6 @@ pub struct RouterHealthCheckResponse { pub vault: Option, #[cfg(feature = "olap")] pub analytics: bool, - #[cfg(feature = "olap")] - pub opensearch: bool, pub outgoing_request: bool, } diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs index a0bc6f6362d..89097705a40 100644 --- a/crates/api_models/src/lib.rs +++ b/crates/api_models/src/lib.rs @@ -25,7 +25,6 @@ pub mod payments; #[cfg(feature = "payouts")] pub mod payouts; pub mod pm_auth; -pub mod poll; #[cfg(feature = "recon")] pub mod recon; pub mod refunds; diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index e9ff261a632..f08a793ebf5 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -22,7 +22,7 @@ use crate::{ pub struct PaymentMethodCreate { /// The type of payment method use for the payment. #[schema(value_type = PaymentMethod,example = "card")] - pub payment_method: Option, + pub payment_method: api_enums::PaymentMethod, /// This is a sub-category of payment method. #[schema(value_type = Option,example = "credit")] @@ -65,16 +65,6 @@ pub struct PaymentMethodCreate { #[cfg(feature = "payouts")] #[schema(value_type = Option)] pub wallet: Option, - - /// For Client based calls, SDK will use the client_secret - /// in order to call /payment_methods - /// Client secret will be generated whenever a new - /// payment method is created - pub client_secret: Option, - - /// Payment method data to be passed in case of client - /// based flow - pub payment_method_data: Option, } #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] @@ -86,7 +76,7 @@ pub struct PaymentMethodUpdate { "card_exp_month": "10", "card_exp_year": "25", "card_holder_name": "John Doe"}))] - pub card: Option, + pub card: Option, /// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object. #[schema(value_type = Option,example = "Visa")] @@ -105,19 +95,6 @@ pub struct PaymentMethodUpdate { /// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object. #[schema(value_type = Option,example = json!({ "city": "NY", "unit": "245" }))] pub metadata: Option, - - /// This is a 15 minute expiry token which shall be used from the client to authenticate and perform sessions from the SDK - #[schema(max_length = 30, min_length = 30, example = "secret_k2uj3he2893eiu2d")] - pub client_secret: Option, -} - -#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] -#[serde(deny_unknown_fields)] -#[serde(rename_all = "snake_case")] -#[serde(rename = "payment_method_data")] - -pub enum PaymentMethodCreateData { - Card(CardDetail), } #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] @@ -157,54 +134,6 @@ pub struct CardDetail { pub card_type: Option, } -#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] -#[serde(deny_unknown_fields)] -pub struct CardDetailUpdate { - /// Card Expiry Month - #[schema(value_type = String,example = "10")] - pub card_exp_month: Option>, - - /// Card Expiry Year - #[schema(value_type = String,example = "25")] - pub card_exp_year: Option>, - - /// Card Holder Name - #[schema(value_type = String,example = "John Doe")] - pub card_holder_name: Option>, - - /// Card Holder's Nick Name - #[schema(value_type = Option,example = "John Doe")] - pub nick_name: Option>, -} - -impl CardDetailUpdate { - pub fn apply(&self, card_data_from_locker: Card) -> CardDetail { - CardDetail { - card_number: card_data_from_locker.card_number, - card_exp_month: self - .card_exp_month - .clone() - .unwrap_or(card_data_from_locker.card_exp_month), - card_exp_year: self - .card_exp_year - .clone() - .unwrap_or(card_data_from_locker.card_exp_year), - card_holder_name: self - .card_holder_name - .clone() - .or(card_data_from_locker.name_on_card), - nick_name: self - .nick_name - .clone() - .or(card_data_from_locker.nick_name.map(masking::Secret::new)), - card_issuing_country: None, - card_network: None, - card_issuer: None, - card_type: None, - } - } -} - #[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)] pub struct PaymentMethodResponse { /// Unique identifier for a merchant @@ -216,12 +145,12 @@ pub struct PaymentMethodResponse { pub customer_id: Option, /// The unique identifier of the Payment method - #[schema(example = "card_rGK4Vi5iSW70MY7J2mIg")] + #[schema(example = "card_rGK4Vi5iSW70MY7J2mIy")] pub payment_method_id: String, /// The type of payment method use for the payment. #[schema(value_type = PaymentMethod, example = "card")] - pub payment_method: Option, + pub payment_method: api_enums::PaymentMethod, /// This is a sub-category of payment method. #[schema(value_type = Option, example = "credit")] @@ -261,9 +190,6 @@ pub struct PaymentMethodResponse { #[schema(value_type = Option, example = "2024-02-24T11:04:09.922Z")] #[serde(default, with = "common_utils::custom_serde::iso8601::option")] pub last_used_at: Option, - - /// For Client based calls - pub client_secret: Option, } #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] @@ -316,17 +242,6 @@ pub struct BankAccountConnectorDetails { pub enum BankAccountAccessCreds { AccessToken(masking::Secret), } - -#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] -pub struct Card { - pub card_number: CardNumber, - pub name_on_card: Option>, - pub card_exp_month: masking::Secret, - pub card_exp_year: masking::Secret, - pub card_brand: Option, - pub card_isin: Option, - pub nick_name: Option, -} #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] pub struct CardDetailFromLocker { pub scheme: Option, @@ -367,28 +282,6 @@ fn saved_in_locker_default() -> bool { true } -impl From for payments::AdditionalCardInfo { - fn from(item: CardDetailFromLocker) -> Self { - Self { - card_issuer: item.card_issuer, - card_network: item.card_network, - card_type: item.card_type, - card_issuing_country: item.issuer_country, - bank_code: None, - last4: item.last4_digits, - card_isin: item.card_isin, - card_extended_bin: item - .card_number - .map(|card_number| card_number.get_card_extended_bin()), - card_exp_month: item.expiry_month, - card_exp_year: item.expiry_year, - card_holder_name: item.card_holder_name, - payment_checks: None, - authentication_data: None, - } - } -} - impl From for CardDetailFromLocker { fn from(item: CardDetailsPaymentMethod) -> Self { Self { @@ -643,7 +536,7 @@ pub struct RequestPaymentMethodTypes { #[serde(deny_unknown_fields)] pub struct PaymentMethodListRequest { /// This is a 15 minute expiry token which shall be used from the client to authenticate and perform sessions from the SDK - #[schema(max_length = 30, min_length = 30, example = "secret_k2uj3he2893eiu2d")] + #[schema(max_length = 30, min_length = 30, example = "secret_k2uj3he2893ein2d")] pub client_secret: Option, /// The two-letter ISO currency code @@ -850,7 +743,7 @@ pub struct CustomerPaymentMethodsListResponse { #[derive(Debug, serde::Serialize, ToSchema)] pub struct PaymentMethodDeleteResponse { /// The unique identifier of the Payment method - #[schema(example = "card_rGK4Vi5iSW70MY7J2mIg")] + #[schema(example = "card_rGK4Vi5iSW70MY7J2mIy")] pub payment_method_id: String, /// Whether payment method was deleted or not @@ -860,7 +753,7 @@ pub struct PaymentMethodDeleteResponse { #[derive(Debug, serde::Serialize, ToSchema)] pub struct CustomerDefaultPaymentMethodResponse { /// The unique identifier of the Payment method - #[schema(example = "card_rGK4Vi5iSW70MY7J2mIg")] + #[schema(example = "card_rGK4Vi5iSW70MY7J2mIy")] pub default_payment_method_id: Option, /// The unique identifier of the customer. #[schema(example = "cus_meowerunwiuwiwqw")] diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index b39355d2c99..72592ec3cad 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -1,17 +1,13 @@ -use std::{ - collections::{HashMap, HashSet}, - fmt, - num::NonZeroI64, -}; +use std::{collections::HashMap, fmt, num::NonZeroI64}; use cards::CardNumber; use common_utils::{ consts::default_payments_list_limit, crypto, - ext_traits::{ConfigExt, Encode}, + ext_traits::Encode, pii::{self, Email}, }; -use masking::{PeekInterface, Secret}; +use masking::Secret; use router_derive::Setter; use serde::{ de::{self, Unexpected, Visitor}, @@ -23,11 +19,8 @@ use url::Url; use utoipa::ToSchema; use crate::{ - admin::{self, MerchantConnectorInfo}, - disputes, enums as api_enums, - ephemeral_key::EphemeralKeyCreateResponse, - mandates::RecurringDetails, - refunds, + admin, disputes, enums as api_enums, ephemeral_key::EphemeralKeyCreateResponse, + mandates::RecurringDetails, refunds, }; #[derive(Clone, Copy, Debug, Eq, PartialEq)] @@ -46,7 +39,7 @@ pub struct BankData { #[derive(serde::Deserialize)] pub struct BankCodeInformation { - pub bank_name: common_enums::BankNames, + pub bank_name: api_enums::BankNames, pub connector_codes: Vec, } @@ -58,7 +51,7 @@ pub struct ConnectorCode { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq)] pub struct BankCodeResponse { - pub bank_name: Vec, + pub bank_name: Vec, pub eligible_connectors: Vec, } @@ -176,7 +169,7 @@ mod client_secret_tests { } } -#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema, PartialEq)] +#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] pub struct CustomerDetails { /// The identifier for the customer. pub id: String, @@ -916,99 +909,6 @@ pub struct Card { pub nick_name: Option>, } -#[derive(Default, Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] -pub struct ExtendedCardInfo { - /// The card number - #[schema(value_type = String, example = "4242424242424242")] - pub card_number: CardNumber, - - /// The card's expiry month - #[schema(value_type = String, example = "24")] - pub card_exp_month: Secret, - - /// The card's expiry year - #[schema(value_type = String, example = "24")] - pub card_exp_year: Secret, - - /// The card holder's name - #[schema(value_type = String, example = "John Test")] - pub card_holder_name: Option>, - - /// The name of the issuer of card - #[schema(example = "chase")] - pub card_issuer: Option, - - /// The card network for the card - #[schema(value_type = Option, example = "Visa")] - pub card_network: Option, - - #[schema(example = "CREDIT")] - pub card_type: Option, - - #[schema(example = "INDIA")] - pub card_issuing_country: Option, - - #[schema(example = "JP_AMEX")] - pub bank_code: Option, -} - -impl From for ExtendedCardInfo { - fn from(value: Card) -> Self { - Self { - card_number: value.card_number, - card_exp_month: value.card_exp_month, - card_exp_year: value.card_exp_year, - card_holder_name: value.card_holder_name, - card_issuer: value.card_issuer, - card_network: value.card_network, - card_type: value.card_type, - card_issuing_country: value.card_issuing_country, - bank_code: value.bank_code, - } - } -} - -impl GetAddressFromPaymentMethodData for Card { - fn get_billing_address(&self) -> Option
{ - // Create billing address if first_name is some or if it is not "" - self.card_holder_name - .as_ref() - .filter(|card_holder_name| !card_holder_name.is_empty_after_trim()) - .map(|card_holder_name| { - // Split the `card_holder_name` into `first_name` and `last_name` based on the - // first occurrence of ' '. For example - // John Wheat Dough - // first_name -> John - // last_name -> Wheat Dough - card_holder_name.peek().split_whitespace() - }) - .map(|mut card_holder_name_iter| { - let first_name = card_holder_name_iter - .next() - .map(ToOwned::to_owned) - .map(Secret::new); - - let last_name = card_holder_name_iter.collect::>().join(" "); - let last_name = if last_name.is_empty_after_trim() { - None - } else { - Some(Secret::new(last_name)) - }; - - AddressDetails { - first_name, - last_name, - ..Default::default() - } - }) - .map(|address_details| Address { - address: Some(address_details), - phone: None, - email: None, - }) - } -} - impl Card { fn apply_additional_card_info(&self, additional_card_info: AdditionalCardInfo) -> Self { Self { @@ -1158,13 +1058,13 @@ pub enum BankDebitData { bank_account_holder_name: Option>, #[schema(value_type = String, example = "ACH")] - bank_name: Option, + bank_name: Option, #[schema(value_type = String, example = "Checking")] - bank_type: Option, + bank_type: Option, #[schema(value_type = String, example = "Personal")] - bank_holder_type: Option, + bank_holder_type: Option, }, SepaBankDebit { /// Billing details for bank debit @@ -1288,56 +1188,15 @@ mod payment_method_data_serde { OptionalPaymentMethod(serde_json::Value), } - // This struct is an intermediate representation - // This is required in order to catch deserialization errors when deserializing `payment_method_data` - // The #[serde(flatten)] attribute applied on `payment_method_data` discards - // any of the error when deserializing and deserializes to an option instead - #[derive(serde::Deserialize, Debug)] - struct __InnerPaymentMethodData { - billing: Option
, - #[serde(flatten)] - payment_method_data: Option, - } - let deserialize_to_inner = __Inner::deserialize(deserializer)?; - match deserialize_to_inner { __Inner::OptionalPaymentMethod(value) => { - let parsed_value = serde_json::from_value::<__InnerPaymentMethodData>(value) + let parsed_value = serde_json::from_value::(value) .map_err(|serde_json_error| { serde::de::Error::custom(serde_json_error.to_string()) })?; - let payment_method_data = if let Some(payment_method_data_value) = - parsed_value.payment_method_data - { - // Even though no data is passed, the flatten serde_json::Value is deserialized as Some(Object {}) - if let serde_json::Value::Object(ref inner_map) = payment_method_data_value { - if inner_map.is_empty() { - None - } else { - Some( - serde_json::from_value::( - payment_method_data_value, - ) - .map_err(|serde_json_error| { - serde::de::Error::custom(serde_json_error.to_string()) - })?, - ) - } - } else { - Err(serde::de::Error::custom( - "Expected a map for payment_method_data", - ))? - } - } else { - None - }; - - Ok(Some(PaymentMethodDataRequest { - payment_method_data, - billing: parsed_value.billing, - })) + Ok(Some(parsed_value)) } __Inner::RewardString(inner_string) => { let payment_method_data = match inner_string.as_str() { @@ -1346,7 +1205,7 @@ mod payment_method_data_serde { }; Ok(Some(PaymentMethodDataRequest { - payment_method_data: Some(payment_method_data), + payment_method_data, billing: None, })) } @@ -1361,29 +1220,21 @@ mod payment_method_data_serde { S: Serializer, { if let Some(payment_method_data_request) = payment_method_data_request { - if let Some(payment_method_data) = - payment_method_data_request.payment_method_data.as_ref() - { - match payment_method_data { - PaymentMethodData::Reward => serializer.serialize_str("reward"), - PaymentMethodData::CardRedirect(_) - | PaymentMethodData::BankDebit(_) - | PaymentMethodData::BankRedirect(_) - | PaymentMethodData::BankTransfer(_) - | PaymentMethodData::CardToken(_) - | PaymentMethodData::Crypto(_) - | PaymentMethodData::GiftCard(_) - | PaymentMethodData::PayLater(_) - | PaymentMethodData::Upi(_) - | PaymentMethodData::Voucher(_) - | PaymentMethodData::Card(_) - | PaymentMethodData::MandatePayment - | PaymentMethodData::Wallet(_) => { - payment_method_data_request.serialize(serializer) - } - } - } else { - payment_method_data_request.serialize(serializer) + match payment_method_data_request.payment_method_data { + PaymentMethodData::Reward => serializer.serialize_str("reward"), + PaymentMethodData::CardRedirect(_) + | PaymentMethodData::BankDebit(_) + | PaymentMethodData::BankRedirect(_) + | PaymentMethodData::BankTransfer(_) + | PaymentMethodData::CardToken(_) + | PaymentMethodData::Crypto(_) + | PaymentMethodData::GiftCard(_) + | PaymentMethodData::PayLater(_) + | PaymentMethodData::Upi(_) + | PaymentMethodData::Voucher(_) + | PaymentMethodData::Card(_) + | PaymentMethodData::MandatePayment + | PaymentMethodData::Wallet(_) => payment_method_data_request.serialize(serializer), } } else { serializer.serialize_none() @@ -1394,7 +1245,7 @@ mod payment_method_data_serde { #[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, Eq, PartialEq)] pub struct PaymentMethodDataRequest { #[serde(flatten)] - pub payment_method_data: Option, + pub payment_method_data: PaymentMethodData, /// billing details for the payment method. /// This billing details will be passed to the processor as billing address. /// If not passed, then payment.billing will be considered @@ -1441,13 +1292,25 @@ pub trait GetAddressFromPaymentMethodData { impl GetAddressFromPaymentMethodData for PaymentMethodData { fn get_billing_address(&self) -> Option
{ match self { - Self::Card(card_data) => card_data.get_billing_address(), + Self::Card(card_data) => { + card_data + .card_holder_name + .as_ref() + .map(|card_holder_name| Address { + address: Some(AddressDetails { + first_name: Some(card_holder_name.clone()), + ..AddressDetails::default() + }), + email: None, + phone: None, + }) + } Self::CardRedirect(_) => None, Self::Wallet(wallet_data) => wallet_data.get_billing_address(), - Self::PayLater(_) => None, - Self::BankRedirect(_) => None, - Self::BankDebit(_) => None, - Self::BankTransfer(_) => None, + Self::PayLater(pay_later_data) => pay_later_data.get_billing_address(), + Self::BankRedirect(bank_redirect_data) => bank_redirect_data.get_billing_address(), + Self::BankDebit(bank_debit_data) => bank_debit_data.get_billing_address(), + Self::BankTransfer(bank_transfer_data) => bank_transfer_data.get_billing_address(), Self::Voucher(voucher_data) => voucher_data.get_billing_address(), Self::Crypto(_) | Self::Reward @@ -1614,7 +1477,6 @@ impl GetPaymentMethodType for BankTransferData { Self::MandiriVaBankTransfer { .. } => api_enums::PaymentMethodType::MandiriVa, Self::Pix {} => api_enums::PaymentMethodType::Pix, Self::Pse {} => api_enums::PaymentMethodType::Pse, - Self::LocalBankTransfer { .. } => api_enums::PaymentMethodType::LocalBankTransfer, } } } @@ -1721,7 +1583,7 @@ pub struct AdditionalCardInfo { pub enum AdditionalPaymentData { Card(Box), BankRedirect { - bank_name: Option, + bank_name: Option, }, Wallet { apple_pay: Option, @@ -1772,7 +1634,7 @@ pub enum BankRedirectData { /// The hyperswitch bank code for eps #[schema(value_type = BankNames, example = "triodos_bank")] - bank_name: Option, + bank_name: Option, /// The country for bank payment #[schema(value_type = CountryAlpha2, example = "US")] @@ -1801,7 +1663,7 @@ pub enum BankRedirectData { /// The hyperswitch bank code for ideal #[schema(value_type = BankNames, example = "abn_amro")] - bank_name: Option, + bank_name: Option, /// The country for bank payment #[schema(value_type = CountryAlpha2, example = "US")] @@ -1818,7 +1680,7 @@ pub enum BankRedirectData { OnlineBankingCzechRepublic { // Issuer banks #[schema(value_type = BankNames)] - issuer: common_enums::BankNames, + issuer: api_enums::BankNames, }, OnlineBankingFinland { // Shopper Email @@ -1828,17 +1690,17 @@ pub enum BankRedirectData { OnlineBankingPoland { // Issuer banks #[schema(value_type = BankNames)] - issuer: common_enums::BankNames, + issuer: api_enums::BankNames, }, OnlineBankingSlovakia { // Issuer value corresponds to the bank #[schema(value_type = BankNames)] - issuer: common_enums::BankNames, + issuer: api_enums::BankNames, }, OpenBankingUk { // Issuer banks #[schema(value_type = BankNames)] - issuer: Option, + issuer: Option, /// The country for bank payment #[schema(value_type = CountryAlpha2, example = "US")] country: Option, @@ -1846,7 +1708,7 @@ pub enum BankRedirectData { Przelewy24 { //Issuer banks #[schema(value_type = Option)] - bank_name: Option, + bank_name: Option, // The billing details for bank redirect billing_details: BankRedirectBilling, @@ -1871,11 +1733,11 @@ pub enum BankRedirectData { OnlineBankingFpx { // Issuer banks #[schema(value_type = BankNames)] - issuer: common_enums::BankNames, + issuer: api_enums::BankNames, }, OnlineBankingThailand { #[schema(value_type = BankNames)] - issuer: common_enums::BankNames, + issuer: api_enums::BankNames, }, } @@ -1999,43 +1861,43 @@ impl GetAddressFromPaymentMethodData for BankRedirectData { #[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)] pub struct AlfamartVoucherData { /// The billing first name for Alfamart - #[schema(value_type = Option, example = "Jane")] - pub first_name: Option>, + #[schema(value_type = String, example = "Jane")] + pub first_name: Secret, /// The billing second name for Alfamart - #[schema(value_type = Option, example = "Doe")] + #[schema(value_type = String, example = "Doe")] pub last_name: Option>, /// The Email ID for Alfamart - #[schema(value_type = Option, example = "example@me.com")] - pub email: Option, + #[schema(value_type = String, example = "example@me.com")] + pub email: Email, } #[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)] pub struct IndomaretVoucherData { /// The billing first name for Alfamart - #[schema(value_type = Option, example = "Jane")] - pub first_name: Option>, + #[schema(value_type = String, example = "Jane")] + pub first_name: Secret, /// The billing second name for Alfamart - #[schema(value_type = Option, example = "Doe")] + #[schema(value_type = String, example = "Doe")] pub last_name: Option>, /// The Email ID for Alfamart - #[schema(value_type = Option, example = "example@me.com")] - pub email: Option, + #[schema(value_type = String, example = "example@me.com")] + pub email: Email, } #[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)] pub struct JCSVoucherData { /// The billing first name for Japanese convenience stores - #[schema(value_type = Option, example = "Jane")] - pub first_name: Option>, + #[schema(value_type = String, example = "Jane")] + pub first_name: Secret, /// The billing second name Japanese convenience stores - #[schema(value_type = Option, example = "Doe")] + #[schema(value_type = String, example = "Doe")] pub last_name: Option>, /// The Email ID for Japanese convenience stores - #[schema(value_type = Option, example = "example@me.com")] - pub email: Option, + #[schema(value_type = String, example = "example@me.com")] + pub email: Email, /// The telephone number for Japanese convenience stores - #[schema(value_type = Option, example = "9999999999")] - pub phone_number: Option, + #[schema(value_type = String, example = "9999999999")] + pub phone_number: String, } #[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)] @@ -2179,9 +2041,6 @@ pub enum BankTransferData { }, Pix {}, Pse {}, - LocalBankTransfer { - bank_code: Option, - }, } impl GetAddressFromPaymentMethodData for BankTransferData { @@ -2232,7 +2091,7 @@ impl GetAddressFromPaymentMethodData for BankTransferData { phone: None, email: Some(billing_details.email.clone()), }), - Self::LocalBankTransfer { .. } | Self::Pix {} | Self::Pse {} => None, + Self::Pix {} | Self::Pse {} => None, } } } @@ -2336,7 +2195,7 @@ impl GetAddressFromPaymentMethodData for WalletData { let phone = PhoneDetails { // Portuguese country code, this payment method is applicable only in portugal country_code: Some("+351".into()), - number: mb_way_redirect.telephone_number.clone(), + number: Some(mb_way_redirect.telephone_number.clone()), }; Some(Address { @@ -2461,7 +2320,7 @@ pub struct MobilePayRedirection {} pub struct MbWayRedirection { /// Telephone number of the shopper. Should be Portuguese phone number. #[schema(value_type = String)] - pub telephone_number: Option>, + pub telephone_number: Secret, } #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] @@ -2569,21 +2428,21 @@ impl GetAddressFromPaymentMethodData for VoucherData { match self { Self::Alfamart(voucher_data) => Some(Address { address: Some(AddressDetails { - first_name: voucher_data.first_name.clone(), + first_name: Some(voucher_data.first_name.clone()), last_name: voucher_data.last_name.clone(), ..AddressDetails::default() }), phone: None, - email: voucher_data.email.clone(), + email: Some(voucher_data.email.clone()), }), Self::Indomaret(voucher_data) => Some(Address { address: Some(AddressDetails { - first_name: voucher_data.first_name.clone(), + first_name: Some(voucher_data.first_name.clone()), last_name: voucher_data.last_name.clone(), ..AddressDetails::default() }), phone: None, - email: voucher_data.email.clone(), + email: Some(voucher_data.email.clone()), }), Self::Lawson(voucher_data) | Self::MiniStop(voucher_data) @@ -2592,15 +2451,15 @@ impl GetAddressFromPaymentMethodData for VoucherData { | Self::PayEasy(voucher_data) | Self::SevenEleven(voucher_data) => Some(Address { address: Some(AddressDetails { - first_name: voucher_data.first_name.clone(), + first_name: Some(voucher_data.first_name.clone()), last_name: voucher_data.last_name.clone(), ..AddressDetails::default() }), phone: Some(PhoneDetails { - number: voucher_data.phone_number.clone().map(Secret::new), + number: Some(voucher_data.phone_number.clone().into()), country_code: None, }), - email: voucher_data.email.clone(), + email: Some(voucher_data.email.clone()), }), Self::Boleto(_) | Self::Efecty @@ -2738,21 +2597,6 @@ pub struct Address { pub email: Option, } -impl Address { - /// Unify the address, giving priority to `self` when details are present in both - pub fn unify_address(self, other: Option<&Self>) -> Self { - let other_address_details = other.and_then(|address| address.address.as_ref()); - Self { - address: self - .address - .map(|address| address.unify_address_details(other_address_details)) - .or(other_address_details.cloned()), - email: self.email.or(other.and_then(|other| other.email.clone())), - phone: self.phone.or(other.and_then(|other| other.phone.clone())), - } - } -} - // used by customers also, could be moved outside /// Address details #[derive(Clone, Default, Debug, Eq, serde::Deserialize, serde::Serialize, PartialEq, ToSchema)] @@ -2795,44 +2639,6 @@ pub struct AddressDetails { pub last_name: Option>, } -impl AddressDetails { - pub fn get_optional_full_name(&self) -> Option> { - match (self.first_name.as_ref(), self.last_name.as_ref()) { - (Some(first_name), Some(last_name)) => Some(Secret::new(format!( - "{} {}", - first_name.peek(), - last_name.peek() - ))), - (Some(name), None) | (None, Some(name)) => Some(name.to_owned()), - _ => None, - } - } - - pub fn unify_address_details(self, other: Option<&Self>) -> Self { - if let Some(other) = other { - let (first_name, last_name) = if self.first_name.is_some() { - (self.first_name, self.last_name) - } else { - (other.first_name.clone(), other.last_name.clone()) - }; - - Self { - first_name, - last_name, - city: self.city.or(other.city.clone()), - country: self.country.or(other.country), - line1: self.line1.or(other.line1.clone()), - line2: self.line2.or(other.line2.clone()), - line3: self.line3.or(other.line3.clone()), - zip: self.zip.or(other.zip.clone()), - state: self.state.or(other.state.clone()), - } - } else { - self - } - } -} - #[derive(Debug, Clone, Default, Eq, PartialEq, ToSchema, serde::Deserialize, serde::Serialize)] pub struct PhoneDetails { /// The contact number @@ -2926,8 +2732,6 @@ pub struct ThreeDsData { pub three_ds_authorize_url: String, /// ThreeDS method details pub three_ds_method_details: ThreeDsMethodData, - /// Poll config for a connector - pub poll_config: PollConfigResponse, } #[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)] @@ -2944,16 +2748,6 @@ pub enum ThreeDsMethodData { }, } -#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)] -pub struct PollConfigResponse { - /// Poll Id - pub poll_id: String, - /// Interval of the poll - pub delay_in_secs: i8, - /// Frequency of the poll - pub frequency: i8, -} - #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "snake_case")] #[serde(untagged)] @@ -3141,9 +2935,6 @@ pub struct PaymentsResponse { #[schema(max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")] pub customer_id: Option, - /// Details of customer attached to this payment - pub customer: Option, - /// A description of the payment #[schema(example = "It's my first payment request")] pub description: Option, @@ -3363,21 +3154,12 @@ pub struct PaymentsResponse { /// Payment Fingerprint pub fingerprint: Option, - #[schema(value_type = Option)] - /// The browser information used for this payment - pub browser_info: Option, - /// Payment Method Id pub payment_method_id: Option, /// Payment Method Status #[schema(value_type = Option)] pub payment_method_status: Option, - - /// Date time at which payment was updated - #[schema(example = "2022-09-10T10:11:12Z")] - #[serde(default, with = "common_utils::custom_serde::iso8601::option")] - pub updated: Option, } #[derive(Setter, Clone, Default, Debug, PartialEq, serde::Serialize, ToSchema)] @@ -3507,8 +3289,6 @@ pub struct PaymentListFilterConstraints { pub limit: u32, /// The starting point within a list of objects pub offset: Option, - /// The amount to filter payments list - pub amount_filter: Option, /// The time range for which objects are needed. TimeRange has two fields start_time and end_time from which objects can be filtered as per required scenarios (created_at, time less than, greater than etc). #[serde(flatten)] pub time_range: Option, @@ -3524,8 +3304,6 @@ pub struct PaymentListFilterConstraints { pub payment_method_type: Option>, /// The list of authentication types to filter payments list pub authentication_type: Option>, - /// The list of merchant connector ids to filter payments list for selected label - pub merchant_connector_id: Option>, } #[derive(Clone, Debug, serde::Serialize)] pub struct PaymentListFilters { @@ -3543,26 +3321,6 @@ pub struct PaymentListFilters { pub authentication_type: Vec, } -#[derive(Clone, Debug, serde::Serialize)] -pub struct PaymentListFiltersV2 { - /// The list of available connector filters - pub connector: HashMap>, - /// The list of available currency filters - pub currency: Vec, - /// The list of available payment status filters - pub status: Vec, - /// The list payment method and their corresponding types - pub payment_method: HashMap>, - /// The list of available authentication types - pub authentication_type: Vec, -} - -#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct AmountFilter { - pub start_amount: Option, - pub end_amount: Option, -} - #[derive( Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, ToSchema, )] @@ -3995,23 +3753,17 @@ pub struct PaymentRequestMetadata { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] pub struct SessionTokenInfo { - #[schema(value_type = String)] - pub certificate: Secret, - #[schema(value_type = String)] - pub certificate_keys: Secret, + pub certificate: String, + pub certificate_keys: String, pub merchant_identifier: String, pub display_name: String, pub initiative: String, pub initiative_context: String, - #[schema(value_type = Option)] - pub merchant_business_country: Option, } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] pub struct SessionTokenForSimplifiedApplePay { pub initiative_context: String, - #[schema(value_type = Option)] - pub merchant_business_country: Option, } #[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)] @@ -4179,7 +3931,7 @@ pub struct SecretInfoToInitiateSdk { pub struct ApplePayPaymentRequest { /// The code for country #[schema(value_type = CountryAlpha2, example = "US")] - pub country_code: api_enums::CountryAlpha2, + pub country_code: Option, /// The code for currency #[schema(value_type = Currency, example = "USD")] pub currency_code: api_enums::Currency, @@ -4592,12 +4344,12 @@ pub struct PaymentLinkInitiateRequest { #[derive(Debug, serde::Serialize)] #[serde(untagged)] -pub enum PaymentLinkData<'a> { - PaymentLinkDetails(&'a PaymentLinkDetails), +pub enum PaymentLinkData { + PaymentLinkDetails(PaymentLinkDetails), PaymentLinkStatusDetails(PaymentLinkStatusDetails), } -#[derive(Debug, serde::Serialize, Clone)] +#[derive(Debug, serde::Serialize)] pub struct PaymentLinkDetails { pub amount: String, pub currency: api_enums::Currency, @@ -4614,8 +4366,6 @@ pub struct PaymentLinkDetails { pub theme: String, pub merchant_description: Option, pub sdk_layout: String, - pub display_sdk_only: bool, - pub enabled_saved_payment_method: bool, } #[derive(Debug, serde::Serialize)] @@ -4725,12 +4475,6 @@ pub enum PaymentLinkStatusWrap { IntentStatus(api_enums::IntentStatus), } -#[derive(Debug, Default, serde::Deserialize, serde::Serialize, Clone, ToSchema)] -pub struct ExtendedCardInfoResponse { - // Encrypted customer payment method data - pub payload: String, -} - #[cfg(test)] mod payments_request_api_contract { #![allow(clippy::unwrap_used)] @@ -4764,7 +4508,7 @@ mod payments_request_api_contract { let payments_request = serde_json::from_str::(payments_request); assert!(payments_request.is_ok()); - if let Some(PaymentMethodData::Card(card_data)) = payments_request + if let PaymentMethodData::Card(card_data) = payments_request .unwrap() .payment_method_data .unwrap() @@ -4796,7 +4540,7 @@ mod payments_request_api_contract { .payment_method_data .unwrap() .payment_method_data, - Some(PaymentMethodData::Reward) + PaymentMethodData::Reward ); } } @@ -4807,15 +4551,11 @@ mod payments_request_api_contract { mod billing_from_payment_method_data { #![allow(clippy::unwrap_used)] use common_enums::CountryAlpha2; - use masking::ExposeOptionInterface; use super::*; const TEST_COUNTRY: CountryAlpha2 = CountryAlpha2::US; const TEST_FIRST_NAME: &str = "John"; - const TEST_LAST_NAME: &str = "Wheat Dough"; - const TEST_FULL_NAME: &str = "John Wheat Dough"; - const TEST_FIRST_NAME_SINGLE: &str = "John"; #[test] fn test_wallet_payment_method_data_paypal() { @@ -4924,17 +4664,15 @@ mod billing_from_payment_method_data { #[test] fn test_card_payment_method_data() { let card_payment_method_data = PaymentMethodData::Card(Card { - card_holder_name: Some(Secret::new(TEST_FIRST_NAME_SINGLE.into())), + card_holder_name: Some(Secret::new(TEST_FIRST_NAME.into())), ..Default::default() }); - let billing_address = card_payment_method_data.get_billing_address(); - - let billing_address = billing_address.unwrap(); + let billing_address = card_payment_method_data.get_billing_address().unwrap(); assert_eq!( - billing_address.address.unwrap().first_name.expose_option(), - Some(TEST_FIRST_NAME_SINGLE.into()) + billing_address.address.unwrap().first_name.unwrap(), + Secret::new(TEST_FIRST_NAME.into()) ); } @@ -4946,37 +4684,4 @@ mod billing_from_payment_method_data { assert!(billing_address.is_none()); } - - #[test] - fn test_card_payment_method_data_full_name() { - let card_payment_method_data = PaymentMethodData::Card(Card { - card_holder_name: Some(Secret::new(TEST_FULL_NAME.into())), - ..Default::default() - }); - - let billing_details = card_payment_method_data.get_billing_address().unwrap(); - let billing_address = billing_details.address.unwrap(); - - assert_eq!( - billing_address.first_name.expose_option(), - Some(TEST_FIRST_NAME.into()) - ); - - assert_eq!( - billing_address.last_name.expose_option(), - Some(TEST_LAST_NAME.into()) - ); - } - - #[test] - fn test_card_payment_method_data_empty_string() { - let card_payment_method_data = PaymentMethodData::Card(Card { - card_holder_name: Some(Secret::new("".to_string())), - ..Default::default() - }); - - let billing_details = card_payment_method_data.get_billing_address(); - - assert!(billing_details.is_none()); - } } diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs index 815234d57ed..1cdbfe41ebc 100644 --- a/crates/api_models/src/payouts.rs +++ b/crates/api_models/src/payouts.rs @@ -189,7 +189,6 @@ pub enum Bank { Ach(AchBankTransfer), Bacs(BacsBankTransfer), Sepa(SepaBankTransfer), - Pix(PixBankTransfer), } #[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] @@ -262,34 +261,10 @@ pub struct SepaBankTransfer { pub bic: Option>, } -#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] -pub struct PixBankTransfer { - /// Bank name - #[schema(value_type = Option, example = "Deutsche Bank")] - pub bank_name: Option, - - /// Bank branch - #[schema(value_type = Option, example = "3707")] - pub bank_branch: Option, - - /// Bank account number is an unique identifier assigned by a bank to a customer. - #[schema(value_type = String, example = "000123456")] - pub bank_account_number: Secret, - - /// Unique key for pix customer - #[schema(value_type = String, example = "000123456")] - pub pix_key: Secret, - - /// Individual taxpayer identification number - #[schema(value_type = Option, example = "000123456")] - pub tax_id: Option>, -} - #[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] #[serde(rename_all = "snake_case")] pub enum Wallet { Paypal(Paypal), - Venmo(Venmo), } #[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] @@ -297,21 +272,6 @@ pub struct Paypal { /// Email linked with paypal account #[schema(value_type = String, example = "john.doe@example.com")] pub email: Option, - - /// mobile number linked to paypal account - #[schema(value_type = String, example = "16608213349")] - pub telephone_number: Option>, - - /// id of the paypal account - #[schema(value_type = String, example = "G83KXTJ5EHCQ2")] - pub paypal_id: Option>, -} - -#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] -pub struct Venmo { - /// mobile number linked to venmo account - #[schema(value_type = String, example = "16608213349")] - pub telephone_number: Option>, } #[derive(Debug, Default, ToSchema, Clone, Serialize)] @@ -477,6 +437,8 @@ pub struct PayoutAttemptResponse { pub connector_transaction_id: Option, /// If the payout was cancelled the reason provided here pub cancellation_reason: Option, + /// Provide a reference to a stored payout method + pub payout_token: Option, /// error code unified across the connectors is received here if there was an error while calling connector pub unified_code: Option, /// error message unified across the connectors is received here if there was an error while calling connector @@ -486,7 +448,6 @@ pub struct PayoutAttemptResponse { #[derive(Default, Debug, Clone, Deserialize, ToSchema)] pub struct PayoutRetrieveBody { pub force_sync: Option, - pub merchant_id: Option, } #[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)] @@ -505,9 +466,6 @@ pub struct PayoutRetrieveRequest { /// (defaults to false) #[schema(value_type = Option, default = false, example = true)] pub force_sync: Option, - - /// The identifier for the Merchant Account. - pub merchant_id: Option, } #[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)] @@ -523,43 +481,6 @@ pub struct PayoutActionRequest { pub payout_id: String, } -#[derive(Default, Debug, ToSchema, Clone, Deserialize)] -pub struct PayoutVendorAccountDetails { - pub vendor_details: PayoutVendorDetails, - pub individual_details: PayoutIndividualDetails, -} - -#[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)] -pub struct PayoutVendorDetails { - pub account_type: String, - pub business_type: String, - pub business_profile_mcc: Option, - pub business_profile_url: Option, - pub business_profile_name: Option>, - pub company_address_line1: Option>, - pub company_address_line2: Option>, - pub company_address_postal_code: Option>, - pub company_address_city: Option>, - pub company_address_state: Option>, - pub company_phone: Option>, - pub company_tax_id: Option>, - pub company_owners_provided: Option, - pub capabilities_card_payments: Option, - pub capabilities_transfers: Option, -} - -#[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)] -pub struct PayoutIndividualDetails { - pub tos_acceptance_date: Option, - pub tos_acceptance_ip: Option>, - pub individual_dob_day: Option>, - pub individual_dob_month: Option>, - pub individual_dob_year: Option>, - pub individual_id_number: Option>, - pub individual_ssn_last_4: Option>, - pub external_account_account_holder_type: Option, -} - #[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)] #[serde(deny_unknown_fields)] pub struct PayoutListConstraints { diff --git a/crates/api_models/src/poll.rs b/crates/api_models/src/poll.rs deleted file mode 100644 index f75754d72b8..00000000000 --- a/crates/api_models/src/poll.rs +++ /dev/null @@ -1,28 +0,0 @@ -use common_utils::events::{ApiEventMetric, ApiEventsType}; -use serde::Serialize; -use utoipa::ToSchema; - -#[derive(Debug, ToSchema, Clone, Serialize)] -pub struct PollResponse { - /// The poll id - pub poll_id: String, - /// Status of the poll - pub status: PollStatus, -} - -#[derive(Debug, strum::Display, strum::EnumString, Clone, serde::Serialize, ToSchema)] -#[strum(serialize_all = "snake_case")] -#[serde(rename_all = "snake_case")] -pub enum PollStatus { - Pending, - Completed, - NotFound, -} - -impl ApiEventMetric for PollResponse { - fn get_api_event_type(&self) -> Option { - Some(ApiEventsType::Poll { - poll_id: self.poll_id.clone(), - }) - } -} diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rs index ea28ed56af3..97182df0a5e 100644 --- a/crates/api_models/src/refunds.rs +++ b/crates/api_models/src/refunds.rs @@ -9,7 +9,7 @@ use crate::{admin, enums}; #[derive(Default, Debug, ToSchema, Clone, Deserialize, Serialize)] #[serde(deny_unknown_fields)] pub struct RefundRequest { - /// The payment id against which refund is to be initiated + /// The payment id against which refund is to be intiated #[schema( max_length = 30, min_length = 30, @@ -102,7 +102,7 @@ pub enum RefundType { pub struct RefundResponse { /// Unique Identifier for the refund pub refund_id: String, - /// The payment id against which refund is initiated + /// The payment id against which refund is intiated pub payment_id: String, /// The refund amount, which should be less than or equal to the total payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc pub amount: i64, diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs index 723e6eccc36..4d32f1d0f81 100644 --- a/crates/api_models/src/routing.rs +++ b/crates/api_models/src/routing.rs @@ -11,7 +11,7 @@ pub use euclid::{ use serde::{Deserialize, Serialize}; use utoipa::ToSchema; -use crate::enums::{RoutableConnectors, TransactionType}; +use crate::enums::{self, RoutableConnectors, TransactionType}; #[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] #[serde(tag = "type", content = "data", rename_all = "snake_case")] @@ -299,13 +299,35 @@ impl From for ast::ConnectorChoice { } } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct DetailedConnectorChoice { - pub enabled: bool, + pub connector: RoutableConnectors, + pub business_label: Option, + pub business_country: Option, + pub business_sub_label: Option, +} + +impl DetailedConnectorChoice { + pub fn get_connector_label(&self) -> Option { + self.business_country + .as_ref() + .zip(self.business_label.as_ref()) + .map(|(business_country, business_label)| { + let mut base_label = format!( + "{}_{:?}_{}", + self.connector, business_country, business_label + ); + + if let Some(ref sub_label) = self.business_sub_label { + base_label.push('_'); + base_label.push_str(sub_label); + } + + base_label + }) + } } -impl common_utils::events::ApiEventMetric for DetailedConnectorChoice {} - #[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize, strum::Display, ToSchema)] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs index b4d53a92c1a..9b193a9ba12 100644 --- a/crates/api_models/src/user.rs +++ b/crates/api_models/src/user.rs @@ -1,4 +1,4 @@ -use common_enums::{PermissionGroup, RoleScope, TokenPurpose}; +use common_enums::{PermissionGroup, RoleScope}; use common_utils::{crypto::OptionalEncryptableName, pii}; use masking::Secret; @@ -98,6 +98,12 @@ pub struct InviteUserRequest { pub role_id: String, } +#[derive(Debug, serde::Serialize)] +pub struct InviteUserResponse { + pub is_email_sent: bool, + pub password: Option>, +} + #[derive(Debug, serde::Serialize)] pub struct InviteMultipleUserResponse { pub email: pii::Email, @@ -149,25 +155,13 @@ pub struct UserDetails { pub last_modified_at: time::PrimitiveDateTime, } -#[derive(serde::Serialize, Debug, Clone)] -pub struct GetUserDetailsResponse { - pub merchant_id: String, - pub name: Secret, - pub email: pii::Email, - pub verification_days_left: Option, - pub role_id: String, - // This field is added for audit/debug reasons - #[serde(skip_serializing)] - pub user_id: String, - pub org_id: String, -} #[derive(Debug, serde::Deserialize, serde::Serialize)] -pub struct GetUserRoleDetailsRequest { +pub struct GetUserDetailsRequest { pub email: pii::Email, } #[derive(Debug, serde::Serialize)] -pub struct GetUserRoleDetailsResponse { +pub struct GetUserDetailsResponse { pub email: pii::Email, pub name: Secret, pub role_id: String, @@ -196,9 +190,6 @@ pub struct UserMerchantAccount { pub merchant_id: String, pub merchant_name: OptionalEncryptableName, pub is_active: bool, - pub role_id: String, - pub role_name: String, - pub org_id: String, } #[cfg(feature = "recon")] @@ -213,21 +204,3 @@ pub struct UpdateUserAccountDetailsRequest { pub name: Option>, pub preferred_merchant_id: Option, } - -#[derive(Debug, serde::Deserialize, serde::Serialize)] -pub struct TokenOnlyQueryParam { - pub token_only: Option, -} - -#[derive(Debug, serde::Deserialize, serde::Serialize)] -pub struct TokenResponse { - pub token: Secret, - pub token_type: TokenPurpose, -} - -#[derive(Debug, serde::Serialize)] -#[serde(untagged)] -pub enum SignInWithTokenResponse { - Token(TokenResponse), - SignInResponse(SignInResponse), -} diff --git a/crates/api_models/src/user/dashboard_metadata.rs b/crates/api_models/src/user/dashboard_metadata.rs index b547a61d450..66831c7aeb8 100644 --- a/crates/api_models/src/user/dashboard_metadata.rs +++ b/crates/api_models/src/user/dashboard_metadata.rs @@ -26,7 +26,6 @@ pub enum SetMetaDataRequest { IsMultipleConfiguration, #[serde(skip)] IsChangePasswordRequired, - OnboardingSurvey(OnboardingSurvey), } #[derive(Debug, serde::Deserialize, serde::Serialize)] @@ -47,20 +46,6 @@ pub struct ProcessorConnected { pub processor_name: String, } -#[derive(Debug, serde::Deserialize, serde::Serialize)] -pub struct OnboardingSurvey { - pub designation: Option, - pub about_business: Option, - pub business_website: Option, - pub hyperswitch_req: Option, - pub major_markets: Option>, - pub business_size: Option, - pub required_features: Option>, - pub required_processors: Option>, - pub planned_live_date: Option, - pub miscellaneous: Option, -} - #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct ConfiguredRouting { pub routing_id: String, @@ -128,7 +113,6 @@ pub enum GetMetaDataRequest { SetupWoocomWebhook, IsMultipleConfiguration, IsChangePasswordRequired, - OnboardingSurvey, } #[derive(Debug, serde::Deserialize, serde::Serialize)] @@ -166,5 +150,4 @@ pub enum GetMetaDataResponse { SetupWoocomWebhook(bool), IsMultipleConfiguration(bool), IsChangePasswordRequired(bool), - OnboardingSurvey(Option), } diff --git a/crates/api_models/src/user_role.rs b/crates/api_models/src/user_role.rs index 25c1c5ecd40..31da8386ab6 100644 --- a/crates/api_models/src/user_role.rs +++ b/crates/api_models/src/user_role.rs @@ -34,7 +34,6 @@ pub enum Permission { WebhookEventRead, PayoutWrite, PayoutRead, - WebhookEventWrite, } #[derive(Debug, serde::Serialize)] diff --git a/crates/api_models/src/webhook_events.rs b/crates/api_models/src/webhook_events.rs index 40a694a6650..ef7db3231af 100644 --- a/crates/api_models/src/webhook_events.rs +++ b/crates/api_models/src/webhook_events.rs @@ -94,14 +94,6 @@ pub struct EventRetrieveResponse { pub delivery_attempt: Option, } -impl common_utils::events::ApiEventMetric for EventRetrieveResponse { - fn get_api_event_type(&self) -> Option { - Some(common_utils::events::ApiEventsType::Events { - merchant_id_or_profile_id: self.event_information.merchant_id.clone(), - }) - } -} - /// The request information (headers and body) sent in the webhook. #[derive(Debug, Serialize, Deserialize, ToSchema)] pub struct OutgoingWebhookRequestContent { @@ -122,24 +114,20 @@ pub struct OutgoingWebhookRequestContent { #[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema)] pub struct OutgoingWebhookResponseContent { /// The response body received for the webhook sent. - #[schema(value_type = Option)] + #[schema(value_type = String)] #[serde(alias = "payload")] - pub body: Option>, + pub body: Secret, /// The response headers received for the webhook sent. #[schema( - value_type = Option>, + value_type = Vec<(String, String)>, example = json!([["content-type", "application/json"], ["content-length", "1024"]])) ] - pub headers: Option)>>, + pub headers: Vec<(String, Secret)>, /// The HTTP status code for the webhook sent. #[schema(example = 200)] - pub status_code: Option, - - /// Error message in case any error occurred when trying to deliver the webhook. - #[schema(example = 200)] - pub error_message: Option, + pub status_code: u16, } #[derive(Debug, serde::Serialize)] @@ -169,17 +157,3 @@ impl common_utils::events::ApiEventMetric for WebhookDeliveryAttemptListRequestI }) } } - -#[derive(Debug, serde::Serialize)] -pub struct WebhookDeliveryRetryRequestInternal { - pub merchant_id_or_profile_id: String, - pub event_id: String, -} - -impl common_utils::events::ApiEventMetric for WebhookDeliveryRetryRequestInternal { - fn get_api_event_type(&self) -> Option { - Some(common_utils::events::ApiEventsType::Events { - merchant_id_or_profile_id: self.merchant_id_or_profile_id.clone(), - }) - } -} diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rs index df9b1249c75..25e1f5827ad 100644 --- a/crates/api_models/src/webhooks.rs +++ b/crates/api_models/src/webhooks.rs @@ -38,7 +38,6 @@ pub enum IncomingWebhookEvent { MandateActive, MandateRevoked, EndpointVerification, - ExternalAuthenticationARes, } pub enum WebhookFlow { @@ -49,7 +48,6 @@ pub enum WebhookFlow { ReturnResponse, BankTransfer, Mandate, - ExternalAuthentication, } #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] @@ -118,7 +116,6 @@ impl From for WebhookFlow { IncomingWebhookEvent::EndpointVerification => Self::ReturnResponse, IncomingWebhookEvent::SourceChargeable | IncomingWebhookEvent::SourceTransactionCreated => Self::BankTransfer, - IncomingWebhookEvent::ExternalAuthenticationARes => Self::ExternalAuthentication, } } } @@ -137,18 +134,11 @@ pub enum MandateIdType { ConnectorMandateId(String), } -#[derive(Clone)] -pub enum AuthenticationIdType { - AuthenticationId(String), - ConnectorAuthenticationId(String), -} - #[derive(Clone)] pub enum ObjectReferenceId { PaymentId(payments::PaymentIdType), RefundId(RefundIdType), MandateId(MandateIdType), - ExternalAuthenticationID(AuthenticationIdType), } pub struct IncomingWebhookDetails { diff --git a/crates/cards/Cargo.toml b/crates/cards/Cargo.toml index ac8a417fb99..bb185bf2167 100644 --- a/crates/cards/Cargo.toml +++ b/crates/cards/Cargo.toml @@ -12,9 +12,9 @@ license.workspace = true [dependencies] error-stack = "0.4.1" luhn = "1.0.1" -serde = { version = "1.0.197", features = ["derive"] } -thiserror = "1.0.58" -time = "0.3.35" +serde = { version = "1.0.193", features = ["derive"] } +thiserror = "1.0.40" +time = "0.3.21" # First party crates common_utils = { version = "0.1.0", path = "../common_utils" } @@ -24,4 +24,4 @@ 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"] } [dev-dependencies] -serde_json = "1.0.115" +serde_json = "1.0.108" diff --git a/crates/common_enums/Cargo.toml b/crates/common_enums/Cargo.toml index 5c88236b8ae..30da73c57d2 100644 --- a/crates/common_enums/Cargo.toml +++ b/crates/common_enums/Cargo.toml @@ -13,14 +13,14 @@ openapi = [] payouts = [] [dependencies] -diesel = { version = "2.1.5", features = ["postgres"] } -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" -strum = { version = "0.26", features = ["derive"] } -utoipa = { version = "4.2.0", features = ["preserve_order", "preserve_path_order"] } +diesel = { version = "2.1.0", features = ["postgres"] } +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" +strum = { version = "0.25", features = ["derive"] } +utoipa = { version = "3.5.0", features = ["preserve_order", "preserve_path_order"] } # First party crates router_derive = { version = "0.1.0", path = "../router_derive" } [dev-dependencies] -serde_json = "1.0.115" +serde_json = "1.0.108" diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs index 3c86064731b..548e721f0d3 100644 --- a/crates/common_enums/src/enums.rs +++ b/crates/common_enums/src/enums.rs @@ -2,7 +2,6 @@ use std::num::{ParseFloatError, TryFromIntError}; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; - #[doc(hidden)] pub mod diesel_exports { pub use super::{ @@ -75,7 +74,7 @@ pub enum AttemptStatus { strum::Display, strum::EnumString, strum::EnumIter, - strum::VariantNames, + strum::EnumVariantNames, ToSchema, )] #[router_derive::diesel_enum(storage_type = "db_enum")] @@ -116,7 +115,7 @@ pub enum RoutableConnectors { Airwallex, Authorizedotnet, Bankofamerica, - Billwerk, + // Billwerk, Added as template code for future usage Bitpay, Bambora, Bluesnap, @@ -128,7 +127,6 @@ pub enum RoutableConnectors { Cryptopay, Cybersource, Dlocal, - Ebanx, Fiserv, Forte, Globalpay, @@ -167,7 +165,6 @@ pub enum RoutableConnectors { Worldline, Worldpay, Zen, - Zsl, } impl AttemptStatus { @@ -212,7 +209,7 @@ impl AttemptStatus { serde::Deserialize, serde::Serialize, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, ToSchema, @@ -315,7 +312,7 @@ pub enum BlocklistDataKind { serde::Deserialize, serde::Serialize, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, ToSchema, @@ -389,7 +386,7 @@ pub enum ConnectorType { strum::Display, strum::EnumString, strum::EnumIter, - strum::VariantNames, + strum::EnumVariantNames, ToSchema, )] #[router_derive::diesel_enum(storage_type = "db_enum")] @@ -1035,16 +1032,6 @@ impl Currency { | Self::ZMW => false, } } - - pub fn number_of_digits_after_decimal_point(self) -> u8 { - if self.is_zero_decimal_currency() { - 0 - } else if self.is_three_decimal_currency() { - 3 - } else { - 2 - } - } } #[derive( @@ -1163,7 +1150,6 @@ pub enum MerchantStorageScheme { serde::Deserialize, serde::Serialize, strum::Display, - strum::EnumIter, strum::EnumString, )] #[router_derive::diesel_enum(storage_type = "db_enum")] @@ -1195,7 +1181,7 @@ pub enum IntentStatus { serde::Deserialize, serde::Serialize, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, ToSchema, @@ -1262,8 +1248,6 @@ pub enum PaymentMethodStatus { /// Indicates that the payment method is awaiting some data or action before it can be marked /// as 'active'. Processing, - /// Indicates that the payment method is awaiting some data before changing state to active - AwaitingData, } impl From for PaymentMethodStatus { @@ -1344,7 +1328,7 @@ pub enum PaymentExperience { serde::Deserialize, serde::Serialize, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, ToSchema, @@ -1429,7 +1413,6 @@ pub enum PaymentMethodType { Twint, UpiCollect, Vipps, - Venmo, Walley, WeChatPay, SevenEleven, @@ -1438,7 +1421,6 @@ pub enum PaymentMethodType { FamilyMart, Seicomart, PayEasy, - LocalBankTransfer, } /// Indicates the type of payment method. Eg: 'card', 'wallet', etc. @@ -1453,7 +1435,7 @@ pub enum PaymentMethodType { serde::Deserialize, serde::Serialize, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, ToSchema, @@ -1561,7 +1543,7 @@ pub enum MandateStatus { serde::Deserialize, serde::Serialize, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, ToSchema, @@ -1727,7 +1709,7 @@ pub enum CountryAlpha3 { Eq, Hash, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, Deserialize, @@ -2114,7 +2096,6 @@ pub enum PayoutStatus { RequiresCreation, RequiresPayoutMethodData, RequiresFulfillment, - RequiresVendorAccountCreation, } #[derive( @@ -2128,7 +2109,7 @@ pub enum PayoutStatus { serde::Deserialize, serde::Serialize, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, ToSchema, @@ -2251,7 +2232,7 @@ pub enum FrmSuggestion { #[default] FrmCancelTransaction, FrmManualReview, - FrmAuthorizeTransaction, // When manual capture payment which was marked fraud and held, when approved needs to be authorized. + FrmAutoRefund, } #[derive( @@ -2504,219 +2485,3 @@ pub enum PermissionGroup { MerchantDetailsManage, OrganizationManage, } - -/// Name of banks supported by Hyperswitch -#[derive( - Clone, - Copy, - Debug, - Eq, - Hash, - PartialEq, - serde::Deserialize, - serde::Serialize, - strum::Display, - strum::EnumString, - ToSchema, -)] -#[strum(serialize_all = "snake_case")] -#[serde(rename_all = "snake_case")] -pub enum BankNames { - AmericanExpress, - AffinBank, - AgroBank, - AllianceBank, - AmBank, - BankOfAmerica, - BankIslam, - BankMuamalat, - BankRakyat, - BankSimpananNasional, - Barclays, - BlikPSP, - CapitalOne, - Chase, - Citi, - CimbBank, - Discover, - NavyFederalCreditUnion, - PentagonFederalCreditUnion, - SynchronyBank, - WellsFargo, - AbnAmro, - AsnBank, - Bunq, - Handelsbanken, - HongLeongBank, - HsbcBank, - Ing, - Knab, - KuwaitFinanceHouse, - Moneyou, - Rabobank, - Regiobank, - Revolut, - SnsBank, - TriodosBank, - VanLanschot, - ArzteUndApothekerBank, - AustrianAnadiBankAg, - BankAustria, - Bank99Ag, - BankhausCarlSpangler, - BankhausSchelhammerUndSchatteraAg, - BankMillennium, - BankPEKAOSA, - BawagPskAg, - BksBankAg, - BrullKallmusBankAg, - BtvVierLanderBank, - CapitalBankGraweGruppeAg, - CeskaSporitelna, - Dolomitenbank, - EasybankAg, - EPlatbyVUB, - ErsteBankUndSparkassen, - FrieslandBank, - HypoAlpeadriabankInternationalAg, - HypoNoeLbFurNiederosterreichUWien, - HypoOberosterreichSalzburgSteiermark, - HypoTirolBankAg, - HypoVorarlbergBankAg, - HypoBankBurgenlandAktiengesellschaft, - KomercniBanka, - MBank, - MarchfelderBank, - Maybank, - OberbankAg, - OsterreichischeArzteUndApothekerbank, - OcbcBank, - PayWithING, - PlaceZIPKO, - PlatnoscOnlineKartaPlatnicza, - PosojilnicaBankEGen, - PostovaBanka, - PublicBank, - RaiffeisenBankengruppeOsterreich, - RhbBank, - SchelhammerCapitalBankAg, - StandardCharteredBank, - SchoellerbankAg, - SpardaBankWien, - SporoPay, - SantanderPrzelew24, - TatraPay, - Viamo, - VolksbankGruppe, - VolkskreditbankAg, - VrBankBraunau, - UobBank, - PayWithAliorBank, - BankiSpoldzielcze, - PayWithInteligo, - BNPParibasPoland, - BankNowySA, - CreditAgricole, - PayWithBOS, - PayWithCitiHandlowy, - PayWithPlusBank, - ToyotaBank, - VeloBank, - ETransferPocztowy24, - PlusBank, - EtransferPocztowy24, - BankiSpbdzielcze, - BankNowyBfgSa, - GetinBank, - Blik, - NoblePay, - IdeaBank, - EnveloBank, - NestPrzelew, - MbankMtransfer, - Inteligo, - PbacZIpko, - BnpParibas, - BankPekaoSa, - VolkswagenBank, - AliorBank, - Boz, - BangkokBank, - KrungsriBank, - KrungThaiBank, - TheSiamCommercialBank, - KasikornBank, - OpenBankSuccess, - OpenBankFailure, - OpenBankCancelled, - Aib, - BankOfScotland, - DanskeBank, - FirstDirect, - FirstTrust, - Halifax, - Lloyds, - Monzo, - NatWest, - NationwideBank, - RoyalBankOfScotland, - Starling, - TsbBank, - TescoBank, - UlsterBank, - Yoursafe, - N26, - NationaleNederlanden, -} -#[derive( - Clone, - Copy, - Debug, - Eq, - Hash, - PartialEq, - serde::Deserialize, - serde::Serialize, - strum::Display, - strum::EnumString, - ToSchema, -)] -#[strum(serialize_all = "snake_case")] -#[serde(rename_all = "snake_case")] -pub enum BankType { - Checking, - Savings, -} -#[derive( - Clone, - Copy, - Debug, - Eq, - Hash, - PartialEq, - serde::Deserialize, - serde::Serialize, - strum::Display, - strum::EnumString, - ToSchema, -)] -#[strum(serialize_all = "snake_case")] -#[serde(rename_all = "snake_case")] -pub enum BankHolderType { - Personal, - Business, -} - -#[derive(Debug, Clone, PartialEq, Eq, strum::Display, serde::Deserialize, serde::Serialize)] -#[strum(serialize_all = "snake_case")] -#[serde(rename_all = "snake_case")] -pub enum TokenPurpose { - #[serde(rename = "totp")] - #[strum(serialize = "totp")] - TOTP, - VerifyEmail, - AcceptInvitationFromEmail, - ResetPassword, - AcceptInvite, - UserInfo, -} diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs index faca2579c0a..63abfdb3f73 100644 --- a/crates/common_enums/src/transformers.rs +++ b/crates/common_enums/src/transformers.rs @@ -1842,7 +1842,6 @@ impl From for PaymentMethod { PaymentMethodType::PermataBankTransfer => Self::BankTransfer, PaymentMethodType::Pix => Self::BankTransfer, PaymentMethodType::Pse => Self::BankTransfer, - PaymentMethodType::LocalBankTransfer => Self::BankTransfer, PaymentMethodType::PayBright => Self::PayLater, PaymentMethodType::Paypal => Self::Wallet, PaymentMethodType::PaySafeCard => Self::GiftCard, @@ -1855,7 +1854,6 @@ impl From for PaymentMethod { PaymentMethodType::Twint => Self::Wallet, PaymentMethodType::UpiCollect => Self::Upi, PaymentMethodType::Vipps => Self::Wallet, - PaymentMethodType::Venmo => Self::Wallet, PaymentMethodType::Walley => Self::PayLater, PaymentMethodType::WeChatPay => Self::Wallet, PaymentMethodType::TouchNGo => Self::Wallet, diff --git a/crates/common_utils/Cargo.toml b/crates/common_utils/Cargo.toml index 4179bc876ec..7e0dc0a1eb3 100644 --- a/crates/common_utils/Cargo.toml +++ b/crates/common_utils/Cargo.toml @@ -13,33 +13,33 @@ async_ext = ["dep:futures", "dep:async-trait"] logs = ["dep:router_env"] [dependencies] -async-trait = { version = "0.1.79", optional = true } -bytes = "1.6.0" -diesel = "2.1.5" +async-trait = { version = "0.1.68", optional = true } +bytes = "1.4.0" +diesel = "2.1.0" error-stack = "0.4.1" -futures = { version = "0.3.30", optional = true } +futures = { version = "0.3.28", optional = true } hex = "0.4.3" -http = "0.2.12" +http = "0.2.9" md5 = "0.7.0" nanoid = "0.4.0" -once_cell = "1.19.0" +once_cell = "1.18.0" phonenumber = "0.3.3" -quick-xml = { version = "0.31.0", features = ["serialize"] } +quick-xml = { version = "0.28.2", features = ["serialize"] } rand = "0.8.5" -regex = "1.10.4" +regex = "1.8.4" reqwest = { version = "0.12.2", features = ["json", "native-tls", "gzip", "multipart"] } -ring = { version = "0.17.8", features = ["std", "wasm32_unknown_unknown_js"] } +ring = { version = "0.16.20", features = ["std"] } rustc-hash = "1.1.0" -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" serde_urlencoded = "0.7.1" -signal-hook = { version = "0.3.17", optional = true } -strum = { version = "0.26.2", features = ["derive"] } -thiserror = "1.0.58" -time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] } -tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"], optional = true } +signal-hook = { version = "0.3.15", optional = true } +strum = { version = "0.24.1", features = ["derive"] } +thiserror = "1.0.40" +time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] } +tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"], optional = true } semver = { version = "1.0.22", features = ["serde"] } -uuid = { version = "1.8.0", features = ["v7"] } +uuid = { version = "1.7.0", features = ["v7"] } # First party crates common_enums = { version = "0.1.0", path = "../common_enums" } @@ -50,6 +50,6 @@ router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"], optional = true } [dev-dependencies] -fake = "2.9.2" -proptest = "1.4.0" -test-case = "3.3.1" +fake = "2.6.1" +proptest = "1.2.0" +test-case = "3.1.0" diff --git a/crates/common_utils/src/access_token.rs b/crates/common_utils/src/access_token.rs deleted file mode 100644 index 56c2a4f784f..00000000000 --- a/crates/common_utils/src/access_token.rs +++ /dev/null @@ -1,11 +0,0 @@ -//! Commonly used utilities for access token - -use std::fmt::Display; - -/// Create a key for fetching the access token from redis -pub fn create_access_token_key( - merchant_id: impl Display, - merchant_connector_id_or_connector_name: impl Display, -) -> String { - format!("access_token_{merchant_id}_{merchant_connector_id_or_connector_name}") -} diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rs index 509056152eb..9ab5f0ac61d 100644 --- a/crates/common_utils/src/consts.rs +++ b/crates/common_utils/src/consts.rs @@ -22,15 +22,12 @@ pub static FRM_CONFIGS_EG: &str = r#" /// Maximum limit for payments list get api pub const PAYMENTS_LIST_MAX_LIMIT_V1: u32 = 100; /// Maximum limit for payments list post api with filters -pub const PAYMENTS_LIST_MAX_LIMIT_V2: u32 = 50; +pub const PAYMENTS_LIST_MAX_LIMIT_V2: u32 = 20; /// Default limit for payments list API pub fn default_payments_list_limit() -> u32 { 10 } -/// Average delay (in seconds) between account onboarding's API response and the changes to actually reflect at Stripe's end -pub const STRIPE_ACCOUNT_ONBOARDING_DELAY_IN_SECONDS: i64 = 15; - /// Maximum limit for payment link list get api pub const PAYMENTS_LINK_LIST_LIMIT: u32 = 100; @@ -71,15 +68,3 @@ pub const DEFAULT_SDK_LAYOUT: &str = "tabs"; /// Payment intent default client secret expiry (in seconds) pub const DEFAULT_SESSION_EXPIRY: i64 = 15 * 60; - -/// Default bool for Display sdk only -pub const DEFAULT_DISPLAY_SDK_ONLY: bool = false; - -/// Default bool to enable saved payment method -pub const DEFAULT_ENABLE_SAVED_PAYMENT_METHOD: bool = false; - -/// Default ttl for Extended card info in redis (in seconds) -pub const DEFAULT_TTL_FOR_EXTENDED_CARD_INFO: u16 = 15 * 60; - -/// Max ttl for Extended card info in redis (in seconds) -pub const MAX_TTL_FOR_EXTENDED_CARD_INFO: u16 = 60 * 60; diff --git a/crates/common_utils/src/custom_serde.rs b/crates/common_utils/src/custom_serde.rs index 79e0c5b85e7..e4608c4f371 100644 --- a/crates/common_utils/src/custom_serde.rs +++ b/crates/common_utils/src/custom_serde.rs @@ -265,22 +265,3 @@ pub mod iso8601custom { }) } } - -#[cfg(test)] -mod tests { - use serde::{Deserialize, Serialize}; - use serde_json::json; - - #[test] - fn test_leap_second_parse() { - #[derive(Serialize, Deserialize)] - struct Try { - #[serde(with = "crate::custom_serde::iso8601")] - f: time::PrimitiveDateTime, - } - let leap_second_date_time = json!({"f": "2023-12-31T23:59:60.000Z"}); - let deser = serde_json::from_value::(leap_second_date_time); - - assert!(deser.is_ok()) - } -} diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs index c51749cf202..4e4a09d9387 100644 --- a/crates/common_utils/src/events.rs +++ b/crates/common_utils/src/events.rs @@ -56,9 +56,6 @@ pub enum ApiEventsType { Events { merchant_id_or_profile_id: String, }, - Poll { - poll_id: String, - }, } impl ApiEventMetric for serde_json::Value {} diff --git a/crates/common_utils/src/lib.rs b/crates/common_utils/src/lib.rs index f24b67fde1b..b1a708f7a08 100644 --- a/crates/common_utils/src/lib.rs +++ b/crates/common_utils/src/lib.rs @@ -2,7 +2,6 @@ #![warn(missing_docs, missing_debug_implementations)] #![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR" ), "/", "README.md"))] -pub mod access_token; pub mod consts; pub mod crypto; pub mod custom_serde; @@ -24,15 +23,15 @@ pub mod validation; /// Date-time utilities. pub mod date_time { - #[cfg(feature = "async_ext")] - use std::time::Instant; use std::{marker::PhantomData, num::NonZeroU8}; use masking::{Deserialize, Serialize}; + #[cfg(feature = "async_ext")] + use time::Instant; use time::{ format_description::{ well_known::iso8601::{Config, EncodedConfig, Iso8601, TimePrecision}, - BorrowedFormatItem, + FormatItem, }, OffsetDateTime, PrimitiveDateTime, }; @@ -44,8 +43,6 @@ pub mod date_time { YYYYMMDDHHmmss, /// Format the date in 20191105 format YYYYMMDD, - /// Format the date in 201911050811 format - YYYYMMDDHHmm, } /// Create a new [`PrimitiveDateTime`] with the current date and time in UTC. @@ -71,7 +68,7 @@ pub mod date_time { ) -> (T, f64) { let start = Instant::now(); let result = block().await; - (result, start.elapsed().as_secs_f64() * 1000f64) + (result, start.elapsed().as_seconds_f64() * 1000f64) } /// Return the given date and time in UTC with the given format Eg: format: YYYYMMDDHHmmss Eg: 20191105081132 @@ -79,7 +76,7 @@ pub mod date_time { date: PrimitiveDateTime, format: DateFormat, ) -> Result { - let format = <&[BorrowedFormatItem<'_>]>::from(format); + let format = <&[FormatItem<'_>]>::from(format); date.format(&format) } @@ -93,12 +90,11 @@ pub mod date_time { now().assume_utc().format(&Iso8601::) } - impl From for &[BorrowedFormatItem<'_>] { + impl From for &[FormatItem<'_>] { fn from(format: DateFormat) -> Self { match format { DateFormat::YYYYMMDDHHmmss => time::macros::format_description!("[year repr:full][month padding:zero repr:numerical][day padding:zero][hour padding:zero repr:24][minute padding:zero][second padding:zero]"), DateFormat::YYYYMMDD => time::macros::format_description!("[year repr:full][month padding:zero repr:numerical][day padding:zero]"), - DateFormat::YYYYMMDDHHmm => time::macros::format_description!("[year repr:full][month padding:zero repr:numerical][day padding:zero][hour padding:zero repr:24][minute padding:zero]"), } } } diff --git a/crates/common_utils/src/request.rs b/crates/common_utils/src/request.rs index 264179fc603..47f280bc577 100644 --- a/crates/common_utils/src/request.rs +++ b/crates/common_utils/src/request.rs @@ -35,8 +35,8 @@ pub struct Request { pub url: String, pub headers: Headers, pub method: Method, - pub certificate: Option>, - pub certificate_key: Option>, + pub certificate: Option, + pub certificate_key: Option, pub body: Option, } @@ -96,11 +96,11 @@ impl Request { self.headers.insert((String::from(header), value)); } - pub fn add_certificate(&mut self, certificate: Option>) { + pub fn add_certificate(&mut self, certificate: Option) { self.certificate = certificate; } - pub fn add_certificate_key(&mut self, certificate_key: Option>) { + pub fn add_certificate_key(&mut self, certificate_key: Option) { self.certificate = certificate_key; } } @@ -110,8 +110,8 @@ pub struct RequestBuilder { pub url: String, pub headers: Headers, pub method: Method, - pub certificate: Option>, - pub certificate_key: Option>, + pub certificate: Option, + pub certificate_key: Option, pub body: Option, } @@ -157,12 +157,12 @@ impl RequestBuilder { self } - pub fn add_certificate(mut self, certificate: Option>) -> Self { + pub fn add_certificate(mut self, certificate: Option) -> Self { self.certificate = certificate; self } - pub fn add_certificate_key(mut self, certificate_key: Option>) -> Self { + pub fn add_certificate_key(mut self, certificate_key: Option) -> Self { self.certificate_key = certificate_key; self } diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs index b15a519caad..418ce591fd2 100644 --- a/crates/common_utils/src/types.rs +++ b/crates/common_utils/src/types.rs @@ -157,7 +157,7 @@ pub enum Surcharge { } /// This struct lets us represent a semantic version type -#[derive(Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, Ord, PartialOrd)] +#[derive(Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression)] #[diesel(sql_type = Jsonb)] #[derive(serde::Serialize, serde::Deserialize)] pub struct SemanticVersion(#[serde(with = "Version")] Version); @@ -167,10 +167,6 @@ impl SemanticVersion { pub fn get_major(&self) -> u64 { self.0.major } - /// Constructs new SemanticVersion instance - pub fn new(major: u64, minor: u64, patch: u64) -> Self { - Self(Version::new(major, minor, patch)) - } } impl Display for SemanticVersion { diff --git a/crates/config_importer/Cargo.toml b/crates/config_importer/Cargo.toml index 129abae15ad..d831812cdca 100644 --- a/crates/config_importer/Cargo.toml +++ b/crates/config_importer/Cargo.toml @@ -12,12 +12,12 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -anyhow = "1.0.81" -clap = { version = "4.4.18", default-features = false, features = ["std", "derive", "help", "usage"] } -indexmap = { version = "2.2.6", optional = true } -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" -toml = { version = "0.8.12", default-features = false, features = ["parse"] } +anyhow = "1.0.75" +clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] } +indexmap = { version = "2.1.0", optional = true } +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" +toml = { version = "0.7.4", default-features = false, features = ["parse"] } [features] default = ["preserve_order"] diff --git a/crates/connector_configs/Cargo.toml b/crates/connector_configs/Cargo.toml index de0c963d7b6..7966e6a5afe 100644 --- a/crates/connector_configs/Cargo.toml +++ b/crates/connector_configs/Cargo.toml @@ -16,7 +16,7 @@ payouts = ["api_models/payouts"] [dependencies] api_models = { version = "0.1.0", path = "../api_models", package = "api_models" } -serde = { version = "1.0.197", features = ["derive"] } -serde_with = "3.7.0" -toml = "0.8.12" -utoipa = { version = "4.2.0", features = ["preserve_order", "preserve_path_order"] } +serde = { version = "1.0.193", features = ["derive"] } +serde_with = "3.4.0" +toml = "0.7.3" +utoipa = { version = "3.5.0", features = ["preserve_order", "preserve_path_order"] } diff --git a/crates/connector_configs/src/common_config.rs b/crates/connector_configs/src/common_config.rs index b11a74a3ca6..495c0e5b6cc 100644 --- a/crates/connector_configs/src/common_config.rs +++ b/crates/connector_configs/src/common_config.rs @@ -87,9 +87,6 @@ pub struct ApiModelMetaData { pub merchant_name: Option, pub acquirer_bin: Option, pub acquirer_merchant_id: Option, - pub three_ds_requestor_name: Option, - pub three_ds_requestor_id: Option, - pub pull_mechanism_for_external_3ds_enabled: Option, } #[serde_with::skip_serializing_none] @@ -188,7 +185,4 @@ pub struct DashboardMetaData { pub merchant_name: Option, pub acquirer_bin: Option, pub acquirer_merchant_id: Option, - pub three_ds_requestor_name: Option, - pub three_ds_requestor_id: Option, - pub pull_mechanism_for_external_3ds_enabled: Option, } diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs index b9fbed28158..74317319f50 100644 --- a/crates/connector_configs/src/connector.rs +++ b/crates/connector_configs/src/connector.rs @@ -55,10 +55,6 @@ pub enum ConnectorAuthType { CurrencyAuthKey { auth_key_map: HashMap, }, - CertificateAuth { - certificate: String, - private_key: String, - }, #[default] NoKey, } @@ -87,9 +83,6 @@ pub struct ConfigMetadata { pub merchant_name: Option, pub acquirer_bin: Option, pub acquirer_merchant_id: Option, - pub three_ds_requestor_name: Option, - pub three_ds_requestor_id: Option, - pub pull_mechanism_for_external_3ds_enabled: Option, } #[serde_with::skip_serializing_none] @@ -137,7 +130,6 @@ pub struct ConnectorConfig { pub opennode: Option, pub bambora: Option, pub dlocal: Option, - pub ebanx_payout: Option, pub fiserv: Option, pub forte: Option, pub globalpay: Option, @@ -153,8 +145,6 @@ pub struct ConnectorConfig { pub nuvei: Option, pub payme: Option, pub paypal: Option, - #[cfg(feature = "payouts")] - pub paypal_payout: Option, pub payu: Option, pub placetopay: Option, pub plaid: Option, @@ -164,25 +154,21 @@ pub struct ConnectorConfig { pub rapyd: Option, pub shift4: Option, pub stripe: Option, - #[cfg(feature = "payouts")] - pub stripe_payout: Option, pub signifyd: Option, pub trustpay: Option, pub threedsecureio: Option, - pub netcetera: Option, pub tsys: Option, pub volt: Option, #[cfg(feature = "payouts")] pub wise_payout: Option, pub worldline: Option, pub worldpay: Option, + pub zen: Option, pub square: Option, pub stax: Option, pub dummy_connector: Option, pub stripe_test: Option, pub paypal_test: Option, - pub zen: Option, - pub zsl: Option, } impl ConnectorConfig { @@ -219,10 +205,7 @@ impl ConnectorConfig { let connector_data = Self::new()?; match connector { PayoutConnectors::Adyen => Ok(connector_data.adyen_payout), - PayoutConnectors::Stripe => Ok(connector_data.stripe_payout), PayoutConnectors::Wise => Ok(connector_data.wise_payout), - PayoutConnectors::Paypal => Ok(connector_data.paypal_payout), - PayoutConnectors::Ebanx => Ok(connector_data.ebanx_payout), } } @@ -232,7 +215,6 @@ impl ConnectorConfig { let connector_data = Self::new()?; match connector { AuthenticationConnectors::Threedsecureio => Ok(connector_data.threedsecureio), - AuthenticationConnectors::Netcetera => Ok(connector_data.netcetera), } } @@ -246,7 +228,7 @@ impl ConnectorConfig { Connector::Airwallex => Ok(connector_data.airwallex), Connector::Authorizedotnet => Ok(connector_data.authorizedotnet), Connector::Bankofamerica => Ok(connector_data.bankofamerica), - Connector::Billwerk => Ok(connector_data.billwerk), + // Connector::Billwerk => Ok(connector_data.billwerk), Added as template code for future usage Connector::Bitpay => Ok(connector_data.bitpay), Connector::Bluesnap => Ok(connector_data.bluesnap), Connector::Boku => Ok(connector_data.boku), @@ -260,7 +242,6 @@ impl ConnectorConfig { Connector::Opennode => Ok(connector_data.opennode), Connector::Bambora => Ok(connector_data.bambora), Connector::Dlocal => Ok(connector_data.dlocal), - Connector::Ebanx => Ok(connector_data.ebanx_payout), Connector::Fiserv => Ok(connector_data.fiserv), Connector::Forte => Ok(connector_data.forte), Connector::Globalpay => Ok(connector_data.globalpay), @@ -296,7 +277,6 @@ impl ConnectorConfig { Connector::Worldline => Ok(connector_data.worldline), Connector::Worldpay => Ok(connector_data.worldpay), Connector::Zen => Ok(connector_data.zen), - Connector::Zsl => Ok(connector_data.zsl), #[cfg(feature = "dummy_connector")] Connector::DummyConnector1 => Ok(connector_data.dummy_connector), #[cfg(feature = "dummy_connector")] @@ -311,7 +291,6 @@ impl ConnectorConfig { Connector::DummyConnector6 => Ok(connector_data.dummy_connector), #[cfg(feature = "dummy_connector")] Connector::DummyConnector7 => Ok(connector_data.paypal_test), - Connector::Netcetera => Ok(connector_data.netcetera), } } } diff --git a/crates/connector_configs/src/response_modifier.rs b/crates/connector_configs/src/response_modifier.rs index 8f7da58c4dc..6fbf85f4fcf 100644 --- a/crates/connector_configs/src/response_modifier.rs +++ b/crates/connector_configs/src/response_modifier.rs @@ -317,10 +317,6 @@ impl From for DashboardMetaData { merchant_name: api_model.merchant_name, acquirer_bin: api_model.acquirer_bin, acquirer_merchant_id: api_model.acquirer_merchant_id, - three_ds_requestor_name: api_model.three_ds_requestor_name, - three_ds_requestor_id: api_model.three_ds_requestor_id, - pull_mechanism_for_external_3ds_enabled: api_model - .pull_mechanism_for_external_3ds_enabled, } } } diff --git a/crates/connector_configs/src/transformer.rs b/crates/connector_configs/src/transformer.rs index 203e48ac507..09a28ac2b07 100644 --- a/crates/connector_configs/src/transformer.rs +++ b/crates/connector_configs/src/transformer.rs @@ -114,8 +114,8 @@ impl DashboardRequestPayload { maximum_amount: Some(68607706), recurring_enabled: true, installment_payment_enabled: false, - accepted_currencies: method.accepted_currencies, - accepted_countries: method.accepted_countries, + accepted_currencies: None, + accepted_countries: None, payment_experience: None, }; card_payment_method_types.push(data) @@ -192,9 +192,6 @@ impl DashboardRequestPayload { merchant_name: None, acquirer_bin: None, acquirer_merchant_id: None, - three_ds_requestor_name: None, - three_ds_requestor_id: None, - pull_mechanism_for_external_3ds_enabled: None, }; let meta_data = match request.metadata { Some(data) => data, @@ -214,10 +211,6 @@ impl DashboardRequestPayload { let merchant_name = meta_data.merchant_name; let acquirer_bin = meta_data.acquirer_bin; let acquirer_merchant_id = meta_data.acquirer_merchant_id; - let three_ds_requestor_name = meta_data.three_ds_requestor_name; - let three_ds_requestor_id = meta_data.three_ds_requestor_id; - let pull_mechanism_for_external_3ds_enabled = - meta_data.pull_mechanism_for_external_3ds_enabled; Some(ApiModelMetaData { google_pay, @@ -234,9 +227,6 @@ impl DashboardRequestPayload { merchant_name, acquirer_bin, acquirer_merchant_id, - three_ds_requestor_name, - three_ds_requestor_id, - pull_mechanism_for_external_3ds_enabled, }) } diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml index b6be7bb0eb3..0e18bb33ed2 100644 --- a/crates/connector_configs/toml/development.toml +++ b/crates/connector_configs/toml/development.toml @@ -866,48 +866,6 @@ merchant_name="Google Pay Merchant Name" gateway_merchant_id="Google Pay Merchant Key" merchant_id="Google Pay Merchant ID" -[cybersource_payout] -[[cybersource_payout.credit]] - payment_method_type = "Mastercard" -[[cybersource_payout.credit]] - payment_method_type = "Visa" -[[cybersource_payout.credit]] - payment_method_type = "Interac" -[[cybersource_payout.credit]] - payment_method_type = "AmericanExpress" -[[cybersource_payout.credit]] - payment_method_type = "JCB" -[[cybersource_payout.credit]] - payment_method_type = "DinersClub" -[[cybersource_payout.credit]] - payment_method_type = "Discover" -[[cybersource_payout.credit]] - payment_method_type = "CartesBancaires" -[[cybersource_payout.credit]] - payment_method_type = "UnionPay" -[[cybersource_payout.debit]] - payment_method_type = "Mastercard" -[[cybersource_payout.debit]] - payment_method_type = "Visa" -[[cybersource_payout.debit]] - payment_method_type = "Interac" -[[cybersource_payout.debit]] - payment_method_type = "AmericanExpress" -[[cybersource_payout.debit]] - payment_method_type = "JCB" -[[cybersource_payout.debit]] - payment_method_type = "DinersClub" -[[cybersource_payout.debit]] - payment_method_type = "Discover" -[[cybersource_payout.debit]] - payment_method_type = "CartesBancaires" -[[cybersource_payout.debit]] - payment_method_type = "UnionPay" -[cybersource_payout.connector_auth.SignatureKey] -api_key="Key" -key1="Merchant ID" -api_secret="Shared Secret" - [dlocal] [[dlocal.credit]] payment_method_type = "Mastercard" @@ -952,12 +910,6 @@ api_secret="Secret Key" [dlocal.connector_webhook_details] merchant_secret="Source verification key" -[ebanx_payout] -[[ebanx_payout.bank_transfer]] - payment_method_type = "pix" -[ebanx_payout.connector_auth.HeaderKey] -api_key = "Integration Key" - [fiserv] [[fiserv.credit]] payment_method_type = "Mastercard" @@ -1373,10 +1325,6 @@ key1="Public Key" [nmi.connector_webhook_details] merchant_secret="Source verification key" -[nmi.metadata] -acquirer_bin = "Acquirer Bin" -acquirer_merchant_id = "Acquirer Merchant ID" - [nmi.metadata.google_pay] merchant_name="Google Pay Merchant Name" gateway_merchant_id="Google Pay Merchant Key" @@ -1655,14 +1603,6 @@ key1="Client ID" [paypal.connector_webhook_details] merchant_secret="Source verification key" -[paypal_payout] -[[paypal.wallet]] - payment_method_type = "paypal" -[[paypal.wallet]] - payment_method_type = "venmo" -[paypal_payout.connector_auth.BodyKey] -api_key="Client Secret" -key1="Client ID" [payu] [[payu.credit]] @@ -2400,12 +2340,6 @@ pay_wall_secret="Pay Wall Secret" terminal_uuid="Terminal UUID" pay_wall_secret="Pay Wall Secret" -[zsl] -[[zsl.bank_transfer]] - payment_method_type = "local_bank_transfer" -[zsl.connector_auth.BodyKey] -api_key = "Key" -key1 = "Merchant ID" [dummy_connector] [[dummy_connector.credit]] @@ -2636,12 +2570,6 @@ api_key = "Adyen API Key (Payout creation)" api_secret = "Adyen Key (Payout submission)" key1 = "Adyen Account Id" -[stripe_payout] -[[stripe_payout.bank_transfer]] - payment_method_type = "ach" -[stripe_payout.connector_auth.HeaderKey] -api_key = "Stripe API Key" - [wise_payout] [[wise_payout.bank_transfer]] payment_method_type = "ach" @@ -2659,58 +2587,4 @@ api_key="Api Key" [threedsecureio.metadata] mcc="MCC" merchant_country_code="3 digit numeric country code" -merchant_name="Name of the merchant" -pull_mechanism_for_external_3ds_enabled=true - -[netcetera] -[netcetera.connector_auth.CertificateAuth] -certificate="Base64 encoded PEM formatted certificate chain" -private_key="Base64 encoded PEM formatted private key" -[netcetera.metadata] -mcc="MCC" -merchant_country_code="3 digit numeric country code" -merchant_name="Name of the merchant" -endpoint_prefix="string that will replace '{prefix}' in this base url 'https://{prefix}.3ds-server.prev.netcetera-cloud-payment.ch'" -three_ds_requestor_name="ThreeDS requestor name" -three_ds_requestor_id="ThreeDS request id" - -[billwerk] -[[billwerk.credit]] - payment_method_type = "Mastercard" -[[billwerk.credit]] - payment_method_type = "Visa" -[[billwerk.credit]] - payment_method_type = "Interac" -[[billwerk.credit]] - payment_method_type = "AmericanExpress" -[[billwerk.credit]] - payment_method_type = "JCB" -[[billwerk.credit]] - payment_method_type = "DinersClub" -[[billwerk.credit]] - payment_method_type = "Discover" -[[billwerk.credit]] - payment_method_type = "CartesBancaires" -[[billwerk.credit]] - payment_method_type = "UnionPay" -[[billwerk.debit]] - payment_method_type = "Mastercard" -[[billwerk.debit]] - payment_method_type = "Visa" -[[billwerk.debit]] - payment_method_type = "Interac" -[[billwerk.debit]] - payment_method_type = "AmericanExpress" -[[billwerk.debit]] - payment_method_type = "JCB" -[[billwerk.debit]] - payment_method_type = "DinersClub" -[[billwerk.debit]] - payment_method_type = "Discover" -[[billwerk.debit]] - payment_method_type = "CartesBancaires" -[[billwerk.debit]] - payment_method_type = "UnionPay" -[billwerk.connector_auth.BodyKey] -api_key="Private Api Key" -key1="Public Api Key" \ No newline at end of file +merchant_name="Name of the merchant" \ No newline at end of file diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml index 311a029488c..079ead7e4ce 100644 --- a/crates/connector_configs/toml/production.toml +++ b/crates/connector_configs/toml/production.toml @@ -1913,52 +1913,4 @@ terminal_uuid="Terminal UUID" pay_wall_secret="Pay Wall Secret" [zen.metadata.google_pay] terminal_uuid="Terminal UUID" -pay_wall_secret="Pay Wall Secret" - -[zsl] -[[zsl.bank_transfer]] - payment_method_type = "local_bank_transfer" -[zsl.connector_auth.BodyKey] -api_key = "Key" -key1 = "Merchant ID" - -[billwerk] -[[billwerk.credit]] - payment_method_type = "Mastercard" -[[billwerk.credit]] - payment_method_type = "Visa" -[[billwerk.credit]] - payment_method_type = "Interac" -[[billwerk.credit]] - payment_method_type = "AmericanExpress" -[[billwerk.credit]] - payment_method_type = "JCB" -[[billwerk.credit]] - payment_method_type = "DinersClub" -[[billwerk.credit]] - payment_method_type = "Discover" -[[billwerk.credit]] - payment_method_type = "CartesBancaires" -[[billwerk.credit]] - payment_method_type = "UnionPay" -[[billwerk.debit]] - payment_method_type = "Mastercard" -[[billwerk.debit]] - payment_method_type = "Visa" -[[billwerk.debit]] - payment_method_type = "Interac" -[[billwerk.debit]] - payment_method_type = "AmericanExpress" -[[billwerk.debit]] - payment_method_type = "JCB" -[[billwerk.debit]] - payment_method_type = "DinersClub" -[[billwerk.debit]] - payment_method_type = "Discover" -[[billwerk.debit]] - payment_method_type = "CartesBancaires" -[[billwerk.debit]] - payment_method_type = "UnionPay" -[billwerk.connector_auth.BodyKey] -api_key="Private Api Key" -key1="Public Api Key" \ No newline at end of file +pay_wall_secret="Pay Wall Secret" \ No newline at end of file diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml index 502141382b7..f484e914531 100644 --- a/crates/connector_configs/toml/sandbox.toml +++ b/crates/connector_configs/toml/sandbox.toml @@ -866,48 +866,6 @@ merchant_name="Google Pay Merchant Name" gateway_merchant_id="Google Pay Merchant Key" merchant_id="Google Pay Merchant ID" -[cybersource_payout] -[[cybersource_payout.credit]] - payment_method_type = "Mastercard" -[[cybersource_payout.credit]] - payment_method_type = "Visa" -[[cybersource_payout.credit]] - payment_method_type = "Interac" -[[cybersource_payout.credit]] - payment_method_type = "AmericanExpress" -[[cybersource_payout.credit]] - payment_method_type = "JCB" -[[cybersource_payout.credit]] - payment_method_type = "DinersClub" -[[cybersource_payout.credit]] - payment_method_type = "Discover" -[[cybersource_payout.credit]] - payment_method_type = "CartesBancaires" -[[cybersource_payout.credit]] - payment_method_type = "UnionPay" -[[cybersource_payout.debit]] - payment_method_type = "Mastercard" -[[cybersource_payout.debit]] - payment_method_type = "Visa" -[[cybersource_payout.debit]] - payment_method_type = "Interac" -[[cybersource_payout.debit]] - payment_method_type = "AmericanExpress" -[[cybersource_payout.debit]] - payment_method_type = "JCB" -[[cybersource_payout.debit]] - payment_method_type = "DinersClub" -[[cybersource_payout.debit]] - payment_method_type = "Discover" -[[cybersource_payout.debit]] - payment_method_type = "CartesBancaires" -[[cybersource_payout.debit]] - payment_method_type = "UnionPay" -[cybersource_payout.connector_auth.SignatureKey] -api_key="Key" -key1="Merchant ID" -api_secret="Shared Secret" - [dlocal] [[dlocal.credit]] payment_method_type = "Mastercard" @@ -952,12 +910,6 @@ api_secret="Secret Key" [dlocal.connector_webhook_details] merchant_secret="Source verification key" -[ebanx_payout] -[[ebanx_payout.bank_transfer]] - payment_method_type = "pix" -[ebanx_payout.connector_auth.HeaderKey] -api_key = "Integration Key" - [fiserv] [[fiserv.credit]] payment_method_type = "Mastercard" @@ -1373,10 +1325,6 @@ key1="Public Key" [nmi.connector_webhook_details] merchant_secret="Source verification key" -[nmi.metadata] -acquirer_bin = "Acquirer Bin" -acquirer_merchant_id = "Acquirer Merchant ID" - [nmi.metadata.google_pay] merchant_name="Google Pay Merchant Name" gateway_merchant_id="Google Pay Merchant Key" @@ -1655,14 +1603,6 @@ key1="Client ID" [paypal.connector_webhook_details] merchant_secret="Source verification key" -[paypal_payout] -[[paypal.wallet]] - payment_method_type = "paypal" -[[paypal.wallet]] - payment_method_type = "venmo" -[paypal_payout.connector_auth.BodyKey] -api_key="Client Secret" -key1="Client ID" [payu] [[payu.credit]] @@ -2400,12 +2340,6 @@ pay_wall_secret="Pay Wall Secret" terminal_uuid="Terminal UUID" pay_wall_secret="Pay Wall Secret" -[zsl] -[[zsl.bank_transfer]] - payment_method_type = "local_bank_transfer" -[zsl.connector_auth.BodyKey] -api_key = "Key" -key1 = "Merchant ID" [dummy_connector] [[dummy_connector.credit]] @@ -2638,12 +2572,6 @@ api_key = "Adyen API Key (Payout creation)" api_secret = "Adyen Key (Payout submission)" key1 = "Adyen Account Id" -[stripe_payout] -[[stripe_payout.bank_transfer]] - payment_method_type = "ach" -[stripe_payout.connector_auth.HeaderKey] -api_key = "Stripe API Key" - [wise_payout] [[wise_payout.bank_transfer]] payment_method_type = "ach" @@ -2661,58 +2589,4 @@ api_key="Api Key" [threedsecureio.metadata] mcc="MCC" merchant_country_code="3 digit numeric country code" -merchant_name="Name of the merchant" -pull_mechanism_for_external_3ds_enabled=true - -[netcetera] -[netcetera.connector_auth.CertificateAuth] -certificate="Base64 encoded PEM formatted certificate chain" -private_key="Base64 encoded PEM formatted private key" -[netcetera.metadata] -mcc="MCC" -merchant_country_code="3 digit numeric country code" -merchant_name="Name of the merchant" -endpoint_prefix="string that will replace '{prefix}' in this base url 'https://{prefix}.3ds-server.prev.netcetera-cloud-payment.ch'" -three_ds_requestor_name="ThreeDS requestor name" -three_ds_requestor_id="ThreeDS request id" - -[billwerk] -[[billwerk.credit]] - payment_method_type = "Mastercard" -[[billwerk.credit]] - payment_method_type = "Visa" -[[billwerk.credit]] - payment_method_type = "Interac" -[[billwerk.credit]] - payment_method_type = "AmericanExpress" -[[billwerk.credit]] - payment_method_type = "JCB" -[[billwerk.credit]] - payment_method_type = "DinersClub" -[[billwerk.credit]] - payment_method_type = "Discover" -[[billwerk.credit]] - payment_method_type = "CartesBancaires" -[[billwerk.credit]] - payment_method_type = "UnionPay" -[[billwerk.debit]] - payment_method_type = "Mastercard" -[[billwerk.debit]] - payment_method_type = "Visa" -[[billwerk.debit]] - payment_method_type = "Interac" -[[billwerk.debit]] - payment_method_type = "AmericanExpress" -[[billwerk.debit]] - payment_method_type = "JCB" -[[billwerk.debit]] - payment_method_type = "DinersClub" -[[billwerk.debit]] - payment_method_type = "Discover" -[[billwerk.debit]] - payment_method_type = "CartesBancaires" -[[billwerk.debit]] - payment_method_type = "UnionPay" -[billwerk.connector_auth.BodyKey] -api_key="Private Api Key" -key1="Public Api Key" +merchant_name="Name of the merchant" \ No newline at end of file diff --git a/crates/currency_conversion/Cargo.toml b/crates/currency_conversion/Cargo.toml index 40129258a67..d2c99080bf6 100644 --- a/crates/currency_conversion/Cargo.toml +++ b/crates/currency_conversion/Cargo.toml @@ -3,8 +3,6 @@ name = "currency_conversion" description = "Currency conversion for cost based routing" version = "0.1.0" edition.workspace = true -rust-version.workspace = true -license.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -12,7 +10,7 @@ license.workspace = true common_enums = { version = "0.1.0", path = "../common_enums", package = "common_enums" } # Third party crates -rust_decimal = "1.35" +rust_decimal = "1.29" rusty-money = { git = "https://github.com/varunsrin/rusty_money", rev = "bbc0150742a0fff905225ff11ee09388e9babdcc", features = ["iso", "crypto"] } -serde = { version = "1.0.197", features = ["derive"] } -thiserror = "1.0.58" +serde = { version = "1.0.193", features = ["derive"] } +thiserror = "1.0.43" diff --git a/crates/hyperswitch_domain_models/Cargo.toml b/crates/data_models/Cargo.toml similarity index 76% rename from crates/hyperswitch_domain_models/Cargo.toml rename to crates/data_models/Cargo.toml index 58eff10a363..090983246d7 100644 --- a/crates/hyperswitch_domain_models/Cargo.toml +++ b/crates/data_models/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hyperswitch_domain_models" +name = "data_models" description = "Represents the data/domain models used by the business layer" version = "0.1.0" edition.workspace = true @@ -21,9 +21,9 @@ masking = { version = "0.1.0", path = "../masking" } diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"] } # Third party deps -async-trait = "0.1.79" +async-trait = "0.1.68" error-stack = "0.4.1" -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" -thiserror = "1.0.58" -time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] } +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" +thiserror = "1.0.40" +time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] } diff --git a/crates/hyperswitch_domain_models/README.md b/crates/data_models/README.md similarity index 70% rename from crates/hyperswitch_domain_models/README.md rename to crates/data_models/README.md index d0b974d13c6..0c1c5170558 100644 --- a/crates/hyperswitch_domain_models/README.md +++ b/crates/data_models/README.md @@ -1,3 +1,3 @@ -# Hyperswitch domain models +# Data models Represents the data/domain models used by the business/domain layer \ No newline at end of file diff --git a/crates/hyperswitch_domain_models/src/errors.rs b/crates/data_models/src/errors.rs similarity index 100% rename from crates/hyperswitch_domain_models/src/errors.rs rename to crates/data_models/src/errors.rs diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/data_models/src/lib.rs similarity index 100% rename from crates/hyperswitch_domain_models/src/lib.rs rename to crates/data_models/src/lib.rs diff --git a/crates/hyperswitch_domain_models/src/mandates.rs b/crates/data_models/src/mandates.rs similarity index 100% rename from crates/hyperswitch_domain_models/src/mandates.rs rename to crates/data_models/src/mandates.rs diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/data_models/src/payments.rs similarity index 90% rename from crates/hyperswitch_domain_models/src/payments.rs rename to crates/data_models/src/payments.rs index 8a7dfad5fcb..a6df7ede414 100644 --- a/crates/hyperswitch_domain_models/src/payments.rs +++ b/crates/data_models/src/payments.rs @@ -27,11 +27,8 @@ pub struct PaymentIntent { pub billing_address_id: Option, pub statement_descriptor_name: Option, pub statement_descriptor_suffix: Option, - #[serde(with = "common_utils::custom_serde::iso8601")] pub created_at: PrimitiveDateTime, - #[serde(with = "common_utils::custom_serde::iso8601")] pub modified_at: PrimitiveDateTime, - #[serde(with = "common_utils::custom_serde::iso8601::option")] pub last_synced: Option, pub setup_future_usage: Option, pub off_session: Option, @@ -57,7 +54,6 @@ pub struct PaymentIntent { pub incremental_authorization_allowed: Option, pub authorization_count: Option, pub fingerprint_id: Option, - #[serde(with = "common_utils::custom_serde::iso8601::option")] pub session_expiry: Option, pub request_external_three_ds_authentication: Option, } diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/data_models/src/payments/payment_attempt.rs similarity index 97% rename from crates/hyperswitch_domain_models/src/payments/payment_attempt.rs rename to crates/data_models/src/payments/payment_attempt.rs index 7e406ca24d5..8984c1caeeb 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +++ b/crates/data_models/src/payments/payment_attempt.rs @@ -99,7 +99,6 @@ pub trait PaymentAttemptInterface { payment_method: Option>, payment_method_type: Option>, authentication_type: Option>, - merchant_connector_id: Option>, storage_scheme: storage_enums::MerchantStorageScheme, ) -> error_stack::Result; } @@ -303,7 +302,6 @@ pub enum PaymentAttemptUpdate { currency: storage_enums::Currency, status: storage_enums::AttemptStatus, authentication_type: Option, - capture_method: Option, payment_method: Option, browser_info: Option, connector: Option, @@ -339,10 +337,6 @@ pub enum PaymentAttemptUpdate { error_message: Option>, updated_by: String, }, - PaymentMethodDetailsUpdate { - payment_method_id: Option, - updated_by: String, - }, VoidUpdate { status: storage_enums::AttemptStatus, cancellation_reason: Option, @@ -353,7 +347,7 @@ pub enum PaymentAttemptUpdate { connector: Option, connector_transaction_id: Option, authentication_type: Option, - payment_method_id: Option, + payment_method_id: Option>, mandate_id: Option, connector_metadata: Option, payment_token: Option, @@ -373,7 +367,7 @@ pub enum PaymentAttemptUpdate { status: storage_enums::AttemptStatus, connector: Option, connector_transaction_id: Option, - payment_method_id: Option, + payment_method_id: Option>, error_code: Option>, error_message: Option>, error_reason: Option>, @@ -409,7 +403,7 @@ pub enum PaymentAttemptUpdate { }, PreprocessingUpdate { status: storage_enums::AttemptStatus, - payment_method_id: Option, + payment_method_id: Option>, connector_metadata: Option, preprocessing_step_id: Option, connector_transaction_id: Option, diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/data_models/src/payments/payment_intent.rs similarity index 97% rename from crates/hyperswitch_domain_models/src/payments/payment_intent.rs rename to crates/data_models/src/payments/payment_intent.rs index a5e631b5ac3..83b266c3470 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs +++ b/crates/data_models/src/payments/payment_intent.rs @@ -182,7 +182,6 @@ pub enum PaymentIntentUpdate { updated_by: String, }, ApproveUpdate { - status: storage_enums::IntentStatus, merchant_decision: Option, updated_by: String, }, @@ -383,11 +382,9 @@ impl From for PaymentIntentUpdateInternal { ..Default::default() }, PaymentIntentUpdate::ApproveUpdate { - status, merchant_decision, updated_by, } => Self { - status: Some(status), merchant_decision, updated_by, ..Default::default() @@ -433,14 +430,12 @@ pub struct PaymentIntentListParams { pub offset: u32, pub starting_at: Option, pub ending_at: Option, - pub amount_filter: Option, pub connector: Option>, pub currency: Option>, pub status: Option>, pub payment_method: Option>, pub payment_method_type: Option>, pub authentication_type: Option>, - pub merchant_connector_id: Option>, pub profile_id: Option, pub customer_id: Option, pub starting_after_id: Option, @@ -454,14 +449,12 @@ impl From for PaymentIntentFetchCo offset: 0, starting_at: value.created_gte.or(value.created_gt).or(value.created), ending_at: value.created_lte.or(value.created_lt).or(value.created), - amount_filter: None, connector: None, currency: None, status: None, payment_method: None, payment_method_type: None, authentication_type: None, - merchant_connector_id: None, profile_id: None, customer_id: value.customer_id, starting_after_id: value.starting_after, @@ -477,14 +470,12 @@ impl From for PaymentIntentFetchConstraints { offset: 0, starting_at: Some(value.start_time), ending_at: value.end_time, - amount_filter: None, connector: None, currency: None, status: None, payment_method: None, payment_method_type: None, authentication_type: None, - merchant_connector_id: None, profile_id: None, customer_id: None, starting_after_id: None, @@ -503,14 +494,12 @@ impl From for PaymentIntentF offset: value.offset.unwrap_or_default(), starting_at: value.time_range.map(|t| t.start_time), ending_at: value.time_range.and_then(|t| t.end_time), - amount_filter: value.amount_filter, connector: value.connector, currency: value.currency, status: value.status, payment_method: value.payment_method, payment_method_type: value.payment_method_type, authentication_type: value.authentication_type, - merchant_connector_id: value.merchant_connector_id, profile_id: value.profile_id, customer_id: value.customer_id, starting_after_id: None, diff --git a/crates/hyperswitch_domain_models/src/payouts.rs b/crates/data_models/src/payouts.rs similarity index 100% rename from crates/hyperswitch_domain_models/src/payouts.rs rename to crates/data_models/src/payouts.rs diff --git a/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs b/crates/data_models/src/payouts/payout_attempt.rs similarity index 98% rename from crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs rename to crates/data_models/src/payouts/payout_attempt.rs index afe45b0a6a2..5c4c98970f8 100644 --- a/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs +++ b/crates/data_models/src/payouts/payout_attempt.rs @@ -11,8 +11,7 @@ use crate::errors; pub trait PayoutAttemptInterface { async fn insert_payout_attempt( &self, - _payout_attempt: PayoutAttemptNew, - _payouts: &Payouts, + _payout: PayoutAttemptNew, _storage_scheme: MerchantStorageScheme, ) -> error_stack::Result; @@ -20,7 +19,6 @@ pub trait PayoutAttemptInterface { &self, _this: &PayoutAttempt, _payout_attempt_update: PayoutAttemptUpdate, - _payouts: &Payouts, _storage_scheme: MerchantStorageScheme, ) -> error_stack::Result; diff --git a/crates/hyperswitch_domain_models/src/payouts/payouts.rs b/crates/data_models/src/payouts/payouts.rs similarity index 90% rename from crates/hyperswitch_domain_models/src/payouts/payouts.rs rename to crates/data_models/src/payouts/payouts.rs index 679e4488f7b..e5a95108ef2 100644 --- a/crates/hyperswitch_domain_models/src/payouts/payouts.rs +++ b/crates/data_models/src/payouts/payouts.rs @@ -4,9 +4,8 @@ use serde::{Deserialize, Serialize}; use storage_enums::MerchantStorageScheme; use time::PrimitiveDateTime; -use super::payout_attempt::PayoutAttempt; #[cfg(feature = "olap")] -use super::PayoutFetchConstraints; +use super::{payout_attempt::PayoutAttempt, PayoutFetchConstraints}; use crate::errors; #[async_trait::async_trait] @@ -28,7 +27,6 @@ pub trait PayoutsInterface { &self, _this: &Payouts, _payout: PayoutsUpdate, - _payout_attempt: &PayoutAttempt, _storage_scheme: MerchantStorageScheme, ) -> error_stack::Result; @@ -53,10 +51,7 @@ pub trait PayoutsInterface { _merchant_id: &str, _filters: &PayoutFetchConstraints, _storage_scheme: MerchantStorageScheme, - ) -> error_stack::Result< - Vec<(Payouts, PayoutAttempt, diesel_models::Customer)>, - errors::StorageError, - >; + ) -> error_stack::Result, errors::StorageError>; #[cfg(feature = "olap")] async fn filter_payouts_by_time_range_constraints( @@ -89,7 +84,6 @@ pub struct Payouts { pub attempt_count: i16, pub profile_id: String, pub status: storage_enums::PayoutStatus, - pub confirm: Option, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -111,10 +105,9 @@ pub struct PayoutsNew { pub metadata: Option, pub created_at: Option, pub last_modified_at: Option, - pub attempt_count: i16, pub profile_id: String, pub status: storage_enums::PayoutStatus, - pub confirm: Option, + pub attempt_count: i16, } impl Default for PayoutsNew { @@ -139,10 +132,9 @@ impl Default for PayoutsNew { metadata: Option::default(), created_at: Some(now), last_modified_at: Some(now), - attempt_count: 1, profile_id: String::default(), status: storage_enums::PayoutStatus::default(), - confirm: None, + attempt_count: 1, } } } @@ -161,10 +153,9 @@ pub enum PayoutsUpdate { metadata: Option, profile_id: Option, status: Option, - confirm: Option, }, PayoutMethodIdUpdate { - payout_method_id: String, + payout_method_id: Option, }, RecurringUpdate { recurring: bool, @@ -172,9 +163,6 @@ pub enum PayoutsUpdate { AttemptCountUpdate { attempt_count: i16, }, - StatusUpdate { - status: storage_enums::PayoutStatus, - }, } #[derive(Clone, Debug, Default)] @@ -192,7 +180,6 @@ pub struct PayoutsUpdateInternal { pub profile_id: Option, pub status: Option, pub attempt_count: Option, - pub confirm: Option, } impl From for PayoutsUpdateInternal { @@ -210,7 +197,6 @@ impl From for PayoutsUpdateInternal { metadata, profile_id, status, - confirm, } => Self { amount: Some(amount), destination_currency: Some(destination_currency), @@ -223,11 +209,10 @@ impl From for PayoutsUpdateInternal { metadata, profile_id, status, - confirm, ..Default::default() }, PayoutsUpdate::PayoutMethodIdUpdate { payout_method_id } => Self { - payout_method_id: Some(payout_method_id), + payout_method_id, ..Default::default() }, PayoutsUpdate::RecurringUpdate { recurring } => Self { @@ -238,10 +223,6 @@ impl From for PayoutsUpdateInternal { attempt_count: Some(attempt_count), ..Default::default() }, - PayoutsUpdate::StatusUpdate { status } => Self { - status: Some(status), - ..Default::default() - }, } } } diff --git a/crates/diesel_models/Cargo.toml b/crates/diesel_models/Cargo.toml index 577233cdf1a..d0ef6169335 100644 --- a/crates/diesel_models/Cargo.toml +++ b/crates/diesel_models/Cargo.toml @@ -13,18 +13,18 @@ kv_store = [] [dependencies] async-bb8-diesel = { git = "https://github.com/jarnura/async-bb8-diesel", rev = "53b4ab901aab7635c8215fd1c2d542c8db443094" } -diesel = { version = "2.1.5", features = ["postgres", "serde_json", "time", "64-column-tables"] } +diesel = { version = "2.1.0", features = ["postgres", "serde_json", "time", "64-column-tables"] } error-stack = "0.4.1" -frunk = "0.4.2" -frunk_core = "0.4.2" -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" -strum = { version = "0.26.2", features = ["derive"] } -thiserror = "1.0.58" -time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] } +frunk = "0.4.1" +frunk_core = "0.4.1" +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" +strum = { version = "0.24.1", features = ["derive"] } +thiserror = "1.0.40" +time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] } # First party crates -common_enums = { version = "0.1.0", path = "../common_enums" } +common_enums = { path = "../common_enums" } common_utils = { version = "0.1.0", path = "../common_utils" } masking = { version = "0.1.0", path = "../masking" } router_derive = { version = "0.1.0", path = "../router_derive" } diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rs index 61f64dbaa3d..cc675a06ac9 100644 --- a/crates/diesel_models/src/authentication.rs +++ b/crates/diesel_models/src/authentication.rs @@ -40,9 +40,6 @@ pub struct Authentication { pub acs_trans_id: Option, pub three_ds_server_trans_id: Option, pub acs_signed_content: Option, - pub profile_id: String, - pub payment_id: Option, - pub merchant_connector_id: String, } impl Authentication { @@ -85,9 +82,6 @@ pub struct AuthenticationNew { pub acs_trans_id: Option, pub three_dsserver_trans_id: Option, pub acs_signed_content: Option, - pub profile_id: String, - pub payment_id: Option, - pub merchant_connector_id: String, } #[derive(Debug)] @@ -96,7 +90,7 @@ pub enum AuthenticationUpdate { threeds_server_transaction_id: String, maximum_supported_3ds_version: common_utils::types::SemanticVersion, connector_authentication_id: String, - three_ds_method_data: Option, + three_ds_method_data: String, three_ds_method_url: Option, message_version: common_utils::types::SemanticVersion, connector_metadata: Option, @@ -316,7 +310,7 @@ impl From for AuthenticationUpdateInternal { threeds_server_transaction_id: Some(threeds_server_transaction_id), maximum_supported_version: Some(maximum_supported_3ds_version), connector_authentication_id: Some(connector_authentication_id), - three_ds_method_data, + three_ds_method_data: Some(three_ds_method_data), three_ds_method_url, message_version: Some(message_version), connector_metadata, diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs index 90a9dcbb7d8..d5d4f5d805f 100644 --- a/crates/diesel_models/src/business_profile.rs +++ b/crates/diesel_models/src/business_profile.rs @@ -35,8 +35,6 @@ pub struct BusinessProfile { pub payment_link_config: Option, pub session_expiry: Option, pub authentication_connector_details: Option, - pub is_extended_card_info_enabled: Option, - pub extended_card_info_config: Option, } #[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)] @@ -63,8 +61,6 @@ pub struct BusinessProfileNew { pub payment_link_config: Option, pub session_expiry: Option, pub authentication_connector_details: Option, - pub is_extended_card_info_enabled: Option, - pub extended_card_info_config: Option, } #[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)] @@ -88,88 +84,6 @@ pub struct BusinessProfileUpdateInternal { pub payment_link_config: Option, pub session_expiry: Option, pub authentication_connector_details: Option, - pub is_extended_card_info_enabled: Option, - pub extended_card_info_config: Option, -} - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -pub enum BusinessProfileUpdate { - Update { - profile_name: Option, - modified_at: Option, - return_url: Option, - enable_payment_response_hash: Option, - payment_response_hash_key: Option, - redirect_to_merchant_with_http_post: Option, - webhook_details: Option, - metadata: Option, - routing_algorithm: Option, - intent_fulfillment_time: Option, - frm_routing_algorithm: Option, - payout_routing_algorithm: Option, - is_recon_enabled: Option, - applepay_verified_domains: Option>, - payment_link_config: Option, - session_expiry: Option, - authentication_connector_details: Option, - extended_card_info_config: Option, - }, - ExtendedCardInfoUpdate { - is_extended_card_info_enabled: Option, - }, -} - -impl From for BusinessProfileUpdateInternal { - fn from(business_profile_update: BusinessProfileUpdate) -> Self { - match business_profile_update { - BusinessProfileUpdate::Update { - profile_name, - modified_at, - return_url, - enable_payment_response_hash, - payment_response_hash_key, - redirect_to_merchant_with_http_post, - webhook_details, - metadata, - routing_algorithm, - intent_fulfillment_time, - frm_routing_algorithm, - payout_routing_algorithm, - is_recon_enabled, - applepay_verified_domains, - payment_link_config, - session_expiry, - authentication_connector_details, - extended_card_info_config, - } => Self { - profile_name, - modified_at, - return_url, - enable_payment_response_hash, - payment_response_hash_key, - redirect_to_merchant_with_http_post, - webhook_details, - metadata, - routing_algorithm, - intent_fulfillment_time, - frm_routing_algorithm, - payout_routing_algorithm, - is_recon_enabled, - applepay_verified_domains, - payment_link_config, - session_expiry, - authentication_connector_details, - extended_card_info_config, - ..Default::default() - }, - BusinessProfileUpdate::ExtendedCardInfoUpdate { - is_extended_card_info_enabled, - } => Self { - is_extended_card_info_enabled, - ..Default::default() - }, - } - } } impl From for BusinessProfile { @@ -195,15 +109,13 @@ impl From for BusinessProfile { payment_link_config: new.payment_link_config, session_expiry: new.session_expiry, authentication_connector_details: new.authentication_connector_details, - is_extended_card_info_enabled: new.is_extended_card_info_enabled, - extended_card_info_config: new.extended_card_info_config, } } } -impl BusinessProfileUpdate { +impl BusinessProfileUpdateInternal { pub fn apply_changeset(self, source: BusinessProfile) -> BusinessProfile { - let BusinessProfileUpdateInternal { + let Self { profile_name, modified_at: _, return_url, @@ -221,9 +133,7 @@ impl BusinessProfileUpdate { payment_link_config, session_expiry, authentication_connector_details, - is_extended_card_info_enabled, - extended_card_info_config, - } = self.into(); + } = self; BusinessProfile { profile_name: profile_name.unwrap_or(source.profile_name), modified_at: common_utils::date_time::now(), @@ -244,8 +154,6 @@ impl BusinessProfileUpdate { payment_link_config, session_expiry, authentication_connector_details, - is_extended_card_info_enabled, - extended_card_info_config, ..source } } diff --git a/crates/diesel_models/src/customers.rs b/crates/diesel_models/src/customers.rs index fcabc8879b3..bda7af157de 100644 --- a/crates/diesel_models/src/customers.rs +++ b/crates/diesel_models/src/customers.rs @@ -4,9 +4,7 @@ use time::PrimitiveDateTime; use crate::{encryption::Encryption, schema::customers}; -#[derive( - Clone, Debug, Insertable, router_derive::DebugAsDisplay, serde::Deserialize, serde::Serialize, -)] +#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)] #[diesel(table_name = customers)] pub struct CustomerNew { pub customer_id: String, @@ -23,28 +21,7 @@ pub struct CustomerNew { pub address_id: Option, } -impl From for Customer { - fn from(customer_new: CustomerNew) -> Self { - Self { - id: 0i32, - customer_id: customer_new.customer_id, - merchant_id: customer_new.merchant_id, - name: customer_new.name, - email: customer_new.email, - phone: customer_new.phone, - phone_country_code: customer_new.phone_country_code, - description: customer_new.description, - created_at: customer_new.created_at, - metadata: customer_new.metadata, - connector_customer: customer_new.connector_customer, - modified_at: customer_new.modified_at, - address_id: customer_new.address_id, - default_payment_method_id: None, - } - } -} - -#[derive(Clone, Debug, Identifiable, Queryable, serde::Deserialize, serde::Serialize)] +#[derive(Clone, Debug, Identifiable, Queryable)] #[diesel(table_name = customers)] pub struct Customer { pub id: i32, @@ -63,15 +40,7 @@ pub struct Customer { pub default_payment_method_id: Option, } -#[derive( - Clone, - Debug, - Default, - AsChangeset, - router_derive::DebugAsDisplay, - serde::Deserialize, - serde::Serialize, -)] +#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)] #[diesel(table_name = customers)] pub struct CustomerUpdateInternal { pub name: Option, @@ -85,36 +54,3 @@ pub struct CustomerUpdateInternal { pub address_id: Option, pub default_payment_method_id: Option>, } - -impl CustomerUpdateInternal { - pub fn apply_changeset(self, source: Customer) -> Customer { - let Self { - name, - email, - phone, - description, - phone_country_code, - metadata, - connector_customer, - address_id, - default_payment_method_id, - .. - } = self; - - Customer { - name: name.map_or(source.name, Some), - email: email.map_or(source.email, Some), - phone: phone.map_or(source.phone, Some), - description: description.map_or(source.description, Some), - phone_country_code: phone_country_code.map_or(source.phone_country_code, Some), - metadata: metadata.map_or(source.metadata, Some), - modified_at: common_utils::date_time::now(), - connector_customer: connector_customer.map_or(source.connector_customer, Some), - address_id: address_id.map_or(source.address_id, Some), - default_payment_method_id: default_payment_method_id - .flatten() - .map_or(source.default_payment_method_id, Some), - ..source - } - } -} diff --git a/crates/diesel_models/src/enums.rs b/crates/diesel_models/src/enums.rs index 85a7e3d92df..865524c6455 100644 --- a/crates/diesel_models/src/enums.rs +++ b/crates/diesel_models/src/enums.rs @@ -222,6 +222,141 @@ pub struct MandateAmountData { pub metadata: Option, } +#[derive( + Clone, + Copy, + Debug, + Eq, + Hash, + PartialEq, + serde::Deserialize, + serde::Serialize, + strum::Display, + strum::EnumString, +)] +#[diesel_enum(storage_type = "text")] +#[strum(serialize_all = "snake_case")] +#[serde(rename_all = "snake_case")] +pub enum BankNames { + AmericanExpress, + BankOfAmerica, + Barclays, + CapitalOne, + Chase, + Citi, + Discover, + NavyFederalCreditUnion, + PentagonFederalCreditUnion, + SynchronyBank, + WellsFargo, + AbnAmro, + AsnBank, + Bunq, + Handelsbanken, + Ing, + Knab, + Moneyou, + Rabobank, + Regiobank, + Revolut, + SnsBank, + TriodosBank, + VanLanschot, + ArzteUndApothekerBank, + AustrianAnadiBankAg, + BankAustria, + Bank99Ag, + BankhausCarlSpangler, + BankhausSchelhammerUndSchatteraAg, + BawagPskAg, + BksBankAg, + BrullKallmusBankAg, + BtvVierLanderBank, + CapitalBankGraweGruppeAg, + Dolomitenbank, + EasybankAg, + ErsteBankUndSparkassen, + HypoAlpeadriabankInternationalAg, + HypoNoeLbFurNiederosterreichUWien, + HypoOberosterreichSalzburgSteiermark, + HypoTirolBankAg, + HypoVorarlbergBankAg, + HypoBankBurgenlandAktiengesellschaft, + MarchfelderBank, + OberbankAg, + OsterreichischeArzteUndApothekerbank, + PosojilnicaBankEGen, + RaiffeisenBankengruppeOsterreich, + SchelhammerCapitalBankAg, + SchoellerbankAg, + SpardaBankWien, + VolksbankGruppe, + VolkskreditbankAg, + VrBankBraunau, + PlusBank, + EtransferPocztowy24, + BankiSpbdzielcze, + BankNowyBfgSa, + GetinBank, + Blik, + NoblePay, + IdeaBank, + EnveloBank, + NestPrzelew, + MbankMtransfer, + Inteligo, + PbacZIpko, + BnpParibas, + BankPekaoSa, + VolkswagenBank, + AliorBank, + Boz, + AffinBank, + AgroBank, + AllianceBank, + AmBank, + BankIslam, + BankMuamalat, + BankRakyat, + BankSimpananNasional, + CimbBank, + HongLeongBank, + HsbcBank, + KuwaitFinanceHouse, + Maybank, + OcbcBank, + PublicBank, + RhbBank, + StandardCharteredBank, + UobBank, + BangkokBank, + KrungsriBank, + KrungThaiBank, + TheSiamCommercialBank, + KasikornBank, + OpenBankSuccess, + OpenBankFailure, + OpenBankCancelled, + Aib, + BankOfScotland, + DanskeBank, + FirstDirect, + FirstTrust, + Halifax, + Lloyds, + Monzo, + NatWest, + NationwideBank, + RoyalBankOfScotland, + Starling, + TsbBank, + TescoBank, + UlsterBank, + Yoursafe, + N26, + NationaleNederlanden, +} + #[derive( Clone, Copy, @@ -348,5 +483,4 @@ pub enum DashboardMetadata { SetupWoocomWebhook, IsMultipleConfiguration, IsChangePasswordRequired, - OnboardingSurvey, } diff --git a/crates/diesel_models/src/fraud_check.rs b/crates/diesel_models/src/fraud_check.rs index 5513afcfbd1..8c20fe466af 100644 --- a/crates/diesel_models/src/fraud_check.rs +++ b/crates/diesel_models/src/fraud_check.rs @@ -1,4 +1,3 @@ -use common_enums as storage_enums; use diesel::{AsChangeset, Identifiable, Insertable, Queryable}; use masking::{Deserialize, Serialize}; use time::PrimitiveDateTime; @@ -26,7 +25,6 @@ pub struct FraudCheck { pub metadata: Option, pub modified_at: PrimitiveDateTime, pub last_step: FraudCheckLastStep, - pub payment_capture_method: Option, // In postFrm, we are updating capture method from automatic to manual. To store the merchant actual capture method, we are storing the actual capture method in payment_capture_method. It will be useful while approving the FRM decision. } #[derive(router_derive::Setter, Clone, Debug, Insertable, router_derive::DebugAsDisplay)] @@ -48,7 +46,6 @@ pub struct FraudCheckNew { pub metadata: Option, pub modified_at: PrimitiveDateTime, pub last_step: FraudCheckLastStep, - pub payment_capture_method: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -62,7 +59,6 @@ pub enum FraudCheckUpdate { metadata: Option, modified_at: PrimitiveDateTime, last_step: FraudCheckLastStep, - payment_capture_method: Option, }, ErrorUpdate { status: FraudCheckStatus, @@ -80,7 +76,6 @@ pub struct FraudCheckUpdateInternal { frm_error: Option>, metadata: Option, last_step: FraudCheckLastStep, - payment_capture_method: Option, } impl From for FraudCheckUpdateInternal { @@ -94,7 +89,6 @@ impl From for FraudCheckUpdateInternal { metadata, modified_at: _, last_step, - payment_capture_method, } => Self { frm_status: Some(frm_status), frm_transaction_id, @@ -102,7 +96,6 @@ impl From for FraudCheckUpdateInternal { frm_score, metadata, last_step, - payment_capture_method, ..Default::default() }, FraudCheckUpdate::ErrorUpdate { diff --git a/crates/diesel_models/src/kv.rs b/crates/diesel_models/src/kv.rs index c4d7c993c1d..38429b414bb 100644 --- a/crates/diesel_models/src/kv.rs +++ b/crates/diesel_models/src/kv.rs @@ -3,7 +3,6 @@ use serde::{Deserialize, Serialize}; use crate::{ address::{Address, AddressNew, AddressUpdateInternal}, - customers::{Customer, CustomerNew, CustomerUpdateInternal}, errors, payment_attempt::{PaymentAttempt, PaymentAttemptNew, PaymentAttemptUpdate}, payment_intent::{PaymentIntentNew, PaymentIntentUpdate}, @@ -11,8 +10,7 @@ use crate::{ payouts::{Payouts, PayoutsNew, PayoutsUpdate}, refund::{Refund, RefundNew, RefundUpdate}, reverse_lookup::{ReverseLookup, ReverseLookupNew}, - Mandate, MandateNew, MandateUpdateInternal, PaymentIntent, PaymentMethod, PaymentMethodNew, - PaymentMethodUpdateInternal, PgPooledConn, + PaymentIntent, PgPooledConn, }; #[derive(Debug, Serialize, Deserialize)] @@ -38,21 +36,15 @@ impl DBOperation { Insertable::Address(_) => "address", Insertable::Payouts(_) => "payouts", Insertable::PayoutAttempt(_) => "payout_attempt", - Insertable::Customer(_) => "customer", Insertable::ReverseLookUp(_) => "reverse_lookup", - Insertable::PaymentMethod(_) => "payment_method", - Insertable::Mandate(_) => "mandate", }, Self::Update { updatable } => match updatable { Updateable::PaymentIntentUpdate(_) => "payment_intent", Updateable::PaymentAttemptUpdate(_) => "payment_attempt", Updateable::RefundUpdate(_) => "refund", - Updateable::CustomerUpdate(_) => "customer", Updateable::AddressUpdate(_) => "address", Updateable::PayoutsUpdate(_) => "payouts", Updateable::PayoutAttemptUpdate(_) => "payout_attempt", - Updateable::PaymentMethodUpdate(_) => "payment_method", - Updateable::MandateUpdate(_) => " mandate", }, } } @@ -64,12 +56,9 @@ pub enum DBResult { PaymentAttempt(Box), Refund(Box), Address(Box
), - Customer(Box), ReverseLookUp(Box), Payouts(Box), PayoutAttempt(Box), - PaymentMethod(Box), - Mandate(Box), } #[derive(Debug, Serialize, Deserialize)] @@ -90,9 +79,6 @@ impl DBOperation { } Insertable::Refund(a) => DBResult::Refund(Box::new(a.insert(conn).await?)), Insertable::Address(addr) => DBResult::Address(Box::new(addr.insert(conn).await?)), - Insertable::Customer(cust) => { - DBResult::Customer(Box::new(cust.insert(conn).await?)) - } Insertable::ReverseLookUp(rev) => { DBResult::ReverseLookUp(Box::new(rev.insert(conn).await?)) } @@ -100,10 +86,6 @@ impl DBOperation { Insertable::PayoutAttempt(rev) => { DBResult::PayoutAttempt(Box::new(rev.insert(conn).await?)) } - Insertable::PaymentMethod(rev) => { - DBResult::PaymentMethod(Box::new(rev.insert(conn).await?)) - } - Insertable::Mandate(m) => DBResult::Mandate(Box::new(m.insert(conn).await?)), }, Self::Update { updatable } => match updatable { Updateable::PaymentIntentUpdate(a) => { @@ -124,29 +106,6 @@ impl DBOperation { Updateable::PayoutAttemptUpdate(a) => DBResult::PayoutAttempt(Box::new( a.orig.update_with_attempt_id(conn, a.update_data).await?, )), - Updateable::PaymentMethodUpdate(v) => DBResult::PaymentMethod(Box::new( - v.orig - .update_with_payment_method_id(conn, v.update_data) - .await?, - )), - Updateable::MandateUpdate(m) => DBResult::Mandate(Box::new( - Mandate::update_by_merchant_id_mandate_id( - conn, - &m.orig.merchant_id, - &m.orig.mandate_id, - m.update_data, - ) - .await?, - )), - Updateable::CustomerUpdate(cust) => DBResult::Customer(Box::new( - Customer::update_by_customer_id_merchant_id( - conn, - cust.orig.customer_id.clone(), - cust.orig.merchant_id.clone(), - cust.update_data, - ) - .await?, - )), }, }) } @@ -180,12 +139,9 @@ pub enum Insertable { PaymentAttempt(PaymentAttemptNew), Refund(RefundNew), Address(Box), - Customer(CustomerNew), ReverseLookUp(ReverseLookupNew), Payouts(PayoutsNew), PayoutAttempt(PayoutAttemptNew), - PaymentMethod(PaymentMethodNew), - Mandate(MandateNew), } #[derive(Debug, Serialize, Deserialize)] @@ -194,18 +150,9 @@ pub enum Updateable { PaymentIntentUpdate(PaymentIntentUpdateMems), PaymentAttemptUpdate(PaymentAttemptUpdateMems), RefundUpdate(RefundUpdateMems), - CustomerUpdate(CustomerUpdateMems), AddressUpdate(Box), PayoutsUpdate(PayoutsUpdateMems), PayoutAttemptUpdate(PayoutAttemptUpdateMems), - PaymentMethodUpdate(PaymentMethodUpdateMems), - MandateUpdate(MandateUpdateMems), -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct CustomerUpdateMems { - pub orig: Customer, - pub update_data: CustomerUpdateInternal, } #[derive(Debug, Serialize, Deserialize)] @@ -243,15 +190,3 @@ pub struct PayoutAttemptUpdateMems { pub orig: PayoutAttempt, pub update_data: PayoutAttemptUpdate, } - -#[derive(Debug, Serialize, Deserialize)] -pub struct PaymentMethodUpdateMems { - pub orig: PaymentMethod, - pub update_data: PaymentMethodUpdateInternal, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct MandateUpdateMems { - pub orig: Mandate, - pub update_data: MandateUpdateInternal, -} diff --git a/crates/diesel_models/src/mandate.rs b/crates/diesel_models/src/mandate.rs index 39c43a4a178..31c6ef62f2b 100644 --- a/crates/diesel_models/src/mandate.rs +++ b/crates/diesel_models/src/mandate.rs @@ -5,7 +5,7 @@ use time::PrimitiveDateTime; use crate::{enums as storage_enums, schema::mandate}; -#[derive(Clone, Debug, Identifiable, Queryable, serde::Serialize, serde::Deserialize)] +#[derive(Clone, Debug, Identifiable, Queryable)] #[diesel(table_name = mandate)] pub struct Mandate { pub id: i32, @@ -35,14 +35,7 @@ pub struct Mandate { } #[derive( - router_derive::Setter, - Clone, - Debug, - Default, - Insertable, - router_derive::DebugAsDisplay, - serde::Serialize, - serde::Deserialize, + router_derive::Setter, Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay, )] #[diesel(table_name = mandate)] pub struct MandateNew { @@ -96,15 +89,7 @@ pub struct SingleUseMandate { pub currency: storage_enums::Currency, } -#[derive( - Clone, - Debug, - Default, - AsChangeset, - router_derive::DebugAsDisplay, - serde::Serialize, - serde::Deserialize, -)] +#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)] #[diesel(table_name = mandate)] pub struct MandateUpdateInternal { mandate_status: Option, @@ -155,59 +140,3 @@ impl From for MandateUpdateInternal { } } } - -impl MandateUpdateInternal { - pub fn apply_changeset(self, source: Mandate) -> Mandate { - let Self { - mandate_status, - amount_captured, - connector_mandate_ids, - connector_mandate_id, - payment_method_id, - original_payment_id, - } = self; - - Mandate { - mandate_status: mandate_status.unwrap_or(source.mandate_status), - amount_captured: amount_captured.map_or(source.amount_captured, Some), - connector_mandate_ids: connector_mandate_ids.map_or(source.connector_mandate_ids, Some), - connector_mandate_id: connector_mandate_id.map_or(source.connector_mandate_id, Some), - payment_method_id: payment_method_id.unwrap_or(source.payment_method_id), - original_payment_id: original_payment_id.map_or(source.original_payment_id, Some), - ..source - } - } -} - -impl From<&MandateNew> for Mandate { - fn from(mandate_new: &MandateNew) -> Self { - Self { - id: 0i32, - mandate_id: mandate_new.mandate_id.clone(), - customer_id: mandate_new.customer_id.clone(), - merchant_id: mandate_new.merchant_id.clone(), - payment_method_id: mandate_new.payment_method_id.clone(), - mandate_status: mandate_new.mandate_status, - mandate_type: mandate_new.mandate_type, - customer_accepted_at: mandate_new.customer_accepted_at, - customer_ip_address: mandate_new.customer_ip_address.clone(), - customer_user_agent: mandate_new.customer_user_agent.clone(), - network_transaction_id: mandate_new.network_transaction_id.clone(), - previous_attempt_id: mandate_new.previous_attempt_id.clone(), - created_at: mandate_new - .created_at - .unwrap_or_else(common_utils::date_time::now), - mandate_amount: mandate_new.mandate_amount, - mandate_currency: mandate_new.mandate_currency, - amount_captured: mandate_new.amount_captured, - connector: mandate_new.connector.clone(), - connector_mandate_id: mandate_new.connector_mandate_id.clone(), - start_date: mandate_new.start_date, - end_date: mandate_new.end_date, - metadata: mandate_new.metadata.clone(), - connector_mandate_ids: mandate_new.connector_mandate_ids.clone(), - original_payment_id: mandate_new.original_payment_id.clone(), - merchant_connector_id: mandate_new.merchant_connector_id.clone(), - } - } -} diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs index 65481d93bec..77fd21165d7 100644 --- a/crates/diesel_models/src/payment_attempt.rs +++ b/crates/diesel_models/src/payment_attempt.rs @@ -209,7 +209,6 @@ pub enum PaymentAttemptUpdate { currency: storage_enums::Currency, status: storage_enums::AttemptStatus, authentication_type: Option, - capture_method: Option, payment_method: Option, browser_info: Option, connector: Option, @@ -238,10 +237,6 @@ pub enum PaymentAttemptUpdate { cancellation_reason: Option, updated_by: String, }, - PaymentMethodDetailsUpdate { - payment_method_id: Option, - updated_by: String, - }, BlocklistUpdate { status: storage_enums::AttemptStatus, error_code: Option>, @@ -259,7 +254,7 @@ pub enum PaymentAttemptUpdate { connector: Option, connector_transaction_id: Option, authentication_type: Option, - payment_method_id: Option, + payment_method_id: Option>, mandate_id: Option, connector_metadata: Option, payment_token: Option, @@ -279,7 +274,7 @@ pub enum PaymentAttemptUpdate { status: storage_enums::AttemptStatus, connector: Option, connector_transaction_id: Option, - payment_method_id: Option, + payment_method_id: Option>, error_code: Option>, error_message: Option>, error_reason: Option>, @@ -315,7 +310,7 @@ pub enum PaymentAttemptUpdate { }, PreprocessingUpdate { status: storage_enums::AttemptStatus, - payment_method_id: Option, + payment_method_id: Option>, connector_metadata: Option, preprocessing_step_id: Option, connector_transaction_id: Option, @@ -355,7 +350,7 @@ pub struct PaymentAttemptUpdateInternal { authentication_type: Option, payment_method: Option, error_message: Option>, - payment_method_id: Option, + payment_method_id: Option>, cancellation_reason: Option, modified_at: Option, mandate_id: Option, @@ -464,7 +459,7 @@ impl PaymentAttemptUpdate { authentication_type: authentication_type.or(source.authentication_type), payment_method: payment_method.or(source.payment_method), error_message: error_message.unwrap_or(source.error_message), - payment_method_id: payment_method_id.or(source.payment_method_id), + payment_method_id: payment_method_id.unwrap_or(source.payment_method_id), cancellation_reason: cancellation_reason.or(source.cancellation_reason), modified_at: common_utils::date_time::now(), mandate_id: mandate_id.or(source.mandate_id), @@ -560,7 +555,6 @@ impl From for PaymentAttemptUpdateInternal { amount, currency, authentication_type, - capture_method, status, payment_method, browser_info, @@ -611,8 +605,7 @@ impl From for PaymentAttemptUpdateInternal { authentication_id, payment_method_billing_address_id, fingerprint_id, - payment_method_id, - capture_method, + payment_method_id: payment_method_id.map(Some), ..Default::default() }, PaymentAttemptUpdate::VoidUpdate { @@ -651,14 +644,6 @@ impl From for PaymentAttemptUpdateInternal { merchant_connector_id: Some(None), ..Default::default() }, - PaymentAttemptUpdate::PaymentMethodDetailsUpdate { - payment_method_id, - updated_by, - } => Self { - payment_method_id, - updated_by, - ..Default::default() - }, PaymentAttemptUpdate::ResponseUpdate { status, connector, diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs index ee6e3960b73..d1711c8ba00 100644 --- a/crates/diesel_models/src/payment_intent.rs +++ b/crates/diesel_models/src/payment_intent.rs @@ -180,7 +180,6 @@ pub enum PaymentIntentUpdate { updated_by: String, }, ApproveUpdate { - status: storage_enums::IntentStatus, merchant_decision: Option, updated_by: String, }, @@ -457,11 +456,9 @@ impl From for PaymentIntentUpdateInternal { ..Default::default() }, PaymentIntentUpdate::ApproveUpdate { - status, merchant_decision, updated_by, } => Self { - status: Some(status), merchant_decision, updated_by, ..Default::default() diff --git a/crates/diesel_models/src/payment_method.rs b/crates/diesel_models/src/payment_method.rs index e2807f3b5ea..ef153c23a7b 100644 --- a/crates/diesel_models/src/payment_method.rs +++ b/crates/diesel_models/src/payment_method.rs @@ -6,7 +6,7 @@ use time::PrimitiveDateTime; use crate::{encryption::Encryption, enums as storage_enums, schema::payment_methods}; -#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable)] #[diesel(table_name = payment_methods)] pub struct PaymentMethod { pub id: i32, @@ -27,7 +27,7 @@ pub struct PaymentMethod { pub direct_debit_token: Option, pub created_at: PrimitiveDateTime, pub last_modified: PrimitiveDateTime, - pub payment_method: Option, + pub payment_method: storage_enums::PaymentMethod, pub payment_method_type: Option, pub payment_method_issuer: Option, pub payment_method_issuer_code: Option, @@ -38,19 +38,15 @@ pub struct PaymentMethod { pub connector_mandate_details: Option, pub customer_acceptance: Option, pub status: storage_enums::PaymentMethodStatus, - pub network_transaction_id: Option, - pub client_secret: Option, } -#[derive( - Clone, Debug, Eq, PartialEq, Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize, -)] +#[derive(Clone, Debug, Eq, PartialEq, Insertable, router_derive::DebugAsDisplay)] #[diesel(table_name = payment_methods)] pub struct PaymentMethodNew { pub customer_id: String, pub merchant_id: String, pub payment_method_id: String, - pub payment_method: Option, + pub payment_method: storage_enums::PaymentMethod, pub payment_method_type: Option, pub payment_method_issuer: Option, pub payment_method_issuer_code: Option, @@ -73,8 +69,6 @@ pub struct PaymentMethodNew { pub connector_mandate_details: Option, pub customer_acceptance: Option, pub status: storage_enums::PaymentMethodStatus, - pub network_transaction_id: Option, - pub client_secret: Option, } impl Default for PaymentMethodNew { @@ -86,7 +80,7 @@ impl Default for PaymentMethodNew { merchant_id: String::default(), payment_method_id: String::default(), locker_id: Option::default(), - payment_method: Option::default(), + payment_method: storage_enums::PaymentMethod::default(), payment_method_type: Option::default(), payment_method_issuer: Option::default(), payment_method_issuer_code: Option::default(), @@ -108,8 +102,6 @@ impl Default for PaymentMethodNew { connector_mandate_details: Option::default(), customer_acceptance: Option::default(), status: storage_enums::PaymentMethodStatus::Active, - network_transaction_id: Option::default(), - client_secret: Option::default(), } } } @@ -131,37 +123,18 @@ pub enum PaymentMethodUpdate { LastUsedUpdate { last_used_at: PrimitiveDateTime, }, - NetworkTransactionIdAndStatusUpdate { - network_transaction_id: Option, - status: Option, - }, StatusUpdate { status: Option, }, - AdditionalDataUpdate { - payment_method_data: Option, - status: Option, - locker_id: Option, - payment_method: Option, - }, - ConnectorMandateDetailsUpdate { - connector_mandate_details: Option, - }, } -#[derive( - Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay, Serialize, Deserialize, -)] +#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)] #[diesel(table_name = payment_methods)] pub struct PaymentMethodUpdateInternal { metadata: Option, payment_method_data: Option, last_used_at: Option, - network_transaction_id: Option, status: Option, - locker_id: Option, - payment_method: Option, - connector_mandate_details: Option, } impl PaymentMethodUpdateInternal { @@ -170,30 +143,6 @@ impl PaymentMethodUpdateInternal { PaymentMethod { metadata, ..source } } - - pub fn apply_changeset(self, source: PaymentMethod) -> PaymentMethod { - let Self { - metadata, - payment_method_data, - last_used_at, - network_transaction_id, - status, - connector_mandate_details, - .. - } = self; - - PaymentMethod { - metadata: metadata.map_or(source.metadata, |v| Some(v.into())), - payment_method_data: payment_method_data.map_or(source.payment_method_data, Some), - last_used_at: last_used_at.unwrap_or(source.last_used_at), - network_transaction_id: network_transaction_id - .map_or(source.network_transaction_id, Some), - status: status.unwrap_or(source.status), - connector_mandate_details: connector_mandate_details - .map_or(source.connector_mandate_details, Some), - ..source - } - } } impl From for PaymentMethodUpdateInternal { @@ -203,11 +152,7 @@ impl From for PaymentMethodUpdateInternal { metadata, payment_method_data: None, last_used_at: None, - network_transaction_id: None, status: None, - locker_id: None, - payment_method: None, - connector_mandate_details: None, }, PaymentMethodUpdate::PaymentMethodDataUpdate { payment_method_data, @@ -215,108 +160,20 @@ impl From for PaymentMethodUpdateInternal { metadata: None, payment_method_data, last_used_at: None, - network_transaction_id: None, status: None, - locker_id: None, - payment_method: None, - connector_mandate_details: None, }, PaymentMethodUpdate::LastUsedUpdate { last_used_at } => Self { metadata: None, payment_method_data: None, last_used_at: Some(last_used_at), - network_transaction_id: None, status: None, - locker_id: None, - payment_method: None, - connector_mandate_details: None, - }, - PaymentMethodUpdate::NetworkTransactionIdAndStatusUpdate { - network_transaction_id, - status, - } => Self { - metadata: None, - payment_method_data: None, - last_used_at: None, - network_transaction_id, - status, - locker_id: None, - payment_method: None, - connector_mandate_details: None, }, PaymentMethodUpdate::StatusUpdate { status } => Self { metadata: None, payment_method_data: None, last_used_at: None, - network_transaction_id: None, - status, - locker_id: None, - payment_method: None, - connector_mandate_details: None, - }, - PaymentMethodUpdate::AdditionalDataUpdate { - payment_method_data, - status, - locker_id, - payment_method, - } => Self { - metadata: None, - payment_method_data, - last_used_at: None, - network_transaction_id: None, status, - locker_id, - payment_method, - connector_mandate_details: None, - }, - PaymentMethodUpdate::ConnectorMandateDetailsUpdate { - connector_mandate_details, - } => Self { - metadata: None, - payment_method_data: None, - last_used_at: None, - status: None, - locker_id: None, - payment_method: None, - connector_mandate_details, - network_transaction_id: None, }, } } } - -impl From<&PaymentMethodNew> for PaymentMethod { - fn from(payment_method_new: &PaymentMethodNew) -> Self { - Self { - id: 0i32, - customer_id: payment_method_new.customer_id.clone(), - merchant_id: payment_method_new.merchant_id.clone(), - payment_method_id: payment_method_new.payment_method_id.clone(), - locker_id: payment_method_new.locker_id.clone(), - accepted_currency: payment_method_new.accepted_currency.clone(), - scheme: payment_method_new.scheme.clone(), - token: payment_method_new.token.clone(), - cardholder_name: payment_method_new.cardholder_name.clone(), - issuer_name: payment_method_new.issuer_name.clone(), - issuer_country: payment_method_new.issuer_country.clone(), - payer_country: payment_method_new.payer_country.clone(), - is_stored: payment_method_new.is_stored, - swift_code: payment_method_new.swift_code.clone(), - direct_debit_token: payment_method_new.direct_debit_token.clone(), - created_at: payment_method_new.created_at, - last_modified: payment_method_new.last_modified, - payment_method: payment_method_new.payment_method, - payment_method_type: payment_method_new.payment_method_type, - payment_method_issuer: payment_method_new.payment_method_issuer.clone(), - payment_method_issuer_code: payment_method_new.payment_method_issuer_code, - metadata: payment_method_new.metadata.clone(), - payment_method_data: payment_method_new.payment_method_data.clone(), - last_used_at: payment_method_new.last_used_at, - connector_mandate_details: payment_method_new.connector_mandate_details.clone(), - customer_acceptance: payment_method_new.customer_acceptance.clone(), - status: payment_method_new.status, - network_transaction_id: payment_method_new.network_transaction_id.clone(), - client_secret: payment_method_new.client_secret.clone(), - } - } -} diff --git a/crates/diesel_models/src/payouts.rs b/crates/diesel_models/src/payouts.rs index 4c6fe40c399..aa3eabf6d4e 100644 --- a/crates/diesel_models/src/payouts.rs +++ b/crates/diesel_models/src/payouts.rs @@ -32,7 +32,6 @@ pub struct Payouts { pub attempt_count: i16, pub profile_id: String, pub status: storage_enums::PayoutStatus, - pub confirm: Option, } #[derive( @@ -68,10 +67,9 @@ pub struct PayoutsNew { pub created_at: Option, #[serde(default, with = "common_utils::custom_serde::iso8601::option")] pub last_modified_at: Option, - pub attempt_count: i16, pub profile_id: String, pub status: storage_enums::PayoutStatus, - pub confirm: Option, + pub attempt_count: i16, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -88,10 +86,9 @@ pub enum PayoutsUpdate { metadata: Option, profile_id: Option, status: Option, - confirm: Option, }, PayoutMethodIdUpdate { - payout_method_id: String, + payout_method_id: Option, }, RecurringUpdate { recurring: bool, @@ -99,9 +96,6 @@ pub enum PayoutsUpdate { AttemptCountUpdate { attempt_count: i16, }, - StatusUpdate { - status: storage_enums::PayoutStatus, - }, } #[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)] @@ -121,7 +115,6 @@ pub struct PayoutsUpdateInternal { pub status: Option, pub last_modified_at: PrimitiveDateTime, pub attempt_count: Option, - pub confirm: Option, } impl Default for PayoutsUpdateInternal { @@ -141,7 +134,6 @@ impl Default for PayoutsUpdateInternal { status: None, last_modified_at: common_utils::date_time::now(), attempt_count: None, - confirm: None, } } } @@ -161,7 +153,6 @@ impl From for PayoutsUpdateInternal { metadata, profile_id, status, - confirm, } => Self { amount: Some(amount), destination_currency: Some(destination_currency), @@ -174,11 +165,10 @@ impl From for PayoutsUpdateInternal { metadata, profile_id, status, - confirm, ..Default::default() }, PayoutsUpdate::PayoutMethodIdUpdate { payout_method_id } => Self { - payout_method_id: Some(payout_method_id), + payout_method_id, ..Default::default() }, PayoutsUpdate::RecurringUpdate { recurring } => Self { @@ -189,10 +179,6 @@ impl From for PayoutsUpdateInternal { attempt_count: Some(attempt_count), ..Default::default() }, - PayoutsUpdate::StatusUpdate { status } => Self { - status: Some(status), - ..Default::default() - }, } } } @@ -214,7 +200,6 @@ impl PayoutsUpdate { status, last_modified_at, attempt_count, - confirm, } = self.into(); Payouts { amount: amount.unwrap_or(source.amount), @@ -231,7 +216,6 @@ impl PayoutsUpdate { status: status.unwrap_or(source.status), last_modified_at, attempt_count: attempt_count.unwrap_or(source.attempt_count), - confirm: confirm.or(source.confirm), ..source } } diff --git a/crates/diesel_models/src/process_tracker.rs b/crates/diesel_models/src/process_tracker.rs index cd0dbed2c64..0c6aaa5922f 100644 --- a/crates/diesel_models/src/process_tracker.rs +++ b/crates/diesel_models/src/process_tracker.rs @@ -209,7 +209,6 @@ pub enum ProcessTrackerRunner { DeleteTokenizeDataWorkflow, ApiKeyExpiryWorkflow, OutgoingWebhookRetryWorkflow, - AttachPayoutAccountWorkflow, } #[cfg(test)] diff --git a/crates/diesel_models/src/query/authentication.rs b/crates/diesel_models/src/query/authentication.rs index 86ee4a35c16..60e635ad126 100644 --- a/crates/diesel_models/src/query/authentication.rs +++ b/crates/diesel_models/src/query/authentication.rs @@ -69,18 +69,4 @@ impl Authentication { ) .await } - - pub async fn find_authentication_by_merchant_id_connector_authentication_id( - conn: &PgPooledConn, - merchant_id: &str, - connector_authentication_id: &str, - ) -> StorageResult { - generics::generic_find_one::<::Table, _, _>( - conn, - dsl::merchant_id - .eq(merchant_id.to_owned()) - .and(dsl::connector_authentication_id.eq(connector_authentication_id.to_owned())), - ) - .await - } } diff --git a/crates/diesel_models/src/query/business_profile.rs b/crates/diesel_models/src/query/business_profile.rs index 609a5c55f24..effe2219a69 100644 --- a/crates/diesel_models/src/query/business_profile.rs +++ b/crates/diesel_models/src/query/business_profile.rs @@ -2,9 +2,7 @@ use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, T use super::generics; use crate::{ - business_profile::{ - BusinessProfile, BusinessProfileNew, BusinessProfileUpdate, BusinessProfileUpdateInternal, - }, + business_profile::{BusinessProfile, BusinessProfileNew, BusinessProfileUpdateInternal}, errors, schema::business_profile::dsl, PgPooledConn, StorageResult, @@ -20,12 +18,12 @@ impl BusinessProfile { pub async fn update_by_profile_id( self, conn: &PgPooledConn, - business_profile: BusinessProfileUpdate, + business_profile: BusinessProfileUpdateInternal, ) -> StorageResult { match generics::generic_update_by_id::<::Table, _, _, _>( conn, self.profile_id.clone(), - BusinessProfileUpdateInternal::from(business_profile), + business_profile, ) .await { diff --git a/crates/diesel_models/src/query/mandate.rs b/crates/diesel_models/src/query/mandate.rs index 6925cd12b6a..0baae87c512 100644 --- a/crates/diesel_models/src/query/mandate.rs +++ b/crates/diesel_models/src/query/mandate.rs @@ -65,14 +65,14 @@ impl Mandate { conn: &PgPooledConn, merchant_id: &str, mandate_id: &str, - mandate: MandateUpdateInternal, + mandate: MandateUpdate, ) -> StorageResult { generics::generic_update_with_results::<::Table, _, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::mandate_id.eq(mandate_id.to_owned())), - mandate, + MandateUpdateInternal::from(mandate), ) .await? .first() diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs index f23c2318899..0133c52c5db 100644 --- a/crates/diesel_models/src/query/payment_attempt.rs +++ b/crates/diesel_models/src/query/payment_attempt.rs @@ -309,8 +309,6 @@ impl PaymentAttempt { filter_authentication_type, )) } - - #[allow(clippy::too_many_arguments)] pub async fn get_total_count_of_attempts( conn: &PgPooledConn, merchant_id: &str, @@ -319,7 +317,6 @@ impl PaymentAttempt { payment_method: Option>, payment_method_type: Option>, authentication_type: Option>, - merchant_connector_id: Option>, ) -> StorageResult { let mut filter = ::table() .count() @@ -327,22 +324,19 @@ impl PaymentAttempt { .filter(dsl::attempt_id.eq_any(active_attempt_ids.to_owned())) .into_boxed(); - if let Some(connector) = connector { + if let Some(connector) = connector.clone() { filter = filter.filter(dsl::connector.eq_any(connector)); } - if let Some(payment_method) = payment_method { + if let Some(payment_method) = payment_method.clone() { filter = filter.filter(dsl::payment_method.eq_any(payment_method)); } - if let Some(payment_method_type) = payment_method_type { + if let Some(payment_method_type) = payment_method_type.clone() { filter = filter.filter(dsl::payment_method_type.eq_any(payment_method_type)); } - if let Some(authentication_type) = authentication_type { + if let Some(authentication_type) = authentication_type.clone() { filter = filter.filter(dsl::authentication_type.eq_any(authentication_type)); } - if let Some(merchant_connector_id) = merchant_connector_id { - filter = filter.filter(dsl::merchant_connector_id.eq_any(merchant_connector_id)) - } router_env::logger::debug!(query = %debug_query::(&filter).to_string()); db_metrics::track_database_call::<::Table, _, _>( diff --git a/crates/diesel_models/src/query/payment_method.rs b/crates/diesel_models/src/query/payment_method.rs index d3ae4409ee8..7acf49a1570 100644 --- a/crates/diesel_models/src/query/payment_method.rs +++ b/crates/diesel_models/src/query/payment_method.rs @@ -151,7 +151,7 @@ impl PaymentMethod { pub async fn update_with_payment_method_id( self, conn: &PgPooledConn, - payment_method: payment_method::PaymentMethodUpdateInternal, + payment_method: payment_method::PaymentMethodUpdate, ) -> StorageResult { match generics::generic_update_with_unique_predicate_get_result::< ::Table, @@ -161,7 +161,7 @@ impl PaymentMethod { >( conn, dsl::payment_method_id.eq(self.payment_method_id.to_owned()), - payment_method, + payment_method::PaymentMethodUpdateInternal::from(payment_method), ) .await { diff --git a/crates/diesel_models/src/query/user.rs b/crates/diesel_models/src/query/user.rs index 9df1a83aa9e..77d245cf596 100644 --- a/crates/diesel_models/src/query/user.rs +++ b/crates/diesel_models/src/query/user.rs @@ -1,5 +1,4 @@ use async_bb8_diesel::AsyncRunQueryDsl; -use common_utils::pii; use diesel::{ associations::HasTable, debug_query, result::Error as DieselError, ExpressionMethods, JoinOnDsl, QueryDsl, @@ -27,10 +26,7 @@ impl UserNew { } impl User { - pub async fn find_by_user_email( - conn: &PgPooledConn, - user_email: &pii::Email, - ) -> StorageResult { + pub async fn find_by_user_email(conn: &PgPooledConn, user_email: &str) -> StorageResult { generics::generic_find_one::<::Table, _, _>( conn, users_dsl::email.eq(user_email.to_owned()), @@ -66,7 +62,7 @@ impl User { pub async fn update_by_user_email( conn: &PgPooledConn, - user_email: &pii::Email, + user_email: &str, user_update: UserUpdate, ) -> StorageResult { generics::generic_update_with_unique_predicate_get_result::< diff --git a/crates/diesel_models/src/query/user_role.rs b/crates/diesel_models/src/query/user_role.rs index 09a0bbfe300..4cce0d3f800 100644 --- a/crates/diesel_models/src/query/user_role.rs +++ b/crates/diesel_models/src/query/user_role.rs @@ -70,8 +70,8 @@ impl UserRole { conn: &PgPooledConn, user_id: String, merchant_id: String, - ) -> StorageResult { - generics::generic_delete_one_with_result::<::Table, _, _>( + ) -> StorageResult { + generics::generic_delete::<::Table, _>( conn, dsl::user_id .eq(user_id) diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index f5dc5abe1e6..8e8bf48a538 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -82,7 +82,8 @@ diesel::table! { authentication_lifecycle_status -> Varchar, created_at -> Timestamp, modified_at -> Timestamp, - error_message -> Nullable, + #[max_length = 64] + error_message -> Nullable, #[max_length = 64] error_code -> Nullable, connector_metadata -> Nullable, @@ -110,12 +111,6 @@ diesel::table! { acs_trans_id -> Nullable, three_dsserver_trans_id -> Nullable, acs_signed_content -> Nullable, - #[max_length = 64] - profile_id -> Varchar, - #[max_length = 255] - payment_id -> Nullable, - #[max_length = 128] - merchant_connector_id -> Varchar, } } @@ -192,8 +187,6 @@ diesel::table! { payment_link_config -> Nullable, session_expiry -> Nullable, authentication_connector_details -> Nullable, - is_extended_card_info_enabled -> Nullable, - extended_card_info_config -> Nullable, } } @@ -450,7 +443,6 @@ diesel::table! { modified_at -> Timestamp, #[max_length = 64] last_step -> Varchar, - payment_capture_method -> Nullable, } } @@ -906,7 +898,7 @@ diesel::table! { direct_debit_token -> Nullable, created_at -> Timestamp, last_modified -> Timestamp, - payment_method -> Nullable, + payment_method -> Varchar, #[max_length = 64] payment_method_type -> Nullable, #[max_length = 128] @@ -921,10 +913,6 @@ diesel::table! { customer_acceptance -> Nullable, #[max_length = 64] status -> Varchar, - #[max_length = 255] - network_transaction_id -> Nullable, - #[max_length = 128] - client_secret -> Nullable, } } @@ -1001,7 +989,6 @@ diesel::table! { #[max_length = 64] profile_id -> Varchar, status -> PayoutStatus, - confirm -> Nullable, } } diff --git a/crates/drainer/Cargo.toml b/crates/drainer/Cargo.toml index bfd5798863b..6faa5fd95b6 100644 --- a/crates/drainer/Cargo.toml +++ b/crates/drainer/Cargo.toml @@ -12,22 +12,22 @@ release = ["vergen", "external_services/aws_kms"] vergen = ["router_env/vergen"] [dependencies] -actix-web = "4.5.1" +actix-web = "4.3.1" async-bb8-diesel = { git = "https://github.com/jarnura/async-bb8-diesel", rev = "53b4ab901aab7635c8215fd1c2d542c8db443094" } bb8 = "0.8" -clap = { version = "4.4.18", default-features = false, features = ["std", "derive", "help", "usage"] } -config = { version = "0.14.0", features = ["toml"] } -diesel = { version = "2.1.5", features = ["postgres"] } +clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] } +config = { version = "0.13.3", features = ["toml"] } +diesel = { version = "2.1.0", features = ["postgres"] } error-stack = "0.4.1" mime = "0.3.17" -once_cell = "1.19.0" +once_cell = "1.18.0" reqwest = { version = "0.12.2" } -serde = "1.0.197" -serde_json = "1.0.115" -serde_path_to_error = "0.1.16" -thiserror = "1.0.58" -tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } -async-trait = "0.1.79" +serde = "1.0.193" +serde_json = "1.0.108" +serde_path_to_error = "0.1.14" +thiserror = "1.0.40" +tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] } +async-trait = "0.1.74" # First Party Crates common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals"] } diff --git a/crates/euclid/Cargo.toml b/crates/euclid/Cargo.toml index 7de27645523..256ed784512 100644 --- a/crates/euclid/Cargo.toml +++ b/crates/euclid/Cargo.toml @@ -4,20 +4,19 @@ description = "DSL for static routing" version = "0.1.0" edition.workspace = true rust-version.workspace = true -license.workspace = true [dependencies] -erased-serde = "0.4.4" -frunk = "0.4.2" -frunk_core = "0.4.2" +erased-serde = "0.3.28" +frunk = "0.4.1" +frunk_core = "0.4.1" nom = { version = "7.1.3", features = ["alloc"], optional = true } -once_cell = "1.19.0" +once_cell = "1.18.0" rustc-hash = "1.1.0" -serde = { version = "1.0.197", features = ["derive", "rc"] } -serde_json = "1.0.115" -strum = { version = "0.26", features = ["derive"] } -thiserror = "1.0.58" -utoipa = { version = "4.2.0", features = ["preserve_order", "preserve_path_order"] } +serde = { version = "1.0.193", features = ["derive", "rc"] } +serde_json = "1.0.108" +strum = { version = "0.25", features = ["derive"] } +thiserror = "1.0.43" +utoipa = { version = "3.5.0", features = ["preserve_order", "preserve_path_order"] } # First party dependencies common_enums = { version = "0.1.0", path = "../common_enums" } diff --git a/crates/euclid/src/dssa/analyzer.rs b/crates/euclid/src/dssa/analyzer.rs index 4c615e78495..149ed1fd79c 100644 --- a/crates/euclid/src/dssa/analyzer.rs +++ b/crates/euclid/src/dssa/analyzer.rs @@ -304,7 +304,7 @@ mod tests { & payment_method /= reward & payment_method /= voucher & payment_method /= gift_card - & payment_method /= card_redirect + } } } diff --git a/crates/euclid/src/dssa/graph.rs b/crates/euclid/src/dssa/graph.rs index cb72cca0448..bd23ae38522 100644 --- a/crates/euclid/src/dssa/graph.rs +++ b/crates/euclid/src/dssa/graph.rs @@ -1465,7 +1465,7 @@ mod test { ]), &mut memo, ); - let _answer = memo + let _ans = memo .0 .get(&( _node_3.expect("node3 construction failed"), @@ -1473,6 +1473,6 @@ mod test { Strength::Strong, )) .expect("Memoization not workng"); - matches!(_answer, Ok(())); + matches!(_ans, Ok(())); } } diff --git a/crates/euclid/src/enums.rs b/crates/euclid/src/enums.rs index f473c5980c7..7bd32d33633 100644 --- a/crates/euclid/src/enums.rs +++ b/crates/euclid/src/enums.rs @@ -48,7 +48,7 @@ collect_variants!(PayoutWalletType); PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -68,7 +68,7 @@ pub enum MandateAcceptanceType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -88,7 +88,7 @@ pub enum PaymentType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -109,7 +109,7 @@ pub enum MandateType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -131,7 +131,7 @@ pub enum PayoutBankTransferType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -151,7 +151,7 @@ pub enum PayoutWalletType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, diff --git a/crates/euclid/src/frontend/dir.rs b/crates/euclid/src/frontend/dir.rs index 455330fcf76..7fb12d96c3e 100644 --- a/crates/euclid/src/frontend/dir.rs +++ b/crates/euclid/src/frontend/dir.rs @@ -113,7 +113,7 @@ impl DirKey { serde::Serialize, strum::Display, strum::EnumIter, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumString, strum::EnumMessage, strum::EnumProperty, @@ -306,7 +306,7 @@ pub enum DirKeyKind { #[serde(rename = "setup_future_usage")] SetupFutureUsage, #[strum( - serialize = "card_redirect", + serialize = "card_redirect_type", detailed_message = "Supported types of Card Redirect payment method", props(Category = "Payment Method Types") )] @@ -490,7 +490,7 @@ impl DirKeyKind { } #[derive( - Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, strum::Display, strum::VariantNames, + Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, strum::Display, strum::EnumVariantNames, )] #[serde(tag = "key", content = "value")] pub enum DirValue { @@ -559,7 +559,7 @@ impl DirValue { Self::CardBin(_) => (DirKeyKind::CardBin, None), Self::RewardType(_) => (DirKeyKind::RewardType, None), Self::BusinessCountry(_) => (DirKeyKind::BusinessCountry, None), - Self::BillingCountry(_) => (DirKeyKind::BillingCountry, None), + Self::BillingCountry(_) => (DirKeyKind::CardBin, None), Self::BankTransferType(_) => (DirKeyKind::BankTransferType, None), Self::UpiType(_) => (DirKeyKind::UpiType, None), Self::CardType(_) => (DirKeyKind::CardType, None), @@ -677,7 +677,7 @@ impl DirValue { serde::Serialize, strum::Display, strum::EnumIter, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumString, strum::EnumMessage, strum::EnumProperty, @@ -743,7 +743,7 @@ pub enum PayoutDirKeyKind { #[cfg(feature = "payouts")] #[derive( - Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, strum::Display, strum::VariantNames, + Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, strum::Display, strum::EnumVariantNames, )] pub enum PayoutDirValue { #[serde(rename = "business_country", alias = "country")] diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs index 941fc9d7465..ab33f16fb0a 100644 --- a/crates/euclid/src/frontend/dir/enums.rs +++ b/crates/euclid/src/frontend/dir/enums.rs @@ -16,7 +16,7 @@ pub use crate::enums::{PayoutBankTransferType, PayoutType, PayoutWalletType}; PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -36,7 +36,7 @@ pub enum CardType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -61,7 +61,7 @@ pub enum PayLaterType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -89,7 +89,6 @@ pub enum WalletType { TouchNGo, Swish, Cashapp, - Venmo, } #[derive( @@ -99,7 +98,7 @@ pub enum WalletType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -131,7 +130,7 @@ pub enum VoucherType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -165,7 +164,7 @@ pub enum BankRedirectType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -187,7 +186,6 @@ pub enum BankTransferType { PermataBankTransfer, Pix, Pse, - LocalBankTransfer, } #[derive( @@ -197,7 +195,7 @@ pub enum BankTransferType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -217,7 +215,7 @@ pub enum GiftCardType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -239,7 +237,7 @@ pub enum CardRedirectType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -258,7 +256,7 @@ pub enum CryptoType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -277,7 +275,7 @@ pub enum UpiType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, @@ -299,7 +297,7 @@ pub enum BankDebitType { PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumIter, strum::EnumString, serde::Serialize, diff --git a/crates/euclid/src/frontend/dir/lowering.rs b/crates/euclid/src/frontend/dir/lowering.rs index f6b156bf909..b1f03e8dd55 100644 --- a/crates/euclid/src/frontend/dir/lowering.rs +++ b/crates/euclid/src/frontend/dir/lowering.rs @@ -56,7 +56,6 @@ impl From for global_enums::PaymentMethodType { enums::WalletType::TouchNGo => Self::TouchNGo, enums::WalletType::Swish => Self::Swish, enums::WalletType::Cashapp => Self::Cashapp, - enums::WalletType::Venmo => Self::Venmo, } } } @@ -116,7 +115,6 @@ impl From for global_enums::PaymentMethodType { enums::BankTransferType::DanamonVa => Self::DanamonVa, enums::BankTransferType::MandiriVa => Self::MandiriVa, enums::BankTransferType::PermataBankTransfer => Self::PermataBankTransfer, - enums::BankTransferType::LocalBankTransfer => Self::LocalBankTransfer, } } } diff --git a/crates/euclid/src/frontend/dir/transformers.rs b/crates/euclid/src/frontend/dir/transformers.rs index bcc951b0057..c99b39e36f4 100644 --- a/crates/euclid/src/frontend/dir/transformers.rs +++ b/crates/euclid/src/frontend/dir/transformers.rs @@ -143,9 +143,6 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet global_enums::PaymentMethodType::DanamonVa => Ok(dirval!(BankTransferType = DanamonVa)), global_enums::PaymentMethodType::Indomaret => Ok(dirval!(VoucherType = Indomaret)), global_enums::PaymentMethodType::MandiriVa => Ok(dirval!(BankTransferType = MandiriVa)), - global_enums::PaymentMethodType::LocalBankTransfer => { - Ok(dirval!(BankTransferType = LocalBankTransfer)) - } global_enums::PaymentMethodType::PermataBankTransfer => { Ok(dirval!(BankTransferType = PermataBankTransfer)) } @@ -167,7 +164,6 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet global_enums::PaymentMethodType::CardRedirect => { Ok(dirval!(CardRedirectType = CardRedirect)) } - global_enums::PaymentMethodType::Venmo => Ok(dirval!(WalletType = Venmo)), } } } diff --git a/crates/euclid/src/types.rs b/crates/euclid/src/types.rs index 904525d54b7..59736ae6512 100644 --- a/crates/euclid/src/types.rs +++ b/crates/euclid/src/types.rs @@ -23,7 +23,7 @@ pub type Metadata = std::collections::HashMap; PartialEq, Eq, strum::Display, - strum::VariantNames, + strum::EnumVariantNames, strum::EnumString, )] pub enum EuclidKey { diff --git a/crates/euclid_macros/Cargo.toml b/crates/euclid_macros/Cargo.toml index d3bd99bfbee..2524887a8a0 100644 --- a/crates/euclid_macros/Cargo.toml +++ b/crates/euclid_macros/Cargo.toml @@ -4,14 +4,13 @@ description = "Macros for Euclid DSL" version = "0.1.0" edition.workspace = true rust-version.workspace = true -license.workspace = true [lib] proc-macro = true [dependencies] -proc-macro2 = "1.0.79" -quote = "1.0.35" +proc-macro2 = "1.0.51" +quote = "1.0.23" rustc-hash = "1.1.0" -strum = { version = "0.26", features = ["derive"] } -syn = "2.0.57" +strum = { version = "0.24", features = ["derive"] } +syn = "1.0.109" diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml index 6f5d3ec9cc3..d33ed2688a9 100644 --- a/crates/euclid_wasm/Cargo.toml +++ b/crates/euclid_wasm/Cargo.toml @@ -4,7 +4,6 @@ description = "WASM bindings for Euclid DSL" version = "0.1.0" edition.workspace = true rust-version.workspace = true -license.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] @@ -25,15 +24,15 @@ payouts = ["api_models/payouts", "euclid/payouts"] api_models = { version = "0.1.0", path = "../api_models", package = "api_models" } currency_conversion = { version = "0.1.0", path = "../currency_conversion" } connector_configs = { version = "0.1.0", path = "../connector_configs" } -euclid = { version = "0.1.0", path = "../euclid", features = [] } +euclid = { path = "../euclid", features = [] } kgraph_utils = { version = "0.1.0", path = "../kgraph_utils" } common_enums = { version = "0.1.0", path = "../common_enums" } # Third party crates -getrandom = { version = "0.2.12", features = ["js"] } -once_cell = "1.19.0" +getrandom = { version = "0.2.10", features = ["js"] } +once_cell = "1.18.0" ron-parser = "0.1.4" serde = { version = "1.0", features = [] } -serde-wasm-bindgen = "0.6.5" -strum = { version = "0.26", features = ["derive"] } -wasm-bindgen = { version = "0.2.92" } +serde-wasm-bindgen = "0.5" +strum = { version = "0.25", features = ["derive"] } +wasm-bindgen = { version = "0.2.86" } diff --git a/crates/events/Cargo.toml b/crates/events/Cargo.toml deleted file mode 100644 index 228fba60a68..00000000000 --- a/crates/events/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "events" -description = "Events framework for generating events & some sample implementations" -version = "0.1.0" -edition.workspace = true -rust-version.workspace = true -license.workspace = true - -[dependencies] -# First Party crates -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"]} - -# Third Party crates -error-stack = "0.4.1" -serde = "1.0.197" -serde_json = "1.0.114" -thiserror = "1.0.58" -time = "0.3.34" diff --git a/crates/events/src/actix.rs b/crates/events/src/actix.rs deleted file mode 100644 index 094336640e0..00000000000 --- a/crates/events/src/actix.rs +++ /dev/null @@ -1,15 +0,0 @@ -use router_env::tracing_actix_web::RequestId; - -use crate::EventInfo; - -impl EventInfo for RequestId { - type Data = String; - - fn data(&self) -> error_stack::Result { - Ok(self.as_hyphenated().to_string()) - } - - fn key(&self) -> String { - "request_id".to_string() - } -} diff --git a/crates/events/src/lib.rs b/crates/events/src/lib.rs deleted file mode 100644 index 0136b64a0f6..00000000000 --- a/crates/events/src/lib.rs +++ /dev/null @@ -1,268 +0,0 @@ -#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide))] -#![cfg_attr(docsrs, doc(cfg_hide(doc)))] -#![forbid(unsafe_code)] -#![warn(missing_docs)] - -//! -//! A generic event handler system. -//! This library consists of 4 parts: -//! Event Sink: A trait that defines how events are published. This could be a simple logger, a message queue, or a database. -//! EventContext: A struct that holds the event sink and metadata about the event. This is used to create events. This can be used to add metadata to all events, such as the user who triggered the event. -//! EventInfo: A trait that defines the metadata that is sent with the event. It works with the EventContext to add metadata to all events. -//! Event: A trait that defines the event itself. This trait is used to define the data that is sent with the event and defines the event's type & identifier. -//! - -mod actix; - -use std::{collections::HashMap, sync::Arc}; - -use error_stack::{Result, ResultExt}; -use masking::{ErasedMaskSerialize, Serialize}; -use router_env::logger; -use serde::Serializer; -use serde_json::Value; -use time::PrimitiveDateTime; - -/// Errors that can occur when working with events. -#[derive(Debug, Clone, thiserror::Error)] -pub enum EventsError { - /// An error occurred when publishing the event. - #[error("Generic Error")] - GenericError, - /// An error occurred when serializing the event. - #[error("Event serialization error")] - SerializationError, - /// An error occurred when publishing/producing the event. - #[error("Event publishing error")] - PublishError, -} - -/// An event that can be published. -pub trait Event: EventInfo { - /// The type of the event. - type EventType; - /// The timestamp of the event. - fn timestamp(&self) -> PrimitiveDateTime; - - /// The (unique) identifier of the event. - fn identifier(&self) -> String; - - /// The class/type of the event. This is used to group/categorize events together. - fn class(&self) -> Self::EventType; -} - -/// Hold the context information for any events -#[derive(Clone)] -pub struct EventContext -where - A: MessagingInterface, -{ - message_sink: Arc, - metadata: HashMap, -} - -/// intermediary structure to build events with in-place info. -#[must_use = "make sure to call `emit` or `try_emit` to actually emit the event"] -pub struct EventBuilder -where - A: MessagingInterface, - E: Event, -{ - message_sink: Arc, - metadata: HashMap, - event: E, -} - -struct RawEvent>(HashMap, A); - -impl EventBuilder -where - A: MessagingInterface, - E: Event, -{ - /// Add metadata to the event. - pub fn with + 'static>( - mut self, - info: G, - ) -> Self { - info.data() - .and_then(|i| { - i.masked_serialize() - .change_context(EventsError::SerializationError) - }) - .map_err(|e| { - logger::error!("Error adding event info: {:?}", e); - }) - .ok() - .and_then(|data| self.metadata.insert(info.key(), data)); - self - } - /// Emit the event and log any errors. - pub fn emit(self) { - self.try_emit() - .map_err(|e| { - logger::error!("Error emitting event: {:?}", e); - }) - .ok(); - } - - /// Emit the event. - pub fn try_emit(self) -> Result<(), EventsError> { - let ts = self.event.timestamp(); - self.message_sink - .send_message(RawEvent(self.metadata, self.event), ts) - } -} - -impl Serialize for RawEvent -where - A: Event, -{ - fn serialize(&self, serializer: S) -> core::result::Result - where - S: Serializer, - { - let mut serialize_map: HashMap<_, _> = self - .0 - .iter() - .filter_map(|(k, v)| Some((k.clone(), v.masked_serialize().ok()?))) - .collect(); - match self.1.data().map(|i| i.masked_serialize()) { - Ok(Ok(Value::Object(map))) => { - for (k, v) in map.into_iter() { - serialize_map.insert(k, v); - } - } - Ok(Ok(i)) => { - serialize_map.insert(self.1.key(), i); - } - i => { - logger::error!("Error serializing event: {:?}", i); - } - }; - serialize_map.serialize(serializer) - } -} - -impl EventContext -where - A: MessagingInterface, -{ - /// Create a new event context. - pub fn new(message_sink: A) -> Self { - Self { - message_sink: Arc::new(message_sink), - metadata: HashMap::new(), - } - } - - /// Add metadata to the event context. - #[track_caller] - pub fn record_info + 'static>( - &mut self, - info: E, - ) { - match info.data().and_then(|i| { - i.masked_serialize() - .change_context(EventsError::SerializationError) - }) { - Ok(data) => { - self.metadata.insert(info.key(), data); - } - Err(e) => { - logger::error!("Error recording event info: {:?}", e); - } - } - } - - /// Emit an event. - pub fn try_emit>(&self, event: E) -> Result<(), EventsError> { - EventBuilder { - message_sink: self.message_sink.clone(), - metadata: self.metadata.clone(), - event, - } - .try_emit() - } - - /// Emit an event. - pub fn emit>(&self, event: E) { - EventBuilder { - message_sink: self.message_sink.clone(), - metadata: self.metadata.clone(), - event, - } - .emit() - } - - /// Create an event builder. - pub fn event>( - &self, - event: E, - ) -> EventBuilder { - EventBuilder { - message_sink: self.message_sink.clone(), - metadata: self.metadata.clone(), - event, - } - } -} - -/// Add information/metadata to the current context of an event. -pub trait EventInfo { - /// The data that is sent with the event. - type Data: ErasedMaskSerialize; - /// The data that is sent with the event. - fn data(&self) -> Result; - - /// The key identifying the data for an event. - fn key(&self) -> String; -} - -impl EventInfo for (String, String) { - type Data = String; - fn data(&self) -> Result { - Ok(self.1.clone()) - } - - fn key(&self) -> String { - self.0.clone() - } -} - -/// A messaging interface for sending messages/events. -/// This can be implemented for any messaging system, such as a message queue, a logger, or a database. -pub trait MessagingInterface { - /// The type of the event used for categorization by the event publisher. - type MessageClass; - /// Send a message that follows the defined message class. - fn send_message(&self, data: T, timestamp: PrimitiveDateTime) -> Result<(), EventsError> - where - T: Message + ErasedMaskSerialize; -} - -/// A message that can be sent. -pub trait Message { - /// The type of the event used for categorization by the event publisher. - type Class; - /// The type of the event used for categorization by the event publisher. - fn get_message_class(&self) -> Self::Class; - - /// The (unique) identifier of the event. - fn identifier(&self) -> String; -} - -impl Message for RawEvent -where - A: Event, -{ - type Class = T; - - fn get_message_class(&self) -> Self::Class { - self.1.class() - } - - fn identifier(&self) -> String { - self.1.identifier() - } -} diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml index 31e22d4a640..f19216f74d7 100644 --- a/crates/external_services/Cargo.toml +++ b/crates/external_services/Cargo.toml @@ -11,26 +11,26 @@ license.workspace = true aws_kms = ["dep:aws-config", "dep:aws-sdk-kms"] email = ["dep:aws-config"] aws_s3 = ["dep:aws-config", "dep:aws-sdk-s3"] -hashicorp-vault = ["dep:vaultrs"] +hashicorp-vault = [ "dep:vaultrs" ] [dependencies] -async-trait = "0.1.79" +async-trait = "0.1.68" aws-config = { version = "0.55.3", optional = true } aws-sdk-kms = { version = "0.28.0", optional = true } aws-sdk-sesv2 = "0.28.0" aws-sdk-sts = "0.28.0" aws-sdk-s3 = { version = "0.28.0", optional = true } aws-smithy-client = "0.55.3" -base64 = "0.22.0" -dyn-clone = "1.0.17" +base64 = "0.21.2" +dyn-clone = "1.0.11" error-stack = "0.4.1" -once_cell = "1.19.0" -serde = { version = "1.0.197", features = ["derive"] } -thiserror = "1.0.58" -tokio = "1.37.0" +once_cell = "1.18.0" +serde = { version = "1.0.193", features = ["derive"] } +thiserror = "1.0.40" +tokio = "1.36.0" hyper-proxy = "0.9.1" -hyper = "0.14.28" -vaultrs = { version = "0.7.2", optional = true } +hyper = "0.14.26" +vaultrs = { version = "0.7.0", optional = true } hex = "0.4.3" # First party crates diff --git a/crates/external_services/src/email.rs b/crates/external_services/src/email.rs index 07552cb519f..1d389f58298 100644 --- a/crates/external_services/src/email.rs +++ b/crates/external_services/src/email.rs @@ -95,7 +95,7 @@ pub struct EmailContents { /// The subject of email pub subject: String, - /// This will be the intermediate representation of the email body in a generic format. + /// This will be the intermediate representation of the the email body in a generic format. /// The email clients can convert this intermediate representation to their client specific rich text format pub body: IntermediateString, diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.toml index 034e0a67d92..855cf63917f 100644 --- a/crates/hyperswitch_interfaces/Cargo.toml +++ b/crates/hyperswitch_interfaces/Cargo.toml @@ -7,10 +7,10 @@ readme = "README.md" license.workspace = true [dependencies] -async-trait = "0.1.79" -dyn-clone = "1.0.17" -serde = { version = "1.0.197", features = ["derive"] } -thiserror = "1.0.58" +async-trait = "0.1.68" +dyn-clone = "1.0.11" +serde = { version = "1.0.193", features = ["derive"] } +thiserror = "1.0.40" # First party crates common_utils = { version = "0.1.0", path = "../common_utils" } diff --git a/crates/kgraph_utils/Cargo.toml b/crates/kgraph_utils/Cargo.toml index 4ad5ef04f42..a07285167e4 100644 --- a/crates/kgraph_utils/Cargo.toml +++ b/crates/kgraph_utils/Cargo.toml @@ -4,7 +4,6 @@ description = "Utilities for constructing and working with Knowledge Graphs" version = "0.1.0" edition.workspace = true rust-version.workspace = true -license.workspace = true [features] dummy_connector = ["api_models/dummy_connector", "euclid/dummy_connector"] @@ -17,9 +16,9 @@ euclid = { version = "0.1.0", path = "../euclid" } masking = { version = "0.1.0", path = "../masking/" } # Third party crates -serde = "1.0.197" -serde_json = "1.0.115" -thiserror = "1.0.58" +serde = "1.0.193" +serde_json = "1.0.108" +thiserror = "1.0.43" [dev-dependencies] criterion = "0.5" diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs index 8542437a5a6..a04e052514d 100644 --- a/crates/kgraph_utils/src/mca.rs +++ b/crates/kgraph_utils/src/mca.rs @@ -544,7 +544,6 @@ mod tests { "connector_type": "payment_processor", "connector_name": "bluesnap", "merchant_connector_id": "REDACTED", - "status": "inactive", "connector_account_details": { "auth_type": "BodyKey", "api_key": "REDACTED", @@ -626,7 +625,6 @@ mod tests { "connector_type": "payment_processor", "connector_name": "stripe", "merchant_connector_id": "REDACTED", - "status": "inactive", "connector_account_details": { "auth_type": "HeaderKey", "api_key": "REDACTED" diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs index 3e43a4324f9..5bcb64fd875 100644 --- a/crates/kgraph_utils/src/transformers.rs +++ b/crates/kgraph_utils/src/transformers.rs @@ -262,9 +262,6 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { api_enums::PaymentMethodType::DanamonVa => Ok(dirval!(BankTransferType = DanamonVa)), api_enums::PaymentMethodType::Indomaret => Ok(dirval!(VoucherType = Indomaret)), api_enums::PaymentMethodType::MandiriVa => Ok(dirval!(BankTransferType = MandiriVa)), - api_enums::PaymentMethodType::LocalBankTransfer => { - Ok(dirval!(BankTransferType = LocalBankTransfer)) - } api_enums::PaymentMethodType::PermataBankTransfer => { Ok(dirval!(BankTransferType = PermataBankTransfer)) } @@ -286,7 +283,6 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { api_enums::PaymentMethodType::CardRedirect => { Ok(dirval!(CardRedirectType = CardRedirect)) } - api_enums::PaymentMethodType::Venmo => Ok(dirval!(WalletType = Venmo)), } } } diff --git a/crates/masking/Cargo.toml b/crates/masking/Cargo.toml index e7f3550ed7e..23f207d63d5 100644 --- a/crates/masking/Cargo.toml +++ b/crates/masking/Cargo.toml @@ -18,12 +18,12 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] bytes = { version = "1", optional = true } -diesel = { version = "2.1.5", features = ["postgres", "serde_json", "time"], optional = true } -erased-serde = "0.4.4" +diesel = { version = "2.1.0", features = ["postgres", "serde_json", "time"], optional = true } +erased-serde = "0.3.31" serde = { version = "1", features = ["derive"], optional = true } -serde_json = { version = "1.0.115", optional = true } -subtle = "2.5.0" -zeroize = { version = "1.7", default-features = false } +serde_json = { version = "1.0.108", optional = true } +subtle = "=2.4.1" +zeroize = { version = "1.6", default-features = false } [dev-dependencies] -serde_json = "1.0.115" +serde_json = "1.0.108" diff --git a/crates/openapi/Cargo.toml b/crates/openapi/Cargo.toml index 8cf8c156ba0..330f5ed890f 100644 --- a/crates/openapi/Cargo.toml +++ b/crates/openapi/Cargo.toml @@ -8,7 +8,7 @@ license.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde_json = "1.0.115" -utoipa = { version = "4.2.0", features = ["preserve_order", "preserve_path_order", "time"] } +serde_json = "1.0.96" +utoipa = { version = "3.5.0", features = ["preserve_order", "preserve_path_order", "time"] } api_models = { version = "0.1.0", path = "../api_models", features = ["frm", "payouts", "openapi"] } diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs index 1e384408397..4a61a20d08d 100644 --- a/crates/openapi/src/openapi.rs +++ b/crates/openapi/src/openapi.rs @@ -177,10 +177,6 @@ Never share your secret api keys. Keep them guarded and secure. // Routes for events routes::webhook_events::list_initial_webhook_delivery_attempts, routes::webhook_events::list_webhook_delivery_attempts, - routes::webhook_events::retry_webhook_delivery_attempt, - - // Routes for poll apis - routes::poll::retrieve_poll_status, ), components(schemas( api_models::refunds::RefundRequest, @@ -194,7 +190,6 @@ Never share your secret api keys. Keep them guarded and secure. api_models::admin::MerchantConnectorDeleteResponse, api_models::admin::MerchantConnectorResponse, api_models::admin::AuthenticationConnectorDetails, - api_models::admin::ExtendedCardInfoConfig, api_models::customers::CustomerRequest, api_models::customers::CustomerDeleteResponse, api_models::payment_methods::PaymentMethodCreate, @@ -207,12 +202,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payment_methods::PaymentMethodUpdate, api_models::payment_methods::CustomerDefaultPaymentMethodResponse, api_models::payment_methods::CardDetailFromLocker, - api_models::payment_methods::PaymentMethodCreateData, api_models::payment_methods::CardDetail, - api_models::payment_methods::CardDetailUpdate, api_models::payment_methods::RequestPaymentMethodTypes, - api_models::poll::PollResponse, - api_models::poll::PollStatus, api_models::customers::CustomerResponse, api_models::admin::AcceptedCountries, api_models::admin::AcceptedCurrencies, @@ -406,9 +397,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::PaymentCreatePaymentLinkConfig, api_models::payments::ThreeDsData, api_models::payments::ThreeDsMethodData, - api_models::payments::PollConfigResponse, api_models::payments::ExternalAuthenticationDetailsResponse, - api_models::payments::ExtendedCardInfo, api_models::payment_methods::RequiredFieldInfo, api_models::payment_methods::DefaultPaymentMethod, api_models::payment_methods::MaskedBankDetails, @@ -430,11 +419,9 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payouts::Card, api_models::payouts::Wallet, api_models::payouts::Paypal, - api_models::payouts::Venmo, api_models::payouts::AchBankTransfer, api_models::payouts::BacsBankTransfer, api_models::payouts::SepaBankTransfer, - api_models::payouts::PixBankTransfer, api_models::payouts::PayoutRequest, api_models::payouts::PayoutAttemptResponse, api_models::payouts::PayoutActionRequest, @@ -474,7 +461,6 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::PaymentLinkResponse, api_models::payments::RetrievePaymentLinkResponse, api_models::payments::PaymentLinkInitiateRequest, - api_models::payments::ExtendedCardInfoResponse, api_models::routing::RoutingConfigRequest, api_models::routing::RoutingDictionaryRecord, api_models::routing::RoutingKind, diff --git a/crates/openapi/src/routes.rs b/crates/openapi/src/routes.rs index 1df4e4e4f89..bf6182e4954 100644 --- a/crates/openapi/src/routes.rs +++ b/crates/openapi/src/routes.rs @@ -13,12 +13,11 @@ pub mod payment_link; pub mod payment_method; pub mod payments; pub mod payouts; -pub mod poll; pub mod refunds; pub mod routing; pub mod webhook_events; pub use self::{ customers::*, mandates::*, merchant_account::*, merchant_connector_account::*, - payment_method::*, payments::*, poll::*, refunds::*, routing::*, webhook_events::*, + payment_method::*, payments::*, refunds::*, routing::*, webhook_events::*, }; diff --git a/crates/openapi/src/routes/poll.rs b/crates/openapi/src/routes/poll.rs deleted file mode 100644 index db2fd49fe47..00000000000 --- a/crates/openapi/src/routes/poll.rs +++ /dev/null @@ -1,16 +0,0 @@ -/// Poll - Retrieve Poll Status -#[utoipa::path( - get, - path = "/poll/status/{poll_id}", - params( - ("poll_id" = String, Path, description = "The identifier for poll") - ), - responses( - (status = 200, description = "The poll status was retrieved successfully", body = PollResponse), - (status = 404, description = "Poll not found") - ), - tag = "Poll", - operation_id = "Retrieve Poll Status", - security(("publishable_key" = [])) -)] -pub async fn retrieve_poll_status() {} diff --git a/crates/openapi/src/routes/webhook_events.rs b/crates/openapi/src/routes/webhook_events.rs index fc06ffee580..4238b6e99cd 100644 --- a/crates/openapi/src/routes/webhook_events.rs +++ b/crates/openapi/src/routes/webhook_events.rs @@ -68,27 +68,3 @@ pub fn list_initial_webhook_delivery_attempts() {} security(("admin_api_key" = [])) )] pub fn list_webhook_delivery_attempts() {} - -/// Events - Manual Retry -/// -/// Manually retry the delivery of the specified Event. -#[utoipa::path( - post, - path = "/events/{merchant_id_or_profile_id}/{event_id}/retry", - params( - ("merchant_id_or_profile_id" = String, Path, description = "The unique identifier for the Merchant Account or Business Profile"), - ("event_id" = String, Path, description = "The unique identifier for the Event"), - ), - responses( - ( - status = 200, - description = "The delivery of the Event was attempted. \ - Check the `response` field in the response payload to identify the status of the delivery attempt.", - body = EventRetrieveResponse - ), - ), - tag = "Event", - operation_id = "Manually retry the delivery of an Event", - security(("admin_api_key" = [])) -)] -pub fn retry_webhook_delivery_attempt() {} diff --git a/crates/pm_auth/Cargo.toml b/crates/pm_auth/Cargo.toml index 2c0beb5e008..1aa0e782083 100644 --- a/crates/pm_auth/Cargo.toml +++ b/crates/pm_auth/Cargo.toml @@ -5,7 +5,6 @@ version = "0.1.0" edition.workspace = true rust-version.workspace = true readme = "README.md" -license.workspace = true [dependencies] # First party crates @@ -17,12 +16,12 @@ router_derive = { version = "0.1.0", path = "../router_derive" } router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] } # Third party crates -async-trait = "0.1.79" -bytes = "1.6.0" +async-trait = "0.1.66" +bytes = "1.4.0" error-stack = "0.4.1" http = "1.1.0" mime = "0.3.17" -serde = "1.0.197" -serde_json = "1.0.115" -strum = { version = "0.26.2", features = ["derive"] } -thiserror = "1.0.58" +serde = "1.0.193" +serde_json = "1.0.108" +strum = { version = "0.24.1", features = ["derive"] } +thiserror = "1.0.43" diff --git a/crates/redis_interface/Cargo.toml b/crates/redis_interface/Cargo.toml index 1fb74be79d9..233781b52e4 100644 --- a/crates/redis_interface/Cargo.toml +++ b/crates/redis_interface/Cargo.toml @@ -11,14 +11,14 @@ license.workspace = true error-stack = "0.4.1" fred = { version = "7.1.2", features = ["metrics", "partial-tracing", "subscriber-client", "check-unresponsive"] } futures = "0.3" -serde = { version = "1.0.197", features = ["derive"] } -thiserror = "1.0.58" -tokio = "1.37.0" -tokio-stream = {version = "0.1.15", features = ["sync"]} +serde = { version = "1.0.193", features = ["derive"] } +thiserror = "1.0.40" +tokio = "1.36.0" +tokio-stream = {version = "0.1.14", features = ["sync"]} # First party crates common_utils = { version = "0.1.0", path = "../common_utils", features = ["async_ext"] } router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] } [dev-dependencies] -tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] } diff --git a/crates/redis_interface/src/commands.rs b/crates/redis_interface/src/commands.rs index 46e3a35fd33..21630fc3c08 100644 --- a/crates/redis_interface/src/commands.rs +++ b/crates/redis_interface/src/commands.rs @@ -49,21 +49,6 @@ impl super::RedisConnectionPool { .change_context(errors::RedisError::SetFailed) } - pub async fn set_key_without_modifying_ttl( - &self, - key: &str, - value: V, - ) -> CustomResult<(), errors::RedisError> - where - V: TryInto + Debug + Send + Sync, - V::Error: Into + Send + Sync, - { - self.pool - .set(key, value, Some(Expiration::KEEPTTL), None, false) - .await - .change_context(errors::RedisError::SetFailed) - } - pub async fn set_multiple_keys_if_not_exist( &self, value: V, @@ -111,23 +96,6 @@ impl super::RedisConnectionPool { self.set_key(key, serialized.as_slice()).await } - #[instrument(level = "DEBUG", skip(self))] - pub async fn serialize_and_set_key_without_modifying_ttl( - &self, - key: &str, - value: V, - ) -> CustomResult<(), errors::RedisError> - where - V: serde::Serialize + Debug, - { - let serialized = value - .encode_to_vec() - .change_context(errors::RedisError::JsonSerializationFailed)?; - - self.set_key_without_modifying_ttl(key, serialized.as_slice()) - .await - } - #[instrument(level = "DEBUG", skip(self))] pub async fn serialize_and_set_key_with_expiry( &self, @@ -338,6 +306,45 @@ impl super::RedisConnectionPool { .await } + #[instrument(level = "DEBUG", skip(self))] + pub async fn get_multiple_keys( + &self, + keys: K, + ) -> CustomResult>, errors::RedisError> + where + V: FromRedis + Unpin + Send + 'static, + K: Into + Send + Debug, + { + self.pool + .mget(keys) + .await + .change_context(errors::RedisError::GetFailed) + } + + #[instrument(level = "DEBUG", skip(self))] + pub async fn get_and_deserialize_multiple_keys( + &self, + keys: K, + type_name: &'static str, + ) -> CustomResult>, errors::RedisError> + where + K: Into + Send + Debug, + V: serde::de::DeserializeOwned, + { + let data = self.get_multiple_keys::>(keys).await?; + data.into_iter() + .map(|value_bytes| { + value_bytes + .map(|bytes| { + bytes + .parse_struct(type_name) + .change_context(errors::RedisError::JsonSerializationFailed) + }) + .transpose() + }) + .collect() + } + #[instrument(level = "DEBUG", skip(self))] pub async fn serialize_and_set_multiple_hash_field_if_not_exist( &self, diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index 98dbfdacfcb..7dd410e8d53 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -14,7 +14,7 @@ email = ["external_services/email", "scheduler/email", "olap"] frm = ["api_models/frm"] stripe = ["dep:serde_qs"] release = ["stripe", "email", "backwards_compatibility", "business_profile_routing", "accounts_cache", "kv_store", "connector_choice_mca_id", "profile_specific_fallback_routing", "vergen", "recon", "external_services/aws_kms", "external_services/aws_s3"] -olap = ["hyperswitch_domain_models/olap", "storage_impl/olap", "scheduler/olap", "api_models/olap", "dep:analytics"] +olap = ["data_models/olap", "storage_impl/olap", "scheduler/olap", "api_models/olap", "dep:analytics"] oltp = ["storage_impl/oltp"] kv_store = ["scheduler/kv_store"] accounts_cache = [] @@ -26,75 +26,80 @@ dummy_connector = ["api_models/dummy_connector", "euclid/dummy_connector", "kgra connector_choice_mca_id = ["api_models/connector_choice_mca_id", "euclid/connector_choice_mca_id", "kgraph_utils/connector_choice_mca_id"] external_access_dc = ["dummy_connector"] detailed_errors = ["api_models/detailed_errors", "error-stack/serde"] -payouts = ["api_models/payouts", "common_enums/payouts", "hyperswitch_domain_models/payouts", "storage_impl/payouts"] +payouts = [ + "api_models/payouts", + "common_enums/payouts", + "data_models/payouts", + "storage_impl/payouts" +] payout_retry = ["payouts"] recon = ["email", "api_models/recon"] retry = [] [dependencies] -actix-cors = "0.6.5" -actix-multipart = "0.6.1" -actix-rt = "2.9.0" -actix-web = "4.5.1" +actix-cors = "0.6.4" +actix-multipart = "0.6.0" +actix-rt = "2.8.0" +actix-web = "4.3.1" async-bb8-diesel = { git = "https://github.com/jarnura/async-bb8-diesel", rev = "53b4ab901aab7635c8215fd1c2d542c8db443094" } -argon2 = { version = "0.5.3", features = ["std"] } -async-trait = "0.1.79" -base64 = "0.22.0" +argon2 = { version = "0.5.0", features = ["std"] } +async-trait = "0.1.68" +base64 = "0.21.2" bb8 = "0.8" bigdecimal = "0.3.1" -blake3 = "1.5.1" -bytes = "1.6.0" -clap = { version = "4.4.18", default-features = false, features = ["std", "derive", "help", "usage"] } -config = { version = "0.14.0", features = ["toml"] } -cookie = "0.18.1" -diesel = { version = "2.1.5", features = ["postgres"] } -digest = "0.10.7" -dyn-clone = "1.0.17" -encoding_rs = "0.8.33" +blake3 = "1.3.3" +bytes = "1.4.0" +clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] } +config = { version = "0.13.3", features = ["toml"] } +cookie = "0.18.0" +diesel = { version = "2.1.0", features = ["postgres"] } +digest = "0.9" +dyn-clone = "1.0.11" +encoding_rs = "0.8.32" error-stack = "0.4.1" -futures = "0.3.30" +futures = "0.3.28" hex = "0.4.3" -http = "0.2.12" -hyper = "0.14.28" -image = { version = "0.25.1", default-features = false, features = ["png"] } -infer = "0.15.0" -josekit = "0.8.6" -jsonwebtoken = "9.2.0" -maud = { version = "0.26.0", features = ["actix-web"] } +http = "0.2.9" +hyper = "0.14.27" +image = "0.23.14" +infer = "0.13.0" +josekit = "0.8.3" +jsonwebtoken = "8.3.0" +maud = { version = "0.25", features = ["actix-web"] } mimalloc = { version = "0.1", optional = true } mime = "0.3.17" nanoid = "0.4.0" -num_cpus = "1.16.0" -once_cell = "1.19.0" -openssl = "0.10.64" -qrcode = "0.14.0" +num_cpus = "1.15.0" +once_cell = "1.18.0" +openssl = "0.10.60" +qrcode = "0.12.0" rand = "0.8.5" rand_chacha = "0.3.1" -regex = "1.10.4" +regex = "1.8.4" reqwest = { version = "0.12.2", features = ["json", "native-tls", "gzip", "multipart"] } -ring = "0.17.8" -roxmltree = "0.19.0" -rust_decimal = { version = "1.35.0", features = ["serde-with-float", "serde-with-str"] } +ring = "0.16.20" +roxmltree = "0.18.0" +rust_decimal = { version = "1.30.0", features = ["serde-with-float", "serde-with-str"] } rustc-hash = "1.1.0" -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" -serde_path_to_error = "0.1.16" +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" +serde_path_to_error = "0.1.14" serde_qs = { version = "0.12.0", optional = true } serde_urlencoded = "0.7.1" -serde_with = "3.7.0" -sha1 = { version = "0.10.6" } -sqlx = { version = "0.7.3", features = ["postgres", "runtime-tokio", "runtime-tokio-native-tls", "time", "bigdecimal"] } -strum = { version = "0.26", features = ["derive"] } +serde_with = "3.4.0" +sha-1 = { version = "0.9" } +sqlx = { version = "0.6.3", features = ["postgres", "runtime-actix", "runtime-actix-native-tls", "time", "bigdecimal"] } +strum = { version = "0.25", features = ["derive"] } tera = "1.19.1" -thiserror = "1.0.58" -time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] } -tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } -unicode-segmentation = "1.11.0" -url = { version = "2.5.0", features = ["serde"] } -utoipa = { version = "4.2.0", features = ["preserve_order", "preserve_path_order", "time"] } -uuid = { version = "1.8.0", features = ["v4"] } -validator = "0.17.0" -x509-parser = "0.16.0" +thiserror = "1.0.40" +time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] } +tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] } +unicode-segmentation = "1.10.1" +url = { version = "2.4.0", features = ["serde"] } +utoipa = { version = "3.5.0", features = ["preserve_order", "preserve_path_order", "time"] } +uuid = { version = "1.7.0", features = ["v4"] } +validator = "0.16.0" +x509-parser = "0.15.0" tracing-futures = { version = "0.2.5", features = ["tokio"] } # First party crates @@ -104,7 +109,7 @@ cards = { version = "0.1.0", path = "../cards" } common_enums = { version = "0.1.0", path = "../common_enums" } common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals", "async_ext", "logs"] } currency_conversion = { version = "0.1.0", path = "../currency_conversion" } -hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false } +data_models = { version = "0.1.0", path = "../data_models", default-features = false } diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"] } euclid = { version = "0.1.0", path = "../euclid", features = ["valued_jit"] } pm_auth = { version = "0.1.0", path = "../pm_auth", package = "pm_auth" } @@ -118,26 +123,25 @@ router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra scheduler = { version = "0.1.0", path = "../scheduler", default-features = false } storage_impl = { version = "0.1.0", path = "../storage_impl", default-features = false } openapi = { version = "0.1.0", path = "../openapi", optional = true } -erased-serde = "0.4.4" +erased-serde = "0.3.31" quick-xml = { version = "0.31.0", features = ["serialize"] } -rdkafka = "0.36.2" +rdkafka = "0.36.0" isocountry = "0.3.2" iso_currency = "0.4.4" -actix-http = "3.6.0" -events = { version = "0.1.0", path = "../events" } +actix-http = "3.3.1" [build-dependencies] router_env = { version = "0.1.0", path = "../router_env", default-features = false } [dev-dependencies] -actix-http = "3.6.0" -awc = { version = "3.4.0", features = ["rustls"] } +actix-http = "3.3.1" +awc = { version = "3.1.1", features = ["rustls"] } derive_deref = "1.1.1" rand = "0.8.5" -serial_test = "3.0.0" -time = { version = "0.3.35", features = ["macros"] } -tokio = "1.37.0" -wiremock = "0.6.0" +serial_test = "2.0.0" +time = { version = "0.3.21", features = ["macros"] } +tokio = "1.36.0" +wiremock = "0.5.18" # First party dev-dependencies diff --git a/crates/router/build.rs b/crates/router/build.rs index b33c168833d..167ca918407 100644 --- a/crates/router/build.rs +++ b/crates/router/build.rs @@ -1,8 +1,8 @@ fn main() { - // Set thread stack size to 8 MiB for debug builds + // Set thread stack size to 4 MiB for debug builds // Reference: https://doc.rust-lang.org/std/thread/#stack-size #[cfg(debug_assertions)] - println!("cargo:rustc-env=RUST_MIN_STACK=8388608"); // 8 * 1024 * 1024 = 8 MiB + println!("cargo:rustc-env=RUST_MIN_STACK=6291456"); // 6 * 1024 * 1024 = 6 MiB #[cfg(feature = "vergen")] router_env::vergen::generate_cargo_instructions(); diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs index d509cf03d3c..a9c2b8995b5 100644 --- a/crates/router/src/analytics.rs +++ b/crates/router/src/analytics.rs @@ -6,7 +6,6 @@ pub mod routes { api_event::api_events_core, connector_events::connector_events_core, errors::AnalyticsError, lambda_utils::invoke_lambda, outgoing_webhook_event::outgoing_webhook_events_core, sdk_events::sdk_events_core, - AnalyticsFlow, }; use api_models::analytics::{ search::{ @@ -18,6 +17,7 @@ pub mod routes { GetSdkEventMetricRequest, ReportRequest, }; use error_stack::ResultExt; + use router_env::AnalyticsFlow; use crate::{ core::api_locking, @@ -122,7 +122,7 @@ pub mod routes { state, &req, domain.into_inner(), - |_, _, domain: analytics::AnalyticsDomain, _| async { + |_, _, domain: analytics::AnalyticsDomain| async { analytics::core::get_domain_info(domain) .await .map(ApplicationResponse::Json) @@ -154,7 +154,7 @@ pub mod routes { state, &req, payload, - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::payments::get_metrics( &state.pool, &auth.merchant_account.merchant_id, @@ -190,7 +190,7 @@ pub mod routes { state, &req, payload, - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::refunds::get_metrics( &state.pool, &auth.merchant_account.merchant_id, @@ -226,7 +226,7 @@ pub mod routes { state, &req, payload, - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::sdk_events::get_metrics( &state.pool, auth.merchant_account.publishable_key.as_ref(), @@ -252,7 +252,7 @@ pub mod routes { state, &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::payments::get_filters( &state.pool, req, @@ -278,7 +278,7 @@ pub mod routes { state, &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req: GetRefundFilterRequest, _| async move { + |state, auth: AuthenticationData, req: GetRefundFilterRequest| async move { analytics::refunds::get_filters( &state.pool, req, @@ -304,7 +304,7 @@ pub mod routes { state, &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::sdk_events::get_filters( &state.pool, req, @@ -330,7 +330,7 @@ pub mod routes { state, &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { api_events_core(&state.pool, req, auth.merchant_account.merchant_id) .await .map(ApplicationResponse::Json) @@ -354,7 +354,7 @@ pub mod routes { state, &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { outgoing_webhook_events_core(&state.pool, req, auth.merchant_account.merchant_id) .await .map(ApplicationResponse::Json) @@ -376,7 +376,7 @@ pub mod routes { state, &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { sdk_events_core( &state.pool, req, @@ -402,7 +402,7 @@ pub mod routes { state.clone(), &req, json_payload.into_inner(), - |state, (auth, user_id): auth::AuthenticationDataWithUserId, payload, _| async move { + |state, (auth, user_id): auth::AuthenticationDataWithUserId, payload| async move { let user = UserInterface::find_user_by_id(&*state.store, &user_id) .await .change_context(AnalyticsError::UnknownError)?; @@ -444,7 +444,7 @@ pub mod routes { state.clone(), &req, json_payload.into_inner(), - |state, (auth, user_id): auth::AuthenticationDataWithUserId, payload, _| async move { + |state, (auth, user_id): auth::AuthenticationDataWithUserId, payload| async move { let user = UserInterface::find_user_by_id(&*state.store, &user_id) .await .change_context(AnalyticsError::UnknownError)?; @@ -486,7 +486,7 @@ pub mod routes { state.clone(), &req, json_payload.into_inner(), - |state, (auth, user_id): auth::AuthenticationDataWithUserId, payload, _| async move { + |state, (auth, user_id): auth::AuthenticationDataWithUserId, payload| async move { let user = UserInterface::find_user_by_id(&*state.store, &user_id) .await .change_context(AnalyticsError::UnknownError)?; @@ -538,7 +538,7 @@ pub mod routes { state.clone(), &req, payload, - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::api_event::get_api_event_metrics( &state.pool, &auth.merchant_account.merchant_id, @@ -564,7 +564,7 @@ pub mod routes { state.clone(), &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::api_event::get_filters( &state.pool, req, @@ -590,7 +590,7 @@ pub mod routes { state, &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { connector_events_core(&state.pool, req, auth.merchant_account.merchant_id) .await .map(ApplicationResponse::Json) @@ -612,11 +612,11 @@ pub mod routes { state.clone(), &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::search::msearch_results( - &state.opensearch_client, req, &auth.merchant_account.merchant_id, + state.conf.opensearch.clone(), ) .await .map(ApplicationResponse::Json) @@ -643,11 +643,11 @@ pub mod routes { state.clone(), &req, indexed_req, - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::search::search_results( - &state.opensearch_client, req, &auth.merchant_account.merchant_id, + state.conf.opensearch.clone(), ) .await .map(ApplicationResponse::Json) @@ -669,7 +669,7 @@ pub mod routes { state, &req, json_payload.into_inner(), - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::disputes::get_filters( &state.pool, req, @@ -704,7 +704,7 @@ pub mod routes { state, &req, payload, - |state, auth: AuthenticationData, req, _| async move { + |state, auth: AuthenticationData, req| async move { analytics::disputes::get_metrics( &state.pool, &auth.merchant_account.merchant_id, diff --git a/crates/router/src/bin/scheduler.rs b/crates/router/src/bin/scheduler.rs index 47f41d8700f..1df37e9f6d1 100644 --- a/crates/router/src/bin/scheduler.rs +++ b/crates/router/src/bin/scheduler.rs @@ -263,23 +263,6 @@ impl ProcessTrackerWorkflows for WorkflowRunner { storage::ProcessTrackerRunner::OutgoingWebhookRetryWorkflow => Ok(Box::new( workflows::outgoing_webhook_retry::OutgoingWebhookRetryWorkflow, )), - storage::ProcessTrackerRunner::AttachPayoutAccountWorkflow => { - #[cfg(feature = "payouts")] - { - Ok(Box::new( - workflows::attach_payout_account_workflow::AttachPayoutAccountWorkflow, - )) - } - #[cfg(not(feature = "payouts"))] - { - Err( - error_stack::report!(ProcessTrackerError::UnexpectedFlow), - ) - .attach_printable( - "Cannot run Stripe external account workflow when payouts feature is disabled", - ) - } - } } }; diff --git a/crates/router/src/compatibility/stripe/customers.rs b/crates/router/src/compatibility/stripe/customers.rs index 3628c72a31c..cd2ce4835e5 100644 --- a/crates/router/src/compatibility/stripe/customers.rs +++ b/crates/router/src/compatibility/stripe/customers.rs @@ -35,6 +35,7 @@ pub async fn customer_create( _, _, _, + _, types::CreateCustomerResponse, errors::StripeErrorCode, _, @@ -43,7 +44,7 @@ pub async fn customer_create( state.into_inner(), &req, create_cust_req, - |state, auth, req, _| { + |state, auth, req| { customers::create_customer(state, auth.merchant_account, auth.key_store, req) }, &auth::ApiKeyAuth, @@ -69,6 +70,7 @@ pub async fn customer_retrieve( _, _, _, + _, types::CustomerRetrieveResponse, errors::StripeErrorCode, _, @@ -77,7 +79,7 @@ pub async fn customer_retrieve( state.into_inner(), &req, payload, - |state, auth, req, _| { + |state, auth, req| { customers::retrieve_customer(state, auth.merchant_account, auth.key_store, req) }, &auth::ApiKeyAuth, @@ -112,6 +114,7 @@ pub async fn customer_update( _, _, _, + _, types::CustomerUpdateResponse, errors::StripeErrorCode, _, @@ -120,7 +123,7 @@ pub async fn customer_update( state.into_inner(), &req, cust_update_req, - |state, auth, req, _| { + |state, auth, req| { customers::update_customer(state, auth.merchant_account, req, auth.key_store) }, &auth::ApiKeyAuth, @@ -146,6 +149,7 @@ pub async fn customer_delete( _, _, _, + _, types::CustomerDeleteResponse, errors::StripeErrorCode, _, @@ -154,7 +158,7 @@ pub async fn customer_delete( state.into_inner(), &req, payload, - |state, auth, req, _| { + |state, auth, req| { customers::delete_customer(state, auth.merchant_account, req, auth.key_store) }, &auth::ApiKeyAuth, @@ -179,6 +183,7 @@ pub async fn list_customer_payment_method_api( _, _, _, + _, types::CustomerPaymentMethodListResponse, errors::StripeErrorCode, _, @@ -187,7 +192,7 @@ pub async fn list_customer_payment_method_api( state.into_inner(), &req, payload, - |state, auth, req, _| { + |state, auth, req| { cards::do_list_customer_pm_fetch_customer_if_not_passed( state, auth.merchant_account, diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs index 3482d42eb88..e8c398ad880 100644 --- a/crates/router/src/compatibility/stripe/errors.rs +++ b/crates/router/src/compatibility/stripe/errors.rs @@ -262,8 +262,6 @@ pub enum StripeErrorCode { CurrencyConversionFailed, #[error(error_type = StripeErrorType::InvalidRequestError, code = "IR_25", message = "Cannot delete the default payment method")] PaymentMethodDeleteFailed, - #[error(error_type = StripeErrorType::InvalidRequestError, code = "", message = "Extended card info does not exist")] - ExtendedCardInfoNotFound, // [#216]: https://github.com/juspay/hyperswitch/issues/216 // Implement the remaining stripe error codes @@ -429,7 +427,6 @@ impl From for StripeErrorCode { | errors::ApiErrorResponse::InvalidJwtToken | errors::ApiErrorResponse::GenericUnauthorized { .. } | errors::ApiErrorResponse::AccessForbidden { .. } - | errors::ApiErrorResponse::InvalidCookie | errors::ApiErrorResponse::InvalidEphemeralKey => Self::Unauthorized, errors::ApiErrorResponse::InvalidRequestUrl | errors::ApiErrorResponse::InvalidHttpMethod @@ -593,18 +590,10 @@ impl From for StripeErrorCode { object: "dispute".to_owned(), id: dispute_id, }, - errors::ApiErrorResponse::AuthenticationNotFound { id } => Self::ResourceMissing { - object: "authentication".to_owned(), - id, - }, errors::ApiErrorResponse::BusinessProfileNotFound { id } => Self::ResourceMissing { object: "business_profile".to_owned(), id, }, - errors::ApiErrorResponse::PollNotFound { id } => Self::ResourceMissing { - object: "poll".to_owned(), - id, - }, errors::ApiErrorResponse::DisputeStatusValidationFailed { reason } => { Self::InternalServerError } @@ -645,7 +634,6 @@ impl From for StripeErrorCode { errors::ApiErrorResponse::InvalidWalletToken { wallet_name } => { Self::InvalidWalletToken { wallet_name } } - errors::ApiErrorResponse::ExtendedCardInfoNotFound => Self::ExtendedCardInfoNotFound, } } } @@ -717,8 +705,7 @@ impl actix_web::ResponseError for StripeErrorCode { | Self::PaymentMethodUnactivated | Self::InvalidConnectorConfiguration { .. } | Self::CurrencyConversionFailed - | Self::PaymentMethodDeleteFailed - | Self::ExtendedCardInfoNotFound => StatusCode::BAD_REQUEST, + | Self::PaymentMethodDeleteFailed => StatusCode::BAD_REQUEST, Self::RefundFailed | Self::PayoutFailed | Self::PaymentLinkNotFound diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rs index d67e10a96e5..87560032ea4 100644 --- a/crates/router/src/compatibility/stripe/payment_intents.rs +++ b/crates/router/src/compatibility/stripe/payment_intents.rs @@ -7,8 +7,7 @@ use router_env::{instrument, tracing, Flow, Tag}; use crate::{ compatibility::{stripe::errors, wrap}, core::{api_locking::GetLockingInput, payment_methods::Oss, payments}, - logger, - routes::{self, payments::get_or_generate_payment_id}, + logger, routes, services::{api, authentication as auth}, types::api as api_types, }; @@ -27,19 +26,15 @@ pub async fn payment_intents_create( Ok(p) => p, Err(err) => return api::log_and_return_error_response(err), }; - tracing::Span::current().record("payment_id", &payload.id.clone().unwrap_or_default()); logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?payload); - let mut create_payment_req: payment_types::PaymentsRequest = match payload.try_into() { + let create_payment_req: payment_types::PaymentsRequest = match payload.try_into() { Ok(req) => req, Err(err) => return api::log_and_return_error_response(err), }; - if let Err(err) = get_or_generate_payment_id(&mut create_payment_req) { - return api::log_and_return_error_response(err); - } let flow = Flow::PaymentsCreate; let locking_action = create_payment_req.get_locking_input(flow.clone()); Box::pin(wrap::compatibility_api_wrap::< @@ -48,6 +43,7 @@ pub async fn payment_intents_create( _, _, _, + _, types::StripePaymentIntentResponse, errors::StripeErrorCode, _, @@ -56,11 +52,10 @@ pub async fn payment_intents_create( state.into_inner(), &req, create_payment_req, - |state, auth, req, req_state| { + |state, auth, req| { let eligible_connectors = req.connector.clone(); payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentCreate, @@ -109,6 +104,7 @@ pub async fn payment_intents_retrieve( _, _, _, + _, types::StripePaymentIntentResponse, errors::StripeErrorCode, _, @@ -117,10 +113,9 @@ pub async fn payment_intents_retrieve( state.into_inner(), &req, payload, - |state, auth, payload, req_state| { + |state, auth, payload| { payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentStatus, @@ -179,6 +174,7 @@ pub async fn payment_intents_retrieve_with_gateway_creds( _, _, _, + _, types::StripePaymentIntentResponse, errors::StripeErrorCode, _, @@ -187,10 +183,9 @@ pub async fn payment_intents_retrieve_with_gateway_creds( state.into_inner(), &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentStatus, @@ -244,6 +239,7 @@ pub async fn payment_intents_update( _, _, _, + _, types::StripePaymentIntentResponse, errors::StripeErrorCode, _, @@ -252,11 +248,10 @@ pub async fn payment_intents_update( state.into_inner(), &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { let eligible_connectors = req.connector.clone(); payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentUpdate, @@ -316,6 +311,7 @@ pub async fn payment_intents_confirm( _, _, _, + _, types::StripePaymentIntentResponse, errors::StripeErrorCode, _, @@ -324,11 +320,10 @@ pub async fn payment_intents_confirm( state.into_inner(), &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { let eligible_connectors = req.connector.clone(); payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentConfirm, @@ -378,6 +373,7 @@ pub async fn payment_intents_capture( _, _, _, + _, types::StripePaymentIntentResponse, errors::StripeErrorCode, _, @@ -386,10 +382,9 @@ pub async fn payment_intents_capture( state.into_inner(), &req, payload, - |state, auth, payload, req_state| { + |state, auth, payload| { payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentCapture, @@ -443,6 +438,7 @@ pub async fn payment_intents_cancel( _, _, _, + _, types::StripePaymentIntentResponse, errors::StripeErrorCode, _, @@ -451,10 +447,9 @@ pub async fn payment_intents_cancel( state.into_inner(), &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentCancel, @@ -489,6 +484,7 @@ pub async fn payment_intent_list( _, _, _, + _, types::StripePaymentIntentListResponse, errors::StripeErrorCode, _, @@ -497,7 +493,7 @@ pub async fn payment_intent_list( state.into_inner(), &req, payload, - |state, auth, req, _| payments::list_payments(state, auth.merchant_account, req), + |state, auth, req| payments::list_payments(state, auth.merchant_account, req), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, )) diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs index eed80a1128e..5a26c5e2615 100644 --- a/crates/router/src/compatibility/stripe/payment_intents/types.rs +++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs @@ -335,9 +335,7 @@ impl TryFrom for payments::PaymentsRequest { pmd.payment_method_details .as_ref() .map(|spmd| payments::PaymentMethodDataRequest { - payment_method_data: Some(payments::PaymentMethodData::from( - spmd.to_owned(), - )), + payment_method_data: payments::PaymentMethodData::from(spmd.to_owned()), billing: pmd.billing_details.clone().map(payments::Address::from), }) }), @@ -425,9 +423,8 @@ impl From for StripePaymentStatus { } } -#[derive(Debug, Serialize, Deserialize, Copy, Clone, strum::Display)] +#[derive(Debug, Serialize, Deserialize, Copy, Clone)] #[serde(rename_all = "snake_case")] -#[strum(serialize_all = "snake_case")] pub enum CancellationReason { Duplicate, Fraudulent, @@ -435,6 +432,17 @@ pub enum CancellationReason { Abandoned, } +impl ToString for CancellationReason { + fn to_string(&self) -> String { + String::from(match self { + Self::Duplicate => "duplicate", + Self::Fraudulent => "fradulent", + Self::RequestedByCustomer => "requested_by_customer", + Self::Abandoned => "abandoned", + }) + } +} + #[derive(Debug, Deserialize, Serialize, Copy, Clone)] pub struct StripePaymentCancelRequest { cancellation_reason: Option, diff --git a/crates/router/src/compatibility/stripe/refunds.rs b/crates/router/src/compatibility/stripe/refunds.rs index da68e79e422..80ebbc4f84d 100644 --- a/crates/router/src/compatibility/stripe/refunds.rs +++ b/crates/router/src/compatibility/stripe/refunds.rs @@ -40,6 +40,7 @@ pub async fn refund_create( _, _, _, + _, types::StripeRefundResponse, errors::StripeErrorCode, _, @@ -48,7 +49,7 @@ pub async fn refund_create( state.into_inner(), &req, create_refund_req, - |state, auth, req, _| { + |state, auth, req| { refunds::refund_create_core(state, auth.merchant_account, auth.key_store, req) }, &auth::ApiKeyAuth, @@ -84,6 +85,7 @@ pub async fn refund_retrieve_with_gateway_creds( _, _, _, + _, types::StripeRefundResponse, errors::StripeErrorCode, _, @@ -92,7 +94,7 @@ pub async fn refund_retrieve_with_gateway_creds( state.into_inner(), &req, refund_request, - |state, auth, refund_request, _| { + |state, auth, refund_request| { refunds::refund_response_wrapper( state, auth.merchant_account, @@ -126,6 +128,7 @@ pub async fn refund_retrieve( _, _, _, + _, types::StripeRefundResponse, errors::StripeErrorCode, _, @@ -134,7 +137,7 @@ pub async fn refund_retrieve( state.into_inner(), &req, refund_request, - |state, auth, refund_request, _| { + |state, auth, refund_request| { refunds::refund_response_wrapper( state, auth.merchant_account, @@ -166,6 +169,7 @@ pub async fn refund_update( _, _, _, + _, types::StripeRefundResponse, errors::StripeErrorCode, _, @@ -174,7 +178,7 @@ pub async fn refund_update( state.into_inner(), &req, create_refund_update_req, - |state, auth, req, _| refunds::refund_update_core(state, auth.merchant_account, req), + |state, auth, req| refunds::refund_update_core(state, auth.merchant_account, req), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, )) diff --git a/crates/router/src/compatibility/stripe/setup_intents.rs b/crates/router/src/compatibility/stripe/setup_intents.rs index 60627ee5642..6522dc4697c 100644 --- a/crates/router/src/compatibility/stripe/setup_intents.rs +++ b/crates/router/src/compatibility/stripe/setup_intents.rs @@ -44,6 +44,7 @@ pub async fn setup_intents_create( _, _, _, + _, types::StripeSetupIntentResponse, errors::StripeErrorCode, _, @@ -52,7 +53,7 @@ pub async fn setup_intents_create( state.into_inner(), &req, create_payment_req, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::< api_types::SetupMandate, api_types::PaymentsResponse, @@ -62,7 +63,6 @@ pub async fn setup_intents_create( Oss, >( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentCreate, @@ -111,6 +111,7 @@ pub async fn setup_intents_retrieve( _, _, _, + _, types::StripeSetupIntentResponse, errors::StripeErrorCode, _, @@ -119,10 +120,9 @@ pub async fn setup_intents_retrieve( state.into_inner(), &req, payload, - |state, auth, payload, req_state| { + |state, auth, payload| { payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentStatus, @@ -177,6 +177,7 @@ pub async fn setup_intents_update( _, _, _, + _, types::StripeSetupIntentResponse, errors::StripeErrorCode, _, @@ -185,7 +186,7 @@ pub async fn setup_intents_update( state.into_inner(), &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::< api_types::SetupMandate, api_types::PaymentsResponse, @@ -195,7 +196,6 @@ pub async fn setup_intents_update( Oss, >( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentUpdate, @@ -251,6 +251,7 @@ pub async fn setup_intents_confirm( _, _, _, + _, types::StripeSetupIntentResponse, errors::StripeErrorCode, _, @@ -259,7 +260,7 @@ pub async fn setup_intents_confirm( state.into_inner(), &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::< api_types::SetupMandate, api_types::PaymentsResponse, @@ -269,7 +270,6 @@ pub async fn setup_intents_confirm( Oss, >( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentConfirm, diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs index 03335d42722..6fb6b6c808b 100644 --- a/crates/router/src/compatibility/stripe/setup_intents/types.rs +++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs @@ -246,9 +246,7 @@ impl TryFrom for payments::PaymentsRequest { pmd.payment_method_details .as_ref() .map(|spmd| payments::PaymentMethodDataRequest { - payment_method_data: Some(payments::PaymentMethodData::from( - spmd.to_owned(), - )), + payment_method_data: payments::PaymentMethodData::from(spmd.to_owned()), billing: pmd.billing_details.clone().map(payments::Address::from), }) }), @@ -336,9 +334,8 @@ impl From for StripeSetupStatus { } } -#[derive(Debug, Serialize, Deserialize, Copy, Clone, strum::Display)] +#[derive(Debug, Serialize, Deserialize, Copy, Clone)] #[serde(rename_all = "snake_case")] -#[strum(serialize_all = "snake_case")] pub enum CancellationReason { Duplicate, Fraudulent, @@ -346,6 +343,17 @@ pub enum CancellationReason { Abandoned, } +impl ToString for CancellationReason { + fn to_string(&self) -> String { + String::from(match self { + Self::Duplicate => "duplicate", + Self::Fraudulent => "fradulent", + Self::RequestedByCustomer => "requested_by_customer", + Self::Abandoned => "abandoned", + }) + } +} + #[derive(Debug, Deserialize, Serialize, Copy, Clone)] pub struct StripePaymentCancelRequest { cancellation_reason: Option, diff --git a/crates/router/src/compatibility/wrap.rs b/crates/router/src/compatibility/wrap.rs index 96163727da3..da9a7f3d163 100644 --- a/crates/router/src/compatibility/wrap.rs +++ b/crates/router/src/compatibility/wrap.rs @@ -8,25 +8,22 @@ use serde::Serialize; use crate::{ core::{api_locking, errors}, events::api_logs::ApiEventMetric, - routes::{ - app::{AppStateInfo, ReqState}, - metrics, AppState, - }, + routes::{app::AppStateInfo, metrics}, services::{self, api, authentication as auth, logger}, }; #[instrument(skip(request, payload, state, func, api_authentication))] -pub async fn compatibility_api_wrap<'a, 'b, U, T, Q, F, Fut, S, E, E2>( +pub async fn compatibility_api_wrap<'a, 'b, A, U, T, Q, F, Fut, S, E, E2>( flow: impl router_env::types::FlowMetric, - state: Arc, + state: Arc, request: &'a HttpRequest, payload: T, func: F, - api_authentication: &dyn auth::AuthenticateAndFetch, + api_authentication: &dyn auth::AuthenticateAndFetch, lock_action: api_locking::LockAction, ) -> HttpResponse where - F: Fn(AppState, U, T, ReqState) -> Fut, + F: Fn(A, U, T) -> Fut, Fut: Future, E2>>, E2: ErrorSwitch + std::error::Error + Send + Sync + 'static, Q: Serialize + std::fmt::Debug + 'a + ApiEventMetric, @@ -35,6 +32,7 @@ where error_stack::Report: services::EmbedError, errors::ApiErrorResponse: ErrorSwitch, T: std::fmt::Debug + Serialize + ApiEventMetric, + A: AppStateInfo + Clone, { let request_method = request.method().as_str(); let url_path = request.path(); @@ -43,13 +41,11 @@ where let start_instant = Instant::now(); logger::info!(tag = ?Tag::BeginRequest, payload = ?payload); - let req_state = state.get_req_state(); let server_wrap_util_res = metrics::request::record_request_time_metric( api::server_wrap_util( &flow, state.clone().into(), - req_state, request, payload, func, diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs index bf2635c6fc2..7ade016856c 100644 --- a/crates/router/src/configs/defaults.rs +++ b/crates/router/src/configs/defaults.rs @@ -280,23 +280,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), - ( - "billing.address.last_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), + ) ] ), } @@ -485,18 +476,9 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), - ( - "billing.address.last_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, @@ -561,25 +543,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -588,7 +570,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.state".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.state".to_string(), + required_field: "billing.address.state".to_string(), display_name: "state".to_string(), field_type: enums::FieldType::UserAddressState, value: None, @@ -597,7 +579,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -606,7 +588,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -619,7 +601,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -684,18 +666,18 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ) @@ -760,9 +742,9 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ) @@ -815,36 +797,45 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } ), ( - "billing.address.last_name".to_string(), + "email".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "email".to_string(), + display_name: "email".to_string(), + field_type: enums::FieldType::UserEmailAddress, value: None, } ), ( - "email".to_string(), + "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "email".to_string(), - display_name: "email".to_string(), - field_type: enums::FieldType::UserEmailAddress, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, + value: None, + } + ), + ( + "billing.address.last_name".to_string(), + RequiredFieldInfo { + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -853,7 +844,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -862,7 +853,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.state".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.state".to_string(), + required_field: "billing.address.state".to_string(), display_name: "state".to_string(), field_type: enums::FieldType::UserAddressState, value: None, @@ -871,7 +862,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -880,7 +871,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -936,28 +927,37 @@ impl Default for super::settings::RequiredFields { value: None, } ), - ( - "billing.address.first_name".to_string(), + ( + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } ), + ( + "billing.address.first_name".to_string(), + RequiredFieldInfo { + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, + value: None, + } + ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), - ( + ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -1062,23 +1062,32 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } ), ( - "billing.address.last_name".to_string(), + "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), + ( + "billing.address.last_name".to_string(), + RequiredFieldInfo { + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, + value: None, + } + ) ] ), common:HashMap::new(), @@ -1174,25 +1183,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -1201,7 +1210,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -1263,23 +1272,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), - ( - "billing.address.last_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), + ) ] ), common: HashMap::new(), @@ -1331,25 +1331,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -1358,7 +1358,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line2".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line2".to_string(), + required_field: "billing.address.line2".to_string(), display_name: "line2".to_string(), field_type: enums::FieldType::UserAddressLine2, value: None, @@ -1367,7 +1367,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -1376,7 +1376,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -1385,7 +1385,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -1491,25 +1491,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "billing_zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -1564,23 +1564,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), - ( - "billing.address.last_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), + ) ] ), } @@ -1640,18 +1631,18 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), @@ -1796,23 +1787,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), - ( - "billing.address.last_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), + ) ] ), common: HashMap::new(), @@ -1861,23 +1843,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), - ( - "billing.address.last_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), + ) ] ), common: HashMap::new(), @@ -1972,23 +1945,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), - ( - "billing.address.last_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), + ) ] ), common: HashMap::new(), @@ -2086,25 +2050,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -2113,7 +2077,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -2122,7 +2086,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -2131,7 +2095,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -2237,7 +2201,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -2383,23 +2347,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), - ( - "billing.address.last_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), + ) ] ), } @@ -2588,18 +2543,9 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), - ( - "billing.address.last_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, @@ -2664,25 +2610,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -2691,7 +2637,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.state".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.state".to_string(), + required_field: "billing.address.state".to_string(), display_name: "state".to_string(), field_type: enums::FieldType::UserAddressState, value: None, @@ -2700,7 +2646,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -2709,7 +2655,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -2722,7 +2668,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -2787,18 +2733,18 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ) @@ -2863,9 +2809,9 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ) @@ -2917,36 +2863,45 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } ), ( - "billing.address.last_name".to_string(), + "email".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "email".to_string(), + display_name: "email".to_string(), + field_type: enums::FieldType::UserEmailAddress, value: None, } ), ( - "email".to_string(), + "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "email".to_string(), - display_name: "email".to_string(), - field_type: enums::FieldType::UserEmailAddress, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, + value: None, + } + ), + ( + "billing.address.last_name".to_string(), + RequiredFieldInfo { + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -2955,7 +2910,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -2964,7 +2919,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.state".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.state".to_string(), + required_field: "billing.address.state".to_string(), display_name: "state".to_string(), field_type: enums::FieldType::UserAddressState, value: None, @@ -2973,7 +2928,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -2982,7 +2937,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -3040,27 +2995,36 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } ), + ( + "billing.address.first_name".to_string(), + RequiredFieldInfo { + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, + value: None, + } + ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -3165,23 +3129,32 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } ), ( - "billing.address.last_name".to_string(), + "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), + ( + "billing.address.last_name".to_string(), + RequiredFieldInfo { + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, + value: None, + } + ) ] ), common:HashMap::new(), @@ -3277,25 +3250,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -3304,7 +3277,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -3366,23 +3339,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), - ( - "billing.address.last_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), + ) ] ), common: HashMap::new(), @@ -3434,25 +3398,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -3461,7 +3425,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line2".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line2".to_string(), + required_field: "billing.address.line2".to_string(), display_name: "line2".to_string(), field_type: enums::FieldType::UserAddressLine2, value: None, @@ -3470,7 +3434,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -3479,7 +3443,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -3488,7 +3452,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -3594,25 +3558,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "billing_zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -3667,23 +3631,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), - ( - "billing.address.last_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), + ) ] ), } @@ -3743,18 +3698,18 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.first_name".to_string(), + display_name: "billing_first_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + required_field: "billing.address.last_name".to_string(), + display_name: "billing_last_name".to_string(), + field_type: enums::FieldType::UserBillingName, value: None, } ), @@ -3899,23 +3854,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), - ( - "billing.address.last_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), + ) ] ), common: HashMap::new(), @@ -3964,23 +3910,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), - ( - "billing.address.last_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), + ) ] ), common: HashMap::new(), @@ -4075,23 +4012,14 @@ impl Default for super::settings::RequiredFields { } ), ( - "billing.address.first_name".to_string(), + "payment_method_data.card.card_holder_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "payment_method_data.card.card_holder_name".to_string(), display_name: "card_holder_name".to_string(), field_type: enums::FieldType::UserFullName, value: None, } - ), - ( - "billing.address.last_name".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), - display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, - value: None, - } - ), + ) ] ), common: HashMap::new(), @@ -4189,25 +4117,25 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "card_holder_name".to_string(), - field_type: enums::FieldType::UserFullName, + field_type: enums::FieldType::UserBillingName, value: None, } ), ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -4216,7 +4144,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -4225,7 +4153,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -4234,7 +4162,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -4340,7 +4268,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -4456,7 +4384,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -4465,7 +4393,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -4638,7 +4566,7 @@ impl Default for super::settings::RequiredFields { common: HashMap::from([ ("billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry { options: vec![ @@ -4676,7 +4604,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -4685,7 +4613,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -4694,7 +4622,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -4771,7 +4699,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -4780,7 +4708,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -4789,7 +4717,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -4798,7 +4726,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -4807,7 +4735,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry { options: vec![ @@ -4919,7 +4847,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -4928,7 +4856,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -4937,7 +4865,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -5039,7 +4967,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5048,7 +4976,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -5057,7 +4985,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -5066,7 +4994,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -5075,7 +5003,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -5144,7 +5072,7 @@ impl Default for super::settings::RequiredFields { common: HashMap::from([ ("billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry { options: vec![ @@ -5195,7 +5123,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5204,7 +5132,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5213,7 +5141,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -5332,7 +5260,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5341,7 +5269,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -5350,7 +5278,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -5359,7 +5287,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -5368,7 +5296,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry { options: vec![ @@ -5467,7 +5395,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry { options: vec![ @@ -5527,7 +5455,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5536,7 +5464,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -5545,7 +5473,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -5554,7 +5482,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -5563,7 +5491,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -5602,7 +5530,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5611,7 +5539,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5620,7 +5548,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -5695,7 +5623,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5704,7 +5632,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5713,7 +5641,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -5722,7 +5650,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -5731,7 +5659,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -5740,7 +5668,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -5791,7 +5719,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5800,7 +5728,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5809,7 +5737,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -5818,7 +5746,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.state".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.state".to_string(), + required_field: "billing.address.state".to_string(), display_name: "state".to_string(), field_type: enums::FieldType::UserAddressState, value: None, @@ -5827,7 +5755,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -5836,7 +5764,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -5849,7 +5777,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -5878,7 +5806,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5887,7 +5815,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5896,7 +5824,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -5905,7 +5833,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.state".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.state".to_string(), + required_field: "billing.address.state".to_string(), display_name: "state".to_string(), field_type: enums::FieldType::UserAddressState, value: None, @@ -5914,7 +5842,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -5923,7 +5851,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -5936,7 +5864,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -5980,7 +5908,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5989,7 +5917,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -5998,7 +5926,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -6007,7 +5935,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.state".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.state".to_string(), + required_field: "billing.address.state".to_string(), display_name: "state".to_string(), field_type: enums::FieldType::UserAddressState, value: None, @@ -6016,7 +5944,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -6025,7 +5953,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -6038,7 +5966,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -6113,7 +6041,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -6122,7 +6050,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -6131,7 +6059,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -6140,7 +6068,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.state".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.state".to_string(), + required_field: "billing.address.state".to_string(), display_name: "state".to_string(), field_type: enums::FieldType::UserAddressState, value: None, @@ -6149,7 +6077,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -6158,7 +6086,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -6171,7 +6099,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -6180,7 +6108,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line2".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line2".to_string(), + required_field: "billing.address.line2".to_string(), display_name: "line2".to_string(), field_type: enums::FieldType::UserAddressLine2, value: None, @@ -6207,7 +6135,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -6216,7 +6144,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.last_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.last_name".to_string(), + required_field: "billing.address.last_name".to_string(), display_name: "billing_last_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -6225,7 +6153,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.city".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.city".to_string(), + required_field: "billing.address.city".to_string(), display_name: "city".to_string(), field_type: enums::FieldType::UserAddressCity, value: None, @@ -6234,7 +6162,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.state".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.state".to_string(), + required_field: "billing.address.state".to_string(), display_name: "state".to_string(), field_type: enums::FieldType::UserAddressState, value: None, @@ -6243,7 +6171,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.zip".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.zip".to_string(), + required_field: "billing.address.zip".to_string(), display_name: "zip".to_string(), field_type: enums::FieldType::UserAddressPincode, value: None, @@ -6252,7 +6180,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.country".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), + required_field: "billing.address.country".to_string(), display_name: "country".to_string(), field_type: enums::FieldType::UserAddressCountry{ options: vec![ @@ -6265,7 +6193,7 @@ impl Default for super::settings::RequiredFields { ( "billing.address.line1".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.line1".to_string(), + required_field: "billing.address.line1".to_string(), display_name: "line1".to_string(), field_type: enums::FieldType::UserAddressLine1, value: None, @@ -6528,7 +6456,7 @@ impl Default for super::settings::RequiredFields { common: HashMap::from([ ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -6549,7 +6477,7 @@ impl Default for super::settings::RequiredFields { common: HashMap::from([ ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -6572,7 +6500,7 @@ impl Default for super::settings::RequiredFields { common: HashMap::from([ ( "billing.address.first_name".to_string(), RequiredFieldInfo { - required_field: "payment_method_data.billing.address.first_name".to_string(), + required_field: "billing.address.first_name".to_string(), display_name: "billing_first_name".to_string(), field_type: enums::FieldType::UserBillingName, value: None, @@ -6598,26 +6526,14 @@ impl Default for super::settings::RequiredFields { } ), ])}), - (enums::PaymentMethodType::LocalBankTransfer, + (enums::PaymentMethodType::Multibanco, ConnectorFields { fields: HashMap::from([ ( - enums::Connector::Zsl, + enums::Connector::Stripe, RequiredFieldFinal { mandate: HashMap::new(), - non_mandate: HashMap::from([ ( - "billing.address.country".to_string(), - RequiredFieldInfo { - required_field: "payment_method_data.billing.address.country".to_string(), - display_name: "country".to_string(), - field_type: enums::FieldType::UserAddressCountry{ - options: vec![ - "CN".to_string(), - ] - }, - value: None, - } - )]), + non_mandate: HashMap::new(), common: HashMap::new(), } ), diff --git a/crates/router/src/configs/secrets_transformers.rs b/crates/router/src/configs/secrets_transformers.rs index 537f6666c5d..6906b5a3e7a 100644 --- a/crates/router/src/configs/secrets_transformers.rs +++ b/crates/router/src/configs/secrets_transformers.rs @@ -335,8 +335,6 @@ pub(crate) async fn fetch_raw_secrets( #[cfg(feature = "email")] email: conf.email, mandates: conf.mandates, - network_transaction_id_supported_connectors: conf - .network_transaction_id_supported_connectors, required_fields: conf.required_fields, delayed_session_response: conf.delayed_session_response, webhook_source_verification_call: conf.webhook_source_verification_call, diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs index 01b05c60bd9..d92812cee40 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::{opensearch::OpenSearchConfig, ReportConfig}; +use analytics::{OpensearchConfig, ReportConfig}; use api_models::{enums, payment_methods::RequiredFieldInfo}; use common_utils::ext_traits::ConfigExt; use config::{Environment, File}; @@ -91,7 +91,6 @@ pub struct Settings { pub email: EmailSettings, pub cors: CorsSettings, pub mandates: Mandates, - pub network_transaction_id_supported_connectors: NetworkTransactionIdSupportedConnectors, pub required_fields: RequiredFields, pub delayed_session_response: DelayedSessionConfig, pub webhook_source_verification_call: WebhookSourceVerificationCall, @@ -114,7 +113,7 @@ pub struct Settings { #[cfg(feature = "olap")] pub report_download_config: ReportConfig, #[cfg(feature = "olap")] - pub opensearch: OpenSearchConfig, + pub opensearch: OpensearchConfig, pub events: EventsConfig, #[cfg(feature = "olap")] pub connector_onboarding: SecretStateContainer, @@ -252,12 +251,6 @@ pub struct Mandates { pub update_mandate_supported: SupportedPaymentMethodsForMandate, } -#[derive(Debug, Deserialize, Clone, Default)] -pub struct NetworkTransactionIdSupportedConnectors { - #[serde(deserialize_with = "deserialize_hashset")] - pub connector_list: HashSet, -} - #[derive(Debug, Deserialize, Clone)] pub struct SupportedPaymentMethodsForMandate( pub HashMap, @@ -323,7 +316,7 @@ pub struct ConnectorBankNames(pub HashMap); #[derive(Debug, Deserialize, Clone)] pub struct BanksVector { #[serde(deserialize_with = "deserialize_hashset")] - pub banks: HashSet, + pub banks: HashSet, } #[derive(Debug, Deserialize, Clone, Default)] @@ -500,7 +493,6 @@ pub struct Connectors { pub dlocal: ConnectorParams, #[cfg(feature = "dummy_connector")] pub dummyconnector: ConnectorParams, - pub ebanx: ConnectorParams, pub fiserv: ConnectorParams, pub forte: ConnectorParams, pub globalpay: ConnectorParams, @@ -511,7 +503,6 @@ pub struct Connectors { pub klarna: ConnectorParams, pub mollie: ConnectorParams, pub multisafepay: ConnectorParams, - pub netcetera: ConnectorParams, pub nexinets: ConnectorParams, pub nmi: ConnectorParams, pub noon: ConnectorParamsWithModeType, @@ -540,7 +531,6 @@ pub struct Connectors { pub worldline: ConnectorParams, pub worldpay: ConnectorParams, pub zen: ConnectorParams, - pub zsl: ConnectorParams, } #[derive(Debug, Deserialize, Clone, Default, router_derive::ConfigValidate)] @@ -730,9 +720,6 @@ impl Settings { self.lock_settings.validate()?; self.events.validate()?; - #[cfg(feature = "olap")] - self.opensearch.validate()?; - self.encryption_management .validate() .map_err(|err| ApplicationError::InvalidConfigurationValueError(err.into()))?; diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs index 01c22651cd0..d786ed4e31b 100644 --- a/crates/router/src/connector.rs +++ b/crates/router/src/connector.rs @@ -17,7 +17,6 @@ pub mod cybersource; pub mod dlocal; #[cfg(feature = "dummy_connector")] pub mod dummyconnector; -pub mod ebanx; pub mod fiserv; pub mod forte; pub mod globalpay; @@ -28,7 +27,6 @@ pub mod iatapay; pub mod klarna; pub mod mollie; pub mod multisafepay; -pub mod netcetera; pub mod nexinets; pub mod nmi; pub mod noon; @@ -58,7 +56,6 @@ pub mod wise; pub mod worldline; pub mod worldpay; pub mod zen; -pub mod zsl; #[cfg(feature = "dummy_connector")] pub use self::dummyconnector::DummyConnector; @@ -67,13 +64,12 @@ pub use self::{ bambora::Bambora, bankofamerica::Bankofamerica, billwerk::Billwerk, bitpay::Bitpay, bluesnap::Bluesnap, boku::Boku, braintree::Braintree, cashtocode::Cashtocode, checkout::Checkout, coinbase::Coinbase, cryptopay::Cryptopay, cybersource::Cybersource, - dlocal::Dlocal, ebanx::Ebanx, fiserv::Fiserv, forte::Forte, globalpay::Globalpay, - globepay::Globepay, gocardless::Gocardless, helcim::Helcim, iatapay::Iatapay, klarna::Klarna, - mollie::Mollie, multisafepay::Multisafepay, netcetera::Netcetera, nexinets::Nexinets, nmi::Nmi, - noon::Noon, nuvei::Nuvei, opayo::Opayo, opennode::Opennode, payeezy::Payeezy, payme::Payme, - paypal::Paypal, payu::Payu, placetopay::Placetopay, powertranz::Powertranz, - prophetpay::Prophetpay, rapyd::Rapyd, riskified::Riskified, shift4::Shift4, signifyd::Signifyd, - square::Square, stax::Stax, stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay, - tsys::Tsys, volt::Volt, wise::Wise, worldline::Worldline, worldpay::Worldpay, zen::Zen, - zsl::Zsl, + dlocal::Dlocal, fiserv::Fiserv, forte::Forte, globalpay::Globalpay, globepay::Globepay, + gocardless::Gocardless, helcim::Helcim, iatapay::Iatapay, klarna::Klarna, mollie::Mollie, + multisafepay::Multisafepay, nexinets::Nexinets, nmi::Nmi, noon::Noon, nuvei::Nuvei, + opayo::Opayo, opennode::Opennode, payeezy::Payeezy, payme::Payme, paypal::Paypal, payu::Payu, + placetopay::Placetopay, powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd, + riskified::Riskified, shift4::Shift4, signifyd::Signifyd, square::Square, stax::Stax, + stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay, tsys::Tsys, volt::Volt, + wise::Wise, worldline::Worldline, worldpay::Worldpay, zen::Zen, }; diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs index 23288e3819d..7fb3ba7c411 100644 --- a/crates/router/src/connector/aci/transformers.rs +++ b/crates/router/src/connector/aci/transformers.rs @@ -1,5 +1,6 @@ use std::str::FromStr; +use api_models::enums::BankNames; use common_utils::pii::Email; use error_stack::report; use masking::{ExposeInterface, Secret}; @@ -8,10 +9,10 @@ use serde::{Deserialize, Serialize}; use super::result_codes::{FAILURE_CODES, PENDING_CODES, SUCCESSFUL_CODES}; use crate::{ - connector::utils::{self, PhoneDetailsData, RouterData}, + connector::utils::{self, RouterData}, core::errors, services, - types::{self, domain, storage::enums}, + types::{self, api, storage::enums}, }; type Error = error_stack::Report; @@ -106,48 +107,46 @@ pub enum PaymentDetails { Mandate, } -impl TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)> for PaymentDetails { +impl TryFrom<&api_models::payments::WalletData> for PaymentDetails { type Error = Error; - fn try_from( - value: (&domain::WalletData, &types::PaymentsAuthorizeRouterData), - ) -> Result { - let (wallet_data, item) = value; + fn try_from(wallet_data: &api_models::payments::WalletData) -> Result { let payment_data = match wallet_data { - domain::WalletData::MbWayRedirect(_) => { - let phone_details = item.get_billing_phone()?; + api_models::payments::WalletData::MbWayRedirect(data) => { Self::Wallet(Box::new(WalletPMData { payment_brand: PaymentBrand::Mbway, - account_id: Some(phone_details.get_number_with_hash_country_code()?), + account_id: Some(data.telephone_number.clone()), })) } - domain::WalletData::AliPayRedirect { .. } => Self::Wallet(Box::new(WalletPMData { - payment_brand: PaymentBrand::AliPay, - account_id: None, - })), - domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect { .. } - | domain::WalletData::GooglePay(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect { .. } - | domain::WalletData::VippsRedirect { .. } - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::AliPayQr(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::GooglePayRedirect(_) => Err( + api_models::payments::WalletData::AliPayRedirect { .. } => { + Self::Wallet(Box::new(WalletPMData { + payment_brand: PaymentBrand::AliPay, + account_id: None, + })) + } + api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePay(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect { .. } + | api_models::payments::WalletData::GooglePay(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect { .. } + | api_models::payments::WalletData::VippsRedirect { .. } + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) + | api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::GooglePayRedirect(_) => Err( errors::ConnectorError::NotImplemented("Payment method".to_string()), )?, }; @@ -158,19 +157,19 @@ impl TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)> for Pay impl TryFrom<( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankRedirectData, + &api_models::payments::BankRedirectData, )> for PaymentDetails { type Error = Error; fn try_from( value: ( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankRedirectData, + &api_models::payments::BankRedirectData, ), ) -> Result { let (item, bank_redirect_data) = value; let payment_data = match bank_redirect_data { - domain::BankRedirectData::Eps { country, .. } => { + api_models::payments::BankRedirectData::Eps { country, .. } => { Self::BankRedirect(Box::new(BankRedirectionPMData { payment_brand: PaymentBrand::Eps, bank_account_country: Some(country.ok_or( @@ -187,7 +186,7 @@ impl customer_email: None, })) } - domain::BankRedirectData::Giropay { + api_models::payments::BankRedirectData::Giropay { bank_account_bic, bank_account_iban, country, @@ -207,7 +206,7 @@ impl merchant_transaction_id: None, customer_email: None, })), - domain::BankRedirectData::Ideal { + api_models::payments::BankRedirectData::Ideal { bank_name, country, .. } => Self::BankRedirect(Box::new(BankRedirectionPMData { payment_brand: PaymentBrand::Ideal, @@ -228,7 +227,7 @@ impl merchant_transaction_id: None, customer_email: None, })), - domain::BankRedirectData::Sofort { country, .. } => { + api_models::payments::BankRedirectData::Sofort { country, .. } => { Self::BankRedirect(Box::new(BankRedirectionPMData { payment_brand: PaymentBrand::Sofortueberweisung, bank_account_country: Some(country.to_owned().ok_or( @@ -245,7 +244,7 @@ impl customer_email: None, })) } - domain::BankRedirectData::Przelewy24 { + api_models::payments::BankRedirectData::Przelewy24 { billing_details, .. } => Self::BankRedirect(Box::new(BankRedirectionPMData { payment_brand: PaymentBrand::Przelewy, @@ -258,7 +257,7 @@ impl merchant_transaction_id: None, customer_email: billing_details.email.to_owned(), })), - domain::BankRedirectData::Interac { email, country } => { + api_models::payments::BankRedirectData::Interac { email, country } => { Self::BankRedirect(Box::new(BankRedirectionPMData { payment_brand: PaymentBrand::InteracOnline, bank_account_country: Some(country.to_owned()), @@ -271,7 +270,7 @@ impl customer_email: Some(email.to_owned()), })) } - domain::BankRedirectData::Trustly { country } => { + api_models::payments::BankRedirectData::Trustly { country } => { Self::BankRedirect(Box::new(BankRedirectionPMData { payment_brand: PaymentBrand::Trustly, bank_account_country: None, @@ -286,16 +285,16 @@ impl customer_email: None, })) } - domain::BankRedirectData::Bizum { .. } - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } - | domain::BankRedirectData::OpenBankingUk { .. } => Err( + api_models::payments::BankRedirectData::Bizum { .. } + | api_models::payments::BankRedirectData::Blik { .. } + | api_models::payments::BankRedirectData::BancontactCard { .. } + | api_models::payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | api_models::payments::BankRedirectData::OnlineBankingFinland { .. } + | api_models::payments::BankRedirectData::OnlineBankingFpx { .. } + | api_models::payments::BankRedirectData::OnlineBankingPoland { .. } + | api_models::payments::BankRedirectData::OnlineBankingSlovakia { .. } + | api_models::payments::BankRedirectData::OnlineBankingThailand { .. } + | api_models::payments::BankRedirectData::OpenBankingUk { .. } => Err( errors::ConnectorError::NotImplemented("Payment method".to_string()), )?, }; @@ -303,14 +302,14 @@ impl } } -impl TryFrom<(domain::payments::Card, Option>)> for PaymentDetails { +impl TryFrom for PaymentDetails { type Error = Error; - fn try_from( - (card_data, card_holder_name): (domain::payments::Card, Option>), - ) -> Result { + fn try_from(card_data: api_models::payments::Card) -> Result { Ok(Self::AciCard(Box::new(CardDetails { card_number: card_data.card_number, - card_holder: card_holder_name.unwrap_or(Secret::new("".to_string())), + card_holder: card_data + .card_holder_name + .unwrap_or(Secret::new("".to_string())), card_expiry_month: card_data.card_exp_month, card_expiry_year: card_data.card_exp_year, card_cvv: card_data.card_cvc, @@ -325,7 +324,7 @@ pub struct BankRedirectionPMData { #[serde(rename = "bankAccount.country")] bank_account_country: Option, #[serde(rename = "bankAccount.bankName")] - bank_account_bank_name: Option, + bank_account_bank_name: Option, #[serde(rename = "bankAccount.bic")] bank_account_bic: Option>, #[serde(rename = "bankAccount.iban")] @@ -442,17 +441,15 @@ impl TryFrom<&AciRouterData<&types::PaymentsAuthorizeRouterData>> for AciPayment item: &AciRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ref card_data) => Self::try_from((item, card_data)), - domain::PaymentMethodData::Wallet(ref wallet_data) => { - Self::try_from((item, wallet_data)) - } - domain::PaymentMethodData::PayLater(ref pay_later_data) => { + api::PaymentMethodData::Card(ref card_data) => Self::try_from((item, card_data)), + api::PaymentMethodData::Wallet(ref wallet_data) => Self::try_from((item, wallet_data)), + api::PaymentMethodData::PayLater(ref pay_later_data) => { Self::try_from((item, pay_later_data)) } - domain::PaymentMethodData::BankRedirect(ref bank_redirect_data) => { + api::PaymentMethodData::BankRedirect(ref bank_redirect_data) => { Self::try_from((item, bank_redirect_data)) } - domain::PaymentMethodData::MandatePayment => { + api::PaymentMethodData::MandatePayment => { let mandate_id = item.router_data.request.mandate_id.clone().ok_or( errors::ConnectorError::MissingRequiredField { field_name: "mandate_id", @@ -460,19 +457,17 @@ impl TryFrom<&AciRouterData<&types::PaymentsAuthorizeRouterData>> for AciPayment )?; Self::try_from((item, mandate_id)) } - domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Aci"), - ))? - } + api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Reward + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Aci"), + ))?, } } } @@ -480,19 +475,19 @@ impl TryFrom<&AciRouterData<&types::PaymentsAuthorizeRouterData>> for AciPayment impl TryFrom<( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &api_models::payments::WalletData, )> for AciPaymentsRequest { type Error = Error; fn try_from( value: ( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &api_models::payments::WalletData, ), ) -> Result { let (item, wallet_data) = value; let txn_details = get_transaction_details(item)?; - let payment_method = PaymentDetails::try_from((wallet_data, item.router_data))?; + let payment_method = PaymentDetails::try_from(wallet_data)?; Ok(Self { txn_details, @@ -506,14 +501,14 @@ impl impl TryFrom<( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankRedirectData, + &api_models::payments::BankRedirectData, )> for AciPaymentsRequest { type Error = Error; fn try_from( value: ( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankRedirectData, + &api_models::payments::BankRedirectData, ), ) -> Result { let (item, bank_redirect_data) = value; @@ -532,14 +527,14 @@ impl impl TryFrom<( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::payments::PayLaterData, + &api_models::payments::PayLaterData, )> for AciPaymentsRequest { type Error = Error; fn try_from( value: ( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::payments::PayLaterData, + &api_models::payments::PayLaterData, ), ) -> Result { let (item, _pay_later_data) = value; @@ -558,20 +553,19 @@ impl impl TryFrom<( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, + &api::Card, )> for AciPaymentsRequest { type Error = Error; fn try_from( value: ( &AciRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, + &api::Card, ), ) -> Result { let (item, card_data) = value; - let card_holder_name = item.router_data.get_optional_billing_full_name(); let txn_details = get_transaction_details(item)?; - let payment_method = PaymentDetails::try_from((card_data.clone(), card_holder_name))?; + let payment_method = PaymentDetails::try_from(card_data.clone())?; let instruction = get_instruction_details(item); Ok(Self { diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs index 85e650390f8..44e889ed9db 100644 --- a/crates/router/src/connector/adyen.rs +++ b/crates/router/src/connector/adyen.rs @@ -106,7 +106,6 @@ impl ConnectorValidation for Adyen { | PaymentMethodType::PayBright | PaymentMethodType::Sepa | PaymentMethodType::Vipps - | PaymentMethodType::Venmo | PaymentMethodType::Paypal => match capture_method { enums::CaptureMethod::Automatic | enums::CaptureMethod::Manual @@ -203,7 +202,6 @@ impl ConnectorValidation for Adyen { | PaymentMethodType::Becs | PaymentMethodType::ClassicReward | PaymentMethodType::Pse - | PaymentMethodType::LocalBankTransfer | PaymentMethodType::Efecty | PaymentMethodType::PagoEfectivo | PaymentMethodType::RedCompra diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index 6dfe899f2d1..b301be7f577 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -12,7 +12,7 @@ use time::{Duration, OffsetDateTime, PrimitiveDateTime}; use crate::{ connector::utils::{ self, AddressDetailsData, BrowserInformationData, CardData, MandateReferenceData, - PaymentsAuthorizeRequestData, PhoneDetailsData, RouterData, + PaymentsAuthorizeRequestData, RouterData, }, consts, core::errors, @@ -20,8 +20,7 @@ use crate::{ services, types::{ self, - api::enums as api_enums, - domain, + api::{self, enums as api_enums}, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, PaymentsAuthorizeData, @@ -734,25 +733,25 @@ pub enum OnlineBankingCzechRepublicBanks { C, } -impl TryFrom<&types::PaymentsAuthorizeRouterData> for JCSVoucherData { +impl TryFrom<&Box> for JCSVoucherData { type Error = Error; - fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { + fn try_from(jcs_data: &Box) -> Result { Ok(Self { - first_name: item.get_billing_first_name()?, - last_name: item.get_optional_billing_last_name(), - shopper_email: item.get_billing_email()?, - telephone_number: item.get_billing_phone_number()?, + first_name: jcs_data.first_name.clone(), + last_name: jcs_data.last_name.clone(), + shopper_email: jcs_data.email.clone(), + telephone_number: Secret::new(jcs_data.phone_number.clone()), }) } } -impl TryFrom<&common_enums::BankNames> for OnlineBankingCzechRepublicBanks { +impl TryFrom<&api_enums::BankNames> for OnlineBankingCzechRepublicBanks { type Error = Error; - fn try_from(bank_name: &common_enums::BankNames) -> Result { + fn try_from(bank_name: &api_enums::BankNames) -> Result { match bank_name { - common_enums::BankNames::KomercniBanka => Ok(Self::KB), - common_enums::BankNames::CeskaSporitelna => Ok(Self::CS), - common_enums::BankNames::PlatnoscOnlineKartaPlatnicza => Ok(Self::C), + api::enums::BankNames::KomercniBanka => Ok(Self::KB), + api::enums::BankNames::CeskaSporitelna => Ok(Self::CS), + api::enums::BankNames::PlatnoscOnlineKartaPlatnicza => Ok(Self::C), _ => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ))?, @@ -809,29 +808,29 @@ pub enum OnlineBankingPolandBanks { ETransferPocztowy24, } -impl TryFrom<&common_enums::BankNames> for OnlineBankingPolandBanks { +impl TryFrom<&api_enums::BankNames> for OnlineBankingPolandBanks { type Error = Error; - fn try_from(bank_name: &common_enums::BankNames) -> Result { + fn try_from(bank_name: &api_enums::BankNames) -> Result { match bank_name { - common_enums::BankNames::BlikPSP => Ok(Self::BlikPSP), - common_enums::BankNames::PlaceZIPKO => Ok(Self::PlaceZIPKO), - common_enums::BankNames::MBank => Ok(Self::MBank), - common_enums::BankNames::PayWithING => Ok(Self::PayWithING), - common_enums::BankNames::SantanderPrzelew24 => Ok(Self::SantanderPrzelew24), - common_enums::BankNames::BankPEKAOSA => Ok(Self::BankPEKAOSA), - common_enums::BankNames::BankMillennium => Ok(Self::BankMillennium), - common_enums::BankNames::PayWithAliorBank => Ok(Self::PayWithAliorBank), - common_enums::BankNames::BankiSpoldzielcze => Ok(Self::BankiSpoldzielcze), - common_enums::BankNames::PayWithInteligo => Ok(Self::PayWithInteligo), - common_enums::BankNames::BNPParibasPoland => Ok(Self::BNPParibasPoland), - common_enums::BankNames::BankNowySA => Ok(Self::BankNowySA), - common_enums::BankNames::CreditAgricole => Ok(Self::CreditAgricole), - common_enums::BankNames::PayWithBOS => Ok(Self::PayWithBOS), - common_enums::BankNames::PayWithCitiHandlowy => Ok(Self::PayWithCitiHandlowy), - common_enums::BankNames::PayWithPlusBank => Ok(Self::PayWithPlusBank), - common_enums::BankNames::ToyotaBank => Ok(Self::ToyotaBank), - common_enums::BankNames::VeloBank => Ok(Self::VeloBank), - common_enums::BankNames::ETransferPocztowy24 => Ok(Self::ETransferPocztowy24), + api_models::enums::BankNames::BlikPSP => Ok(Self::BlikPSP), + api_models::enums::BankNames::PlaceZIPKO => Ok(Self::PlaceZIPKO), + api_models::enums::BankNames::MBank => Ok(Self::MBank), + api_models::enums::BankNames::PayWithING => Ok(Self::PayWithING), + api_models::enums::BankNames::SantanderPrzelew24 => Ok(Self::SantanderPrzelew24), + api_models::enums::BankNames::BankPEKAOSA => Ok(Self::BankPEKAOSA), + api_models::enums::BankNames::BankMillennium => Ok(Self::BankMillennium), + api_models::enums::BankNames::PayWithAliorBank => Ok(Self::PayWithAliorBank), + api_models::enums::BankNames::BankiSpoldzielcze => Ok(Self::BankiSpoldzielcze), + api_models::enums::BankNames::PayWithInteligo => Ok(Self::PayWithInteligo), + api_models::enums::BankNames::BNPParibasPoland => Ok(Self::BNPParibasPoland), + api_models::enums::BankNames::BankNowySA => Ok(Self::BankNowySA), + api_models::enums::BankNames::CreditAgricole => Ok(Self::CreditAgricole), + api_models::enums::BankNames::PayWithBOS => Ok(Self::PayWithBOS), + api_models::enums::BankNames::PayWithCitiHandlowy => Ok(Self::PayWithCitiHandlowy), + api_models::enums::BankNames::PayWithPlusBank => Ok(Self::PayWithPlusBank), + api_models::enums::BankNames::ToyotaBank => Ok(Self::ToyotaBank), + api_models::enums::BankNames::VeloBank => Ok(Self::VeloBank), + api_models::enums::BankNames::ETransferPocztowy24 => Ok(Self::ETransferPocztowy24), _ => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ))?, @@ -874,15 +873,15 @@ pub enum OnlineBankingSlovakiaBanks { Viamo, } -impl TryFrom<&common_enums::BankNames> for OnlineBankingSlovakiaBanks { +impl TryFrom<&api_enums::BankNames> for OnlineBankingSlovakiaBanks { type Error = Error; - fn try_from(bank_name: &common_enums::BankNames) -> Result { + fn try_from(bank_name: &api_enums::BankNames) -> Result { match bank_name { - common_enums::BankNames::EPlatbyVUB => Ok(Self::Vub), - common_enums::BankNames::PostovaBanka => Ok(Self::Posto), - common_enums::BankNames::SporoPay => Ok(Self::Sporo), - common_enums::BankNames::TatraPay => Ok(Self::Tatra), - common_enums::BankNames::Viamo => Ok(Self::Viamo), + api::enums::BankNames::EPlatbyVUB => Ok(Self::Vub), + api::enums::BankNames::PostovaBanka => Ok(Self::Posto), + api::enums::BankNames::SporoPay => Ok(Self::Sporo), + api::enums::BankNames::TatraPay => Ok(Self::Tatra), + api::enums::BankNames::Viamo => Ok(Self::Viamo), _ => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ))?, @@ -890,28 +889,28 @@ impl TryFrom<&common_enums::BankNames> for OnlineBankingSlovakiaBanks { } } -impl TryFrom<&common_enums::BankNames> for OnlineBankingFpxIssuer { +impl TryFrom<&api_enums::BankNames> for OnlineBankingFpxIssuer { type Error = Error; - fn try_from(bank_name: &common_enums::BankNames) -> Result { + fn try_from(bank_name: &api_enums::BankNames) -> Result { match bank_name { - common_enums::BankNames::AffinBank => Ok(Self::FpxAbb), - common_enums::BankNames::AgroBank => Ok(Self::FpxAgrobank), - common_enums::BankNames::AllianceBank => Ok(Self::FpxAbmb), - common_enums::BankNames::AmBank => Ok(Self::FpxAmb), - common_enums::BankNames::BankIslam => Ok(Self::FpxBimb), - common_enums::BankNames::BankMuamalat => Ok(Self::FpxBmmb), - common_enums::BankNames::BankRakyat => Ok(Self::FpxBkrm), - common_enums::BankNames::BankSimpananNasional => Ok(Self::FpxBsn), - common_enums::BankNames::CimbBank => Ok(Self::FpxCimbclicks), - common_enums::BankNames::HongLeongBank => Ok(Self::FpxHlb), - common_enums::BankNames::HsbcBank => Ok(Self::FpxHsbc), - common_enums::BankNames::KuwaitFinanceHouse => Ok(Self::FpxKfh), - common_enums::BankNames::Maybank => Ok(Self::FpxMb2u), - common_enums::BankNames::OcbcBank => Ok(Self::FpxOcbc), - common_enums::BankNames::PublicBank => Ok(Self::FpxPbb), - common_enums::BankNames::RhbBank => Ok(Self::FpxRhb), - common_enums::BankNames::StandardCharteredBank => Ok(Self::FpxScb), - common_enums::BankNames::UobBank => Ok(Self::FpxUob), + api::enums::BankNames::AffinBank => Ok(Self::FpxAbb), + api::enums::BankNames::AgroBank => Ok(Self::FpxAgrobank), + api::enums::BankNames::AllianceBank => Ok(Self::FpxAbmb), + api::enums::BankNames::AmBank => Ok(Self::FpxAmb), + api::enums::BankNames::BankIslam => Ok(Self::FpxBimb), + api::enums::BankNames::BankMuamalat => Ok(Self::FpxBmmb), + api::enums::BankNames::BankRakyat => Ok(Self::FpxBkrm), + api::enums::BankNames::BankSimpananNasional => Ok(Self::FpxBsn), + api::enums::BankNames::CimbBank => Ok(Self::FpxCimbclicks), + api::enums::BankNames::HongLeongBank => Ok(Self::FpxHlb), + api::enums::BankNames::HsbcBank => Ok(Self::FpxHsbc), + api::enums::BankNames::KuwaitFinanceHouse => Ok(Self::FpxKfh), + api::enums::BankNames::Maybank => Ok(Self::FpxMb2u), + api::enums::BankNames::OcbcBank => Ok(Self::FpxOcbc), + api::enums::BankNames::PublicBank => Ok(Self::FpxPbb), + api::enums::BankNames::RhbBank => Ok(Self::FpxRhb), + api::enums::BankNames::StandardCharteredBank => Ok(Self::FpxScb), + api::enums::BankNames::UobBank => Ok(Self::FpxUob), _ => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ))?, @@ -919,15 +918,15 @@ impl TryFrom<&common_enums::BankNames> for OnlineBankingFpxIssuer { } } -impl TryFrom<&common_enums::BankNames> for OnlineBankingThailandIssuer { +impl TryFrom<&api_enums::BankNames> for OnlineBankingThailandIssuer { type Error = Error; - fn try_from(bank_name: &common_enums::BankNames) -> Result { + fn try_from(bank_name: &api_enums::BankNames) -> Result { match bank_name { - common_enums::BankNames::BangkokBank => Ok(Self::Bangkokbank), - common_enums::BankNames::KrungsriBank => Ok(Self::Krungsribank), - common_enums::BankNames::KrungThaiBank => Ok(Self::Krungthaibank), - common_enums::BankNames::TheSiamCommercialBank => Ok(Self::Siamcommercialbank), - common_enums::BankNames::KasikornBank => Ok(Self::Kbank), + api::enums::BankNames::BangkokBank => Ok(Self::Bangkokbank), + api::enums::BankNames::KrungsriBank => Ok(Self::Krungsribank), + api::enums::BankNames::KrungThaiBank => Ok(Self::Krungthaibank), + api::enums::BankNames::TheSiamCommercialBank => Ok(Self::Siamcommercialbank), + api::enums::BankNames::KasikornBank => Ok(Self::Kbank), _ => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ))?, @@ -935,159 +934,157 @@ impl TryFrom<&common_enums::BankNames> for OnlineBankingThailandIssuer { } } -impl TryFrom<&common_enums::BankNames> for OpenBankingUKIssuer { +impl TryFrom<&api_enums::BankNames> for OpenBankingUKIssuer { type Error = Error; - fn try_from(bank_name: &common_enums::BankNames) -> Result { + fn try_from(bank_name: &api_enums::BankNames) -> Result { match bank_name { - common_enums::BankNames::OpenBankSuccess => Ok(Self::RedirectSuccess), - common_enums::BankNames::OpenBankFailure => Ok(Self::RedirectFailure), - common_enums::BankNames::OpenBankCancelled => Ok(Self::RedirectCancelled), - common_enums::BankNames::Aib => Ok(Self::Aib), - common_enums::BankNames::BankOfScotland => Ok(Self::BankOfScotland), - common_enums::BankNames::Barclays => Ok(Self::Barclays), - common_enums::BankNames::DanskeBank => Ok(Self::DanskeBank), - common_enums::BankNames::FirstDirect => Ok(Self::FirstDirect), - common_enums::BankNames::FirstTrust => Ok(Self::FirstTrust), - common_enums::BankNames::HsbcBank => Ok(Self::HsbcBank), - common_enums::BankNames::Halifax => Ok(Self::Halifax), - common_enums::BankNames::Lloyds => Ok(Self::Lloyds), - common_enums::BankNames::Monzo => Ok(Self::Monzo), - common_enums::BankNames::NatWest => Ok(Self::NatWest), - common_enums::BankNames::NationwideBank => Ok(Self::NationwideBank), - common_enums::BankNames::Revolut => Ok(Self::Revolut), - common_enums::BankNames::RoyalBankOfScotland => Ok(Self::RoyalBankOfScotland), - common_enums::BankNames::SantanderPrzelew24 => Ok(Self::SantanderPrzelew24), - common_enums::BankNames::Starling => Ok(Self::Starling), - common_enums::BankNames::TsbBank => Ok(Self::TsbBank), - common_enums::BankNames::TescoBank => Ok(Self::TescoBank), - common_enums::BankNames::UlsterBank => Ok(Self::UlsterBank), - common_enums::BankNames::AmericanExpress - | common_enums::BankNames::AffinBank - | common_enums::BankNames::AgroBank - | common_enums::BankNames::AllianceBank - | common_enums::BankNames::AmBank - | common_enums::BankNames::BankOfAmerica - | common_enums::BankNames::BankIslam - | common_enums::BankNames::BankMuamalat - | common_enums::BankNames::BankRakyat - | common_enums::BankNames::BankSimpananNasional - | common_enums::BankNames::BlikPSP - | common_enums::BankNames::CapitalOne - | common_enums::BankNames::Chase - | common_enums::BankNames::Citi - | common_enums::BankNames::CimbBank - | common_enums::BankNames::Discover - | common_enums::BankNames::NavyFederalCreditUnion - | common_enums::BankNames::PentagonFederalCreditUnion - | common_enums::BankNames::SynchronyBank - | common_enums::BankNames::WellsFargo - | common_enums::BankNames::AbnAmro - | common_enums::BankNames::AsnBank - | common_enums::BankNames::Bunq - | common_enums::BankNames::Handelsbanken - | common_enums::BankNames::HongLeongBank - | common_enums::BankNames::Ing - | common_enums::BankNames::Knab - | common_enums::BankNames::KuwaitFinanceHouse - | common_enums::BankNames::Moneyou - | common_enums::BankNames::Rabobank - | common_enums::BankNames::Regiobank - | common_enums::BankNames::SnsBank - | common_enums::BankNames::TriodosBank - | common_enums::BankNames::VanLanschot - | common_enums::BankNames::ArzteUndApothekerBank - | common_enums::BankNames::AustrianAnadiBankAg - | common_enums::BankNames::BankAustria - | common_enums::BankNames::Bank99Ag - | common_enums::BankNames::BankhausCarlSpangler - | common_enums::BankNames::BankhausSchelhammerUndSchatteraAg - | common_enums::BankNames::BankMillennium - | common_enums::BankNames::BankPEKAOSA - | common_enums::BankNames::BawagPskAg - | common_enums::BankNames::BksBankAg - | common_enums::BankNames::BrullKallmusBankAg - | common_enums::BankNames::BtvVierLanderBank - | common_enums::BankNames::CapitalBankGraweGruppeAg - | common_enums::BankNames::CeskaSporitelna - | common_enums::BankNames::Dolomitenbank - | common_enums::BankNames::EasybankAg - | common_enums::BankNames::EPlatbyVUB - | common_enums::BankNames::ErsteBankUndSparkassen - | common_enums::BankNames::FrieslandBank - | common_enums::BankNames::HypoAlpeadriabankInternationalAg - | common_enums::BankNames::HypoNoeLbFurNiederosterreichUWien - | common_enums::BankNames::HypoOberosterreichSalzburgSteiermark - | common_enums::BankNames::HypoTirolBankAg - | common_enums::BankNames::HypoVorarlbergBankAg - | common_enums::BankNames::HypoBankBurgenlandAktiengesellschaft - | common_enums::BankNames::KomercniBanka - | common_enums::BankNames::MBank - | common_enums::BankNames::MarchfelderBank - | common_enums::BankNames::Maybank - | common_enums::BankNames::OberbankAg - | common_enums::BankNames::OsterreichischeArzteUndApothekerbank - | common_enums::BankNames::OcbcBank - | common_enums::BankNames::PayWithING - | common_enums::BankNames::PlaceZIPKO - | common_enums::BankNames::PlatnoscOnlineKartaPlatnicza - | common_enums::BankNames::PosojilnicaBankEGen - | common_enums::BankNames::PostovaBanka - | common_enums::BankNames::PublicBank - | common_enums::BankNames::RaiffeisenBankengruppeOsterreich - | common_enums::BankNames::RhbBank - | common_enums::BankNames::SchelhammerCapitalBankAg - | common_enums::BankNames::StandardCharteredBank - | common_enums::BankNames::SchoellerbankAg - | common_enums::BankNames::SpardaBankWien - | common_enums::BankNames::SporoPay - | common_enums::BankNames::TatraPay - | common_enums::BankNames::Viamo - | common_enums::BankNames::VolksbankGruppe - | common_enums::BankNames::VolkskreditbankAg - | common_enums::BankNames::VrBankBraunau - | common_enums::BankNames::UobBank - | common_enums::BankNames::PayWithAliorBank - | common_enums::BankNames::BankiSpoldzielcze - | common_enums::BankNames::PayWithInteligo - | common_enums::BankNames::BNPParibasPoland - | common_enums::BankNames::BankNowySA - | common_enums::BankNames::CreditAgricole - | common_enums::BankNames::PayWithBOS - | common_enums::BankNames::PayWithCitiHandlowy - | common_enums::BankNames::PayWithPlusBank - | common_enums::BankNames::ToyotaBank - | common_enums::BankNames::VeloBank - | common_enums::BankNames::ETransferPocztowy24 - | common_enums::BankNames::PlusBank - | common_enums::BankNames::EtransferPocztowy24 - | common_enums::BankNames::BankiSpbdzielcze - | common_enums::BankNames::BankNowyBfgSa - | common_enums::BankNames::GetinBank - | common_enums::BankNames::Blik - | common_enums::BankNames::NoblePay - | common_enums::BankNames::IdeaBank - | common_enums::BankNames::EnveloBank - | common_enums::BankNames::NestPrzelew - | common_enums::BankNames::MbankMtransfer - | common_enums::BankNames::Inteligo - | common_enums::BankNames::PbacZIpko - | common_enums::BankNames::BnpParibas - | common_enums::BankNames::BankPekaoSa - | common_enums::BankNames::VolkswagenBank - | common_enums::BankNames::AliorBank - | common_enums::BankNames::Boz - | common_enums::BankNames::BangkokBank - | common_enums::BankNames::KrungsriBank - | common_enums::BankNames::KrungThaiBank - | common_enums::BankNames::TheSiamCommercialBank - | common_enums::BankNames::Yoursafe - | common_enums::BankNames::N26 - | common_enums::BankNames::NationaleNederlanden - | common_enums::BankNames::KasikornBank => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Adyen"), - ))? - } + api::enums::BankNames::OpenBankSuccess => Ok(Self::RedirectSuccess), + api::enums::BankNames::OpenBankFailure => Ok(Self::RedirectFailure), + api::enums::BankNames::OpenBankCancelled => Ok(Self::RedirectCancelled), + api::enums::BankNames::Aib => Ok(Self::Aib), + api::enums::BankNames::BankOfScotland => Ok(Self::BankOfScotland), + api::enums::BankNames::Barclays => Ok(Self::Barclays), + api::enums::BankNames::DanskeBank => Ok(Self::DanskeBank), + api::enums::BankNames::FirstDirect => Ok(Self::FirstDirect), + api::enums::BankNames::FirstTrust => Ok(Self::FirstTrust), + api::enums::BankNames::HsbcBank => Ok(Self::HsbcBank), + api::enums::BankNames::Halifax => Ok(Self::Halifax), + api::enums::BankNames::Lloyds => Ok(Self::Lloyds), + api::enums::BankNames::Monzo => Ok(Self::Monzo), + api::enums::BankNames::NatWest => Ok(Self::NatWest), + api::enums::BankNames::NationwideBank => Ok(Self::NationwideBank), + api::enums::BankNames::Revolut => Ok(Self::Revolut), + api::enums::BankNames::RoyalBankOfScotland => Ok(Self::RoyalBankOfScotland), + api::enums::BankNames::SantanderPrzelew24 => Ok(Self::SantanderPrzelew24), + api::enums::BankNames::Starling => Ok(Self::Starling), + api::enums::BankNames::TsbBank => Ok(Self::TsbBank), + api::enums::BankNames::TescoBank => Ok(Self::TescoBank), + api::enums::BankNames::UlsterBank => Ok(Self::UlsterBank), + enums::BankNames::AmericanExpress + | enums::BankNames::AffinBank + | enums::BankNames::AgroBank + | enums::BankNames::AllianceBank + | enums::BankNames::AmBank + | enums::BankNames::BankOfAmerica + | enums::BankNames::BankIslam + | enums::BankNames::BankMuamalat + | enums::BankNames::BankRakyat + | enums::BankNames::BankSimpananNasional + | enums::BankNames::BlikPSP + | enums::BankNames::CapitalOne + | enums::BankNames::Chase + | enums::BankNames::Citi + | enums::BankNames::CimbBank + | enums::BankNames::Discover + | enums::BankNames::NavyFederalCreditUnion + | enums::BankNames::PentagonFederalCreditUnion + | enums::BankNames::SynchronyBank + | enums::BankNames::WellsFargo + | enums::BankNames::AbnAmro + | enums::BankNames::AsnBank + | enums::BankNames::Bunq + | enums::BankNames::Handelsbanken + | enums::BankNames::HongLeongBank + | enums::BankNames::Ing + | enums::BankNames::Knab + | enums::BankNames::KuwaitFinanceHouse + | enums::BankNames::Moneyou + | enums::BankNames::Rabobank + | enums::BankNames::Regiobank + | enums::BankNames::SnsBank + | enums::BankNames::TriodosBank + | enums::BankNames::VanLanschot + | enums::BankNames::ArzteUndApothekerBank + | enums::BankNames::AustrianAnadiBankAg + | enums::BankNames::BankAustria + | enums::BankNames::Bank99Ag + | enums::BankNames::BankhausCarlSpangler + | enums::BankNames::BankhausSchelhammerUndSchatteraAg + | enums::BankNames::BankMillennium + | enums::BankNames::BankPEKAOSA + | enums::BankNames::BawagPskAg + | enums::BankNames::BksBankAg + | enums::BankNames::BrullKallmusBankAg + | enums::BankNames::BtvVierLanderBank + | enums::BankNames::CapitalBankGraweGruppeAg + | enums::BankNames::CeskaSporitelna + | enums::BankNames::Dolomitenbank + | enums::BankNames::EasybankAg + | enums::BankNames::EPlatbyVUB + | enums::BankNames::ErsteBankUndSparkassen + | enums::BankNames::FrieslandBank + | enums::BankNames::HypoAlpeadriabankInternationalAg + | enums::BankNames::HypoNoeLbFurNiederosterreichUWien + | enums::BankNames::HypoOberosterreichSalzburgSteiermark + | enums::BankNames::HypoTirolBankAg + | enums::BankNames::HypoVorarlbergBankAg + | enums::BankNames::HypoBankBurgenlandAktiengesellschaft + | enums::BankNames::KomercniBanka + | enums::BankNames::MBank + | enums::BankNames::MarchfelderBank + | enums::BankNames::Maybank + | enums::BankNames::OberbankAg + | enums::BankNames::OsterreichischeArzteUndApothekerbank + | enums::BankNames::OcbcBank + | enums::BankNames::PayWithING + | enums::BankNames::PlaceZIPKO + | enums::BankNames::PlatnoscOnlineKartaPlatnicza + | enums::BankNames::PosojilnicaBankEGen + | enums::BankNames::PostovaBanka + | enums::BankNames::PublicBank + | enums::BankNames::RaiffeisenBankengruppeOsterreich + | enums::BankNames::RhbBank + | enums::BankNames::SchelhammerCapitalBankAg + | enums::BankNames::StandardCharteredBank + | enums::BankNames::SchoellerbankAg + | enums::BankNames::SpardaBankWien + | enums::BankNames::SporoPay + | enums::BankNames::TatraPay + | enums::BankNames::Viamo + | enums::BankNames::VolksbankGruppe + | enums::BankNames::VolkskreditbankAg + | enums::BankNames::VrBankBraunau + | enums::BankNames::UobBank + | enums::BankNames::PayWithAliorBank + | enums::BankNames::BankiSpoldzielcze + | enums::BankNames::PayWithInteligo + | enums::BankNames::BNPParibasPoland + | enums::BankNames::BankNowySA + | enums::BankNames::CreditAgricole + | enums::BankNames::PayWithBOS + | enums::BankNames::PayWithCitiHandlowy + | enums::BankNames::PayWithPlusBank + | enums::BankNames::ToyotaBank + | enums::BankNames::VeloBank + | enums::BankNames::ETransferPocztowy24 + | enums::BankNames::PlusBank + | enums::BankNames::EtransferPocztowy24 + | enums::BankNames::BankiSpbdzielcze + | enums::BankNames::BankNowyBfgSa + | enums::BankNames::GetinBank + | enums::BankNames::Blik + | enums::BankNames::NoblePay + | enums::BankNames::IdeaBank + | enums::BankNames::EnveloBank + | enums::BankNames::NestPrzelew + | enums::BankNames::MbankMtransfer + | enums::BankNames::Inteligo + | enums::BankNames::PbacZIpko + | enums::BankNames::BnpParibas + | enums::BankNames::BankPekaoSa + | enums::BankNames::VolkswagenBank + | enums::BankNames::AliorBank + | enums::BankNames::Boz + | enums::BankNames::BangkokBank + | enums::BankNames::KrungsriBank + | enums::BankNames::KrungThaiBank + | enums::BankNames::TheSiamCommercialBank + | enums::BankNames::Yoursafe + | enums::BankNames::N26 + | enums::BankNames::NationaleNederlanden + | enums::BankNames::KasikornBank => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Adyen"), + ))?, } } } @@ -1428,48 +1425,58 @@ pub enum OpenBankingUKIssuer { pub struct AdyenTestBankNames<'a>(&'a str); -impl<'a> TryFrom<&common_enums::BankNames> for AdyenTestBankNames<'a> { +impl<'a> TryFrom<&api_enums::BankNames> for AdyenTestBankNames<'a> { type Error = Error; - fn try_from(bank: &common_enums::BankNames) -> Result { + fn try_from(bank: &api_enums::BankNames) -> Result { Ok(match bank { - common_enums::BankNames::AbnAmro => Self("1121"), - common_enums::BankNames::AsnBank => Self("1151"), - common_enums::BankNames::Bunq => Self("1152"), - common_enums::BankNames::Ing => Self("1154"), - common_enums::BankNames::Knab => Self("1155"), - common_enums::BankNames::N26 => Self("1156"), - common_enums::BankNames::NationaleNederlanden => Self("1157"), - common_enums::BankNames::Rabobank => Self("1157"), - common_enums::BankNames::Regiobank => Self("1158"), - common_enums::BankNames::Revolut => Self("1159"), - common_enums::BankNames::SnsBank => Self("1159"), - common_enums::BankNames::TriodosBank => Self("1159"), - common_enums::BankNames::VanLanschot => Self("1159"), - common_enums::BankNames::Yoursafe => Self("1159"), - common_enums::BankNames::BankAustria => Self("e6819e7a-f663-414b-92ec-cf7c82d2f4e5"), - common_enums::BankNames::BawagPskAg => Self("ba7199cc-f057-42f2-9856-2378abf21638"), - common_enums::BankNames::Dolomitenbank => Self("d5d5b133-1c0d-4c08-b2be-3c9b116dc326"), - common_enums::BankNames::EasybankAg => Self("eff103e6-843d-48b7-a6e6-fbd88f511b11"), - common_enums::BankNames::ErsteBankUndSparkassen => { + api_models::enums::BankNames::AbnAmro => Self("1121"), + api_models::enums::BankNames::AsnBank => Self("1151"), + api_models::enums::BankNames::Bunq => Self("1152"), + api_models::enums::BankNames::Ing => Self("1154"), + api_models::enums::BankNames::Knab => Self("1155"), + api_models::enums::BankNames::N26 => Self("1156"), + api_models::enums::BankNames::NationaleNederlanden => Self("1157"), + api_models::enums::BankNames::Rabobank => Self("1157"), + api_models::enums::BankNames::Regiobank => Self("1158"), + api_models::enums::BankNames::Revolut => Self("1159"), + api_models::enums::BankNames::SnsBank => Self("1159"), + api_models::enums::BankNames::TriodosBank => Self("1159"), + api_models::enums::BankNames::VanLanschot => Self("1159"), + api_models::enums::BankNames::Yoursafe => Self("1159"), + api_models::enums::BankNames::BankAustria => { + Self("e6819e7a-f663-414b-92ec-cf7c82d2f4e5") + } + api_models::enums::BankNames::BawagPskAg => { + Self("ba7199cc-f057-42f2-9856-2378abf21638") + } + api_models::enums::BankNames::Dolomitenbank => { + Self("d5d5b133-1c0d-4c08-b2be-3c9b116dc326") + } + api_models::enums::BankNames::EasybankAg => { + Self("eff103e6-843d-48b7-a6e6-fbd88f511b11") + } + api_models::enums::BankNames::ErsteBankUndSparkassen => { Self("3fdc41fc-3d3d-4ee3-a1fe-cd79cfd58ea3") } - common_enums::BankNames::HypoTirolBankAg => { + api_models::enums::BankNames::HypoTirolBankAg => { Self("6765e225-a0dc-4481-9666-e26303d4f221") } - common_enums::BankNames::PosojilnicaBankEGen => { + api_models::enums::BankNames::PosojilnicaBankEGen => { Self("65ef4682-4944-499f-828f-5d74ad288376") } - common_enums::BankNames::RaiffeisenBankengruppeOsterreich => { + api_models::enums::BankNames::RaiffeisenBankengruppeOsterreich => { Self("ee9fc487-ebe0-486c-8101-17dce5141a67") } - common_enums::BankNames::SchoellerbankAg => { + api_models::enums::BankNames::SchoellerbankAg => { Self("1190c4d1-b37a-487e-9355-e0a067f54a9f") } - common_enums::BankNames::SpardaBankWien => Self("8b0bfeea-fbb0-4337-b3a1-0e25c0f060fc"), - common_enums::BankNames::VolksbankGruppe => { + api_models::enums::BankNames::SpardaBankWien => { + Self("8b0bfeea-fbb0-4337-b3a1-0e25c0f060fc") + } + api_models::enums::BankNames::VolksbankGruppe => { Self("e2e97aaa-de4c-4e18-9431-d99790773433") } - common_enums::BankNames::VolkskreditbankAg => { + api_models::enums::BankNames::VolkskreditbankAg => { Self("4a0a975b-0594-4b40-9068-39f77b3a91f9") } _ => Err(errors::ConnectorError::NotImplemented( @@ -1481,24 +1488,24 @@ impl<'a> TryFrom<&common_enums::BankNames> for AdyenTestBankNames<'a> { pub struct AdyenBankNames<'a>(&'a str); -impl<'a> TryFrom<&common_enums::BankNames> for AdyenBankNames<'a> { +impl<'a> TryFrom<&api_enums::BankNames> for AdyenBankNames<'a> { type Error = Error; - fn try_from(bank: &common_enums::BankNames) -> Result { + fn try_from(bank: &api_enums::BankNames) -> Result { Ok(match bank { - common_enums::BankNames::AbnAmro => Self("0031"), - common_enums::BankNames::AsnBank => Self("0761"), - common_enums::BankNames::Bunq => Self("0802"), - common_enums::BankNames::Ing => Self("0721"), - common_enums::BankNames::Knab => Self("0801"), - common_enums::BankNames::N26 => Self("0807"), - common_enums::BankNames::NationaleNederlanden => Self("0808"), - common_enums::BankNames::Rabobank => Self("0021"), - common_enums::BankNames::Regiobank => Self("0771"), - common_enums::BankNames::Revolut => Self("0805"), - common_enums::BankNames::SnsBank => Self("0751"), - common_enums::BankNames::TriodosBank => Self("0511"), - common_enums::BankNames::VanLanschot => Self("0161"), - common_enums::BankNames::Yoursafe => Self("0806"), + api_models::enums::BankNames::AbnAmro => Self("0031"), + api_models::enums::BankNames::AsnBank => Self("0761"), + api_models::enums::BankNames::Bunq => Self("0802"), + api_models::enums::BankNames::Ing => Self("0721"), + api_models::enums::BankNames::Knab => Self("0801"), + api_models::enums::BankNames::N26 => Self("0807"), + api_models::enums::BankNames::NationaleNederlanden => Self("0808"), + api_models::enums::BankNames::Rabobank => Self("0021"), + api_models::enums::BankNames::Regiobank => Self("0771"), + api_models::enums::BankNames::Revolut => Self("0805"), + api_models::enums::BankNames::SnsBank => Self("0751"), + api_models::enums::BankNames::TriodosBank => Self("0511"), + api_models::enums::BankNames::VanLanschot => Self("0161"), + api_models::enums::BankNames::Yoursafe => Self("0806"), _ => Err(errors::ConnectorError::NotSupported { message: String::from("BankRedirect"), connector: "Adyen", @@ -1546,38 +1553,38 @@ impl<'a> TryFrom<&AdyenRouterData<&types::PaymentsAuthorizeRouterData>> { Some(mandate_ref) => AdyenPaymentRequest::try_from((item, mandate_ref)), None => match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref card) => { + api_models::payments::PaymentMethodData::Card(ref card) => { AdyenPaymentRequest::try_from((item, card)) } - domain::PaymentMethodData::Wallet(ref wallet) => { + api_models::payments::PaymentMethodData::Wallet(ref wallet) => { AdyenPaymentRequest::try_from((item, wallet)) } - domain::PaymentMethodData::PayLater(ref pay_later) => { + api_models::payments::PaymentMethodData::PayLater(ref pay_later) => { AdyenPaymentRequest::try_from((item, pay_later)) } - domain::PaymentMethodData::BankRedirect(ref bank_redirect) => { + api_models::payments::PaymentMethodData::BankRedirect(ref bank_redirect) => { AdyenPaymentRequest::try_from((item, bank_redirect)) } - domain::PaymentMethodData::BankDebit(ref bank_debit) => { + api_models::payments::PaymentMethodData::BankDebit(ref bank_debit) => { AdyenPaymentRequest::try_from((item, bank_debit)) } - domain::PaymentMethodData::BankTransfer(ref bank_transfer) => { + api_models::payments::PaymentMethodData::BankTransfer(ref bank_transfer) => { AdyenPaymentRequest::try_from((item, bank_transfer.as_ref())) } - domain::PaymentMethodData::CardRedirect(ref card_redirect_data) => { + api_models::payments::PaymentMethodData::CardRedirect(ref card_redirect_data) => { AdyenPaymentRequest::try_from((item, card_redirect_data)) } - domain::PaymentMethodData::Voucher(ref voucher_data) => { + api_models::payments::PaymentMethodData::Voucher(ref voucher_data) => { AdyenPaymentRequest::try_from((item, voucher_data)) } - domain::PaymentMethodData::GiftCard(ref gift_card_data) => { + api_models::payments::PaymentMethodData::GiftCard(ref gift_card_data) => { AdyenPaymentRequest::try_from((item, gift_card_data.as_ref())) } - domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ))? @@ -1591,9 +1598,9 @@ impl<'a> TryFrom<&types::PaymentsPreProcessingRouterData> for AdyenBalanceReques type Error = Error; fn try_from(item: &types::PaymentsPreProcessingRouterData) -> Result { let payment_method = match &item.request.payment_method_data { - Some(domain::PaymentMethodData::GiftCard(gift_card_data)) => { + Some(payments::PaymentMethodData::GiftCard(gift_card_data)) => { match gift_card_data.as_ref() { - domain::GiftCardData::Givex(gift_card_data) => { + payments::GiftCardData::Givex(gift_card_data) => { let balance_pm = BalancePmData { payment_type: GiftCardBrand::Givex, number: gift_card_data.number.clone(), @@ -1603,7 +1610,7 @@ impl<'a> TryFrom<&types::PaymentsPreProcessingRouterData> for AdyenBalanceReques balance_pm, ))) } - domain::GiftCardData::PaySafeCard {} => { + payments::GiftCardData::PaySafeCard {} => { Err(errors::ConnectorError::FlowNotSupported { flow: "Balance".to_string(), connector: "adyen".to_string(), @@ -1797,22 +1804,24 @@ fn get_country_code( address.and_then(|billing| billing.address.as_ref().and_then(|address| address.country)) } -fn get_social_security_number(voucher_data: &domain::VoucherData) -> Option> { +fn get_social_security_number( + voucher_data: &api_models::payments::VoucherData, +) -> Option> { match voucher_data { - domain::VoucherData::Boleto(boleto_data) => boleto_data.social_security_number.clone(), - domain::VoucherData::Alfamart { .. } - | domain::VoucherData::Indomaret { .. } - | domain::VoucherData::Efecty - | domain::VoucherData::PagoEfectivo - | domain::VoucherData::RedCompra - | domain::VoucherData::Oxxo - | domain::VoucherData::RedPagos - | domain::VoucherData::SevenEleven { .. } - | domain::VoucherData::Lawson { .. } - | domain::VoucherData::MiniStop { .. } - | domain::VoucherData::FamilyMart { .. } - | domain::VoucherData::Seicomart { .. } - | domain::VoucherData::PayEasy { .. } => None, + payments::VoucherData::Boleto(boleto_data) => boleto_data.social_security_number.clone(), + payments::VoucherData::Alfamart { .. } + | payments::VoucherData::Indomaret { .. } + | payments::VoucherData::Efecty + | payments::VoucherData::PagoEfectivo + | payments::VoucherData::RedCompra + | payments::VoucherData::Oxxo + | payments::VoucherData::RedPagos + | payments::VoucherData::SevenEleven { .. } + | payments::VoucherData::Lawson { .. } + | payments::VoucherData::MiniStop { .. } + | payments::VoucherData::FamilyMart { .. } + | payments::VoucherData::Seicomart { .. } + | payments::VoucherData::PayEasy { .. } => None, } } @@ -1822,11 +1831,13 @@ fn build_shopper_reference(customer_id: &Option, merchant_id: String) -> .map(|c_id| format!("{}_{}", merchant_id, c_id)) } -impl<'a> TryFrom<&domain::BankDebitData> for AdyenPaymentMethod<'a> { +impl<'a> TryFrom<&api_models::payments::BankDebitData> for AdyenPaymentMethod<'a> { type Error = Error; - fn try_from(bank_debit_data: &domain::BankDebitData) -> Result { + fn try_from( + bank_debit_data: &api_models::payments::BankDebitData, + ) -> Result { match bank_debit_data { - domain::BankDebitData::AchBankDebit { + payments::BankDebitData::AchBankDebit { account_number, routing_number, card_holder_name, @@ -1843,7 +1854,7 @@ impl<'a> TryFrom<&domain::BankDebitData> for AdyenPaymentMethod<'a> { )?, }, ))), - domain::BankDebitData::SepaBankDebit { + payments::BankDebitData::SepaBankDebit { iban, bank_account_holder_name, .. @@ -1857,7 +1868,7 @@ impl<'a> TryFrom<&domain::BankDebitData> for AdyenPaymentMethod<'a> { iban_number: iban.clone(), }, ))), - domain::BankDebitData::BacsBankDebit { + payments::BankDebitData::BacsBankDebit { account_number, sort_code, bank_account_holder_name, @@ -1874,7 +1885,7 @@ impl<'a> TryFrom<&domain::BankDebitData> for AdyenPaymentMethod<'a> { )?, }, ))), - domain::BankDebitData::BecsBankDebit { .. } => { + payments::BankDebitData::BecsBankDebit { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ) @@ -1884,46 +1895,48 @@ impl<'a> TryFrom<&domain::BankDebitData> for AdyenPaymentMethod<'a> { } } -impl<'a> TryFrom<(&domain::VoucherData, &types::PaymentsAuthorizeRouterData)> - for AdyenPaymentMethod<'a> -{ +impl<'a> TryFrom<&api_models::payments::VoucherData> for AdyenPaymentMethod<'a> { type Error = Error; - fn try_from( - (voucher_data, item): (&domain::VoucherData, &types::PaymentsAuthorizeRouterData), - ) -> Result { + fn try_from(voucher_data: &api_models::payments::VoucherData) -> Result { match voucher_data { - domain::VoucherData::Boleto { .. } => Ok(AdyenPaymentMethod::BoletoBancario), - domain::VoucherData::Alfamart(_) => Ok(AdyenPaymentMethod::Alfamart(Box::new( - DokuBankData::try_from(item)?, - ))), - - domain::VoucherData::Indomaret(_) => Ok(AdyenPaymentMethod::Indomaret(Box::new( - DokuBankData::try_from(item)?, - ))), - - domain::VoucherData::Oxxo => Ok(AdyenPaymentMethod::Oxxo), - domain::VoucherData::SevenEleven(_) => Ok(AdyenPaymentMethod::SevenEleven(Box::new( - JCSVoucherData::try_from(item)?, - ))), - domain::VoucherData::Lawson(_) => Ok(AdyenPaymentMethod::Lawson(Box::new( - JCSVoucherData::try_from(item)?, - ))), - domain::VoucherData::MiniStop(_) => Ok(AdyenPaymentMethod::MiniStop(Box::new( - JCSVoucherData::try_from(item)?, - ))), - domain::VoucherData::FamilyMart(_) => Ok(AdyenPaymentMethod::FamilyMart(Box::new( - JCSVoucherData::try_from(item)?, - ))), - domain::VoucherData::Seicomart(_) => Ok(AdyenPaymentMethod::Seicomart(Box::new( - JCSVoucherData::try_from(item)?, + payments::VoucherData::Boleto { .. } => Ok(AdyenPaymentMethod::BoletoBancario), + payments::VoucherData::Alfamart(alfarmart_data) => { + Ok(AdyenPaymentMethod::Alfamart(Box::new(DokuBankData { + first_name: alfarmart_data.first_name.clone(), + last_name: alfarmart_data.last_name.clone(), + shopper_email: alfarmart_data.email.clone(), + }))) + } + payments::VoucherData::Indomaret(indomaret_data) => { + Ok(AdyenPaymentMethod::Indomaret(Box::new(DokuBankData { + first_name: indomaret_data.first_name.clone(), + last_name: indomaret_data.last_name.clone(), + shopper_email: indomaret_data.email.clone(), + }))) + } + payments::VoucherData::Oxxo => Ok(AdyenPaymentMethod::Oxxo), + payments::VoucherData::SevenEleven(jcs_data) => Ok(AdyenPaymentMethod::SevenEleven( + Box::new(JCSVoucherData::try_from(jcs_data)?), + )), + payments::VoucherData::Lawson(jcs_data) => Ok(AdyenPaymentMethod::Lawson(Box::new( + JCSVoucherData::try_from(jcs_data)?, ))), - domain::VoucherData::PayEasy(_) => Ok(AdyenPaymentMethod::PayEasy(Box::new( - JCSVoucherData::try_from(item)?, + payments::VoucherData::MiniStop(jcs_data) => Ok(AdyenPaymentMethod::MiniStop( + Box::new(JCSVoucherData::try_from(jcs_data)?), + )), + payments::VoucherData::FamilyMart(jcs_data) => Ok(AdyenPaymentMethod::FamilyMart( + Box::new(JCSVoucherData::try_from(jcs_data)?), + )), + payments::VoucherData::Seicomart(jcs_data) => Ok(AdyenPaymentMethod::Seicomart( + Box::new(JCSVoucherData::try_from(jcs_data)?), + )), + payments::VoucherData::PayEasy(jcs_data) => Ok(AdyenPaymentMethod::PayEasy(Box::new( + JCSVoucherData::try_from(jcs_data)?, ))), - domain::VoucherData::Efecty - | domain::VoucherData::PagoEfectivo - | domain::VoucherData::RedCompra - | domain::VoucherData::RedPagos => Err(errors::ConnectorError::NotImplemented( + payments::VoucherData::Efecty + | payments::VoucherData::PagoEfectivo + | payments::VoucherData::RedCompra + | payments::VoucherData::RedPagos => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ) .into()), @@ -1931,12 +1944,12 @@ impl<'a> TryFrom<(&domain::VoucherData, &types::PaymentsAuthorizeRouterData)> } } -impl<'a> TryFrom<&domain::GiftCardData> for AdyenPaymentMethod<'a> { +impl<'a> TryFrom<&api_models::payments::GiftCardData> for AdyenPaymentMethod<'a> { type Error = Error; - fn try_from(gift_card_data: &domain::GiftCardData) -> Result { + fn try_from(gift_card_data: &api_models::payments::GiftCardData) -> Result { match gift_card_data { - domain::GiftCardData::PaySafeCard {} => Ok(AdyenPaymentMethod::PaySafeCard), - domain::GiftCardData::Givex(givex_data) => { + payments::GiftCardData::PaySafeCard {} => Ok(AdyenPaymentMethod::PaySafeCard), + payments::GiftCardData::Givex(givex_data) => { let gift_card_pm = GiftCardData { payment_type: PaymentType::Giftcard, brand: GiftCardBrand::Givex, @@ -1949,18 +1962,16 @@ impl<'a> TryFrom<&domain::GiftCardData> for AdyenPaymentMethod<'a> { } } -impl<'a> TryFrom<(&domain::Card, Option>)> for AdyenPaymentMethod<'a> { +impl<'a> TryFrom<&api::Card> for AdyenPaymentMethod<'a> { type Error = Error; - fn try_from( - (card, card_holder_name): (&domain::Card, Option>), - ) -> Result { + fn try_from(card: &api::Card) -> Result { let adyen_card = AdyenCard { payment_type: PaymentType::Scheme, number: card.card_number.clone(), expiry_month: card.card_exp_month.clone(), expiry_year: card.get_expiry_year_4_digit(), cvc: Some(card.card_cvc.clone()), - holder_name: card_holder_name, + holder_name: card.card_holder_name.clone(), brand: None, network_payment_reference: None, }; @@ -2021,23 +2032,18 @@ impl TryFrom<&utils::CardIssuer> for CardBrand { } } -impl<'a> TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)> - for AdyenPaymentMethod<'a> -{ +impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> { type Error = Error; - fn try_from( - value: (&domain::WalletData, &types::PaymentsAuthorizeRouterData), - ) -> Result { - let (wallet_data, item) = value; + fn try_from(wallet_data: &api::WalletData) -> Result { match wallet_data { - domain::WalletData::GooglePay(data) => { + api_models::payments::WalletData::GooglePay(data) => { let gpay_data = AdyenGPay { payment_type: PaymentType::Googlepay, google_pay_token: Secret::new(data.tokenization_data.token.to_owned()), }; Ok(AdyenPaymentMethod::Gpay(Box::new(gpay_data))) } - domain::WalletData::ApplePay(data) => { + api_models::payments::WalletData::ApplePay(data) => { let apple_pay_data = AdyenApplePay { payment_type: PaymentType::Applepay, apple_pay_token: Secret::new(data.payment_data.to_string()), @@ -2045,78 +2051,79 @@ impl<'a> TryFrom<(&domain::WalletData, &types::PaymentsAuthorizeRouterData)> Ok(AdyenPaymentMethod::ApplePay(Box::new(apple_pay_data))) } - domain::WalletData::PaypalRedirect(_) => { + api_models::payments::WalletData::PaypalRedirect(_) => { let wallet = PmdForPaymentType { payment_type: PaymentType::Paypal, }; Ok(AdyenPaymentMethod::AdyenPaypal(Box::new(wallet))) } - domain::WalletData::AliPayRedirect(_) => { + api_models::payments::WalletData::AliPayRedirect(_) => { let alipay_data = PmdForPaymentType { payment_type: PaymentType::Alipay, }; Ok(AdyenPaymentMethod::AliPay(Box::new(alipay_data))) } - domain::WalletData::AliPayHkRedirect(_) => { + api_models::payments::WalletData::AliPayHkRedirect(_) => { let alipay_hk_data = PmdForPaymentType { payment_type: PaymentType::AlipayHk, }; Ok(AdyenPaymentMethod::AliPayHk(Box::new(alipay_hk_data))) } - domain::WalletData::GoPayRedirect(_) => { + api_models::payments::WalletData::GoPayRedirect(_) => { let go_pay_data = GoPayData {}; Ok(AdyenPaymentMethod::GoPay(Box::new(go_pay_data))) } - domain::WalletData::KakaoPayRedirect(_) => { + api_models::payments::WalletData::KakaoPayRedirect(_) => { let kakao_pay_data = KakaoPayData {}; Ok(AdyenPaymentMethod::Kakaopay(Box::new(kakao_pay_data))) } - domain::WalletData::GcashRedirect(_) => { + api_models::payments::WalletData::GcashRedirect(_) => { let gcash_data = GcashData {}; Ok(AdyenPaymentMethod::Gcash(Box::new(gcash_data))) } - domain::WalletData::MomoRedirect(_) => { + api_models::payments::WalletData::MomoRedirect(_) => { let momo_data = MomoData {}; Ok(AdyenPaymentMethod::Momo(Box::new(momo_data))) } - domain::WalletData::TouchNGoRedirect(_) => { + api_models::payments::WalletData::TouchNGoRedirect(_) => { let touch_n_go_data = TouchNGoData {}; Ok(AdyenPaymentMethod::TouchNGo(Box::new(touch_n_go_data))) } - domain::WalletData::MbWayRedirect(_) => { - let phone_details = item.get_billing_phone()?; + api_models::payments::WalletData::MbWayRedirect(data) => { let mbway_data = MbwayData { payment_type: PaymentType::Mbway, - telephone_number: phone_details.get_number_with_country_code()?, + telephone_number: data.telephone_number.clone(), }; Ok(AdyenPaymentMethod::Mbway(Box::new(mbway_data))) } - domain::WalletData::MobilePayRedirect(_) => { + api_models::payments::WalletData::MobilePayRedirect(_) => { let data = PmdForPaymentType { payment_type: PaymentType::MobilePay, }; Ok(AdyenPaymentMethod::MobilePay(Box::new(data))) } - domain::WalletData::WeChatPayRedirect(_) => Ok(AdyenPaymentMethod::WeChatPayWeb), - domain::WalletData::SamsungPay(samsung_data) => { + api_models::payments::WalletData::WeChatPayRedirect(_) => { + Ok(AdyenPaymentMethod::WeChatPayWeb) + } + api_models::payments::WalletData::SamsungPay(samsung_data) => { let data = SamsungPayPmData { payment_type: PaymentType::Samsungpay, samsung_pay_token: samsung_data.token.to_owned(), }; Ok(AdyenPaymentMethod::SamsungPay(Box::new(data))) } - domain::WalletData::TwintRedirect { .. } => Ok(AdyenPaymentMethod::Twint), - domain::WalletData::VippsRedirect { .. } => Ok(AdyenPaymentMethod::Vipps), - domain::WalletData::DanaRedirect { .. } => Ok(AdyenPaymentMethod::Dana), - domain::WalletData::SwishQr(_) => Ok(AdyenPaymentMethod::Swish), - domain::WalletData::AliPayQr(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) => Err(errors::ConnectorError::NotImplemented( + api_models::payments::WalletData::TwintRedirect { .. } => Ok(AdyenPaymentMethod::Twint), + api_models::payments::WalletData::VippsRedirect { .. } => Ok(AdyenPaymentMethod::Vipps), + api_models::payments::WalletData::DanaRedirect { .. } => Ok(AdyenPaymentMethod::Dana), + api_models::payments::WalletData::SwishQr(_) => Ok(AdyenPaymentMethod::Swish), + payments::WalletData::AliPayQr(_) + | payments::WalletData::ApplePayRedirect(_) + | payments::WalletData::ApplePayThirdPartySdk(_) + | payments::WalletData::GooglePayRedirect(_) + | payments::WalletData::GooglePayThirdPartySdk(_) + | payments::WalletData::PaypalSdk(_) + | payments::WalletData::WeChatPayQr(_) + | payments::WalletData::CashappQr(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ) .into()), @@ -2137,7 +2144,7 @@ pub fn check_required_field<'a, T>( impl<'a> TryFrom<( - &domain::PayLaterData, + &api::PayLaterData, &Option, &Option, &Option, @@ -2150,7 +2157,7 @@ impl<'a> type Error = Error; fn try_from( value: ( - &domain::PayLaterData, + &api::PayLaterData, &Option, &Option, &Option, @@ -2171,7 +2178,7 @@ impl<'a> delivery_address, ) = value; match pay_later_data { - domain::payments::PayLaterData::KlarnaRedirect { .. } => { + api_models::payments::PayLaterData::KlarnaRedirect { .. } => { let klarna = PmdForPaymentType { payment_type: PaymentType::Klarna, }; @@ -2181,7 +2188,7 @@ impl<'a> Ok(AdyenPaymentMethod::AdyenKlarna(Box::new(klarna))) } - domain::payments::PayLaterData::AffirmRedirect { .. } => { + api_models::payments::PayLaterData::AffirmRedirect { .. } => { check_required_field(shopper_email, "email")?; check_required_field(shopper_name, "billing.first_name, billing.last_name")?; check_required_field(telephone_number, "billing.phone")?; @@ -2193,7 +2200,7 @@ impl<'a> }, ))) } - domain::payments::PayLaterData::AfterpayClearpayRedirect { .. } => { + api_models::payments::PayLaterData::AfterpayClearpayRedirect { .. } => { check_required_field(shopper_email, "email")?; check_required_field(shopper_name, "billing.first_name, billing.last_name")?; check_required_field(delivery_address, "shipping")?; @@ -2215,7 +2222,7 @@ impl<'a> })? } } - domain::payments::PayLaterData::PayBrightRedirect { .. } => { + api_models::payments::PayLaterData::PayBrightRedirect { .. } => { check_required_field(shopper_name, "billing.first_name, billing.last_name")?; check_required_field(telephone_number, "billing.phone")?; check_required_field(shopper_email, "email")?; @@ -2224,13 +2231,13 @@ impl<'a> check_required_field(country_code, "billing.country")?; Ok(AdyenPaymentMethod::PayBright) } - domain::payments::PayLaterData::WalleyRedirect { .. } => { + api_models::payments::PayLaterData::WalleyRedirect { .. } => { //[TODO: Line items specific sub-fields are mandatory] check_required_field(telephone_number, "billing.phone")?; check_required_field(shopper_email, "email")?; Ok(AdyenPaymentMethod::Walley) } - domain::payments::PayLaterData::AlmaRedirect { .. } => { + api_models::payments::PayLaterData::AlmaRedirect { .. } => { check_required_field(telephone_number, "billing.phone")?; check_required_field(shopper_email, "email")?; check_required_field(billing_address, "billing")?; @@ -2241,14 +2248,14 @@ impl<'a> }, ))) } - domain::payments::PayLaterData::AtomeRedirect { .. } => { + api_models::payments::PayLaterData::AtomeRedirect { .. } => { check_required_field(shopper_email, "email")?; check_required_field(shopper_name, "billing.first_name, billing.last_name")?; check_required_field(telephone_number, "billing.phone")?; check_required_field(billing_address, "billing")?; Ok(AdyenPaymentMethod::Atome) } - domain::payments::PayLaterData::KlarnaSdk { .. } => { + payments::PayLaterData::KlarnaSdk { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ) @@ -2258,13 +2265,15 @@ impl<'a> } } -impl<'a> TryFrom<(&domain::BankRedirectData, Option)> for AdyenPaymentMethod<'a> { +impl<'a> TryFrom<(&api_models::payments::BankRedirectData, Option)> + for AdyenPaymentMethod<'a> +{ type Error = Error; fn try_from( - (bank_redirect_data, test_mode): (&domain::BankRedirectData, Option), + (bank_redirect_data, test_mode): (&api_models::payments::BankRedirectData, Option), ) -> Result { match bank_redirect_data { - domain::BankRedirectData::BancontactCard { + api_models::payments::BankRedirectData::BancontactCard { card_number, card_exp_month, card_exp_year, @@ -2300,12 +2309,12 @@ impl<'a> TryFrom<(&domain::BankRedirectData, Option)> for AdyenPaymentMeth .clone(), }, ))), - domain::BankRedirectData::Bizum { .. } => { + api_models::payments::BankRedirectData::Bizum { .. } => { Ok(AdyenPaymentMethod::Bizum(Box::new(PmdForPaymentType { payment_type: PaymentType::Bizum, }))) } - domain::BankRedirectData::Blik { blik_code } => { + api_models::payments::BankRedirectData::Blik { blik_code } => { Ok(AdyenPaymentMethod::Blik(Box::new(BlikRedirectionData { payment_type: PaymentType::Blik, blik_code: Secret::new(blik_code.clone().ok_or( @@ -2315,8 +2324,8 @@ impl<'a> TryFrom<(&domain::BankRedirectData, Option)> for AdyenPaymentMeth )?), }))) } - domain::BankRedirectData::Eps { bank_name, .. } => Ok(AdyenPaymentMethod::Eps( - Box::new(BankRedirectionWithIssuer { + api_models::payments::BankRedirectData::Eps { bank_name, .. } => Ok( + AdyenPaymentMethod::Eps(Box::new(BankRedirectionWithIssuer { payment_type: PaymentType::Eps, issuer: Some( AdyenTestBankNames::try_from(&bank_name.ok_or( @@ -2326,14 +2335,14 @@ impl<'a> TryFrom<(&domain::BankRedirectData, Option)> for AdyenPaymentMeth )?)? .0, ), - }), - )), - domain::BankRedirectData::Giropay { .. } => { + })), + ), + api_models::payments::BankRedirectData::Giropay { .. } => { Ok(AdyenPaymentMethod::Giropay(Box::new(PmdForPaymentType { payment_type: PaymentType::Giropay, }))) } - domain::BankRedirectData::Ideal { bank_name, .. } => { + api_models::payments::BankRedirectData::Ideal { bank_name, .. } => { let issuer = if test_mode.unwrap_or(true) { Some( AdyenTestBankNames::try_from(&bank_name.ok_or( @@ -2360,7 +2369,7 @@ impl<'a> TryFrom<(&domain::BankRedirectData, Option)> for AdyenPaymentMeth }, ))) } - domain::BankRedirectData::OnlineBankingCzechRepublic { issuer } => { + api_models::payments::BankRedirectData::OnlineBankingCzechRepublic { issuer } => { Ok(AdyenPaymentMethod::OnlineBankingCzechRepublic(Box::new( OnlineBankingCzechRepublicData { payment_type: PaymentType::OnlineBankingCzechRepublic, @@ -2368,34 +2377,34 @@ impl<'a> TryFrom<(&domain::BankRedirectData, Option)> for AdyenPaymentMeth }, ))) } - domain::BankRedirectData::OnlineBankingFinland { .. } => Ok( + api_models::payments::BankRedirectData::OnlineBankingFinland { .. } => Ok( AdyenPaymentMethod::OnlineBankingFinland(Box::new(PmdForPaymentType { payment_type: PaymentType::OnlineBankingFinland, })), ), - domain::BankRedirectData::OnlineBankingPoland { issuer } => Ok( + api_models::payments::BankRedirectData::OnlineBankingPoland { issuer } => Ok( AdyenPaymentMethod::OnlineBankingPoland(Box::new(OnlineBankingPolandData { payment_type: PaymentType::OnlineBankingPoland, issuer: OnlineBankingPolandBanks::try_from(issuer)?, })), ), - domain::BankRedirectData::OnlineBankingSlovakia { issuer } => Ok( + api_models::payments::BankRedirectData::OnlineBankingSlovakia { issuer } => Ok( AdyenPaymentMethod::OnlineBankingSlovakia(Box::new(OnlineBankingSlovakiaData { payment_type: PaymentType::OnlineBankingSlovakia, issuer: OnlineBankingSlovakiaBanks::try_from(issuer)?, })), ), - domain::BankRedirectData::OnlineBankingFpx { issuer } => Ok( + api_models::payments::BankRedirectData::OnlineBankingFpx { issuer } => Ok( AdyenPaymentMethod::OnlineBankingFpx(Box::new(OnlineBankingFpxData { issuer: OnlineBankingFpxIssuer::try_from(issuer)?, })), ), - domain::BankRedirectData::OnlineBankingThailand { issuer } => Ok( + api_models::payments::BankRedirectData::OnlineBankingThailand { issuer } => Ok( AdyenPaymentMethod::OnlineBankingThailand(Box::new(OnlineBankingThailandData { issuer: OnlineBankingThailandIssuer::try_from(issuer)?, })), ), - domain::BankRedirectData::OpenBankingUk { issuer, .. } => Ok( + api_models::payments::BankRedirectData::OpenBankingUk { issuer, .. } => Ok( AdyenPaymentMethod::OpenBankingUK(Box::new(OpenBankingUKData { issuer: match issuer { Some(bank_name) => OpenBankingUKIssuer::try_from(bank_name)?, @@ -2405,10 +2414,12 @@ impl<'a> TryFrom<(&domain::BankRedirectData, Option)> for AdyenPaymentMeth }, })), ), - domain::BankRedirectData::Sofort { .. } => Ok(AdyenPaymentMethod::Sofort), - domain::BankRedirectData::Trustly { .. } => Ok(AdyenPaymentMethod::Trustly), - domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::Przelewy24 { .. } => { + api_models::payments::BankRedirectData::Sofort { .. } => Ok(AdyenPaymentMethod::Sofort), + api_models::payments::BankRedirectData::Trustly { .. } => { + Ok(AdyenPaymentMethod::Trustly) + } + payments::BankRedirectData::Interac { .. } + | payments::BankRedirectData::Przelewy24 { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ) @@ -2418,11 +2429,13 @@ impl<'a> TryFrom<(&domain::BankRedirectData, Option)> for AdyenPaymentMeth } } -impl<'a> TryFrom<&domain::BankTransferData> for AdyenPaymentMethod<'a> { +impl<'a> TryFrom<&api_models::payments::BankTransferData> for AdyenPaymentMethod<'a> { type Error = Error; - fn try_from(bank_transfer_data: &domain::BankTransferData) -> Result { + fn try_from( + bank_transfer_data: &api_models::payments::BankTransferData, + ) -> Result { match bank_transfer_data { - domain::BankTransferData::PermataBankTransfer { + payments::BankTransferData::PermataBankTransfer { ref billing_details, } => Ok(AdyenPaymentMethod::PermataBankTransfer(Box::new( DokuBankData { @@ -2431,7 +2444,7 @@ impl<'a> TryFrom<&domain::BankTransferData> for AdyenPaymentMethod<'a> { shopper_email: billing_details.email.clone(), }, ))), - domain::BankTransferData::BcaBankTransfer { + payments::BankTransferData::BcaBankTransfer { ref billing_details, } => Ok(AdyenPaymentMethod::BcaBankTransfer(Box::new( DokuBankData { @@ -2440,52 +2453,51 @@ impl<'a> TryFrom<&domain::BankTransferData> for AdyenPaymentMethod<'a> { shopper_email: billing_details.email.clone(), }, ))), - domain::BankTransferData::BniVaBankTransfer { + payments::BankTransferData::BniVaBankTransfer { ref billing_details, } => Ok(AdyenPaymentMethod::BniVa(Box::new(DokuBankData { first_name: billing_details.first_name.clone(), last_name: billing_details.last_name.clone(), shopper_email: billing_details.email.clone(), }))), - domain::BankTransferData::BriVaBankTransfer { + payments::BankTransferData::BriVaBankTransfer { ref billing_details, } => Ok(AdyenPaymentMethod::BriVa(Box::new(DokuBankData { first_name: billing_details.first_name.clone(), last_name: billing_details.last_name.clone(), shopper_email: billing_details.email.clone(), }))), - domain::BankTransferData::CimbVaBankTransfer { + payments::BankTransferData::CimbVaBankTransfer { ref billing_details, } => Ok(AdyenPaymentMethod::CimbVa(Box::new(DokuBankData { first_name: billing_details.first_name.clone(), last_name: billing_details.last_name.clone(), shopper_email: billing_details.email.clone(), }))), - domain::BankTransferData::DanamonVaBankTransfer { + payments::BankTransferData::DanamonVaBankTransfer { ref billing_details, } => Ok(AdyenPaymentMethod::DanamonVa(Box::new(DokuBankData { first_name: billing_details.first_name.clone(), last_name: billing_details.last_name.clone(), shopper_email: billing_details.email.clone(), }))), - domain::BankTransferData::MandiriVaBankTransfer { + payments::BankTransferData::MandiriVaBankTransfer { ref billing_details, } => Ok(AdyenPaymentMethod::MandiriVa(Box::new(DokuBankData { first_name: billing_details.first_name.clone(), last_name: billing_details.last_name.clone(), shopper_email: billing_details.email.clone(), }))), - domain::BankTransferData::Pix {} => { + api_models::payments::BankTransferData::Pix {} => { Ok(AdyenPaymentMethod::Pix(Box::new(PmdForPaymentType { payment_type: PaymentType::Pix, }))) } - domain::BankTransferData::AchBankTransfer { .. } - | domain::BankTransferData::SepaBankTransfer { .. } - | domain::BankTransferData::BacsBankTransfer { .. } - | domain::BankTransferData::MultibancoBankTransfer { .. } - | domain::BankTransferData::LocalBankTransfer { .. } - | domain::BankTransferData::Pse {} => Err(errors::ConnectorError::NotImplemented( + api_models::payments::BankTransferData::AchBankTransfer { .. } + | api_models::payments::BankTransferData::SepaBankTransfer { .. } + | api_models::payments::BankTransferData::BacsBankTransfer { .. } + | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } + | payments::BankTransferData::Pse {} => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ) .into()), @@ -2493,27 +2505,16 @@ impl<'a> TryFrom<&domain::BankTransferData> for AdyenPaymentMethod<'a> { } } -impl TryFrom<&types::PaymentsAuthorizeRouterData> for DokuBankData { - type Error = Error; - fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { - Ok(Self { - first_name: item.get_billing_first_name()?, - last_name: item.get_optional_billing_last_name(), - shopper_email: item.get_billing_email()?, - }) - } -} - -impl<'a> TryFrom<&domain::payments::CardRedirectData> for AdyenPaymentMethod<'a> { +impl<'a> TryFrom<&api_models::payments::CardRedirectData> for AdyenPaymentMethod<'a> { type Error = Error; fn try_from( - card_redirect_data: &domain::payments::CardRedirectData, + card_redirect_data: &api_models::payments::CardRedirectData, ) -> Result { match card_redirect_data { - domain::CardRedirectData::Knet {} => Ok(AdyenPaymentMethod::Knet), - domain::CardRedirectData::Benefit {} => Ok(AdyenPaymentMethod::Benefit), - domain::CardRedirectData::MomoAtm {} => Ok(AdyenPaymentMethod::MomoAtm), - domain::CardRedirectData::CardRedirect {} => { + payments::CardRedirectData::Knet {} => Ok(AdyenPaymentMethod::Knet), + payments::CardRedirectData::Benefit {} => Ok(AdyenPaymentMethod::Benefit), + payments::CardRedirectData::MomoAtm {} => Ok(AdyenPaymentMethod::MomoAtm), + payments::CardRedirectData::CardRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), ) @@ -2565,35 +2566,34 @@ impl<'a> } payments::MandateReferenceId::NetworkMandateId(network_mandate_id) => { match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref card) => { + api::PaymentMethodData::Card(ref card) => { let card_issuer = card.get_card_issuer()?; let brand = CardBrand::try_from(&card_issuer)?; - let card_holder_name = item.router_data.get_optional_billing_full_name(); let adyen_card = AdyenCard { payment_type: PaymentType::Scheme, number: card.card_number.clone(), expiry_month: card.card_exp_month.clone(), expiry_year: card.card_exp_year.clone(), cvc: None, - holder_name: card_holder_name, + holder_name: card.card_holder_name.clone(), brand: Some(brand), network_payment_reference: Some(Secret::new(network_mandate_id)), }; Ok(AdyenPaymentMethod::AdyenCard(Box::new(adyen_card))) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::Wallet(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotSupported { message: "Network tokenization for payment method".to_string(), connector: "Adyen", @@ -2633,14 +2633,14 @@ impl<'a> impl<'a> TryFrom<( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, + &api::Card, )> for AdyenPaymentRequest<'a> { type Error = Error; fn try_from( value: ( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, + &api::Card, ), ) -> Result { let (item, card_data) = value; @@ -2659,8 +2659,7 @@ impl<'a> let country_code = get_country_code(item.router_data.get_optional_billing()); let additional_data = get_additional_data(item.router_data); let return_url = item.router_data.request.get_return_url()?; - let card_holder_name = item.router_data.get_optional_billing_full_name(); - let payment_method = AdyenPaymentMethod::try_from((card_data, card_holder_name))?; + let payment_method = AdyenPaymentMethod::try_from(card_data)?; let shopper_email = item.router_data.request.email.clone(); let shopper_name = get_shopper_name(item.router_data.get_optional_billing()); @@ -2696,7 +2695,7 @@ impl<'a> impl<'a> TryFrom<( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankDebitData, + &api_models::payments::BankDebitData, )> for AdyenPaymentRequest<'a> { type Error = Error; @@ -2704,7 +2703,7 @@ impl<'a> fn try_from( value: ( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankDebitData, + &api_models::payments::BankDebitData, ), ) -> Result { let (item, bank_debit_data) = value; @@ -2750,7 +2749,7 @@ impl<'a> impl<'a> TryFrom<( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::VoucherData, + &api_models::payments::VoucherData, )> for AdyenPaymentRequest<'a> { type Error = Error; @@ -2758,7 +2757,7 @@ impl<'a> fn try_from( value: ( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::VoucherData, + &api_models::payments::VoucherData, ), ) -> Result { let (item, voucher_data) = value; @@ -2768,7 +2767,7 @@ impl<'a> let recurring_processing_model = get_recurring_processing_model(item.router_data)?.0; let browser_info = get_browser_info(item.router_data)?; let additional_data = get_additional_data(item.router_data); - let payment_method = AdyenPaymentMethod::try_from((voucher_data, item.router_data))?; + let payment_method = AdyenPaymentMethod::try_from(voucher_data)?; let return_url = item.router_data.request.get_return_url()?; let social_security_number = get_social_security_number(voucher_data); let request = AdyenPaymentRequest { @@ -2804,7 +2803,7 @@ impl<'a> impl<'a> TryFrom<( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankTransferData, + &api_models::payments::BankTransferData, )> for AdyenPaymentRequest<'a> { type Error = Error; @@ -2812,7 +2811,7 @@ impl<'a> fn try_from( value: ( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankTransferData, + &api_models::payments::BankTransferData, ), ) -> Result { let (item, bank_transfer_data) = value; @@ -2854,7 +2853,7 @@ impl<'a> impl<'a> TryFrom<( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::GiftCardData, + &api_models::payments::GiftCardData, )> for AdyenPaymentRequest<'a> { type Error = Error; @@ -2862,7 +2861,7 @@ impl<'a> fn try_from( value: ( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::GiftCardData, + &api_models::payments::GiftCardData, ), ) -> Result { let (item, gift_card_data) = value; @@ -2904,14 +2903,14 @@ impl<'a> impl<'a> TryFrom<( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankRedirectData, + &api_models::payments::BankRedirectData, )> for AdyenPaymentRequest<'a> { type Error = Error; fn try_from( value: ( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::BankRedirectData, + &api_models::payments::BankRedirectData, ), ) -> Result { let (item, bank_redirect_data) = value; @@ -2961,20 +2960,22 @@ fn get_redirect_extra_details( item: &types::PaymentsAuthorizeRouterData, ) -> Result<(Option, Option), errors::ConnectorError> { match item.request.payment_method_data { - domain::PaymentMethodData::BankRedirect(ref redirect_data) => match redirect_data { - domain::BankRedirectData::Sofort { - country, - preferred_language, - .. - } => Ok((preferred_language.clone(), *country)), - domain::BankRedirectData::OpenBankingUk { country, .. } => { - let country = country.ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "country", - })?; - Ok((None, Some(country))) + api_models::payments::PaymentMethodData::BankRedirect(ref redirect_data) => { + match redirect_data { + api_models::payments::BankRedirectData::Sofort { + country, + preferred_language, + .. + } => Ok((preferred_language.clone(), *country)), + api_models::payments::BankRedirectData::OpenBankingUk { country, .. } => { + let country = country.ok_or(errors::ConnectorError::MissingRequiredField { + field_name: "country", + })?; + Ok((None, Some(country))) + } + _ => Ok((None, None)), } - _ => Ok((None, None)), - }, + } _ => Ok((None, None)), } } @@ -3000,14 +3001,14 @@ fn get_shopper_email( impl<'a> TryFrom<( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &api::WalletData, )> for AdyenPaymentRequest<'a> { type Error = Error; fn try_from( value: ( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &api::WalletData, ), ) -> Result { let (item, wallet_data) = value; @@ -3015,7 +3016,7 @@ impl<'a> let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?; let browser_info = get_browser_info(item.router_data)?; let additional_data = get_additional_data(item.router_data); - let payment_method = AdyenPaymentMethod::try_from((wallet_data, item.router_data))?; + let payment_method = AdyenPaymentMethod::try_from(wallet_data)?; let shopper_interaction = AdyenShopperInteraction::from(item.router_data); let channel = get_channel_type(&item.router_data.request.payment_method_type); let (recurring_processing_model, store_payment_method, shopper_reference) = @@ -3055,14 +3056,14 @@ impl<'a> impl<'a> TryFrom<( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::PayLaterData, + &api::PayLaterData, )> for AdyenPaymentRequest<'a> { type Error = Error; fn try_from( value: ( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::PayLaterData, + &api::PayLaterData, ), ) -> Result { let (item, paylater_data) = value; @@ -3130,14 +3131,14 @@ impl<'a> impl<'a> TryFrom<( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::payments::CardRedirectData, + &api_models::payments::CardRedirectData, )> for AdyenPaymentRequest<'a> { type Error = Error; fn try_from( value: ( &AdyenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::payments::CardRedirectData, + &api_models::payments::CardRedirectData, ), ) -> Result { let (item, card_redirect_data) = value; @@ -3963,7 +3964,7 @@ impl TryFrom> connector_response_reference_id: Some(item.response.reference), incremental_authorization_allowed: None, }), - amount_captured: Some(0), + amount_captured: Some(item.response.amount.value), ..item.data }) } @@ -4633,10 +4634,6 @@ impl TryFrom<&AdyenRouterData<&types::PayoutsRouterData>> for AdyenPayoutC message: "Bank transfer via Bacs is not supported".to_string(), connector: "Adyen", })?, - payouts::BankPayout::Pix(..) => Err(errors::ConnectorError::NotSupported { - message: "Bank transfer via Pix is not supported".to_string(), - connector: "Adyen", - })?, }; let bank_data = PayoutBankData { bank: bank_details }; let address: &payments::AddressDetails = item.router_data.get_billing_address()?; @@ -4674,12 +4671,6 @@ impl TryFrom<&AdyenRouterData<&types::PayoutsRouterData>> for AdyenPayoutC }, )?, }, - api_models::payouts::Wallet::Venmo(_) => { - Err(errors::ConnectorError::NotSupported { - message: "Venmo Wallet is not supported".to_string(), - connector: "Adyen", - })? - } }; let address: &payments::AddressDetails = item.router_data.get_billing_address()?; let payout_wallet = PayoutWalletData { @@ -4778,8 +4769,10 @@ impl TryFrom> let status = payout_eligible.map_or( { response.result_code.map_or( - response.response.map(storage_enums::PayoutStatus::from), - |rc| Some(storage_enums::PayoutStatus::from(rc)), + response + .response + .map(storage_enums::PayoutStatus::foreign_from), + |rc| Some(storage_enums::PayoutStatus::foreign_from(rc)), ) }, |pe| { @@ -4796,7 +4789,6 @@ impl TryFrom> status, connector_payout_id: response.psp_reference, payout_eligible, - should_add_next_step_to_process_tracker: false, }), ..item.data }) @@ -4804,8 +4796,8 @@ impl TryFrom> } #[cfg(feature = "payouts")] -impl From for storage_enums::PayoutStatus { - fn from(adyen_status: AdyenStatus) -> Self { +impl ForeignFrom for storage_enums::PayoutStatus { + fn foreign_from(adyen_status: AdyenStatus) -> Self { match adyen_status { AdyenStatus::Authorised | AdyenStatus::PayoutConfirmReceived => Self::Success, AdyenStatus::Cancelled | AdyenStatus::PayoutDeclineReceived => Self::Cancelled, diff --git a/crates/router/src/connector/airwallex.rs b/crates/router/src/connector/airwallex.rs index 91a27fc3df0..6a8f384e199 100644 --- a/crates/router/src/connector/airwallex.rs +++ b/crates/router/src/connector/airwallex.rs @@ -1132,9 +1132,7 @@ impl services::ConnectorRedirectResponse for Airwallex { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/airwallex/transformers.rs b/crates/router/src/connector/airwallex/transformers.rs index e80909d7e01..ee52884817b 100644 --- a/crates/router/src/connector/airwallex/transformers.rs +++ b/crates/router/src/connector/airwallex/transformers.rs @@ -10,7 +10,7 @@ use crate::{ core::errors, pii::Secret, services, - types::{self, api, domain, storage::enums, PaymentsSyncData}, + types::{self, api, storage::enums, PaymentsSyncData}, }; pub struct AirwallexAuthType { @@ -167,7 +167,7 @@ impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>> let mut payment_method_options = None; let request = &item.router_data.request; let payment_method = match request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => { + api::PaymentMethodData::Card(ccard) => { payment_method_options = Some(AirwallexPaymentOptions::Card(AirwallexCardPaymentOptions { auto_capture: matches!( @@ -185,23 +185,21 @@ impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>> payment_method_type: AirwallexPaymentType::Card, })) } - domain::PaymentMethodData::Wallet(ref wallet_data) => get_wallet_details(wallet_data), - domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("airwallex"), - )) - } + api::PaymentMethodData::Wallet(ref wallet_data) => get_wallet_details(wallet_data), + api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("airwallex"), + )), }?; Ok(Self { @@ -214,10 +212,10 @@ impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>> } fn get_wallet_details( - wallet_data: &domain::WalletData, + wallet_data: &api_models::payments::WalletData, ) -> Result { let wallet_details: AirwallexPaymentMethod = match wallet_data { - domain::WalletData::GooglePay(gpay_details) => { + api_models::payments::WalletData::GooglePay(gpay_details) => { AirwallexPaymentMethod::Wallets(WalletData::GooglePay(GooglePayData { googlepay: GooglePayDetails { encrypted_payment_token: Secret::new( @@ -228,33 +226,35 @@ fn get_wallet_details( payment_method_type: AirwallexPaymentType::Googlepay, })) } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("airwallex"), - ))?, + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePay(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("airwallex"), + ))? + } }; Ok(wallet_details) } diff --git a/crates/router/src/connector/authorizedotnet.rs b/crates/router/src/connector/authorizedotnet.rs index 7f9cdc376e1..946fded930d 100644 --- a/crates/router/src/connector/authorizedotnet.rs +++ b/crates/router/src/connector/authorizedotnet.rs @@ -974,9 +974,7 @@ impl services::ConnectorRedirectResponse for Authorizedotnet { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs index a072fcf3214..2e5a9f3bbcb 100644 --- a/crates/router/src/connector/authorizedotnet/transformers.rs +++ b/crates/router/src/connector/authorizedotnet/transformers.rs @@ -15,7 +15,6 @@ use crate::{ types::{ self, api::{self, enums as api_enums}, - domain, storage::enums, transformers::ForeignFrom, }, @@ -164,7 +163,7 @@ fn get_pm_and_subsequent_auth_detail( reason: Reason::Resubmission, }); match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => { + api::PaymentMethodData::Card(ref ccard) => { let payment_details = PaymentDetails::CreditCard(CreditCardDetails { card_number: (*ccard.card_number).clone(), expiration_date: ccard.get_expiry_date_as_yyyymm("-"), @@ -172,19 +171,19 @@ fn get_pm_and_subsequent_auth_detail( }); Ok((payment_details, processing_options, subseuent_auth_info)) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("authorizedotnet"), ))? @@ -193,7 +192,7 @@ fn get_pm_and_subsequent_auth_detail( } Some(api_models::payments::MandateReferenceId::ConnectorMandateId(_)) | None => { match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => { + api::PaymentMethodData::Card(ref ccard) => { Ok(( PaymentDetails::CreditCard(CreditCardDetails { card_number: (*ccard.card_number).clone(), @@ -207,7 +206,7 @@ fn get_pm_and_subsequent_auth_detail( None, )) } - domain::PaymentMethodData::Wallet(ref wallet_data) => Ok(( + api::PaymentMethodData::Wallet(ref wallet_data) => Ok(( get_wallet_data( wallet_data, &item.router_data.request.complete_authorize_url, @@ -215,18 +214,18 @@ fn get_pm_and_subsequent_auth_detail( None, None, )), - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("authorizedotnet"), ))? @@ -1283,49 +1282,55 @@ impl TryFrom for AuthorizedotnetSyncResponse { } fn get_wallet_data( - wallet_data: &domain::WalletData, + wallet_data: &api_models::payments::WalletData, return_url: &Option, ) -> CustomResult { match wallet_data { - domain::WalletData::GooglePay(_) => Ok(PaymentDetails::OpaqueData(WalletDetails { - data_descriptor: WalletMethod::Googlepay, - data_value: Secret::new(wallet_data.get_encoded_wallet_token()?), - })), - domain::WalletData::ApplePay(applepay_token) => { + api_models::payments::WalletData::GooglePay(_) => { + Ok(PaymentDetails::OpaqueData(WalletDetails { + data_descriptor: WalletMethod::Googlepay, + data_value: Secret::new(wallet_data.get_encoded_wallet_token()?), + })) + } + api_models::payments::WalletData::ApplePay(applepay_token) => { Ok(PaymentDetails::OpaqueData(WalletDetails { data_descriptor: WalletMethod::Applepay, data_value: Secret::new(applepay_token.payment_data.clone()), })) } - domain::WalletData::PaypalRedirect(_) => Ok(PaymentDetails::PayPal(PayPalDetails { - success_url: return_url.to_owned(), - cancel_url: return_url.to_owned(), - })), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("authorizedotnet"), - ))?, + api_models::payments::WalletData::PaypalRedirect(_) => { + Ok(PaymentDetails::PayPal(PayPalDetails { + success_url: return_url.to_owned(), + cancel_url: return_url.to_owned(), + })) + } + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("authorizedotnet"), + ))? + } } } diff --git a/crates/router/src/connector/bambora.rs b/crates/router/src/connector/bambora.rs index 7ff352416cd..a9bfc54313d 100644 --- a/crates/router/src/connector/bambora.rs +++ b/crates/router/src/connector/bambora.rs @@ -62,10 +62,6 @@ impl ConnectorCommon for Bambora { "bambora" } - fn get_currency_unit(&self) -> api::CurrencyUnit { - api::CurrencyUnit::Base - } - fn common_get_content_type(&self) -> &'static str { "application/json" } @@ -191,7 +187,7 @@ impl ConnectorIntegration CustomResult { - let connector_router_data = bambora::BamboraRouterData::try_from(( - &self.get_currency_unit(), - req.request - .currency - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "Currency", - })?, - req.request - .amount - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "Amount", - })?, - req, - ))?; - - let connector_req = bambora::BamboraVoidRequest::try_from(connector_router_data)?; + let connector_req = bambora::BamboraPaymentsRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) } @@ -395,15 +376,7 @@ impl ConnectorIntegration CustomResult { - let connector_router_data = bambora::BamboraRouterData::try_from(( - &self.get_currency_unit(), - req.request.currency, - req.request.amount_to_capture, - req, - ))?; - - let connector_req = - bambora::BamboraPaymentsCaptureRequest::try_from(connector_router_data)?; + let connector_req = bambora::BamboraPaymentsCaptureRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) } @@ -497,14 +470,7 @@ impl ConnectorIntegration CustomResult { - let connector_router_data = bambora::BamboraRouterData::try_from(( - &self.get_currency_unit(), - req.request.currency, - req.request.amount, - req, - ))?; - - let connector_req = bambora::BamboraPaymentsRequest::try_from(connector_router_data)?; + let connector_req = bambora::BamboraPaymentsRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) } @@ -603,13 +569,7 @@ impl ConnectorIntegration, _connectors: &settings::Connectors, ) -> CustomResult { - let connector_router_data = bambora::BamboraRouterData::try_from(( - &self.get_currency_unit(), - req.request.currency, - req.request.refund_amount, - req, - ))?; - let connector_req = bambora::BamboraRefundRequest::try_from(connector_router_data)?; + let connector_req = bambora::BamboraRefundRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) } @@ -777,9 +737,7 @@ impl services::ConnectorRedirectResponse for Bambora { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/bambora/transformers.rs b/crates/router/src/connector/bambora/transformers.rs index dbb655c6ca0..40c3219d353 100644 --- a/crates/router/src/connector/bambora/transformers.rs +++ b/crates/router/src/connector/bambora/transformers.rs @@ -5,46 +5,13 @@ use masking::{ExposeInterface, PeekInterface, Secret}; use serde::{Deserialize, Deserializer, Serialize}; use crate::{ - connector::utils::{ - AddressDetailsData, BrowserInformationData, CardData as OtherCardData, - PaymentsAuthorizeRequestData, RouterData, - }, + connector::utils::{BrowserInformationData, PaymentsAuthorizeRequestData}, consts, core::errors, services, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; -pub struct BamboraRouterData { - pub amount: f64, - pub router_data: T, -} - -impl - TryFrom<( - &types::api::CurrencyUnit, - types::storage::enums::Currency, - i64, - T, - )> for BamboraRouterData -{ - type Error = error_stack::Report; - fn try_from( - (currency_unit, currency, amount, item): ( - &types::api::CurrencyUnit, - types::storage::enums::Currency, - i64, - T, - ), - ) -> Result { - let amount = crate::connector::utils::get_amount_as_f64(currency_unit, amount, currency)?; - Ok(Self { - amount, - router_data: item, - }) - } -} - #[derive(Default, Debug, Serialize, Eq, PartialEq)] pub struct BamboraCard { name: Secret, @@ -79,21 +46,16 @@ pub struct BamboraBrowserInfo { javascript_enabled: bool, } -#[derive(Default, Debug, Serialize)] +#[derive(Default, Debug, Serialize, Eq, PartialEq)] pub struct BamboraPaymentsRequest { order_number: String, - amount: f64, + amount: i64, payment_method: PaymentMethod, customer_ip: Option>, term_url: Option, card: BamboraCard, } -#[derive(Default, Debug, Serialize)] -pub struct BamboraVoidRequest { - amount: f64, -} - fn get_browser_info( item: &types::PaymentsAuthorizeRouterData, ) -> Result, error_stack::Report> { @@ -140,41 +102,41 @@ impl TryFrom<&types::CompleteAuthorizeData> for BamboraThreedsContinueRequest { } } -impl TryFrom> for BamboraPaymentsRequest { +impl TryFrom<&types::PaymentsAuthorizeRouterData> for BamboraPaymentsRequest { type Error = error_stack::Report; - fn try_from( - item: BamboraRouterData<&types::PaymentsAuthorizeRouterData>, - ) -> Result { - match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(req_card) => { - let three_ds = match item.router_data.auth_type { + fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { + match item.request.payment_method_data.clone() { + api::PaymentMethodData::Card(req_card) => { + let three_ds = match item.auth_type { enums::AuthenticationType::ThreeDs => Some(ThreeDSecure { enabled: true, - browser: get_browser_info(item.router_data)?, + browser: get_browser_info(item)?, version: Some(2), auth_required: Some(true), }), enums::AuthenticationType::NoThreeDs => None, }; let bambora_card = BamboraCard { - name: item.router_data.get_billing_address()?.get_full_name()?, - expiry_year: req_card.get_card_expiry_year_2_digit()?, + name: req_card + .card_holder_name + .unwrap_or(Secret::new("".to_string())), number: req_card.card_number, expiry_month: req_card.card_exp_month, + expiry_year: req_card.card_exp_year, cvd: req_card.card_cvc, three_d_secure: three_ds, - complete: item.router_data.request.is_auto_capture()?, + complete: item.request.is_auto_capture()?, }; - let browser_info = item.router_data.request.get_browser_info()?; + let browser_info = item.request.get_browser_info()?; Ok(Self { - order_number: item.router_data.connector_request_reference_id.clone(), - amount: item.amount, + order_number: item.connector_request_reference_id.clone(), + amount: item.request.amount, payment_method: PaymentMethod::Card, card: bambora_card, customer_ip: browser_info .ip_address .map(|ip_address| Secret::new(format!("{ip_address}"))), - term_url: item.router_data.request.complete_authorize_url.clone(), + term_url: item.request.complete_authorize_url.clone(), }) } _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()), @@ -182,13 +144,12 @@ impl TryFrom> for Bambora } } -impl TryFrom> for BamboraVoidRequest { +impl TryFrom<&types::PaymentsCancelRouterData> for BamboraPaymentsRequest { type Error = error_stack::Report; - fn try_from( - item: BamboraRouterData<&types::PaymentsCancelRouterData>, - ) -> Result { + fn try_from(_item: &types::PaymentsCancelRouterData) -> Result { Ok(Self { - amount: item.amount, + amount: 0, + ..Default::default() }) } } @@ -456,19 +417,15 @@ pub enum PaymentMethod { // Capture #[derive(Default, Debug, Clone, Serialize, PartialEq)] pub struct BamboraPaymentsCaptureRequest { - amount: Option, + amount: Option, payment_method: PaymentMethod, } -impl TryFrom> - for BamboraPaymentsCaptureRequest -{ +impl TryFrom<&types::PaymentsCaptureRouterData> for BamboraPaymentsCaptureRequest { type Error = error_stack::Report; - fn try_from( - item: BamboraRouterData<&types::PaymentsCaptureRouterData>, - ) -> Result { + fn try_from(item: &types::PaymentsCaptureRouterData) -> Result { Ok(Self { - amount: Some(item.amount), + amount: Some(item.request.amount_to_capture), payment_method: PaymentMethod::Card, }) } @@ -476,18 +433,16 @@ impl TryFrom> // REFUND : // Type definition for RefundRequest -#[derive(Default, Debug, Serialize)] +#[derive(Default, Debug, Serialize, Eq, PartialEq)] pub struct BamboraRefundRequest { - amount: f64, + amount: i64, } -impl TryFrom>> for BamboraRefundRequest { +impl TryFrom<&types::RefundsRouterData> for BamboraRefundRequest { type Error = error_stack::Report; - fn try_from( - item: BamboraRouterData<&types::RefundsRouterData>, - ) -> Result { + fn try_from(item: &types::RefundsRouterData) -> Result { Ok(Self { - amount: item.amount, + amount: item.request.refund_amount, }) } } diff --git a/crates/router/src/connector/bankofamerica.rs b/crates/router/src/connector/bankofamerica.rs index 0c01facf386..15c19622bc9 100644 --- a/crates/router/src/connector/bankofamerica.rs +++ b/crates/router/src/connector/bankofamerica.rs @@ -12,7 +12,7 @@ use time::OffsetDateTime; use transformers as bankofamerica; use url::Url; -use super::utils::{PaymentsAuthorizeRequestData, PaymentsSetupMandateRequestData, RouterData}; +use super::utils::{PaymentsAuthorizeRequestData, RouterData}; use crate::{ configs::settings, connector::{utils as connector_utils, utils::RefundsRequestData}, @@ -288,141 +288,19 @@ impl types::PaymentsResponseData, > for Bankofamerica { - fn get_headers( - &self, - req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - fn get_url( - &self, - req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - if req.is_three_ds() && req.request.is_card() { - Ok(format!( - "{}risk/v1/authentication-setups", - self.base_url(connectors) - )) - } else { - Ok(format!("{}pts/v2/payments/", self.base_url(connectors))) - } - } - fn get_request_body( - &self, - req: &types::SetupMandateRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - if req.is_three_ds() && req.request.is_card() { - let connector_req = bankofamerica::BankOfAmericaAuthSetupRequest::try_from(( - &req.request.payment_method_data, - req.connector_request_reference_id.clone(), - ))?; - Ok(RequestContent::Json(Box::new(connector_req))) - } else { - let connector_req = bankofamerica::BankOfAmericaPaymentsRequest::try_from(req)?; - Ok(RequestContent::Json(Box::new(connector_req))) - } - } - fn build_request( &self, - req: &types::RouterData< + _req: &types::RouterData< api::SetupMandate, types::SetupMandateRequestData, types::PaymentsResponseData, >, - connectors: &settings::Connectors, + _connectors: &settings::Connectors, ) -> CustomResult, errors::ConnectorError> { - Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::SetupMandateType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::SetupMandateType::get_headers(self, req, connectors)?) - .set_body(types::SetupMandateType::get_request_body( - self, req, connectors, - )?) - .build(), - )) - } - fn handle_response( - &self, - data: &types::SetupMandateRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult { - if data.is_three_ds() && data.request.is_card() { - let response: bankofamerica::BankOfAmericaAuthSetupResponse = res - .response - .parse_struct("Bankofamerica AuthSetupResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } else { - let response: bankofamerica::BankOfAmericaSetupMandatesResponse = res - .response - .parse_struct("BankOfAmericaSetupMandatesResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - } - - fn get_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } - - fn get_5xx_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - let response: bankofamerica::BankOfAmericaServerErrorResponse = res - .response - .parse_struct("BankOfAmericaServerErrorResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|event| event.set_response_body(&response)); - router_env::logger::info!(error_response=?response); - - let attempt_status = match response.reason { - Some(reason) => match reason { - transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure), - transformers::Reason::ServerTimeout | transformers::Reason::ServiceTimeout => None, - }, - None => None, - }; - Ok(ErrorResponse { - status_code: res.status_code, - reason: response.status.clone(), - code: response.status.unwrap_or(consts::NO_ERROR_CODE.to_string()), - message: response - .message - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), - attempt_status, - connector_transaction_id: None, - }) + Err(errors::ConnectorError::NotImplemented( + "Setup Mandate flow for Bankofamerica".to_string(), + ) + .into()) } } @@ -579,10 +457,8 @@ impl ConnectorIntegration>, - action_token_types: Option>, - authorization_options: Option, - commerce_indicator: String, capture: Option, - capture_options: Option, payment_solution: Option, -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum BankOfAmericaActionsList { - TokenCreate, -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub enum BankOfAmericaActionsTokenType { - PaymentInstrument, -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct BankOfAmericaAuthorizationOptions { - initiator: Option, - merchant_intitiated_transaction: Option, -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct BankOfAmericaPaymentInitiator { - #[serde(rename = "type")] - initiator_type: Option, - credential_stored_on_file: Option, - stored_credential_used: Option, -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub enum BankOfAmericaPaymentInitiatorTypes { - Customer, -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct MerchantInitiatedTransaction { - reason: Option, - //Required for recurring mandates payment - original_authorized_amount: Option, + commerce_indicator: String, } #[derive(Debug, Serialize)] @@ -175,11 +127,6 @@ pub struct CaptureOptions { total_capture_count: u32, } -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct BankOfAmericaPaymentInstrument { - id: Secret, -} - #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct CardPaymentInformation { @@ -218,13 +165,6 @@ pub enum PaymentInformation { GooglePay(GooglePayPaymentInformation), ApplePay(ApplePayPaymentInformation), ApplePayToken(ApplePayTokenPaymentInformation), - MandatePayment(MandatePaymentInformation), -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct MandatePaymentInformation { - payment_instrument: BankOfAmericaPaymentInstrument, } #[derive(Debug, Serialize)] @@ -258,7 +198,7 @@ pub struct FluidData { #[serde(rename_all = "camelCase")] pub struct OrderInformationWithBill { amount_details: Amount, - bill_to: Option, + bill_to: BillTo, } #[derive(Debug, Serialize)] @@ -281,170 +221,6 @@ pub struct BillTo { email: pii::Email, } -impl TryFrom<&types::SetupMandateRouterData> for BankOfAmericaPaymentsRequest { - type Error = error_stack::Report; - fn try_from(item: &types::SetupMandateRouterData) -> Result { - match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(card_data) => Self::try_from((item, card_data)), - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::ApplePay(apple_pay_data) => { - Self::try_from((item, apple_pay_data)) - } - domain::WalletData::GooglePay(google_pay_data) => { - Self::try_from((item, google_pay_data)) - } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("BankOfAmerica"), - ))?, - }, - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("BankOfAmerica"), - ))? - } - } - } -} - -impl - TryFrom< - types::ResponseRouterData< - F, - BankOfAmericaSetupMandatesResponse, - T, - types::PaymentsResponseData, - >, - > for types::RouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::ResponseRouterData< - F, - BankOfAmericaSetupMandatesResponse, - T, - types::PaymentsResponseData, - >, - ) -> Result { - match item.response { - BankOfAmericaSetupMandatesResponse::ClientReferenceInformation(info_response) => { - let mandate_reference = info_response.token_information.clone().map(|token_info| { - types::MandateReference { - connector_mandate_id: token_info - .payment_instrument - .map(|payment_instrument| payment_instrument.id.expose()), - payment_method_id: None, - } - }); - let mut mandate_status = - enums::AttemptStatus::foreign_from((info_response.status.clone(), false)); - if matches!(mandate_status, enums::AttemptStatus::Authorized) { - //In case of zero auth mandates we want to make the payment reach the terminal status so we are converting the authorized status to charged as well. - mandate_status = enums::AttemptStatus::Charged - } - let error_response = - get_error_response_if_failure((&info_response, mandate_status, item.http_code)); - - let connector_response = match item.data.payment_method { - common_enums::PaymentMethod::Card => info_response - .processor_information - .as_ref() - .and_then(|processor_information| { - info_response - .consumer_authentication_information - .as_ref() - .map(|consumer_auth_information| { - types::AdditionalPaymentMethodConnectorResponse::from(( - processor_information, - consumer_auth_information, - )) - }) - }) - .map(types::ConnectorResponseData::with_additional_payment_method_data), - common_enums::PaymentMethod::CardRedirect - | common_enums::PaymentMethod::PayLater - | common_enums::PaymentMethod::Wallet - | common_enums::PaymentMethod::BankRedirect - | common_enums::PaymentMethod::BankTransfer - | common_enums::PaymentMethod::Crypto - | common_enums::PaymentMethod::BankDebit - | common_enums::PaymentMethod::Reward - | common_enums::PaymentMethod::Upi - | common_enums::PaymentMethod::Voucher - | common_enums::PaymentMethod::GiftCard => None, - }; - - Ok(Self { - status: mandate_status, - response: match error_response { - Some(error) => Err(error), - None => Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - info_response.id.clone(), - ), - redirection_data: None, - mandate_reference, - connector_metadata: None, - network_txn_id: None, - connector_response_reference_id: Some( - info_response - .client_reference_information - .code - .clone() - .unwrap_or(info_response.id), - ), - incremental_authorization_allowed: None, - }), - }, - connector_response, - ..item.data - }) - } - BankOfAmericaSetupMandatesResponse::ErrorInformation(ref error_response) => { - let response = Err(types::ErrorResponse::from((error_response, item.http_code))); - Ok(Self { - response, - status: enums::AttemptStatus::Failure, - ..item.data - }) - } - } - } -} - // for bankofamerica each item in Billing is mandatory fn build_bill_to( address_details: &payments::Address, @@ -456,10 +232,9 @@ fn build_bill_to( .ok_or_else(utils::missing_field_err("billing.address"))?; let mut state = address.to_state_code()?.peek().clone(); state.truncate(20); - let first_name = address.get_first_name()?; Ok(BillTo { - first_name: first_name.clone(), - last_name: address.get_last_name().unwrap_or(first_name).clone(), + first_name: address.get_first_name()?.to_owned(), + last_name: address.get_last_name()?.to_owned(), address1: address.get_line1()?.to_owned(), locality: Secret::new(address.get_city()?.to_owned()), administrative_area: Secret::from(state), @@ -511,13 +286,13 @@ pub enum TransactionType { impl From<( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - Option, + BillTo, )> for OrderInformationWithBill { fn from( (item, bill_to): ( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - Option, + BillTo, ), ) -> Self { Self { @@ -547,86 +322,44 @@ impl total_amount: item.amount.to_owned(), currency: item.router_data.request.currency, }, - bill_to: Some(bill_to), + bill_to, } } } impl - TryFrom<( + From<( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, Option, Option, )> for ProcessingInformation { - type Error = error_stack::Report; - - fn try_from( + fn from( (item, solution, network): ( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, Option, Option, ), - ) -> Result { - let (action_list, action_token_types, authorization_options) = if item - .router_data - .request - .setup_future_usage - .map_or(false, |future_usage| { - matches!(future_usage, common_enums::FutureUsage::OffSession) - }) - && (item.router_data.request.customer_acceptance.is_some() - || item - .router_data - .request - .setup_mandate_details - .clone() - .map_or(false, |mandate_details| { - mandate_details.customer_acceptance.is_some() - })) { - get_boa_mandate_action_details() - } else if item.router_data.request.connector_mandate_id().is_some() { - let original_amount = item - .router_data - .get_recurring_mandate_payment_data()? - .get_original_payment_amount()?; - let original_currency = item - .router_data - .get_recurring_mandate_payment_data()? - .get_original_payment_currency()?; - ( - None, - None, - Some(BankOfAmericaAuthorizationOptions { - initiator: None, - merchant_intitiated_transaction: Some(MerchantInitiatedTransaction { - reason: None, - original_authorized_amount: Some(utils::get_amount_as_string( - &types::api::CurrencyUnit::Base, - original_amount, - original_currency, - )?), - }), - }), - ) - } else { - (None, None, None) - }; - - let commerce_indicator = get_commerce_indicator(network); - - Ok(Self { + ) -> Self { + let commerce_indicator = match network { + Some(card_network) => match card_network.to_lowercase().as_str() { + "amex" => "aesk", + "discover" => "dipb", + "mastercard" => "spa", + "visa" => "internet", + _ => "internet", + }, + None => "internet", + } + .to_string(); + Self { capture: Some(matches!( item.router_data.request.capture_method, Some(enums::CaptureMethod::Automatic) | None )), payment_solution: solution.map(String::from), - action_list, - action_token_types, - authorization_options, - capture_options: None, commerce_indicator, - }) + } } } @@ -644,42 +377,12 @@ impl &BankOfAmericaConsumerAuthValidateResponse, ), ) -> Self { - let (action_list, action_token_types, authorization_options) = - if is_customer_initiated_mandate_payment(&item.router_data.request) { - ( - Some(vec![BankOfAmericaActionsList::TokenCreate]), - Some(vec![BankOfAmericaActionsTokenType::PaymentInstrument]), - Some(BankOfAmericaAuthorizationOptions { - initiator: Some(BankOfAmericaPaymentInitiator { - initiator_type: Some(BankOfAmericaPaymentInitiatorTypes::Customer), - credential_stored_on_file: Some(true), - stored_credential_used: None, - }), - merchant_intitiated_transaction: None, - }), - ) - } else { - (None, None, None) - }; - - let is_setup_mandate_payment = is_setup_mandate_payment(&item.router_data.request); - - let capture = if is_setup_mandate_payment { - Some(false) - } else { - Some(matches!( + Self { + capture: Some(matches!( item.router_data.request.capture_method, Some(enums::CaptureMethod::Automatic) | None - )) - }; - - Self { - capture, + )), payment_solution: solution.map(String::from), - action_list, - action_token_types, - authorization_options, - capture_options: None, commerce_indicator: three_ds_data .indicator .to_owned() @@ -708,14 +411,6 @@ impl From<&BankOfAmericaRouterData<&types::PaymentsCompleteAuthorizeRouterData>> } } -impl From<&types::SetupMandateRouterData> for ClientReferenceInformation { - fn from(item: &types::SetupMandateRouterData) -> Self { - Self { - code: Some(item.connector_request_reference_id.clone()), - } - } -} - impl ForeignFrom for Vec { fn foreign_from(metadata: Value) -> Self { let hashmap: std::collections::BTreeMap = @@ -744,91 +439,12 @@ pub struct ClientReferenceInformation { #[serde(rename_all = "camelCase")] pub struct ClientProcessorInformation { avs: Option, - card_verification: Option, - processor: Option, - network_transaction_id: Option>, - approval_code: Option, - merchant_advice: Option, - response_code: Option, - ach_verification: Option, - system_trace_audit_number: Option, - event_status: Option, - retrieval_reference_number: Option, - consumer_authentication_response: Option, - response_details: Option, - transaction_id: Option>, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct MerchantAdvice { - code: Option, - code_raw: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ConsumerAuthenticationResponse { - code: Option, - code_raw: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct AchVerification { - result_code_raw: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ProcessorResponse { - name: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct CardVerification { - result_code: Option, - result_code_raw: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ClientRiskInformation { rules: Option>, - profile: Option, - score: Option, - info_codes: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct InfoCodes { - address: Option>, - identity_change: Option>, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Score { - factor_codes: Option>, - result: Option, - model_used: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(untagged)] -pub enum RiskResult { - StringVariant(String), - IntVariant(u64), -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Profile { - early_decision: Option, - name: Option, - decision: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] @@ -846,21 +462,35 @@ pub struct Avs { impl TryFrom<( &BankOfAmericaRouterData<&types::PaymentsCompleteAuthorizeRouterData>, - domain::Card, + payments::Card, )> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, ccard): ( &BankOfAmericaRouterData<&types::PaymentsCompleteAuthorizeRouterData>, - domain::Card, + payments::Card, ), ) -> Result { let email = item.router_data.request.get_email()?; let bill_to = build_bill_to(item.router_data.get_billing()?, email)?; let order_information = OrderInformationWithBill::from((item, bill_to)); - let payment_information = PaymentInformation::try_from(&ccard)?; + let card_issuer = ccard.get_card_issuer(); + let card_type = match card_issuer { + Ok(issuer) => Some(String::from(issuer)), + Err(_) => None, + }; + + let payment_information = PaymentInformation::Cards(CardPaymentInformation { + card: Card { + number: ccard.card_number, + expiration_month: ccard.card_exp_month, + expiration_year: ccard.card_exp_year, + security_code: ccard.card_cvc, + card_type, + }, + }); let client_reference_information = ClientReferenceInformation::from(item); let three_ds_info: BankOfAmericaThreeDSMetadata = item @@ -909,21 +539,34 @@ impl impl TryFrom<( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - domain::Card, + payments::Card, )> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, ccard): ( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - domain::Card, + payments::Card, ), ) -> Result { let email = item.router_data.request.get_email()?; let bill_to = build_bill_to(item.router_data.get_billing()?, email)?; - let order_information = OrderInformationWithBill::from((item, Some(bill_to))); - let payment_information = PaymentInformation::try_from(&ccard)?; - let processing_information = ProcessingInformation::try_from((item, None, None))?; + let order_information = OrderInformationWithBill::from((item, bill_to)); + let card_issuer = ccard.get_card_issuer(); + let card_type = match card_issuer { + Ok(issuer) => Some(String::from(issuer)), + Err(_) => None, + }; + let payment_information = PaymentInformation::Cards(CardPaymentInformation { + card: Card { + number: ccard.card_number, + expiration_month: ccard.card_exp_month, + expiration_year: ccard.card_exp_year, + security_code: ccard.card_cvc, + card_type, + }, + }); + let processing_information = ProcessingInformation::from((item, None, None)); let client_reference_information = ClientReferenceInformation::from(item); let merchant_defined_information = item.router_data.request.metadata.clone().map(|metadata| { @@ -945,7 +588,7 @@ impl TryFrom<( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, Box, - domain::ApplePayWalletData, + payments::ApplePayWalletData, )> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; @@ -953,19 +596,29 @@ impl (item, apple_pay_data, apple_pay_wallet_data): ( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, Box, - domain::ApplePayWalletData, + payments::ApplePayWalletData, ), ) -> Result { let email = item.router_data.request.get_email()?; let bill_to = build_bill_to(item.router_data.get_billing()?, email)?; - let order_information = OrderInformationWithBill::from((item, Some(bill_to))); - let processing_information = ProcessingInformation::try_from(( + let order_information = OrderInformationWithBill::from((item, bill_to)); + let processing_information = ProcessingInformation::from(( item, Some(PaymentSolution::ApplePay), Some(apple_pay_wallet_data.payment_method.network.clone()), - ))?; + )); let client_reference_information = ClientReferenceInformation::from(item); - let payment_information = PaymentInformation::try_from(&apple_pay_data)?; + let expiration_month = apple_pay_data.get_expiry_month()?; + let expiration_year = apple_pay_data.get_four_digit_expiry_year()?; + let payment_information = PaymentInformation::ApplePay(ApplePayPaymentInformation { + tokenized_card: TokenizedCard { + number: apple_pay_data.application_primary_account_number, + cryptogram: apple_pay_data.payment_data.online_payment_cryptogram, + transaction_type: TransactionType::ApplePay, + expiration_year, + expiration_month, + }, + }); let merchant_defined_information = item.router_data.request.metadata.clone().map(|metadata| { Vec::::foreign_from(metadata.peek().to_owned()) @@ -1000,22 +653,28 @@ impl impl TryFrom<( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - domain::GooglePayWalletData, + payments::GooglePayWalletData, )> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, google_pay_data): ( &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - domain::GooglePayWalletData, + payments::GooglePayWalletData, ), ) -> Result { let email = item.router_data.request.get_email()?; let bill_to = build_bill_to(item.router_data.get_billing()?, email)?; - let order_information = OrderInformationWithBill::from((item, Some(bill_to))); - let payment_information = PaymentInformation::from(&google_pay_data); + let order_information = OrderInformationWithBill::from((item, bill_to)); + let payment_information = PaymentInformation::GooglePay(GooglePayPaymentInformation { + fluid_data: FluidData { + value: Secret::from( + consts::BASE64_ENGINE.encode(google_pay_data.tokenization_data.token), + ), + }, + }); let processing_information = - ProcessingInformation::try_from((item, Some(PaymentSolution::GooglePay), None))?; + ProcessingInformation::from((item, Some(PaymentSolution::GooglePay), None)); let client_reference_information = ClientReferenceInformation::from(item); let merchant_defined_information = item.router_data.request.metadata.clone().map(|metadata| { @@ -1040,143 +699,126 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>> fn try_from( item: &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { - match item.router_data.request.connector_mandate_id() { - Some(connector_mandate_id) => Self::try_from((item, connector_mandate_id)), - None => { - match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::ApplePay(apple_pay_data) => { - match item.router_data.payment_method_token.clone() { - Some(payment_method_token) => match payment_method_token { - types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { - Self::try_from((item, decrypt_data, apple_pay_data)) - } - types::PaymentMethodToken::Token(_) => { - Err(unimplemented_payment_method!( - "Apple Pay", - "Manual", - "Bank Of America" - ))? - } - }, - None => { - let email = item.router_data.request.get_email()?; - let bill_to = - build_bill_to(item.router_data.get_billing()?, email)?; - let order_information: OrderInformationWithBill = - OrderInformationWithBill::from((item, Some(bill_to))); - let processing_information = - ProcessingInformation::try_from(( - item, - Some(PaymentSolution::ApplePay), - Some(apple_pay_data.payment_method.network.clone()), - ))?; - let client_reference_information = - ClientReferenceInformation::from(item); - let payment_information = - PaymentInformation::from(&apple_pay_data); - let merchant_defined_information = - item.router_data.request.metadata.clone().map(|metadata| { - Vec::::foreign_from( - metadata.peek().to_owned(), - ) - }); - let ucaf_collection_indicator = match apple_pay_data - .payment_method - .network - .to_lowercase() - .as_str() - { - "mastercard" => Some("2".to_string()), - _ => None, - }; - Ok(Self { - processing_information, - payment_information, - order_information, - merchant_defined_information, - client_reference_information, - consumer_authentication_information: Some( - BankOfAmericaConsumerAuthInformation { - ucaf_collection_indicator, - cavv: None, - ucaf_authentication_data: None, - xid: None, - directory_server_transaction_id: None, - specification_version: None, - }, - ), - }) - } + match item.router_data.request.payment_method_data.clone() { + payments::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), + payments::PaymentMethodData::Wallet(wallet_data) => match wallet_data { + payments::WalletData::ApplePay(apple_pay_data) => { + match item.router_data.payment_method_token.clone() { + Some(payment_method_token) => match payment_method_token { + types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { + Self::try_from((item, decrypt_data, apple_pay_data)) } - } - domain::WalletData::GooglePay(google_pay_data) => { - Self::try_from((item, google_pay_data)) - } - - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message( - "Bank of America", + types::PaymentMethodToken::Token(_) => { + Err(unimplemented_payment_method!( + "Apple Pay", + "Manual", + "Bank Of America" + ))? + } + }, + None => { + let email = item.router_data.request.get_email()?; + let bill_to = build_bill_to(item.router_data.get_billing()?, email)?; + let order_information = OrderInformationWithBill::from((item, bill_to)); + let processing_information = ProcessingInformation::from(( + item, + Some(PaymentSolution::ApplePay), + Some(apple_pay_data.payment_method.network.clone()), + )); + let client_reference_information = + ClientReferenceInformation::from(item); + let payment_information = PaymentInformation::ApplePayToken( + ApplePayTokenPaymentInformation { + fluid_data: FluidData { + value: Secret::from(apple_pay_data.payment_data), + }, + tokenized_card: ApplePayTokenizedCard { + transaction_type: TransactionType::ApplePay, + }, + }, + ); + let merchant_defined_information = + item.router_data.request.metadata.clone().map(|metadata| { + Vec::::foreign_from( + metadata.peek().to_owned(), + ) + }); + let ucaf_collection_indicator = match apple_pay_data + .payment_method + .network + .to_lowercase() + .as_str() + { + "mastercard" => Some("2".to_string()), + _ => None, + }; + Ok(Self { + processing_information, + payment_information, + order_information, + merchant_defined_information, + client_reference_information, + consumer_authentication_information: Some( + BankOfAmericaConsumerAuthInformation { + ucaf_collection_indicator, + cavv: None, + ucaf_authentication_data: None, + xid: None, + directory_server_transaction_id: None, + specification_version: None, + }, ), - ) - .into()) + }) } - }, - // If connector_mandate_id is present MandatePayment will be the PMD, the case will be handled in the first `if` clause. - // This is a fallback implementation in the event of catastrophe. - domain::PaymentMethodData::MandatePayment => { - let connector_mandate_id = - item.router_data.request.connector_mandate_id().ok_or( - errors::ConnectorError::MissingRequiredField { - field_name: "connector_mandate_id", - }, - )?; - Self::try_from((item, connector_mandate_id)) - } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message( - "Bank of America", - ), - ) - .into()) } } + payments::WalletData::GooglePay(google_pay_data) => { + Self::try_from((item, google_pay_data)) + } + payments::WalletData::AliPayQr(_) + | payments::WalletData::AliPayRedirect(_) + | payments::WalletData::AliPayHkRedirect(_) + | payments::WalletData::MomoRedirect(_) + | payments::WalletData::KakaoPayRedirect(_) + | payments::WalletData::GoPayRedirect(_) + | payments::WalletData::GcashRedirect(_) + | payments::WalletData::ApplePayRedirect(_) + | payments::WalletData::ApplePayThirdPartySdk(_) + | payments::WalletData::DanaRedirect {} + | payments::WalletData::GooglePayRedirect(_) + | payments::WalletData::GooglePayThirdPartySdk(_) + | payments::WalletData::MbWayRedirect(_) + | payments::WalletData::MobilePayRedirect(_) + | payments::WalletData::PaypalRedirect(_) + | payments::WalletData::PaypalSdk(_) + | payments::WalletData::SamsungPay(_) + | payments::WalletData::TwintRedirect {} + | payments::WalletData::VippsRedirect {} + | payments::WalletData::TouchNGoRedirect(_) + | payments::WalletData::WeChatPayRedirect(_) + | payments::WalletData::WeChatPayQr(_) + | payments::WalletData::CashappQr(_) + | payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Bank of America"), + ) + .into()), + }, + payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Bank of America"), + ) + .into()) } } } @@ -1189,38 +831,50 @@ pub struct BankOfAmericaAuthSetupRequest { client_reference_information: ClientReferenceInformation, } -impl TryFrom<(&domain::PaymentMethodData, String)> for BankOfAmericaAuthSetupRequest { +impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>> + for BankOfAmericaAuthSetupRequest +{ type Error = error_stack::Report; fn try_from( - (payment_method_data, connector_request_reference_id): (&domain::PaymentMethodData, String), + item: &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { - match payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => { - let payment_information = PaymentInformation::try_from(&ccard)?; - let client_reference_information = ClientReferenceInformation { - code: Some(connector_request_reference_id), + match item.router_data.request.payment_method_data.clone() { + payments::PaymentMethodData::Card(ccard) => { + let card_issuer = ccard.get_card_issuer(); + let card_type = match card_issuer { + Ok(issuer) => Some(String::from(issuer)), + Err(_) => None, }; - + let payment_information = PaymentInformation::Cards(CardPaymentInformation { + card: Card { + number: ccard.card_number, + expiration_month: ccard.card_exp_month, + expiration_year: ccard.card_exp_year, + security_code: ccard.card_cvc, + card_type, + }, + }); + let client_reference_information = ClientReferenceInformation::from(item); Ok(Self { payment_information, client_reference_information, }) } - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::Wallet(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Bank Of America"), + utils::get_unimplemented_payment_method_error_message("BankOfAmerica"), ) .into()) } @@ -1228,49 +882,6 @@ impl TryFrom<(&domain::PaymentMethodData, String)> for BankOfAmericaAuthSetupReq } } -impl - TryFrom<( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - String, - )> for BankOfAmericaPaymentsRequest -{ - type Error = error_stack::Report; - fn try_from( - (item, connector_mandate_id): ( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - String, - ), - ) -> Result { - let processing_information = ProcessingInformation::try_from((item, None, None))?; - let payment_instrument = BankOfAmericaPaymentInstrument { - id: connector_mandate_id.into(), - }; - let email = item.router_data.request.get_email().ok(); - let bill_to = email.and_then(|email_id| { - item.router_data - .get_billing() - .ok() - .and_then(|billing_details| build_bill_to(billing_details, email_id).ok()) - }); - let order_information = OrderInformationWithBill::from((item, bill_to)); - let payment_information = - PaymentInformation::MandatePayment(MandatePaymentInformation { payment_instrument }); - let client_reference_information = ClientReferenceInformation::from(item); - let merchant_defined_information = - item.router_data.request.metadata.clone().map(|metadata| { - Vec::::foreign_from(metadata.peek().to_owned()) - }); - Ok(Self { - processing_information, - payment_information, - order_information, - client_reference_information, - merchant_defined_information, - consumer_authentication_information: None, - }) - } -} - #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum BankofamericaPaymentStatus { @@ -1322,218 +933,57 @@ impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus { | BankofamericaPaymentStatus::Cancelled => Self::Voided, BankofamericaPaymentStatus::Failed | BankofamericaPaymentStatus::Declined - | BankofamericaPaymentStatus::AuthorizedRiskDeclined - | BankofamericaPaymentStatus::InvalidRequest - | BankofamericaPaymentStatus::Rejected - | BankofamericaPaymentStatus::ServerError => Self::Failure, - BankofamericaPaymentStatus::PendingAuthentication => Self::AuthenticationPending, - BankofamericaPaymentStatus::PendingReview - | BankofamericaPaymentStatus::Challenge - | BankofamericaPaymentStatus::Accepted => Self::Pending, - } - } -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct BankOfAmericaConsumerAuthInformationResponse { - access_token: Secret, - device_data_collection_url: Secret, - reference_id: String, -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ClientAuthSetupInfoResponse { - id: String, - client_reference_information: ClientReferenceInformation, - consumer_authentication_information: BankOfAmericaConsumerAuthInformationResponse, - processor_information: Option, - processing_information: Option, - payment_account_information: Option, - payment_information: Option, - payment_insights_information: Option, - risk_information: Option, - token_information: Option, - error_information: Option, - issuer_information: Option, - reconciliation_id: Option, -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum BankOfAmericaAuthSetupResponse { - ClientAuthSetupInfo(Box), - ErrorInformation(BankOfAmericaErrorInformationResponse), -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum BankOfAmericaPaymentsResponse { - ClientReferenceInformation(Box), - ErrorInformation(BankOfAmericaErrorInformationResponse), -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum BankOfAmericaSetupMandatesResponse { - ClientReferenceInformation(Box), - ErrorInformation(BankOfAmericaErrorInformationResponse), -} - -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct BankOfAmericaClientReferenceResponse { - id: String, - status: BankofamericaPaymentStatus, - client_reference_information: ClientReferenceInformation, - processor_information: Option, - processing_information: Option, - payment_information: Option, - payment_insights_information: Option, - risk_information: Option, - token_information: Option, - error_information: Option, - issuer_information: Option, - sender_information: Option, - payment_account_information: Option, - reconciliation_id: Option, - consumer_authentication_information: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ConsumerAuthenticationInformation { - eci_raw: Option, - eci: Option, - acs_transaction_id: Option, - cavv: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct SenderInformation { - payment_information: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct PaymentInsightsInformation { - response_insights: Option, - rule_results: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ResponseInsights { - category_code: Option, - category: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct RuleResults { - id: Option, - decision: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct PaymentInformationResponse { - tokenized_card: Option, - customer: Option, - card: Option, - scheme: Option, - bin: Option, - account_type: Option, - issuer: Option, - bin_country: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct CustomerResponseObject { - customer_id: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct PaymentAccountInformation { - card: Option, - features: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct PaymentAccountFeatureInformation { - health_card: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct PaymentAccountCardInformation { - #[serde(rename = "type")] - card_type: Option, - hashed_number: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ProcessingInformationResponse { - payment_solution: Option, - commerce_indicator: Option, - commerce_indicator_label: Option, - authorization_options: Option, - ecommerce_indicator: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct AuthorizationOptions { - auth_type: Option, - initiator: Option, + | BankofamericaPaymentStatus::AuthorizedRiskDeclined + | BankofamericaPaymentStatus::InvalidRequest + | BankofamericaPaymentStatus::Rejected + | BankofamericaPaymentStatus::ServerError => Self::Failure, + BankofamericaPaymentStatus::PendingAuthentication => Self::AuthenticationPending, + BankofamericaPaymentStatus::PendingReview + | BankofamericaPaymentStatus::Challenge + | BankofamericaPaymentStatus::Accepted => Self::Pending, + } + } } -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] -pub struct Initiator { - merchant_initiated_transaction: Option, +pub struct BankOfAmericaConsumerAuthInformationResponse { + access_token: Secret, + device_data_collection_url: Secret, + reference_id: String, } -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] -pub struct MerchantInitiatedTransactionResponse { - agreement_id: Option, - previous_transaction_id: Option, - original_authorized_amount: Option, - reason: Option, +pub struct ClientAuthSetupInfoResponse { + id: String, + client_reference_information: ClientReferenceInformation, + consumer_authentication_information: BankOfAmericaConsumerAuthInformationResponse, } -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct BankOfAmericaTokenInformation { - payment_instrument: Option, +#[derive(Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum BankOfAmericaAuthSetupResponse { + ClientAuthSetupInfo(ClientAuthSetupInfoResponse), + ErrorInformation(BankOfAmericaErrorInformationResponse), } -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct IssuerInformation { - country: Option, - discretionary_data: Option, - country_specific_discretionary_data: Option, - response_code: Option, - pin_request_indicator: Option, +#[derive(Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum BankOfAmericaPaymentsResponse { + ClientReferenceInformation(BankOfAmericaClientReferenceResponse), + ErrorInformation(BankOfAmericaErrorInformationResponse), } -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] -pub struct CardResponseObject { - suffix: Option, - prefix: Option, - expiration_month: Option>, - expiration_year: Option>, - #[serde(rename = "type")] - card_type: Option, +pub struct BankOfAmericaClientReferenceResponse { + id: String, + status: BankofamericaPaymentStatus, + client_reference_information: ClientReferenceInformation, + processor_information: Option, + risk_information: Option, + error_information: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1627,53 +1077,43 @@ fn get_payment_response( let error_response = get_error_response_if_failure((info_response, status, http_code)); match error_response { Some(error) => Err(error), - None => { - let mandate_reference = + None => Ok(types::PaymentsResponseData::TransactionResponse { + resource_id: types::ResponseId::ConnectorTransactionId(info_response.id.clone()), + redirection_data: None, + mandate_reference: None, + connector_metadata: info_response + .processor_information + .as_ref() + .map(|processor_information| serde_json::json!({"avs_response": processor_information.avs})), + network_txn_id: None, + connector_response_reference_id: Some( info_response - .token_information + .client_reference_information + .code .clone() - .map(|token_info| types::MandateReference { - connector_mandate_id: token_info - .payment_instrument - .map(|payment_instrument| payment_instrument.id.expose()), - payment_method_id: None, - }); - - Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(info_response.id.clone()), - redirection_data: None, - mandate_reference, - connector_metadata: None, - network_txn_id: None, - connector_response_reference_id: Some( - info_response - .client_reference_information - .code - .clone() - .unwrap_or(info_response.id.clone()), - ), - incremental_authorization_allowed: None, - }) - } + .unwrap_or(info_response.id.clone()), + ), + incremental_authorization_allowed: None, + }), } } -impl +impl TryFrom< types::ResponseRouterData< F, BankOfAmericaAuthSetupResponse, - T, + types::PaymentsAuthorizeData, types::PaymentsResponseData, >, - > for types::RouterData + > for types::RouterData { type Error = error_stack::Report; fn try_from( item: types::ResponseRouterData< F, BankOfAmericaAuthSetupResponse, - T, + types::PaymentsAuthorizeData, types::PaymentsResponseData, >, ) -> Result { @@ -1792,24 +1232,38 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsPreProcessingRouterData>> }, )?; let payment_information = match payment_method_data { - domain::PaymentMethodData::Card(ccard) => PaymentInformation::try_from(&ccard), - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::Card(ccard) => { + let card_issuer = ccard.get_card_issuer(); + let card_type = match card_issuer { + Ok(issuer) => Some(String::from(issuer)), + Err(_) => None, + }; + Ok(PaymentInformation::Cards(CardPaymentInformation { + card: Card { + number: ccard.card_number, + expiration_month: ccard.card_exp_month, + expiration_year: ccard.card_exp_year, + security_code: ccard.card_cvc, + card_type, + }, + })) + } + payments::PaymentMethodData::Wallet(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("BankOfAmerica"), - ) - .into()) + )) } }?; @@ -1843,7 +1297,7 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsPreProcessingRouterData>> let bill_to = build_bill_to(item.router_data.get_billing()?, email)?; let order_information = OrderInformationWithBill { amount_details, - bill_to: Some(bill_to), + bill_to, }; Ok(Self::AuthEnrollment(BankOfAmericaAuthEnrollmentRequest { payment_information, @@ -1894,20 +1348,20 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsCompleteAuthorizeRouterDat }, )?; match payment_method_data { - domain::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), + payments::PaymentMethodData::Wallet(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("BankOfAmerica"), ) @@ -2065,7 +1519,22 @@ impl } } BankOfAmericaPreProcessingResponse::ErrorInformation(ref error_response) => { - let response = Err(types::ErrorResponse::from((error_response, item.http_code))); + let error_reason = error_response + .error_information + .message + .to_owned() + .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()); + let error_message = error_response.error_information.reason.to_owned(); + let response = Err(types::ErrorResponse { + code: error_message + .clone() + .unwrap_or(consts::NO_ERROR_CODE.to_string()), + message: error_message.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + reason: Some(error_reason), + status_code: item.http_code, + attempt_status: None, + connector_transaction_id: Some(error_response.id.clone()), + }); Ok(Self { response, status: enums::AttemptStatus::AuthenticationFailed, @@ -2099,43 +1568,12 @@ impl BankOfAmericaPaymentsResponse::ClientReferenceInformation(info_response) => { let status = enums::AttemptStatus::foreign_from(( info_response.status.clone(), - item.data.request.is_auto_capture()? - || is_setup_mandate_payment(&item.data.request), + item.data.request.is_auto_capture()?, )); let response = get_payment_response((&info_response, status, item.http_code)); - let connector_response = match item.data.payment_method { - common_enums::PaymentMethod::Card => info_response - .processor_information - .as_ref() - .and_then(|processor_information| { - info_response - .consumer_authentication_information - .as_ref() - .map(|consumer_auth_information| { - types::AdditionalPaymentMethodConnectorResponse::from(( - processor_information, - consumer_auth_information, - )) - }) - }) - .map(types::ConnectorResponseData::with_additional_payment_method_data), - common_enums::PaymentMethod::CardRedirect - | common_enums::PaymentMethod::PayLater - | common_enums::PaymentMethod::Wallet - | common_enums::PaymentMethod::BankRedirect - | common_enums::PaymentMethod::BankTransfer - | common_enums::PaymentMethod::Crypto - | common_enums::PaymentMethod::BankDebit - | common_enums::PaymentMethod::Reward - | common_enums::PaymentMethod::Upi - | common_enums::PaymentMethod::Voucher - | common_enums::PaymentMethod::GiftCard => None, - }; - Ok(Self { status, response, - connector_response, ..item.data }) } @@ -2176,39 +1614,9 @@ impl item.data.request.is_auto_capture()?, )); let response = get_payment_response((&info_response, status, item.http_code)); - let connector_response = match item.data.payment_method { - common_enums::PaymentMethod::Card => info_response - .processor_information - .as_ref() - .and_then(|processor_information| { - info_response - .consumer_authentication_information - .as_ref() - .map(|consumer_auth_information| { - types::AdditionalPaymentMethodConnectorResponse::from(( - processor_information, - consumer_auth_information, - )) - }) - }) - .map(types::ConnectorResponseData::with_additional_payment_method_data), - common_enums::PaymentMethod::CardRedirect - | common_enums::PaymentMethod::PayLater - | common_enums::PaymentMethod::Wallet - | common_enums::PaymentMethod::BankRedirect - | common_enums::PaymentMethod::BankTransfer - | common_enums::PaymentMethod::Crypto - | common_enums::PaymentMethod::BankDebit - | common_enums::PaymentMethod::Reward - | common_enums::PaymentMethod::Upi - | common_enums::PaymentMethod::Voucher - | common_enums::PaymentMethod::GiftCard => None, - }; - Ok(Self { status, response, - connector_response, ..item.data }) } @@ -2223,43 +1631,6 @@ impl } } -impl - From<( - &ClientProcessorInformation, - &ConsumerAuthenticationInformation, - )> for types::AdditionalPaymentMethodConnectorResponse -{ - fn from( - item: ( - &ClientProcessorInformation, - &ConsumerAuthenticationInformation, - ), - ) -> Self { - let processor_information = item.0; - let consumer_authentication_information = item.1; - let payment_checks = Some(serde_json::json!({ - "avs_response": processor_information.avs, - "card_verification": processor_information.card_verification, - "approval_code": processor_information.approval_code, - "consumer_authentication_response": processor_information.consumer_authentication_response, - "cavv": consumer_authentication_information.cavv, - "eci": consumer_authentication_information.eci, - "eci_raw": consumer_authentication_information.eci_raw, - })); - - let authentication_data = Some(serde_json::json!({ - "retrieval_reference_number": processor_information.retrieval_reference_number, - "acs_transaction_id": consumer_authentication_information.acs_transaction_id, - "system_trace_audit_number": processor_information.system_trace_audit_number, - })); - - Self::Card { - authentication_data, - payment_checks, - } - } -} - impl TryFrom< types::ResponseRouterData< @@ -2337,7 +1708,7 @@ impl #[derive(Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum BankOfAmericaTransactionResponse { - ApplicationInformation(Box), + ApplicationInformation(BankOfAmericaApplicationInfoResponse), ErrorInformation(BankOfAmericaErrorInformationResponse), } @@ -2347,22 +1718,7 @@ pub struct BankOfAmericaApplicationInfoResponse { id: String, application_information: ApplicationInformation, client_reference_information: Option, - processor_information: Option, - processing_information: Option, - payment_information: Option, - payment_insights_information: Option, error_information: Option, - fraud_marking_information: Option, - risk_information: Option, - token_information: Option, - reconciliation_id: Option, - consumer_authentication_information: Option, -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct FraudMarkingInformation { - reason: Option, } #[derive(Debug, Deserialize, Serialize)] @@ -2396,36 +1752,6 @@ impl app_response.application_information.status, item.data.request.is_auto_capture()?, )); - - let connector_response = match item.data.payment_method { - common_enums::PaymentMethod::Card => app_response - .processor_information - .as_ref() - .and_then(|processor_information| { - app_response - .consumer_authentication_information - .as_ref() - .map(|consumer_auth_information| { - types::AdditionalPaymentMethodConnectorResponse::from(( - processor_information, - consumer_auth_information, - )) - }) - }) - .map(types::ConnectorResponseData::with_additional_payment_method_data), - common_enums::PaymentMethod::CardRedirect - | common_enums::PaymentMethod::PayLater - | common_enums::PaymentMethod::Wallet - | common_enums::PaymentMethod::BankRedirect - | common_enums::PaymentMethod::BankTransfer - | common_enums::PaymentMethod::Crypto - | common_enums::PaymentMethod::BankDebit - | common_enums::PaymentMethod::Reward - | common_enums::PaymentMethod::Upi - | common_enums::PaymentMethod::Voucher - | common_enums::PaymentMethod::GiftCard => None, - }; - let risk_info: Option = None; if utils::is_payment_failure(status) { Ok(Self { @@ -2436,7 +1762,6 @@ impl app_response.id.clone(), ))), status: enums::AttemptStatus::Failure, - connector_response, ..item.data }) } else { @@ -2456,7 +1781,6 @@ impl .unwrap_or(Some(app_response.id)), incremental_authorization_allowed: None, }), - connector_response, ..item.data }) } @@ -2791,283 +2115,3 @@ impl } } } - -impl TryFrom<(&types::SetupMandateRouterData, domain::Card)> for BankOfAmericaPaymentsRequest { - type Error = error_stack::Report; - fn try_from( - (item, ccard): (&types::SetupMandateRouterData, domain::Card), - ) -> Result { - let order_information = OrderInformationWithBill::try_from(item)?; - let client_reference_information = ClientReferenceInformation::from(item); - let merchant_defined_information = item.request.metadata.clone().map(|metadata| { - Vec::::foreign_from(metadata.peek().to_owned()) - }); - let payment_information = PaymentInformation::try_from(&ccard)?; - let processing_information = ProcessingInformation::try_from((None, None))?; - Ok(Self { - processing_information, - payment_information, - order_information, - client_reference_information, - consumer_authentication_information: None, - merchant_defined_information, - }) - } -} - -impl TryFrom<(&types::SetupMandateRouterData, domain::ApplePayWalletData)> - for BankOfAmericaPaymentsRequest -{ - type Error = error_stack::Report; - fn try_from( - (item, apple_pay_data): (&types::SetupMandateRouterData, domain::ApplePayWalletData), - ) -> Result { - let order_information = OrderInformationWithBill::try_from(item)?; - let client_reference_information = ClientReferenceInformation::from(item); - let merchant_defined_information = item.request.metadata.clone().map(|metadata| { - Vec::::foreign_from(metadata.peek().to_owned()) - }); - let payment_information = match item.payment_method_token.clone() { - Some(payment_method_token) => match payment_method_token { - types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { - PaymentInformation::try_from(&decrypt_data)? - } - types::PaymentMethodToken::Token(_) => Err(unimplemented_payment_method!( - "Apple Pay", - "Manual", - "Bank Of America" - ))?, - }, - None => PaymentInformation::from(&apple_pay_data), - }; - let processing_information = ProcessingInformation::try_from(( - Some(PaymentSolution::ApplePay), - Some(apple_pay_data.payment_method.network.clone()), - ))?; - let ucaf_collection_indicator = match apple_pay_data - .payment_method - .network - .to_lowercase() - .as_str() - { - "mastercard" => Some("2".to_string()), - _ => None, - }; - let consumer_authentication_information = Some(BankOfAmericaConsumerAuthInformation { - ucaf_collection_indicator, - cavv: None, - ucaf_authentication_data: None, - xid: None, - directory_server_transaction_id: None, - specification_version: None, - }); - - Ok(Self { - processing_information, - payment_information, - order_information, - client_reference_information, - merchant_defined_information, - consumer_authentication_information, - }) - } -} - -impl TryFrom<(&types::SetupMandateRouterData, domain::GooglePayWalletData)> - for BankOfAmericaPaymentsRequest -{ - type Error = error_stack::Report; - fn try_from( - (item, google_pay_data): (&types::SetupMandateRouterData, domain::GooglePayWalletData), - ) -> Result { - let order_information = OrderInformationWithBill::try_from(item)?; - let client_reference_information = ClientReferenceInformation::from(item); - let merchant_defined_information = item.request.metadata.clone().map(|metadata| { - Vec::::foreign_from(metadata.peek().to_owned()) - }); - let payment_information = PaymentInformation::from(&google_pay_data); - let processing_information = - ProcessingInformation::try_from((Some(PaymentSolution::GooglePay), None))?; - - Ok(Self { - processing_information, - payment_information, - order_information, - client_reference_information, - merchant_defined_information, - consumer_authentication_information: None, - }) - } -} - -// specific for setupMandate flow -impl TryFrom<(Option, Option)> for ProcessingInformation { - type Error = error_stack::Report; - fn try_from( - (solution, network): (Option, Option), - ) -> Result { - let (action_list, action_token_types, authorization_options) = - get_boa_mandate_action_details(); - let commerce_indicator = get_commerce_indicator(network); - - Ok(Self { - capture: Some(false), - capture_options: None, - action_list, - action_token_types, - authorization_options, - commerce_indicator, - payment_solution: solution.map(String::from), - }) - } -} - -impl TryFrom<&types::SetupMandateRouterData> for OrderInformationWithBill { - type Error = error_stack::Report; - - fn try_from(item: &types::SetupMandateRouterData) -> Result { - let email = item.request.get_email()?; - let bill_to = build_bill_to(item.get_billing()?, email)?; - - Ok(Self { - amount_details: Amount { - total_amount: "0".to_string(), - currency: item.request.currency, - }, - bill_to: Some(bill_to), - }) - } -} - -impl TryFrom<&domain::Card> for PaymentInformation { - type Error = error_stack::Report; - - fn try_from(ccard: &domain::Card) -> Result { - let card_issuer = ccard.get_card_issuer(); - let card_type = match card_issuer { - Ok(issuer) => Some(String::from(issuer)), - Err(_) => None, - }; - Ok(Self::Cards(CardPaymentInformation { - card: Card { - number: ccard.card_number.clone(), - expiration_month: ccard.card_exp_month.clone(), - expiration_year: ccard.card_exp_year.clone(), - security_code: ccard.card_cvc.clone(), - card_type, - }, - })) - } -} - -impl TryFrom<&Box> for PaymentInformation { - type Error = error_stack::Report; - - fn try_from(apple_pay_data: &Box) -> Result { - let expiration_month = apple_pay_data.get_expiry_month()?; - let expiration_year = apple_pay_data.get_four_digit_expiry_year()?; - - Ok(Self::ApplePay(ApplePayPaymentInformation { - tokenized_card: TokenizedCard { - number: apple_pay_data.application_primary_account_number.clone(), - cryptogram: apple_pay_data - .payment_data - .online_payment_cryptogram - .clone(), - transaction_type: TransactionType::ApplePay, - expiration_year, - expiration_month, - }, - })) - } -} - -impl From<&domain::ApplePayWalletData> for PaymentInformation { - fn from(apple_pay_data: &domain::ApplePayWalletData) -> Self { - Self::ApplePayToken(ApplePayTokenPaymentInformation { - fluid_data: FluidData { - value: Secret::from(apple_pay_data.payment_data.clone()), - }, - tokenized_card: ApplePayTokenizedCard { - transaction_type: TransactionType::ApplePay, - }, - }) - } -} - -impl From<&domain::GooglePayWalletData> for PaymentInformation { - fn from(google_pay_data: &domain::GooglePayWalletData) -> Self { - Self::GooglePay(GooglePayPaymentInformation { - fluid_data: FluidData { - value: Secret::from( - consts::BASE64_ENGINE.encode(google_pay_data.tokenization_data.token.clone()), - ), - }, - }) - } -} - -impl From<(&BankOfAmericaErrorInformationResponse, u16)> for types::ErrorResponse { - fn from((error_response, status_code): (&BankOfAmericaErrorInformationResponse, u16)) -> Self { - let error_reason = error_response - .error_information - .message - .to_owned() - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()); - let error_message = error_response.error_information.reason.to_owned(); - Self { - code: error_message - .clone() - .unwrap_or(consts::NO_ERROR_CODE.to_string()), - message: error_message.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), - reason: Some(error_reason), - status_code, - attempt_status: None, - connector_transaction_id: Some(error_response.id.clone()), - } - } -} - -fn get_boa_mandate_action_details() -> ( - Option>, - Option>, - Option, -) { - ( - Some(vec![BankOfAmericaActionsList::TokenCreate]), - Some(vec![BankOfAmericaActionsTokenType::PaymentInstrument]), - Some(BankOfAmericaAuthorizationOptions { - initiator: Some(BankOfAmericaPaymentInitiator { - initiator_type: Some(BankOfAmericaPaymentInitiatorTypes::Customer), - credential_stored_on_file: Some(true), - stored_credential_used: None, - }), - merchant_intitiated_transaction: None, - }), - ) -} - -fn get_commerce_indicator(network: Option) -> String { - match network { - Some(card_network) => match card_network.to_lowercase().as_str() { - "amex" => "aesk", - "discover" => "dipb", - "mastercard" => "spa", - "visa" => "internet", - _ => "internet", - }, - None => "internet", - } - .to_string() -} - -fn is_setup_mandate_payment(item: &types::CompleteAuthorizeData) -> bool { - matches!(item.amount, 0) && is_customer_initiated_mandate_payment(item) -} - -fn is_customer_initiated_mandate_payment(item: &types::CompleteAuthorizeData) -> bool { - item.setup_future_usage.map_or(false, |future_usage| { - matches!(future_usage, common_enums::FutureUsage::OffSession) - }) - // add check for customer_acceptance -} diff --git a/crates/router/src/connector/billwerk.rs b/crates/router/src/connector/billwerk.rs index b6839f5de24..154b729abc9 100644 --- a/crates/router/src/connector/billwerk.rs +++ b/crates/router/src/connector/billwerk.rs @@ -2,15 +2,12 @@ pub mod transformers; use std::fmt::Debug; -use base64::Engine; use error_stack::{report, ResultExt}; -use masking::PeekInterface; +use masking::ExposeInterface; use transformers as billwerk; -use super::utils::RefundsRequestData; use crate::{ configs::settings, - consts, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, @@ -43,6 +40,16 @@ impl api::RefundExecute for Billwerk {} impl api::RefundSync for Billwerk {} impl api::PaymentToken for Billwerk {} +impl + ConnectorIntegration< + api::PaymentMethodToken, + types::PaymentMethodTokenizationData, + types::PaymentsResponseData, + > for Billwerk +{ + // Not Implemented (R) +} + impl ConnectorCommonExt for Billwerk where Self: ConnectorIntegration, @@ -85,10 +92,9 @@ impl ConnectorCommon for Billwerk { ) -> CustomResult)>, errors::ConnectorError> { let auth = billwerk::BillwerkAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; - let encoded_api_key = consts::BASE64_ENGINE.encode(format!("{}:", auth.api_key.peek())); Ok(vec![( headers::AUTHORIZATION.to_string(), - format!("Basic {encoded_api_key}").into_masked(), + auth.api_key.expose().into_masked(), )]) } @@ -107,13 +113,9 @@ impl ConnectorCommon for Billwerk { Ok(ErrorResponse { status_code: res.status_code, - code: response - .code - .map_or(consts::NO_ERROR_CODE.to_string(), |code| code.to_string()), - message: response - .message - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), - reason: Some(response.error), + code: response.code, + message: response.message, + reason: response.reason, attempt_status: None, connector_transaction_id: None, }) @@ -121,20 +123,7 @@ impl ConnectorCommon for Billwerk { } impl ConnectorValidation for Billwerk { - fn validate_capture_method( - &self, - capture_method: Option, - _pmt: Option, - ) -> CustomResult<(), errors::ConnectorError> { - let capture_method = capture_method.unwrap_or_default(); - match capture_method { - common_enums::CaptureMethod::Automatic | common_enums::CaptureMethod::Manual => Ok(()), - common_enums::CaptureMethod::ManualMultiple - | common_enums::CaptureMethod::Scheduled => Err( - super::utils::construct_not_implemented_error_report(capture_method, self.id()), - ), - } - } + //TODO: implement functions when support enabled } impl ConnectorIntegration @@ -157,105 +146,6 @@ impl { } -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Billwerk -{ - fn get_headers( - &self, - req: &types::TokenizationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - _req: &types::TokenizationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - let base_url = connectors - .billwerk - .secondary_base_url - .as_ref() - .ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?; - Ok(format!("{base_url}v1/token")) - } - - fn get_request_body( - &self, - req: &types::TokenizationRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_req = billwerk::BillwerkTokenRequest::try_from(req)?; - Ok(RequestContent::Json(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::TokenizationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::TokenizationType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::TokenizationType::get_headers(self, req, connectors)?) - .set_body(types::TokenizationType::get_request_body( - self, req, connectors, - )?) - .build(), - )) - } - - fn handle_response( - &self, - data: &types::TokenizationRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult - where - types::PaymentsResponseData: Clone, - { - let response: billwerk::BillwerkTokenResponse = res - .response - .parse_struct("BillwerkTokenResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - .change_context(errors::ConnectorError::ResponseHandlingFailed) - } - - fn get_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } - - fn get_5xx_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - impl ConnectorIntegration for Billwerk { @@ -274,9 +164,9 @@ impl ConnectorIntegration CustomResult { - Ok(format!("{}v1/charge", self.base_url(connectors))) + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) } fn get_request_body( @@ -324,7 +214,7 @@ impl ConnectorIntegration CustomResult { let response: billwerk::BillwerkPaymentsResponse = res .response - .parse_struct("Billwerk BillwerkPaymentsResponse") + .parse_struct("Billwerk PaymentsAuthorizeResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); @@ -342,14 +232,6 @@ impl ConnectorIntegration CustomResult { self.build_error_response(res, event_builder) } - - fn get_5xx_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } } impl ConnectorIntegration @@ -369,14 +251,10 @@ impl ConnectorIntegration CustomResult { - Ok(format!( - "{}v1/charge/{}", - self.base_url(connectors), - req.connector_request_reference_id - )) + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) } fn build_request( @@ -402,7 +280,7 @@ impl ConnectorIntegration CustomResult { let response: billwerk::BillwerkPaymentsResponse = res .response - .parse_struct("billwerk BillwerkPaymentsResponse") + .parse_struct("billwerk PaymentsSyncResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); @@ -420,14 +298,6 @@ impl ConnectorIntegration CustomResult { self.build_error_response(res, event_builder) } - - fn get_5xx_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } } impl ConnectorIntegration @@ -447,29 +317,18 @@ impl ConnectorIntegration CustomResult { - let connector_transaction_id = &req.request.connector_transaction_id; - Ok(format!( - "{}v1/charge/{connector_transaction_id}/settle", - self.base_url(connectors) - )) + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) } fn get_request_body( &self, - req: &types::PaymentsCaptureRouterData, + _req: &types::PaymentsCaptureRouterData, _connectors: &settings::Connectors, ) -> CustomResult { - let connector_router_data = billwerk::BillwerkRouterData::try_from(( - &self.get_currency_unit(), - req.request.currency, - req.request.amount_to_capture, - req, - ))?; - let connector_req = billwerk::BillwerkCaptureRequest::try_from(&connector_router_data)?; - Ok(RequestContent::Json(Box::new(connector_req))) + Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) } fn build_request( @@ -500,7 +359,7 @@ impl ConnectorIntegration CustomResult { let response: billwerk::BillwerkPaymentsResponse = res .response - .parse_struct("Billwerk BillwerkPaymentsResponse") + .parse_struct("Billwerk PaymentsCaptureResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); @@ -518,92 +377,11 @@ impl ConnectorIntegration CustomResult { self.build_error_response(res, event_builder) } - - fn get_5xx_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } } impl ConnectorIntegration for Billwerk { - fn get_headers( - &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - let connector_transaction_id = &req.request.connector_transaction_id; - Ok(format!( - "{}v1/charge/{connector_transaction_id}/cancel", - self.base_url(connectors) - )) - } - - fn build_request( - &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) - .build(), - )) - } - - fn handle_response( - &self, - data: &types::PaymentsCancelRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult { - let response: billwerk::BillwerkPaymentsResponse = res - .response - .parse_struct("Billwerk BillwerkPaymentsResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } - - fn get_5xx_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } } impl ConnectorIntegration @@ -624,9 +402,9 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + _connectors: &settings::Connectors, ) -> CustomResult { - Ok(format!("{}v1/refund", self.base_url(connectors))) + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) } fn get_request_body( @@ -689,14 +467,6 @@ impl ConnectorIntegration CustomResult { self.build_error_response(res, event_builder) } - - fn get_5xx_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } } impl ConnectorIntegration for Billwerk { @@ -714,14 +484,10 @@ impl ConnectorIntegration CustomResult { - let refund_id = req.request.get_connector_refund_id()?; - Ok(format!( - "{}v1/refund/{refund_id}", - self.base_url(connectors) - )) + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) } fn build_request( @@ -768,14 +534,6 @@ impl ConnectorIntegration CustomResult { self.build_error_response(res, event_builder) } - - fn get_5xx_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } } #[async_trait::async_trait] diff --git a/crates/router/src/connector/billwerk/transformers.rs b/crates/router/src/connector/billwerk/transformers.rs index 4e91a2c9ffb..c6f025b7898 100644 --- a/crates/router/src/connector/billwerk/transformers.rs +++ b/crates/router/src/connector/billwerk/transformers.rs @@ -1,16 +1,15 @@ -use common_utils::pii::{Email, SecretSerdeValue}; -use masking::{ExposeInterface, Secret}; +use masking::Secret; use serde::{Deserialize, Serialize}; use crate::{ - connector::utils::{self, CardData, PaymentsAuthorizeRequestData, RouterData}, - consts, + connector::utils::PaymentsAuthorizeRequestData, core::errors, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; +//TODO: Fill the struct with respective fields pub struct BillwerkRouterData { - pub amount: i64, + pub amount: i64, // The type of amount that a connector accepts, for example, String, i64, f64, etc. pub router_data: T, } @@ -31,6 +30,7 @@ impl T, ), ) -> Result { + //Todo : use utils to convert the amount to the type of amount that a connector accepts Ok(Self { amount, router_data: item, @@ -38,213 +38,89 @@ impl } } -pub struct BillwerkAuthType { - pub(super) api_key: Secret, - pub(super) public_api_key: Secret, -} - -impl TryFrom<&types::ConnectorAuthType> for BillwerkAuthType { - type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { - match auth_type { - types::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { - api_key: api_key.to_owned(), - public_api_key: key1.to_owned(), - }), - _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), - } - } -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum BillwerkTokenRequestIntent { - ChargeAndStore, -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum BillwerkStrongAuthRule { - UseScaIfAvailableAuth, +//TODO: Fill the struct with respective fields +#[derive(Default, Debug, Serialize, Eq, PartialEq)] +pub struct BillwerkPaymentsRequest { + amount: i64, + card: BillwerkCard, } -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct BillwerkTokenRequest { +#[derive(Default, Debug, Serialize, Eq, PartialEq)] +pub struct BillwerkCard { number: cards::CardNumber, - month: Secret, - year: Secret, - cvv: Secret, - pkey: Secret, - recurring: Option, - intent: Option, - strong_authentication_rule: Option, + expiry_month: Secret, + expiry_year: Secret, + cvc: Secret, + complete: bool, } -impl TryFrom<&types::TokenizationRouterData> for BillwerkTokenRequest { +impl TryFrom<&BillwerkRouterData<&types::PaymentsAuthorizeRouterData>> for BillwerkPaymentsRequest { type Error = error_stack::Report; - fn try_from(item: &types::TokenizationRouterData) -> Result { - match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => { - let connector_auth = &item.connector_auth_type; - let auth_type = BillwerkAuthType::try_from(connector_auth)?; + fn try_from( + item: &BillwerkRouterData<&types::PaymentsAuthorizeRouterData>, + ) -> Result { + match item.router_data.request.payment_method_data.clone() { + api::PaymentMethodData::Card(req_card) => { + let card = BillwerkCard { + number: req_card.card_number, + expiry_month: req_card.card_exp_month, + expiry_year: req_card.card_exp_year, + cvc: req_card.card_cvc, + complete: item.router_data.request.is_auto_capture()?, + }; Ok(Self { - number: ccard.card_number.clone(), - month: ccard.card_exp_month.clone(), - year: ccard.get_card_expiry_year_2_digit()?, - cvv: ccard.card_cvc, - pkey: auth_type.public_api_key, - recurring: None, - intent: None, - strong_authentication_rule: None, + amount: item.amount.to_owned(), + card, }) } - domain::payments::PaymentMethodData::Wallet(_) - | domain::payments::PaymentMethodData::CardRedirect(_) - | domain::payments::PaymentMethodData::PayLater(_) - | domain::payments::PaymentMethodData::BankRedirect(_) - | domain::payments::PaymentMethodData::BankDebit(_) - | domain::payments::PaymentMethodData::BankTransfer(_) - | domain::payments::PaymentMethodData::Crypto(_) - | domain::payments::PaymentMethodData::MandatePayment - | domain::payments::PaymentMethodData::Reward - | domain::payments::PaymentMethodData::Upi(_) - | domain::payments::PaymentMethodData::Voucher(_) - | domain::payments::PaymentMethodData::GiftCard(_) - | domain::payments::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("billwerk"), - ) - .into()) - } + _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()), } } } -#[derive(Debug, Deserialize, Serialize)] -pub struct BillwerkTokenResponse { - id: Secret, - recurring: Option, -} - -impl - TryFrom< - types::ResponseRouterData< - api::PaymentMethodToken, - BillwerkTokenResponse, - T, - types::PaymentsResponseData, - >, - > for types::RouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::ResponseRouterData< - api::PaymentMethodToken, - BillwerkTokenResponse, - T, - types::PaymentsResponseData, - >, - ) -> Result { - Ok(Self { - response: Ok(types::PaymentsResponseData::TokenizationResponse { - token: item.response.id.expose(), - }), - ..item.data - }) - } -} - -#[derive(Debug, Serialize)] -pub struct BillwerkCustomerObject { - handle: Option, - email: Option, - address: Option>, - address2: Option>, - city: Option, - country: Option, - first_name: Option>, - last_name: Option>, -} - -#[derive(Debug, Serialize)] -pub struct BillwerkPaymentsRequest { - handle: String, - amount: i64, - source: Secret, - currency: common_enums::Currency, - customer: BillwerkCustomerObject, - metadata: Option, - settle: bool, +//TODO: Fill the struct with respective fields +// Auth Struct +pub struct BillwerkAuthType { + pub(super) api_key: Secret, } -impl TryFrom<&BillwerkRouterData<&types::PaymentsAuthorizeRouterData>> for BillwerkPaymentsRequest { +impl TryFrom<&types::ConnectorAuthType> for BillwerkAuthType { type Error = error_stack::Report; - fn try_from( - item: &BillwerkRouterData<&types::PaymentsAuthorizeRouterData>, - ) -> Result { - if item.router_data.is_three_ds() { - return Err(errors::ConnectorError::NotImplemented( - "Three_ds payments through Billwerk".to_string(), - ) - .into()); - }; - let source = match item.router_data.get_payment_method_token()? { - types::PaymentMethodToken::Token(pm_token) => Ok(Secret::new(pm_token)), - _ => Err(errors::ConnectorError::MissingRequiredField { - field_name: "payment_method_token", + fn try_from(auth_type: &types::ConnectorAuthType) -> Result { + match auth_type { + types::ConnectorAuthType::HeaderKey { api_key } => Ok(Self { + api_key: api_key.to_owned(), }), - }?; - Ok(Self { - handle: item.router_data.connector_request_reference_id.clone(), - amount: item.amount, - source, - currency: item.router_data.request.currency, - customer: BillwerkCustomerObject { - handle: item.router_data.customer_id.clone(), - email: item.router_data.request.email.clone(), - address: item.router_data.get_optional_billing_line1(), - address2: item.router_data.get_optional_billing_line2(), - city: item.router_data.get_optional_billing_city(), - country: item.router_data.get_optional_billing_country(), - first_name: item.router_data.get_optional_billing_first_name(), - last_name: item.router_data.get_optional_billing_last_name(), - }, - metadata: item.router_data.request.metadata.clone(), - settle: item.router_data.request.is_auto_capture()?, - }) + _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), + } } } - -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +// PaymentsResponse +//TODO: Append the remaining status flags +#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "lowercase")] -pub enum BillwerkPaymentState { - Created, - Authorized, - Pending, - Settled, +pub enum BillwerkPaymentStatus { + Succeeded, Failed, - Cancelled, + #[default] + Processing, } -impl From for enums::AttemptStatus { - fn from(item: BillwerkPaymentState) -> Self { +impl From for enums::AttemptStatus { + fn from(item: BillwerkPaymentStatus) -> Self { match item { - BillwerkPaymentState::Created | BillwerkPaymentState::Pending => Self::Pending, - BillwerkPaymentState::Authorized => Self::Authorized, - BillwerkPaymentState::Settled => Self::Charged, - BillwerkPaymentState::Failed => Self::Failure, - BillwerkPaymentState::Cancelled => Self::Voided, + BillwerkPaymentStatus::Succeeded => Self::Charged, + BillwerkPaymentStatus::Failed => Self::Failure, + BillwerkPaymentStatus::Processing => Self::Authorizing, } } } -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +//TODO: Fill the struct with respective fields +#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct BillwerkPaymentsResponse { - state: BillwerkPaymentState, - handle: String, - error: Option, - error_state: Option, + status: BillwerkPaymentStatus, + id: String, } impl @@ -260,65 +136,28 @@ impl types::PaymentsResponseData, >, ) -> Result { - let error_response = if item.response.error.is_some() || item.response.error_state.is_some() - { - Some(types::ErrorResponse { - code: item - .response - .error_state - .clone() - .unwrap_or(consts::NO_ERROR_CODE.to_string()), - message: item - .response - .error_state - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), - reason: item.response.error, - status_code: item.http_code, - attempt_status: None, - connector_transaction_id: Some(item.response.handle.clone()), - }) - } else { - None - }; - let payments_response = types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(item.response.handle.clone()), - redirection_data: None, - mandate_reference: None, - connector_metadata: None, - network_txn_id: None, - connector_response_reference_id: Some(item.response.handle), - incremental_authorization_allowed: None, - }; Ok(Self { - status: enums::AttemptStatus::from(item.response.state), - response: error_response.map_or_else(|| Ok(payments_response), Err), + status: enums::AttemptStatus::from(item.response.status), + response: Ok(types::PaymentsResponseData::TransactionResponse { + resource_id: types::ResponseId::ConnectorTransactionId(item.response.id), + redirection_data: None, + mandate_reference: None, + connector_metadata: None, + network_txn_id: None, + connector_response_reference_id: None, + incremental_authorization_allowed: None, + }), ..item.data }) } } -#[derive(Debug, Serialize)] -pub struct BillwerkCaptureRequest { - amount: i64, -} - -impl TryFrom<&BillwerkRouterData<&types::PaymentsCaptureRouterData>> for BillwerkCaptureRequest { - type Error = error_stack::Report; - fn try_from( - item: &BillwerkRouterData<&types::PaymentsCaptureRouterData>, - ) -> Result { - Ok(Self { - amount: item.amount, - }) - } -} - +//TODO: Fill the struct with respective fields +// REFUND : // Type definition for RefundRequest -#[derive(Debug, Serialize)] +#[derive(Default, Debug, Serialize)] pub struct BillwerkRefundRequest { - pub invoice: String, pub amount: i64, - pub text: Option, } impl TryFrom<&BillwerkRouterData<&types::RefundsRouterData>> for BillwerkRefundRequest { @@ -327,36 +166,38 @@ impl TryFrom<&BillwerkRouterData<&types::RefundsRouterData>> for BillwerkR item: &BillwerkRouterData<&types::RefundsRouterData>, ) -> Result { Ok(Self { - amount: item.amount, - invoice: item.router_data.request.connector_transaction_id.clone(), - text: item.router_data.request.reason.clone(), + amount: item.amount.to_owned(), }) } } // Type definition for Refund Response -#[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "lowercase")] -pub enum RefundState { - Refunded, + +#[allow(dead_code)] +#[derive(Debug, Serialize, Default, Deserialize, Clone)] +pub enum RefundStatus { + Succeeded, Failed, + #[default] Processing, } -impl From for enums::RefundStatus { - fn from(item: RefundState) -> Self { +impl From for enums::RefundStatus { + fn from(item: RefundStatus) -> Self { match item { - RefundState::Refunded => Self::Success, - RefundState::Failed => Self::Failure, - RefundState::Processing => Self::Pending, + RefundStatus::Succeeded => Self::Success, + RefundStatus::Failed => Self::Failure, + RefundStatus::Processing => Self::Pending, + //TODO: Review mapping } } } -#[derive(Debug, Serialize, Deserialize)] +//TODO: Fill the struct with respective fields +#[derive(Default, Debug, Clone, Serialize, Deserialize)] pub struct RefundResponse { id: String, - state: RefundState, + status: RefundStatus, } impl TryFrom> @@ -369,7 +210,7 @@ impl TryFrom> Ok(Self { response: Ok(types::RefundsResponseData { connector_refund_id: item.response.id.to_string(), - refund_status: enums::RefundStatus::from(item.response.state), + refund_status: enums::RefundStatus::from(item.response.status), }), ..item.data }) @@ -386,16 +227,18 @@ impl TryFrom> Ok(Self { response: Ok(types::RefundsResponseData { connector_refund_id: item.response.id.to_string(), - refund_status: enums::RefundStatus::from(item.response.state), + refund_status: enums::RefundStatus::from(item.response.status), }), ..item.data }) } } -#[derive(Debug, Serialize, Deserialize)] +//TODO: Fill the struct with respective fields +#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] pub struct BillwerkErrorResponse { - pub code: Option, - pub error: String, - pub message: Option, + pub status_code: u16, + pub code: String, + pub message: String, + pub reason: Option, } diff --git a/crates/router/src/connector/bluesnap.rs b/crates/router/src/connector/bluesnap.rs index dff76576ace..e32ebfc6f45 100644 --- a/crates/router/src/connector/bluesnap.rs +++ b/crates/router/src/connector/bluesnap.rs @@ -1159,10 +1159,7 @@ impl services::ConnectorRedirectResponse for Bluesnap { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { - Ok(payments::CallConnectorAction::Trigger) - } + services::PaymentAction::PSync => Ok(payments::CallConnectorAction::Trigger), services::PaymentAction::CompleteAuthorize => { let redirection_response: bluesnap::BluesnapRedirectionResponse = json_payload .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload { diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 2a572a2231a..e22d27e4b83 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -21,7 +21,7 @@ use crate::{ core::errors, pii::Secret, types::{ - self, api, domain, + self, api, storage::enums, transformers::{ForeignFrom, ForeignTryFrom}, }, @@ -230,23 +230,23 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> item: &BluesnapRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => Ok(Self { + api::PaymentMethodData::Card(ref ccard) => Ok(Self { cc_number: ccard.card_number.clone(), exp_date: ccard.get_expiry_date_as_mmyyyy("/"), }), - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api::PaymentMethodData::Wallet(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( "Selected payment method via Token flow through bluesnap".to_string(), ) @@ -280,7 +280,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues .payment_method_data .clone() { - domain::PaymentMethodData::Card(ref ccard) => Ok(( + api::PaymentMethodData::Card(ref ccard) => Ok(( PaymentMethodDetails::CreditCard(Card { card_number: ccard.card_number.clone(), expiration_month: ccard.card_exp_month.clone(), @@ -292,8 +292,8 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues item.router_data.request.get_email()?, )?, )), - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::GooglePay(payment_method_data) => { + api::PaymentMethodData::Wallet(wallet_data) => match wallet_data { + api_models::payments::WalletData::GooglePay(payment_method_data) => { let gpay_object = BluesnapGooglePayObject { payment_method_data: utils::GooglePayWalletData::from(payment_method_data), } @@ -309,7 +309,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues None, )) } - domain::WalletData::ApplePay(payment_method_data) => { + api_models::payments::WalletData::ApplePay(payment_method_data) => { let apple_pay_payment_data = payment_method_data.get_applepay_decoded_payment_data()?; let apple_pay_payment_data: ApplePayEncodedPaymentData = apple_pay_payment_data @@ -370,51 +370,49 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues )?, )) } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::WeChatPayQr(_) => { + payments::WalletData::AliPayQr(_) + | payments::WalletData::AliPayRedirect(_) + | payments::WalletData::AliPayHkRedirect(_) + | payments::WalletData::MomoRedirect(_) + | payments::WalletData::KakaoPayRedirect(_) + | payments::WalletData::GoPayRedirect(_) + | payments::WalletData::GcashRedirect(_) + | payments::WalletData::ApplePayRedirect(_) + | payments::WalletData::ApplePayThirdPartySdk(_) + | payments::WalletData::DanaRedirect {} + | payments::WalletData::GooglePayRedirect(_) + | payments::WalletData::GooglePayThirdPartySdk(_) + | payments::WalletData::MbWayRedirect(_) + | payments::WalletData::MobilePayRedirect(_) + | payments::WalletData::PaypalRedirect(_) + | payments::WalletData::PaypalSdk(_) + | payments::WalletData::SamsungPay(_) + | payments::WalletData::TwintRedirect {} + | payments::WalletData::VippsRedirect {} + | payments::WalletData::TouchNGoRedirect(_) + | payments::WalletData::WeChatPayRedirect(_) + | payments::WalletData::CashappQr(_) + | payments::WalletData::SwishQr(_) + | payments::WalletData::WeChatPayQr(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("bluesnap"), )) } }, - domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("bluesnap"), - )) - } + payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("bluesnap"), + )), }?; Ok(Self { amount: item.amount.to_owned(), @@ -431,8 +429,8 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues } } -impl From for ApplepayPaymentMethod { - fn from(item: domain::ApplepayPaymentMethod) -> Self { +impl From for ApplepayPaymentMethod { + fn from(item: api_models::payments::ApplepayPaymentMethod) -> Self { Self { display_name: item.display_name, network: item.network, @@ -550,7 +548,7 @@ impl TryFrom CustomResult, errors::ConnectorError> { - let first_name = address.get_first_name()?; Ok(Some(BluesnapCardHolderInfo { - first_name: first_name.clone(), - last_name: address.get_last_name().unwrap_or(first_name).clone(), + first_name: address.get_first_name()?.clone(), + last_name: address.get_last_name()?.clone(), email, })) } diff --git a/crates/router/src/connector/boku/transformers.rs b/crates/router/src/connector/boku/transformers.rs index 07b48a5353c..5f36225fd40 100644 --- a/crates/router/src/connector/boku/transformers.rs +++ b/crates/router/src/connector/boku/transformers.rs @@ -9,7 +9,7 @@ use crate::{ connector::utils::{self, AddressDetailsData, RouterData}, core::errors, services::{self, RedirectForm}, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; #[derive(Debug, Clone, Serialize)] @@ -78,20 +78,22 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BokuPaymentsRequest { type Error = error_stack::Report; fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Wallet(wallet_data) => Self::try_from((item, &wallet_data)), - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::Wallet(wallet_data) => { + Self::try_from((item, &wallet_data)) + } + api_models::payments::PaymentMethodData::Card(_) + | api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("boku"), ))? @@ -100,10 +102,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BokuPaymentsRequest { } } -impl TryFrom<(&types::PaymentsAuthorizeRouterData, &domain::WalletData)> for BokuPaymentsRequest { +impl TryFrom<(&types::PaymentsAuthorizeRouterData, &api::WalletData)> for BokuPaymentsRequest { type Error = error_stack::Report; fn try_from( - value: (&types::PaymentsAuthorizeRouterData, &domain::WalletData), + value: (&types::PaymentsAuthorizeRouterData, &api::WalletData), ) -> Result { let (item, wallet_data) = value; let address = item.get_billing_address()?; @@ -130,36 +132,48 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, &domain::WalletData)> for Bok } } -fn get_wallet_type(wallet_data: &domain::WalletData) -> Result { +fn get_wallet_type(wallet_data: &api::WalletData) -> Result { match wallet_data { - domain::WalletData::DanaRedirect { .. } => Ok(BokuPaymentType::Dana.to_string()), - domain::WalletData::MomoRedirect { .. } => Ok(BokuPaymentType::Momo.to_string()), - domain::WalletData::GcashRedirect { .. } => Ok(BokuPaymentType::Gcash.to_string()), - domain::WalletData::GoPayRedirect { .. } => Ok(BokuPaymentType::GoPay.to_string()), - domain::WalletData::KakaoPayRedirect { .. } => Ok(BokuPaymentType::Kakaopay.to_string()), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::GooglePay(_) - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("boku"), - )), + api_models::payments::WalletData::DanaRedirect { .. } => { + Ok(BokuPaymentType::Dana.to_string()) + } + api_models::payments::WalletData::MomoRedirect { .. } => { + Ok(BokuPaymentType::Momo.to_string()) + } + api_models::payments::WalletData::GcashRedirect { .. } => { + Ok(BokuPaymentType::Gcash.to_string()) + } + api_models::payments::WalletData::GoPayRedirect { .. } => { + Ok(BokuPaymentType::GoPay.to_string()) + } + api_models::payments::WalletData::KakaoPayRedirect { .. } => { + Ok(BokuPaymentType::Kakaopay.to_string()) + } + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::ApplePay(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::GooglePay(_) + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("boku"), + )) + } } } diff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rs index 1b55f12cab1..41133e3f670 100644 --- a/crates/router/src/connector/braintree.rs +++ b/crates/router/src/connector/braintree.rs @@ -1569,8 +1569,7 @@ impl services::ConnectorRedirectResponse for Braintree { } None => Ok(payments::CallConnectorAction::Avoid), }, - services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs index 480867c6cbd..1f933392f2b 100644 --- a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs +++ b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs @@ -9,7 +9,7 @@ use crate::{ consts, core::errors, services, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, unimplemented_payment_method, }; @@ -119,7 +119,7 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsAuthorizeRouterData>> )?; match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(_) => { + api::PaymentMethodData::Card(_) => { if item.router_data.is_three_ds() { Ok(Self::CardThreeDs(BraintreeClientTokenRequest::try_from( metadata, @@ -128,19 +128,19 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsAuthorizeRouterData>> Ok(Self::Card(CardPaymentRequest::try_from((item, metadata))?)) } } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("braintree"), ) @@ -860,7 +860,7 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest { type Error = error_stack::Report; fn try_from(item: &types::TokenizationRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(card_data) => { + api::PaymentMethodData::Card(card_data) => { let query = TOKENIZE_CREDIT_CARD.to_string(); let input = InputData { credit_card: CreditCardData { @@ -868,8 +868,8 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest { expiration_year: card_data.card_exp_year, expiration_month: card_data.card_exp_month, cvv: card_data.card_cvc, - cardholder_name: item - .get_optional_billing_full_name() + cardholder_name: card_data + .card_holder_name .unwrap_or(Secret::new("".to_string())), }, }; @@ -878,24 +878,22 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest { variables: VariableInput { input }, }) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("braintree"), - ) - .into()) - } + api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("braintree"), + ) + .into()), } } } @@ -1408,7 +1406,7 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsCompleteAuthorizeRouterData>> fn get_braintree_redirect_form( client_token_data: ClientTokenResponse, payment_method_token: types::PaymentMethodToken, - card_details: domain::PaymentMethodData, + card_details: api_models::payments::PaymentMethodData, ) -> Result> { Ok(services::RedirectForm::Braintree { client_token: client_token_data @@ -1425,24 +1423,24 @@ fn get_braintree_redirect_form( ))?, }, bin: match card_details { - domain::PaymentMethodData::Card(card_details) => { + api_models::payments::PaymentMethodData::Card(card_details) => { card_details.card_number.get_card_isin() } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => Err( - errors::ConnectorError::NotImplemented("given payment method".to_owned()), - )?, + api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + "given payment method".to_owned(), + ))?, }, }) } diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs index ef111a2588a..4e8a15dfea2 100644 --- a/crates/router/src/connector/braintree/transformers.rs +++ b/crates/router/src/connector/braintree/transformers.rs @@ -7,7 +7,7 @@ use crate::{ connector::utils::{self}, consts, core::errors, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; #[derive(Default, Debug, Serialize, Eq, PartialEq)] @@ -115,7 +115,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest { let kind = "sale".to_string(); let payment_method_data_type = match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => Ok(PaymentMethodType::CreditCard(Card { + api::PaymentMethodData::Card(ccard) => Ok(PaymentMethodType::CreditCard(Card { credit_card: CardDetails { number: ccard.card_number, expiration_month: ccard.card_exp_month, @@ -123,37 +123,37 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest { cvv: ccard.card_cvc, }, })), - domain::PaymentMethodData::Wallet(ref wallet_data) => { + api::PaymentMethodData::Wallet(ref wallet_data) => { Ok(PaymentMethodType::PaymentMethodNonce(Nonce { payment_method_nonce: match wallet_data { - domain::WalletData::PaypalSdk(wallet_data) => { + api_models::payments::WalletData::PaypalSdk(wallet_data) => { Ok(wallet_data.token.to_owned()) } - domain::WalletData::ApplePay(_) - | domain::WalletData::GooglePay(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => { + api_models::payments::WalletData::ApplePay(_) + | api_models::payments::WalletData::GooglePay(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("braintree"), )) @@ -162,22 +162,20 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest { .into(), })) } - domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("braintree"), - )) - } + api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("braintree"), + )), }?; let braintree_transaction_body = TransactionBody { amount, diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rs index 3c628fe9ec3..33a43b0a03c 100644 --- a/crates/router/src/connector/checkout.rs +++ b/crates/router/src/connector/checkout.rs @@ -2,7 +2,11 @@ pub mod transformers; use std::fmt::Debug; -use common_utils::{crypto, ext_traits::ByteSliceExt, request::RequestContent}; +use common_utils::{ + crypto, + ext_traits::{ByteSliceExt, Encode}, + request::RequestContent, +}; use diesel_models::enums; use error_stack::ResultExt; use masking::PeekInterface; @@ -1291,19 +1295,27 @@ impl api::IncomingWebhook for Checkout { let event_type_data: checkout::CheckoutWebhookEventTypeBody = request .body .parse_struct("CheckoutWebhookBody") - .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; - - if checkout::is_chargeback_event(&event_type_data.transaction_type) { - let dispute_webhook_body: checkout::CheckoutDisputeWebhookBody = request + .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?; + let resource_object = if checkout::is_chargeback_event(&event_type_data.transaction_type) + || checkout::is_refund_event(&event_type_data.transaction_type) + { + // if other event, just return the json data. + let resource_object_data: checkout::CheckoutWebhookObjectResource = request .body - .parse_struct("CheckoutDisputeWebhookBody") - .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; - Ok(Box::new(dispute_webhook_body.data)) - } else if checkout::is_refund_event(&event_type_data.transaction_type) { - Ok(Box::new(checkout::RefundResponse::try_from(request)?)) + .parse_struct("CheckoutWebhookObjectResource") + .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?; + resource_object_data.data } else { - Ok(Box::new(checkout::PaymentsResponse::try_from(request)?)) - } + // if payment_event, construct PaymentResponse and then serialize it to json and return. + let payment_response = checkout::PaymentsResponse::try_from(request)?; + payment_response + .encode_to_value() + .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)? + }; + // Ideally this should be a strict type that has type information + // PII information is likely being logged here when this response will be logged. + + Ok(Box::new(resource_object)) } fn get_dispute_details( @@ -1339,9 +1351,7 @@ impl services::ConnectorRedirectResponse for Checkout { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs index 3fff6d940d6..1a031eaa7ca 100644 --- a/crates/router/src/connector/checkout/transformers.rs +++ b/crates/router/src/connector/checkout/transformers.rs @@ -13,7 +13,7 @@ use crate::{ consts, core::errors, services, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, + types::{self, api, storage::enums, transformers::ForeignFrom}, unimplemented_payment_method, }; @@ -90,60 +90,60 @@ impl TryFrom<&types::TokenizationRouterData> for TokenRequest { type Error = error_stack::Report; fn try_from(item: &types::TokenizationRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data.clone() { - domain::WalletData::GooglePay(_data) => { + api::PaymentMethodData::Wallet(wallet_data) => match wallet_data.clone() { + api_models::payments::WalletData::GooglePay(_data) => { let json_wallet_data: CheckoutGooglePayData = wallet_data.get_wallet_token_as_json("Google Pay".to_string())?; Ok(Self::Googlepay(json_wallet_data)) } - domain::WalletData::ApplePay(_data) => { + api_models::payments::WalletData::ApplePay(_data) => { let json_wallet_data: CheckoutApplePayData = wallet_data.get_wallet_token_as_json("Apple Pay".to_string())?; Ok(Self::Applepay(json_wallet_data)) } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::WeChatPayQr(_) => { + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) + | api_models::payments::WalletData::WeChatPayQr(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("checkout"), ) .into()) } }, - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::Card(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("checkout"), ) @@ -292,7 +292,7 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme item: &CheckoutRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { let source_var = match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => { + api::PaymentMethodData::Card(ccard) => { let a = PaymentSource::Card(CardSource { source_type: CheckoutSourceTypes::Card, number: ccard.card_number.clone(), @@ -302,17 +302,23 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme }); Ok(a) } - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::GooglePay(_) => Ok(PaymentSource::Wallets(WalletSource { - source_type: CheckoutSourceTypes::Token, - token: match item.router_data.get_payment_method_token()? { - types::PaymentMethodToken::Token(token) => token.into(), - types::PaymentMethodToken::ApplePayDecrypt(_) => Err( - unimplemented_payment_method!("Apple Pay", "Simplified", "Checkout"), - )?, - }, - })), - domain::WalletData::ApplePay(_) => { + api::PaymentMethodData::Wallet(wallet_data) => match wallet_data { + api_models::payments::WalletData::GooglePay(_) => { + Ok(PaymentSource::Wallets(WalletSource { + source_type: CheckoutSourceTypes::Token, + token: match item.router_data.get_payment_method_token()? { + types::PaymentMethodToken::Token(token) => token.into(), + types::PaymentMethodToken::ApplePayDecrypt(_) => { + Err(unimplemented_payment_method!( + "Apple Pay", + "Simplified", + "Checkout" + ))? + } + }, + })) + } + api_models::payments::WalletData::ApplePay(_) => { let payment_method_token = item.router_data.get_payment_method_token()?; match payment_method_token { types::PaymentMethodToken::Token(apple_pay_payment_token) => { @@ -338,52 +344,50 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme } } } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::WeChatPayQr(_) => { + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) + | api_models::payments::WalletData::WeChatPayQr(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("checkout"), )) } }, - domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("checkout"), - )) - } + api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("checkout"), + )), }?; let authentication_data = item.router_data.request.authentication_data.as_ref(); @@ -1237,7 +1241,7 @@ pub struct CheckoutWebhookBody { pub links: Links, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Deserialize)] pub struct CheckoutDisputeWebhookData { pub id: String, pub payment_id: Option, @@ -1382,7 +1386,7 @@ impl TryFrom<&api::IncomingWebhookRequestDetails<'_>> for PaymentsResponse { let details: CheckoutWebhookBody = request .body .parse_struct("CheckoutWebhookBody") - .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; + .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?; let data = details.data; let psync_struct = Self { id: data.payment_id.unwrap_or(data.id), @@ -1403,28 +1407,6 @@ impl TryFrom<&api::IncomingWebhookRequestDetails<'_>> for PaymentsResponse { } } -impl TryFrom<&api::IncomingWebhookRequestDetails<'_>> for RefundResponse { - type Error = error_stack::Report; - - fn try_from(request: &api::IncomingWebhookRequestDetails<'_>) -> Result { - let details: CheckoutWebhookBody = request - .body - .parse_struct("CheckoutWebhookBody") - .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; - let data = details.data; - let refund_struct = Self { - action_id: data - .action_id - .ok_or(errors::ConnectorError::WebhookBodyDecodingFailed)?, - reference: data - .reference - .ok_or(errors::ConnectorError::WebhookBodyDecodingFailed)?, - }; - - Ok(refund_struct) - } -} - impl TryFrom<&types::SubmitEvidenceRouterData> for Evidence { type Error = error_stack::Report; fn try_from(item: &types::SubmitEvidenceRouterData) -> Result { diff --git a/crates/router/src/connector/cryptopay.rs b/crates/router/src/connector/cryptopay.rs index 7245694bd44..2f9c996eff4 100644 --- a/crates/router/src/connector/cryptopay.rs +++ b/crates/router/src/connector/cryptopay.rs @@ -287,14 +287,11 @@ impl ConnectorIntegration> item: &CryptopayRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { let cryptopay_request = match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Crypto(ref cryptodata) => { + api::PaymentMethodData::Crypto(ref cryptodata) => { let pay_currency = cryptodata.get_pay_currency()?; Ok(Self { price_amount: item.amount.to_owned(), @@ -72,24 +70,23 @@ impl TryFrom<&CryptopayRouterData<&types::PaymentsAuthorizeRouterData>> pay_currency, success_redirect_url: item.router_data.request.router_return_url.clone(), unsuccess_redirect_url: item.router_data.request.router_return_url.clone(), - //Cryptopay only accepts metadata as Object. If any other type, payment will fail with error. - metadata: item.router_data.request.get_metadata_as_object(), + metadata: item.router_data.request.metadata.clone(), custom_id: item.router_data.connector_request_reference_id.clone(), }) } - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::MandatePayment {} - | domain::PaymentMethodData::Reward {} - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::Card(_) + | api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::MandatePayment {} + | api_models::payments::PaymentMethodData::Reward {} + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("CryptoPay"), )) @@ -148,17 +145,17 @@ pub struct CryptopayPaymentsResponse { } impl - TryFrom<( - types::ResponseRouterData, - diesel_models::enums::Currency, - )> for types::RouterData + TryFrom> + for types::RouterData { type Error = error_stack::Report; fn try_from( - (item, currency): ( - types::ResponseRouterData, - diesel_models::enums::Currency, - ), + item: types::ResponseRouterData< + F, + CryptopayPaymentsResponse, + T, + types::PaymentsResponseData, + >, ) -> Result { let status = enums::AttemptStatus::from(item.response.data.status.clone()); let response = if is_payment_failure(status) { @@ -199,28 +196,11 @@ impl incremental_authorization_allowed: None, }) }; - - match item.response.data.price_amount { - Some(price_amount) => { - let amount_captured = Some( - connector_utils::to_currency_lower_unit(price_amount, currency)? - .parse::() - .change_context(errors::ConnectorError::ParsingFailed)?, - ); - - Ok(Self { - status, - response, - amount_captured, - ..item.data - }) - } - None => Ok(Self { - status, - response, - ..item.data - }), - } + Ok(Self { + status, + response, + ..item.data + }) } } diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rs index 39079fe9f99..5298420cde2 100644 --- a/crates/router/src/connector/cybersource.rs +++ b/crates/router/src/connector/cybersource.rs @@ -5,7 +5,7 @@ use std::fmt::Debug; use base64::Engine; use common_utils::request::RequestContent; use diesel_models::enums; -use error_stack::{report, Report, ResultExt}; +use error_stack::{report, ResultExt}; use masking::{ExposeInterface, PeekInterface}; use ring::{digest, hmac}; use time::OffsetDateTime; @@ -116,10 +116,13 @@ impl ConnectorCommon for Cybersource { res: types::Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult { - let response: Result< - cybersource::CybersourceErrorResponse, - Report, - > = res.response.parse_struct("Cybersource ErrorResponse"); + let response: cybersource::CybersourceErrorResponse = res + .response + .parse_struct("Cybersource ErrorResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|i| i.set_error_response_body(&response)); + router_env::logger::info!(connector_response=?response); let error_message = if res.status_code == 401 { consts::CONNECTOR_UNAUTHORIZED_ERROR @@ -127,9 +130,7 @@ impl ConnectorCommon for Cybersource { consts::NO_ERROR_MESSAGE }; match response { - Ok(transformers::CybersourceErrorResponse::StandardError(response)) => { - event_builder.map(|i| i.set_error_response_body(&response)); - router_env::logger::info!(connector_response=?response); + transformers::CybersourceErrorResponse::StandardError(response) => { let (code, connector_reason) = match response.error_information { Some(ref error_info) => (error_info.reason.clone(), error_info.message.clone()), None => ( @@ -161,9 +162,7 @@ impl ConnectorCommon for Cybersource { connector_transaction_id: None, }) } - Ok(transformers::CybersourceErrorResponse::AuthenticationError(response)) => { - event_builder.map(|i| i.set_error_response_body(&response)); - router_env::logger::info!(connector_response=?response); + transformers::CybersourceErrorResponse::AuthenticationError(response) => { Ok(types::ErrorResponse { status_code: res.status_code, code: consts::NO_ERROR_CODE.to_string(), @@ -173,9 +172,7 @@ impl ConnectorCommon for Cybersource { connector_transaction_id: None, }) } - Ok(transformers::CybersourceErrorResponse::NotAvailableError(response)) => { - event_builder.map(|i| i.set_error_response_body(&response)); - router_env::logger::info!(connector_response=?response); + transformers::CybersourceErrorResponse::NotAvailableError(response) => { let error_response = response .errors .iter() @@ -197,14 +194,6 @@ impl ConnectorCommon for Cybersource { connector_transaction_id: None, }) } - Err(error_msg) => { - event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); - router_env::logger::error!(deserialization_error =? error_msg); - crate::utils::handle_json_response_deserialization_failure( - res, - "cybersource".to_owned(), - ) - } } } } diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index 4c8e06b28ef..d58f51e1d78 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -19,7 +19,6 @@ use crate::{ types::{ self, api::{self, enums as api_enums}, - domain, storage::enums, transformers::ForeignFrom, ApplePayPredecryptData, @@ -99,7 +98,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest { }; let (payment_information, solution) = match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => { + api::PaymentMethodData::Card(ccard) => { let card_issuer = ccard.get_card_issuer(); let card_type = match card_issuer { Ok(issuer) => Some(String::from(issuer)), @@ -119,8 +118,8 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest { ) } - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::ApplePay(apple_pay_data) => { + api::PaymentMethodData::Wallet(wallet_data) => match wallet_data { + payments::WalletData::ApplePay(apple_pay_data) => { match item.payment_method_token.clone() { Some(payment_method_token) => match payment_method_token { types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { @@ -149,7 +148,6 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest { PaymentInformation::ApplePayToken(ApplePayTokenPaymentInformation { fluid_data: FluidData { value: Secret::from(apple_pay_data.payment_data), - descriptor: Some(FLUID_DATA_DESCRIPTOR.to_string()), }, tokenized_card: ApplePayTokenizedCard { transaction_type: TransactionType::ApplePay, @@ -159,57 +157,56 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest { ), } } - domain::WalletData::GooglePay(google_pay_data) => ( + payments::WalletData::GooglePay(google_pay_data) => ( PaymentInformation::GooglePay(GooglePayPaymentInformation { fluid_data: FluidData { value: Secret::from( consts::BASE64_ENGINE .encode(google_pay_data.tokenization_data.token), ), - descriptor: None, }, }), Some(PaymentSolution::GooglePay), ), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( + payments::WalletData::AliPayQr(_) + | payments::WalletData::AliPayRedirect(_) + | payments::WalletData::AliPayHkRedirect(_) + | payments::WalletData::MomoRedirect(_) + | payments::WalletData::KakaoPayRedirect(_) + | payments::WalletData::GoPayRedirect(_) + | payments::WalletData::GcashRedirect(_) + | payments::WalletData::ApplePayRedirect(_) + | payments::WalletData::ApplePayThirdPartySdk(_) + | payments::WalletData::DanaRedirect {} + | payments::WalletData::GooglePayRedirect(_) + | payments::WalletData::GooglePayThirdPartySdk(_) + | payments::WalletData::MbWayRedirect(_) + | payments::WalletData::MobilePayRedirect(_) + | payments::WalletData::PaypalRedirect(_) + | payments::WalletData::PaypalSdk(_) + | payments::WalletData::SamsungPay(_) + | payments::WalletData::TwintRedirect {} + | payments::WalletData::VippsRedirect {} + | payments::WalletData::TouchNGoRedirect(_) + | payments::WalletData::WeChatPayRedirect(_) + | payments::WalletData::WeChatPayQr(_) + | payments::WalletData::CashappQr(_) + | payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), ))?, }, - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), ))? @@ -299,7 +296,6 @@ pub struct CybersourceAuthorizationOptions { #[serde(rename_all = "camelCase")] pub struct MerchantInitiatedTransaction { reason: Option, - previous_transaction_id: Option>, //Required for recurring mandates payment original_authorized_amount: Option, } @@ -317,7 +313,6 @@ pub struct CybersourcePaymentInitiator { #[serde(rename_all = "camelCase")] pub enum CybersourcePaymentInitiatorTypes { Customer, - Merchant, } #[derive(Debug, Serialize)] @@ -372,12 +367,8 @@ pub struct MandatePaymentInformation { #[serde(rename_all = "camelCase")] pub struct FluidData { value: Secret, - #[serde(skip_serializing_if = "Option::is_none")] - descriptor: Option, } -pub const FLUID_DATA_DESCRIPTOR: &str = "RklEPUNPTU1PTi5BUFBMRS5JTkFQUC5QQVlNRU5U"; - #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct GooglePayPaymentInformation { @@ -511,24 +502,6 @@ impl Option, ), ) -> Result { - let mut commerce_indicator = solution - .as_ref() - .map(|pm_solution| match pm_solution { - PaymentSolution::ApplePay => network - .as_ref() - .map(|card_network| match card_network.to_lowercase().as_str() { - "amex" => "aesk", - "discover" => "dipb", - "mastercard" => "spa", - "visa" => "internet", - _ => "internet", - }) - .unwrap_or("internet"), - PaymentSolution::GooglePay => "internet", - }) - .unwrap_or("internet") - .to_string(); - let (action_list, action_token_types, authorization_options) = if item .router_data .request @@ -557,113 +530,44 @@ impl merchant_intitiated_transaction: None, }), ) - } else if item.router_data.request.mandate_id.is_some() { - match item + } else if item.router_data.request.connector_mandate_id().is_some() { + let original_amount = item .router_data - .request - .mandate_id - .clone() - .and_then(|mandate_id| mandate_id.mandate_reference_id) - { - Some(api_models::payments::MandateReferenceId::ConnectorMandateId(_)) => { - let original_amount = item - .router_data - .get_recurring_mandate_payment_data()? - .get_original_payment_amount()?; - let original_currency = item - .router_data - .get_recurring_mandate_payment_data()? - .get_original_payment_currency()?; - ( - None, - None, - Some(CybersourceAuthorizationOptions { - initiator: None, - merchant_intitiated_transaction: Some(MerchantInitiatedTransaction { - reason: None, - original_authorized_amount: Some(utils::get_amount_as_string( - &types::api::CurrencyUnit::Base, - original_amount, - original_currency, - )?), - previous_transaction_id: None, - }), - }), - ) - } - Some(api_models::payments::MandateReferenceId::NetworkMandateId( - network_transaction_id, - )) => { - let (original_amount, original_currency) = match network - .clone() - .map(|network| network.to_lowercase()) - .as_deref() - { - Some("discover") => { - let original_amount = Some( - item.router_data - .get_recurring_mandate_payment_data()? - .get_original_payment_amount()?, - ); - let original_currency = Some( - item.router_data - .get_recurring_mandate_payment_data()? - .get_original_payment_currency()?, - ); - (original_amount, original_currency) - } - _ => { - let original_amount = item - .router_data - .recurring_mandate_payment_data - .as_ref() - .and_then(|recurring_mandate_payment_data| { - recurring_mandate_payment_data - .original_payment_authorized_amount - }); - - let original_currency = item - .router_data - .recurring_mandate_payment_data - .as_ref() - .and_then(|recurring_mandate_payment_data| { - recurring_mandate_payment_data - .original_payment_authorized_currency - }); - - (original_amount, original_currency) - } - }; - - let original_authorized_amount = match (original_amount, original_currency) { - (Some(original_amount), Some(original_currency)) => Some( - utils::to_currency_base_unit(original_amount, original_currency)?, - ), - _ => None, - }; - commerce_indicator = "recurring".to_string(); - ( - None, - None, - Some(CybersourceAuthorizationOptions { - initiator: Some(CybersourcePaymentInitiator { - initiator_type: Some(CybersourcePaymentInitiatorTypes::Merchant), - credential_stored_on_file: None, - stored_credential_used: Some(true), - }), - merchant_intitiated_transaction: Some(MerchantInitiatedTransaction { - reason: Some("7".to_string()), - original_authorized_amount, - previous_transaction_id: Some(Secret::new(network_transaction_id)), - }), - }), - ) - } - None => (None, None, None), - } + .get_recurring_mandate_payment_data()? + .get_original_payment_amount()?; + let original_currency = item + .router_data + .get_recurring_mandate_payment_data()? + .get_original_payment_currency()?; + ( + None, + None, + Some(CybersourceAuthorizationOptions { + initiator: None, + merchant_intitiated_transaction: Some(MerchantInitiatedTransaction { + reason: None, + original_authorized_amount: Some(utils::get_amount_as_string( + &types::api::CurrencyUnit::Base, + original_amount, + original_currency, + )?), + }), + }), + ) } else { (None, None, None) }; + let commerce_indicator = match network { + Some(card_network) => match card_network.to_lowercase().as_str() { + "amex" => "aesk", + "discover" => "dipb", + "mastercard" => "spa", + "visa" => "internet", + _ => "internet", + }, + None => "internet", + } + .to_string(); Ok(Self { capture: Some(matches!( item.router_data.request.capture_method, @@ -790,10 +694,9 @@ fn build_bill_to( .ok_or_else(utils::missing_field_err("billing.address"))?; let mut state = address.to_state_code()?.peek().clone(); state.truncate(20); - let first_name = address.get_first_name()?; Ok(BillTo { - first_name: first_name.clone(), - last_name: address.get_last_name().unwrap_or(first_name).clone(), + first_name: address.get_first_name()?.to_owned(), + last_name: address.get_last_name()?.to_owned(), address1: address.get_line1()?.to_owned(), locality: address.get_city()?.to_owned(), administrative_area: Secret::from(state), @@ -824,14 +727,14 @@ impl ForeignFrom for Vec { impl TryFrom<( &CybersourceRouterData<&types::PaymentsAuthorizeRouterData>, - domain::Card, + payments::Card, )> for CybersourcePaymentsRequest { type Error = error_stack::Report; fn try_from( (item, ccard): ( &CybersourceRouterData<&types::PaymentsAuthorizeRouterData>, - domain::Card, + payments::Card, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -850,11 +753,11 @@ impl expiration_month: ccard.card_exp_month, expiration_year: ccard.card_exp_year, security_code: ccard.card_cvc, - card_type: card_type.clone(), + card_type, }, }); - let processing_information = ProcessingInformation::try_from((item, None, card_type))?; + let processing_information = ProcessingInformation::try_from((item, None, None))?; let client_reference_information = ClientReferenceInformation::from(item); let merchant_defined_information = item.router_data.request.metadata.clone().map(|metadata| { @@ -875,14 +778,14 @@ impl impl TryFrom<( &CybersourceRouterData<&types::PaymentsCompleteAuthorizeRouterData>, - domain::Card, + payments::Card, )> for CybersourcePaymentsRequest { type Error = error_stack::Report; fn try_from( (item, ccard): ( &CybersourceRouterData<&types::PaymentsCompleteAuthorizeRouterData>, - domain::Card, + payments::Card, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -953,7 +856,7 @@ impl TryFrom<( &CybersourceRouterData<&types::PaymentsAuthorizeRouterData>, Box, - domain::ApplePayWalletData, + payments::ApplePayWalletData, )> for CybersourcePaymentsRequest { type Error = error_stack::Report; @@ -961,7 +864,7 @@ impl (item, apple_pay_data, apple_pay_wallet_data): ( &CybersourceRouterData<&types::PaymentsAuthorizeRouterData>, Box, - domain::ApplePayWalletData, + payments::ApplePayWalletData, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -1018,14 +921,14 @@ impl impl TryFrom<( &CybersourceRouterData<&types::PaymentsAuthorizeRouterData>, - domain::GooglePayWalletData, + payments::GooglePayWalletData, )> for CybersourcePaymentsRequest { type Error = error_stack::Report; fn try_from( (item, google_pay_data): ( &CybersourceRouterData<&types::PaymentsAuthorizeRouterData>, - domain::GooglePayWalletData, + payments::GooglePayWalletData, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -1037,7 +940,6 @@ impl value: Secret::from( consts::BASE64_ENGINE.encode(google_pay_data.tokenization_data.token), ), - descriptor: None, }, }); let processing_information = @@ -1070,9 +972,9 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> Some(connector_mandate_id) => Self::try_from((item, connector_mandate_id)), None => { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::ApplePay(apple_pay_data) => { + payments::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), + payments::PaymentMethodData::Wallet(wallet_data) => match wallet_data { + payments::WalletData::ApplePay(apple_pay_data) => { match item.router_data.payment_method_token.clone() { Some(payment_method_token) => match payment_method_token { types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { @@ -1104,7 +1006,6 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> ApplePayTokenPaymentInformation { fluid_data: FluidData { value: Secret::from(apple_pay_data.payment_data), - descriptor: Some(FLUID_DATA_DESCRIPTOR.to_string()), }, tokenized_card: ApplePayTokenizedCard { transaction_type: TransactionType::ApplePay, @@ -1146,33 +1047,33 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> } } } - domain::WalletData::GooglePay(google_pay_data) => { + payments::WalletData::GooglePay(google_pay_data) => { Self::try_from((item, google_pay_data)) } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => { + payments::WalletData::AliPayQr(_) + | payments::WalletData::AliPayRedirect(_) + | payments::WalletData::AliPayHkRedirect(_) + | payments::WalletData::MomoRedirect(_) + | payments::WalletData::KakaoPayRedirect(_) + | payments::WalletData::GoPayRedirect(_) + | payments::WalletData::GcashRedirect(_) + | payments::WalletData::ApplePayRedirect(_) + | payments::WalletData::ApplePayThirdPartySdk(_) + | payments::WalletData::DanaRedirect {} + | payments::WalletData::GooglePayRedirect(_) + | payments::WalletData::GooglePayThirdPartySdk(_) + | payments::WalletData::MbWayRedirect(_) + | payments::WalletData::MobilePayRedirect(_) + | payments::WalletData::PaypalRedirect(_) + | payments::WalletData::PaypalSdk(_) + | payments::WalletData::SamsungPay(_) + | payments::WalletData::TwintRedirect {} + | payments::WalletData::VippsRedirect {} + | payments::WalletData::TouchNGoRedirect(_) + | payments::WalletData::WeChatPayRedirect(_) + | payments::WalletData::WeChatPayQr(_) + | payments::WalletData::CashappQr(_) + | payments::WalletData::SwishQr(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message( "Cybersource", @@ -1183,7 +1084,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> }, // If connector_mandate_id is present MandatePayment will be the PMD, the case will be handled in the first `if` clause. // This is a fallback implementation in the event of catastrophe. - domain::PaymentMethodData::MandatePayment => { + payments::PaymentMethodData::MandatePayment => { let connector_mandate_id = item.router_data.request.connector_mandate_id().ok_or( errors::ConnectorError::MissingRequiredField { @@ -1192,17 +1093,17 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> )?; Self::try_from((item, connector_mandate_id)) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), ) @@ -1267,7 +1168,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> item: &CybersourceRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => { + payments::PaymentMethodData::Card(ccard) => { let card_issuer = ccard.get_card_issuer(); let card_type = match card_issuer { Ok(issuer) => Some(String::from(issuer)), @@ -1288,19 +1189,19 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> client_reference_information, }) } - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::Wallet(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), ) @@ -1385,7 +1286,6 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsIncrementalAuthorizationRout }), merchant_intitiated_transaction: Some(MerchantInitiatedTransaction { reason: Some("5".to_owned()), - previous_transaction_id: None, original_authorized_amount: None, }), }), @@ -1636,16 +1536,7 @@ pub struct ClientReferenceInformation { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ClientProcessorInformation { - network_transaction_id: Option, avs: Option, - card_verification: Option, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct CardVerification { - result_code: Option, - result_code_raw: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -1669,7 +1560,7 @@ pub struct ClientRiskInformationRules { #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CybersourceTokenInformation { - payment_instrument: Option, + payment_instrument: CybersoucrePaymentInstrument, } #[derive(Debug, Clone, Deserialize, Serialize)] @@ -1764,20 +1655,18 @@ fn get_payment_response( .token_information .clone() .map(|token_info| types::MandateReference { - connector_mandate_id: token_info - .payment_instrument - .map(|payment_instrument| payment_instrument.id.expose()), + connector_mandate_id: Some(token_info.payment_instrument.id.expose()), payment_method_id: None, }); - Ok(types::PaymentsResponseData::TransactionResponse { resource_id: types::ResponseId::ConnectorTransactionId(info_response.id.clone()), redirection_data: None, mandate_reference, - connector_metadata: None, - network_txn_id: info_response.processor_information.as_ref().and_then( - |processor_information| processor_information.network_transaction_id.clone(), - ), + connector_metadata: info_response + .processor_information + .as_ref() + .map(|processor_information| serde_json::json!({"avs_response": processor_information.avs})), + network_txn_id: None, connector_response_reference_id: Some( info_response .client_reference_information @@ -1817,16 +1706,9 @@ impl item.data.request.is_auto_capture()?, )); let response = get_payment_response((&info_response, status, item.http_code)); - let connector_response = info_response - .processor_information - .as_ref() - .map(types::AdditionalPaymentMethodConnectorResponse::from) - .map(types::ConnectorResponseData::with_additional_payment_method_data); - Ok(Self { status, response, - connector_response, ..item.data }) } @@ -1971,7 +1853,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsPreProcessingRouterData>> }, )?; let payment_information = match payment_method_data { - domain::PaymentMethodData::Card(ccard) => { + payments::PaymentMethodData::Card(ccard) => { let card_issuer = ccard.get_card_issuer(); let card_type = match card_issuer { Ok(issuer) => Some(String::from(issuer)), @@ -1987,19 +1869,19 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsPreProcessingRouterData>> }, })) } - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::Wallet(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), )) @@ -2087,20 +1969,20 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsCompleteAuthorizeRouterData> }, )?; match payment_method_data { - domain::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), + payments::PaymentMethodData::Wallet(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), ) @@ -2309,16 +2191,9 @@ impl item.data.request.is_auto_capture()?, )); let response = get_payment_response((&info_response, status, item.http_code)); - let connector_response = info_response - .processor_information - .as_ref() - .map(types::AdditionalPaymentMethodConnectorResponse::from) - .map(types::ConnectorResponseData::with_additional_payment_method_data); - Ok(Self { status, response, - connector_response, ..item.data }) } @@ -2331,19 +2206,6 @@ impl } } -impl From<&ClientProcessorInformation> for types::AdditionalPaymentMethodConnectorResponse { - fn from(processor_information: &ClientProcessorInformation) -> Self { - let payment_checks = Some( - serde_json::json!({"avs_response": processor_information.avs, "card_verification": processor_information.card_verification}), - ); - - Self::Card { - authentication_data: None, - payment_checks, - } - } -} - impl TryFrom< types::ResponseRouterData< @@ -2418,7 +2280,6 @@ impl } } -// zero dollar response impl TryFrom< types::ResponseRouterData< @@ -2442,9 +2303,7 @@ impl CybersourceSetupMandatesResponse::ClientReferenceInformation(info_response) => { let mandate_reference = info_response.token_information.clone().map(|token_info| { types::MandateReference { - connector_mandate_id: token_info - .payment_instrument - .map(|payment_instrument| payment_instrument.id.expose()), + connector_mandate_id: Some(token_info.payment_instrument.id.expose()), payment_method_id: None, } }); @@ -2457,12 +2316,6 @@ impl let error_response = get_error_response_if_failure((&info_response, mandate_status, item.http_code)); - let connector_response = info_response - .processor_information - .as_ref() - .map(types::AdditionalPaymentMethodConnectorResponse::from) - .map(types::ConnectorResponseData::with_additional_payment_method_data); - Ok(Self { status: mandate_status, response: match error_response { @@ -2474,11 +2327,7 @@ impl redirection_data: None, mandate_reference, connector_metadata: None, - network_txn_id: info_response.processor_information.as_ref().and_then( - |processor_information| { - processor_information.network_transaction_id.clone() - }, - ), + network_txn_id: None, connector_response_reference_id: Some( info_response .client_reference_information @@ -2491,7 +2340,6 @@ impl ), }), }, - connector_response, ..item.data }) } diff --git a/crates/router/src/connector/dlocal/transformers.rs b/crates/router/src/connector/dlocal/transformers.rs index 14337ca0765..c1b8731ee89 100644 --- a/crates/router/src/connector/dlocal/transformers.rs +++ b/crates/router/src/connector/dlocal/transformers.rs @@ -9,7 +9,7 @@ use crate::{ connector::utils::{AddressDetailsData, PaymentsAuthorizeRequestData, RouterData}, core::errors, services, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; #[derive(Debug, Default, Eq, PartialEq, Serialize)] @@ -107,7 +107,7 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP let country = address.get_country()?; let name = get_payer_name(address); match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => { + api::PaymentMethodData::Card(ref ccard) => { let should_capture = matches!( item.router_data.request.capture_method, Some(enums::CaptureMethod::Automatic) @@ -125,9 +125,9 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP document: get_doc_from_currency(country.to_string()), }, card: Some(Card { - holder_name: item - .router_data - .get_optional_billing_full_name() + holder_name: ccard + .card_holder_name + .clone() .unwrap_or(Secret::new("".to_string())), number: ccard.card_number.clone(), cvv: ccard.card_cvc.clone(), @@ -160,25 +160,21 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP }; Ok(payment_request) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - crate::connector::utils::get_unimplemented_payment_method_error_message( - "Dlocal", - ), - ))? - } + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + crate::connector::utils::get_unimplemented_payment_method_error_message("Dlocal"), + ))?, } } } diff --git a/crates/router/src/connector/dummyconnector/transformers.rs b/crates/router/src/connector/dummyconnector/transformers.rs index 52c9522842f..5c20d353583 100644 --- a/crates/router/src/connector/dummyconnector/transformers.rs +++ b/crates/router/src/connector/dummyconnector/transformers.rs @@ -4,10 +4,9 @@ use serde::{Deserialize, Serialize}; use url::Url; use crate::{ - connector::utils::RouterData, core::errors, services, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; #[derive(Debug, Serialize, strum::Display, Eq, PartialEq)] @@ -84,13 +83,13 @@ pub struct DummyConnectorCard { cvc: Secret, } -impl TryFrom<(domain::Card, Option>)> for DummyConnectorCard { +impl TryFrom for DummyConnectorCard { type Error = error_stack::Report; - fn try_from( - (value, card_holder_name): (domain::Card, Option>), - ) -> Result { + fn try_from(value: api_models::payments::Card) -> Result { Ok(Self { - name: card_holder_name.unwrap_or(Secret::new("".to_string())), + name: value + .card_holder_name + .unwrap_or(Secret::new("".to_string())), number: value.card_number, expiry_month: value.card_exp_month, expiry_year: value.card_exp_year, @@ -109,16 +108,16 @@ pub enum DummyConnectorWallet { AliPayHK, } -impl TryFrom for DummyConnectorWallet { +impl TryFrom for DummyConnectorWallet { type Error = error_stack::Report; - fn try_from(value: domain::WalletData) -> Result { + fn try_from(value: api_models::payments::WalletData) -> Result { match value { - domain::WalletData::GooglePayRedirect(_) => Ok(Self::GooglePay), - domain::WalletData::PaypalRedirect(_) => Ok(Self::Paypal), - domain::WalletData::WeChatPayRedirect(_) => Ok(Self::WeChatPay), - domain::WalletData::MbWayRedirect(_) => Ok(Self::MbWay), - domain::WalletData::AliPayRedirect(_) => Ok(Self::AliPay), - domain::WalletData::AliPayHkRedirect(_) => Ok(Self::AliPayHK), + api_models::payments::WalletData::GooglePayRedirect(_) => Ok(Self::GooglePay), + api_models::payments::WalletData::PaypalRedirect(_) => Ok(Self::Paypal), + api_models::payments::WalletData::WeChatPayRedirect(_) => Ok(Self::WeChatPay), + api_models::payments::WalletData::MbWayRedirect(_) => Ok(Self::MbWay), + api_models::payments::WalletData::AliPayRedirect(_) => Ok(Self::AliPay), + api_models::payments::WalletData::AliPayHkRedirect(_) => Ok(Self::AliPayHK), _ => Err(errors::ConnectorError::NotImplemented("Dummy wallet".to_string()).into()), } } @@ -131,13 +130,13 @@ pub enum DummyConnectorPayLater { AfterPayClearPay, } -impl TryFrom for DummyConnectorPayLater { +impl TryFrom for DummyConnectorPayLater { type Error = error_stack::Report; - fn try_from(value: domain::payments::PayLaterData) -> Result { + fn try_from(value: api_models::payments::PayLaterData) -> Result { match value { - domain::payments::PayLaterData::KlarnaRedirect { .. } => Ok(Self::Klarna), - domain::payments::PayLaterData::AffirmRedirect {} => Ok(Self::Affirm), - domain::payments::PayLaterData::AfterpayClearpayRedirect { .. } => { + api_models::payments::PayLaterData::KlarnaRedirect { .. } => Ok(Self::Klarna), + api_models::payments::PayLaterData::AffirmRedirect {} => Ok(Self::Affirm), + api_models::payments::PayLaterData::AfterpayClearpayRedirect { .. } => { Ok(Self::AfterPayClearPay) } _ => Err(errors::ConnectorError::NotImplemented("Dummy pay later".to_string()).into()), @@ -154,17 +153,13 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> .request .payment_method_data { - domain::PaymentMethodData::Card(ref req_card) => { - let card_holder_name = item.get_optional_billing_full_name(); - Ok(PaymentMethodData::Card(DummyConnectorCard::try_from(( - req_card.clone(), - card_holder_name, - ))?)) + api::PaymentMethodData::Card(ref req_card) => { + Ok(PaymentMethodData::Card(req_card.clone().try_into()?)) } - domain::PaymentMethodData::Wallet(ref wallet_data) => { + api::PaymentMethodData::Wallet(ref wallet_data) => { Ok(PaymentMethodData::Wallet(wallet_data.clone().try_into()?)) } - domain::PaymentMethodData::PayLater(ref pay_later_data) => Ok( + api::PaymentMethodData::PayLater(ref pay_later_data) => Ok( PaymentMethodData::PayLater(pay_later_data.clone().try_into()?), ), _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()), diff --git a/crates/router/src/connector/ebanx.rs b/crates/router/src/connector/ebanx.rs deleted file mode 100644 index 69cfc501f11..00000000000 --- a/crates/router/src/connector/ebanx.rs +++ /dev/null @@ -1,455 +0,0 @@ -pub mod transformers; - -use std::fmt::Debug; - -#[cfg(feature = "payouts")] -use common_utils::request::RequestContent; -use error_stack::{report, ResultExt}; -#[cfg(feature = "payouts")] -use router_env::{instrument, tracing}; -use transformers as ebanx; - -use crate::{ - configs::settings, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - services::{ConnectorIntegration, ConnectorValidation}, - types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - }, - utils::BytesExt, -}; -#[cfg(feature = "payouts")] -use crate::{ - headers, - services::{self, request}, -}; - -#[derive(Debug, Clone)] -pub struct Ebanx; - -impl api::Payment for Ebanx {} -impl api::PaymentSession for Ebanx {} -impl api::ConnectorAccessToken for Ebanx {} -impl api::MandateSetup for Ebanx {} -impl api::PaymentAuthorize for Ebanx {} -impl api::PaymentSync for Ebanx {} -impl api::PaymentCapture for Ebanx {} -impl api::PaymentVoid for Ebanx {} -impl api::Refund for Ebanx {} -impl api::RefundExecute for Ebanx {} -impl api::RefundSync for Ebanx {} -impl api::PaymentToken for Ebanx {} - -impl api::Payouts for Ebanx {} -#[cfg(feature = "payouts")] -impl api::PayoutCancel for Ebanx {} -#[cfg(feature = "payouts")] -impl api::PayoutCreate for Ebanx {} -#[cfg(feature = "payouts")] -impl api::PayoutEligibility for Ebanx {} -#[cfg(feature = "payouts")] -impl api::PayoutQuote for Ebanx {} -#[cfg(feature = "payouts")] -impl api::PayoutRecipient for Ebanx {} -#[cfg(feature = "payouts")] -impl api::PayoutFulfill for Ebanx {} - -impl ConnectorCommonExt for Ebanx -where - Self: ConnectorIntegration, -{ - #[cfg(feature = "payouts")] - fn build_headers( - &self, - _req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - let header = vec![( - headers::CONTENT_TYPE.to_string(), - self.common_get_content_type().to_string().into(), - )]; - Ok(header) - } -} - -impl ConnectorCommon for Ebanx { - fn id(&self) -> &'static str { - "ebanx" - } - - fn get_currency_unit(&self) -> api::CurrencyUnit { - api::CurrencyUnit::Base - } - - fn common_get_content_type(&self) -> &'static str { - "application/json" - } - - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { - connectors.ebanx.base_url.as_ref() - } - - fn build_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - let response: ebanx::EbanxErrorResponse = - res.response - .parse_struct("EbanxErrorResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - Ok(types::ErrorResponse { - status_code: res.status_code, - code: response.status_code, - message: response.code, - reason: response.message, - attempt_status: None, - connector_transaction_id: None, - }) - } -} - -#[cfg(feature = "payouts")] -impl ConnectorIntegration for Ebanx { - fn get_url( - &self, - _req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - Ok(format!("{}ws/payout/create", connectors.ebanx.base_url)) - } - - fn get_headers( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_request_body( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_router_data = ebanx::EbanxRouterData::try_from(( - &self.get_currency_unit(), - req.request.source_currency, - req.request.amount, - req, - ))?; - let connector_req = ebanx::EbanxPayoutCreateRequest::try_from(&connector_router_data)?; - Ok(RequestContent::Json(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PayoutCreateType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::PayoutCreateType::get_headers(self, req, connectors)?) - .set_body(types::PayoutCreateType::get_request_body( - self, req, connectors, - )?) - .build(); - - Ok(Some(request)) - } - - fn handle_response( - &self, - data: &types::PayoutsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> { - let response: ebanx::EbanxPayoutResponse = res - .response - .parse_struct("EbanxPayoutResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -#[cfg(feature = "payouts")] -impl ConnectorIntegration - for Ebanx -{ - fn get_url( - &self, - _req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - Ok(format!("{}ws/payout/commit", connectors.ebanx.base_url,)) - } - - fn get_headers( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_request_body( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_router_data = ebanx::EbanxRouterData::try_from(( - &self.get_currency_unit(), - req.request.source_currency, - req.request.amount, - req, - ))?; - let connector_req = ebanx::EbanxPayoutFulfillRequest::try_from(&connector_router_data)?; - Ok(RequestContent::Json(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PayoutFulfillType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::PayoutFulfillType::get_headers( - self, req, connectors, - )?) - .set_body(types::PayoutFulfillType::get_request_body( - self, req, connectors, - )?) - .build(); - - Ok(Some(request)) - } - - #[instrument(skip_all)] - fn handle_response( - &self, - data: &types::PayoutsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> { - let response: ebanx::EbanxFulfillResponse = res - .response - .parse_struct("EbanxFulfillResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -#[cfg(feature = "payouts")] -impl ConnectorIntegration for Ebanx { - fn get_url( - &self, - _req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - Ok(format!("{}ws/payout/cancel", connectors.ebanx.base_url,)) - } - - fn get_headers( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, _connectors) - } - - fn get_request_body( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_req = ebanx::EbanxPayoutCancelRequest::try_from(req)?; - Ok(RequestContent::Json(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Put) - .url(&types::PayoutCancelType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::PayoutCancelType::get_headers(self, req, connectors)?) - .set_body(types::PayoutCancelType::get_request_body( - self, req, connectors, - )?) - .build(); - - Ok(Some(request)) - } - - #[instrument(skip_all)] - fn handle_response( - &self, - data: &types::PayoutsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> { - let response: ebanx::EbanxCancelResponse = res - .response - .parse_struct("EbanxCancelResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -#[cfg(feature = "payouts")] -impl ConnectorIntegration for Ebanx {} - -#[cfg(feature = "payouts")] -impl ConnectorIntegration - for Ebanx -{ -} - -#[cfg(feature = "payouts")] -impl ConnectorIntegration - for Ebanx -{ -} - -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Ebanx -{ - // Not Implemented (R) -} - -impl ConnectorValidation for Ebanx { - //TODO: implement functions when support enabled -} - -impl ConnectorIntegration - for Ebanx -{ - //TODO: implement sessions flow -} - -impl ConnectorIntegration - for Ebanx -{ -} - -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Ebanx -{ -} - -impl ConnectorIntegration - for Ebanx -{ -} - -impl ConnectorIntegration - for Ebanx -{ -} - -impl ConnectorIntegration - for Ebanx -{ -} - -impl ConnectorIntegration - for Ebanx -{ -} - -impl ConnectorIntegration for Ebanx {} - -impl ConnectorIntegration for Ebanx {} - -impl api::IncomingWebhook for Ebanx { - fn get_webhook_object_reference_id( - &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Err(report!(errors::ConnectorError::WebhooksNotImplemented)) - } - - fn get_webhook_event_type( - &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Err(report!(errors::ConnectorError::WebhooksNotImplemented)) - } - - fn get_webhook_resource_object( - &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult, errors::ConnectorError> { - Err(report!(errors::ConnectorError::WebhooksNotImplemented)) - } -} diff --git a/crates/router/src/connector/ebanx/transformers.rs b/crates/router/src/connector/ebanx/transformers.rs deleted file mode 100644 index 472e2da1b69..00000000000 --- a/crates/router/src/connector/ebanx/transformers.rs +++ /dev/null @@ -1,406 +0,0 @@ -#[cfg(feature = "payouts")] -use api_models::payouts::{Bank, PayoutMethodData}; -use common_enums::Currency; -#[cfg(feature = "payouts")] -use common_utils::pii::Email; -#[cfg(feature = "payouts")] -use masking::ExposeInterface; -use masking::Secret; -use serde::{Deserialize, Serialize}; - -use crate::{ - connector::utils, - core::errors, - types::{self, api::CurrencyUnit}, -}; -#[cfg(feature = "payouts")] -use crate::{ - connector::utils::{AddressDetailsData, RouterData}, - connector::utils::{CustomerDetails, PayoutsData}, - types::{api, storage::enums as storage_enums}, -}; - -pub struct EbanxRouterData { - pub amount: f64, // The type of amount that a connector accepts, for example, String, i64, f64, etc. - pub router_data: T, -} - -impl TryFrom<(&CurrencyUnit, Currency, i64, T)> for EbanxRouterData { - type Error = error_stack::Report; - fn try_from( - (_currency_unit, currency, amount, item): (&CurrencyUnit, Currency, i64, T), - ) -> Result { - Ok(Self { - amount: utils::to_currency_base_unit_asf64(amount, currency)?, - router_data: item, - }) - } -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize, Clone)] -pub struct EbanxPayoutCreateRequest { - integration_key: Secret, - external_reference: String, - country: String, - amount: f64, - currency: Currency, - target: EbanxPayoutType, - target_account: Secret, - payee: EbanxPayoutDetails, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize, Clone)] -pub enum EbanxPayoutType { - BankAccount, - Mercadopago, - EwalletNequi, - PixKey, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize, Clone)] -pub struct EbanxPayoutDetails { - name: Secret, - email: Option, - document: Option>, - document_type: Option, - bank_info: EbanxBankDetails, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize, Clone)] -pub enum EbanxDocumentType { - #[serde(rename = "CPF")] - NaturalPersonsRegister, - #[serde(rename = "CNPJ")] - NationalRegistryOfLegalEntities, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize, Clone)] -pub struct EbanxBankDetails { - bank_name: Option, - bank_branch: Option, - bank_account: Option>, - account_type: Option, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize, Clone)] -pub enum EbanxBankAccountType { - #[serde(rename = "C")] - CheckingAccount, -} - -#[cfg(feature = "payouts")] -impl TryFrom<&EbanxRouterData<&types::PayoutsRouterData>> - for EbanxPayoutCreateRequest -{ - type Error = error_stack::Report; - fn try_from( - item: &EbanxRouterData<&types::PayoutsRouterData>, - ) -> Result { - let ebanx_auth_type = EbanxAuthType::try_from(&item.router_data.connector_auth_type)?; - match item.router_data.get_payout_method_data()? { - PayoutMethodData::Bank(Bank::Pix(pix_data)) => { - let bank_info = EbanxBankDetails { - bank_account: Some(pix_data.bank_account_number), - bank_branch: pix_data.bank_branch, - bank_name: pix_data.bank_name, - account_type: Some(EbanxBankAccountType::CheckingAccount), - }; - - let billing_address = item.router_data.get_billing_address()?; - let customer_details = item.router_data.request.get_customer_details()?; - - let document_type = pix_data.tax_id.clone().map(|tax_id| { - if tax_id.clone().expose().len() == 11 { - EbanxDocumentType::NaturalPersonsRegister - } else { - EbanxDocumentType::NationalRegistryOfLegalEntities - } - }); - - let payee = EbanxPayoutDetails { - name: billing_address.get_full_name()?, - email: customer_details.email.clone(), - bank_info, - document_type, - document: pix_data.tax_id.to_owned(), - }; - Ok(Self { - amount: item.amount, - integration_key: ebanx_auth_type.integration_key, - country: customer_details.get_customer_phone_country_code()?, - currency: item.router_data.request.source_currency, - external_reference: item.router_data.connector_request_reference_id.to_owned(), - target: EbanxPayoutType::PixKey, - target_account: pix_data.pix_key, - payee, - }) - } - PayoutMethodData::Card(_) | PayoutMethodData::Bank(_) | PayoutMethodData::Wallet(_) => { - Err(errors::ConnectorError::NotSupported { - message: "Payment Method Not Supported".to_string(), - connector: "Ebanx", - })? - } - } - } -} - -pub struct EbanxAuthType { - pub integration_key: Secret, -} - -impl TryFrom<&types::ConnectorAuthType> for EbanxAuthType { - type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { - match auth_type { - types::ConnectorAuthType::HeaderKey { api_key } => Ok(Self { - integration_key: api_key.to_owned(), - }), - _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), - } - } -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Clone, Serialize, Deserialize)] -pub enum EbanxPayoutStatus { - #[serde(rename = "PA")] - Succeeded, - #[serde(rename = "CA")] - Cancelled, - #[serde(rename = "PE")] - Processing, - #[serde(rename = "OP")] - RequiresFulfillment, -} - -#[cfg(feature = "payouts")] -impl From for storage_enums::PayoutStatus { - fn from(item: EbanxPayoutStatus) -> Self { - match item { - EbanxPayoutStatus::Succeeded => Self::Success, - EbanxPayoutStatus::Cancelled => Self::Cancelled, - EbanxPayoutStatus::Processing => Self::Pending, - EbanxPayoutStatus::RequiresFulfillment => Self::RequiresFulfillment, - } - } -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct EbanxPayoutResponse { - payout: EbanxPayoutResponseDetails, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct EbanxPayoutResponseDetails { - uid: String, - status: EbanxPayoutStatus, -} - -#[cfg(feature = "payouts")] -impl TryFrom> - for types::PayoutsRouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::PayoutsResponseRouterData, - ) -> Result { - Ok(Self { - response: Ok(types::PayoutsResponseData { - status: Some(storage_enums::PayoutStatus::from( - item.response.payout.status, - )), - connector_payout_id: item.response.payout.uid, - payout_eligible: None, - should_add_next_step_to_process_tracker: false, - }), - ..item.data - }) - } -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct EbanxPayoutFulfillRequest { - integration_key: Secret, - uid: String, -} - -#[cfg(feature = "payouts")] -impl TryFrom<&EbanxRouterData<&types::PayoutsRouterData>> for EbanxPayoutFulfillRequest { - type Error = error_stack::Report; - fn try_from(item: &EbanxRouterData<&types::PayoutsRouterData>) -> Result { - let request = item.router_data.request.to_owned(); - let ebanx_auth_type = EbanxAuthType::try_from(&item.router_data.connector_auth_type)?; - match request.payout_type.to_owned() { - storage_enums::PayoutType::Bank => Ok(Self { - integration_key: ebanx_auth_type.integration_key, - uid: request - .connector_payout_id - .to_owned() - .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "uid" })?, - }), - storage_enums::PayoutType::Card | storage_enums::PayoutType::Wallet => { - Err(errors::ConnectorError::NotSupported { - message: "Payout Method Not Supported".to_string(), - connector: "Ebanx", - })? - } - } - } -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct EbanxFulfillResponse { - #[serde(rename = "type")] - status: EbanxFulfillStatus, - message: String, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum EbanxFulfillStatus { - Success, - ApiError, - AuthenticationError, - InvalidRequestError, - RequestError, -} - -#[cfg(feature = "payouts")] -impl From for storage_enums::PayoutStatus { - fn from(item: EbanxFulfillStatus) -> Self { - match item { - EbanxFulfillStatus::Success => Self::Success, - EbanxFulfillStatus::ApiError - | EbanxFulfillStatus::AuthenticationError - | EbanxFulfillStatus::InvalidRequestError - | EbanxFulfillStatus::RequestError => Self::Failed, - } - } -} - -#[cfg(feature = "payouts")] -impl TryFrom> - for types::PayoutsRouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::PayoutsResponseRouterData, - ) -> Result { - Ok(Self { - response: Ok(types::PayoutsResponseData { - status: Some(storage_enums::PayoutStatus::from(item.response.status)), - connector_payout_id: item.data.request.get_transfer_id()?, - payout_eligible: None, - should_add_next_step_to_process_tracker: false, - }), - ..item.data - }) - } -} - -#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] -pub struct EbanxErrorResponse { - pub code: String, - pub status_code: String, - pub message: Option, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct EbanxPayoutCancelRequest { - integration_key: Secret, - uid: String, -} - -#[cfg(feature = "payouts")] -impl TryFrom<&types::PayoutsRouterData> for EbanxPayoutCancelRequest { - type Error = error_stack::Report; - fn try_from(item: &types::PayoutsRouterData) -> Result { - let request = item.request.to_owned(); - let ebanx_auth_type = EbanxAuthType::try_from(&item.connector_auth_type)?; - match request.payout_type.to_owned() { - storage_enums::PayoutType::Bank => Ok(Self { - integration_key: ebanx_auth_type.integration_key, - uid: request - .connector_payout_id - .to_owned() - .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "uid" })?, - }), - storage_enums::PayoutType::Card | storage_enums::PayoutType::Wallet => { - Err(errors::ConnectorError::NotSupported { - message: "Payout Method Not Supported".to_string(), - connector: "Ebanx", - })? - } - } - } -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct EbanxCancelResponse { - #[serde(rename = "type")] - status: EbanxCancelStatus, - message: String, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum EbanxCancelStatus { - Success, - ApiError, - AuthenticationError, - InvalidRequestError, - RequestError, -} - -#[cfg(feature = "payouts")] -impl From for storage_enums::PayoutStatus { - fn from(item: EbanxCancelStatus) -> Self { - match item { - EbanxCancelStatus::Success => Self::Cancelled, - EbanxCancelStatus::ApiError - | EbanxCancelStatus::AuthenticationError - | EbanxCancelStatus::InvalidRequestError - | EbanxCancelStatus::RequestError => Self::Failed, - } - } -} - -#[cfg(feature = "payouts")] -impl TryFrom> - for types::PayoutsRouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::PayoutsResponseRouterData, - ) -> Result { - Ok(Self { - response: Ok(types::PayoutsResponseData { - status: Some(storage_enums::PayoutStatus::from(item.response.status)), - connector_payout_id: item - .data - .request - .connector_payout_id - .clone() - .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?, - payout_eligible: None, - should_add_next_step_to_process_tracker: false, - }), - ..item.data - }) - } -} diff --git a/crates/router/src/connector/fiserv/transformers.rs b/crates/router/src/connector/fiserv/transformers.rs index fcb808c6700..dac2a3b2fba 100644 --- a/crates/router/src/connector/fiserv/transformers.rs +++ b/crates/router/src/connector/fiserv/transformers.rs @@ -9,7 +9,7 @@ use crate::{ }, core::errors, pii::Secret, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; #[derive(Debug, Serialize)] @@ -173,7 +173,7 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP pos_condition_code: TransactionInteractionPosConditionCode::CardNotPresentEcom, }; let source = match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ref ccard) => { + api::PaymentMethodData::Card(ref ccard) => { let card = CardData { card_data: ccard.card_number.clone(), expiration_month: ccard.card_exp_month.clone(), @@ -182,19 +182,19 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP }; Source::PaymentCard { card } } - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("fiserv"), )) diff --git a/crates/router/src/connector/forte/transformers.rs b/crates/router/src/connector/forte/transformers.rs index 861801d1295..00efbefe287 100644 --- a/crates/router/src/connector/forte/transformers.rs +++ b/crates/router/src/connector/forte/transformers.rs @@ -7,7 +7,7 @@ use crate::{ self, AddressDetailsData, CardData, PaymentsAuthorizeRequestData, RouterData, }, core::errors, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, + types::{self, api, storage::enums, transformers::ForeignFrom}, }; #[derive(Debug, Serialize)] @@ -71,7 +71,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for FortePaymentsRequest { ))? } match item.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => { + api_models::payments::PaymentMethodData::Card(ref ccard) => { let action = match item.request.is_auto_capture()? { true => ForteAction::Sale, false => ForteAction::Authorize, @@ -80,18 +80,18 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for FortePaymentsRequest { let address = item.get_billing_address()?; let card = Card { card_type, - name_on_card: item - .get_optional_billing_full_name() + name_on_card: ccard + .card_holder_name + .clone() .unwrap_or(Secret::new("".to_string())), account_number: ccard.card_number.clone(), expire_month: ccard.card_exp_month.clone(), expire_year: ccard.card_exp_year.clone(), card_verification_value: ccard.card_cvc.clone(), }; - let first_name = address.get_first_name()?; let billing_address = BillingAddress { - first_name: first_name.clone(), - last_name: address.get_last_name().unwrap_or(first_name).clone(), + first_name: address.get_first_name()?.to_owned(), + last_name: address.get_last_name()?.to_owned(), }; let authorization_amount = utils::to_currency_base_unit_asf64(item.request.amount, item.request.currency)?; @@ -102,19 +102,19 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for FortePaymentsRequest { card, }) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment {} - | domain::PaymentMethodData::Reward {} - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment {} + | api_models::payments::PaymentMethodData::Reward {} + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Forte"), ))? diff --git a/crates/router/src/connector/globalpay.rs b/crates/router/src/connector/globalpay.rs index 6397cb75cfd..447c0568dc1 100644 --- a/crates/router/src/connector/globalpay.rs +++ b/crates/router/src/connector/globalpay.rs @@ -975,9 +975,7 @@ impl services::ConnectorRedirectResponse for Globalpay { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/globalpay/requests.rs b/crates/router/src/connector/globalpay/requests.rs index 79785563f3c..1e5413bc838 100644 --- a/crates/router/src/connector/globalpay/requests.rs +++ b/crates/router/src/connector/globalpay/requests.rs @@ -337,7 +337,7 @@ pub struct Card { pub expiry_year: Secret, /// Indicates whether the card is a debit or credit card. pub funding: Option, - /// The card account number used to authorize the transaction. Also known as PAN. + /// The the card account number used to authorize the transaction. Also known as PAN. pub number: cards::CardNumber, /// Contains the pin block info, relating to the pin code the Payer entered. pub pin_block: Option>, @@ -776,7 +776,7 @@ pub enum Model { Unscheduled, } -/// The reason stored credentials are being used to create a transaction. +/// The reason stored credentials are being used to to create a transaction. #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum Reason { diff --git a/crates/router/src/connector/globalpay/transformers.rs b/crates/router/src/connector/globalpay/transformers.rs index cfb822715bf..ae6f8d3966a 100644 --- a/crates/router/src/connector/globalpay/transformers.rs +++ b/crates/router/src/connector/globalpay/transformers.rs @@ -17,7 +17,7 @@ use crate::{ consts, core::errors, services::{self, RedirectForm}, - types::{self, api, domain, storage::enums, ErrorResponse}, + types::{self, api, storage::enums, ErrorResponse}, }; type Error = error_stack::Report; @@ -380,7 +380,7 @@ fn get_payment_method_data( brand_reference: Option, ) -> Result { match &item.request.payment_method_data { - domain::PaymentMethodData::Card(ccard) => Ok(PaymentMethodData::Card(requests::Card { + api::PaymentMethodData::Card(ccard) => Ok(PaymentMethodData::Card(requests::Card { number: ccard.card_number.clone(), expiry_month: ccard.card_exp_month.clone(), expiry_year: ccard.get_card_expiry_year_2_digit()?, @@ -396,8 +396,8 @@ fn get_payment_method_data( tag: None, track: None, })), - domain::PaymentMethodData::Wallet(wallet_data) => get_wallet_data(wallet_data), - domain::PaymentMethodData::BankRedirect(bank_redirect) => { + api::PaymentMethodData::Wallet(wallet_data) => get_wallet_data(wallet_data), + api::PaymentMethodData::BankRedirect(bank_redirect) => { PaymentMethodData::try_from(bank_redirect) } _ => Err(errors::ConnectorError::NotImplemented( @@ -408,7 +408,7 @@ fn get_payment_method_data( fn get_return_url(item: &types::PaymentsAuthorizeRouterData) -> Option { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Wallet(domain::WalletData::PaypalRedirect(_)) => { + api::PaymentMethodData::Wallet(api_models::payments::WalletData::PaypalRedirect(_)) => { item.request.complete_authorize_url.clone() } _ => item.request.router_return_url.clone(), @@ -445,12 +445,16 @@ fn get_mandate_details(item: &types::PaymentsAuthorizeRouterData) -> Result Result { +fn get_wallet_data( + wallet_data: &api_models::payments::WalletData, +) -> Result { match wallet_data { - domain::WalletData::PaypalRedirect(_) => Ok(PaymentMethodData::Apm(requests::Apm { - provider: Some(ApmProvider::Paypal), - })), - domain::WalletData::GooglePay(_) => { + api_models::payments::WalletData::PaypalRedirect(_) => { + Ok(PaymentMethodData::Apm(requests::Apm { + provider: Some(ApmProvider::Paypal), + })) + } + api_models::payments::WalletData::GooglePay(_) => { Ok(PaymentMethodData::DigitalWallet(requests::DigitalWallet { provider: Some(requests::DigitalWalletProvider::PayByGoogle), payment_token: wallet_data.get_wallet_token_as_json("Google Pay".to_string())?, @@ -462,20 +466,22 @@ fn get_wallet_data(wallet_data: &domain::WalletData) -> Result for PaymentMethodData { +impl TryFrom<&api_models::payments::BankRedirectData> for PaymentMethodData { type Error = Error; - fn try_from(value: &domain::BankRedirectData) -> Result { + fn try_from(value: &api_models::payments::BankRedirectData) -> Result { match value { - domain::BankRedirectData::Eps { .. } => Ok(Self::Apm(requests::Apm { + api_models::payments::BankRedirectData::Eps { .. } => Ok(Self::Apm(requests::Apm { provider: Some(ApmProvider::Eps), })), - domain::BankRedirectData::Giropay { .. } => Ok(Self::Apm(requests::Apm { - provider: Some(ApmProvider::Giropay), - })), - domain::BankRedirectData::Ideal { .. } => Ok(Self::Apm(requests::Apm { + api_models::payments::BankRedirectData::Giropay { .. } => { + Ok(Self::Apm(requests::Apm { + provider: Some(ApmProvider::Giropay), + })) + } + api_models::payments::BankRedirectData::Ideal { .. } => Ok(Self::Apm(requests::Apm { provider: Some(ApmProvider::Ideal), })), - domain::BankRedirectData::Sofort { .. } => Ok(Self::Apm(requests::Apm { + api_models::payments::BankRedirectData::Sofort { .. } => Ok(Self::Apm(requests::Apm { provider: Some(ApmProvider::Sofort), })), _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), diff --git a/crates/router/src/connector/globepay/transformers.rs b/crates/router/src/connector/globepay/transformers.rs index efe96454933..c988bff52ea 100644 --- a/crates/router/src/connector/globepay/transformers.rs +++ b/crates/router/src/connector/globepay/transformers.rs @@ -7,7 +7,7 @@ use crate::{ connector::utils::{self, RouterData}, consts, core::errors, - types::{self, domain, storage::enums}, + types::{self, api, storage::enums}, }; type Error = error_stack::Report; @@ -29,53 +29,51 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for GlobepayPaymentsRequest { type Error = Error; fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { let channel: GlobepayChannel = match &item.request.payment_method_data { - domain::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data { - domain::WalletData::AliPayQr(_) => GlobepayChannel::Alipay, - domain::WalletData::WeChatPayQr(_) => GlobepayChannel::Wechat, - domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePay(_) - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( + api::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data { + api::WalletData::AliPayQr(_) => GlobepayChannel::Alipay, + api::WalletData::WeChatPayQr(_) => GlobepayChannel::Wechat, + api::WalletData::AliPayRedirect(_) + | api::WalletData::AliPayHkRedirect(_) + | api::WalletData::MomoRedirect(_) + | api::WalletData::KakaoPayRedirect(_) + | api::WalletData::GoPayRedirect(_) + | api::WalletData::GcashRedirect(_) + | api::WalletData::ApplePay(_) + | api::WalletData::ApplePayRedirect(_) + | api::WalletData::ApplePayThirdPartySdk(_) + | api::WalletData::DanaRedirect {} + | api::WalletData::GooglePay(_) + | api::WalletData::GooglePayRedirect(_) + | api::WalletData::GooglePayThirdPartySdk(_) + | api::WalletData::MbWayRedirect(_) + | api::WalletData::MobilePayRedirect(_) + | api::WalletData::PaypalRedirect(_) + | api::WalletData::PaypalSdk(_) + | api::WalletData::SamsungPay(_) + | api::WalletData::TwintRedirect {} + | api::WalletData::VippsRedirect {} + | api::WalletData::TouchNGoRedirect(_) + | api::WalletData::WeChatPayRedirect(_) + | api::WalletData::CashappQr(_) + | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("globepay"), ))?, }, - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("globepay"), - ))? - } + api::PaymentMethodData::Card(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("globepay"), + ))?, }; let description = item.get_description()?; Ok(Self { diff --git a/crates/router/src/connector/gocardless/transformers.rs b/crates/router/src/connector/gocardless/transformers.rs index 59177307f22..21fc44fe84f 100644 --- a/crates/router/src/connector/gocardless/transformers.rs +++ b/crates/router/src/connector/gocardless/transformers.rs @@ -1,6 +1,6 @@ use api_models::{ - enums::{CountryAlpha2, UsStatesAbbreviation}, - payments::AddressDetails, + enums::{BankType, CountryAlpha2, UsStatesAbbreviation}, + payments::{AddressDetails, BankDebitData}, }; use common_utils::pii::{self, IpAddress}; use masking::{ExposeInterface, Secret}; @@ -14,8 +14,7 @@ use crate::{ }, core::errors, types::{ - self, api, domain, storage::enums, transformers::ForeignTryFrom, MandateReference, - ResponseId, + self, api, storage::enums, transformers::ForeignTryFrom, MandateReference, ResponseId, }, }; @@ -80,37 +79,37 @@ impl TryFrom<&types::ConnectorCustomerRouterData> for GocardlessCustomerRequest fn try_from(item: &types::ConnectorCustomerRouterData) -> Result { let email = item.request.get_email()?; let billing_details = match &item.request.payment_method_data { - domain::PaymentMethodData::BankDebit(bank_debit_data) => { + api_models::payments::PaymentMethodData::BankDebit(bank_debit_data) => { match bank_debit_data.clone() { - domain::BankDebitData::AchBankDebit { + BankDebitData::AchBankDebit { billing_details, .. } => Ok(billing_details), - domain::BankDebitData::SepaBankDebit { + BankDebitData::SepaBankDebit { billing_details, .. } => Ok(billing_details), - domain::BankDebitData::BecsBankDebit { + BankDebitData::BecsBankDebit { billing_details, .. } => Ok(billing_details), - domain::BankDebitData::BacsBankDebit { .. } => { + BankDebitData::BacsBankDebit { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Gocardless"), )) } } } - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::Card(_) + | api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Gocardless"), )) @@ -285,36 +284,34 @@ impl TryFrom<&types::TokenizationRouterData> for CustomerBankAccount { type Error = error_stack::Report; fn try_from(item: &types::TokenizationRouterData) -> Result { match &item.request.payment_method_data { - domain::PaymentMethodData::BankDebit(bank_debit_data) => { + api_models::payments::PaymentMethodData::BankDebit(bank_debit_data) => { Self::try_from(bank_debit_data) } - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Gocardless"), - ) - .into()) - } + api_models::payments::PaymentMethodData::Card(_) + | api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Gocardless"), + ) + .into()), } } } -impl TryFrom<&domain::BankDebitData> for CustomerBankAccount { +impl TryFrom<&BankDebitData> for CustomerBankAccount { type Error = error_stack::Report; - fn try_from(item: &domain::BankDebitData) -> Result { + fn try_from(item: &BankDebitData) -> Result { match item { - domain::BankDebitData::AchBankDebit { + BankDebitData::AchBankDebit { billing_details, account_number, routing_number, @@ -339,7 +336,7 @@ impl TryFrom<&domain::BankDebitData> for CustomerBankAccount { }; Ok(Self::USBankAccount(us_bank_account)) } - domain::BankDebitData::BecsBankDebit { + BankDebitData::BecsBankDebit { billing_details, account_number, bsb_number, @@ -360,7 +357,7 @@ impl TryFrom<&domain::BankDebitData> for CustomerBankAccount { }; Ok(Self::AUBankAccount(au_bank_account)) } - domain::BankDebitData::SepaBankDebit { + BankDebitData::SepaBankDebit { iban, bank_account_holder_name, .. @@ -377,21 +374,19 @@ impl TryFrom<&domain::BankDebitData> for CustomerBankAccount { }; Ok(Self::InternationalBankAccount(international_bank_account)) } - domain::BankDebitData::BacsBankDebit { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Gocardless"), - ) - .into()) - } + BankDebitData::BacsBankDebit { .. } => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Gocardless"), + ) + .into()), } } } -impl From for AccountType { - fn from(item: common_enums::BankType) -> Self { +impl From for AccountType { + fn from(item: BankType) -> Self { match item { - common_enums::BankType::Checking => Self::Checking, - common_enums::BankType::Savings => Self::Savings, + BankType::Checking => Self::Checking, + BankType::Savings => Self::Savings, } } } @@ -470,30 +465,28 @@ impl TryFrom<&types::SetupMandateRouterData> for GocardlessMandateRequest { type Error = error_stack::Report; fn try_from(item: &types::SetupMandateRouterData) -> Result { let (scheme, payer_ip_address) = match &item.request.payment_method_data { - domain::PaymentMethodData::BankDebit(bank_debit_data) => { + api_models::payments::PaymentMethodData::BankDebit(bank_debit_data) => { let payer_ip_address = get_ip_if_required(bank_debit_data, item)?; Ok(( GocardlessScheme::try_from(bank_debit_data)?, payer_ip_address, )) } - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - "Setup Mandate flow for selected payment method through Gocardless".to_string(), - )) - } + api_models::payments::PaymentMethodData::Card(_) + | api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + "Setup Mandate flow for selected payment method through Gocardless".to_string(), + )), }?; let payment_method_token = item.get_payment_method_token()?; let customer_bank_account = match payment_method_token { @@ -520,31 +513,29 @@ impl TryFrom<&types::SetupMandateRouterData> for GocardlessMandateRequest { } fn get_ip_if_required( - bank_debit_data: &domain::BankDebitData, + bank_debit_data: &BankDebitData, item: &types::SetupMandateRouterData, ) -> Result>, error_stack::Report> { let ip_address = item.request.get_browser_info()?.get_ip_address()?; match bank_debit_data { - domain::BankDebitData::AchBankDebit { .. } => Ok(Some(ip_address)), - domain::BankDebitData::SepaBankDebit { .. } - | domain::BankDebitData::BecsBankDebit { .. } - | domain::BankDebitData::BacsBankDebit { .. } => Ok(None), + BankDebitData::AchBankDebit { .. } => Ok(Some(ip_address)), + BankDebitData::SepaBankDebit { .. } + | BankDebitData::BecsBankDebit { .. } + | BankDebitData::BacsBankDebit { .. } => Ok(None), } } -impl TryFrom<&domain::BankDebitData> for GocardlessScheme { +impl TryFrom<&BankDebitData> for GocardlessScheme { type Error = error_stack::Report; - fn try_from(item: &domain::BankDebitData) -> Result { + fn try_from(item: &BankDebitData) -> Result { match item { - domain::BankDebitData::AchBankDebit { .. } => Ok(Self::Ach), - domain::BankDebitData::SepaBankDebit { .. } => Ok(Self::SepaCore), - domain::BankDebitData::BecsBankDebit { .. } => Ok(Self::Becs), - domain::BankDebitData::BacsBankDebit { .. } => { - Err(errors::ConnectorError::NotImplemented( - "Setup Mandate flow for selected payment method through Gocardless".to_string(), - ) - .into()) - } + BankDebitData::AchBankDebit { .. } => Ok(Self::Ach), + BankDebitData::SepaBankDebit { .. } => Ok(Self::SepaCore), + BankDebitData::BecsBankDebit { .. } => Ok(Self::Becs), + BankDebitData::BacsBankDebit { .. } => Err(errors::ConnectorError::NotImplemented( + "Setup Mandate flow for selected payment method through Gocardless".to_string(), + ) + .into()), } } } diff --git a/crates/router/src/connector/helcim/transformers.rs b/crates/router/src/connector/helcim/transformers.rs index 2dc44c8a19b..66cb2666038 100644 --- a/crates/router/src/connector/helcim/transformers.rs +++ b/crates/router/src/connector/helcim/transformers.rs @@ -10,7 +10,7 @@ use crate::{ RefundsRequestData, RouterData, }, core::errors, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; #[derive(Debug, Serialize)] @@ -121,11 +121,9 @@ pub struct HelcimCard { card_c_v_v: Secret, } -impl TryFrom<(&types::SetupMandateRouterData, &domain::Card)> for HelcimVerifyRequest { +impl TryFrom<(&types::SetupMandateRouterData, &api::Card)> for HelcimVerifyRequest { type Error = error_stack::Report; - fn try_from( - value: (&types::SetupMandateRouterData, &domain::Card), - ) -> Result { + fn try_from(value: (&types::SetupMandateRouterData, &api::Card)) -> Result { let (item, req_card) = value; let card_data = HelcimCard { card_expiry: req_card @@ -159,22 +157,22 @@ impl TryFrom<&types::SetupMandateRouterData> for HelcimVerifyRequest { type Error = error_stack::Report; fn try_from(item: &types::SetupMandateRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(req_card) => Self::try_from((item, &req_card)), - domain::PaymentMethodData::BankTransfer(_) => { + api::PaymentMethodData::Card(req_card) => Self::try_from((item, &req_card)), + api_models::payments::PaymentMethodData::BankTransfer(_) => { Err(errors::ConnectorError::NotImplemented("Payment Method".to_string()).into()) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Helcim"), ))? @@ -186,14 +184,14 @@ impl TryFrom<&types::SetupMandateRouterData> for HelcimVerifyRequest { impl TryFrom<( &HelcimRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, + &api::Card, )> for HelcimPaymentsRequest { type Error = error_stack::Report; fn try_from( value: ( &HelcimRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, + &api::Card, ), ) -> Result { let (item, req_card) = value; @@ -260,26 +258,24 @@ impl TryFrom<&HelcimRouterData<&types::PaymentsAuthorizeRouterData>> for HelcimP item: &HelcimRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(req_card) => Self::try_from((item, &req_card)), - domain::PaymentMethodData::BankTransfer(_) => { + api::PaymentMethodData::Card(req_card) => Self::try_from((item, &req_card)), + api_models::payments::PaymentMethodData::BankTransfer(_) => { Err(errors::ConnectorError::NotImplemented("Payment Method".to_string()).into()) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Helcim"), - ))? - } + api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Helcim"), + ))?, } } } diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs index 8e45b96e69c..0a5f592c765 100644 --- a/crates/router/src/connector/iatapay/transformers.rs +++ b/crates/router/src/connector/iatapay/transformers.rs @@ -12,7 +12,7 @@ use crate::{ consts, core::errors, services, - types::{self, api, domain, storage::enums, PaymentsAuthorizeData}, + types::{self, api, storage::enums, PaymentsAuthorizeData}, }; type Error = error_stack::Report; @@ -149,22 +149,22 @@ impl }; let return_url = item.router_data.get_return_url()?; let payer_info = match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Upi(upi_data) => upi_data.vpa_id.map(|id| PayerInfo { + api::PaymentMethodData::Upi(upi_data) => upi_data.vpa_id.map(|id| PayerInfo { token_id: id.switch_strategy(), }), - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => None, + api::PaymentMethodData::Card(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => None, }; let payload = Self { merchant_id: IatapayAuthType::try_from(&item.router_data.connector_auth_type)? diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rs index 5c174c69e3b..91ef719e5e0 100644 --- a/crates/router/src/connector/klarna.rs +++ b/crates/router/src/connector/klarna.rs @@ -1,6 +1,7 @@ pub mod transformers; use std::fmt::Debug; +use api_models::payments as api_payments; use common_utils::request::RequestContent; use error_stack::{report, ResultExt}; use transformers as klarna; @@ -20,7 +21,7 @@ use crate::{ types::{ self, api::{self, ConnectorCommon}, - domain, + storage::enums as storage_enums, }, utils::BytesExt, }; @@ -306,130 +307,128 @@ impl .ok_or_else(connector_utils::missing_field_err("payment_method_type"))?; match payment_method_data { - domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaSdk { token }) => { - match (payment_experience, payment_method_type) { - ( - common_enums::PaymentExperience::InvokeSdkClient, - common_enums::PaymentMethodType::Klarna, - ) => Ok(format!( - "{}payments/v1/authorizations/{}/order", - self.base_url(connectors), - token - )), - ( - common_enums::PaymentExperience::DisplayQrCode - | common_enums::PaymentExperience::DisplayWaitScreen - | common_enums::PaymentExperience::InvokePaymentApp - | common_enums::PaymentExperience::InvokeSdkClient - | common_enums::PaymentExperience::LinkWallet - | common_enums::PaymentExperience::OneClick - | common_enums::PaymentExperience::RedirectToUrl, - common_enums::PaymentMethodType::Ach - | common_enums::PaymentMethodType::Affirm - | common_enums::PaymentMethodType::AfterpayClearpay - | common_enums::PaymentMethodType::Alfamart - | common_enums::PaymentMethodType::AliPay - | common_enums::PaymentMethodType::AliPayHk - | common_enums::PaymentMethodType::Alma - | common_enums::PaymentMethodType::ApplePay - | common_enums::PaymentMethodType::Atome - | common_enums::PaymentMethodType::Bacs - | common_enums::PaymentMethodType::BancontactCard - | common_enums::PaymentMethodType::Becs - | common_enums::PaymentMethodType::Benefit - | common_enums::PaymentMethodType::Bizum - | common_enums::PaymentMethodType::Blik - | common_enums::PaymentMethodType::Boleto - | common_enums::PaymentMethodType::BcaBankTransfer - | common_enums::PaymentMethodType::BniVa - | common_enums::PaymentMethodType::BriVa - | common_enums::PaymentMethodType::CardRedirect - | common_enums::PaymentMethodType::CimbVa - | common_enums::PaymentMethodType::ClassicReward - | common_enums::PaymentMethodType::Credit - | common_enums::PaymentMethodType::CryptoCurrency - | common_enums::PaymentMethodType::Cashapp - | common_enums::PaymentMethodType::Dana - | common_enums::PaymentMethodType::DanamonVa - | common_enums::PaymentMethodType::Debit - | common_enums::PaymentMethodType::Efecty - | common_enums::PaymentMethodType::Eps - | common_enums::PaymentMethodType::Evoucher - | common_enums::PaymentMethodType::Giropay - | common_enums::PaymentMethodType::Givex - | common_enums::PaymentMethodType::GooglePay - | common_enums::PaymentMethodType::GoPay - | common_enums::PaymentMethodType::Gcash - | common_enums::PaymentMethodType::Ideal - | common_enums::PaymentMethodType::Interac - | common_enums::PaymentMethodType::Indomaret - | common_enums::PaymentMethodType::Klarna - | common_enums::PaymentMethodType::KakaoPay - | common_enums::PaymentMethodType::MandiriVa - | common_enums::PaymentMethodType::Knet - | common_enums::PaymentMethodType::MbWay - | common_enums::PaymentMethodType::MobilePay - | common_enums::PaymentMethodType::Momo - | common_enums::PaymentMethodType::MomoAtm - | common_enums::PaymentMethodType::Multibanco - | common_enums::PaymentMethodType::OnlineBankingThailand - | common_enums::PaymentMethodType::OnlineBankingCzechRepublic - | common_enums::PaymentMethodType::OnlineBankingFinland - | common_enums::PaymentMethodType::OnlineBankingFpx - | common_enums::PaymentMethodType::OnlineBankingPoland - | common_enums::PaymentMethodType::OnlineBankingSlovakia - | common_enums::PaymentMethodType::Oxxo - | common_enums::PaymentMethodType::PagoEfectivo - | common_enums::PaymentMethodType::PermataBankTransfer - | common_enums::PaymentMethodType::OpenBankingUk - | common_enums::PaymentMethodType::PayBright - | common_enums::PaymentMethodType::Paypal - | common_enums::PaymentMethodType::Pix - | common_enums::PaymentMethodType::PaySafeCard - | common_enums::PaymentMethodType::Przelewy24 - | common_enums::PaymentMethodType::Pse - | common_enums::PaymentMethodType::RedCompra - | common_enums::PaymentMethodType::RedPagos - | common_enums::PaymentMethodType::SamsungPay - | common_enums::PaymentMethodType::Sepa - | common_enums::PaymentMethodType::Sofort - | common_enums::PaymentMethodType::Swish - | common_enums::PaymentMethodType::TouchNGo - | common_enums::PaymentMethodType::Trustly - | common_enums::PaymentMethodType::Twint - | common_enums::PaymentMethodType::UpiCollect - | common_enums::PaymentMethodType::Venmo - | common_enums::PaymentMethodType::Vipps - | common_enums::PaymentMethodType::Walley - | common_enums::PaymentMethodType::WeChatPay - | common_enums::PaymentMethodType::SevenEleven - | common_enums::PaymentMethodType::Lawson - | common_enums::PaymentMethodType::LocalBankTransfer - | common_enums::PaymentMethodType::MiniStop - | common_enums::PaymentMethodType::FamilyMart - | common_enums::PaymentMethodType::Seicomart - | common_enums::PaymentMethodType::PayEasy, - ) => Err(error_stack::report!(errors::ConnectorError::NotSupported { - message: payment_method_type.to_string(), - connector: "klarna", - })), - } - } - - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => Err(error_stack::report!( + api_payments::PaymentMethodData::PayLater(api_payments::PayLaterData::KlarnaSdk { + token, + }) => match (payment_experience, payment_method_type) { + ( + storage_enums::PaymentExperience::InvokeSdkClient, + storage_enums::PaymentMethodType::Klarna, + ) => Ok(format!( + "{}payments/v1/authorizations/{}/order", + self.base_url(connectors), + token + )), + ( + storage_enums::PaymentExperience::DisplayQrCode + | storage_enums::PaymentExperience::DisplayWaitScreen + | storage_enums::PaymentExperience::InvokePaymentApp + | storage_enums::PaymentExperience::InvokeSdkClient + | storage_enums::PaymentExperience::LinkWallet + | storage_enums::PaymentExperience::OneClick + | storage_enums::PaymentExperience::RedirectToUrl, + api_models::enums::PaymentMethodType::Ach + | api_models::enums::PaymentMethodType::Affirm + | api_models::enums::PaymentMethodType::AfterpayClearpay + | api_models::enums::PaymentMethodType::Alfamart + | api_models::enums::PaymentMethodType::AliPay + | api_models::enums::PaymentMethodType::AliPayHk + | api_models::enums::PaymentMethodType::Alma + | api_models::enums::PaymentMethodType::ApplePay + | api_models::enums::PaymentMethodType::Atome + | api_models::enums::PaymentMethodType::Bacs + | api_models::enums::PaymentMethodType::BancontactCard + | api_models::enums::PaymentMethodType::Becs + | api_models::enums::PaymentMethodType::Benefit + | api_models::enums::PaymentMethodType::Bizum + | api_models::enums::PaymentMethodType::Blik + | api_models::enums::PaymentMethodType::Boleto + | api_models::enums::PaymentMethodType::BcaBankTransfer + | api_models::enums::PaymentMethodType::BniVa + | api_models::enums::PaymentMethodType::BriVa + | api_models::enums::PaymentMethodType::CardRedirect + | api_models::enums::PaymentMethodType::CimbVa + | api_models::enums::PaymentMethodType::ClassicReward + | api_models::enums::PaymentMethodType::Credit + | api_models::enums::PaymentMethodType::CryptoCurrency + | api_models::enums::PaymentMethodType::Cashapp + | api_models::enums::PaymentMethodType::Dana + | api_models::enums::PaymentMethodType::DanamonVa + | api_models::enums::PaymentMethodType::Debit + | api_models::enums::PaymentMethodType::Efecty + | api_models::enums::PaymentMethodType::Eps + | api_models::enums::PaymentMethodType::Evoucher + | api_models::enums::PaymentMethodType::Giropay + | api_models::enums::PaymentMethodType::Givex + | api_models::enums::PaymentMethodType::GooglePay + | api_models::enums::PaymentMethodType::GoPay + | api_models::enums::PaymentMethodType::Gcash + | api_models::enums::PaymentMethodType::Ideal + | api_models::enums::PaymentMethodType::Interac + | api_models::enums::PaymentMethodType::Indomaret + | api_models::enums::PaymentMethodType::Klarna + | api_models::enums::PaymentMethodType::KakaoPay + | api_models::enums::PaymentMethodType::MandiriVa + | api_models::enums::PaymentMethodType::Knet + | api_models::enums::PaymentMethodType::MbWay + | api_models::enums::PaymentMethodType::MobilePay + | api_models::enums::PaymentMethodType::Momo + | api_models::enums::PaymentMethodType::MomoAtm + | api_models::enums::PaymentMethodType::Multibanco + | api_models::enums::PaymentMethodType::OnlineBankingThailand + | api_models::enums::PaymentMethodType::OnlineBankingCzechRepublic + | api_models::enums::PaymentMethodType::OnlineBankingFinland + | api_models::enums::PaymentMethodType::OnlineBankingFpx + | api_models::enums::PaymentMethodType::OnlineBankingPoland + | api_models::enums::PaymentMethodType::OnlineBankingSlovakia + | api_models::enums::PaymentMethodType::Oxxo + | api_models::enums::PaymentMethodType::PagoEfectivo + | api_models::enums::PaymentMethodType::PermataBankTransfer + | api_models::enums::PaymentMethodType::OpenBankingUk + | api_models::enums::PaymentMethodType::PayBright + | api_models::enums::PaymentMethodType::Paypal + | api_models::enums::PaymentMethodType::Pix + | api_models::enums::PaymentMethodType::PaySafeCard + | api_models::enums::PaymentMethodType::Przelewy24 + | api_models::enums::PaymentMethodType::Pse + | api_models::enums::PaymentMethodType::RedCompra + | api_models::enums::PaymentMethodType::RedPagos + | api_models::enums::PaymentMethodType::SamsungPay + | api_models::enums::PaymentMethodType::Sepa + | api_models::enums::PaymentMethodType::Sofort + | api_models::enums::PaymentMethodType::Swish + | api_models::enums::PaymentMethodType::TouchNGo + | api_models::enums::PaymentMethodType::Trustly + | api_models::enums::PaymentMethodType::Twint + | api_models::enums::PaymentMethodType::UpiCollect + | api_models::enums::PaymentMethodType::Vipps + | api_models::enums::PaymentMethodType::Walley + | api_models::enums::PaymentMethodType::WeChatPay + | api_models::enums::PaymentMethodType::SevenEleven + | api_models::enums::PaymentMethodType::Lawson + | api_models::enums::PaymentMethodType::MiniStop + | api_models::enums::PaymentMethodType::FamilyMart + | api_models::enums::PaymentMethodType::Seicomart + | api_models::enums::PaymentMethodType::PayEasy, + ) => Err(error_stack::report!(errors::ConnectorError::NotSupported { + message: payment_method_type.to_string(), + connector: "klarna", + })), + }, + + api_payments::PaymentMethodData::Card(_) + | api_payments::PaymentMethodData::CardRedirect(_) + | api_payments::PaymentMethodData::Wallet(_) + | api_payments::PaymentMethodData::PayLater(_) + | api_payments::PaymentMethodData::BankRedirect(_) + | api_payments::PaymentMethodData::BankDebit(_) + | api_payments::PaymentMethodData::BankTransfer(_) + | api_payments::PaymentMethodData::Crypto(_) + | api_payments::PaymentMethodData::MandatePayment + | api_payments::PaymentMethodData::Reward + | api_payments::PaymentMethodData::Upi(_) + | api_payments::PaymentMethodData::Voucher(_) + | api_payments::PaymentMethodData::GiftCard(_) + | api_payments::PaymentMethodData::CardToken(_) => Err(error_stack::report!( errors::ConnectorError::MismatchedPaymentData )), } diff --git a/crates/router/src/connector/mollie.rs b/crates/router/src/connector/mollie.rs index cb001ef7c3f..84014fd6d59 100644 --- a/crates/router/src/connector/mollie.rs +++ b/crates/router/src/connector/mollie.rs @@ -631,9 +631,7 @@ impl services::ConnectorRedirectResponse for Mollie { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rs index b61122fbfa2..7acf81db295 100644 --- a/crates/router/src/connector/mollie/transformers.rs +++ b/crates/router/src/connector/mollie/transformers.rs @@ -13,7 +13,7 @@ use crate::{ }, core::errors, services, types, - types::{domain, storage::enums as storage_enums}, + types::storage::enums as storage_enums, unimplemented_payment_method, }; @@ -169,7 +169,7 @@ impl TryFrom<&MollieRouterData<&types::PaymentsAuthorizeRouterData>> for MollieP { enums::CaptureMethod::Automatic => { match &item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(_) => { + api_models::payments::PaymentMethodData::Card(_) => { let pm_token = item.router_data.get_payment_method_token()?; Ok(PaymentMethodData::CreditCard(Box::new( CreditCardMethodData { @@ -188,13 +188,13 @@ impl TryFrom<&MollieRouterData<&types::PaymentsAuthorizeRouterData>> for MollieP }, ))) } - domain::PaymentMethodData::BankRedirect(ref redirect_data) => { + api_models::payments::PaymentMethodData::BankRedirect(ref redirect_data) => { PaymentMethodData::try_from(redirect_data) } - domain::PaymentMethodData::Wallet(ref wallet_data) => { + api_models::payments::PaymentMethodData::Wallet(ref wallet_data) => { get_payment_method_for_wallet(item.router_data, wallet_data) } - domain::PaymentMethodData::BankDebit(ref directdebit_data) => { + api_models::payments::PaymentMethodData::BankDebit(ref directdebit_data) => { PaymentMethodData::try_from(directdebit_data) } _ => Err( @@ -230,35 +230,35 @@ impl TryFrom<&MollieRouterData<&types::PaymentsAuthorizeRouterData>> for MollieP } } -impl TryFrom<&domain::BankRedirectData> for PaymentMethodData { +impl TryFrom<&api_models::payments::BankRedirectData> for PaymentMethodData { type Error = Error; - fn try_from(value: &domain::BankRedirectData) -> Result { + fn try_from(value: &api_models::payments::BankRedirectData) -> Result { match value { - domain::BankRedirectData::Eps { .. } => Ok(Self::Eps), - domain::BankRedirectData::Giropay { .. } => Ok(Self::Giropay), - domain::BankRedirectData::Ideal { .. } => { + api_models::payments::BankRedirectData::Eps { .. } => Ok(Self::Eps), + api_models::payments::BankRedirectData::Giropay { .. } => Ok(Self::Giropay), + api_models::payments::BankRedirectData::Ideal { .. } => { Ok(Self::Ideal(Box::new(IdealMethodData { // To do if possible this should be from the payment request issuer: None, }))) } - domain::BankRedirectData::Sofort { .. } => Ok(Self::Sofort), - domain::BankRedirectData::Przelewy24 { + api_models::payments::BankRedirectData::Sofort { .. } => Ok(Self::Sofort), + api_models::payments::BankRedirectData::Przelewy24 { billing_details, .. } => Ok(Self::Przelewy24(Box::new(Przelewy24MethodData { billing_email: billing_details.email.clone(), }))), - domain::BankRedirectData::BancontactCard { .. } => Ok(Self::Bancontact), + api_models::payments::BankRedirectData::BancontactCard { .. } => Ok(Self::Bancontact), _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), } } } -impl TryFrom<&domain::BankDebitData> for PaymentMethodData { +impl TryFrom<&api_models::payments::BankDebitData> for PaymentMethodData { type Error = Error; - fn try_from(value: &domain::BankDebitData) -> Result { + fn try_from(value: &api_models::payments::BankDebitData) -> Result { match value { - domain::BankDebitData::SepaBankDebit { + api_models::payments::BankDebitData::SepaBankDebit { bank_account_holder_name, iban, .. @@ -287,10 +287,11 @@ impl TryFrom<&types::TokenizationRouterData> for MollieCardTokenRequest { type Error = error_stack::Report; fn try_from(item: &types::TokenizationRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => { + api_models::payments::PaymentMethodData::Card(ccard) => { let auth = MollieAuthType::try_from(&item.connector_auth_type)?; - let card_holder = item - .get_optional_billing_full_name() + let card_holder = ccard + .card_holder_name + .clone() .unwrap_or(Secret::new("".to_string())); let card_number = ccard.card_number.clone(); let card_expiry_date = @@ -324,16 +325,16 @@ impl TryFrom<&types::TokenizationRouterData> for MollieCardTokenRequest { fn get_payment_method_for_wallet( item: &types::PaymentsAuthorizeRouterData, - wallet_data: &domain::WalletData, + wallet_data: &api_models::payments::WalletData, ) -> Result { match wallet_data { - domain::WalletData::PaypalRedirect { .. } => { + api_models::payments::WalletData::PaypalRedirect { .. } => { Ok(PaymentMethodData::Paypal(Box::new(PaypalMethodData { billing_address: get_billing_details(item)?, shipping_address: get_shipping_details(item)?, }))) } - domain::WalletData::ApplePay(applepay_wallet_data) => { + api_models::payments::WalletData::ApplePay(applepay_wallet_data) => { Ok(PaymentMethodData::Applepay(Box::new(ApplePayMethodData { apple_pay_payment_token: Secret::new(applepay_wallet_data.payment_data.to_owned()), }))) diff --git a/crates/router/src/connector/multisafepay.rs b/crates/router/src/connector/multisafepay.rs index bd20228283e..fa6bb5dad3f 100644 --- a/crates/router/src/connector/multisafepay.rs +++ b/crates/router/src/connector/multisafepay.rs @@ -2,7 +2,6 @@ pub mod transformers; use std::fmt::Debug; -use common_enums::AttemptStatus; use common_utils::request::RequestContent; use error_stack::{report, ResultExt}; use masking::ExposeInterface; @@ -85,16 +84,14 @@ impl ConnectorCommon for Multisafepay { event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); - let attempt_status = Option::::from(response.clone()); - - Ok(ErrorResponse::from(( - Some(response.error_code.to_string()), - Some(response.error_info.clone()), - Some(response.error_info), - res.status_code, - attempt_status, - None, - ))) + Ok(ErrorResponse { + status_code: res.status_code, + code: response.error_code.to_string(), + message: response.error_info, + reason: None, + attempt_status: None, + connector_transaction_id: None, + }) } } diff --git a/crates/router/src/connector/multisafepay/transformers.rs b/crates/router/src/connector/multisafepay/transformers.rs index 926781e39e9..f6051ea05de 100644 --- a/crates/router/src/connector/multisafepay/transformers.rs +++ b/crates/router/src/connector/multisafepay/transformers.rs @@ -1,4 +1,3 @@ -use common_enums::AttemptStatus; use common_utils::pii::{Email, IpAddress}; use masking::ExposeInterface; use serde::{Deserialize, Serialize}; @@ -11,7 +10,7 @@ use crate::{ core::errors, pii::Secret, services, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; #[derive(Debug, Serialize)] @@ -279,96 +278,96 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> item: &MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { let payment_type = match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref _ccard) => Type::Direct, - domain::PaymentMethodData::MandatePayment => Type::Direct, - domain::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data { - domain::WalletData::GooglePay(_) => Type::Direct, - domain::WalletData::PaypalRedirect(_) => Type::Redirect, - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( + api::PaymentMethodData::Card(ref _ccard) => Type::Direct, + api::PaymentMethodData::MandatePayment => Type::Direct, + api::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data { + api::WalletData::GooglePay(_) => Type::Direct, + api::WalletData::PaypalRedirect(_) => Type::Redirect, + api::WalletData::AliPayQr(_) + | api::WalletData::AliPayRedirect(_) + | api::WalletData::AliPayHkRedirect(_) + | api::WalletData::MomoRedirect(_) + | api::WalletData::KakaoPayRedirect(_) + | api::WalletData::GoPayRedirect(_) + | api::WalletData::GcashRedirect(_) + | api::WalletData::ApplePay(_) + | api::WalletData::ApplePayRedirect(_) + | api::WalletData::ApplePayThirdPartySdk(_) + | api::WalletData::DanaRedirect {} + | api::WalletData::GooglePayRedirect(_) + | api::WalletData::GooglePayThirdPartySdk(_) + | api::WalletData::MbWayRedirect(_) + | api::WalletData::MobilePayRedirect(_) + | api::WalletData::PaypalSdk(_) + | api::WalletData::SamsungPay(_) + | api::WalletData::TwintRedirect {} + | api::WalletData::VippsRedirect {} + | api::WalletData::TouchNGoRedirect(_) + | api::WalletData::WeChatPayRedirect(_) + | api::WalletData::WeChatPayQr(_) + | api::WalletData::CashappQr(_) + | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("multisafepay"), ))?, }, - domain::PaymentMethodData::PayLater(ref _paylater) => Type::Redirect, + api::PaymentMethodData::PayLater(ref _paylater) => Type::Redirect, _ => Type::Redirect, }; let gateway = match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => { + api::PaymentMethodData::Card(ref ccard) => { Some(Gateway::try_from(ccard.get_card_issuer()?)?) } - domain::PaymentMethodData::Wallet(ref wallet_data) => Some(match wallet_data { - domain::WalletData::GooglePay(_) => Gateway::Googlepay, - domain::WalletData::PaypalRedirect(_) => Gateway::Paypal, - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( + api::PaymentMethodData::Wallet(ref wallet_data) => Some(match wallet_data { + api::WalletData::GooglePay(_) => Gateway::Googlepay, + api::WalletData::PaypalRedirect(_) => Gateway::Paypal, + api::WalletData::AliPayQr(_) + | api::WalletData::AliPayRedirect(_) + | api::WalletData::AliPayHkRedirect(_) + | api::WalletData::MomoRedirect(_) + | api::WalletData::KakaoPayRedirect(_) + | api::WalletData::GoPayRedirect(_) + | api::WalletData::GcashRedirect(_) + | api::WalletData::ApplePay(_) + | api::WalletData::ApplePayRedirect(_) + | api::WalletData::ApplePayThirdPartySdk(_) + | api::WalletData::DanaRedirect {} + | api::WalletData::GooglePayRedirect(_) + | api::WalletData::GooglePayThirdPartySdk(_) + | api::WalletData::MbWayRedirect(_) + | api::WalletData::MobilePayRedirect(_) + | api::WalletData::PaypalSdk(_) + | api::WalletData::SamsungPay(_) + | api::WalletData::TwintRedirect {} + | api::WalletData::VippsRedirect {} + | api::WalletData::TouchNGoRedirect(_) + | api::WalletData::WeChatPayRedirect(_) + | api::WalletData::WeChatPayQr(_) + | api::WalletData::CashappQr(_) + | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("multisafepay"), ))?, }), - domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaRedirect { - billing_email: _, - billing_country: _, - }) => Some(Gateway::Klarna), - domain::PaymentMethodData::MandatePayment => None, - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("multisafepay"), - ))? - } + api::PaymentMethodData::PayLater( + api_models::payments::PayLaterData::KlarnaRedirect { + billing_email: _, + billing_country: _, + }, + ) => Some(Gateway::Klarna), + api::PaymentMethodData::MandatePayment => None, + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("multisafepay"), + ))?, }; let description = item.router_data.get_description()?; let payment_options = PaymentOptions { @@ -411,13 +410,9 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> .address .as_ref() .ok_or_else(utils::missing_field_err("billing.address"))?; - let first_name = billing_address.get_first_name()?; let delivery = DeliveryObject { - first_name: first_name.clone(), - last_name: billing_address - .get_last_name() - .unwrap_or(first_name) - .clone(), + first_name: billing_address.get_first_name()?.to_owned(), + last_name: billing_address.get_last_name()?.to_owned(), address1: billing_address.get_line1()?.to_owned(), house_number: billing_address.get_line2()?.to_owned(), zip_code: billing_address.get_zip()?.to_owned(), @@ -426,7 +421,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> }; let gateway_info = match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => Some(GatewayInfo::Card(CardInfo { + api::PaymentMethodData::Card(ref ccard) => Some(GatewayInfo::Card(CardInfo { card_number: Some(ccard.card_number.clone()), card_expiry_date: Some(Secret::new( (format!( @@ -443,8 +438,8 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> moto: None, term_url: None, })), - domain::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data { - domain::WalletData::GooglePay(ref google_pay) => { + api::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data { + api::WalletData::GooglePay(ref google_pay) => { Some(GatewayInfo::Wallet(WalletInfo::GooglePay({ GpayInfo { payment_token: Some(Secret::new( @@ -453,50 +448,51 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> } }))) } - domain::WalletData::PaypalRedirect(_) => None, - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( + api::WalletData::PaypalRedirect(_) => None, + api::WalletData::AliPayQr(_) + | api::WalletData::AliPayRedirect(_) + | api::WalletData::AliPayHkRedirect(_) + | api::WalletData::MomoRedirect(_) + | api::WalletData::KakaoPayRedirect(_) + | api::WalletData::GoPayRedirect(_) + | api::WalletData::GcashRedirect(_) + | api::WalletData::ApplePay(_) + | api::WalletData::ApplePayRedirect(_) + | api::WalletData::ApplePayThirdPartySdk(_) + | api::WalletData::DanaRedirect {} + | api::WalletData::GooglePayRedirect(_) + | api::WalletData::GooglePayThirdPartySdk(_) + | api::WalletData::MbWayRedirect(_) + | api::WalletData::MobilePayRedirect(_) + | api::WalletData::PaypalSdk(_) + | api::WalletData::SamsungPay(_) + | api::WalletData::TwintRedirect {} + | api::WalletData::VippsRedirect {} + | api::WalletData::TouchNGoRedirect(_) + | api::WalletData::WeChatPayRedirect(_) + | api::WalletData::WeChatPayQr(_) + | api::WalletData::CashappQr(_) + | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("multisafepay"), ))?, }, - domain::PaymentMethodData::PayLater(ref paylater) => { + api::PaymentMethodData::PayLater(ref paylater) => { Some(GatewayInfo::PayLater(PayLaterInfo { email: Some(match paylater { - domain::PayLaterData::KlarnaRedirect { billing_email, .. } => { - billing_email.clone() - } - domain::PayLaterData::KlarnaSdk { token: _ } - | domain::PayLaterData::AffirmRedirect {} - | domain::PayLaterData::AfterpayClearpayRedirect { + api_models::payments::PayLaterData::KlarnaRedirect { + billing_email, + .. + } => billing_email.clone(), + api_models::payments::PayLaterData::KlarnaSdk { token: _ } + | api_models::payments::PayLaterData::AffirmRedirect {} + | api_models::payments::PayLaterData::AfterpayClearpayRedirect { billing_email: _, billing_name: _, } - | domain::PayLaterData::PayBrightRedirect {} - | domain::PayLaterData::WalleyRedirect {} - | domain::PayLaterData::AlmaRedirect {} - | domain::PayLaterData::AtomeRedirect {} => { + | api_models::payments::PayLaterData::PayBrightRedirect {} + | api_models::payments::PayLaterData::WalleyRedirect {} + | api_models::payments::PayLaterData::AlmaRedirect {} + | api_models::payments::PayLaterData::AtomeRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message( "multisafepay", @@ -506,21 +502,19 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> }), })) } - domain::PaymentMethodData::MandatePayment => None, - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("multisafepay"), - ))? - } + api::PaymentMethodData::MandatePayment => None, + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("multisafepay"), + ))?, }; Ok(Self { @@ -589,7 +583,6 @@ pub enum MultisafepayPaymentStatus { #[default] Initialized, Void, - Uncleared, } #[derive(Debug, Clone, Eq, Serialize, Deserialize, PartialEq)] @@ -598,13 +591,12 @@ pub enum MandateType { Unscheduled, } -impl From for AttemptStatus { +impl From for enums::AttemptStatus { fn from(item: MultisafepayPaymentStatus) -> Self { match item { MultisafepayPaymentStatus::Completed => Self::Charged, MultisafepayPaymentStatus::Declined => Self::Failure, MultisafepayPaymentStatus::Initialized => Self::AuthenticationPending, - MultisafepayPaymentStatus::Uncleared => Self::Pending, MultisafepayPaymentStatus::Void => Self::Voided, } } @@ -621,8 +613,8 @@ pub struct Data { pub capture: Option, pub payment_url: Option, pub status: Option, - pub reason: Option, - pub reason_code: Option, + pub error_code: Option, + pub error_info: Option, pub payment_details: Option, } @@ -681,60 +673,44 @@ impl MultisafepayPaymentStatus::Declined }; - let status = enums::AttemptStatus::from( - payment_response.data.status.unwrap_or(default_status), - ); + let status = payment_response.data.status.unwrap_or(default_status); Ok(Self { - status, - response: if utils::is_payment_failure(status) { - Err(types::ErrorResponse::from(( - payment_response.data.reason_code, - payment_response.data.reason.clone(), - payment_response.data.reason, - item.http_code, - Some(status), - Some(payment_response.data.order_id), - ))) - } else { - Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - payment_response.data.order_id.clone(), - ), - redirection_data, - mandate_reference: payment_response - .data - .payment_details - .and_then(|payment_details| payment_details.recurring_id) - .map(|id| types::MandateReference { - connector_mandate_id: Some(id.expose()), - payment_method_id: None, - }), - connector_metadata: None, - network_txn_id: None, - connector_response_reference_id: Some( - payment_response.data.order_id.clone(), - ), - incremental_authorization_allowed: None, - }) - }, - ..item.data - }) - } - MultisafepayAuthResponse::ErrorResponse(error_response) => { - let attempt_status = Option::::from(error_response.clone()); - Ok(Self { - response: Err(types::ErrorResponse::from(( - Some(error_response.error_code.to_string()), - Some(error_response.error_info.clone()), - Some(error_response.error_info), - item.http_code, - attempt_status, - None, - ))), + status: enums::AttemptStatus::from(status), + response: Ok(types::PaymentsResponseData::TransactionResponse { + resource_id: types::ResponseId::ConnectorTransactionId( + payment_response.data.order_id.clone(), + ), + redirection_data, + mandate_reference: payment_response + .data + .payment_details + .and_then(|payment_details| payment_details.recurring_id) + .map(|id| types::MandateReference { + connector_mandate_id: Some(id.expose()), + payment_method_id: None, + }), + connector_metadata: None, + network_txn_id: None, + connector_response_reference_id: Some( + payment_response.data.order_id.clone(), + ), + incremental_authorization_allowed: None, + }), ..item.data }) } + MultisafepayAuthResponse::ErrorResponse(error_response) => Ok(Self { + response: Err(types::ErrorResponse { + code: error_response.error_code.to_string(), + message: error_response.error_info.clone(), + reason: Some(error_response.error_info), + status_code: item.http_code, + attempt_status: None, + connector_transaction_id: None, + }), + ..item.data + }), } } } @@ -832,20 +808,17 @@ impl TryFrom { - let attempt_status = Option::::from(error_response.clone()); - Ok(Self { - response: Err(types::ErrorResponse { - code: error_response.error_code.to_string(), - message: error_response.error_info.clone(), - reason: Some(error_response.error_info), - status_code: item.http_code, - attempt_status, - connector_transaction_id: None, - }), - ..item.data - }) - } + MultisafepayRefundResponse::ErrorResponse(error_response) => Ok(Self { + response: Err(types::ErrorResponse { + code: error_response.error_code.to_string(), + message: error_response.error_info.clone(), + reason: Some(error_response.error_info), + status_code: item.http_code, + attempt_status: None, + connector_transaction_id: None, + }), + ..item.data + }), } } } @@ -874,14 +847,14 @@ impl TryFrom Ok(Self { - response: Err(types::ErrorResponse::from(( - Some(error_response.error_code.to_string()), - Some(error_response.error_info.clone()), - Some(error_response.error_info), - item.http_code, - None, - None, - ))), + response: Err(types::ErrorResponse { + code: error_response.error_code.to_string(), + message: error_response.error_info.clone(), + reason: Some(error_response.error_info), + status_code: item.http_code, + attempt_status: None, + connector_transaction_id: None, + }), ..item.data }), } @@ -893,47 +866,3 @@ pub struct MultisafepayErrorResponse { pub error_code: i32, pub error_info: String, } - -impl From for Option { - fn from(error_data: MultisafepayErrorResponse) -> Self { - match error_data.error_code { - 10001 // InvalidAmount - | 1002 // InvalidCurrency - | 1003 // InvalidAccountID - | 1004 // InvalidSiteID - | 1005 // InvalidSecurityCode - | 1006 // InvalidTransactionID - | 1007 // InvalidIPAddress - | 1008 // InvalidDescription - | 1010 // InvalidVariable - | 1011 // InvalidCustomerAccountID - | 1012 // InvalidCustomerSecurityCode - | 1013 // InvalidSignature - | 1015 //UnknownAccountID - | 1016 // MissingData - | 1018 // InvalidCountryCode - | 1025 // MultisafepayErrorCodes::IncorrectCustomerIPAddress - | 1026 // MultisafepayErrorCodes::MultipleCurrenciesInCart - | 1027 // MultisafepayErrorCodes::CartCurrencyDifferentToOrderCurrency - | 1028 // IncorrectCustomTaxRate - | 1029 // IncorrectItemTaxRate - | 1030 // IncorrectItemCurrency - | 1031 // IncorrectItemPrice - | 1035 // InvalidSignatureRefund - | 1036 // InvalidIdealIssuerID - | 5001 // CartDataNotValidated - | 1032 // InvalidAPIKey - => { - Some(AttemptStatus::AuthenticationFailed) - } - - 1034 // CannotRefundTransaction - | 1022 // CannotInitiateTransaction - | 1024 //TransactionDeclined - => Some(AttemptStatus::Failure), - 1017 // InsufficientFunds - => Some(AttemptStatus::AuthorizationFailed), - _ => None, - } - } -} diff --git a/crates/router/src/connector/netcetera.rs b/crates/router/src/connector/netcetera.rs deleted file mode 100644 index 71072a046de..00000000000 --- a/crates/router/src/connector/netcetera.rs +++ /dev/null @@ -1,453 +0,0 @@ -pub mod netcetera_types; -pub mod transformers; - -use std::fmt::Debug; - -use common_utils::{ext_traits::ByteSliceExt, request::RequestContent}; -use error_stack::ResultExt; -use transformers as netcetera; - -use crate::{ - configs::settings, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{self, request, ConnectorIntegration, ConnectorValidation}, - types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - ErrorResponse, Response, - }, - utils::BytesExt, -}; - -#[derive(Debug, Clone)] -pub struct Netcetera; - -impl api::Payment for Netcetera {} -impl api::PaymentSession for Netcetera {} -impl api::ConnectorAccessToken for Netcetera {} -impl api::MandateSetup for Netcetera {} -impl api::PaymentAuthorize for Netcetera {} -impl api::PaymentSync for Netcetera {} -impl api::PaymentCapture for Netcetera {} -impl api::PaymentVoid for Netcetera {} -impl api::Refund for Netcetera {} -impl api::RefundExecute for Netcetera {} -impl api::RefundSync for Netcetera {} -impl api::PaymentToken for Netcetera {} - -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Netcetera -{ - // Not Implemented (R) -} - -impl ConnectorCommonExt for Netcetera -where - Self: ConnectorIntegration, -{ - fn build_headers( - &self, - req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - let mut header = vec![( - headers::CONTENT_TYPE.to_string(), - self.get_content_type().to_string().into(), - )]; - let mut api_key = self.get_auth_header(&req.connector_auth_type)?; - header.append(&mut api_key); - Ok(header) - } -} - -impl ConnectorCommon for Netcetera { - fn id(&self) -> &'static str { - "netcetera" - } - - fn get_currency_unit(&self) -> api::CurrencyUnit { - api::CurrencyUnit::Minor - } - - fn common_get_content_type(&self) -> &'static str { - "application/json" - } - - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { - connectors.netcetera.base_url.as_ref() - } - - fn get_auth_header( - &self, - _auth_type: &types::ConnectorAuthType, - ) -> CustomResult)>, errors::ConnectorError> { - Ok(vec![]) - } - - fn build_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - let response: netcetera::NetceteraErrorResponse = res - .response - .parse_struct("NetceteraErrorResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - Ok(ErrorResponse { - status_code: res.status_code, - code: response.error_details.error_code, - message: response.error_details.error_description, - reason: Some(response.error_details.error_detail), - attempt_status: None, - connector_transaction_id: None, - }) - } -} - -impl ConnectorValidation for Netcetera {} - -impl ConnectorIntegration - for Netcetera -{ -} - -impl ConnectorIntegration - for Netcetera -{ -} - -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Netcetera -{ -} - -impl ConnectorIntegration - for Netcetera -{ -} - -impl ConnectorIntegration - for Netcetera -{ -} - -impl ConnectorIntegration - for Netcetera -{ -} - -impl ConnectorIntegration - for Netcetera -{ -} - -impl ConnectorIntegration - for Netcetera -{ -} - -impl ConnectorIntegration - for Netcetera -{ -} - -#[async_trait::async_trait] -impl api::IncomingWebhook for Netcetera { - fn get_webhook_object_reference_id( - &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - let webhook_body: netcetera::ResultsResponseData = request - .body - .parse_struct("netcetera ResultsResponseData") - .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; - Ok(api::webhooks::ObjectReferenceId::ExternalAuthenticationID( - api::webhooks::AuthenticationIdType::ConnectorAuthenticationId( - webhook_body.three_ds_server_trans_id, - ), - )) - } - - fn get_webhook_event_type( - &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Ok(api::IncomingWebhookEvent::ExternalAuthenticationARes) - } - - fn get_webhook_resource_object( - &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult, errors::ConnectorError> { - let webhook_body_value: netcetera::ResultsResponseData = request - .body - .parse_struct("netcetera ResultsResponseDatae") - .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; - Ok(Box::new(webhook_body_value)) - } - - fn get_external_authentication_details( - &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - let webhook_body: netcetera::ResultsResponseData = request - .body - .parse_struct("netcetera ResultsResponseData") - .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; - Ok(api::ExternalAuthenticationPayload { - trans_status: webhook_body - .trans_status - .unwrap_or(common_enums::TransactionStatus::InformationOnly), - authentication_value: webhook_body.authentication_value, - eci: webhook_body.eci, - }) - } -} - -fn build_endpoint( - base_url: &str, - connector_metadata: &Option, -) -> CustomResult { - let metadata = netcetera::NetceteraMetaData::try_from(connector_metadata)?; - let endpoint_prefix = metadata.endpoint_prefix; - Ok(base_url.replace("{{merchant_endpoint_prefix}}", &endpoint_prefix)) -} - -impl api::ConnectorPreAuthentication for Netcetera {} -impl api::ExternalAuthentication for Netcetera {} -impl api::ConnectorAuthentication for Netcetera {} -impl api::ConnectorPostAuthentication for Netcetera {} - -impl - ConnectorIntegration< - api::PreAuthentication, - types::authentication::PreAuthNRequestData, - types::authentication::AuthenticationResponseData, - > for Netcetera -{ - fn get_headers( - &self, - req: &types::authentication::PreAuthNRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - req: &types::authentication::PreAuthNRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?; - Ok(format!("{}/3ds/versioning", base_url,)) - } - - fn get_request_body( - &self, - req: &types::authentication::PreAuthNRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_router_data = netcetera::NetceteraRouterData::try_from((0, req))?; - let req_obj = - netcetera::NetceteraPreAuthenticationRequest::try_from(&connector_router_data)?; - Ok(RequestContent::Json(Box::new(req_obj))) - } - - fn build_request( - &self, - req: &types::authentication::PreAuthNRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let netcetera_auth_type = netcetera::NetceteraAuthType::try_from(&req.connector_auth_type)?; - Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url( - &types::authentication::ConnectorPreAuthenticationType::get_url( - self, req, connectors, - )?, - ) - .attach_default_headers() - .headers( - types::authentication::ConnectorPreAuthenticationType::get_headers( - self, req, connectors, - )?, - ) - .set_body( - types::authentication::ConnectorPreAuthenticationType::get_request_body( - self, req, connectors, - )?, - ) - .add_certificate(Some(netcetera_auth_type.certificate)) - .add_certificate_key(Some(netcetera_auth_type.private_key)) - .build(), - )) - } - - fn handle_response( - &self, - data: &types::authentication::PreAuthNRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult { - let response: netcetera::NetceteraPreAuthenticationResponse = res - .response - .parse_struct("netcetera NetceteraPreAuthenticationResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -impl - ConnectorIntegration< - api::Authentication, - types::authentication::ConnectorAuthenticationRequestData, - types::authentication::AuthenticationResponseData, - > for Netcetera -{ - fn get_headers( - &self, - req: &types::authentication::ConnectorAuthenticationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - req: &types::authentication::ConnectorAuthenticationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?; - Ok(format!("{}/3ds/authentication", base_url,)) - } - - fn get_request_body( - &self, - req: &types::authentication::ConnectorAuthenticationRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_router_data = netcetera::NetceteraRouterData::try_from(( - &self.get_currency_unit(), - req.request - .currency - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "currency", - })?, - req.request - .amount - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "amount", - })?, - req, - ))?; - let req_obj = netcetera::NetceteraAuthenticationRequest::try_from(&connector_router_data); - Ok(RequestContent::Json(Box::new(req_obj?))) - } - - fn build_request( - &self, - req: &types::authentication::ConnectorAuthenticationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let netcetera_auth_type = netcetera::NetceteraAuthType::try_from(&req.connector_auth_type)?; - Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url( - &types::authentication::ConnectorAuthenticationType::get_url( - self, req, connectors, - )?, - ) - .attach_default_headers() - .headers( - types::authentication::ConnectorAuthenticationType::get_headers( - self, req, connectors, - )?, - ) - .set_body( - types::authentication::ConnectorAuthenticationType::get_request_body( - self, req, connectors, - )?, - ) - .add_certificate(Some(netcetera_auth_type.certificate)) - .add_certificate_key(Some(netcetera_auth_type.private_key)) - .build(), - )) - } - - fn handle_response( - &self, - data: &types::authentication::ConnectorAuthenticationRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult< - types::authentication::ConnectorAuthenticationRouterData, - errors::ConnectorError, - > { - let response: netcetera::NetceteraAuthenticationResponse = res - .response - .parse_struct("NetceteraAuthenticationResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -impl - ConnectorIntegration< - api::PostAuthentication, - types::authentication::ConnectorPostAuthenticationRequestData, - types::authentication::AuthenticationResponseData, - > for Netcetera -{ -} diff --git a/crates/router/src/connector/netcetera/netcetera_types.rs b/crates/router/src/connector/netcetera/netcetera_types.rs deleted file mode 100644 index 89fa6d9d50c..00000000000 --- a/crates/router/src/connector/netcetera/netcetera_types.rs +++ /dev/null @@ -1,1643 +0,0 @@ -use std::collections::HashMap; - -use common_utils::pii::Email; -use serde::{Deserialize, Serialize}; - -use crate::{ - connector::utils::{AddressDetailsData, PhoneDetailsData}, - errors, - types::api::MessageCategory, -}; - -#[derive(Debug, Deserialize, Serialize, Clone)] -#[serde(untagged)] -pub enum SingleOrListElement { - Single(T), - List(Vec), -} - -impl SingleOrListElement { - pub fn new_single(value: T) -> Self { - Self::Single(value) - } - - pub fn new_list(value: Vec) -> Self { - Self::List(value) - } -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -pub enum NetceteraDeviceChannel { - #[serde(rename = "01")] - AppBased, - #[serde(rename = "02")] - Browser, - #[serde(rename = "03")] - ThreeDsRequestorInitiated, -} - -impl From for NetceteraDeviceChannel { - fn from(value: api_models::payments::DeviceChannel) -> Self { - match value { - api_models::payments::DeviceChannel::App => Self::AppBased, - api_models::payments::DeviceChannel::Browser => Self::Browser, - } - } -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -pub enum NetceteraMessageCategory { - #[serde(rename = "01")] - PaymentAuthentication, - #[serde(rename = "02")] - NonPaymentAuthentication, -} - -impl From for NetceteraMessageCategory { - fn from(value: MessageCategory) -> Self { - match value { - MessageCategory::NonPayment => Self::NonPaymentAuthentication, - MessageCategory::Payment => Self::PaymentAuthentication, - } - } -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -pub enum ThreeDSMethodCompletionIndicator { - /// Successfully completed - Y, - /// Did not successfully complete - N, - /// Unavailable - 3DS Method URL was not present in the PRes message data - U, -} -impl From for ThreeDSMethodCompletionIndicator { - fn from(value: api_models::payments::ThreeDsCompletionIndicator) -> Self { - match value { - api_models::payments::ThreeDsCompletionIndicator::Success => Self::Y, - api_models::payments::ThreeDsCompletionIndicator::Failure => Self::N, - api_models::payments::ThreeDsCompletionIndicator::NotAvailable => Self::U, - } - } -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ThreeDSRequestor { - #[serde(rename = "threeDSRequestorAuthenticationInd")] - pub three_ds_requestor_authentication_ind: ThreeDSRequestorAuthenticationIndicator, - /// Format of this field was changed with EMV 3DS 2.3.1 version: - /// In versions prior to 2.3.1, this field is a single object. - /// Starting from EMVCo version 2.3.1, this field is now an array of objects. Accepted value length is 1-3 elements. - /// - /// This field is optional, but recommended to include. - #[serde(rename = "threeDSRequestorAuthenticationInfo")] - pub three_ds_requestor_authentication_info: - Option>, - #[serde(rename = "threeDSRequestorChallengeInd")] - pub three_ds_requestor_challenge_ind: - Option>, - #[serde(rename = "threeDSRequestorPriorAuthenticationInfo")] - pub three_ds_requestor_prior_authentication_info: - Option>, - #[serde(rename = "threeDSRequestorDecReqInd")] - pub three_ds_requestor_dec_req_ind: Option, - /// Indicates the maximum amount of time that the 3DS Requestor will wait for an ACS to provide the results - /// of a Decoupled Authentication transaction (in minutes). Valid values are between 1 and 10080. - /// - /// The field is optional and if value is not present, the expected action is for the ACS to interpret it as - /// 10080 minutes (7 days). - /// Available for supporting EMV 3DS 2.2.0 and later versions. - /// - /// Starting from EMV 3DS 2.3.1: - /// This field is required if threeDSRequestorDecReqInd = Y, F or B. - #[serde(rename = "threeDSRequestorDecMaxTime")] - pub three_ds_requestor_dec_max_time: Option, - /// External IP address (i.e., the device public IP address) used by the 3DS Requestor App when it connects to the - /// 3DS Requestor environment. The value length is maximum 45 characters. Accepted values are: - /// - /// IPv4 address is represented in the dotted decimal f. Refer to RFC 791. - /// IPv6 address. Refer to RFC 4291. - /// - /// This field is required when deviceChannel = 01 (APP) and unless market or regional mandate restricts sending - /// this information. - /// Available for supporting EMV 3DS 2.3.1 and later versions. - pub app_ip: Option, - /// Indicate if the 3DS Requestor supports the SPC authentication. - /// - /// The accepted values are: - /// - /// - Y -> Supported - /// - /// This field is required if deviceChannel = 02 (BRW) and it is supported by the 3DS Requestor. - /// Available for supporting EMV 3DS 2.3.1 and later versions. - #[serde(rename = "threeDSRequestorSpcSupport")] - pub three_ds_requestor_spc_support: Option, - /// Reason that the SPC authentication was not completed. - /// Accepted value length is 2 characters. - /// - /// The accepted values are: - /// - /// - 01 -> SPC did not run or did not successfully complete - /// - 02 -> Cardholder cancels the SPC authentication - /// - /// This field is required if deviceChannel = 02 (BRW) and the 3DS Requestor attempts to invoke SPC API and there is an - /// error. - /// Available for supporting EMV 3DS 2.3.1 and later versions. - pub spc_incomp_ind: Option, -} - -/// Indicates the type of Authentication request. -/// -/// This data element provides additional information to the ACS to determine the best approach for handling an authentication request. -/// -/// This value is used for App-based and Browser flows. -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum ThreeDSRequestorAuthenticationIndicator { - #[serde(rename = "01")] - Payment, - #[serde(rename = "02")] - Recurring, - #[serde(rename = "03")] - Installment, - #[serde(rename = "04")] - AddCard, - #[serde(rename = "05")] - MaintainCard, - #[serde(rename = "06")] - CardholderVerification, - #[serde(rename = "07")] - BillingAgreement, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ThreeDSRequestorAuthenticationInformation { - /// Mechanism used by the Cardholder to authenticate to the 3DS Requestor. Accepted values are: - /// - 01 -> No 3DS Requestor authentication occurred (i.e. cardholder "logged in" as guest) - /// - 02 -> Login to the cardholder account at the 3DS Requestor system using 3DS Requestor's own credentials - /// - 03 -> Login to the cardholder account at the 3DS Requestor system using federated ID - /// - 04 -> Login to the cardholder account at the 3DS Requestor system using issuer credentials - /// - 05 -> Login to the cardholder account at the 3DS Requestor system using third-party authentication - /// - 06 -> Login to the cardholder account at the 3DS Requestor system using FIDO Authenticator. - /// - /// The next values are accepted as well if 3DS Server initiates authentication with EMV 3DS 2.2.0 version or greater (required protocol version can be set in ThreeDSServerAuthenticationRequest#preferredProtocolVersion field): - /// - 07 -> Login to the cardholder account at the 3DS Requestor system using FIDO Authenticator (FIDO assurance data signed). - /// - 08 -> SRC Assurance Data. - /// - Additionally, 80-99 can be used for PS-specific values, regardless of protocol version. - #[serde(rename = "threeDSReqAuthMethod")] - pub three_ds_req_auth_method: ThreeDSReqAuthMethod, - /// Date and time converted into UTC of the cardholder authentication. Field is limited to 12 characters and accepted format is YYYYMMDDHHMM - #[serde(rename = "threeDSReqAuthTimestamp")] - pub three_ds_req_auth_timestamp: String, - /// Data that documents and supports a specific authentication process. In the current version of the specification, this data element is not defined in detail, however the intention is that for each 3DS Requestor Authentication Method, this field carry data that the ACS can use to verify the authentication process. - /// For example, if the 3DS Requestor Authentication Method is: - /// - /// - 03 -> then this element can carry information about the provider of the federated ID and related information - /// - 06 -> then this element can carry the FIDO attestation data (incl. the signature) - /// - 07 -> then this element can carry FIDO Attestation data with the FIDO assurance data signed. - /// - 08 -> then this element can carry the SRC assurance data. - #[serde(rename = "threeDSReqAuthData")] - pub three_ds_req_auth_data: Option, -} - -/// Indicates whether a challenge is requested for this transaction. For example: For 01-PA, a 3DS Requestor may have -/// concerns about the transaction, and request a challenge. For 02-NPA, a challenge may be necessary when adding a new -/// card to a wallet. -/// -/// This field is optional. The accepted values are: -/// -/// - 01 -> No preference -/// - 02 -> No challenge requested -/// - 03 -> Challenge requested: 3DS Requestor Preference -/// - 04 -> Challenge requested: Mandate. -/// The next values are accepted as well if 3DS Server initiates authentication with EMV 3DS 2.2.0 version -/// or greater (required protocol version can be set in -/// ThreeDSServerAuthenticationRequest#preferredProtocolVersion field): -/// -/// - 05 -> No challenge requested (transactional risk analysis is already performed) -/// - 06 -> No challenge requested (Data share only) -/// - 07 -> No challenge requested (strong consumer authentication is already performed) -/// - 08 -> No challenge requested (utilise whitelist exemption if no challenge required) -/// - 09 -> Challenge requested (whitelist prompt requested if challenge required). -/// - Additionally, 80-99 can be used for PS-specific values, regardless of protocol version. -/// -/// If the element is not provided, the expected action is that the ACS would interpret as 01 -> No preference. -/// -/// Format of this field was changed with EMV 3DS 2.3.1 version: -/// In versions prior to 2.3.1, this field is a String. -/// Starting from EMVCo version 2.3.1, this field is now an array of objects. Accepted value length is 1-2 elements. -/// When providing two preferences, the 3DS Requestor ensures that they are in preference order and are not -/// conflicting. For example, 02 = No challenge requested and 04 = Challenge requested (Mandate). -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum ThreeDSRequestorChallengeIndicator { - #[serde(rename = "01")] - NoPreference, - #[serde(rename = "02")] - NoChallengeRequested, - #[serde(rename = "03")] - ChallengeRequested3DSRequestorPreference, - #[serde(rename = "04")] - ChallengeRequestedMandate, - #[serde(rename = "05")] - NoChallengeRequestedTransactionalRiskAnalysis, - #[serde(rename = "06")] - NoChallengeRequestedDataShareOnly, - #[serde(rename = "07")] - NoChallengeRequestedStrongConsumerAuthentication, - #[serde(rename = "08")] - NoChallengeRequestedWhitelistExemption, - #[serde(rename = "09")] - ChallengeRequestedWhitelistPrompt, -} - -/// This field contains information about how the 3DS Requestor authenticated the cardholder as part of a previous 3DS transaction. -/// Format of this field was changed with EMV 3DS 2.3.1 version: -/// In versions prior to 2.3.1, this field is a single object. -/// Starting from EMVCo version 2.3.1, this field is now an array of objects. Accepted value length is 1-3 elements. -/// -/// This field is optional, but recommended to include for versions prior to 2.3.1. From 2.3.1, -/// it is required for 3RI in the case of Decoupled Authentication Fallback or for SPC. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ThreeDSRequestorPriorTransactionAuthenticationInformation { - /// This data element provides additional information to the ACS to determine the best - /// approach for handling a request. The field is limited to 36 characters containing - /// ACS Transaction ID for a prior authenticated transaction (for example, the first - /// recurring transaction that was authenticated with the cardholder). - pub three_ds_req_prior_ref: String, - - /// Mechanism used by the Cardholder to previously authenticate to the 3DS Requestor. - /// Accepted values for this field are: - /// - 01 -> Frictionless authentication occurred by ACS - /// - 02 -> Cardholder challenge occurred by ACS - /// - 03 -> AVS verified - /// - 04 -> Other issuer methods - /// - 80-99 -> PS-specific value (dependent on the payment scheme type). - pub three_ds_req_prior_auth_method: String, - - /// Date and time converted into UTC of the prior authentication. Accepted date - /// format is YYYYMMDDHHMM. - pub three_ds_req_prior_auth_timestamp: String, - - /// Data that documents and supports a specific authentication process. In the current - /// version of the specification this data element is not defined in detail, however - /// the intention is that for each 3DS Requestor Authentication Method, this field carry - /// data that the ACS can use to verify the authentication process. In future versions - /// of the application, these details are expected to be included. Field is limited to - /// maximum 2048 characters. - pub three_ds_req_prior_auth_data: String, -} - -/// Enum indicating whether the 3DS Requestor requests the ACS to utilize Decoupled Authentication. -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum ThreeDSRequestorDecoupledRequestIndicator { - /// Decoupled Authentication is supported and preferred if challenge is necessary. - Y, - /// Do not use Decoupled Authentication. - N, - /// Decoupled Authentication is supported and is to be used only as a fallback challenge method - /// if a challenge is necessary (Transaction Status = D in RReq). - F, - /// Decoupled Authentication is supported and can be used as a primary or fallback challenge method - /// if a challenge is necessary (Transaction Status = D in either ARes or RReq). - B, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct CardholderAccount { - /// Indicates the type of account. - /// This is required if 3DS Requestor is asking Cardholder which Account Type they are using before making - /// the purchase. This field is required in some markets. Otherwise, it is optional. - pub acct_type: Option, - /// Expiry date of the PAN or token supplied to the 3DS Requestor by the Cardholder. - /// The field has 4 characters in a format YYMM. - /// - /// The requirements of the presence of this field are DS specific. - pub card_expiry_date: Option>, - /// This field contains additional information about the Cardholder’s account provided by the 3DS Requestor. - /// - /// The field is optional but recommended to include. - /// - /// Starting from EMV 3DS 2.3.1, added new field: - /// - `ch_acc_req_id` -> The 3DS Requestor assigned account identifier of the transacting Cardholder. - /// This identifier is a unique representation of the account identifier for the 3DS Requestor and - /// is provided as a String. - pub acct_info: Option, - /// Account number that will be used in the authorization request for payment transactions. - /// May be represented by PAN or token. - /// - /// This field is required. - pub acct_number: cards::CardNumber, - /// ID for the scheme to which the Cardholder's acctNumber belongs to. - /// It will be used to identify the Scheme from the 3DS Server configuration. - /// - /// This field is optional, but recommended to include. - /// It should be present when it is not one of the schemes for which scheme resolving regular expressions - /// are provided in the 3DS Server Configuration Properties. Additionally, - /// if the schemeId is present in the request and there are card ranges found by multiple schemes, the schemeId will be - /// used for proper resolving of the versioning data. - pub scheme_id: Option, - /// Additional information about the account optionally provided by the 3DS Requestor. - /// - /// This field is limited to 64 characters and it is optional to use. - #[serde(rename = "acctID")] - pub acct_id: Option, - /// Indicates if the transaction was de-tokenized prior to being received by the ACS. - /// - /// The boolean value of true is the only valid response for this field when it is present. - /// - /// The field is required only if there is a de-tokenization of an Account Number. - pub pay_token_ind: Option, - /// Information about the de-tokenised Payment Token. - /// Note: Data will be formatted into a JSON object prior to being placed into the EMV Payment Token field of the message. - /// - /// This field is optional. - pub pay_token_info: Option, - /// Three or four-digit security code printed on the card. - /// The value is numeric and limited to 3-4 characters. - /// - /// This field is required depending on the rules provided by the Directory Server. - /// Available for supporting EMV 3DS 2.3.1 and later versions. - pub card_security_code: Option>, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum AccountType { - #[serde(rename = "01")] - NotApplicable, - #[serde(rename = "02")] - Credit, - #[serde(rename = "03")] - Debit, - #[serde(rename = "80")] - Jcb, - /// 81-99 -> PS-specific value (dependent on the payment scheme type). - #[serde(untagged)] - PsSpecificValue(String), -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct CardHolderAccountInformation { - /// Length of time that the cardholder has had the account with the 3DS Requestor. - /// - /// Accepted values are: - /// - `01` -> No account - /// - `02` -> Created during this transaction - /// - `03` -> Less than 30 days - /// - `04` -> Between 30 and 60 days - /// - `05` -> More than 60 days - pub ch_acc_age_ind: Option, - - /// Date converted into UTC that the cardholder opened the account with the 3DS Requestor. - /// - /// Date format = YYYYMMDD. - pub ch_acc_date: Option, - - /// Length of time since the cardholder’s account information with the 3DS Requestor was - /// last changed. - /// - /// Includes Billing or Shipping address, new payment account, or new user(s) added. - /// - /// Accepted values are: - /// - `01` -> Changed during this transaction - /// - `02` -> Less than 30 days - /// - `03` -> 30 - 60 days - /// - `04` -> More than 60 days - pub ch_acc_change_ind: Option, - - /// Date converted into UTC that the cardholder’s account with the 3DS Requestor was last changed. - /// - /// Including Billing or Shipping address, new payment account, or new user(s) added. - /// - /// Date format = YYYYMMDD. - pub ch_acc_change: Option, - - /// Length of time since the cardholder’s account with the 3DS Requestor had a password change - /// or account reset. - /// - /// The accepted values are: - /// - `01` -> No change - /// - `02` -> Changed during this transaction - /// - `03` -> Less than 30 days - /// - `04` -> 30 - 60 days - /// - `05` -> More than 60 days - pub ch_acc_pw_change_ind: Option, - - /// Date converted into UTC that cardholder’s account with the 3DS Requestor had a password - /// change or account reset. - /// - /// Date format must be YYYYMMDD. - pub ch_acc_pw_change: Option, - - /// Indicates when the shipping address used for this transaction was first used with the - /// 3DS Requestor. - /// - /// Accepted values are: - /// - `01` -> This transaction - /// - `02` -> Less than 30 days - /// - `03` -> 30 - 60 days - /// - `04` -> More than 60 days - pub ship_address_usage_ind: Option, - - /// Date converted into UTC when the shipping address used for this transaction was first - /// used with the 3DS Requestor. - /// - /// Date format must be YYYYMMDD. - pub ship_address_usage: Option, - - /// Number of transactions (successful and abandoned) for this cardholder account with the - /// 3DS Requestor across all payment accounts in the previous 24 hours. - pub txn_activity_day: Option, - - /// Number of transactions (successful and abandoned) for this cardholder account with the - /// 3DS Requestor across all payment accounts in the previous year. - pub txn_activity_year: Option, - - /// Number of Add Card attempts in the last 24 hours. - pub provision_attempts_day: Option, - - /// Number of purchases with this cardholder account during the previous six months. - pub nb_purchase_account: Option, - - /// Indicates whether the 3DS Requestor has experienced suspicious activity - /// (including previous fraud) on the cardholder account. - /// - /// Accepted values are: - /// - `01` -> No suspicious activity has been observed - /// - `02` -> Suspicious activity has been observed - pub suspicious_acc_activity: Option, - - /// Indicates if the Cardholder Name on the account is identical to the shipping Name used - /// for this transaction. - /// - /// Accepted values are: - /// - `01` -> Account Name identical to shipping Name - /// - `02` -> Account Name different than shipping Name - pub ship_name_indicator: Option, - - /// Indicates the length of time that the payment account was enrolled in the cardholder’s - /// account with the 3DS Requester. - /// - /// Accepted values are: - /// - `01` -> No account (guest check-out) - /// - `02` -> During this transaction - /// - `03` -> Less than 30 days - /// - `04` -> 30 - 60 days - /// - `05` -> More than 60 days - pub payment_acc_ind: Option, - - /// Date converted into UTC that the payment account was enrolled in the cardholder’s account with - /// the 3DS Requestor. - /// - /// Date format must be YYYYMMDD. - pub payment_acc_age: Option, - - /// The 3DS Requestor assigned account identifier of the transacting Cardholder. - /// - /// This identifier is a unique representation of the account identifier for the 3DS Requestor and - /// is provided as a String. Accepted value length is maximum 64 characters. - /// - /// Added starting from EMV 3DS 2.3.1. - pub ch_acc_req_id: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -#[serde_with::skip_serializing_none] -pub struct Cardholder { - /// Indicates whether the Cardholder Shipping Address and Cardholder Billing Address are the same. - /// - /// Accepted values: - /// - `Y` -> Shipping Address matches Billing Address - /// - `N` -> Shipping Address does not match Billing Address - /// - /// If the field is not set and the shipping and billing addresses are the same, the 3DS Server will set the value to - /// `Y`. Otherwise, the value will not be changed. - /// - /// This field is optional. - addr_match: Option, - - /// The city of the Cardholder billing address associated with the card used for this purchase. - /// - /// This field is limited to a maximum of 50 characters. - /// - /// This field is required unless market or regional mandate restricts sending this information. - bill_addr_city: Option, - - /// The country of the Cardholder billing address associated with the card used for this purchase. - /// - /// This field is limited to 3 characters. This value shall be the ISO 3166-1 numeric country code, except values - /// from range 901 - 999 which are reserved by ISO. - /// - /// The field is required if Cardholder Billing Address State is present and unless market or regional mandate - /// restricts sending this information. - bill_addr_country: Option, - - /// First line of the street address or equivalent local portion of the Cardholder billing address associated with - /// the card use for this purchase. - /// - /// This field is limited to a maximum of 50 characters. - /// - /// This field is required unless market or regional mandate restricts sending this information. - bill_addr_line1: Option>, - - /// Second line of the street address or equivalent local portion of the Cardholder billing address associated with - /// the card use for this purchase. - /// - /// This field is limited to a maximum of 50 characters. - /// - /// This field is required unless market or regional mandate restricts sending this information. - bill_addr_line2: Option>, - - /// Third line of the street address or equivalent local portion of the Cardholder billing address associated with - /// the card use for this purchase. - /// - /// This field is limited to a maximum of 50 characters. - /// - /// This field is required unless market or regional mandate restricts sending this information. - bill_addr_line3: Option>, - - /// ZIP or other postal code of the Cardholder billing address associated with the card used for this purchase. - /// - /// This field is limited to a maximum of 16 characters. - /// - /// This field is required unless market or regional mandate restricts sending this information. - bill_addr_post_code: Option>, - - /// The state or province of the Cardholder billing address associated with the card used for this purchase. - /// - /// This field is limited to 3 characters. The value should be the country subdivision code defined in ISO 3166-2. - /// - /// This field is required unless State is not applicable for this country and unless market or regional mandate - /// restricts sending this information. - bill_addr_state: Option>, - - /// The email address associated with the account that is either entered by the Cardholder, or is on file with - /// the 3DS Requestor. - /// - /// This field is limited to a maximum of 256 characters and shall meet requirements of Section 3.4 of - /// IETF RFC 5322. - /// - /// This field is required unless market or regional mandate restricts sending this information. - email: Option, - - /// The home phone provided by the Cardholder. - /// - /// Refer to ITU-E.164 for additional information on format and length. - /// - /// This field is required if available, unless market or regional mandate restricts sending this information. - home_phone: Option, - - /// The mobile phone provided by the Cardholder. - /// - /// Refer to ITU-E.164 for additional information on format and length. - /// - /// This field is required if available, unless market or regional mandate restricts sending this information. - mobile_phone: Option, - - /// The work phone provided by the Cardholder. - /// - /// Refer to ITU-E.164 for additional information on format and length. - /// - /// This field is required if available, unless market or regional mandate restricts sending this information. - work_phone: Option, - - /// Name of the Cardholder. - /// - /// This field is limited to 2-45 characters. - /// - /// This field is required unless market or regional mandate restricts sending this information. - /// - /// Starting from EMV 3DS 2.3.1: - /// This field is limited to 1-45 characters. - cardholder_name: Option>, - - /// City portion of the shipping address requested by the Cardholder. - /// - /// This field is required unless shipping information is the same as billing information, or market or regional - /// mandate restricts sending this information. - ship_addr_city: Option, - - /// Country of the shipping address requested by the Cardholder. - /// - /// This field is limited to 3 characters. This value shall be the ISO 3166-1 numeric country code, except values - /// from range 901 - 999 which are reserved by ISO. - /// - /// This field is required if Cardholder Shipping Address State is present and if shipping information are not the same - /// as billing information. This field can be omitted if market or regional mandate restricts sending this information. - ship_addr_country: Option, - - /// First line of the street address or equivalent local portion of the shipping address associated with - /// the card use for this purchase. - /// - /// This field is limited to a maximum of 50 characters. - /// - /// This field is required unless shipping information is the same as billing information, or market or regional - /// mandate restricts sending this information. - ship_addr_line1: Option>, - - /// Second line of the street address or equivalent local portion of the shipping address associated with - /// the card use for this purchase. - /// - /// This field is limited to a maximum of 50 characters. - /// - /// This field is required unless shipping information is the same as billing information, or market or regional - /// mandate restricts sending this information. - ship_addr_line2: Option>, - - /// Third line of the street address or equivalent local portion of the shipping address associated with - /// the card use for this purchase. - /// - /// This field is limited to a maximum of 50 characters. - /// - /// This field is required unless shipping information is the same as billing information, or market or regional - /// mandate restricts sending this information. - ship_addr_line3: Option>, - - /// ZIP or other postal code of the shipping address associated with the card used for this purchase. - /// - /// This field is limited to a maximum of 16 characters. - /// - /// This field is required unless shipping information is the same as billing information, or market or regional - /// mandate restricts sending this information. - ship_addr_post_code: Option>, - - /// The state or province of the shipping address associated with the card used for this purchase. - /// - /// This field is limited to 3 characters. The value should be the country subdivision code defined in ISO 3166-2. - /// - /// This field is required unless shipping information is the same as billing information, or State is not applicable - /// for this country, or market or regional mandate restricts sending this information. - ship_addr_state: Option>, - - /// Tax ID is the Cardholder's tax identification. - /// - /// The value is limited to 45 characters. - /// - /// This field is required depending on the rules provided by the Directory Server. - /// Available for supporting EMV 3DS 2.3.1 and later versions. - tax_id: Option, -} - -impl - TryFrom<( - api_models::payments::Address, - Option, - )> for Cardholder -{ - type Error = error_stack::Report; - fn try_from( - (billing_address, shipping_address): ( - api_models::payments::Address, - Option, - ), - ) -> Result { - Ok(Self { - addr_match: None, - bill_addr_city: billing_address - .address - .as_ref() - .and_then(|add| add.city.clone()), - bill_addr_country: None, - bill_addr_line1: billing_address - .address - .as_ref() - .and_then(|add| add.line1.clone()), - bill_addr_line2: billing_address - .address - .as_ref() - .and_then(|add| add.line2.clone()), - bill_addr_line3: billing_address - .address - .as_ref() - .and_then(|add| add.line3.clone()), - bill_addr_post_code: billing_address - .address - .as_ref() - .and_then(|add| add.zip.clone()), - bill_addr_state: billing_address - .address - .as_ref() - .and_then(|add| add.to_state_code_as_optional().transpose()) - .transpose()?, - email: billing_address.email, - home_phone: billing_address - .phone - .clone() - .map(PhoneNumber::try_from) - .transpose()?, - mobile_phone: billing_address - .phone - .clone() - .map(PhoneNumber::try_from) - .transpose()?, - work_phone: billing_address - .phone - .clone() - .map(PhoneNumber::try_from) - .transpose()?, - cardholder_name: billing_address - .address - .as_ref() - .and_then(|add| add.first_name.clone()), - ship_addr_city: shipping_address - .as_ref() - .and_then(|shipping_add| shipping_add.address.as_ref()) - .and_then(|add| add.city.clone()), - ship_addr_country: None, - ship_addr_line1: shipping_address - .as_ref() - .and_then(|shipping_add| shipping_add.address.as_ref()) - .and_then(|add| add.line1.clone()), - ship_addr_line2: shipping_address - .as_ref() - .and_then(|shipping_add| shipping_add.address.as_ref()) - .and_then(|add| add.line2.clone()), - ship_addr_line3: shipping_address - .as_ref() - .and_then(|shipping_add| shipping_add.address.as_ref()) - .and_then(|add| add.line3.clone()), - ship_addr_post_code: shipping_address - .as_ref() - .and_then(|shipping_add| shipping_add.address.as_ref()) - .and_then(|add| add.zip.clone()), - ship_addr_state: shipping_address - .as_ref() - .and_then(|shipping_add| shipping_add.address.as_ref()) - .and_then(|add| add.to_state_code_as_optional().transpose()) - .transpose()?, - tax_id: None, - }) - } -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct PhoneNumber { - /// Country Code of the phone, limited to 1-3 characters - #[serde(rename = "cc")] - country_code: Option, - subscriber: Option>, -} - -impl TryFrom for PhoneNumber { - type Error = error_stack::Report; - fn try_from(value: api_models::payments::PhoneDetails) -> Result { - Ok(Self { - country_code: Some(value.extract_country_code()?), - subscriber: value.number, - }) - } -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Purchase { - /// Indicates the maximum number of authorisations permitted for instalment payments. - /// - /// The field is limited to a maximum of 3 characters and value shall be greater than 1. - /// - /// The field is required if the Merchant and Cardholder have agreed to installment payments, i.e. if 3DS Requestor - /// Authentication Indicator = 03. Omitted if not an installment payment authentication. - /// - /// Starting from EMV 3DS 2.3.1: - /// Additionally this field is required for deviceChannel = 03 (3RI) if threeRIInd = 02. - pub purchase_instal_data: Option, - - /// Merchant's assessment of the level of fraud risk for the specific authentication for both the cardholder and the - /// authentication being conducted. - /// - /// The field is optional but strongly recommended to include. - pub merchant_risk_indicator: Option, - - /// Purchase amount in minor units of currency with all punctuation removed. When used in conjunction with the Purchase - /// Currentcy Exponent field, proper punctuation can be calculated. Example: If the purchase amount is USD 123.45, - /// element will contain the value 12345. The field is limited to maximum 48 characters. - /// - /// This field is required for 02 - NPA message category if 3DS Requestor Authentication Indicator = 02 or 03. - /// - /// Starting from EMV 3DS 2.3.1: - /// Additionally this field is required for messageCategory = 02 (NPA) if threeRIInd = 01, 02, 06, 07, 08, 09, or 11. - pub purchase_amount: Option, - - /// Currency in which purchase amount is expressed. The value is limited to 3 numeric characters and is represented by - /// the ISO 4217 three-digit currency code, except 955-964 and 999. - /// - /// This field is required for requests where messageCategory = 01-PA and for 02-NPA if 3DS Requestor Authentication - /// Indicator = 02 or 03. - /// - /// Starting from EMV 3DS 2.3.1: - /// Additionally this field is required for messageCategory = 02 (NPA) if threeRIInd = 01, 02, 06, 07, 08, 09, or 11. - pub purchase_currency: String, - - /// Minor units of currency as specified in the ISO 4217 currency exponent. The field is limited to 1 character and it - /// is required for 01-PA and for 02-NPA if 3DS Requestor Authentication Indicator = 02 or 03. - /// - /// Example: for currency USD the exponent should be 2, and for Yen the exponent should be 0. - /// - /// Starting from EMV 3DS 2.3.1: - /// Additionally this field is required for messageCategory = 02 (NPA) if threeRIInd = 01, 02, 06, 07, 08, 09, or 11. - pub purchase_exponent: u8, - - /// Date and time of the purchase, converted into UTC. The field is limited to 14 characters, - /// formatted as YYYYMMDDHHMMSS. - /// - /// This field is required for 01-PA and for 02-NPA, if 3DS Requestor Authentication Indicator = 02 or 03. - /// - /// Starting from EMV 3DS 2.3.1: - /// Additionally this field is required for messageCategory = 02 (NPA) if threeRIInd = 01, 02, 06, 07, 08, 09, or 11. - pub purchase_date: Option, - - /// Date after which no further authorizations shall be performed. This field is limited to 8 characters, and the - /// accepted format is YYYYMMDD. - /// - /// This field is required for 01-PA and for 02-NPA, if 3DS Requestor Authentication Indicator = 02 or 03. - /// - /// Starting from EMV 3DS 2.3.1: - /// This field is required if recurringInd = 01. - pub recurring_expiry: Option, - - /// Indicates the minimum number of days between authorizations. The field is limited to maximum 4 characters. - /// - /// This field is required if 3DS Requestor Authentication Indicator = 02 or 03. - /// - /// Starting from EMV 3DS 2.3.1: - /// This field is required if recurringInd = 01 - pub recurring_frequency: Option, - - /// Identifies the type of transaction being authenticated. The values are derived from ISO 8583. Accepted values are: - /// - 01 -> Goods / Service purchase - /// - 03 -> Check Acceptance - /// - 10 -> Account Funding - /// - 11 -> Quasi-Cash Transaction - /// - 28 -> Prepaid activation and Loan - /// - /// This field is required in some markets. Otherwise, the field is optional. - /// - /// This field is required if 3DS Requestor Authentication Indicator = 02 or 03. - pub trans_type: Option, - - /// Recurring amount after first/promotional payment in minor units of currency with all punctuation removed. - /// Example: If the recurring amount is USD 123.45, element will contain the value 12345. The field is limited to - /// maximum 48 characters. - /// - /// The field is required if threeDSRequestorAuthenticationInd = 02 or 03 OR threeRIInd = 01 or 02 AND - /// purchaseAmount != recurringAmount AND recurringInd = 01. - /// - /// Available for supporting EMV 3DS 2.3.1 and later versions. - pub recurring_amount: Option, - - /// Currency in which recurring amount is expressed. The value is limited to 3 numeric characters and is represented by - /// the ISO 4217 three-digit currency code, except 955-964 and 999. - /// - /// This field is required if recurringAmount is present. - /// - /// Available for supporting EMV 3DS 2.3.1 and later versions. - pub recurring_currency: Option, - - /// Minor units of currency as specified in the ISO 4217 currency exponent. Example: USD = 2, Yen = 0. The value is - /// limited to 1 numeric character. - /// - /// This field is required if recurringAmount is present. - /// - /// Available for supporting EMV 3DS 2.3.1 and later versions. - pub recurring_exponent: Option, - - /// Effective date of new authorised amount following first/promotional payment in recurring transaction. The value - /// is limited to 8 characters. Accepted format: YYYYMMDD. - /// - /// This field is required if recurringInd = 01. - /// - /// Available for supporting EMV 3DS 2.3.1 and later versions. - pub recurring_date: Option, - - /// Part of the indication whether the recurring or instalment payment has a fixed or variable amount. - /// - /// Accepted values are: - /// - 01 -> Fixed Purchase Amount - /// - 02 -> Variable Purchase Amount - /// - 03–79 -> Reserved for EMVCo future use (values invalid until defined by EMVCo) - /// - 80-99 -> PS-specific value (dependent on the payment scheme type) - /// - /// Available for supporting EMV 3DS 2.3.1 and later versions. - pub amount_ind: Option, - - /// Part of the indication whether the recurring or instalment payment has a fixed or variable frequency. - /// - /// Accepted values are: - /// - 01 -> Fixed Frequency - /// - 02 -> Variable Frequency - /// - 03–79 -> Reserved for EMVCo future use (values invalid until defined by EMVCo) - /// - 80-99 -> PS-specific value (dependent on the payment scheme type) - /// - /// Available for supporting EMV 3DS 2.3.1 and later versions. - pub frequency_ind: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct MerchantRiskIndicator { - /// Indicates the shipping method chosen for the transaction. - /// - /// Merchants must choose the Shipping Indicator code that most accurately describes the cardholder's specific transaction. - /// If one or more items are included in the sale, use the Shipping Indicator code for the physical goods, or if all digital goods, - /// use the code that describes the most expensive item. - /// - /// Accepted values: - /// - Ship to cardholder's billing address (01) - /// - Ship to another verified address on file with merchant (02) - /// - Ship to address that is different than the cardholder's billing address (03) - /// - Ship to Store / Pick-up at local store (Store address shall be populated in shipping address fields) (04) - /// - Digital goods (includes online services, electronic gift cards and redemption codes) (05) - /// - Travel and Event tickets, not shipped (06) - /// - Other (for example, Gaming, digital services not shipped, e-media subscriptions, etc.) (07) - /// - PS-specific value (dependent on the payment scheme type) (80-81) - /// - /// Starting from EMV 3DS 2.3.1: - /// Changed values to shipIndicator -> Accepted values are: - /// - 01 -> Ship to cardholder's billing address - /// - 02 -> Ship to another verified address on file with merchant - /// - 03 -> Ship to address that is different than the cardholder's billing address - /// - 04 -> "Ship to Store" / Pick-up at local store (Store address shall be populated in shipping - /// address fields) - /// - 05 -> Digital goods (includes online services, electronic gift cards and redemption codes) - /// - 06 -> Travel and Event tickets, not shipped - /// - 07 -> Other (for example, Gaming, digital services not shipped, e-media subscriptions, etc.) - /// - 08 -> Pick-up and go delivery - /// - 09 -> Locker delivery (or other automated pick-up) - ship_indicator: Option, - - /// Indicates the merchandise delivery timeframe. - /// - /// Accepted values: - /// - Electronic Delivery (01) - /// - Same day shipping (02) - /// - Overnight shipping (03) - /// - Two-day or more shipping (04) - delivery_timeframe: Option, - - /// For electronic delivery, the email address to which the merchandise was delivered. - delivery_email_address: Option, - - /// Indicates whether the cardholder is reordering previously purchased merchandise. - /// - /// Accepted values: - /// - First time ordered (01) - /// - Reordered (02) - reorder_items_ind: Option, - - /// Indicates whether Cardholder is placing an order for merchandise with a future availability or release date. - /// - /// Accepted values: - /// - Merchandise available (01) - /// - Future availability (02) - pre_order_purchase_ind: Option, - - /// For a pre-ordered purchase, the expected date that the merchandise will be available. - /// - /// Date format: YYYYMMDD - pre_order_date: Option, - - /// For prepaid or gift card purchase, the purchase amount total of prepaid or gift card(s) in major units. - gift_card_amount: Option, - - /// For prepaid or gift card purchase, the currency code of the card as defined in ISO 4217 except 955 - 964 and 999. - gift_card_curr: Option, // ISO 4217 currency code - - /// For prepaid or gift card purchase, total count of individual prepaid or gift cards/codes purchased. - /// - /// Field is limited to 2 characters. - gift_card_count: Option, - /// Starting from EMV 3DS 2.3.1.1: - /// New field introduced: - /// - transChar -> Indicates to the ACS specific transactions identified by the Merchant. - /// - Size: Variable, 1-2 elements. JSON Data Type: Array of String. Accepted values: - /// - 01 -> Cryptocurrency transaction - /// - 02 -> NFT transaction - trans_char: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct AcquirerData { - /// Acquiring institution identification code as assigned by the DS receiving the AReq message. - /// - /// This field is limited to 11 characters. This field can be omitted if it there is a MerchantAcquirer already configured for 3DS Server, - /// referenced by the acquirerMerchantId. - /// - /// This field is required if no MerchantAcquirer is present for the acquirer BIN in the 3DS Server configuration and - /// for requests where messageCategory = 01 (PA). For requests where messageCategory=02 (NPA), the field is required - /// only if scheme is Mastercard, for other schemes it is optional. - pub acquirer_bin: Option, - - /// Acquirer-assigned Merchant identifier. - /// - /// This may be the same value that is used in authorization requests sent on behalf of the 3DS Requestor and is represented in ISO 8583 formatting requirements. - /// The field is limited to maximum 35 characters. Individual Directory Servers may impose specific format and character requirements on - /// the contents of this field. - /// - /// This field will be used to identify the Directory Server where the AReq will be sent and the acquirerBin from the 3DS Server configuration. - /// If no MerchantAcquirer configuration is present in the 3DS Server, the DirectoryServer information will be resolved from the scheme to which the cardholder account belongs to. - /// - /// This field is required if merchantConfigurationId is not provided in the request and messageCategory = 01 (PA). - /// For Mastercard, if merchantConfigurationId is not provided, the field must be present if messageCategory = 02 (NPA). - pub acquirer_merchant_id: Option, - - /// Acquirer Country Code. - /// - /// This is the code of the country where the acquiring institution is located. The specified - /// length of this field is 3 characters and will accept values according to the ISO 3166-1 numeric three-digit - /// country code. - /// - /// The Directory Server may edit the value of this field provided by the 3DS Server. - /// - /// This field is required. - pub acquirer_country_code: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -#[serde_with::skip_serializing_none] -pub struct MerchantData { - /// ID of the merchant. This value will be used to find merchant information from the configuration. - /// From the merchant configuration the 3DS Server can fill the other values (mcc, merchantCountryCode and merchantName), if provided. - /// - /// This field can be left out if merchant information are provided in the request. - pub merchant_configuration_id: Option, - - /// Merchant Category Code. This is the DS-specific code describing the Merchant's type of business, product or service. - /// The field is limited to 4 characters. The value correlates to the Merchant Category Code as defined by each Payment System or DS. - /// - /// If not present in the request it will be filled from the merchant configuration referenced by the merchantConfigurationId. - /// - /// This field is required for messageCategory=01 (PA) and optional, but strongly recommended for 02 (NPA). - pub mcc: Option, - - /// Country code for the merchant. This value correlates to the Merchant Country Code as defined by each Payment System or DS. - /// The field is limited to 3 characters accepting ISO 3166-1 format, except 901-999. - /// - /// If not present in the request it will be filled from the merchant configuration referenced by the merchantConfigurationId. - /// - /// This field is required for messageCategory=01 (PA) and optional, but strongly recommended for 02 (NPA). - pub merchant_country_code: Option, - - /// Merchant name assigned by the Acquirer or Payment System. This field is limited to maximum 40 characters, - /// and it is the same name used in the authorisation message as defined in ISO 8583. - /// - /// If not present in the request it will be filled from the merchant configuration referenced by the merchantConfigurationId. - /// - /// This field is required for messageCategory=01 (PA) and optional, but strongly recommended for 02 (NPA). - pub merchant_name: Option, - - /// Fully qualified URL of the merchant that receives the CRes message or Error Message. - /// Incorrect formatting will result in a failure to deliver the notification of the final CRes message. - /// This field is limited to 256 characters. - /// - /// This field should be present if the merchant will receive the final CRes message and the device channel is BROWSER. - /// If not present in the request it will be filled from the notificationURL configured in the XML or database configuration. - #[serde(rename = "notificationURL")] - pub notification_url: Option, - - /// Each DS provides rules for the 3DS Requestor ID. The 3DS Requestor is responsible for providing the 3DS Requestor ID according to the DS rules. - /// - /// This value is mandatory, therefore it should be either configured for each Merchant Acquirer, or should be - /// passed in the transaction payload as part of the Merchant data. - #[serde(rename = "threeDSRequestorId")] - pub three_ds_requestor_id: Option, - - /// Each DS provides rules for the 3DS Requestor Name. The 3DS Requestor is responsible for providing the 3DS Requestor Name according to the DS rules. - /// - /// This value is mandatory, therefore it should be either configured for each Merchant Acquirer, or should be - /// passed in the transaction payload as part of the Merchant data. - #[serde(rename = "threeDSRequestorName")] - pub three_ds_requestor_name: Option, - - /// Set whitelisting status of the merchant. - /// - /// The field is optional and if value is not present, the whitelist remains unchanged. - /// This field is only available for supporting EMV 3DS 2.2.0. - pub white_list_status: Option, - - /// Set trustlisting status of the merchant. - /// - /// The field is optional and if value is not present, the trustlist remains unchanged. - /// From EMV 3DS 2.3.1 this field replaces whiteListStatus. - pub trust_list_status: Option, - - /// Additional transaction information for transactions where merchants submit transaction details on behalf of another entity. - /// The accepted value length is 1-50 elements. - /// - /// This field is optional. - pub seller_info: Option>, - - /// Fully qualified URL of the merchant that receives the RRes message or Error Message. - /// Incorrect formatting will result in a failure to deliver the notification of the final RRes message. - /// This field is limited to 256 characters. - /// - /// This field is not mandatory and could be present if the Results Response (in case of a challenge transaction) - /// should be sent to a dynamic URL different from the one present in the configuration, only if dynamic provision - /// of the Results Response notification URL is allowed per the license. - /// - /// If not present in the request it will be filled from the notificationURL configured in the XML or database - /// configuration. - pub results_response_notification_url: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub enum WhitelistStatus { - /// 3DS Requestor is whitelisted by cardholder - Y, - /// 3DS Requestor is not whitelisted by cardholder - N, - /// Not eligible as determined by issuer - E, - /// Pending confirmation by cardholder - P, - /// Cardholder rejected - R, - /// Whitelist status unknown, unavailable, or does not apply. - U, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -#[serde_with::skip_serializing_none] -pub struct SellerInfo { - /// Name of the Seller. The value length is maximum 100 characters. This field is required. - seller_name: String, - - /// Merchant-assigned Seller identifier. If this data element is present, this must match the Seller ID field - /// in the Seller Information object. The value length is maximum 50 characters. This field is required if - /// sellerId in multiTransaction object is present. - seller_id: Option, - - /// Business name of the Seller. The value length is maximum 100 characters. This field is optional. - seller_business_name: Option, - - /// Date converted into UTC that the Seller started using the Merchant's services. The accepted value length is - /// 8 characters. The accepted format is: YYYYMMDD. - seller_acc_date: Option, - - /// First line of the business or contact street address of the Seller. The value length is maximum 50 characters. - /// This field is optional. - seller_addr_line1: Option, - - /// Second line of the business or contact street address of the Seller. The value length is maximum 50 characters. - /// This field is optional. - seller_addr_line2: Option, - - /// Third line of the business or contact street address of the Seller. The value length is maximum 50 characters. - /// This field is optional. - seller_addr_line3: Option, - - /// Business or contact city of the Seller. The value length is maximum 50 characters. This field is optional. - seller_addr_city: Option, - - /// Business or contact state or province of the Seller. The value length is maximum 3 characters. Accepted values - /// are: Country subdivision code defined in ISO 3166-2. For example, using the ISO entry US-CA (California, - /// United States), the correct value for this field = CA. Note that the country and hyphen are not included in - /// this value. This field is optional. - seller_addr_state: Option, - - /// Business or contact ZIP or other postal code of the Seller. The value length is maximum 16 characters. - /// This field is optional. - seller_addr_post_code: Option, - - /// Business or contact country of the Seller. The accepted value length is 3 characters. Accepted values are - /// ISO 3166-1 numeric three-digit country code, except 955-964 and 999. This field is optional. - seller_addr_country: Option, - - /// Business or contact email address of the Seller. The value length is maximum 254 characters. Accepted values - /// shall meet requirements of Section 3.4 of IETF RFC 5322. This field is optional. - seller_email: Option, - - /// Business or contact phone number of the Seller. Country Code and Subscriber sections of the number represented - /// by the following named fields: - /// - cc -> Accepted value length is 1-3 characters. - /// - subscriber -> Accepted value length is maximum 15 characters. - /// This field is optional. - seller_phone: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Browser { - /// Exact content of the HTTP accept headers as sent to the 3DS Requestor from the Cardholder's browser. - /// This field is limited to maximum 2048 characters and if the total length exceeds the limit, the 3DS Server - /// truncates the excess portion. - /// - /// This field is required for requests where deviceChannel=02 (BRW). - browser_accept_header: Option, - - /// IP address of the browser as returned by the HTTP headers to the 3DS Requestor. The field is limited to maximum 45 - /// characters and the accepted values are as following: - /// - IPv4 address is represented in the dotted decimal format of 4 sets of decimal numbers separated by dots. The - /// decimal number in each and every set is in the range 0 - 255. Example: 1.12.123.255 - /// - IPv6 address is represented as eight groups of four hexadecimal digits, each group representing 16 bits (two - /// octets). The groups are separated by colons (:). Example: 2011:0db8:85a3:0101:0101:8a2e:0370:7334 - /// - /// This field is required for requests when deviceChannel = 02 (BRW) where regionally acceptable. - #[serde(rename = "browserIP")] - browser_ip: Option>, - - /// Boolean that represents the ability of the cardholder browser to execute Java. Value is returned from the - /// navigator.javaEnabled property. - /// - /// Depending on the message version, the field is required for requests: - /// - with message version = 2.1.0 and deviceChannel = 02 (BRW). - /// - with message version = 2.2.0 and deviceChannel = 02 (BRW) and browserJavascriptEnabled = true. - browser_java_enabled: Option, - - /// Value representing the browser language as defined in IETF BCP47. - /// - /// Until EMV 3DS 2.2.0: - /// The value is limited to 1-8 characters. If the value exceeds 8 characters, it will be truncated to a - /// semantically valid value, if possible. The value is returned from navigator.language property. - /// - /// This field is required for requests where deviceChannel = 02 (BRW) - /// In other cases this field is optional. - /// - /// Starting from EMV 3DS 2.3.1: - /// The value is limited to 35 characters. If the value exceeds 35 characters, it will be truncated to a - /// semantically valid value, if possible. The value is returned from navigator.language property. - /// - /// This field is required for requests where deviceChannel = 02 (BRW) and browserJavascriptEnabled = true. - /// In other cases this field is optional. - browser_language: Option, - - /// Value representing the bit depth of the colour palette for displaying images, in bits per pixel. Obtained from - /// Cardholder browser using the screen.colorDepth property. The field is limited to 1-2 characters. - /// - /// Accepted values are: - /// - 1 -> 1 bit - /// - 4 -> 4 bits - /// - 8 -> 8 bits - /// - 15 -> 15 bits - /// - 16 -> 16 bits - /// - 24 -> 24 bits - /// - 32 -> 32 bits - /// - 48 -> 48 bits - /// - /// If the value is not in the accepted values, it will be resolved to the first accepted value lower from the one - /// provided. - /// - /// Depending on the message version, the field is required for requests: - /// - with message version = 2.1.0 and deviceChannel = 02 (BRW). - /// - with message version = 2.2.0 and deviceChannel = 02 (BRW) and browserJavascriptEnabled = true. - browser_color_depth: Option, - - /// Total height of the Cardholder's screen in pixels. Value is returned from the screen.height property. The value is - /// limited to 1-6 characters. - /// - /// Depending on the message version, the field is required for requests: - /// - with message version = 2.1.0 and deviceChannel = 02 (BRW). - /// - with message version = 2.2.0 and deviceChannel = 02 (BRW) and browserJavascriptEnabled = true. - browser_screen_height: Option, - - /// Total width of the Cardholder's screen in pixels. Value is returned from the screen.width property. The value is - /// limited to 1-6 characters. - /// - /// Depending on the message version, the field is required for requests: - /// - with message version = 2.1.0 and deviceChannel = 02 (BRW). - /// - with message version = 2.2.0 and deviceChannel = 02 (BRW) and browserJavascriptEnabled = true. - browser_screen_width: Option, - - /// Time difference between UTC time and the Cardholder browser local time, in minutes. The field is limited to 1-5 - /// characters where the vauyes is returned from the getTimezoneOffset() method. - /// - /// Depending on the message version, the field is required for requests: - /// - with message version = 2.1.0 and deviceChannel = 02 (BRW). - /// - with message version = 2.2.0 and deviceChannel = 02 (BRW) and browserJavascriptEnabled = true. - #[serde(rename = "browserTZ")] - browser_tz: Option, - - /// Exact content of the HTTP user-agent header. The field is limited to maximum 2048 characters. If the total length of - /// the User-Agent sent by the browser exceeds 2048 characters, the 3DS Server truncates the excess portion. - /// - /// This field is required for requests where deviceChannel = 02 (BRW). - browser_user_agent: Option, - - /// Dimensions of the challenge window that has been displayed to the Cardholder. The ACS shall reply with content - /// that is formatted to appropriately render in this window to provide the best possible user experience. - /// - /// Preconfigured sizes are width X height in pixels of the window displayed in the Cardholder browser window. This is - /// used only to prepare the CReq request and it is not part of the AReq flow. If not present it will be omitted. - /// - /// However, when sending the Challenge Request, this field is required when deviceChannel = 02 (BRW). - /// - /// Accepted values are: - /// - 01 -> 250 x 400 - /// - 02 -> 390 x 400 - /// - 03 -> 500 x 600 - /// - 04 -> 600 x 400 - /// - 05 -> Full screen - challenge_window_size: Option, - - /// Boolean that represents the ability of the cardholder browser to execute JavaScript. - /// - /// This field is required for requests where deviceChannel = 02 (BRW). - /// Available for supporting EMV 3DS 2.2.0 and later versions. - browser_javascript_enabled: Option, - - /// Value representing the browser language preference present in the http header, as defined in IETF BCP 47. - /// - /// The value is limited to 1-99 elements. Each element should contain a maximum of 100 characters. - /// - /// This field is required for requests where deviceChannel = 02 (BRW). - /// Available for supporting EMV 3DS 2.3.1 and later versions. - accept_language: Option>, -} - -impl From for Browser { - fn from(value: crate::types::BrowserInformation) -> Self { - Self { - browser_accept_header: value.accept_header, - browser_ip: value - .ip_address - .map(|ip| masking::Secret::new(ip.to_string())), - browser_java_enabled: value.java_enabled, - browser_language: value.language, - browser_color_depth: value.color_depth.map(|cd| cd.to_string()), - browser_screen_height: value.screen_height, - browser_screen_width: value.screen_width, - browser_tz: Some(1), - browser_user_agent: value.user_agent, - challenge_window_size: Some(ChallengeWindowSizeEnum::FullScreen), - browser_javascript_enabled: value.java_script_enabled, - accept_language: None, - } - } -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum ChallengeWindowSizeEnum { - #[serde(rename = "01")] - Size250x400, - #[serde(rename = "02")] - Size390x400, - #[serde(rename = "03")] - Size500x600, - #[serde(rename = "04")] - Size600x400, - #[serde(rename = "05")] - FullScreen, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Sdk { - /// Universally unique ID created upon all installations and updates of the 3DS Requestor App on a Customer Device. - /// This will be newly generated and stored by the 3DS SDK for each installation or update. The field is limited to 36 - /// characters and it shall have a canonical format as defined in IETF RFC 4122. This may utilize any of the specified - /// versions as long as the output meets specified requirements. - /// - /// Starting from EMV 3DS 2.3.1: - /// In case of Browser-SDK, the SDK App ID value is not reliable, and may change for each transaction. - #[serde(rename = "sdkAppID")] - sdk_app_id: Option, - - /// JWE Object as defined Section 6.2.2.1 containing data encrypted by the SDK for the DS to decrypt. This element is - /// the only field encrypted in this version of the EMV 3-D Secure specification. The field is sent from the SDK and it - /// is limited to 64.000 characters. The data will be present when sending to DS, but not present from DS to ACS. - sdk_enc_data: Option, - - /// Public key component of the ephemeral key pair generated by the 3DS SDK and used to establish session keys between - /// the 3DS SDK and ACS. In AReq, this data element is contained within the ACS Signed Content JWS Object. The field is - /// limited to maximum 256 characters. - sdk_ephem_pub_key: Option>, - - /// Indicates the maximum amount of time (in minutes) for all exchanges. The field shall have value greater or equals - /// than 05. - sdk_max_timeout: Option, - - /// Identifies the vendor and version of the 3DS SDK that is integrated in a 3DS Requestor App, assigned by EMVCo when - /// the 3DS SDK is approved. The field is limited to 32 characters. - /// - /// Starting from EMV 3DS 2.3.1: - /// Identifies the vendor and version of the 3DS SDK that is utilised for a specific transaction. The value is - /// assigned by EMVCo when the Letter of Approval of the specific 3DS SDK is issued. - sdk_reference_number: Option, - - /// Universally unique transaction identifier assigned by the 3DS SDK to identify a single transaction. The field is - /// limited to 36 characters and it shall be in a canonical format as defined in IETF RFC 4122. This may utilize any of - /// the specified versions as long as the output meets specific requirements. - #[serde(rename = "sdkTransID")] - sdk_trans_id: Option, - - /// Contains the JWS object(represented as a string) created by the Split-SDK Server for the AReq message. A - /// Split-SDK Server creates a time-stamped signature on certain transaction data that is sent to the DS for - /// verification. As a prerequisite, the Split-SDK Server has a key pair PbSDK, PvSDK certificate Cert (PbSDK). This - /// certificate is an X.509 certificate signed by a DS CA whose public key is known to the DS. - /// - /// The Split-SDK Server: - /// Creates a JSON object of the following data as the JWS payload to be signed: - /// - /// SDK Reference Number -> Identifies the vendor and version of the 3DS SDK that is utilised for a specific - /// transaction. The value is assigned by EMVCo when the Letter of Approval of the - /// specific 3DS SDK is issued. The field is limited to 32 characters. - /// SDK Signature Timestamp -> Date and time indicating when the 3DS SDK generated the Split-SDK Server Signed - /// Content converted into UTC. The value is limited to 14 characters. Accepted - /// format: YYYYMMDDHHMMSS. - /// SDK Transaction ID -> Universally unique transaction identifier assigned by the 3DS SDK to identify a - /// single transaction. The field is limited to 36 characters and it shall be in a - /// canonical format as defined in IETF RFC 4122. This may utilize any of the specified - /// versions as long as the output meets specific requirements. - /// Split-SDK Server ID -> DS assigned Split-SDK Server identifier. Each DS can provide a unique ID to each - /// Split-SDK Server on an individual basis. The field is limited to 32 characters. - /// Any individual DS may impose specific formatting and character requirements on the - /// contents of this field. - /// - /// Generates a digital signature of the full JSON object according to JWS (RFC 7515) using JWS Compact - /// Serialization. The parameter values for this version of the specification and to be included in the JWS - /// header are: - /// - /// "alg": PS2567 or ES256 - /// "x5c": X.5C v3: Cert (PbSDK) and chaining certificates if present - /// - /// All other parameters: optional - /// - /// Includes the resulting JWS in the AReq message as SDK Server Signed Content - /// - /// This field is required if sdkType = 02 or 03 and deviceChannel = 01 (APP) - /// Available for supporting EMV 3DS 2.3.1 and later versions. - sdk_server_signed_content: Option, - - /// Indicates the type of 3DS SDK. - /// This data element provides additional information to the DS and ACS to determine the best approach for handling - /// the transaction. Accepted values are: - /// - /// - 01 -> Default SDK - /// - 02 -> Split-SDK - /// - 03 -> Limited-SDK - /// - 04 -> Browser-SDK - /// - 05 -> Shell-SDK - /// - 80-99 -> PS-specific value (dependent on the payment scheme type) - /// - /// This field is required for requests where deviceChannel = 01 (APP). - /// Available for supporting EMV 3DS 2.3.1 and later versions. - sdk_type: Option, - - /// Indicates the characteristics of a Default-SDK. - /// - /// This field is required for requests where deviceChannel = 01 (APP) and SDK Type = 01. - /// Available for supporting EMV 3DS 2.3.1 and later versions. - default_sdk_type: Option, - - /// Indicates the characteristics of a Split-SDK. - /// - /// This field is required for requests where deviceChannel = 01 (APP) and SDK Type = 02. - /// Available for supporting EMV 3DS 2.3.1 and later versions. - split_sdk_type: Option, -} - -impl From for Sdk { - fn from(sdk_info: api_models::payments::SdkInformation) -> Self { - Self { - sdk_app_id: Some(sdk_info.sdk_app_id), - sdk_enc_data: Some(sdk_info.sdk_enc_data), - sdk_ephem_pub_key: Some(sdk_info.sdk_ephem_pub_key), - sdk_max_timeout: Some(sdk_info.sdk_max_timeout), - sdk_reference_number: Some(sdk_info.sdk_reference_number), - sdk_trans_id: Some(sdk_info.sdk_trans_id), - sdk_server_signed_content: None, - sdk_type: None, - default_sdk_type: None, - split_sdk_type: None, - } - } -} - -/// Enum representing the type of 3DS SDK. -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum SdkTypeEnum { - #[serde(rename = "01")] - DefaultSdk, - #[serde(rename = "02")] - SplitSdk, - #[serde(rename = "03")] - LimitedSdk, - #[serde(rename = "04")] - BrowserSdk, - #[serde(rename = "05")] - ShellSdk, - /// - 80-99 -> PS-specific value (dependent on the payment scheme type) - #[serde(untagged)] - PsSpecific(String), -} - -/// Struct representing characteristics of a Default-SDK. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct DefaultSdkType { - /// SDK Variant: SDK implementation characteristics - /// - Length: 2 characters - /// - Values accepted: - /// - 01 = Native - /// - 02–79 = Reserved for EMVCo future use (values invalid until defined by EMVCo) - /// - 80–99 = Reserved for DS use - sdk_variant: String, - - /// Wrapped Indicator: If the Default-SDK is embedded as a wrapped component in the 3DS Requestor App - /// - Length: 1 character - /// - Value accepted: Y = Wrapped - /// - Only present if value = Y - wrapped_ind: Option, -} - -/// Struct representing characteristics of a Split-SDK. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct SplitSdkType { - /// Split-SDK Variant: Implementation characteristics of the Split-SDK client - /// - Length: 2 characters - /// - Values accepted: - /// - 01 = Native Client - /// - 02 = Browser - /// - 03 = Shell - /// - 04–79 = Reserved for EMVCo future use (values invalid until defined by EMVCo) - /// - 80–99 = Reserved for DS use - sdk_variant: String, - - /// Limited Split-SDK Indicator: If the Split-SDK client has limited capabilities - /// - Length: 1 character - /// - Value accepted: - /// • Y = Limited - /// - Only present if value = Y - limited_ind: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct MessageExtensionAttribute { - id: String, - name: String, - criticality_indicator: bool, - data: String, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum ThreeDSReqAuthMethod { - /// No 3DS Requestor authentication occurred (i.e. cardholder "logged in" as guest) - #[serde(rename = "01")] - Guest, - /// Login to the cardholder account at the 3DS Requestor system using 3DS Requestor's own credentials - #[serde(rename = "02")] - ThreeDsRequestorCredentials, - /// Login to the cardholder account at the 3DS Requestor system using federated ID - #[serde(rename = "03")] - FederatedID, - /// Login to the cardholder account at the 3DS Requestor system using issuer credentials - #[serde(rename = "04")] - IssuerCredentials, - /// Login to the cardholder account at the 3DS Requestor system using third-party authentication - #[serde(rename = "05")] - ThirdPartyAuthentication, - /// Login to the cardholder account at the 3DS Requestor system using FIDO Authenticator. - #[serde(rename = "06")] - FidoAuthenticator, - /// Login to the cardholder account at the 3DS Requestor system using FIDO Authenticator(FIDO assurance data signed). - #[serde(rename = "07")] - FidoAssuranceData, - /// SRC Assurance Data. - #[serde(rename = "08")] - SRCAssuranceData, - /// Additionally, 80-99 can be used for PS-specific values, regardless of protocol version. - #[serde(untagged)] - PsSpecificValue(String), -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct DeviceRenderingOptionsSupported { - pub sdk_interface: SdkInterface, - /// For Native UI SDK Interface accepted values are 01-04 and for HTML UI accepted values are 01-05. - pub sdk_ui_type: Vec, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum SdkInterface { - #[serde(rename = "01")] - Native, - #[serde(rename = "02")] - Html, - #[serde(rename = "03")] - Both, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum SdkUiType { - #[serde(rename = "01")] - Text, - #[serde(rename = "02")] - SingleSelect, - #[serde(rename = "03")] - MultiSelect, - #[serde(rename = "04")] - Oob, - #[serde(rename = "05")] - HtmlOther, -} diff --git a/crates/router/src/connector/netcetera/transformers.rs b/crates/router/src/connector/netcetera/transformers.rs deleted file mode 100644 index 7c95578bfd6..00000000000 --- a/crates/router/src/connector/netcetera/transformers.rs +++ /dev/null @@ -1,696 +0,0 @@ -use error_stack::ResultExt; -use masking::Secret; -use serde::{Deserialize, Serialize}; - -use super::netcetera_types; -use crate::{ - connector::utils::{self, CardData}, - core::errors, - types::{self, api}, - utils::OptionExt, -}; - -//TODO: Fill the struct with respective fields -pub struct NetceteraRouterData { - pub amount: i64, // The type of amount that a connector accepts, for example, String, i64, f64, etc. - pub router_data: T, -} - -impl - TryFrom<( - &types::api::CurrencyUnit, - types::storage::enums::Currency, - i64, - T, - )> for NetceteraRouterData -{ - type Error = error_stack::Report; - fn try_from( - (_currency_unit, _currency, amount, item): ( - &types::api::CurrencyUnit, - types::storage::enums::Currency, - i64, - T, - ), - ) -> Result { - //Todo : use utils to convert the amount to the type of amount that a connector accepts - Ok(Self { - amount, - router_data: item, - }) - } -} - -impl TryFrom<(i64, T)> for NetceteraRouterData { - type Error = error_stack::Report; - fn try_from((amount, router_data): (i64, T)) -> Result { - Ok(Self { - amount, - router_data, - }) - } -} - -impl - TryFrom< - types::ResponseRouterData< - api::PreAuthentication, - NetceteraPreAuthenticationResponse, - types::authentication::PreAuthNRequestData, - types::authentication::AuthenticationResponseData, - >, - > for types::authentication::PreAuthNRouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::ResponseRouterData< - api::PreAuthentication, - NetceteraPreAuthenticationResponse, - types::authentication::PreAuthNRequestData, - types::authentication::AuthenticationResponseData, - >, - ) -> Result { - let response = match item.response { - NetceteraPreAuthenticationResponse::Success(pre_authn_response) => { - // if card is not enrolled for 3ds, card_range will be None - let card_range = pre_authn_response.get_card_range_if_available(); - let maximum_supported_3ds_version = card_range - .as_ref() - .map(|card_range| card_range.highest_common_supported_version.clone()) - .unwrap_or_else(|| { - // Version "0.0.0" will be less that "2.0.0", hence we will treat this card as not eligible for 3ds authentication - common_utils::types::SemanticVersion::new(0, 0, 0) - }); - let three_ds_method_data = card_range.as_ref().and_then(|card_range| { - card_range - .three_ds_method_data_form - .as_ref() - .map(|data| data.three_ds_method_data.clone()) - }); - let three_ds_method_url = card_range - .as_ref() - .and_then(|card_range| card_range.get_three_ds_method_url()); - Ok( - types::authentication::AuthenticationResponseData::PreAuthNResponse { - threeds_server_transaction_id: pre_authn_response - .three_ds_server_trans_id - .clone(), - maximum_supported_3ds_version: maximum_supported_3ds_version.clone(), - connector_authentication_id: pre_authn_response.three_ds_server_trans_id, - three_ds_method_data, - three_ds_method_url, - message_version: maximum_supported_3ds_version, - connector_metadata: None, - }, - ) - } - NetceteraPreAuthenticationResponse::Failure(error_response) => { - Err(types::ErrorResponse { - code: error_response.error_details.error_code, - message: error_response.error_details.error_detail, - reason: Some(error_response.error_details.error_description), - status_code: item.http_code, - attempt_status: None, - connector_transaction_id: None, - }) - } - }; - Ok(Self { - response, - ..item.data.clone() - }) - } -} - -impl - TryFrom< - types::ResponseRouterData< - api::Authentication, - NetceteraAuthenticationResponse, - types::authentication::ConnectorAuthenticationRequestData, - types::authentication::AuthenticationResponseData, - >, - > for types::authentication::ConnectorAuthenticationRouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::ResponseRouterData< - api::Authentication, - NetceteraAuthenticationResponse, - types::authentication::ConnectorAuthenticationRequestData, - types::authentication::AuthenticationResponseData, - >, - ) -> Result { - let response = match item.response { - NetceteraAuthenticationResponse::Success(response) => { - let authn_flow_type = match response.acs_challenge_mandated { - Some(ACSChallengeMandatedIndicator::Y) => { - types::authentication::AuthNFlowType::Challenge(Box::new( - types::authentication::ChallengeParams { - acs_url: response.authentication_response.acs_url.clone(), - challenge_request: response.encoded_challenge_request, - acs_reference_number: response - .authentication_response - .acs_reference_number, - acs_trans_id: response.authentication_response.acs_trans_id, - three_dsserver_trans_id: Some(response.three_ds_server_trans_id), - acs_signed_content: response - .authentication_response - .acs_signed_content, - }, - )) - } - Some(ACSChallengeMandatedIndicator::N) | None => { - types::authentication::AuthNFlowType::Frictionless - } - }; - Ok( - types::authentication::AuthenticationResponseData::AuthNResponse { - authn_flow_type, - authentication_value: response.authentication_value, - trans_status: response.trans_status, - }, - ) - } - NetceteraAuthenticationResponse::Error(error_response) => Err(types::ErrorResponse { - code: error_response.error_details.error_code, - message: error_response.error_details.error_detail, - reason: Some(error_response.error_details.error_description), - status_code: item.http_code, - attempt_status: None, - connector_transaction_id: None, - }), - }; - Ok(Self { - response, - ..item.data.clone() - }) - } -} - -pub struct NetceteraAuthType { - pub(super) certificate: Secret, - pub(super) private_key: Secret, -} - -impl TryFrom<&types::ConnectorAuthType> for NetceteraAuthType { - type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { - match auth_type.to_owned() { - types::ConnectorAuthType::CertificateAuth { - certificate, - private_key, - } => Ok(Self { - certificate, - private_key, - }), - _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), - } - } -} - -#[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct NetceteraErrorResponse { - pub three_ds_server_trans_id: Option, - pub error_details: NetceteraErrorDetails, -} - -#[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct NetceteraErrorDetails { - /// Universally unique identifier for the transaction assigned by the 3DS Server. - #[serde(rename = "threeDSServerTransID")] - pub three_ds_server_trans_id: Option, - - /// Universally Unique identifier for the transaction assigned by the ACS. - #[serde(rename = "acsTransID")] - pub acs_trans_id: Option, - - /// Universally unique identifier for the transaction assigned by the DS. - #[serde(rename = "dsTransID")] - pub ds_trans_id: Option, - - /// Code indicating the type of problem identified. - pub error_code: String, - - /// Code indicating the 3-D Secure component that identified the error. - pub error_component: String, - - /// Text describing the problem identified. - pub error_description: String, - - /// Additional detail regarding the problem identified. - pub error_detail: String, - - /// Universally unique identifier for the transaction assigned by the 3DS SDK. - #[serde(rename = "sdkTransID")] - pub sdk_trans_id: Option, - - /// The Message Type that was identified as erroneous. - pub error_message_type: String, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct NetceteraMetaData { - pub mcc: String, - pub merchant_country_code: String, - pub merchant_name: String, - pub endpoint_prefix: String, - pub three_ds_requestor_name: String, - pub three_ds_requestor_id: String, -} - -impl TryFrom<&Option> for NetceteraMetaData { - type Error = error_stack::Report; - fn try_from( - meta_data: &Option, - ) -> Result { - let metadata: Self = utils::to_connector_meta_from_secret::(meta_data.clone()) - .change_context(errors::ConnectorError::InvalidConnectorConfig { - config: "metadata", - })?; - Ok(metadata) - } -} - -#[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct NetceteraPreAuthenticationRequest { - cardholder_account_number: cards::CardNumber, - scheme_id: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -pub enum SchemeId { - Visa, - Mastercard, - #[serde(rename = "JCB")] - Jcb, - #[serde(rename = "American Express")] - AmericanExpress, - Diners, - // For Cartes Bancaires and UnionPay, it is recommended to send the scheme ID - #[serde(rename = "CB")] - CartesBancaires, - UnionPay, -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum NetceteraPreAuthenticationResponse { - Success(Box), - Failure(Box), -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct NetceteraPreAuthenticationResponseData { - #[serde(rename = "threeDSServerTransID")] - pub three_ds_server_trans_id: String, - pub card_ranges: Vec, -} - -impl NetceteraPreAuthenticationResponseData { - pub fn get_card_range_if_available(&self) -> Option { - let card_range = self - .card_ranges - .iter() - .max_by_key(|card_range| &card_range.highest_common_supported_version); - card_range.cloned() - } -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct CardRange { - pub scheme_id: SchemeId, - pub directory_server_id: Option, - pub acs_protocol_versions: Vec, - #[serde(rename = "threeDSMethodDataForm")] - pub three_ds_method_data_form: Option, - pub highest_common_supported_version: common_utils::types::SemanticVersion, -} - -impl CardRange { - pub fn get_three_ds_method_url(&self) -> Option { - self.acs_protocol_versions - .iter() - .find(|acs_protocol_version| { - acs_protocol_version.version == self.highest_common_supported_version - }) - .and_then(|acs_version| acs_version.three_ds_method_url.clone()) - } -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ThreeDSMethodDataForm { - // base64 encoded value for 3ds method data collection - #[serde(rename = "threeDSMethodData")] - pub three_ds_method_data: String, -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct AcsProtocolVersion { - pub version: common_utils::types::SemanticVersion, - #[serde(rename = "threeDSMethodURL")] - pub three_ds_method_url: Option, -} - -impl TryFrom<&NetceteraRouterData<&types::authentication::PreAuthNRouterData>> - for NetceteraPreAuthenticationRequest -{ - type Error = error_stack::Report; - - fn try_from( - value: &NetceteraRouterData<&types::authentication::PreAuthNRouterData>, - ) -> Result { - let router_data = value.router_data; - Ok(Self { - cardholder_account_number: router_data.request.card_holder_account_number.clone(), - scheme_id: None, - }) - } -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -#[serde(rename_all = "camelCase")] -#[serde_with::skip_serializing_none] -pub struct NetceteraAuthenticationRequest { - /// Specifies the preferred version of 3D Secure protocol to be utilized while executing 3D Secure authentication. - /// 3DS Server initiates an authentication request with the preferred version and if this version is not supported by - /// other 3D Secure components, it falls back to the next supported version(s) and continues authentication. - /// - /// If the preferred version is enforced by setting #enforcePreferredProtocolVersion flag, but this version - /// is not supported by one of the 3D Secure components, 3DS Server does not initiate an authentication and provides - /// corresponding error message to the customer. - /// - /// The accepted values are: - /// - 2.1.0 -> prefer authentication with 2.1.0 version, - /// - 2.2.0 -> prefer authentication with 2.2.0 version, - /// - 2.3.1 -> prefer authentication with 2.3.1 version, - /// - latest -> prefer authentication with the latest version, the 3DS Server is certified for. 2.3.1 at this moment. - pub preferred_protocol_version: Option, - /// Boolean flag that enforces preferred 3D Secure protocol version to be used in 3D Secure authentication. - /// The value should be set true to enforce preferred version. If value is false or not provided, - /// 3DS Server can fall back to next supported 3DS protocol version while initiating 3D Secure authentication. - /// - /// For application initiated transactions (deviceChannel = '01'), the preferred protocol version must be enforced. - pub enforce_preferred_protocol_version: Option, - pub device_channel: netcetera_types::NetceteraDeviceChannel, - /// Identifies the category of the message for a specific use case. The accepted values are: - /// - /// - 01 -> PA - /// - 02 -> NPA - /// - 80 - 99 -> PS Specific Values (80 -> MasterCard Identity Check Insights; - /// 85 -> MasterCard Identity Check, Production Validation PA; - /// 86 -> MasterCard Identity Check, Production Validation NPA) - pub message_category: netcetera_types::NetceteraMessageCategory, - #[serde(rename = "threeDSCompInd")] - pub three_ds_comp_ind: Option, - /** - * Contains the 3DS Server Transaction ID used during the previous execution of the 3DS method. Accepted value - * length is 36 characters. Accepted value is a Canonical format as defined in IETF RFC 4122. May utilise any of the - * specified versions if the output meets specified requirements. - * - * This field is required if the 3DS Requestor reuses previous 3DS Method execution with deviceChannel = 02 (BRW). - * Available for supporting EMV 3DS 2.3.1 and later versions. - */ - #[serde(rename = "threeDSMethodId")] - pub three_ds_method_id: Option, - #[serde(rename = "threeDSRequestor")] - pub three_ds_requestor: Option, - #[serde(rename = "threeDSServerTransID")] - pub three_ds_server_trans_id: String, - #[serde(rename = "threeDSRequestorURL")] - pub three_ds_requestor_url: Option, - pub cardholder_account: netcetera_types::CardholderAccount, - pub cardholder: Option, - pub purchase: Option, - pub acquirer: Option, - pub merchant: Option, - pub broad_info: Option, - pub device_render_options: Option, - pub message_extension: Option>, - pub challenge_message_extension: Option>, - pub browser_information: Option, - #[serde(rename = "threeRIInd")] - pub three_ri_ind: Option, - pub sdk_information: Option, - pub device: Option, - pub multi_transaction: Option, - pub device_id: Option, - pub user_id: Option, - pub payee_origin: Option, -} - -impl TryFrom<&NetceteraRouterData<&types::authentication::ConnectorAuthenticationRouterData>> - for NetceteraAuthenticationRequest -{ - type Error = error_stack::Report; - fn try_from( - item: &NetceteraRouterData<&types::authentication::ConnectorAuthenticationRouterData>, - ) -> Result { - let now = common_utils::date_time::now(); - let three_ds_req_auth_timestamp = common_utils::date_time::format_date( - now, - common_utils::date_time::DateFormat::YYYYMMDDHHmm, - ) - .change_context(errors::ConnectorError::RequestEncodingFailedWithReason( - "Failed to format Date".to_string(), - ))?; - let request = item.router_data.request.clone(); - let pre_authn_data = request.pre_authentication_data.clone(); - let three_ds_requestor = netcetera_types::ThreeDSRequestor { - three_ds_requestor_authentication_ind: - netcetera_types::ThreeDSRequestorAuthenticationIndicator::Payment, - three_ds_requestor_authentication_info: Some( - netcetera_types::SingleOrListElement::new_single( - netcetera_types::ThreeDSRequestorAuthenticationInformation { - three_ds_req_auth_method: netcetera_types::ThreeDSReqAuthMethod::Guest, - three_ds_req_auth_timestamp, - three_ds_req_auth_data: None, - }, - ), - ), - three_ds_requestor_challenge_ind: None, - three_ds_requestor_prior_authentication_info: None, - three_ds_requestor_dec_req_ind: None, - three_ds_requestor_dec_max_time: None, - app_ip: None, - three_ds_requestor_spc_support: None, - spc_incomp_ind: None, - }; - let card = utils::get_card_details(request.payment_method_data, "netcetera")?; - let cardholder_account = netcetera_types::CardholderAccount { - acct_type: None, - card_expiry_date: Some(card.get_expiry_date_as_yymm()?), - acct_info: None, - acct_number: card.card_number, - scheme_id: None, - acct_id: None, - pay_token_ind: None, - pay_token_info: None, - card_security_code: Some(card.card_cvc), - }; - let currency = request - .currency - .get_required_value("currency") - .change_context(errors::ConnectorError::MissingRequiredField { - field_name: "currency", - })?; - let purchase = netcetera_types::Purchase { - purchase_instal_data: None, - merchant_risk_indicator: None, - purchase_amount: request.amount, - purchase_currency: currency.iso_4217().to_string(), - purchase_exponent: currency.number_of_digits_after_decimal_point(), - purchase_date: Some( - common_utils::date_time::format_date( - now, - common_utils::date_time::DateFormat::YYYYMMDDHHmmss, - ) - .change_context( - errors::ConnectorError::RequestEncodingFailedWithReason( - "Failed to format Date".to_string(), - ), - )?, - ), - recurring_expiry: Some("20240401".to_string()), - recurring_frequency: Some(1), - trans_type: None, - recurring_amount: None, - recurring_currency: None, - recurring_exponent: None, - recurring_date: None, - amount_ind: None, - frequency_ind: None, - }; - let acquirer_details = netcetera_types::AcquirerData { - acquirer_bin: request.pre_authentication_data.acquirer_bin, - acquirer_merchant_id: request.pre_authentication_data.acquirer_merchant_id, - acquirer_country_code: None, - }; - let connector_meta_data: NetceteraMetaData = item - .router_data - .connector_meta_data - .clone() - .parse_value("NetceteraMetaData") - .change_context(errors::ConnectorError::RequestEncodingFailed)?; - let merchant_data = netcetera_types::MerchantData { - merchant_configuration_id: None, - mcc: Some(connector_meta_data.mcc), - merchant_country_code: Some(connector_meta_data.merchant_country_code), - merchant_name: Some(connector_meta_data.merchant_name), - notification_url: request.return_url.clone(), - three_ds_requestor_id: Some(connector_meta_data.three_ds_requestor_id), - three_ds_requestor_name: Some(connector_meta_data.three_ds_requestor_name), - white_list_status: None, - trust_list_status: None, - seller_info: None, - results_response_notification_url: Some(request.webhook_url), - }; - let browser_information = request.browser_details.map(netcetera_types::Browser::from); - let sdk_information = request.sdk_information.map(netcetera_types::Sdk::from); - let device_render_options = match request.device_channel { - api_models::payments::DeviceChannel::App => { - Some(netcetera_types::DeviceRenderingOptionsSupported { - // hard-coded until core provides these values. - sdk_interface: netcetera_types::SdkInterface::Both, - sdk_ui_type: vec![ - netcetera_types::SdkUiType::Text, - netcetera_types::SdkUiType::SingleSelect, - netcetera_types::SdkUiType::MultiSelect, - netcetera_types::SdkUiType::Oob, - netcetera_types::SdkUiType::HtmlOther, - ], - }) - } - api_models::payments::DeviceChannel::Browser => None, - }; - Ok(Self { - preferred_protocol_version: Some(pre_authn_data.message_version), - enforce_preferred_protocol_version: None, - device_channel: netcetera_types::NetceteraDeviceChannel::from(request.device_channel), - message_category: netcetera_types::NetceteraMessageCategory::from( - request.message_category, - ), - three_ds_comp_ind: Some(netcetera_types::ThreeDSMethodCompletionIndicator::from( - request.threeds_method_comp_ind, - )), - three_ds_method_id: None, - three_ds_requestor: Some(three_ds_requestor), - three_ds_server_trans_id: pre_authn_data.threeds_server_transaction_id, - three_ds_requestor_url: Some(request.three_ds_requestor_url), - cardholder_account, - cardholder: Some(netcetera_types::Cardholder::try_from(( - request.billing_address, - request.shipping_address, - ))?), - purchase: Some(purchase), - acquirer: Some(acquirer_details), - merchant: Some(merchant_data), - broad_info: None, - device_render_options, - message_extension: None, - challenge_message_extension: None, - browser_information, - three_ri_ind: None, - sdk_information, - device: None, - multi_transaction: None, - device_id: None, - user_id: None, - payee_origin: None, - }) - } -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum NetceteraAuthenticationResponse { - Error(NetceteraAuthenticationFailureResponse), - Success(NetceteraAuthenticationSuccessResponse), -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct NetceteraAuthenticationSuccessResponse { - #[serde(rename = "threeDSServerTransID")] - pub three_ds_server_trans_id: String, - pub trans_status: common_enums::TransactionStatus, - pub authentication_value: Option, - pub eci: Option, - pub acs_challenge_mandated: Option, - pub authentication_response: AuthenticationResponse, - #[serde(rename = "base64EncodedChallengeRequest")] - pub encoded_challenge_request: Option, -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct NetceteraAuthenticationFailureResponse { - pub error_details: NetceteraErrorDetails, -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct AuthenticationResponse { - #[serde(rename = "acsURL")] - pub acs_url: Option, - pub acs_reference_number: Option, - #[serde(rename = "acsTransID")] - pub acs_trans_id: Option, - pub acs_signed_content: Option, -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -pub enum ACSChallengeMandatedIndicator { - /// Challenge is mandated - Y, - /// Challenge is not mandated - N, -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ResultsResponseData { - /// Universally unique transaction identifier assigned by the 3DS Server to identify a single transaction. - /// It has the same value as the authentication request and conforms to the format defined in IETF RFC 4122. - #[serde(rename = "threeDSServerTransID")] - pub three_ds_server_trans_id: String, - - /// Indicates the status of a transaction in terms of its authentication. - /// - /// Valid values: - /// - `Y`: Authentication / Account verification successful. - /// - `N`: Not authenticated / Account not verified; Transaction denied. - /// - `U`: Authentication / Account verification could not be performed; technical or other problem. - /// - `C`: A challenge is required to complete the authentication. - /// - `R`: Authentication / Account verification Rejected. Issuer is rejecting authentication/verification - /// and request that authorization not be attempted. - /// - `A`: Attempts processing performed; Not authenticated / verified, but a proof of attempt - /// authentication / verification is provided. - /// - `D`: A challenge is required to complete the authentication. Decoupled Authentication confirmed. - /// - `I`: Informational Only; 3DS Requestor challenge preference acknowledged. - pub trans_status: Option, - - /// Payment System-specific value provided as part of the ACS registration for each supported DS. - /// Authentication Value may be used to provide proof of authentication. - pub authentication_value: Option, - - /// Payment System-specific value provided by the ACS to indicate the results of the attempt to authenticate - /// the Cardholder. - pub eci: Option, - - /// The received Results Request from the Directory Server. - pub results_request: Option, - - /// The sent Results Response to the Directory Server. - pub results_response: Option, - - /// Optional object containing error details if any errors occurred during the process. - pub error_details: Option, -} diff --git a/crates/router/src/connector/nexinets/transformers.rs b/crates/router/src/connector/nexinets/transformers.rs index c6ef4ea1ba8..703c24e56e9 100644 --- a/crates/router/src/connector/nexinets/transformers.rs +++ b/crates/router/src/connector/nexinets/transformers.rs @@ -1,7 +1,7 @@ +use api_models::payments::PaymentMethodData; use base64::Engine; use cards::CardNumber; use common_utils::errors::CustomResult; -use domain::PaymentMethodData; use error_stack::ResultExt; use masking::{ExposeInterface, PeekInterface, Secret}; use serde::{Deserialize, Serialize}; @@ -14,7 +14,7 @@ use crate::{ consts, core::errors, services, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, + types::{self, api, storage::enums, transformers::ForeignFrom}, }; #[derive(Debug, Serialize)] @@ -252,20 +252,20 @@ impl ForeignFrom<(NexinetsPaymentStatus, NexinetsTransactionType)> for enums::At } } -impl TryFrom<&common_enums::enums::BankNames> for NexinetsBIC { +impl TryFrom<&api_models::enums::BankNames> for NexinetsBIC { type Error = error_stack::Report; - fn try_from(bank: &common_enums::enums::BankNames) -> Result { + fn try_from(bank: &api_models::enums::BankNames) -> Result { match bank { - common_enums::enums::BankNames::AbnAmro => Ok(Self::AbnAmro), - common_enums::enums::BankNames::AsnBank => Ok(Self::AsnBank), - common_enums::enums::BankNames::Bunq => Ok(Self::Bunq), - common_enums::enums::BankNames::Ing => Ok(Self::Ing), - common_enums::enums::BankNames::Knab => Ok(Self::Knab), - common_enums::enums::BankNames::Rabobank => Ok(Self::Rabobank), - common_enums::enums::BankNames::Regiobank => Ok(Self::Regiobank), - common_enums::enums::BankNames::SnsBank => Ok(Self::SnsBank), - common_enums::enums::BankNames::TriodosBank => Ok(Self::TriodosBank), - common_enums::enums::BankNames::VanLanschot => Ok(Self::VanLanschot), + api_models::enums::BankNames::AbnAmro => Ok(Self::AbnAmro), + api_models::enums::BankNames::AsnBank => Ok(Self::AsnBank), + api_models::enums::BankNames::Bunq => Ok(Self::Bunq), + api_models::enums::BankNames::Ing => Ok(Self::Ing), + api_models::enums::BankNames::Knab => Ok(Self::Knab), + api_models::enums::BankNames::Rabobank => Ok(Self::Rabobank), + api_models::enums::BankNames::Regiobank => Ok(Self::Regiobank), + api_models::enums::BankNames::SnsBank => Ok(Self::SnsBank), + api_models::enums::BankNames::TriodosBank => Ok(Self::TriodosBank), + api_models::enums::BankNames::VanLanschot => Ok(Self::VanLanschot), _ => Err(errors::ConnectorError::FlowNotSupported { flow: bank.to_string(), connector: "Nexinets".to_string(), @@ -580,9 +580,11 @@ fn get_payment_details_and_product( )), PaymentMethodData::Wallet(wallet) => Ok(get_wallet_details(wallet)?), PaymentMethodData::BankRedirect(bank_redirect) => match bank_redirect { - domain::BankRedirectData::Eps { .. } => Ok((None, NexinetsProduct::Eps)), - domain::BankRedirectData::Giropay { .. } => Ok((None, NexinetsProduct::Giropay)), - domain::BankRedirectData::Ideal { bank_name, .. } => Ok(( + api_models::payments::BankRedirectData::Eps { .. } => Ok((None, NexinetsProduct::Eps)), + api_models::payments::BankRedirectData::Giropay { .. } => { + Ok((None, NexinetsProduct::Giropay)) + } + api_models::payments::BankRedirectData::Ideal { bank_name, .. } => Ok(( Some(NexinetsPaymentDetails::BankRedirects(Box::new( NexinetsBankRedirects { bic: bank_name @@ -592,20 +594,22 @@ fn get_payment_details_and_product( ))), NexinetsProduct::Ideal, )), - domain::BankRedirectData::Sofort { .. } => Ok((None, NexinetsProduct::Sofort)), - domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Bizum { .. } - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::Przelewy24 { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } => { + api_models::payments::BankRedirectData::Sofort { .. } => { + Ok((None, NexinetsProduct::Sofort)) + } + api_models::payments::BankRedirectData::BancontactCard { .. } + | api_models::payments::BankRedirectData::Blik { .. } + | api_models::payments::BankRedirectData::Bizum { .. } + | api_models::payments::BankRedirectData::Interac { .. } + | api_models::payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | api_models::payments::BankRedirectData::OnlineBankingFinland { .. } + | api_models::payments::BankRedirectData::OnlineBankingPoland { .. } + | api_models::payments::BankRedirectData::OnlineBankingSlovakia { .. } + | api_models::payments::BankRedirectData::OpenBankingUk { .. } + | api_models::payments::BankRedirectData::Przelewy24 { .. } + | api_models::payments::BankRedirectData::Trustly { .. } + | api_models::payments::BankRedirectData::OnlineBankingFpx { .. } + | api_models::payments::BankRedirectData::OnlineBankingThailand { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nexinets"), ))? @@ -629,7 +633,7 @@ fn get_payment_details_and_product( fn get_card_data( item: &types::PaymentsAuthorizeRouterData, - card: &domain::payments::Card, + card: &api_models::payments::Card, ) -> Result { let (card_data, cof_contract) = match item.request.is_mandate_payment() { true => { @@ -656,8 +660,8 @@ fn get_card_data( } fn get_applepay_details( - wallet_data: &domain::WalletData, - applepay_data: &domain::ApplePayWalletData, + wallet_data: &api_models::payments::WalletData, + applepay_data: &api_models::payments::ApplePayWalletData, ) -> CustomResult { let payment_data = wallet_data.get_wallet_token_as_json("Apple Pay".to_string())?; Ok(ApplePayDetails { @@ -672,7 +676,7 @@ fn get_applepay_details( } fn get_card_details( - req_card: &domain::payments::Card, + req_card: &api_models::payments::Card, ) -> Result { Ok(CardDetails { card_number: req_card.card_number.clone(), @@ -683,14 +687,14 @@ fn get_card_details( } fn get_wallet_details( - wallet: &domain::WalletData, + wallet: &api_models::payments::WalletData, ) -> Result< (Option, NexinetsProduct), error_stack::Report, > { match wallet { - domain::WalletData::PaypalRedirect(_) => Ok((None, NexinetsProduct::Paypal)), - domain::WalletData::ApplePay(applepay_data) => Ok(( + api_models::payments::WalletData::PaypalRedirect(_) => Ok((None, NexinetsProduct::Paypal)), + api_models::payments::WalletData::ApplePay(applepay_data) => Ok(( Some(NexinetsPaymentDetails::Wallet(Box::new( NexinetsWalletDetails::ApplePayToken(Box::new(get_applepay_details( wallet, @@ -699,32 +703,34 @@ fn get_wallet_details( ))), NexinetsProduct::Applepay, )), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect { .. } - | domain::WalletData::GooglePay(_) - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect { .. } - | domain::WalletData::VippsRedirect { .. } - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("nexinets"), - ))?, + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect { .. } + | api_models::payments::WalletData::GooglePay(_) + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect { .. } + | api_models::payments::WalletData::VippsRedirect { .. } + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("nexinets"), + ))? + } } } diff --git a/crates/router/src/connector/nmi.rs b/crates/router/src/connector/nmi.rs index a00e276b9ce..d34b894411f 100644 --- a/crates/router/src/connector/nmi.rs +++ b/crates/router/src/connector/nmi.rs @@ -1007,10 +1007,7 @@ impl services::ConnectorRedirectResponse for Nmi { } } } - services::PaymentAction::PSync - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { - Ok(payments::CallConnectorAction::Trigger) - } + services::PaymentAction::PSync => Ok(payments::CallConnectorAction::Trigger), } } } diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs index ea61782d498..2358e0f6cc0 100644 --- a/crates/router/src/connector/nmi/transformers.rs +++ b/crates/router/src/connector/nmi/transformers.rs @@ -6,7 +6,7 @@ use common_utils::{ ext_traits::XmlExt, pii::{self, Email}, }; -use error_stack::{report, Report, ResultExt}; +use error_stack::{Report, ResultExt}; use masking::{ExposeInterface, PeekInterface, Secret}; use serde::{Deserialize, Serialize}; @@ -17,7 +17,7 @@ use crate::{ }, core::errors, services, - types::{self, api, domain, storage::enums, transformers::ForeignFrom, ConnectorAuthType}, + types::{self, api, storage::enums, transformers::ForeignFrom, ConnectorAuthType}, }; type Error = Report; @@ -116,18 +116,14 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for NmiVaultRequest { let auth_type: NmiAuthType = (&item.connector_auth_type).try_into()?; let (ccnumber, ccexp, cvv) = get_card_details(item.request.payment_method_data.clone())?; let billing_details = item.get_billing_address()?; - let first_name = billing_details.get_first_name()?; Ok(Self { security_key: auth_type.api_key, ccnumber, ccexp, cvv, - first_name: first_name.clone(), - last_name: billing_details - .get_last_name() - .unwrap_or(first_name) - .clone(), + first_name: billing_details.get_first_name()?.to_owned(), + last_name: billing_details.get_last_name()?.to_owned(), address1: billing_details.line1.clone(), address2: billing_details.line2.clone(), city: billing_details.city.clone(), @@ -140,10 +136,10 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for NmiVaultRequest { } fn get_card_details( - payment_method_data: Option, + payment_method_data: Option, ) -> CustomResult<(CardNumber, Secret, Secret), errors::ConnectorError> { match payment_method_data { - Some(domain::PaymentMethodData::Card(ref card_details)) => Ok(( + Some(api::PaymentMethodData::Card(ref card_details)) => Ok(( card_details.card_number.clone(), utils::CardData::get_card_expiry_month_year_2_digit_with_delimiter( card_details, @@ -464,8 +460,7 @@ impl NmiMerchantDefinedField { #[derive(Debug, Serialize)] #[serde(untagged)] pub enum PaymentMethod { - CardNonThreeDs(Box), - CardThreeDs(Box), + Card(Box), GPay(Box), ApplePay(Box), } @@ -477,19 +472,6 @@ pub struct CardData { cvv: Secret, } -#[derive(Debug, Serialize)] -pub struct CardThreeDsData { - ccnumber: CardNumber, - ccexp: Secret, - email: Option, - cardholder_auth: Option, - cavv: Option, - eci: Option, - cvv: Secret, - three_ds_version: Option, - directory_server_id: Option>, -} - #[derive(Debug, Serialize)] pub struct GooglePayData { googlepay_payment_data: Secret, @@ -511,10 +493,8 @@ impl TryFrom<&NmiRouterData<&types::PaymentsAuthorizeRouterData>> for NmiPayment }; let auth_type: NmiAuthType = (&item.router_data.connector_auth_type).try_into()?; let amount = item.amount; - let payment_method = PaymentMethod::try_from(( - &item.router_data.request.payment_method_data, - Some(item.router_data), - ))?; + let payment_method = + PaymentMethod::try_from(&item.router_data.request.payment_method_data)?; Ok(Self { transaction_type, @@ -533,114 +513,72 @@ impl TryFrom<&NmiRouterData<&types::PaymentsAuthorizeRouterData>> for NmiPayment } } -impl - TryFrom<( - &domain::PaymentMethodData, - Option<&types::PaymentsAuthorizeRouterData>, - )> for PaymentMethod -{ +impl TryFrom<&api_models::payments::PaymentMethodData> for PaymentMethod { type Error = Error; fn try_from( - item: ( - &domain::PaymentMethodData, - Option<&types::PaymentsAuthorizeRouterData>, - ), + payment_method_data: &api_models::payments::PaymentMethodData, ) -> Result { - let (payment_method_data, router_data) = item; - match payment_method_data { - domain::PaymentMethodData::Card(ref card) => match router_data { - Some(data) => match data.auth_type { - common_enums::AuthenticationType::NoThreeDs => Ok(Self::try_from(card)?), - common_enums::AuthenticationType::ThreeDs => { - Ok(Self::try_from((card, &data.request))?) - } - }, - None => Ok(Self::try_from(card)?), - }, - domain::PaymentMethodData::Wallet(ref wallet_type) => match wallet_type { - domain::WalletData::GooglePay(ref googlepay_data) => Ok(Self::from(googlepay_data)), - domain::WalletData::ApplePay(ref applepay_data) => Ok(Self::from(applepay_data)), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => { - Err(report!(errors::ConnectorError::NotImplemented( + match &payment_method_data { + api::PaymentMethodData::Card(ref card) => Ok(Self::try_from(card)?), + api::PaymentMethodData::Wallet(ref wallet_type) => match wallet_type { + api_models::payments::WalletData::GooglePay(ref googlepay_data) => { + Ok(Self::from(googlepay_data)) + } + api_models::payments::WalletData::ApplePay(ref applepay_data) => { + Ok(Self::from(applepay_data)) + } + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { + Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nmi"), - ))) + ) + .into()) } }, - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("nmi"), - ) - .into()) - } + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("nmi"), + ) + .into()), } } } -impl TryFrom<(&domain::payments::Card, &types::PaymentsAuthorizeData)> for PaymentMethod { - type Error = Error; - fn try_from( - val: (&domain::payments::Card, &types::PaymentsAuthorizeData), - ) -> Result { - let (card_data, item) = val; - let auth_data = &item.get_authentication_data()?; - let ccexp = utils::CardData::get_card_expiry_month_year_2_digit_with_delimiter( - card_data, - "".to_string(), - )?; - - let card_3ds_details = CardThreeDsData { - ccnumber: card_data.card_number.clone(), - ccexp, - cvv: card_data.card_cvc.clone(), - email: item.email.clone(), - cavv: Some(auth_data.cavv.clone()), - eci: auth_data.eci.clone(), - cardholder_auth: None, - three_ds_version: Some(auth_data.message_version.clone()), - directory_server_id: Some(auth_data.threeds_server_transaction_id.clone().into()), - }; - - Ok(Self::CardThreeDs(Box::new(card_3ds_details))) - } -} - -impl TryFrom<&domain::payments::Card> for PaymentMethod { +impl TryFrom<&api_models::payments::Card> for PaymentMethod { type Error = Error; - fn try_from(card: &domain::payments::Card) -> Result { + fn try_from(card: &api_models::payments::Card) -> Result { let ccexp = utils::CardData::get_card_expiry_month_year_2_digit_with_delimiter( card, "".to_string(), @@ -650,12 +588,12 @@ impl TryFrom<&domain::payments::Card> for PaymentMethod { ccexp, cvv: card.card_cvc.clone(), }; - Ok(Self::CardNonThreeDs(Box::new(card))) + Ok(Self::Card(Box::new(card))) } } -impl From<&domain::GooglePayWalletData> for PaymentMethod { - fn from(wallet_data: &domain::GooglePayWalletData) -> Self { +impl From<&api_models::payments::GooglePayWalletData> for PaymentMethod { + fn from(wallet_data: &api_models::payments::GooglePayWalletData) -> Self { let gpay_data = GooglePayData { googlepay_payment_data: Secret::new(wallet_data.tokenization_data.token.clone()), }; @@ -663,8 +601,8 @@ impl From<&domain::GooglePayWalletData> for PaymentMethod { } } -impl From<&domain::ApplePayWalletData> for PaymentMethod { - fn from(wallet_data: &domain::ApplePayWalletData) -> Self { +impl From<&api_models::payments::ApplePayWalletData> for PaymentMethod { + fn from(wallet_data: &api_models::payments::ApplePayWalletData) -> Self { let apple_pay_data = ApplePayData { applepay_payment_data: Secret::new(wallet_data.payment_data.clone()), }; @@ -676,7 +614,7 @@ impl TryFrom<&types::SetupMandateRouterData> for NmiPaymentsRequest { type Error = Error; fn try_from(item: &types::SetupMandateRouterData) -> Result { let auth_type: NmiAuthType = (&item.connector_auth_type).try_into()?; - let payment_method = PaymentMethod::try_from((&item.request.payment_method_data, None))?; + let payment_method = PaymentMethod::try_from(&item.request.payment_method_data)?; Ok(Self { transaction_type: TransactionType::Validate, security_key: auth_type.api_key, diff --git a/crates/router/src/connector/noon.rs b/crates/router/src/connector/noon.rs index dcbeeac960f..f247a5dae1f 100644 --- a/crates/router/src/connector/noon.rs +++ b/crates/router/src/connector/noon.rs @@ -775,9 +775,7 @@ impl services::ConnectorRedirectResponse for Noon { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs index 8fd148864f5..38202291b41 100644 --- a/crates/router/src/connector/noon/transformers.rs +++ b/crates/router/src/connector/noon/transformers.rs @@ -10,7 +10,7 @@ use crate::{ }, core::{errors, mandate::MandateBehaviour}, services, - types::{self, api, domain, storage::enums, transformers::ForeignFrom, ErrorResponse}, + types::{self, api, storage::enums, transformers::ForeignFrom, ErrorResponse}, }; // These needs to be accepted from SDK, need to be done after 1.0.0 stability as API contract will change @@ -239,17 +239,15 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest { ), _ => ( match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(req_card) => { - Ok(NoonPaymentData::Card(NoonCard { - name_on_card: item.get_optional_billing_full_name(), - number_plain: req_card.card_number.clone(), - expiry_month: req_card.card_exp_month.clone(), - expiry_year: req_card.get_expiry_year_4_digit(), - cvv: req_card.card_cvc, - })) - } - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data.clone() { - domain::WalletData::GooglePay(google_pay_data) => { + api::PaymentMethodData::Card(req_card) => Ok(NoonPaymentData::Card(NoonCard { + name_on_card: req_card.card_holder_name.clone(), + number_plain: req_card.card_number.clone(), + expiry_month: req_card.card_exp_month.clone(), + expiry_year: req_card.get_expiry_year_4_digit(), + cvv: req_card.card_cvc, + })), + api::PaymentMethodData::Wallet(wallet_data) => match wallet_data.clone() { + api_models::payments::WalletData::GooglePay(google_pay_data) => { Ok(NoonPaymentData::GooglePay(NoonGooglePay { api_version_minor: GOOGLEPAY_API_VERSION_MINOR, api_version: GOOGLEPAY_API_VERSION, @@ -258,7 +256,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest { ), })) } - domain::WalletData::ApplePay(apple_pay_data) => { + api_models::payments::WalletData::ApplePay(apple_pay_data) => { let payment_token_data = NoonApplePayTokenData { token: NoonApplePayData { payment_data: wallet_data @@ -281,51 +279,51 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest { payment_info: Secret::new(payment_token), })) } - domain::WalletData::PaypalRedirect(_) => { + api_models::payments::WalletData::PaypalRedirect(_) => { Ok(NoonPaymentData::PayPal(NoonPayPal { return_url: item.request.get_router_return_url()?, })) } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => { + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { Err(errors::ConnectorError::NotImplemented( conn_utils::get_unimplemented_payment_method_error_message("Noon"), )) } }, - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment {} - | domain::PaymentMethodData::Reward {} - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment {} + | api::PaymentMethodData::Reward {} + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( conn_utils::get_unimplemented_payment_method_error_message("Noon"), )) @@ -373,13 +371,11 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest { .get_setup_mandate_details() .map(|mandate_data| { let max_amount = match &mandate_data.mandate_type { - Some(hyperswitch_domain_models::mandates::MandateDataType::SingleUse( - mandate, - )) - | Some(hyperswitch_domain_models::mandates::MandateDataType::MultiUse(Some( - mandate, - ))) => conn_utils::to_currency_base_unit(mandate.amount, mandate.currency), - Some(hyperswitch_domain_models::mandates::MandateDataType::MultiUse(None)) => { + Some(data_models::mandates::MandateDataType::SingleUse(mandate)) + | Some(data_models::mandates::MandateDataType::MultiUse(Some(mandate))) => { + conn_utils::to_currency_base_unit(mandate.amount, mandate.currency) + } + Some(data_models::mandates::MandateDataType::MultiUse(None)) => { Err(errors::ConnectorError::MissingRequiredField { field_name: "setup_future_usage.mandate_data.mandate_type.multi_use.amount", diff --git a/crates/router/src/connector/nuvei.rs b/crates/router/src/connector/nuvei.rs index aa4157a68d8..0e3ae84581a 100644 --- a/crates/router/src/connector/nuvei.rs +++ b/crates/router/src/connector/nuvei.rs @@ -998,10 +998,7 @@ impl services::ConnectorRedirectResponse for Nuvei { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { - Ok(payments::CallConnectorAction::Trigger) - } + services::PaymentAction::PSync => Ok(payments::CallConnectorAction::Trigger), services::PaymentAction::CompleteAuthorize => { if let Some(payload) = json_payload { let redirect_response: nuvei::NuveiRedirectionResponse = diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs index e0d7a58566d..6753dfe203f 100644 --- a/crates/router/src/connector/nuvei/transformers.rs +++ b/crates/router/src/connector/nuvei/transformers.rs @@ -1,3 +1,4 @@ +use api_models::payments; use common_utils::{ crypto::{self, GenerateDigest}, date_time, @@ -5,8 +6,8 @@ use common_utils::{ fp_utils, pii::{Email, IpAddress}, }; +use data_models::mandates::MandateDataType; use error_stack::ResultExt; -use hyperswitch_domain_models::mandates::MandateDataType; use masking::{ExposeInterface, PeekInterface, Secret}; use reqwest::Url; use serde::{Deserialize, Serialize}; @@ -19,7 +20,7 @@ use crate::{ consts, core::errors, services, - types::{self, api, domain, storage::enums, transformers::ForeignTryFrom, BrowserInformation}, + types::{self, api, storage::enums, transformers::ForeignTryFrom, BrowserInformation}, utils::OptionExt, }; @@ -423,16 +424,14 @@ impl } } -#[derive(Debug)] +#[derive(Debug, Default)] pub struct NuveiCardDetails { - card: domain::Card, + card: payments::Card, three_d: Option, - card_holder_name: Option>, } - -impl TryFrom for NuveiPaymentsRequest { +impl TryFrom for NuveiPaymentsRequest { type Error = error_stack::Report; - fn try_from(gpay_data: domain::GooglePayWalletData) -> Result { + fn try_from(gpay_data: payments::GooglePayWalletData) -> Result { Ok(Self { payment_option: PaymentOption { card: Some(Card { @@ -452,8 +451,8 @@ impl TryFrom for NuveiPaymentsRequest { }) } } -impl From for NuveiPaymentsRequest { - fn from(apple_pay_data: domain::ApplePayWalletData) -> Self { +impl From for NuveiPaymentsRequest { + fn from(apple_pay_data: payments::ApplePayWalletData) -> Self { Self { payment_option: PaymentOption { card: Some(Card { @@ -470,156 +469,156 @@ impl From for NuveiPaymentsRequest { } } -impl TryFrom for NuveiBIC { +impl TryFrom for NuveiBIC { type Error = error_stack::Report; - fn try_from(bank: common_enums::enums::BankNames) -> Result { + fn try_from(bank: api_models::enums::BankNames) -> Result { match bank { - common_enums::enums::BankNames::AbnAmro => Ok(Self::Abnamro), - common_enums::enums::BankNames::AsnBank => Ok(Self::ASNBank), - common_enums::enums::BankNames::Bunq => Ok(Self::Bunq), - common_enums::enums::BankNames::Ing => Ok(Self::Ing), - common_enums::enums::BankNames::Knab => Ok(Self::Knab), - common_enums::enums::BankNames::Rabobank => Ok(Self::Rabobank), - common_enums::enums::BankNames::SnsBank => Ok(Self::SNSBank), - common_enums::enums::BankNames::TriodosBank => Ok(Self::TriodosBank), - common_enums::enums::BankNames::VanLanschot => Ok(Self::VanLanschotBankiers), - common_enums::enums::BankNames::Moneyou => Ok(Self::Moneyou), - - common_enums::enums::BankNames::AmericanExpress - | common_enums::enums::BankNames::AffinBank - | common_enums::enums::BankNames::AgroBank - | common_enums::enums::BankNames::AllianceBank - | common_enums::enums::BankNames::AmBank - | common_enums::enums::BankNames::BankOfAmerica - | common_enums::enums::BankNames::BankIslam - | common_enums::enums::BankNames::BankMuamalat - | common_enums::enums::BankNames::BankRakyat - | common_enums::enums::BankNames::BankSimpananNasional - | common_enums::enums::BankNames::Barclays - | common_enums::enums::BankNames::BlikPSP - | common_enums::enums::BankNames::CapitalOne - | common_enums::enums::BankNames::Chase - | common_enums::enums::BankNames::Citi - | common_enums::enums::BankNames::CimbBank - | common_enums::enums::BankNames::Discover - | common_enums::enums::BankNames::NavyFederalCreditUnion - | common_enums::enums::BankNames::PentagonFederalCreditUnion - | common_enums::enums::BankNames::SynchronyBank - | common_enums::enums::BankNames::WellsFargo - | common_enums::enums::BankNames::Handelsbanken - | common_enums::enums::BankNames::HongLeongBank - | common_enums::enums::BankNames::HsbcBank - | common_enums::enums::BankNames::KuwaitFinanceHouse - | common_enums::enums::BankNames::Regiobank - | common_enums::enums::BankNames::Revolut - | common_enums::enums::BankNames::ArzteUndApothekerBank - | common_enums::enums::BankNames::AustrianAnadiBankAg - | common_enums::enums::BankNames::BankAustria - | common_enums::enums::BankNames::Bank99Ag - | common_enums::enums::BankNames::BankhausCarlSpangler - | common_enums::enums::BankNames::BankhausSchelhammerUndSchatteraAg - | common_enums::enums::BankNames::BankMillennium - | common_enums::enums::BankNames::BankPEKAOSA - | common_enums::enums::BankNames::BawagPskAg - | common_enums::enums::BankNames::BksBankAg - | common_enums::enums::BankNames::BrullKallmusBankAg - | common_enums::enums::BankNames::BtvVierLanderBank - | common_enums::enums::BankNames::CapitalBankGraweGruppeAg - | common_enums::enums::BankNames::CeskaSporitelna - | common_enums::enums::BankNames::Dolomitenbank - | common_enums::enums::BankNames::EasybankAg - | common_enums::enums::BankNames::EPlatbyVUB - | common_enums::enums::BankNames::ErsteBankUndSparkassen - | common_enums::enums::BankNames::FrieslandBank - | common_enums::enums::BankNames::HypoAlpeadriabankInternationalAg - | common_enums::enums::BankNames::HypoNoeLbFurNiederosterreichUWien - | common_enums::enums::BankNames::HypoOberosterreichSalzburgSteiermark - | common_enums::enums::BankNames::HypoTirolBankAg - | common_enums::enums::BankNames::HypoVorarlbergBankAg - | common_enums::enums::BankNames::HypoBankBurgenlandAktiengesellschaft - | common_enums::enums::BankNames::KomercniBanka - | common_enums::enums::BankNames::MBank - | common_enums::enums::BankNames::MarchfelderBank - | common_enums::enums::BankNames::Maybank - | common_enums::enums::BankNames::OberbankAg - | common_enums::enums::BankNames::OsterreichischeArzteUndApothekerbank - | common_enums::enums::BankNames::OcbcBank - | common_enums::enums::BankNames::PayWithING - | common_enums::enums::BankNames::PlaceZIPKO - | common_enums::enums::BankNames::PlatnoscOnlineKartaPlatnicza - | common_enums::enums::BankNames::PosojilnicaBankEGen - | common_enums::enums::BankNames::PostovaBanka - | common_enums::enums::BankNames::PublicBank - | common_enums::enums::BankNames::RaiffeisenBankengruppeOsterreich - | common_enums::enums::BankNames::RhbBank - | common_enums::enums::BankNames::SchelhammerCapitalBankAg - | common_enums::enums::BankNames::StandardCharteredBank - | common_enums::enums::BankNames::SchoellerbankAg - | common_enums::enums::BankNames::SpardaBankWien - | common_enums::enums::BankNames::SporoPay - | common_enums::enums::BankNames::SantanderPrzelew24 - | common_enums::enums::BankNames::TatraPay - | common_enums::enums::BankNames::Viamo - | common_enums::enums::BankNames::VolksbankGruppe - | common_enums::enums::BankNames::VolkskreditbankAg - | common_enums::enums::BankNames::VrBankBraunau - | common_enums::enums::BankNames::UobBank - | common_enums::enums::BankNames::PayWithAliorBank - | common_enums::enums::BankNames::BankiSpoldzielcze - | common_enums::enums::BankNames::PayWithInteligo - | common_enums::enums::BankNames::BNPParibasPoland - | common_enums::enums::BankNames::BankNowySA - | common_enums::enums::BankNames::CreditAgricole - | common_enums::enums::BankNames::PayWithBOS - | common_enums::enums::BankNames::PayWithCitiHandlowy - | common_enums::enums::BankNames::PayWithPlusBank - | common_enums::enums::BankNames::ToyotaBank - | common_enums::enums::BankNames::VeloBank - | common_enums::enums::BankNames::ETransferPocztowy24 - | common_enums::enums::BankNames::PlusBank - | common_enums::enums::BankNames::EtransferPocztowy24 - | common_enums::enums::BankNames::BankiSpbdzielcze - | common_enums::enums::BankNames::BankNowyBfgSa - | common_enums::enums::BankNames::GetinBank - | common_enums::enums::BankNames::Blik - | common_enums::enums::BankNames::NoblePay - | common_enums::enums::BankNames::IdeaBank - | common_enums::enums::BankNames::EnveloBank - | common_enums::enums::BankNames::NestPrzelew - | common_enums::enums::BankNames::MbankMtransfer - | common_enums::enums::BankNames::Inteligo - | common_enums::enums::BankNames::PbacZIpko - | common_enums::enums::BankNames::BnpParibas - | common_enums::enums::BankNames::BankPekaoSa - | common_enums::enums::BankNames::VolkswagenBank - | common_enums::enums::BankNames::AliorBank - | common_enums::enums::BankNames::Boz - | common_enums::enums::BankNames::BangkokBank - | common_enums::enums::BankNames::KrungsriBank - | common_enums::enums::BankNames::KrungThaiBank - | common_enums::enums::BankNames::TheSiamCommercialBank - | common_enums::enums::BankNames::KasikornBank - | common_enums::enums::BankNames::OpenBankSuccess - | common_enums::enums::BankNames::OpenBankFailure - | common_enums::enums::BankNames::OpenBankCancelled - | common_enums::enums::BankNames::Aib - | common_enums::enums::BankNames::BankOfScotland - | common_enums::enums::BankNames::DanskeBank - | common_enums::enums::BankNames::FirstDirect - | common_enums::enums::BankNames::FirstTrust - | common_enums::enums::BankNames::Halifax - | common_enums::enums::BankNames::Lloyds - | common_enums::enums::BankNames::Monzo - | common_enums::enums::BankNames::NatWest - | common_enums::enums::BankNames::NationwideBank - | common_enums::enums::BankNames::RoyalBankOfScotland - | common_enums::enums::BankNames::Starling - | common_enums::enums::BankNames::TsbBank - | common_enums::enums::BankNames::TescoBank - | common_enums::enums::BankNames::Yoursafe - | common_enums::enums::BankNames::N26 - | common_enums::enums::BankNames::NationaleNederlanden - | common_enums::enums::BankNames::UlsterBank => { + api_models::enums::BankNames::AbnAmro => Ok(Self::Abnamro), + api_models::enums::BankNames::AsnBank => Ok(Self::ASNBank), + api_models::enums::BankNames::Bunq => Ok(Self::Bunq), + api_models::enums::BankNames::Ing => Ok(Self::Ing), + api_models::enums::BankNames::Knab => Ok(Self::Knab), + api_models::enums::BankNames::Rabobank => Ok(Self::Rabobank), + api_models::enums::BankNames::SnsBank => Ok(Self::SNSBank), + api_models::enums::BankNames::TriodosBank => Ok(Self::TriodosBank), + api_models::enums::BankNames::VanLanschot => Ok(Self::VanLanschotBankiers), + api_models::enums::BankNames::Moneyou => Ok(Self::Moneyou), + + api_models::enums::BankNames::AmericanExpress + | api_models::enums::BankNames::AffinBank + | api_models::enums::BankNames::AgroBank + | api_models::enums::BankNames::AllianceBank + | api_models::enums::BankNames::AmBank + | api_models::enums::BankNames::BankOfAmerica + | api_models::enums::BankNames::BankIslam + | api_models::enums::BankNames::BankMuamalat + | api_models::enums::BankNames::BankRakyat + | api_models::enums::BankNames::BankSimpananNasional + | api_models::enums::BankNames::Barclays + | api_models::enums::BankNames::BlikPSP + | api_models::enums::BankNames::CapitalOne + | api_models::enums::BankNames::Chase + | api_models::enums::BankNames::Citi + | api_models::enums::BankNames::CimbBank + | api_models::enums::BankNames::Discover + | api_models::enums::BankNames::NavyFederalCreditUnion + | api_models::enums::BankNames::PentagonFederalCreditUnion + | api_models::enums::BankNames::SynchronyBank + | api_models::enums::BankNames::WellsFargo + | api_models::enums::BankNames::Handelsbanken + | api_models::enums::BankNames::HongLeongBank + | api_models::enums::BankNames::HsbcBank + | api_models::enums::BankNames::KuwaitFinanceHouse + | api_models::enums::BankNames::Regiobank + | api_models::enums::BankNames::Revolut + | api_models::enums::BankNames::ArzteUndApothekerBank + | api_models::enums::BankNames::AustrianAnadiBankAg + | api_models::enums::BankNames::BankAustria + | api_models::enums::BankNames::Bank99Ag + | api_models::enums::BankNames::BankhausCarlSpangler + | api_models::enums::BankNames::BankhausSchelhammerUndSchatteraAg + | api_models::enums::BankNames::BankMillennium + | api_models::enums::BankNames::BankPEKAOSA + | api_models::enums::BankNames::BawagPskAg + | api_models::enums::BankNames::BksBankAg + | api_models::enums::BankNames::BrullKallmusBankAg + | api_models::enums::BankNames::BtvVierLanderBank + | api_models::enums::BankNames::CapitalBankGraweGruppeAg + | api_models::enums::BankNames::CeskaSporitelna + | api_models::enums::BankNames::Dolomitenbank + | api_models::enums::BankNames::EasybankAg + | api_models::enums::BankNames::EPlatbyVUB + | api_models::enums::BankNames::ErsteBankUndSparkassen + | api_models::enums::BankNames::FrieslandBank + | api_models::enums::BankNames::HypoAlpeadriabankInternationalAg + | api_models::enums::BankNames::HypoNoeLbFurNiederosterreichUWien + | api_models::enums::BankNames::HypoOberosterreichSalzburgSteiermark + | api_models::enums::BankNames::HypoTirolBankAg + | api_models::enums::BankNames::HypoVorarlbergBankAg + | api_models::enums::BankNames::HypoBankBurgenlandAktiengesellschaft + | api_models::enums::BankNames::KomercniBanka + | api_models::enums::BankNames::MBank + | api_models::enums::BankNames::MarchfelderBank + | api_models::enums::BankNames::Maybank + | api_models::enums::BankNames::OberbankAg + | api_models::enums::BankNames::OsterreichischeArzteUndApothekerbank + | api_models::enums::BankNames::OcbcBank + | api_models::enums::BankNames::PayWithING + | api_models::enums::BankNames::PlaceZIPKO + | api_models::enums::BankNames::PlatnoscOnlineKartaPlatnicza + | api_models::enums::BankNames::PosojilnicaBankEGen + | api_models::enums::BankNames::PostovaBanka + | api_models::enums::BankNames::PublicBank + | api_models::enums::BankNames::RaiffeisenBankengruppeOsterreich + | api_models::enums::BankNames::RhbBank + | api_models::enums::BankNames::SchelhammerCapitalBankAg + | api_models::enums::BankNames::StandardCharteredBank + | api_models::enums::BankNames::SchoellerbankAg + | api_models::enums::BankNames::SpardaBankWien + | api_models::enums::BankNames::SporoPay + | api_models::enums::BankNames::SantanderPrzelew24 + | api_models::enums::BankNames::TatraPay + | api_models::enums::BankNames::Viamo + | api_models::enums::BankNames::VolksbankGruppe + | api_models::enums::BankNames::VolkskreditbankAg + | api_models::enums::BankNames::VrBankBraunau + | api_models::enums::BankNames::UobBank + | api_models::enums::BankNames::PayWithAliorBank + | api_models::enums::BankNames::BankiSpoldzielcze + | api_models::enums::BankNames::PayWithInteligo + | api_models::enums::BankNames::BNPParibasPoland + | api_models::enums::BankNames::BankNowySA + | api_models::enums::BankNames::CreditAgricole + | api_models::enums::BankNames::PayWithBOS + | api_models::enums::BankNames::PayWithCitiHandlowy + | api_models::enums::BankNames::PayWithPlusBank + | api_models::enums::BankNames::ToyotaBank + | api_models::enums::BankNames::VeloBank + | api_models::enums::BankNames::ETransferPocztowy24 + | api_models::enums::BankNames::PlusBank + | api_models::enums::BankNames::EtransferPocztowy24 + | api_models::enums::BankNames::BankiSpbdzielcze + | api_models::enums::BankNames::BankNowyBfgSa + | api_models::enums::BankNames::GetinBank + | api_models::enums::BankNames::Blik + | api_models::enums::BankNames::NoblePay + | api_models::enums::BankNames::IdeaBank + | api_models::enums::BankNames::EnveloBank + | api_models::enums::BankNames::NestPrzelew + | api_models::enums::BankNames::MbankMtransfer + | api_models::enums::BankNames::Inteligo + | api_models::enums::BankNames::PbacZIpko + | api_models::enums::BankNames::BnpParibas + | api_models::enums::BankNames::BankPekaoSa + | api_models::enums::BankNames::VolkswagenBank + | api_models::enums::BankNames::AliorBank + | api_models::enums::BankNames::Boz + | api_models::enums::BankNames::BangkokBank + | api_models::enums::BankNames::KrungsriBank + | api_models::enums::BankNames::KrungThaiBank + | api_models::enums::BankNames::TheSiamCommercialBank + | api_models::enums::BankNames::KasikornBank + | api_models::enums::BankNames::OpenBankSuccess + | api_models::enums::BankNames::OpenBankFailure + | api_models::enums::BankNames::OpenBankCancelled + | api_models::enums::BankNames::Aib + | api_models::enums::BankNames::BankOfScotland + | api_models::enums::BankNames::DanskeBank + | api_models::enums::BankNames::FirstDirect + | api_models::enums::BankNames::FirstTrust + | api_models::enums::BankNames::Halifax + | api_models::enums::BankNames::Lloyds + | api_models::enums::BankNames::Monzo + | api_models::enums::BankNames::NatWest + | api_models::enums::BankNames::NationwideBank + | api_models::enums::BankNames::RoyalBankOfScotland + | api_models::enums::BankNames::Starling + | api_models::enums::BankNames::TsbBank + | api_models::enums::BankNames::TescoBank + | api_models::enums::BankNames::Yoursafe + | api_models::enums::BankNames::N26 + | api_models::enums::BankNames::NationaleNederlanden + | api_models::enums::BankNames::UlsterBank => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Nuvei"), ))? @@ -631,7 +630,7 @@ impl TryFrom for NuveiBIC { impl ForeignTryFrom<( AlternativePaymentMethodType, - Option, + Option, &types::RouterData, )> for NuveiPaymentsRequest { @@ -639,7 +638,7 @@ impl fn foreign_try_from( data: ( AlternativePaymentMethodType, - Option, + Option, &types::RouterData, ), ) -> Result { @@ -663,11 +662,10 @@ impl ), (AlternativePaymentMethodType::Sofort, _) | (AlternativePaymentMethodType::Eps, _) => { let address = item.get_billing_address()?; - let first_name = address.get_first_name()?; ( Some(BillingAddress { - first_name: Some(first_name.clone()), - last_name: Some(address.get_last_name().unwrap_or(first_name).clone()), + first_name: Some(address.get_first_name()?.clone()), + last_name: Some(address.get_last_name()?.clone()), email: item.request.get_email()?, country: item.get_billing_country()?, }), @@ -676,16 +674,13 @@ impl } ( AlternativePaymentMethodType::Ideal, - Some(domain::BankRedirectData::Ideal { bank_name, .. }), + Some(payments::BankRedirectData::Ideal { bank_name, .. }), ) => { let address = item.get_billing_address()?; - let first_name = address.get_first_name()?.clone(); ( Some(BillingAddress { - first_name: Some(first_name.clone()), - last_name: Some( - address.get_last_name().ok().unwrap_or(&first_name).clone(), - ), + first_name: Some(address.get_first_name()?.clone()), + last_name: Some(address.get_last_name()?.clone()), email: item.request.get_email()?, country: item.get_billing_country()?, }), @@ -719,7 +714,6 @@ fn get_pay_later_info( .address .as_ref() .ok_or_else(utils::missing_field_err("billing.address"))?; - let first_name = address.get_first_name()?; let payment_method = payment_method_type; Ok(NuveiPaymentsRequest { payment_option: PaymentOption { @@ -729,8 +723,8 @@ fn get_pay_later_info( }), billing_address: Some(BillingAddress { email: item.request.get_email()?, - first_name: Some(first_name.clone()), - last_name: Some(address.get_last_name().unwrap_or(first_name).clone()), + first_name: Some(address.get_first_name()?.to_owned()), + last_name: Some(address.get_last_name()?.to_owned()), country: address.get_country()?.to_owned(), }), ..Default::default() @@ -754,113 +748,113 @@ impl ) -> Result { let item = data.0; let request_data = match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(card) => get_card_info(item, &card), - domain::PaymentMethodData::MandatePayment => Self::try_from(item), - domain::PaymentMethodData::Wallet(wallet) => match wallet { - domain::WalletData::GooglePay(gpay_data) => Self::try_from(gpay_data), - domain::WalletData::ApplePay(apple_pay_data) => Ok(Self::from(apple_pay_data)), - domain::WalletData::PaypalRedirect(_) => Self::foreign_try_from(( + api::PaymentMethodData::Card(card) => get_card_info(item, &card), + api::PaymentMethodData::MandatePayment => Self::try_from(item), + api::PaymentMethodData::Wallet(wallet) => match wallet { + payments::WalletData::GooglePay(gpay_data) => Self::try_from(gpay_data), + payments::WalletData::ApplePay(apple_pay_data) => Ok(Self::from(apple_pay_data)), + payments::WalletData::PaypalRedirect(_) => Self::foreign_try_from(( AlternativePaymentMethodType::Expresscheckout, None, item, )), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::WeChatPayQr(_) => { + payments::WalletData::AliPayQr(_) + | payments::WalletData::AliPayRedirect(_) + | payments::WalletData::AliPayHkRedirect(_) + | payments::WalletData::MomoRedirect(_) + | payments::WalletData::KakaoPayRedirect(_) + | payments::WalletData::GoPayRedirect(_) + | payments::WalletData::GcashRedirect(_) + | payments::WalletData::ApplePayRedirect(_) + | payments::WalletData::ApplePayThirdPartySdk(_) + | payments::WalletData::DanaRedirect {} + | payments::WalletData::GooglePayRedirect(_) + | payments::WalletData::GooglePayThirdPartySdk(_) + | payments::WalletData::MbWayRedirect(_) + | payments::WalletData::MobilePayRedirect(_) + | payments::WalletData::PaypalSdk(_) + | payments::WalletData::SamsungPay(_) + | payments::WalletData::TwintRedirect {} + | payments::WalletData::VippsRedirect {} + | payments::WalletData::TouchNGoRedirect(_) + | payments::WalletData::WeChatPayRedirect(_) + | payments::WalletData::CashappQr(_) + | payments::WalletData::SwishQr(_) + | payments::WalletData::WeChatPayQr(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nuvei"), ) .into()) } }, - domain::PaymentMethodData::BankRedirect(redirect) => match redirect { - domain::BankRedirectData::Eps { .. } => Self::foreign_try_from(( + api::PaymentMethodData::BankRedirect(redirect) => match redirect { + payments::BankRedirectData::Eps { .. } => Self::foreign_try_from(( AlternativePaymentMethodType::Eps, Some(redirect), item, )), - domain::BankRedirectData::Giropay { .. } => Self::foreign_try_from(( + payments::BankRedirectData::Giropay { .. } => Self::foreign_try_from(( AlternativePaymentMethodType::Giropay, Some(redirect), item, )), - domain::BankRedirectData::Ideal { .. } => Self::foreign_try_from(( + payments::BankRedirectData::Ideal { .. } => Self::foreign_try_from(( AlternativePaymentMethodType::Ideal, Some(redirect), item, )), - domain::BankRedirectData::Sofort { .. } => Self::foreign_try_from(( + payments::BankRedirectData::Sofort { .. } => Self::foreign_try_from(( AlternativePaymentMethodType::Sofort, Some(redirect), item, )), - domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::Przelewy24 { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } - | domain::BankRedirectData::OpenBankingUk { .. } => { + payments::BankRedirectData::BancontactCard { .. } + | payments::BankRedirectData::Bizum {} + | payments::BankRedirectData::Blik { .. } + | payments::BankRedirectData::Interac { .. } + | payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | payments::BankRedirectData::OnlineBankingFinland { .. } + | payments::BankRedirectData::OnlineBankingPoland { .. } + | payments::BankRedirectData::OnlineBankingSlovakia { .. } + | payments::BankRedirectData::Przelewy24 { .. } + | payments::BankRedirectData::Trustly { .. } + | payments::BankRedirectData::OnlineBankingFpx { .. } + | payments::BankRedirectData::OnlineBankingThailand { .. } + | payments::BankRedirectData::OpenBankingUk { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nuvei"), ) .into()) } }, - domain::PaymentMethodData::PayLater(pay_later_data) => match pay_later_data { - domain::PayLaterData::KlarnaRedirect { .. } => { + api::PaymentMethodData::PayLater(pay_later_data) => match pay_later_data { + payments::PayLaterData::KlarnaRedirect { .. } => { get_pay_later_info(AlternativePaymentMethodType::Klarna, item) } - domain::PayLaterData::AfterpayClearpayRedirect { .. } => { + payments::PayLaterData::AfterpayClearpayRedirect { .. } => { get_pay_later_info(AlternativePaymentMethodType::AfterPay, item) } - domain::PayLaterData::KlarnaSdk { .. } - | domain::PayLaterData::AffirmRedirect {} - | domain::PayLaterData::PayBrightRedirect {} - | domain::PayLaterData::WalleyRedirect {} - | domain::PayLaterData::AlmaRedirect {} - | domain::PayLaterData::AtomeRedirect {} => { + payments::PayLaterData::KlarnaSdk { .. } + | payments::PayLaterData::AffirmRedirect {} + | payments::PayLaterData::PayBrightRedirect {} + | payments::PayLaterData::WalleyRedirect {} + | payments::PayLaterData::AlmaRedirect {} + | payments::PayLaterData::AtomeRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nuvei"), ) .into()) } }, - domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nuvei"), ) @@ -896,7 +890,7 @@ impl fn get_card_info( item: &types::RouterData, - card_details: &domain::Card, + card_details: &payments::Card, ) -> Result> { let browser_information = item.request.browser_info.clone(); let related_transaction_id = if item.is_three_ds() { @@ -910,15 +904,12 @@ fn get_card_info( .and_then(|billing_details| billing_details.address.as_ref()); let billing_address = match address { - Some(address) => { - let first_name = address.get_first_name()?.clone(); - Some(BillingAddress { - first_name: Some(first_name.clone()), - last_name: Some(address.get_last_name().ok().unwrap_or(&first_name).clone()), - email: item.request.get_email()?, - country: item.get_billing_country()?, - }) - } + Some(address) => Some(BillingAddress { + first_name: Some(address.get_first_name()?.clone()), + last_name: Some(address.get_last_name()?.clone()), + email: item.request.get_email()?, + country: item.get_billing_country()?, + }), None => None, }; let (is_rebilling, additional_params, user_token_id) = @@ -1003,7 +994,6 @@ fn get_card_info( payment_option: PaymentOption::from(NuveiCardDetails { card: card_details.clone(), three_d, - card_holder_name: item.get_optional_billing_full_name(), }), billing_address, ..Default::default() @@ -1015,7 +1005,7 @@ impl From for PaymentOption { Self { card: Some(Card { card_number: Some(card.card_number), - card_holder_name: card_details.card_holder_name, + card_holder_name: card.card_holder_name, expiration_month: Some(card.card_exp_month), expiration_year: Some(card.card_exp_year), three_d: card_details.three_d, @@ -1036,27 +1026,26 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret)> ) -> Result { let item = data.0; let request_data = match item.request.payment_method_data.clone() { - Some(domain::PaymentMethodData::Card(card)) => Ok(Self { + Some(api::PaymentMethodData::Card(card)) => Ok(Self { payment_option: PaymentOption::from(NuveiCardDetails { card, three_d: None, - card_holder_name: item.get_optional_billing_full_name(), }), ..Default::default() }), - Some(domain::PaymentMethodData::Wallet(..)) - | Some(domain::PaymentMethodData::PayLater(..)) - | Some(domain::PaymentMethodData::BankDebit(..)) - | Some(domain::PaymentMethodData::BankRedirect(..)) - | Some(domain::PaymentMethodData::BankTransfer(..)) - | Some(domain::PaymentMethodData::Crypto(..)) - | Some(domain::PaymentMethodData::MandatePayment) - | Some(domain::PaymentMethodData::GiftCard(..)) - | Some(domain::PaymentMethodData::Voucher(..)) - | Some(domain::PaymentMethodData::CardRedirect(..)) - | Some(domain::PaymentMethodData::Reward) - | Some(domain::PaymentMethodData::Upi(..)) - | Some(domain::PaymentMethodData::CardToken(..)) + Some(api::PaymentMethodData::Wallet(..)) + | Some(api::PaymentMethodData::PayLater(..)) + | Some(api::PaymentMethodData::BankDebit(..)) + | Some(api::PaymentMethodData::BankRedirect(..)) + | Some(api::PaymentMethodData::BankTransfer(..)) + | Some(api::PaymentMethodData::Crypto(..)) + | Some(api::PaymentMethodData::MandatePayment) + | Some(api::PaymentMethodData::GiftCard(..)) + | Some(api::PaymentMethodData::Voucher(..)) + | Some(api::PaymentMethodData::CardRedirect(..)) + | Some(api::PaymentMethodData::Reward) + | Some(api::PaymentMethodData::Upi(..)) + | Some(api::PaymentMethodData::CardToken(..)) | None => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nuvei"), )), diff --git a/crates/router/src/connector/opayo/transformers.rs b/crates/router/src/connector/opayo/transformers.rs index e00f9a331a1..94ab62b4f7f 100644 --- a/crates/router/src/connector/opayo/transformers.rs +++ b/crates/router/src/connector/opayo/transformers.rs @@ -2,9 +2,9 @@ use masking::Secret; use serde::{Deserialize, Serialize}; use crate::{ - connector::utils::{self, PaymentsAuthorizeRequestData, RouterData}, + connector::utils::{self, PaymentsAuthorizeRequestData}, core::errors, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; #[derive(Default, Debug, Serialize, Eq, PartialEq)] @@ -27,10 +27,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for OpayoPaymentsRequest { type Error = error_stack::Report; fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(req_card) => { + api::PaymentMethodData::Card(req_card) => { let card = OpayoCard { - name: item - .get_optional_billing_full_name() + name: req_card + .card_holder_name .unwrap_or(Secret::new("".to_string())), number: req_card.card_number, expiry_month: req_card.card_exp_month, @@ -43,24 +43,22 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for OpayoPaymentsRequest { card, }) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Opayo"), - ) - .into()) - } + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Opayo"), + ) + .into()), } } } diff --git a/crates/router/src/connector/payeezy/transformers.rs b/crates/router/src/connector/payeezy/transformers.rs index 0ceed1390be..6d5d6db9dcf 100644 --- a/crates/router/src/connector/payeezy/transformers.rs +++ b/crates/router/src/connector/payeezy/transformers.rs @@ -5,9 +5,9 @@ use masking::{ExposeInterface, Secret}; use serde::{Deserialize, Serialize}; use crate::{ - connector::utils::{self, CardData, RouterData}, + connector::utils::{self, CardData}, core::errors, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, + types::{self, api, storage::enums, transformers::ForeignFrom}, }; #[derive(Debug, Serialize)] pub struct PayeezyRouterData { @@ -237,13 +237,13 @@ fn get_payment_method_data( item: &PayeezyRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result> { match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref card) => { + api::PaymentMethodData::Card(ref card) => { let card_type = PayeezyCardType::try_from(card.get_card_issuer()?)?; let payeezy_card = PayeezyCard { card_type, - cardholder_name: item - .router_data - .get_optional_billing_full_name() + cardholder_name: card + .card_holder_name + .clone() .unwrap_or(Secret::new("".to_string())), card_number: card.card_number.clone(), exp_date: card.get_card_expiry_month_year_2_digit_with_delimiter("".to_string())?, @@ -252,19 +252,19 @@ fn get_payment_method_data( Ok(PayeezyPaymentMethod::PayeezyCard(payeezy_card)) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Payeezy"), ))?, } diff --git a/crates/router/src/connector/payme.rs b/crates/router/src/connector/payme.rs index b384b938cda..042b506b306 100644 --- a/crates/router/src/connector/payme.rs +++ b/crates/router/src/connector/payme.rs @@ -381,9 +381,7 @@ impl services::ConnectorRedirectResponse for Payme { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs index 7f5e30402d6..b577ae9f20a 100644 --- a/crates/router/src/connector/payme/transformers.rs +++ b/crates/router/src/connector/payme/transformers.rs @@ -1,6 +1,9 @@ use std::collections::HashMap; -use api_models::enums::{AuthenticationType, PaymentMethod}; +use api_models::{ + enums::{AuthenticationType, PaymentMethod}, + payments::PaymentMethodData, +}; use common_utils::pii; use error_stack::ResultExt; use masking::{ExposeInterface, Secret}; @@ -17,7 +20,7 @@ use crate::{ consts, core::errors, services, - types::{self, api, domain, domain::PaymentMethodData, storage::enums, MandateReference}, + types::{self, api, storage::enums, MandateReference}, unimplemented_payment_method, }; @@ -385,36 +388,38 @@ impl TryFrom<&PaymentMethodData> for SalePaymentMethod { match item { PaymentMethodData::Card(_) => Ok(Self::CreditCard), PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::ApplePayThirdPartySdk(_) => Ok(Self::ApplePay), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePay(_) - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotSupported { - message: "Wallet".to_string(), - connector: "payme", + api_models::payments::WalletData::ApplePayThirdPartySdk(_) => Ok(Self::ApplePay), + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePay(_) + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::ApplePay(_) + | api_models::payments::WalletData::SwishQr(_) => { + Err(errors::ConnectorError::NotSupported { + message: "Wallet".to_string(), + connector: "payme", + } + .into()) } - .into()), }, PaymentMethodData::PayLater(_) | PaymentMethodData::BankRedirect(_) @@ -538,21 +543,26 @@ impl } _ => { let currency_code = item.data.request.get_currency()?; + let country_code = item + .data + .get_optional_billing() + .and_then(|billing| billing.address.as_ref()) + .and_then(|address| address.country); let amount = item.data.request.get_amount()?; let amount_in_base_unit = utils::to_currency_base_unit(amount, currency_code)?; let pmd = item.data.request.payment_method_data.to_owned(); let payme_auth_type = PaymeAuthType::try_from(&item.data.connector_auth_type)?; let session_token = match pmd { - Some(PaymentMethodData::Wallet(domain::WalletData::ApplePayThirdPartySdk( - _, - ))) => Some(api_models::payments::SessionToken::ApplePay(Box::new( + Some(PaymentMethodData::Wallet( + api_models::payments::WalletData::ApplePayThirdPartySdk(_), + )) => Some(api_models::payments::SessionToken::ApplePay(Box::new( api_models::payments::ApplepaySessionTokenResponse { session_token_data: api_models::payments::ApplePaySessionResponse::NoSessionResponse, payment_request_data: Some( api_models::payments::ApplePayPaymentRequest { - country_code: item.data.get_billing_country()?, + country_code, currency_code, total: api_models::payments::AmountInfo { label: "Apple Pay".to_string(), @@ -630,7 +640,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayRequest { type Error = error_stack::Report; fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(req_card) => { + api::PaymentMethodData::Card(req_card) => { let card = PaymeCard { credit_card_cvv: req_card.card_cvc.clone(), credit_card_exp: req_card @@ -652,23 +662,21 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayRequest { language: LANGUAGE.to_string(), }) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("payme"), - ))? - } + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("payme"), + ))?, } } } @@ -681,7 +689,7 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for Pay3dsRequest { type Error = error_stack::Report; fn try_from(item: &types::PaymentsCompleteAuthorizeRouterData) -> Result { match item.request.payment_method_data.clone() { - Some(domain::PaymentMethodData::Card(_)) => { + Some(api::PaymentMethodData::Card(_)) => { let buyer_email = item.request.get_email()?; let buyer_name = item.get_billing_address()?.get_full_name()?; @@ -712,19 +720,19 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for Pay3dsRequest { meta_data_jwt: Secret::new(jwt_data.meta_data), }) } - Some(domain::PaymentMethodData::CardRedirect(_)) - | Some(domain::PaymentMethodData::Wallet(_)) - | Some(domain::PaymentMethodData::PayLater(_)) - | Some(domain::PaymentMethodData::BankRedirect(_)) - | Some(domain::PaymentMethodData::BankDebit(_)) - | Some(domain::PaymentMethodData::BankTransfer(_)) - | Some(domain::PaymentMethodData::Crypto(_)) - | Some(domain::PaymentMethodData::MandatePayment) - | Some(domain::PaymentMethodData::Reward) - | Some(domain::PaymentMethodData::Upi(_)) - | Some(domain::PaymentMethodData::Voucher(_)) - | Some(domain::PaymentMethodData::GiftCard(_)) - | Some(domain::PaymentMethodData::CardToken(_)) + Some(api::PaymentMethodData::CardRedirect(_)) + | Some(api::PaymentMethodData::Wallet(_)) + | Some(api::PaymentMethodData::PayLater(_)) + | Some(api::PaymentMethodData::BankRedirect(_)) + | Some(api::PaymentMethodData::BankDebit(_)) + | Some(api::PaymentMethodData::BankTransfer(_)) + | Some(api::PaymentMethodData::Crypto(_)) + | Some(api::PaymentMethodData::MandatePayment) + | Some(api::PaymentMethodData::Reward) + | Some(api::PaymentMethodData::Upi(_)) + | Some(api::PaymentMethodData::Voucher(_)) + | Some(api::PaymentMethodData::GiftCard(_)) + | Some(api::PaymentMethodData::CardToken(_)) | None => { Err(errors::ConnectorError::NotImplemented("Tokenize Flow".to_string()).into()) } @@ -736,7 +744,7 @@ impl TryFrom<&types::TokenizationRouterData> for CaptureBuyerRequest { type Error = error_stack::Report; fn try_from(item: &types::TokenizationRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(req_card) => { + api::PaymentMethodData::Card(req_card) => { let seller_payme_id = PaymeAuthType::try_from(&item.connector_auth_type)?.seller_payme_id; let card = PaymeCard { @@ -750,19 +758,19 @@ impl TryFrom<&types::TokenizationRouterData> for CaptureBuyerRequest { seller_payme_id, }) } - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented("Tokenize Flow".to_string()).into()) } } diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rs index 63912391787..69bf3f72493 100644 --- a/crates/router/src/connector/paypal.rs +++ b/crates/router/src/connector/paypal.rs @@ -6,8 +6,6 @@ use common_utils::{ext_traits::ByteSliceExt, request::RequestContent}; use diesel_models::enums; use error_stack::ResultExt; use masking::{ExposeInterface, PeekInterface, Secret}; -#[cfg(feature = "payouts")] -use router_env::{instrument, tracing}; use transformers as paypal; use self::transformers::{auth_headers, PaypalAuthResponse, PaypalMeta, PaypalWebhookEventType}; @@ -58,12 +56,6 @@ impl api::RefundExecute for Paypal {} impl api::RefundSync for Paypal {} impl api::ConnectorVerifyWebhookSource for Paypal {} -impl api::Payouts for Paypal {} -#[cfg(feature = "payouts")] -impl api::PayoutCreate for Paypal {} -#[cfg(feature = "payouts")] -impl api::PayoutFulfill for Paypal {} - impl Paypal { pub fn get_order_error_response( &self, @@ -433,110 +425,6 @@ impl ConnectorIntegration - for Paypal -{ - fn get_url( - &self, - _req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - Ok(format!("{}v1/payments/payouts", self.base_url(connectors))) - } - - fn get_headers( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_request_body( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_router_data = paypal::PaypalRouterData::try_from(( - &self.get_currency_unit(), - req.request.destination_currency, - req.request.amount, - req, - ))?; - let connector_req = paypal::PaypalFulfillRequest::try_from(&connector_router_data)?; - Ok(RequestContent::Json(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PayoutFulfillType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::PayoutFulfillType::get_headers( - self, req, connectors, - )?) - .set_body(types::PayoutFulfillType::get_request_body( - self, req, connectors, - )?) - .build(); - - Ok(Some(request)) - } - - #[instrument(skip_all)] - fn handle_response( - &self, - data: &types::PayoutsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult, errors::ConnectorError> { - let response: paypal::PaypalFulfillResponse = res - .response - .parse_struct("PaypalFulfillResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -#[async_trait::async_trait] -#[cfg(feature = "payouts")] -impl ConnectorIntegration - for Paypal -{ - fn build_request( - &self, - _req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - // Eligibility check for wallet is not implemented - Err( - errors::ConnectorError::NotImplemented("Payout Eligibility for Paypal".to_string()) - .into(), - ) - } -} - impl ConnectorIntegration< api::SetupMandate, @@ -765,18 +653,18 @@ impl .clone(), ) { ( - Some(paypal::EnrollmentStatus::Ready), + Some(paypal::EnrollementStatus::Ready), Some(paypal::AuthenticationStatus::Success), paypal::LiabilityShift::Possible, ) | ( - Some(paypal::EnrollmentStatus::Ready), + Some(paypal::EnrollementStatus::Ready), Some(paypal::AuthenticationStatus::Attempted), paypal::LiabilityShift::Possible, ) - | (Some(paypal::EnrollmentStatus::NotReady), None, paypal::LiabilityShift::No) - | (Some(paypal::EnrollmentStatus::Unavailable), None, paypal::LiabilityShift::No) - | (Some(paypal::EnrollmentStatus::Bypassed), None, paypal::LiabilityShift::No) => { + | (Some(paypal::EnrollementStatus::NotReady), None, paypal::LiabilityShift::No) + | (Some(paypal::EnrollementStatus::Unavailable), None, paypal::LiabilityShift::No) + | (Some(paypal::EnrollementStatus::Bypassed), None, paypal::LiabilityShift::No) => { Ok(types::PaymentsPreProcessingRouterData { status: storage_enums::AttemptStatus::AuthenticationSuccessful, response: Ok(types::PaymentsResponseData::TransactionResponse { @@ -810,7 +698,7 @@ impl .authentication_result .three_d_secure .enrollment_status - .unwrap_or(paypal::EnrollmentStatus::Null), + .unwrap_or(paypal::EnrollementStatus::Null), liability_response .payment_source .card @@ -826,7 +714,7 @@ impl } } // if card does not supports 3DS check for liability - paypal::PaypalPreProcessingResponse::PaypalNonLiabilityResponse(_) => { + paypal::PaypalPreProcessingResponse::PaypalNonLiablityResponse(_) => { Ok(types::PaymentsPreProcessingRouterData { status: storage_enums::AttemptStatus::AuthenticationSuccessful, response: Ok(types::PaymentsResponseData::TransactionResponse { @@ -1633,9 +1521,7 @@ impl services::ConnectorRedirectResponse for Paypal { action: PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs index 2c5dbabafe8..a109cb2d38e 100644 --- a/crates/router/src/connector/paypal/transformers.rs +++ b/crates/router/src/connector/paypal/transformers.rs @@ -1,8 +1,6 @@ -use api_models::enums; +use api_models::{enums, payments::BankRedirectData}; use base64::Engine; use common_utils::errors::CustomResult; -#[cfg(feature = "payouts")] -use common_utils::pii::Email; use error_stack::ResultExt; use masking::{ExposeInterface, Secret}; use serde::{Deserialize, Serialize}; @@ -18,8 +16,8 @@ use crate::{ core::errors, services, types::{ - self, api, domain, storage::enums as storage_enums, transformers::ForeignFrom, - ConnectorAuthType, VerifyWebhookSourceResponseData, + self, api, storage::enums as storage_enums, transformers::ForeignFrom, ConnectorAuthType, + VerifyWebhookSourceResponseData, }, }; @@ -282,10 +280,10 @@ fn get_address_info( } fn get_payment_source( item: &types::PaymentsAuthorizeRouterData, - bank_redirection_data: &domain::BankRedirectData, + bank_redirection_data: &BankRedirectData, ) -> Result> { match bank_redirection_data { - domain::BankRedirectData::Eps { + BankRedirectData::Eps { billing_details, bank_name: _, country, @@ -310,7 +308,7 @@ fn get_payment_source( user_action: Some(UserAction::PayNow), }, })), - domain::BankRedirectData::Giropay { + BankRedirectData::Giropay { billing_details, country, .. @@ -335,7 +333,7 @@ fn get_payment_source( user_action: Some(UserAction::PayNow), }, })), - domain::BankRedirectData::Ideal { + BankRedirectData::Ideal { billing_details, bank_name: _, country, @@ -360,7 +358,7 @@ fn get_payment_source( user_action: Some(UserAction::PayNow), }, })), - domain::BankRedirectData::Sofort { + BankRedirectData::Sofort { country, preferred_language: _, billing_details, @@ -385,24 +383,22 @@ fn get_payment_source( user_action: Some(UserAction::PayNow), }, })), - domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Przelewy24 { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ) - .into()) - } - domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } => { + BankRedirectData::BancontactCard { .. } + | BankRedirectData::Blik { .. } + | BankRedirectData::Przelewy24 { .. } => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Paypal"), + ) + .into()), + BankRedirectData::Bizum {} + | BankRedirectData::Interac { .. } + | BankRedirectData::OnlineBankingCzechRepublic { .. } + | BankRedirectData::OnlineBankingFinland { .. } + | BankRedirectData::OnlineBankingPoland { .. } + | BankRedirectData::OnlineBankingSlovakia { .. } + | BankRedirectData::OpenBankingUk { .. } + | BankRedirectData::Trustly { .. } + | BankRedirectData::OnlineBankingFpx { .. } + | BankRedirectData::OnlineBankingThailand { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ))? @@ -429,7 +425,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP PaypalAuthType::try_from(&item.router_data.connector_auth_type)?; let payee = get_payee(&paypal_auth); match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => { + api_models::payments::PaymentMethodData::Card(ref ccard) => { let intent = if item.router_data.request.is_auto_capture()? { PaypalPaymentIntent::Capture } else { @@ -465,9 +461,9 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP let payment_source = Some(PaymentSourceItem::Card(CardRequest { billing_address: get_address_info(item.router_data.get_optional_billing())?, expiry, - name: item - .router_data - .get_optional_billing_full_name() + name: ccard + .card_holder_name + .clone() .unwrap_or(Secret::new("".to_string())), number: Some(ccard.card_number.clone()), security_code: Some(ccard.card_cvc.clone()), @@ -480,8 +476,8 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP payment_source, }) } - domain::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data { - domain::WalletData::PaypalRedirect(_) => { + api::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data { + api_models::payments::WalletData::PaypalRedirect(_) => { let intent = if item.router_data.request.is_auto_capture()? { PaypalPaymentIntent::Capture } else { @@ -527,35 +523,37 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP payment_source, }) } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePay(_) - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ))?, + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePay(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePay(_) + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::WeChatPayQr(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Paypal"), + ))? + } }, - domain::PaymentMethodData::BankRedirect(ref bank_redirection_data) => { + api::PaymentMethodData::BankRedirect(ref bank_redirection_data) => { let intent = if item.router_data.request.is_auto_capture()? { PaypalPaymentIntent::Capture } else { @@ -588,30 +586,34 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP payment_source, }) } - domain::PaymentMethodData::CardRedirect(ref card_redirect_data) => { + api_models::payments::PaymentMethodData::CardRedirect(ref card_redirect_data) => { Self::try_from(card_redirect_data) } - domain::PaymentMethodData::PayLater(ref paylater_data) => Self::try_from(paylater_data), - domain::PaymentMethodData::BankDebit(ref bank_debit_data) => { + api_models::payments::PaymentMethodData::PayLater(ref paylater_data) => { + Self::try_from(paylater_data) + } + api_models::payments::PaymentMethodData::BankDebit(ref bank_debit_data) => { Self::try_from(bank_debit_data) } - domain::PaymentMethodData::BankTransfer(ref bank_transfer_data) => { + api_models::payments::PaymentMethodData::BankTransfer(ref bank_transfer_data) => { Self::try_from(bank_transfer_data.as_ref()) } - domain::PaymentMethodData::Voucher(ref voucher_data) => Self::try_from(voucher_data), - domain::PaymentMethodData::GiftCard(ref giftcard_data) => { + api_models::payments::PaymentMethodData::Voucher(ref voucher_data) => { + Self::try_from(voucher_data) + } + api_models::payments::PaymentMethodData::GiftCard(ref giftcard_data) => { Self::try_from(giftcard_data.as_ref()) } - domain::PaymentMethodData::MandatePayment => { + api_models::payments::PaymentMethodData::MandatePayment => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ) .into()) } - domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ) @@ -621,14 +623,14 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP } } -impl TryFrom<&domain::payments::CardRedirectData> for PaypalPaymentsRequest { +impl TryFrom<&api_models::payments::CardRedirectData> for PaypalPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::payments::CardRedirectData) -> Result { + fn try_from(value: &api_models::payments::CardRedirectData) -> Result { match value { - domain::payments::CardRedirectData::Knet {} - | domain::payments::CardRedirectData::Benefit {} - | domain::payments::CardRedirectData::MomoAtm {} - | domain::payments::CardRedirectData::CardRedirect {} => { + api_models::payments::CardRedirectData::Knet {} + | api_models::payments::CardRedirectData::Benefit {} + | api_models::payments::CardRedirectData::MomoAtm {} + | api_models::payments::CardRedirectData::CardRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ) @@ -638,18 +640,18 @@ impl TryFrom<&domain::payments::CardRedirectData> for PaypalPaymentsRequest { } } -impl TryFrom<&domain::PayLaterData> for PaypalPaymentsRequest { +impl TryFrom<&api_models::payments::PayLaterData> for PaypalPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::PayLaterData) -> Result { + fn try_from(value: &api_models::payments::PayLaterData) -> Result { match value { - domain::PayLaterData::KlarnaRedirect { .. } - | domain::PayLaterData::KlarnaSdk { .. } - | domain::PayLaterData::AffirmRedirect {} - | domain::PayLaterData::AfterpayClearpayRedirect { .. } - | domain::PayLaterData::PayBrightRedirect {} - | domain::PayLaterData::WalleyRedirect {} - | domain::PayLaterData::AlmaRedirect {} - | domain::PayLaterData::AtomeRedirect {} => { + api_models::payments::PayLaterData::KlarnaRedirect { .. } + | api_models::payments::PayLaterData::KlarnaSdk { .. } + | api_models::payments::PayLaterData::AffirmRedirect {} + | api_models::payments::PayLaterData::AfterpayClearpayRedirect { .. } + | api_models::payments::PayLaterData::PayBrightRedirect {} + | api_models::payments::PayLaterData::WalleyRedirect {} + | api_models::payments::PayLaterData::AlmaRedirect {} + | api_models::payments::PayLaterData::AtomeRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ) @@ -659,14 +661,14 @@ impl TryFrom<&domain::PayLaterData> for PaypalPaymentsRequest { } } -impl TryFrom<&domain::BankDebitData> for PaypalPaymentsRequest { +impl TryFrom<&api_models::payments::BankDebitData> for PaypalPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::BankDebitData) -> Result { + fn try_from(value: &api_models::payments::BankDebitData) -> Result { match value { - domain::BankDebitData::AchBankDebit { .. } - | domain::BankDebitData::SepaBankDebit { .. } - | domain::BankDebitData::BecsBankDebit { .. } - | domain::BankDebitData::BacsBankDebit { .. } => { + api_models::payments::BankDebitData::AchBankDebit { .. } + | api_models::payments::BankDebitData::SepaBankDebit { .. } + | api_models::payments::BankDebitData::BecsBankDebit { .. } + | api_models::payments::BankDebitData::BacsBankDebit { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ) @@ -676,24 +678,23 @@ impl TryFrom<&domain::BankDebitData> for PaypalPaymentsRequest { } } -impl TryFrom<&domain::BankTransferData> for PaypalPaymentsRequest { +impl TryFrom<&api_models::payments::BankTransferData> for PaypalPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::BankTransferData) -> Result { + fn try_from(value: &api_models::payments::BankTransferData) -> Result { match value { - domain::BankTransferData::AchBankTransfer { .. } - | domain::BankTransferData::SepaBankTransfer { .. } - | domain::BankTransferData::BacsBankTransfer { .. } - | domain::BankTransferData::MultibancoBankTransfer { .. } - | domain::BankTransferData::PermataBankTransfer { .. } - | domain::BankTransferData::BcaBankTransfer { .. } - | domain::BankTransferData::BniVaBankTransfer { .. } - | domain::BankTransferData::BriVaBankTransfer { .. } - | domain::BankTransferData::CimbVaBankTransfer { .. } - | domain::BankTransferData::DanamonVaBankTransfer { .. } - | domain::BankTransferData::MandiriVaBankTransfer { .. } - | domain::BankTransferData::Pix {} - | domain::BankTransferData::Pse {} - | domain::BankTransferData::LocalBankTransfer { .. } => { + api_models::payments::BankTransferData::AchBankTransfer { .. } + | api_models::payments::BankTransferData::SepaBankTransfer { .. } + | api_models::payments::BankTransferData::BacsBankTransfer { .. } + | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } + | api_models::payments::BankTransferData::PermataBankTransfer { .. } + | api_models::payments::BankTransferData::BcaBankTransfer { .. } + | api_models::payments::BankTransferData::BniVaBankTransfer { .. } + | api_models::payments::BankTransferData::BriVaBankTransfer { .. } + | api_models::payments::BankTransferData::CimbVaBankTransfer { .. } + | api_models::payments::BankTransferData::DanamonVaBankTransfer { .. } + | api_models::payments::BankTransferData::MandiriVaBankTransfer { .. } + | api_models::payments::BankTransferData::Pix {} + | api_models::payments::BankTransferData::Pse {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ) @@ -703,36 +704,39 @@ impl TryFrom<&domain::BankTransferData> for PaypalPaymentsRequest { } } -impl TryFrom<&domain::VoucherData> for PaypalPaymentsRequest { +impl TryFrom<&api_models::payments::VoucherData> for PaypalPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::VoucherData) -> Result { + fn try_from(value: &api_models::payments::VoucherData) -> Result { match value { - domain::VoucherData::Boleto(_) - | domain::VoucherData::Efecty - | domain::VoucherData::PagoEfectivo - | domain::VoucherData::RedCompra - | domain::VoucherData::RedPagos - | domain::VoucherData::Alfamart(_) - | domain::VoucherData::Indomaret(_) - | domain::VoucherData::Oxxo - | domain::VoucherData::SevenEleven(_) - | domain::VoucherData::Lawson(_) - | domain::VoucherData::MiniStop(_) - | domain::VoucherData::FamilyMart(_) - | domain::VoucherData::Seicomart(_) - | domain::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ) - .into()), + api_models::payments::VoucherData::Boleto(_) + | api_models::payments::VoucherData::Efecty + | api_models::payments::VoucherData::PagoEfectivo + | api_models::payments::VoucherData::RedCompra + | api_models::payments::VoucherData::RedPagos + | api_models::payments::VoucherData::Alfamart(_) + | api_models::payments::VoucherData::Indomaret(_) + | api_models::payments::VoucherData::Oxxo + | api_models::payments::VoucherData::SevenEleven(_) + | api_models::payments::VoucherData::Lawson(_) + | api_models::payments::VoucherData::MiniStop(_) + | api_models::payments::VoucherData::FamilyMart(_) + | api_models::payments::VoucherData::Seicomart(_) + | api_models::payments::VoucherData::PayEasy(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Paypal"), + ) + .into()) + } } } } -impl TryFrom<&domain::GiftCardData> for PaypalPaymentsRequest { +impl TryFrom<&api_models::payments::GiftCardData> for PaypalPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::GiftCardData) -> Result { + fn try_from(value: &api_models::payments::GiftCardData) -> Result { match value { - domain::GiftCardData::Givex(_) | domain::GiftCardData::PaySafeCard {} => { + api_models::payments::GiftCardData::Givex(_) + | api_models::payments::GiftCardData::PaySafeCard {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ) @@ -946,7 +950,7 @@ pub struct PaypalThreeDsResponse { #[serde(untagged)] pub enum PaypalPreProcessingResponse { PaypalLiabilityResponse(PaypalLiabilityResponse), - PaypalNonLiabilityResponse(PaypalNonLiabilityResponse), + PaypalNonLiablityResponse(PaypalNonLiablityResponse), } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -955,7 +959,7 @@ pub struct PaypalLiabilityResponse { } #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct PaypalNonLiabilityResponse { +pub struct PaypalNonLiablityResponse { payment_source: CardsData, } @@ -976,7 +980,7 @@ pub struct PaypalThreeDsParams { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ThreeDsCheck { - pub enrollment_status: Option, + pub enrollment_status: Option, pub authentication_status: Option, } @@ -989,7 +993,7 @@ pub enum LiabilityShift { } #[derive(Debug, Clone, Serialize, Deserialize)] -pub enum EnrollmentStatus { +pub enum EnrollementStatus { Null, #[serde(rename = "Y")] Ready, @@ -1470,212 +1474,6 @@ impl } } -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize)] -pub struct PaypalFulfillRequest { - sender_batch_header: PayoutBatchHeader, - items: Vec, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize)] -pub struct PayoutBatchHeader { - sender_batch_id: String, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize)] -pub struct PaypalPayoutItem { - amount: PayoutAmount, - note: Option, - notification_language: String, - #[serde(flatten)] - payout_method_data: PaypalPayoutMethodData, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize)] -pub struct PaypalPayoutMethodData { - recipient_type: PayoutRecipientType, - recipient_wallet: PayoutWalletType, - receiver: PaypalPayoutDataType, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum PayoutRecipientType { - Email, - PaypalId, - Phone, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum PayoutWalletType { - Paypal, - Venmo, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize)] -#[serde(untagged)] -pub enum PaypalPayoutDataType { - EmailType(Email), - OtherType(Secret), -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Serialize)] -pub struct PayoutAmount { - value: String, - currency: storage_enums::Currency, -} - -#[cfg(feature = "payouts")] -impl TryFrom<&PaypalRouterData<&types::PayoutsRouterData>> - for PaypalFulfillRequest -{ - type Error = error_stack::Report; - fn try_from( - item: &PaypalRouterData<&types::PayoutsRouterData>, - ) -> Result { - let item_data = PaypalPayoutItem::try_from(item)?; - Ok(Self { - sender_batch_header: PayoutBatchHeader { - sender_batch_id: item.router_data.request.payout_id.to_owned(), - }, - items: vec![item_data], - }) - } -} - -#[cfg(feature = "payouts")] -impl TryFrom<&PaypalRouterData<&types::PayoutsRouterData>> for PaypalPayoutItem { - type Error = error_stack::Report; - fn try_from( - item: &PaypalRouterData<&types::PayoutsRouterData>, - ) -> Result { - let amount = PayoutAmount { - value: item.amount.to_owned(), - currency: item.router_data.request.destination_currency, - }; - - let payout_method_data = match item.router_data.get_payout_method_data()? { - api::PayoutMethodData::Wallet(wallet_data) => match wallet_data { - api::WalletPayout::Paypal(data) => { - let (recipient_type, receiver) = - match (data.email, data.telephone_number, data.paypal_id) { - (Some(email), _, _) => ( - PayoutRecipientType::Email, - PaypalPayoutDataType::EmailType(email), - ), - (_, Some(phone), _) => ( - PayoutRecipientType::Phone, - PaypalPayoutDataType::OtherType(phone), - ), - (_, _, Some(paypal_id)) => ( - PayoutRecipientType::PaypalId, - PaypalPayoutDataType::OtherType(paypal_id), - ), - _ => Err(errors::ConnectorError::MissingRequiredField { - field_name: "receiver_data", - })?, - }; - - PaypalPayoutMethodData { - recipient_type, - recipient_wallet: PayoutWalletType::Paypal, - receiver, - } - } - api::WalletPayout::Venmo(data) => { - let receiver = PaypalPayoutDataType::OtherType(data.telephone_number.ok_or( - errors::ConnectorError::MissingRequiredField { - field_name: "telephone_number", - }, - )?); - PaypalPayoutMethodData { - recipient_type: PayoutRecipientType::Phone, - recipient_wallet: PayoutWalletType::Venmo, - receiver, - } - } - }, - _ => Err(errors::ConnectorError::NotSupported { - message: "PayoutMethodType is not supported".to_string(), - connector: "Paypal", - })?, - }; - - Ok(Self { - amount, - payout_method_data, - note: item.router_data.description.to_owned(), - notification_language: consts::DEFAULT_NOTIFICATION_SCRIPT_LANGUAGE.to_string(), - }) - } -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Deserialize, Serialize)] -pub struct PaypalFulfillResponse { - batch_header: PaypalBatchResponse, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Deserialize, Serialize)] -pub struct PaypalBatchResponse { - payout_batch_id: String, - batch_status: PaypalFulfillStatus, -} - -#[cfg(feature = "payouts")] -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum PaypalFulfillStatus { - Denied, - Pending, - Processing, - Success, - Cancelled, -} - -#[cfg(feature = "payouts")] -impl ForeignFrom for storage_enums::PayoutStatus { - fn foreign_from(status: PaypalFulfillStatus) -> Self { - match status { - PaypalFulfillStatus::Success => Self::Success, - PaypalFulfillStatus::Denied => Self::Failed, - PaypalFulfillStatus::Cancelled => Self::Cancelled, - PaypalFulfillStatus::Pending | PaypalFulfillStatus::Processing => Self::Pending, - } - } -} - -#[cfg(feature = "payouts")] -impl TryFrom> - for types::PayoutsRouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::PayoutsResponseRouterData, - ) -> Result { - Ok(Self { - response: Ok(types::PayoutsResponseData { - status: Some(storage_enums::PayoutStatus::foreign_from( - item.response.batch_header.batch_status, - )), - connector_payout_id: item.response.batch_header.payout_batch_id, - payout_eligible: None, - should_add_next_step_to_process_tracker: false, - }), - ..item.data - }) - } -} - #[derive(Debug, Serialize)] pub struct PaypalPaymentsCaptureRequest { amount: OrderAmount, @@ -1749,35 +1547,8 @@ impl TryFrom> fn try_from( item: types::PaymentsCaptureResponseRouterData, ) -> Result { + let amount_captured = item.data.request.amount_to_capture; let status = storage_enums::AttemptStatus::from(item.response.status); - let amount_captured = match status { - storage_enums::AttemptStatus::Pending - | storage_enums::AttemptStatus::Authorized - | storage_enums::AttemptStatus::Failure - | storage_enums::AttemptStatus::RouterDeclined - | storage_enums::AttemptStatus::AuthenticationFailed - | storage_enums::AttemptStatus::CaptureFailed - | storage_enums::AttemptStatus::Started - | storage_enums::AttemptStatus::AuthenticationPending - | storage_enums::AttemptStatus::AuthenticationSuccessful - | storage_enums::AttemptStatus::AuthorizationFailed - | storage_enums::AttemptStatus::Authorizing - | storage_enums::AttemptStatus::VoidInitiated - | storage_enums::AttemptStatus::CodInitiated - | storage_enums::AttemptStatus::CaptureInitiated - | storage_enums::AttemptStatus::VoidFailed - | storage_enums::AttemptStatus::AutoRefunded - | storage_enums::AttemptStatus::Unresolved - | storage_enums::AttemptStatus::PaymentMethodAwaited - | storage_enums::AttemptStatus::ConfirmationAwaited - | storage_enums::AttemptStatus::DeviceDataCollectionPending - | storage_enums::AttemptStatus::Voided => 0, - storage_enums::AttemptStatus::Charged - | storage_enums::AttemptStatus::PartialCharged - | storage_enums::AttemptStatus::PartialChargedAndChargeable => { - item.data.request.amount_to_capture - } - }; let connector_payment_id: PaypalMeta = to_connector_meta(item.data.request.connector_meta.clone())?; Ok(Self { diff --git a/crates/router/src/connector/payu/transformers.rs b/crates/router/src/connector/payu/transformers.rs index 575f199b730..9484749ff22 100644 --- a/crates/router/src/connector/payu/transformers.rs +++ b/crates/router/src/connector/payu/transformers.rs @@ -8,7 +8,7 @@ use crate::{ consts, core::errors, pii::Secret, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; const WALLET_IDENTIFIER: &str = "PBL"; @@ -70,7 +70,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest { fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { let auth_type = PayuAuthType::try_from(&item.connector_auth_type)?; let payment_method = match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => Ok(PayuPaymentMethod { + api::PaymentMethodData::Card(ccard) => Ok(PayuPaymentMethod { pay_method: PayuPaymentMethodData::Card(PayuCard::Card { number: ccard.card_number, expiration_month: ccard.card_exp_month, @@ -78,8 +78,8 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest { cvv: ccard.card_cvc, }), }), - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::GooglePay(data) => Ok(PayuPaymentMethod { + api::PaymentMethodData::Wallet(wallet_data) => match wallet_data { + api_models::payments::WalletData::GooglePay(data) => Ok(PayuPaymentMethod { pay_method: PayuPaymentMethodData::Wallet({ PayuWallet { value: PayuWalletCode::Ap, @@ -90,7 +90,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest { } }), }), - domain::WalletData::ApplePay(data) => Ok(PayuPaymentMethod { + api_models::payments::WalletData::ApplePay(data) => Ok(PayuPaymentMethod { pay_method: PayuPaymentMethodData::Wallet({ PayuWallet { value: PayuWalletCode::Jp, diff --git a/crates/router/src/connector/placetopay/transformers.rs b/crates/router/src/connector/placetopay/transformers.rs index 6ad3d3c2039..152e315de18 100644 --- a/crates/router/src/connector/placetopay/transformers.rs +++ b/crates/router/src/connector/placetopay/transformers.rs @@ -1,3 +1,4 @@ +use api_models::payments; use common_utils::date_time; use diesel_models::enums; use error_stack::ResultExt; @@ -12,7 +13,7 @@ use crate::{ }, consts, core::errors, - types::{self, api, domain, storage::enums as storage_enums}, + types::{self, api, storage::enums as storage_enums}, }; pub struct PlacetopayRouterData { @@ -125,7 +126,7 @@ impl TryFrom<&PlacetopayRouterData<&types::PaymentsAuthorizeRouterData>> }, }; match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(req_card) => { + payments::PaymentMethodData::Card(req_card) => { let card = PlacetopayCard { number: req_card.card_number.clone(), expiration: req_card @@ -143,19 +144,19 @@ impl TryFrom<&PlacetopayRouterData<&types::PaymentsAuthorizeRouterData>> }, }) } - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::Wallet(_) + | payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankRedirect(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::BankTransfer(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::Voucher(_) + | payments::PaymentMethodData::GiftCard(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Placetopay"), ) diff --git a/crates/router/src/connector/powertranz.rs b/crates/router/src/connector/powertranz.rs index b9daf49fac0..9e514a43553 100644 --- a/crates/router/src/connector/powertranz.rs +++ b/crates/router/src/connector/powertranz.rs @@ -115,7 +115,7 @@ impl ConnectorCommon for Powertranz { res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult { - // For error scenarios connector respond with 200 http status code and error response object in response + // For error scenerios connector respond with 200 http status code and error response object in response // For http status code other than 200 they send empty response back event_builder.map(|i: &mut ConnectorEvent| i.set_error_response_body(&serde_json::json!({"error_response": std::str::from_utf8(&res.response).unwrap_or("")}))); diff --git a/crates/router/src/connector/powertranz/transformers.rs b/crates/router/src/connector/powertranz/transformers.rs index 6b0675b1611..26a8e4fc69e 100644 --- a/crates/router/src/connector/powertranz/transformers.rs +++ b/crates/router/src/connector/powertranz/transformers.rs @@ -1,3 +1,4 @@ +use api_models::payments::Card; use common_utils::pii::{Email, IpAddress}; use diesel_models::enums::RefundStatus; use masking::{ExposeInterface, Secret}; @@ -5,11 +6,11 @@ use serde::{Deserialize, Serialize}; use uuid::Uuid; use crate::{ - connector::utils::{self, CardData, PaymentsAuthorizeRequestData, RouterData}, + connector::utils::{self, CardData, PaymentsAuthorizeRequestData}, consts, core::errors, services, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, + types::{self, api, storage::enums, transformers::ForeignFrom}, }; const ISO_SUCCESS_CODES: [&str; 7] = ["00", "3D0", "3D1", "HP0", "TK0", "SP4", "FC0"]; @@ -99,29 +100,24 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PowertranzPaymentsRequest type Error = error_stack::Report; fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { let source = match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(card) => { - let card_holder_name = item.get_optional_billing_full_name(); - Source::try_from((&card, card_holder_name)) - } - domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotSupported { - message: utils::SELECTED_PAYMENT_METHOD.to_string(), - connector: "powertranz", - } - .into()) + api::PaymentMethodData::Card(card) => Source::try_from(&card), + api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "powertranz", } + .into()), }?; // let billing_address = get_address_details(&item.address.billing, &item.request.email); // let shipping_address = get_address_details(&item.address.shipping, &item.request.email); @@ -216,13 +212,14 @@ impl TryFrom<&types::BrowserInformation> for BrowserInfo { }) }*/ -impl TryFrom<(&domain::Card, Option>)> for Source { +impl TryFrom<&Card> for Source { type Error = error_stack::Report; - fn try_from( - (card, card_holder_name): (&domain::Card, Option>), - ) -> Result { + fn try_from(card: &Card) -> Result { let card = PowertranzCard { - cardholder_name: card_holder_name.unwrap_or(Secret::new("".to_string())), + cardholder_name: card + .card_holder_name + .clone() + .unwrap_or(Secret::new("".to_string())), card_pan: card.card_number.clone(), card_expiration: card.get_expiry_date_as_yymm()?, card_cvv: card.card_cvc.clone(), diff --git a/crates/router/src/connector/prophetpay/transformers.rs b/crates/router/src/connector/prophetpay/transformers.rs index 570bf8d2b3a..06d23af33af 100644 --- a/crates/router/src/connector/prophetpay/transformers.rs +++ b/crates/router/src/connector/prophetpay/transformers.rs @@ -11,7 +11,7 @@ use crate::{ consts as const_val, core::errors, services, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, }; pub struct ProphetpayRouterData { @@ -136,8 +136,8 @@ impl TryFrom<&ProphetpayRouterData<&types::PaymentsAuthorizeRouterData>> ) -> Result { if item.router_data.request.currency == api_models::enums::Currency::USD { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::CardRedirect( - domain::payments::CardRedirectData::CardRedirect {}, + api::PaymentMethodData::CardRedirect( + api_models::payments::CardRedirectData::CardRedirect {}, ) => { let auth_data = ProphetpayAuthType::try_from(&item.router_data.connector_auth_type)?; diff --git a/crates/router/src/connector/rapyd/transformers.rs b/crates/router/src/connector/rapyd/transformers.rs index 04dc4496b62..d51a322635c 100644 --- a/crates/router/src/connector/rapyd/transformers.rs +++ b/crates/router/src/connector/rapyd/transformers.rs @@ -4,12 +4,12 @@ use time::PrimitiveDateTime; use url::Url; use crate::{ - connector::utils::{PaymentsAuthorizeRequestData, RouterData}, + connector::utils::PaymentsAuthorizeRequestData, consts, core::errors, pii::Secret, services, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, + types::{self, api, storage::enums, transformers::ForeignFrom}, utils::OptionExt, }; @@ -124,16 +124,15 @@ impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPay _ => (None, None), }; let payment_method = match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => { + api_models::payments::PaymentMethodData::Card(ref ccard) => { Some(PaymentMethod { pm_type: "in_amex_card".to_owned(), //[#369] Map payment method type based on country fields: Some(PaymentFields { number: ccard.card_number.to_owned(), expiration_month: ccard.card_exp_month.to_owned(), expiration_year: ccard.card_exp_year.to_owned(), - name: item - .router_data - .get_optional_billing_full_name() + name: ccard + .card_holder_name .to_owned() .unwrap_or(Secret::new("".to_string())), cvv: ccard.card_cvc.to_owned(), @@ -142,13 +141,13 @@ impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPay digital_wallet: None, }) } - domain::PaymentMethodData::Wallet(ref wallet_data) => { + api_models::payments::PaymentMethodData::Wallet(ref wallet_data) => { let digital_wallet = match wallet_data { - domain::WalletData::GooglePay(data) => Some(RapydWallet { + api_models::payments::WalletData::GooglePay(data) => Some(RapydWallet { payment_type: "google_pay".to_string(), token: Some(Secret::new(data.tokenization_data.token.to_owned())), }), - domain::WalletData::ApplePay(data) => Some(RapydWallet { + api_models::payments::WalletData::ApplePay(data) => Some(RapydWallet { payment_type: "apple_pay".to_string(), token: Some(Secret::new(data.payment_data.to_string())), }), @@ -358,7 +357,7 @@ pub struct RefundResponse { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct RefundResponseData { - //Some field related to foreign exchange and split payment can be added as and when implemented + //Some field related to forign exchange and split payment can be added as and when implemented pub id: String, pub payment: String, pub amount: i64, diff --git a/crates/router/src/connector/riskified.rs b/crates/router/src/connector/riskified.rs index c7cb321f719..b28fb5b27ef 100644 --- a/crates/router/src/connector/riskified.rs +++ b/crates/router/src/connector/riskified.rs @@ -392,7 +392,7 @@ impl req: &frm_types::FrmFulfillmentRouterData, _connectors: &settings::Connectors, ) -> CustomResult { - let req_obj = riskified::RiskifiedFulfillmentRequest::try_from(req)?; + let req_obj = riskified::RiskifiedFullfillmentRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(req_obj))) } diff --git a/crates/router/src/connector/riskified/transformers/api.rs b/crates/router/src/connector/riskified/transformers/api.rs index f20b6103cc8..f425ecdfe56 100644 --- a/crates/router/src/connector/riskified/transformers/api.rs +++ b/crates/router/src/connector/riskified/transformers/api.rs @@ -451,8 +451,8 @@ impl TryFrom<&frm_types::FrmTransactionRouterData> for TransactionSuccessRequest } #[derive(Debug, Deserialize, Serialize, Eq, PartialEq, Clone)] -pub struct RiskifiedFulfillmentRequest { - order: OrderFulfillment, +pub struct RiskifiedFullfillmentRequest { + order: OrderFullfillment, } #[derive(Debug, Deserialize, Serialize, Eq, PartialEq, Clone)] @@ -465,7 +465,7 @@ pub enum FulfillmentRequestStatus { } #[derive(Debug, Deserialize, Serialize, Eq, PartialEq, Clone)] -pub struct OrderFulfillment { +pub struct OrderFullfillment { id: String, fulfillments: FulfilmentData, } @@ -481,26 +481,11 @@ pub struct FulfilmentData { tracking_url: Option, } -impl TryFrom<&frm_types::FrmFulfillmentRouterData> for RiskifiedFulfillmentRequest { +impl TryFrom<&frm_types::FrmFulfillmentRouterData> for RiskifiedFullfillmentRequest { type Error = Error; fn try_from(item: &frm_types::FrmFulfillmentRouterData) -> Result { - let tracking_number = item - .request - .fulfillment_req - .tracking_numbers - .as_ref() - .and_then(|numbers| numbers.first().cloned()) - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "tracking_number", - })?; - let tracking_url = item - .request - .fulfillment_req - .tracking_urls - .as_ref() - .and_then(|urls| urls.first().cloned().map(|url| url.to_string())); Ok(Self { - order: OrderFulfillment { + order: OrderFullfillment { id: item.attempt_id.clone(), fulfillments: FulfilmentData { fulfillment_id: item.payment_id.clone(), @@ -519,8 +504,12 @@ impl TryFrom<&frm_types::FrmFulfillmentRouterData> for RiskifiedFulfillmentReque .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "tracking_company", })?, - tracking_number, - tracking_url, + tracking_number: item.request.fulfillment_req.tracking_number.clone().ok_or( + errors::ConnectorError::MissingRequiredField { + field_name: "tracking_number", + }, + )?, + tracking_url: item.request.fulfillment_req.tracking_url.clone(), }, }, }) diff --git a/crates/router/src/connector/shift4/transformers.rs b/crates/router/src/connector/shift4/transformers.rs index 92a72f42d1e..416dd8fd9d7 100644 --- a/crates/router/src/connector/shift4/transformers.rs +++ b/crates/router/src/connector/shift4/transformers.rs @@ -13,7 +13,7 @@ use crate::{ }, core::errors, pii, services, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, + types::{self, api, storage::enums, transformers::ForeignFrom}, }; type Error = error_stack::Report; @@ -148,26 +148,26 @@ impl TryFrom<&types::RouterData, ) -> Result { match item.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => Self::try_from((item, ccard)), - domain::PaymentMethodData::BankRedirect(ref redirect) => { + payments::PaymentMethodData::Card(ref ccard) => Self::try_from((item, ccard)), + payments::PaymentMethodData::BankRedirect(ref redirect) => { Self::try_from((item, redirect)) } - domain::PaymentMethodData::Wallet(ref wallet_data) => Self::try_from(wallet_data), - domain::PaymentMethodData::BankTransfer(ref bank_transfer_data) => { + payments::PaymentMethodData::Wallet(ref wallet_data) => Self::try_from(wallet_data), + payments::PaymentMethodData::BankTransfer(ref bank_transfer_data) => { Self::try_from(bank_transfer_data.as_ref()) } - domain::PaymentMethodData::Voucher(ref voucher_data) => Self::try_from(voucher_data), - domain::PaymentMethodData::GiftCard(ref giftcard_data) => { + payments::PaymentMethodData::Voucher(ref voucher_data) => Self::try_from(voucher_data), + payments::PaymentMethodData::GiftCard(ref giftcard_data) => { Self::try_from(giftcard_data.as_ref()) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::CardToken(_) => { + payments::PaymentMethodData::CardRedirect(_) + | payments::PaymentMethodData::PayLater(_) + | payments::PaymentMethodData::BankDebit(_) + | payments::PaymentMethodData::Crypto(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::Reward + | payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Shift4"), ) @@ -177,36 +177,36 @@ impl TryFrom<&types::RouterData for Shift4PaymentMethod { +impl TryFrom<&api_models::payments::WalletData> for Shift4PaymentMethod { type Error = Error; - fn try_from(wallet_data: &domain::WalletData) -> Result { + fn try_from(wallet_data: &api_models::payments::WalletData) -> Result { match wallet_data { - domain::WalletData::AliPayRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePay(_) - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( + payments::WalletData::AliPayRedirect(_) + | payments::WalletData::ApplePay(_) + | payments::WalletData::WeChatPayRedirect(_) + | payments::WalletData::AliPayQr(_) + | payments::WalletData::AliPayHkRedirect(_) + | payments::WalletData::MomoRedirect(_) + | payments::WalletData::KakaoPayRedirect(_) + | payments::WalletData::GoPayRedirect(_) + | payments::WalletData::GcashRedirect(_) + | payments::WalletData::ApplePayRedirect(_) + | payments::WalletData::ApplePayThirdPartySdk(_) + | payments::WalletData::DanaRedirect {} + | payments::WalletData::GooglePay(_) + | payments::WalletData::GooglePayRedirect(_) + | payments::WalletData::GooglePayThirdPartySdk(_) + | payments::WalletData::MbWayRedirect(_) + | payments::WalletData::MobilePayRedirect(_) + | payments::WalletData::PaypalRedirect(_) + | payments::WalletData::PaypalSdk(_) + | payments::WalletData::SamsungPay(_) + | payments::WalletData::TwintRedirect {} + | payments::WalletData::VippsRedirect {} + | payments::WalletData::TouchNGoRedirect(_) + | payments::WalletData::WeChatPayQr(_) + | payments::WalletData::CashappQr(_) + | payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Shift4"), ) .into()), @@ -214,51 +214,50 @@ impl TryFrom<&domain::WalletData> for Shift4PaymentMethod { } } -impl TryFrom<&domain::BankTransferData> for Shift4PaymentMethod { +impl TryFrom<&api_models::payments::BankTransferData> for Shift4PaymentMethod { type Error = Error; - fn try_from(bank_transfer_data: &domain::BankTransferData) -> Result { + fn try_from( + bank_transfer_data: &api_models::payments::BankTransferData, + ) -> Result { match bank_transfer_data { - domain::BankTransferData::MultibancoBankTransfer { .. } - | domain::BankTransferData::AchBankTransfer { .. } - | domain::BankTransferData::SepaBankTransfer { .. } - | domain::BankTransferData::BacsBankTransfer { .. } - | domain::BankTransferData::PermataBankTransfer { .. } - | domain::BankTransferData::BcaBankTransfer { .. } - | domain::BankTransferData::BniVaBankTransfer { .. } - | domain::BankTransferData::BriVaBankTransfer { .. } - | domain::BankTransferData::CimbVaBankTransfer { .. } - | domain::BankTransferData::DanamonVaBankTransfer { .. } - | domain::BankTransferData::MandiriVaBankTransfer { .. } - | domain::BankTransferData::Pix { .. } - | domain::BankTransferData::Pse {} - | domain::BankTransferData::LocalBankTransfer { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Shift4"), - ) - .into()) - } + payments::BankTransferData::MultibancoBankTransfer { .. } + | payments::BankTransferData::AchBankTransfer { .. } + | payments::BankTransferData::SepaBankTransfer { .. } + | payments::BankTransferData::BacsBankTransfer { .. } + | payments::BankTransferData::PermataBankTransfer { .. } + | payments::BankTransferData::BcaBankTransfer { .. } + | payments::BankTransferData::BniVaBankTransfer { .. } + | payments::BankTransferData::BriVaBankTransfer { .. } + | payments::BankTransferData::CimbVaBankTransfer { .. } + | payments::BankTransferData::DanamonVaBankTransfer { .. } + | payments::BankTransferData::MandiriVaBankTransfer { .. } + | payments::BankTransferData::Pix {} + | payments::BankTransferData::Pse {} => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Shift4"), + ) + .into()), } } } -impl TryFrom<&domain::VoucherData> for Shift4PaymentMethod { +impl TryFrom<&api_models::payments::VoucherData> for Shift4PaymentMethod { type Error = Error; - fn try_from(voucher_data: &domain::VoucherData) -> Result { + fn try_from(voucher_data: &api_models::payments::VoucherData) -> Result { match voucher_data { - domain::VoucherData::Boleto(_) - | domain::VoucherData::Efecty - | domain::VoucherData::PagoEfectivo - | domain::VoucherData::RedCompra - | domain::VoucherData::RedPagos - | domain::VoucherData::Alfamart(_) - | domain::VoucherData::Indomaret(_) - | domain::VoucherData::Oxxo - | domain::VoucherData::SevenEleven(_) - | domain::VoucherData::Lawson(_) - | domain::VoucherData::MiniStop(_) - | domain::VoucherData::FamilyMart(_) - | domain::VoucherData::Seicomart(_) - | domain::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotImplemented( + payments::VoucherData::Boleto(_) + | payments::VoucherData::Efecty + | payments::VoucherData::PagoEfectivo + | payments::VoucherData::RedCompra + | payments::VoucherData::RedPagos + | payments::VoucherData::Alfamart(_) + | payments::VoucherData::Indomaret(_) + | payments::VoucherData::Oxxo + | payments::VoucherData::SevenEleven(_) + | payments::VoucherData::Lawson(_) + | payments::VoucherData::MiniStop(_) + | payments::VoucherData::FamilyMart(_) + | payments::VoucherData::Seicomart(_) + | payments::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Shift4"), ) .into()), @@ -266,11 +265,11 @@ impl TryFrom<&domain::VoucherData> for Shift4PaymentMethod { } } -impl TryFrom<&domain::GiftCardData> for Shift4PaymentMethod { +impl TryFrom<&api_models::payments::GiftCardData> for Shift4PaymentMethod { type Error = Error; - fn try_from(gift_card_data: &domain::GiftCardData) -> Result { + fn try_from(gift_card_data: &api_models::payments::GiftCardData) -> Result { match gift_card_data { - domain::GiftCardData::Givex(_) | domain::GiftCardData::PaySafeCard {} => { + payments::GiftCardData::Givex(_) | payments::GiftCardData::PaySafeCard {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Shift4"), ) @@ -283,22 +282,23 @@ impl TryFrom<&domain::GiftCardData> for Shift4PaymentMethod { impl TryFrom<( &types::RouterData, - &domain::Card, + &api_models::payments::Card, )> for Shift4PaymentMethod { type Error = Error; fn try_from( (item, card): ( &types::RouterData, - &domain::Card, + &api_models::payments::Card, ), ) -> Result { let card_object = Card { number: card.card_number.clone(), exp_month: card.card_exp_month.clone(), exp_year: card.card_exp_year.clone(), - cardholder_name: item - .get_optional_billing_full_name() + cardholder_name: card + .card_holder_name + .clone() .unwrap_or(Secret::new("".to_string())), }; if item.is_three_ds() { @@ -324,14 +324,14 @@ impl impl TryFrom<( &types::RouterData, - &domain::BankRedirectData, + &payments::BankRedirectData, )> for Shift4PaymentMethod { type Error = Error; fn try_from( (item, redirect_data): ( &types::RouterData, - &domain::BankRedirectData, + &payments::BankRedirectData, ), ) -> Result { let flow = Flow::try_from(&item.request.router_return_url)?; @@ -356,7 +356,7 @@ impl TryFrom<&types::RouterData, ) -> Result { match &item.request.payment_method_data { - Some(domain::PaymentMethodData::Card(_)) => { + Some(api::PaymentMethodData::Card(_)) => { let card_token: Shift4CardToken = to_connector_meta(item.request.connector_meta.clone())?; Ok(Self { @@ -371,19 +371,19 @@ impl TryFrom<&types::RouterData Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Shift4"), ) @@ -392,27 +392,27 @@ impl TryFrom<&types::RouterData for PaymentMethodType { +impl TryFrom<&payments::BankRedirectData> for PaymentMethodType { type Error = Error; - fn try_from(value: &domain::BankRedirectData) -> Result { + fn try_from(value: &payments::BankRedirectData) -> Result { match value { - domain::BankRedirectData::Eps { .. } => Ok(Self::Eps), - domain::BankRedirectData::Giropay { .. } => Ok(Self::Giropay), - domain::BankRedirectData::Ideal { .. } => Ok(Self::Ideal), - domain::BankRedirectData::Sofort { .. } => Ok(Self::Sofort), - domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::Przelewy24 { .. } - | domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } => { + payments::BankRedirectData::Eps { .. } => Ok(Self::Eps), + payments::BankRedirectData::Giropay { .. } => Ok(Self::Giropay), + payments::BankRedirectData::Ideal { .. } => Ok(Self::Ideal), + payments::BankRedirectData::Sofort { .. } => Ok(Self::Sofort), + payments::BankRedirectData::BancontactCard { .. } + | payments::BankRedirectData::Blik { .. } + | payments::BankRedirectData::Trustly { .. } + | payments::BankRedirectData::Przelewy24 { .. } + | payments::BankRedirectData::Bizum {} + | payments::BankRedirectData::Interac { .. } + | payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | payments::BankRedirectData::OnlineBankingFinland { .. } + | payments::BankRedirectData::OnlineBankingPoland { .. } + | payments::BankRedirectData::OnlineBankingSlovakia { .. } + | payments::BankRedirectData::OpenBankingUk { .. } + | payments::BankRedirectData::OnlineBankingFpx { .. } + | payments::BankRedirectData::OnlineBankingThailand { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Shift4"), ) diff --git a/crates/router/src/connector/signifyd.rs b/crates/router/src/connector/signifyd.rs index c28fbc0550b..6e63d5487e5 100644 --- a/crates/router/src/connector/signifyd.rs +++ b/crates/router/src/connector/signifyd.rs @@ -498,7 +498,7 @@ impl req: &frm_types::FrmFulfillmentRouterData, _connectors: &settings::Connectors, ) -> CustomResult { - let req_obj = signifyd::FrmFulfillmentSignifydRequest::try_from(req)?; + let req_obj = signifyd::FrmFullfillmentSignifydRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(req_obj.clone()))) } @@ -530,9 +530,9 @@ impl event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult { - let response: signifyd::FrmFulfillmentSignifydApiResponse = res + let response: signifyd::FrmFullfillmentSignifydApiResponse = res .response - .parse_struct("FrmFulfillmentSignifydApiResponse Sale") + .parse_struct("FrmFullfillmentSignifydApiResponse Sale") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); diff --git a/crates/router/src/connector/signifyd/transformers/api.rs b/crates/router/src/connector/signifyd/transformers/api.rs index 684c789be6b..b738ec00fcf 100644 --- a/crates/router/src/connector/signifyd/transformers/api.rs +++ b/crates/router/src/connector/signifyd/transformers/api.rs @@ -225,7 +225,6 @@ pub struct Transactions { payment_method: storage_enums::PaymentMethod, amount: i64, currency: storage_enums::Currency, - gateway: Option, } #[derive(Debug, Serialize, Eq, PartialEq)] @@ -257,7 +256,6 @@ impl TryFrom<&frm_types::FrmTransactionRouterData> for SignifydPaymentsTransacti gateway_status_code: GatewayStatusCode::from(item.status).to_string(), payment_method: item.payment_method, currency, - gateway: item.request.connector.clone(), }; Ok(Self { order_id: item.attempt_id.clone(), @@ -355,7 +353,7 @@ impl TryFrom<&frm_types::FrmCheckoutRouterData> for SignifydPaymentsCheckoutRequ #[serde(deny_unknown_fields)] #[serde_with::skip_serializing_none] #[serde(rename_all = "camelCase")] -pub struct FrmFulfillmentSignifydRequest { +pub struct FrmFullfillmentSignifydRequest { pub order_id: String, pub fulfillment_status: Option, pub fulfillments: Vec, @@ -379,12 +377,6 @@ pub struct Fulfillments { pub shipment_id: String, pub products: Option>, pub destination: Destination, - pub fulfillment_method: Option, - pub carrier: Option, - pub shipment_status: Option, - pub tracking_urls: Option>, - pub tracking_numbers: Option>, - pub shipped_at: Option, } #[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] @@ -396,7 +388,7 @@ pub struct Product { pub item_id: String, } -impl TryFrom<&frm_types::FrmFulfillmentRouterData> for FrmFulfillmentSignifydRequest { +impl TryFrom<&frm_types::FrmFulfillmentRouterData> for FrmFullfillmentSignifydRequest { type Error = error_stack::Report; fn try_from(item: &frm_types::FrmFulfillmentRouterData) -> Result { Ok(Self { @@ -405,9 +397,15 @@ impl TryFrom<&frm_types::FrmFulfillmentRouterData> for FrmFulfillmentSignifydReq .request .fulfillment_req .fulfillment_status - .as_ref() - .map(|fulfillment_status| FulfillmentStatus::from(&fulfillment_status.clone())), - fulfillments: Vec::::from(&item.request.fulfillment_req), + .clone() + .map(|fulfillment_status| FulfillmentStatus::from(&fulfillment_status)), + fulfillments: item + .request + .fulfillment_req + .fulfillments + .iter() + .map(|f| Fulfillments::from(f.clone())) + .collect(), }) } } @@ -423,26 +421,15 @@ impl From<&core_types::FulfillmentStatus> for FulfillmentStatus { } } -impl From<&core_types::FrmFulfillmentRequest> for Vec { - fn from(fulfillment_req: &core_types::FrmFulfillmentRequest) -> Self { - fulfillment_req - .fulfillments - .iter() - .map(|fulfillment| Fulfillments { - shipment_id: fulfillment.shipment_id.clone(), - products: fulfillment - .products - .as_ref() - .map(|products| products.iter().map(|p| Product::from(p.clone())).collect()), - destination: Destination::from(fulfillment.destination.clone()), - tracking_urls: fulfillment_req.tracking_urls.clone(), - tracking_numbers: fulfillment_req.tracking_numbers.clone(), - fulfillment_method: fulfillment_req.fulfillment_method.clone(), - carrier: fulfillment_req.carrier.clone(), - shipment_status: fulfillment_req.shipment_status.clone(), - shipped_at: fulfillment_req.shipped_at.clone(), - }) - .collect() +impl From for Fulfillments { + fn from(fulfillment: core_types::Fulfillments) -> Self { + Self { + shipment_id: fulfillment.shipment_id, + products: fulfillment + .products + .map(|products| products.iter().map(|p| Product::from(p.clone())).collect()), + destination: Destination::from(fulfillment.destination), + } } } @@ -483,7 +470,7 @@ impl From for Address { #[derive(Debug, Deserialize, Serialize, Clone, ToSchema)] #[serde_with::skip_serializing_none] #[serde(rename_all = "camelCase")] -pub struct FrmFulfillmentSignifydApiResponse { +pub struct FrmFullfillmentSignifydApiResponse { pub order_id: String, pub shipment_ids: Vec, } @@ -492,7 +479,7 @@ impl TryFrom< ResponseRouterData< Fulfillment, - FrmFulfillmentSignifydApiResponse, + FrmFullfillmentSignifydApiResponse, frm_types::FraudCheckFulfillmentData, frm_types::FraudCheckResponseData, >, @@ -507,7 +494,7 @@ impl fn try_from( item: ResponseRouterData< Fulfillment, - FrmFulfillmentSignifydApiResponse, + FrmFullfillmentSignifydApiResponse, frm_types::FraudCheckFulfillmentData, frm_types::FraudCheckResponseData, >, diff --git a/crates/router/src/connector/square/transformers.rs b/crates/router/src/connector/square/transformers.rs index 318e33978cc..064e8457403 100644 --- a/crates/router/src/connector/square/transformers.rs +++ b/crates/router/src/connector/square/transformers.rs @@ -1,3 +1,4 @@ +use api_models::payments::{BankDebitData, PayLaterData, WalletData}; use error_stack::ResultExt; use masking::{ExposeInterface, PeekInterface, Secret}; use serde::{Deserialize, Serialize}; @@ -6,35 +7,33 @@ use crate::{ connector::utils::{self, CardData, PaymentsAuthorizeRequestData, RouterData}, core::errors, types::{ - self, api, domain, + self, api, storage::{self, enums}, }, unimplemented_payment_method, }; -impl TryFrom<(&types::TokenizationRouterData, domain::BankDebitData)> for SquareTokenRequest { +impl TryFrom<(&types::TokenizationRouterData, BankDebitData)> for SquareTokenRequest { type Error = error_stack::Report; fn try_from( - value: (&types::TokenizationRouterData, domain::BankDebitData), + value: (&types::TokenizationRouterData, BankDebitData), ) -> Result { let (_item, bank_debit_data) = value; match bank_debit_data { - domain::BankDebitData::AchBankDebit { .. } - | domain::BankDebitData::SepaBankDebit { .. } - | domain::BankDebitData::BecsBankDebit { .. } - | domain::BankDebitData::BacsBankDebit { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Square"), - ))? - } + BankDebitData::AchBankDebit { .. } + | BankDebitData::SepaBankDebit { .. } + | BankDebitData::BecsBankDebit { .. } + | BankDebitData::BacsBankDebit { .. } => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Square"), + ))?, } } } -impl TryFrom<(&types::TokenizationRouterData, domain::Card)> for SquareTokenRequest { +impl TryFrom<(&types::TokenizationRouterData, api_models::payments::Card)> for SquareTokenRequest { type Error = error_stack::Report; fn try_from( - value: (&types::TokenizationRouterData, domain::Card), + value: (&types::TokenizationRouterData, api_models::payments::Card), ) -> Result { let (item, card_data) = value; let auth = SquareAuthType::try_from(&item.connector_auth_type) @@ -72,62 +71,58 @@ impl TryFrom<(&types::TokenizationRouterData, domain::Card)> for SquareTokenRequ } } -impl TryFrom<(&types::TokenizationRouterData, domain::PayLaterData)> for SquareTokenRequest { +impl TryFrom<(&types::TokenizationRouterData, PayLaterData)> for SquareTokenRequest { type Error = error_stack::Report; fn try_from( - value: (&types::TokenizationRouterData, domain::PayLaterData), + value: (&types::TokenizationRouterData, PayLaterData), ) -> Result { let (_item, pay_later_data) = value; match pay_later_data { - domain::PayLaterData::AfterpayClearpayRedirect { .. } - | domain::PayLaterData::KlarnaRedirect { .. } - | domain::PayLaterData::KlarnaSdk { .. } - | domain::PayLaterData::AffirmRedirect { .. } - | domain::PayLaterData::PayBrightRedirect { .. } - | domain::PayLaterData::WalleyRedirect { .. } - | domain::PayLaterData::AlmaRedirect { .. } - | domain::PayLaterData::AtomeRedirect { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Square"), - ))? - } + PayLaterData::AfterpayClearpayRedirect { .. } + | PayLaterData::KlarnaRedirect { .. } + | PayLaterData::KlarnaSdk { .. } + | PayLaterData::AffirmRedirect { .. } + | PayLaterData::PayBrightRedirect { .. } + | PayLaterData::WalleyRedirect { .. } + | PayLaterData::AlmaRedirect { .. } + | PayLaterData::AtomeRedirect { .. } => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Square"), + ))?, } } } -impl TryFrom<(&types::TokenizationRouterData, domain::WalletData)> for SquareTokenRequest { +impl TryFrom<(&types::TokenizationRouterData, WalletData)> for SquareTokenRequest { type Error = error_stack::Report; - fn try_from( - value: (&types::TokenizationRouterData, domain::WalletData), - ) -> Result { + fn try_from(value: (&types::TokenizationRouterData, WalletData)) -> Result { let (_item, wallet_data) = value; match wallet_data { - domain::WalletData::ApplePay(_) - | domain::WalletData::GooglePay(_) - | domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( + WalletData::ApplePay(_) + | WalletData::GooglePay(_) + | WalletData::AliPayQr(_) + | WalletData::AliPayRedirect(_) + | WalletData::AliPayHkRedirect(_) + | WalletData::MomoRedirect(_) + | WalletData::KakaoPayRedirect(_) + | WalletData::GoPayRedirect(_) + | WalletData::GcashRedirect(_) + | WalletData::ApplePayRedirect(_) + | WalletData::ApplePayThirdPartySdk(_) + | WalletData::DanaRedirect {} + | WalletData::GooglePayRedirect(_) + | WalletData::GooglePayThirdPartySdk(_) + | WalletData::MbWayRedirect(_) + | WalletData::MobilePayRedirect(_) + | WalletData::PaypalRedirect(_) + | WalletData::PaypalSdk(_) + | WalletData::SamsungPay(_) + | WalletData::TwintRedirect {} + | WalletData::VippsRedirect {} + | WalletData::TouchNGoRedirect(_) + | WalletData::WeChatPayRedirect(_) + | WalletData::WeChatPayQr(_) + | WalletData::CashappQr(_) + | WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Square"), ))?, } @@ -158,28 +153,26 @@ impl TryFrom<&types::TokenizationRouterData> for SquareTokenRequest { type Error = error_stack::Report; fn try_from(item: &types::TokenizationRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::BankDebit(bank_debit_data) => { + api::PaymentMethodData::BankDebit(bank_debit_data) => { Self::try_from((item, bank_debit_data)) } - domain::PaymentMethodData::Card(card_data) => Self::try_from((item, card_data)), - domain::PaymentMethodData::Wallet(wallet_data) => Self::try_from((item, wallet_data)), - domain::PaymentMethodData::PayLater(pay_later_data) => { + api::PaymentMethodData::Card(card_data) => Self::try_from((item, card_data)), + api::PaymentMethodData::Wallet(wallet_data) => Self::try_from((item, wallet_data)), + api::PaymentMethodData::PayLater(pay_later_data) => { Self::try_from((item, pay_later_data)) } - domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Square"), - ))? - } + api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Square"), + ))?, } } } @@ -257,7 +250,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for SquarePaymentsRequest { fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { let autocomplete = item.request.is_auto_capture()?; match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(_) => { + api::PaymentMethodData::Card(_) => { let pm_token = item.get_payment_method_token()?; Ok(Self { idempotency_key: Secret::new(item.attempt_id.clone()), @@ -278,23 +271,21 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for SquarePaymentsRequest { }, }) } - domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Square"), - ))? - } + api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Square"), + ))?, } } } @@ -313,13 +304,13 @@ impl TryFrom<&types::ConnectorAuthType> for SquareAuthType { api_key: api_key.to_owned(), key1: key1.to_owned(), }), + types::ConnectorAuthType::HeaderKey { .. } | types::ConnectorAuthType::SignatureKey { .. } | types::ConnectorAuthType::MultiAuthKey { .. } | types::ConnectorAuthType::CurrencyAuthKey { .. } | types::ConnectorAuthType::TemporaryAuth { .. } - | types::ConnectorAuthType::NoKey { .. } - | types::ConnectorAuthType::CertificateAuth { .. } => { + | types::ConnectorAuthType::NoKey { .. } => { Err(errors::ConnectorError::FailedToObtainAuthType.into()) } } diff --git a/crates/router/src/connector/stax/transformers.rs b/crates/router/src/connector/stax/transformers.rs index 1d097c40e7f..1d7cc63a937 100644 --- a/crates/router/src/connector/stax/transformers.rs +++ b/crates/router/src/connector/stax/transformers.rs @@ -8,7 +8,7 @@ use crate::{ self, missing_field_err, CardData, PaymentsAuthorizeRequestData, RouterData, }, core::errors, - types::{self, api, domain, storage::enums}, + types::{self, api, storage::enums}, unimplemented_payment_method, }; @@ -71,7 +71,7 @@ impl TryFrom<&StaxRouterData<&types::PaymentsAuthorizeRouterData>> for StaxPayme let total = item.amount; match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(_) => { + api::PaymentMethodData::Card(_) => { let pm_token = item.router_data.get_payment_method_token()?; let pre_auth = !item.router_data.request.is_auto_capture()?; Ok(Self { @@ -88,9 +88,9 @@ impl TryFrom<&StaxRouterData<&types::PaymentsAuthorizeRouterData>> for StaxPayme idempotency_id: Some(item.router_data.connector_request_reference_id.clone()), }) } - domain::PaymentMethodData::BankDebit(domain::BankDebitData::AchBankDebit { - .. - }) => { + api::PaymentMethodData::BankDebit( + api_models::payments::BankDebitData::AchBankDebit { .. }, + ) => { let pm_token = item.router_data.get_payment_method_token()?; let pre_auth = !item.router_data.request.is_auto_capture()?; Ok(Self { @@ -107,23 +107,21 @@ impl TryFrom<&StaxRouterData<&types::PaymentsAuthorizeRouterData>> for StaxPayme idempotency_id: Some(item.router_data.connector_request_reference_id.clone()), }) } - domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Stax"), - ))? - } + api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Stax"), + ))?, } } } @@ -206,9 +204,9 @@ pub struct StaxBankTokenizeData { person_name: Secret, bank_account: Secret, bank_routing: Secret, - bank_name: common_enums::BankNames, - bank_type: common_enums::BankType, - bank_holder_type: common_enums::BankHolderType, + bank_name: api_models::enums::BankNames, + bank_type: api_models::enums::BankType, + bank_holder_type: api_models::enums::BankHolderType, customer_id: Secret, } @@ -225,12 +223,12 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest { fn try_from(item: &types::TokenizationRouterData) -> Result { let customer_id = item.get_connector_customer_id()?; match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(card_data) => { + api::PaymentMethodData::Card(card_data) => { let stax_card_data = StaxTokenizeData { card_exp: card_data .get_card_expiry_month_year_2_digit_with_delimiter("".to_string())?, - person_name: item - .get_optional_billing_full_name() + person_name: card_data + .card_holder_name .unwrap_or(Secret::new("".to_string())), card_number: card_data.card_number, card_cvv: card_data.card_cvc, @@ -238,15 +236,17 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest { }; Ok(Self::Card(stax_card_data)) } - domain::PaymentMethodData::BankDebit(domain::BankDebitData::AchBankDebit { - billing_details, - account_number, - routing_number, - bank_name, - bank_type, - bank_holder_type, - .. - }) => { + api_models::payments::PaymentMethodData::BankDebit( + api_models::payments::BankDebitData::AchBankDebit { + billing_details, + account_number, + routing_number, + bank_name, + bank_type, + bank_holder_type, + .. + }, + ) => { let stax_bank_data = StaxBankTokenizeData { person_name: billing_details.name, bank_account: account_number, @@ -259,23 +259,21 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest { }; Ok(Self::Bank(stax_bank_data)) } - domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Stax"), - ))? - } + api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Stax"), + ))?, } } } diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs index b94dd537285..7928e558b11 100644 --- a/crates/router/src/connector/stripe.rs +++ b/crates/router/src/connector/stripe.rs @@ -11,8 +11,6 @@ use stripe::auth_headers; use self::transformers as stripe; use super::utils::{self as connector_utils, RefundsRequestData}; -#[cfg(feature = "payouts")] -use super::utils::{PayoutsData, RouterData}; use crate::{ configs::settings, consts, @@ -29,8 +27,7 @@ use crate::{ }, types::{ self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - domain, + api::{self, ConnectorCommon}, }, utils::{crypto, ByteSliceExt, BytesExt, OptionExt}, }; @@ -38,25 +35,6 @@ use crate::{ #[derive(Debug, Clone)] pub struct Stripe; -impl ConnectorCommonExt for Stripe -where - Self: services::ConnectorIntegration, -{ - fn build_headers( - &self, - req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - let mut header = vec![( - headers::CONTENT_TYPE.to_string(), - Self::common_get_content_type(self).to_string().into(), - )]; - let mut api_key = self.get_auth_header(&req.connector_auth_type)?; - header.append(&mut api_key); - Ok(header) - } -} - impl ConnectorCommon for Stripe { fn id(&self) -> &'static str { "stripe" @@ -88,34 +66,6 @@ impl ConnectorCommon for Stripe { ), ]) } - - #[cfg(feature = "payouts")] - fn build_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - let response: stripe::StripeConnectErrorResponse = res - .response - .parse_struct("StripeConnectErrorResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_error_response_body(&response)); - Ok(types::ErrorResponse { - status_code: res.status_code, - code: response - .error - .code - .clone() - .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()), - message: response - .error - .code - .unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()), - reason: response.error.message, - attempt_status: None, - connector_transaction_id: response.error.payment_intent.map(|pi| pi.id), - }) - } } impl ConnectorValidation for Stripe { @@ -872,10 +822,10 @@ impl connectors: &settings::Connectors, ) -> CustomResult { match &req.request.payment_method_data { - domain::PaymentMethodData::BankTransfer(bank_transfer_data) => { + api_models::payments::PaymentMethodData::BankTransfer(bank_transfer_data) => { match bank_transfer_data.deref() { - domain::BankTransferData::AchBankTransfer { .. } - | domain::BankTransferData::MultibancoBankTransfer { .. } => { + api_models::payments::BankTransferData::AchBankTransfer { .. } + | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => { Ok(format!("{}{}", self.base_url(connectors), "v1/charges")) } _ => Ok(format!( @@ -899,7 +849,7 @@ impl _connectors: &settings::Connectors, ) -> CustomResult { match &req.request.payment_method_data { - domain::PaymentMethodData::BankTransfer(bank_transfer_data) => { + api_models::payments::PaymentMethodData::BankTransfer(bank_transfer_data) => { stripe::get_bank_transfer_request_data(req, bank_transfer_data.deref()) } _ => { @@ -939,41 +889,45 @@ impl res: types::Response, ) -> CustomResult { match &data.request.payment_method_data { - domain::PaymentMethodData::BankTransfer(bank_transfer_data) => match bank_transfer_data - .deref() - { - domain::BankTransferData::AchBankTransfer { .. } - | domain::BankTransferData::MultibancoBankTransfer { .. } => { - let response: stripe::ChargesResponse = res - .response - .parse_struct("ChargesResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - _ => { - let response: stripe::PaymentIntentResponse = res - .response - .parse_struct("PaymentIntentResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) + api_models::payments::PaymentMethodData::BankTransfer(bank_transfer_data) => { + match bank_transfer_data.deref() { + api_models::payments::BankTransferData::AchBankTransfer { .. } + | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => { + let response: stripe::ChargesResponse = res + .response + .parse_struct("ChargesResponse") + .change_context( + errors::ConnectorError::ResponseDeserializationFailed, + )?; + + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + + types::RouterData::try_from(types::ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + _ => { + let response: stripe::PaymentIntentResponse = res + .response + .parse_struct("PaymentIntentResponse") + .change_context( + errors::ConnectorError::ResponseDeserializationFailed, + )?; + + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + + types::RouterData::try_from(types::ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } } - }, + } _ => { let response: stripe::PaymentIntentResponse = res .response @@ -2221,12 +2175,12 @@ impl api::IncomingWebhook for Stripe { &self, request: &api::IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { - let details: stripe::WebhookEvent = request + let details: stripe::WebhookEventObjectResource = request .body - .parse_struct("WebhookEvent") - .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; + .parse_struct("WebhookEventObjectResource") + .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?; - Ok(Box::new(details.event_data.event_object)) + Ok(Box::new(details.data.object)) } fn get_dispute_details( &self, @@ -2276,442 +2230,9 @@ impl services::ConnectorRedirectResponse for Stripe { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } } } - -impl api::Payouts for Stripe {} -#[cfg(feature = "payouts")] -impl api::PayoutCancel for Stripe {} -#[cfg(feature = "payouts")] -impl api::PayoutCreate for Stripe {} -#[cfg(feature = "payouts")] -impl api::PayoutFulfill for Stripe {} -#[cfg(feature = "payouts")] -impl api::PayoutRecipient for Stripe {} -#[cfg(feature = "payouts")] -impl api::PayoutRecipientAccount for Stripe {} - -#[cfg(feature = "payouts")] -impl services::ConnectorIntegration - for Stripe -{ - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - let transfer_id = req.request.get_transfer_id()?; - Ok(format!( - "{}v1/transfers/{}/reversals", - connectors.stripe.base_url, transfer_id - )) - } - - fn get_headers( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, _connectors) - } - - fn get_request_body( - &self, - req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_req = stripe::StripeConnectReversalRequest::try_from(req)?; - Ok(RequestContent::FormUrlEncoded(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PayoutCancelType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::PayoutCancelType::get_headers(self, req, connectors)?) - .set_body(types::PayoutCancelType::get_request_body( - self, req, connectors, - )?) - .build(); - - Ok(Some(request)) - } - - fn handle_response( - &self, - data: &types::PayoutsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> { - let response: stripe::StripeConnectReversalResponse = res - .response - .parse_struct("StripeConnectReversalResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_error_response_body(&response)); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -#[cfg(feature = "payouts")] -impl services::ConnectorIntegration - for Stripe -{ - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - _req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - Ok(format!("{}v1/transfers", connectors.stripe.base_url)) - } - - fn get_headers( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_request_body( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_req = stripe::StripeConnectPayoutCreateRequest::try_from(req)?; - Ok(RequestContent::FormUrlEncoded(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PayoutCreateType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::PayoutCreateType::get_headers(self, req, connectors)?) - .set_body(types::PayoutCreateType::get_request_body( - self, req, connectors, - )?) - .build(); - - Ok(Some(request)) - } - - fn handle_response( - &self, - data: &types::PayoutsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> { - let response: stripe::StripeConnectPayoutCreateResponse = res - .response - .parse_struct("StripeConnectPayoutCreateResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_error_response_body(&response)); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -#[cfg(feature = "payouts")] -impl services::ConnectorIntegration - for Stripe -{ - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - _req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - Ok(format!("{}v1/payouts", connectors.stripe.base_url,)) - } - - fn get_headers( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - let mut headers = self.build_headers(req, connectors)?; - let customer_account = req.get_connector_customer_id()?; - let mut customer_account_header = vec![( - headers::STRIPE_COMPATIBLE_CONNECT_ACCOUNT.to_string(), - customer_account.into_masked(), - )]; - headers.append(&mut customer_account_header); - Ok(headers) - } - - fn get_request_body( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_req = stripe::StripeConnectPayoutFulfillRequest::try_from(req)?; - Ok(RequestContent::FormUrlEncoded(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PayoutFulfillType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::PayoutFulfillType::get_headers( - self, req, connectors, - )?) - .set_body(types::PayoutFulfillType::get_request_body( - self, req, connectors, - )?) - .build(); - - Ok(Some(request)) - } - - fn handle_response( - &self, - data: &types::PayoutsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> { - let response: stripe::StripeConnectPayoutFulfillResponse = res - .response - .parse_struct("StripeConnectPayoutFulfillResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_error_response_body(&response)); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -#[cfg(feature = "payouts")] -impl - services::ConnectorIntegration - for Stripe -{ - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - _req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - Ok(format!("{}v1/accounts", connectors.stripe.base_url)) - } - - fn get_headers( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_request_body( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_req = stripe::StripeConnectRecipientCreateRequest::try_from(req)?; - Ok(RequestContent::FormUrlEncoded(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PayoutRecipientType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::PayoutRecipientType::get_headers( - self, req, connectors, - )?) - .set_body(types::PayoutRecipientType::get_request_body( - self, req, connectors, - )?) - .build(); - - Ok(Some(request)) - } - - fn handle_response( - &self, - data: &types::PayoutsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> { - let response: stripe::StripeConnectRecipientCreateResponse = res - .response - .parse_struct("StripeConnectRecipientCreateResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_error_response_body(&response)); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -#[cfg(feature = "payouts")] -impl - services::ConnectorIntegration< - api::PoRecipientAccount, - types::PayoutsData, - types::PayoutsResponseData, - > for Stripe -{ - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - let connector_customer_id = req.get_connector_customer_id()?; - Ok(format!( - "{}v1/accounts/{}/external_accounts", - connectors.stripe.base_url, connector_customer_id - )) - } - - fn get_headers( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_request_body( - &self, - req: &types::PayoutsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_req = stripe::StripeConnectRecipientAccountCreateRequest::try_from(req)?; - Ok(RequestContent::FormUrlEncoded(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PayoutsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PayoutRecipientAccountType::get_url( - self, req, connectors, - )?) - .attach_default_headers() - .headers(types::PayoutRecipientAccountType::get_headers( - self, req, connectors, - )?) - .set_body(types::PayoutRecipientAccountType::get_request_body( - self, req, connectors, - )?) - .build(); - - Ok(Some(request)) - } - - fn handle_response( - &self, - data: &types::PayoutsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> - { - let response: stripe::StripeConnectRecipientAccountCreateResponse = res - .response - .parse_struct("StripeConnectRecipientAccountCreateResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_error_response_body(&response)); - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: types::Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs index 46c47a51f32..95d9b6dd906 100644 --- a/crates/router/src/connector/stripe/transformers.rs +++ b/crates/router/src/connector/stripe/transformers.rs @@ -1,24 +1,20 @@ use std::{collections::HashMap, ops::Deref}; -use api_models::{self, enums as api_enums}; +use api_models::{self, enums as api_enums, payments}; use common_utils::{ errors::CustomResult, ext_traits::{ByteSliceExt, Encode}, pii::{self, Email}, request::RequestContent, }; +use data_models::mandates::AcceptanceType; use error_stack::ResultExt; -use hyperswitch_domain_models::mandates::AcceptanceType; use masking::{ExposeInterface, ExposeOptionInterface, PeekInterface, Secret}; use serde::{Deserialize, Serialize}; use serde_json::Value; use time::PrimitiveDateTime; use url::Url; -#[cfg(feature = "payouts")] -pub mod connect; -#[cfg(feature = "payouts")] -pub use self::connect::*; use crate::{ collect_missing_value_keys, connector::utils::{ @@ -29,7 +25,7 @@ use crate::{ core::errors, services, types::{ - self, api, domain, + self, api, storage::enums, transformers::{ForeignFrom, ForeignTryFrom}, }, @@ -118,14 +114,6 @@ pub enum ExpandableObjects { LatestAttempt, } -#[derive(Debug, Eq, PartialEq, Serialize)] -pub struct StripeBrowserInformation { - #[serde(rename = "payment_method_data[ip]")] - pub ip_address: Option>, - #[serde(rename = "payment_method_data[user_agent]")] - pub user_agent: Option, -} - #[derive(Debug, Eq, PartialEq, Serialize)] pub struct PaymentIntentRequest { pub amount: i64, //amount in cents, hence passed as integer @@ -136,6 +124,7 @@ pub struct PaymentIntentRequest { pub meta_data: HashMap, pub return_url: String, pub confirm: bool, + pub mandate: Option>, pub payment_method: Option, pub customer: Option>, #[serde(flatten)] @@ -148,7 +137,6 @@ pub struct PaymentIntentRequest { #[serde(flatten)] pub payment_data: Option, pub capture_method: StripeCaptureMethod, - #[serde(flatten)] pub payment_method_options: Option, // For mandate txns using network_txns_id, needs to be validated pub setup_future_usage: Option, pub off_session: Option, @@ -156,8 +144,6 @@ pub struct PaymentIntentRequest { pub payment_method_types: Option, #[serde(rename = "expand[0]")] pub expand: Option, - #[serde(flatten)] - pub browser_info: Option, } // Field rename is required only in case of serialization as it is passed in the request to the connector. @@ -168,8 +154,8 @@ pub struct StripeMetadata { // merchant_reference_id #[serde(rename(serialize = "metadata[order_id]"))] pub order_id: Option, - // to check whether the order_id is refund_id or payment_id - // before deployment, order id is set to payment_id in refunds but now it is set as refund_id + // to check whether the order_id is refund_id or payemnt_id + // before deployment, order id is set to payemnt_id in refunds but now it is set as refund_id // it is set as string instead of bool because stripe pass it as string even if we set it as bool #[serde(rename(serialize = "metadata[is_refund_id_as_reference]"))] pub is_refund_id_as_reference: Option, @@ -191,8 +177,6 @@ pub struct SetupIntentRequest { pub payment_method_types: Option, #[serde(rename = "expand[0]")] pub expand: Option, - #[serde(flatten)] - pub browser_info: Option, } #[derive(Debug, Eq, PartialEq, Serialize)] @@ -206,9 +190,9 @@ pub struct StripeCardData { #[serde(rename = "payment_method_data[card][exp_year]")] pub payment_method_data_card_exp_year: Secret, #[serde(rename = "payment_method_data[card][cvc]")] - pub payment_method_data_card_cvc: Option>, + pub payment_method_data_card_cvc: Secret, #[serde(rename = "payment_method_options[card][request_three_d_secure]")] - pub payment_method_auth_type: Option, + pub payment_method_auth_type: Auth3ds, } #[derive(Debug, Eq, PartialEq, Serialize)] pub struct StripePayLaterData { @@ -654,11 +638,10 @@ impl TryFrom for StripePaymentMethodType { enums::PaymentMethodType::Blik => Ok(Self::Blik), enums::PaymentMethodType::AliPay => Ok(Self::Alipay), enums::PaymentMethodType::Przelewy24 => Ok(Self::Przelewy24), - // Stripe expects PMT as Card for Recurring Mandates Payments - enums::PaymentMethodType::GooglePay => Ok(Self::Card), enums::PaymentMethodType::Boleto | enums::PaymentMethodType::CardRedirect | enums::PaymentMethodType::CryptoCurrency + | enums::PaymentMethodType::GooglePay | enums::PaymentMethodType::Multibanco | enums::PaymentMethodType::OnlineBankingFpx | enums::PaymentMethodType::Paypal @@ -702,7 +685,6 @@ impl TryFrom for StripePaymentMethodType { | enums::PaymentMethodType::Trustly | enums::PaymentMethodType::Twint | enums::PaymentMethodType::Vipps - | enums::PaymentMethodType::Venmo | enums::PaymentMethodType::Alfamart | enums::PaymentMethodType::BcaBankTransfer | enums::PaymentMethodType::BniVa @@ -722,7 +704,6 @@ impl TryFrom for StripePaymentMethodType { | enums::PaymentMethodType::FamilyMart | enums::PaymentMethodType::Seicomart | enums::PaymentMethodType::PayEasy - | enums::PaymentMethodType::LocalBankTransfer | enums::PaymentMethodType::Walley => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) @@ -832,84 +813,84 @@ impl From for api_models::webhooks::IncomingWebhookEvent { } } -impl TryFrom<&common_enums::enums::BankNames> for StripeBankNames { +impl TryFrom<&api_models::enums::BankNames> for StripeBankNames { type Error = errors::ConnectorError; - fn try_from(bank: &common_enums::enums::BankNames) -> Result { + fn try_from(bank: &api_models::enums::BankNames) -> Result { Ok(match bank { - common_enums::enums::BankNames::AbnAmro => Self::AbnAmro, - common_enums::enums::BankNames::ArzteUndApothekerBank => Self::ArzteUndApothekerBank, - common_enums::enums::BankNames::AsnBank => Self::AsnBank, - common_enums::enums::BankNames::AustrianAnadiBankAg => Self::AustrianAnadiBankAg, - common_enums::enums::BankNames::BankAustria => Self::BankAustria, - common_enums::enums::BankNames::BankhausCarlSpangler => Self::BankhausCarlSpangler, - common_enums::enums::BankNames::BankhausSchelhammerUndSchatteraAg => { + api_models::enums::BankNames::AbnAmro => Self::AbnAmro, + api_models::enums::BankNames::ArzteUndApothekerBank => Self::ArzteUndApothekerBank, + api_models::enums::BankNames::AsnBank => Self::AsnBank, + api_models::enums::BankNames::AustrianAnadiBankAg => Self::AustrianAnadiBankAg, + api_models::enums::BankNames::BankAustria => Self::BankAustria, + api_models::enums::BankNames::BankhausCarlSpangler => Self::BankhausCarlSpangler, + api_models::enums::BankNames::BankhausSchelhammerUndSchatteraAg => { Self::BankhausSchelhammerUndSchatteraAg } - common_enums::enums::BankNames::BawagPskAg => Self::BawagPskAg, - common_enums::enums::BankNames::BksBankAg => Self::BksBankAg, - common_enums::enums::BankNames::BrullKallmusBankAg => Self::BrullKallmusBankAg, - common_enums::enums::BankNames::BtvVierLanderBank => Self::BtvVierLanderBank, - common_enums::enums::BankNames::Bunq => Self::Bunq, - common_enums::enums::BankNames::CapitalBankGraweGruppeAg => { + api_models::enums::BankNames::BawagPskAg => Self::BawagPskAg, + api_models::enums::BankNames::BksBankAg => Self::BksBankAg, + api_models::enums::BankNames::BrullKallmusBankAg => Self::BrullKallmusBankAg, + api_models::enums::BankNames::BtvVierLanderBank => Self::BtvVierLanderBank, + api_models::enums::BankNames::Bunq => Self::Bunq, + api_models::enums::BankNames::CapitalBankGraweGruppeAg => { Self::CapitalBankGraweGruppeAg } - common_enums::enums::BankNames::Citi => Self::CitiHandlowy, - common_enums::enums::BankNames::Dolomitenbank => Self::Dolomitenbank, - common_enums::enums::BankNames::EasybankAg => Self::EasybankAg, - common_enums::enums::BankNames::ErsteBankUndSparkassen => Self::ErsteBankUndSparkassen, - common_enums::enums::BankNames::Handelsbanken => Self::Handelsbanken, - common_enums::enums::BankNames::HypoAlpeadriabankInternationalAg => { + api_models::enums::BankNames::Citi => Self::CitiHandlowy, + api_models::enums::BankNames::Dolomitenbank => Self::Dolomitenbank, + api_models::enums::BankNames::EasybankAg => Self::EasybankAg, + api_models::enums::BankNames::ErsteBankUndSparkassen => Self::ErsteBankUndSparkassen, + api_models::enums::BankNames::Handelsbanken => Self::Handelsbanken, + api_models::enums::BankNames::HypoAlpeadriabankInternationalAg => { Self::HypoAlpeadriabankInternationalAg } - common_enums::enums::BankNames::HypoNoeLbFurNiederosterreichUWien => { + api_models::enums::BankNames::HypoNoeLbFurNiederosterreichUWien => { Self::HypoNoeLbFurNiederosterreichUWien } - common_enums::enums::BankNames::HypoOberosterreichSalzburgSteiermark => { + api_models::enums::BankNames::HypoOberosterreichSalzburgSteiermark => { Self::HypoOberosterreichSalzburgSteiermark } - common_enums::enums::BankNames::HypoTirolBankAg => Self::HypoTirolBankAg, - common_enums::enums::BankNames::HypoVorarlbergBankAg => Self::HypoVorarlbergBankAg, - common_enums::enums::BankNames::HypoBankBurgenlandAktiengesellschaft => { + api_models::enums::BankNames::HypoTirolBankAg => Self::HypoTirolBankAg, + api_models::enums::BankNames::HypoVorarlbergBankAg => Self::HypoVorarlbergBankAg, + api_models::enums::BankNames::HypoBankBurgenlandAktiengesellschaft => { Self::HypoBankBurgenlandAktiengesellschaft } - common_enums::enums::BankNames::Ing => Self::Ing, - common_enums::enums::BankNames::Knab => Self::Knab, - common_enums::enums::BankNames::MarchfelderBank => Self::MarchfelderBank, - common_enums::enums::BankNames::OberbankAg => Self::OberbankAg, - common_enums::enums::BankNames::RaiffeisenBankengruppeOsterreich => { + api_models::enums::BankNames::Ing => Self::Ing, + api_models::enums::BankNames::Knab => Self::Knab, + api_models::enums::BankNames::MarchfelderBank => Self::MarchfelderBank, + api_models::enums::BankNames::OberbankAg => Self::OberbankAg, + api_models::enums::BankNames::RaiffeisenBankengruppeOsterreich => { Self::RaiffeisenBankengruppeOsterreich } - common_enums::enums::BankNames::Rabobank => Self::Rabobank, - common_enums::enums::BankNames::Regiobank => Self::Regiobank, - common_enums::enums::BankNames::Revolut => Self::Revolut, - common_enums::enums::BankNames::SnsBank => Self::SnsBank, - common_enums::enums::BankNames::TriodosBank => Self::TriodosBank, - common_enums::enums::BankNames::VanLanschot => Self::VanLanschot, - common_enums::enums::BankNames::Moneyou => Self::Moneyou, - common_enums::enums::BankNames::SchoellerbankAg => Self::SchoellerbankAg, - common_enums::enums::BankNames::SpardaBankWien => Self::SpardaBankWien, - common_enums::enums::BankNames::VolksbankGruppe => Self::VolksbankGruppe, - common_enums::enums::BankNames::VolkskreditbankAg => Self::VolkskreditbankAg, - common_enums::enums::BankNames::VrBankBraunau => Self::VrBankBraunau, - common_enums::enums::BankNames::PlusBank => Self::PlusBank, - common_enums::enums::BankNames::EtransferPocztowy24 => Self::EtransferPocztowy24, - common_enums::enums::BankNames::BankiSpbdzielcze => Self::BankiSpbdzielcze, - common_enums::enums::BankNames::BankNowyBfgSa => Self::BankNowyBfgSa, - common_enums::enums::BankNames::GetinBank => Self::GetinBank, - common_enums::enums::BankNames::Blik => Self::Blik, - common_enums::enums::BankNames::NoblePay => Self::NoblePay, - common_enums::enums::BankNames::IdeaBank => Self::IdeaBank, - common_enums::enums::BankNames::EnveloBank => Self::EnveloBank, - common_enums::enums::BankNames::NestPrzelew => Self::NestPrzelew, - common_enums::enums::BankNames::MbankMtransfer => Self::MbankMtransfer, - common_enums::enums::BankNames::Inteligo => Self::Inteligo, - common_enums::enums::BankNames::PbacZIpko => Self::PbacZIpko, - common_enums::enums::BankNames::BnpParibas => Self::BnpParibas, - common_enums::enums::BankNames::BankPekaoSa => Self::BankPekaoSa, - common_enums::enums::BankNames::VolkswagenBank => Self::VolkswagenBank, - common_enums::enums::BankNames::AliorBank => Self::AliorBank, - common_enums::enums::BankNames::Boz => Self::Boz, + api_models::enums::BankNames::Rabobank => Self::Rabobank, + api_models::enums::BankNames::Regiobank => Self::Regiobank, + api_models::enums::BankNames::Revolut => Self::Revolut, + api_models::enums::BankNames::SnsBank => Self::SnsBank, + api_models::enums::BankNames::TriodosBank => Self::TriodosBank, + api_models::enums::BankNames::VanLanschot => Self::VanLanschot, + api_models::enums::BankNames::Moneyou => Self::Moneyou, + api_models::enums::BankNames::SchoellerbankAg => Self::SchoellerbankAg, + api_models::enums::BankNames::SpardaBankWien => Self::SpardaBankWien, + api_models::enums::BankNames::VolksbankGruppe => Self::VolksbankGruppe, + api_models::enums::BankNames::VolkskreditbankAg => Self::VolkskreditbankAg, + api_models::enums::BankNames::VrBankBraunau => Self::VrBankBraunau, + api_models::enums::BankNames::PlusBank => Self::PlusBank, + api_models::enums::BankNames::EtransferPocztowy24 => Self::EtransferPocztowy24, + api_models::enums::BankNames::BankiSpbdzielcze => Self::BankiSpbdzielcze, + api_models::enums::BankNames::BankNowyBfgSa => Self::BankNowyBfgSa, + api_models::enums::BankNames::GetinBank => Self::GetinBank, + api_models::enums::BankNames::Blik => Self::Blik, + api_models::enums::BankNames::NoblePay => Self::NoblePay, + api_models::enums::BankNames::IdeaBank => Self::IdeaBank, + api_models::enums::BankNames::EnveloBank => Self::EnveloBank, + api_models::enums::BankNames::NestPrzelew => Self::NestPrzelew, + api_models::enums::BankNames::MbankMtransfer => Self::MbankMtransfer, + api_models::enums::BankNames::Inteligo => Self::Inteligo, + api_models::enums::BankNames::PbacZIpko => Self::PbacZIpko, + api_models::enums::BankNames::BnpParibas => Self::BnpParibas, + api_models::enums::BankNames::BankPekaoSa => Self::BankPekaoSa, + api_models::enums::BankNames::VolkswagenBank => Self::VolkswagenBank, + api_models::enums::BankNames::AliorBank => Self::AliorBank, + api_models::enums::BankNames::Boz => Self::Boz, _ => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), @@ -948,21 +929,21 @@ fn validate_shipping_address_against_payment_method( } } -impl TryFrom<&domain::payments::PayLaterData> for StripePaymentMethodType { +impl TryFrom<&api_models::payments::PayLaterData> for StripePaymentMethodType { type Error = errors::ConnectorError; - fn try_from(pay_later_data: &domain::payments::PayLaterData) -> Result { + fn try_from(pay_later_data: &api_models::payments::PayLaterData) -> Result { match pay_later_data { - domain::payments::PayLaterData::KlarnaRedirect { .. } => Ok(Self::Klarna), - domain::payments::PayLaterData::AffirmRedirect {} => Ok(Self::Affirm), - domain::payments::PayLaterData::AfterpayClearpayRedirect { .. } => { + api_models::payments::PayLaterData::KlarnaRedirect { .. } => Ok(Self::Klarna), + api_models::payments::PayLaterData::AffirmRedirect {} => Ok(Self::Affirm), + api_models::payments::PayLaterData::AfterpayClearpayRedirect { .. } => { Ok(Self::AfterpayClearpay) } - domain::PayLaterData::KlarnaSdk { .. } - | domain::PayLaterData::PayBrightRedirect {} - | domain::PayLaterData::WalleyRedirect {} - | domain::PayLaterData::AlmaRedirect {} - | domain::PayLaterData::AtomeRedirect {} => { + payments::PayLaterData::KlarnaSdk { .. } + | payments::PayLaterData::PayBrightRedirect {} + | payments::PayLaterData::WalleyRedirect {} + | payments::PayLaterData::AlmaRedirect {} + | payments::PayLaterData::AtomeRedirect {} => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), )) @@ -971,31 +952,31 @@ impl TryFrom<&domain::payments::PayLaterData> for StripePaymentMethodType { } } -impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodType { +impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodType { type Error = errors::ConnectorError; - fn try_from(bank_redirect_data: &domain::BankRedirectData) -> Result { + fn try_from(bank_redirect_data: &payments::BankRedirectData) -> Result { match bank_redirect_data { - domain::BankRedirectData::Giropay { .. } => Ok(Self::Giropay), - domain::BankRedirectData::Ideal { .. } => Ok(Self::Ideal), - domain::BankRedirectData::Sofort { .. } => Ok(Self::Sofort), - domain::BankRedirectData::BancontactCard { .. } => Ok(Self::Bancontact), - domain::BankRedirectData::Przelewy24 { .. } => Ok(Self::Przelewy24), - domain::BankRedirectData::Eps { .. } => Ok(Self::Eps), - domain::BankRedirectData::Blik { .. } => Ok(Self::Blik), - domain::BankRedirectData::OnlineBankingFpx { .. } => { + payments::BankRedirectData::Giropay { .. } => Ok(Self::Giropay), + payments::BankRedirectData::Ideal { .. } => Ok(Self::Ideal), + payments::BankRedirectData::Sofort { .. } => Ok(Self::Sofort), + payments::BankRedirectData::BancontactCard { .. } => Ok(Self::Bancontact), + payments::BankRedirectData::Przelewy24 { .. } => Ok(Self::Przelewy24), + payments::BankRedirectData::Eps { .. } => Ok(Self::Eps), + payments::BankRedirectData::Blik { .. } => Ok(Self::Blik), + payments::BankRedirectData::OnlineBankingFpx { .. } => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), )) } - domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::Trustly { .. } => { + payments::BankRedirectData::Bizum {} + | payments::BankRedirectData::Interac { .. } + | payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | payments::BankRedirectData::OnlineBankingFinland { .. } + | payments::BankRedirectData::OnlineBankingPoland { .. } + | payments::BankRedirectData::OnlineBankingSlovakia { .. } + | payments::BankRedirectData::OnlineBankingThailand { .. } + | payments::BankRedirectData::OpenBankingUk { .. } + | payments::BankRedirectData::Trustly { .. } => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), )) @@ -1004,40 +985,40 @@ impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodType { } } -impl ForeignTryFrom<&domain::WalletData> for Option { +impl ForeignTryFrom<&payments::WalletData> for Option { type Error = errors::ConnectorError; - fn foreign_try_from(wallet_data: &domain::WalletData) -> Result { + fn foreign_try_from(wallet_data: &payments::WalletData) -> Result { match wallet_data { - domain::WalletData::AliPayRedirect(_) => Ok(Some(StripePaymentMethodType::Alipay)), - domain::WalletData::ApplePay(_) => Ok(None), - domain::WalletData::GooglePay(_) => Ok(Some(StripePaymentMethodType::Card)), - domain::WalletData::WeChatPayQr(_) => Ok(Some(StripePaymentMethodType::Wechatpay)), - domain::WalletData::CashappQr(_) => Ok(Some(StripePaymentMethodType::Cashapp)), - domain::WalletData::MobilePayRedirect(_) => { + payments::WalletData::AliPayRedirect(_) => Ok(Some(StripePaymentMethodType::Alipay)), + payments::WalletData::ApplePay(_) => Ok(None), + payments::WalletData::GooglePay(_) => Ok(Some(StripePaymentMethodType::Card)), + payments::WalletData::WeChatPayQr(_) => Ok(Some(StripePaymentMethodType::Wechatpay)), + payments::WalletData::CashappQr(_) => Ok(Some(StripePaymentMethodType::Cashapp)), + payments::WalletData::MobilePayRedirect(_) => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), )) } - domain::WalletData::PaypalRedirect(_) - | domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::WeChatPayRedirect(_) => { + payments::WalletData::PaypalRedirect(_) + | payments::WalletData::AliPayQr(_) + | payments::WalletData::AliPayHkRedirect(_) + | payments::WalletData::MomoRedirect(_) + | payments::WalletData::KakaoPayRedirect(_) + | payments::WalletData::GoPayRedirect(_) + | payments::WalletData::GcashRedirect(_) + | payments::WalletData::ApplePayRedirect(_) + | payments::WalletData::ApplePayThirdPartySdk(_) + | payments::WalletData::DanaRedirect {} + | payments::WalletData::GooglePayRedirect(_) + | payments::WalletData::GooglePayThirdPartySdk(_) + | payments::WalletData::MbWayRedirect(_) + | payments::WalletData::PaypalSdk(_) + | payments::WalletData::SamsungPay(_) + | payments::WalletData::TwintRedirect {} + | payments::WalletData::VippsRedirect {} + | payments::WalletData::TouchNGoRedirect(_) + | payments::WalletData::SwishQr(_) + | payments::WalletData::WeChatPayRedirect(_) => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), )) @@ -1046,26 +1027,28 @@ impl ForeignTryFrom<&domain::WalletData> for Option { } } -impl From<&domain::BankDebitData> for StripePaymentMethodType { - fn from(bank_debit_data: &domain::BankDebitData) -> Self { +impl From<&payments::BankDebitData> for StripePaymentMethodType { + fn from(bank_debit_data: &payments::BankDebitData) -> Self { match bank_debit_data { - domain::BankDebitData::AchBankDebit { .. } => Self::Ach, - domain::BankDebitData::SepaBankDebit { .. } => Self::Sepa, - domain::BankDebitData::BecsBankDebit { .. } => Self::Becs, - domain::BankDebitData::BacsBankDebit { .. } => Self::Bacs, + payments::BankDebitData::AchBankDebit { .. } => Self::Ach, + payments::BankDebitData::SepaBankDebit { .. } => Self::Sepa, + payments::BankDebitData::BecsBankDebit { .. } => Self::Becs, + payments::BankDebitData::BacsBankDebit { .. } => Self::Bacs, } } } -impl TryFrom<(&domain::payments::PayLaterData, StripePaymentMethodType)> for StripeBillingAddress { +impl TryFrom<(&api_models::payments::PayLaterData, StripePaymentMethodType)> + for StripeBillingAddress +{ type Error = errors::ConnectorError; fn try_from( - (pay_later_data, pm_type): (&domain::payments::PayLaterData, StripePaymentMethodType), + (pay_later_data, pm_type): (&api_models::payments::PayLaterData, StripePaymentMethodType), ) -> Result { match (pay_later_data, pm_type) { ( - domain::payments::PayLaterData::KlarnaRedirect { + payments::PayLaterData::KlarnaRedirect { billing_email, billing_country, }, @@ -1075,12 +1058,11 @@ impl TryFrom<(&domain::payments::PayLaterData, StripePaymentMethodType)> for Str country: Some(billing_country.to_owned()), ..Self::default() }), + (payments::PayLaterData::AffirmRedirect {}, StripePaymentMethodType::Affirm) => { + Ok(Self::default()) + } ( - domain::payments::PayLaterData::AffirmRedirect {}, - StripePaymentMethodType::Affirm, - ) => Ok(Self::default()), - ( - domain::payments::PayLaterData::AfterpayClearpayRedirect { + payments::PayLaterData::AfterpayClearpayRedirect { billing_email, billing_name, }, @@ -1095,8 +1077,8 @@ impl TryFrom<(&domain::payments::PayLaterData, StripePaymentMethodType)> for Str } } -impl From<&domain::BankDebitBilling> for StripeBillingAddress { - fn from(item: &domain::BankDebitBilling) -> Self { +impl From<&payments::BankDebitBilling> for StripeBillingAddress { + fn from(item: &payments::BankDebitBilling) -> Self { Self { email: Some(item.email.to_owned()), country: item @@ -1126,17 +1108,17 @@ impl From<&domain::BankDebitBilling> for StripeBillingAddress { } } -impl TryFrom<(&domain::BankRedirectData, Option)> for StripeBillingAddress { +impl TryFrom<(&payments::BankRedirectData, Option)> for StripeBillingAddress { type Error = error_stack::Report; fn try_from( (bank_redirection_data, is_customer_initiated_mandate_payment): ( - &domain::BankRedirectData, + &payments::BankRedirectData, Option, ), ) -> Result { match bank_redirection_data { - domain::BankRedirectData::Eps { + payments::BankRedirectData::Eps { billing_details, .. } => Ok({ let billing_data = billing_details.clone().ok_or( @@ -1151,7 +1133,7 @@ impl TryFrom<(&domain::BankRedirectData, Option)> for StripeBillingAddress ..Self::default() } }), - domain::BankRedirectData::Giropay { + payments::BankRedirectData::Giropay { billing_details, .. } => Ok(Self { name: Some( @@ -1164,19 +1146,19 @@ impl TryFrom<(&domain::BankRedirectData, Option)> for StripeBillingAddress ), ..Self::default() }), - domain::BankRedirectData::Ideal { + payments::BankRedirectData::Ideal { billing_details, .. } => Ok(get_stripe_sepa_dd_mandate_billing_details( billing_details, is_customer_initiated_mandate_payment, )?), - domain::BankRedirectData::Przelewy24 { + payments::BankRedirectData::Przelewy24 { billing_details, .. } => Ok(Self { email: billing_details.email.clone(), ..Self::default() }), - domain::BankRedirectData::BancontactCard { + payments::BankRedirectData::BancontactCard { billing_details, .. } => { let billing_details = billing_details.as_ref().ok_or( @@ -1206,33 +1188,33 @@ impl TryFrom<(&domain::BankRedirectData, Option)> for StripeBillingAddress ..Self::default() }) } - domain::BankRedirectData::Sofort { + payments::BankRedirectData::Sofort { billing_details, .. } => Ok(get_stripe_sepa_dd_mandate_billing_details( billing_details, is_customer_initiated_mandate_payment, )?), - domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } - | domain::BankRedirectData::OpenBankingUk { .. } => Ok(Self::default()), + payments::BankRedirectData::Bizum {} + | payments::BankRedirectData::Blik { .. } + | payments::BankRedirectData::Interac { .. } + | payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | payments::BankRedirectData::OnlineBankingFinland { .. } + | payments::BankRedirectData::OnlineBankingPoland { .. } + | payments::BankRedirectData::OnlineBankingSlovakia { .. } + | payments::BankRedirectData::Trustly { .. } + | payments::BankRedirectData::OnlineBankingFpx { .. } + | payments::BankRedirectData::OnlineBankingThailand { .. } + | payments::BankRedirectData::OpenBankingUk { .. } => Ok(Self::default()), } } } fn get_bank_debit_data( - bank_debit_data: &domain::BankDebitData, + bank_debit_data: &payments::BankDebitData, ) -> (StripePaymentMethodType, BankDebitData, StripeBillingAddress) { match bank_debit_data { - domain::BankDebitData::AchBankDebit { + payments::BankDebitData::AchBankDebit { billing_details, account_number, routing_number, @@ -1247,7 +1229,7 @@ fn get_bank_debit_data( let billing_data = StripeBillingAddress::from(billing_details); (StripePaymentMethodType::Ach, ach_data, billing_data) } - domain::BankDebitData::SepaBankDebit { + payments::BankDebitData::SepaBankDebit { billing_details, iban, .. @@ -1259,7 +1241,7 @@ fn get_bank_debit_data( let billing_data = StripeBillingAddress::from(billing_details); (StripePaymentMethodType::Sepa, sepa_data, billing_data) } - domain::BankDebitData::BecsBankDebit { + payments::BankDebitData::BecsBankDebit { billing_details, account_number, bsb_number, @@ -1273,7 +1255,7 @@ fn get_bank_debit_data( let billing_data = StripeBillingAddress::from(billing_details); (StripePaymentMethodType::Becs, becs_data, billing_data) } - domain::BankDebitData::BacsBankDebit { + payments::BankDebitData::BacsBankDebit { billing_details, account_number, sort_code, @@ -1291,7 +1273,7 @@ fn get_bank_debit_data( } fn create_stripe_payment_method( - payment_method_data: &domain::PaymentMethodData, + payment_method_data: &api_models::payments::PaymentMethodData, auth_type: enums::AuthenticationType, payment_method_token: Option, is_customer_initiated_mandate_payment: Option, @@ -1305,7 +1287,7 @@ fn create_stripe_payment_method( error_stack::Report, > { match payment_method_data { - domain::PaymentMethodData::Card(card_details) => { + payments::PaymentMethodData::Card(card_details) => { let payment_method_auth_type = match auth_type { enums::AuthenticationType::ThreeDs => Auth3ds::Any, enums::AuthenticationType::NoThreeDs => Auth3ds::Automatic, @@ -1316,7 +1298,7 @@ fn create_stripe_payment_method( billing_address, )) } - domain::PaymentMethodData::PayLater(pay_later_data) => { + payments::PaymentMethodData::PayLater(pay_later_data) => { let stripe_pm_type = StripePaymentMethodType::try_from(pay_later_data)?; let billing_address = StripeBillingAddress::try_from((pay_later_data, stripe_pm_type))?; Ok(( @@ -1327,7 +1309,7 @@ fn create_stripe_payment_method( billing_address, )) } - domain::PaymentMethodData::BankRedirect(bank_redirect_data) => { + payments::PaymentMethodData::BankRedirect(bank_redirect_data) => { let billing_address = StripeBillingAddress::try_from(( bank_redirect_data, is_customer_initiated_mandate_payment, @@ -1337,7 +1319,7 @@ fn create_stripe_payment_method( Ok((bank_redirect_data, Some(pm_type), billing_address)) } - domain::PaymentMethodData::Wallet(wallet_data) => { + payments::PaymentMethodData::Wallet(wallet_data) => { let pm_type = ForeignTryFrom::foreign_try_from(wallet_data)?; let wallet_specific_data = StripePaymentMethodData::try_from((wallet_data, payment_method_token))?; @@ -1347,7 +1329,7 @@ fn create_stripe_payment_method( StripeBillingAddress::default(), )) } - domain::PaymentMethodData::BankDebit(bank_debit_data) => { + payments::PaymentMethodData::BankDebit(bank_debit_data) => { let (pm_type, bank_debit_data, billing_address) = get_bank_debit_data(bank_debit_data); let pm_data = StripePaymentMethodData::BankDebit(StripeBankDebitData { @@ -1356,9 +1338,9 @@ fn create_stripe_payment_method( Ok((pm_data, Some(pm_type), billing_address)) } - domain::PaymentMethodData::BankTransfer(bank_transfer_data) => { + payments::PaymentMethodData::BankTransfer(bank_transfer_data) => { match bank_transfer_data.deref() { - domain::BankTransferData::AchBankTransfer { billing_details } => Ok(( + payments::BankTransferData::AchBankTransfer { billing_details } => Ok(( StripePaymentMethodData::BankTransfer(StripeBankTransferData::AchBankTransfer( Box::new(AchTransferData { email: billing_details.email.to_owned(), @@ -1367,7 +1349,7 @@ fn create_stripe_payment_method( None, StripeBillingAddress::default(), )), - domain::BankTransferData::MultibancoBankTransfer { billing_details } => Ok(( + payments::BankTransferData::MultibancoBankTransfer { billing_details } => Ok(( StripePaymentMethodData::BankTransfer( StripeBankTransferData::MultibancoBankTransfers(Box::new( MultibancoTransferData { @@ -1378,7 +1360,7 @@ fn create_stripe_payment_method( None, StripeBillingAddress::default(), )), - domain::BankTransferData::SepaBankTransfer { + payments::BankTransferData::SepaBankTransfer { billing_details, country, } => { @@ -1404,7 +1386,7 @@ fn create_stripe_payment_method( billing_details, )) } - domain::BankTransferData::BacsBankTransfer { billing_details } => { + payments::BankTransferData::BacsBankTransfer { billing_details } => { let billing_details = StripeBillingAddress { email: Some(billing_details.email.clone()), name: Some(billing_details.name.clone()), @@ -1426,19 +1408,18 @@ fn create_stripe_payment_method( billing_details, )) } - domain::BankTransferData::Pix {} => Err(errors::ConnectorError::NotImplemented( + payments::BankTransferData::Pix {} => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()), - domain::BankTransferData::Pse {} - | domain::BankTransferData::LocalBankTransfer { .. } - | domain::BankTransferData::PermataBankTransfer { .. } - | domain::BankTransferData::BcaBankTransfer { .. } - | domain::BankTransferData::BniVaBankTransfer { .. } - | domain::BankTransferData::BriVaBankTransfer { .. } - | domain::BankTransferData::CimbVaBankTransfer { .. } - | domain::BankTransferData::DanamonVaBankTransfer { .. } - | domain::BankTransferData::MandiriVaBankTransfer { .. } => { + payments::BankTransferData::Pse {} + | payments::BankTransferData::PermataBankTransfer { .. } + | payments::BankTransferData::BcaBankTransfer { .. } + | payments::BankTransferData::BniVaBankTransfer { .. } + | payments::BankTransferData::BriVaBankTransfer { .. } + | payments::BankTransferData::CimbVaBankTransfer { .. } + | payments::BankTransferData::DanamonVaBankTransfer { .. } + | payments::BankTransferData::MandiriVaBankTransfer { .. } => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) @@ -1446,94 +1427,97 @@ fn create_stripe_payment_method( } } } - domain::PaymentMethodData::Crypto(_) => Err(errors::ConnectorError::NotImplemented( + payments::PaymentMethodData::Crypto(_) => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()), - domain::PaymentMethodData::GiftCard(giftcard_data) => match giftcard_data.deref() { - domain::GiftCardData::Givex(_) | domain::GiftCardData::PaySafeCard {} => { + payments::PaymentMethodData::GiftCard(giftcard_data) => match giftcard_data.deref() { + payments::GiftCardData::Givex(_) | payments::GiftCardData::PaySafeCard {} => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()) } }, - domain::PaymentMethodData::CardRedirect(cardredirect_data) => match cardredirect_data { - domain::CardRedirectData::Knet {} - | domain::CardRedirectData::Benefit {} - | domain::CardRedirectData::MomoAtm {} - | domain::CardRedirectData::CardRedirect {} => { + + payments::PaymentMethodData::CardRedirect(cardredirect_data) => match cardredirect_data { + payments::CardRedirectData::Knet {} + | payments::CardRedirectData::Benefit {} + | payments::CardRedirectData::MomoAtm {} + | payments::CardRedirectData::CardRedirect {} => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()) } }, - domain::PaymentMethodData::Reward => Err(errors::ConnectorError::NotImplemented( + payments::PaymentMethodData::Reward => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()), - domain::PaymentMethodData::Voucher(voucher_data) => match voucher_data { - domain::VoucherData::Boleto(_) | domain::VoucherData::Oxxo => { + payments::PaymentMethodData::Voucher(voucher_data) => match voucher_data { + payments::VoucherData::Boleto(_) | payments::VoucherData::Oxxo => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()) } - domain::VoucherData::Alfamart(_) - | domain::VoucherData::Efecty - | domain::VoucherData::PagoEfectivo - | domain::VoucherData::RedCompra - | domain::VoucherData::RedPagos - | domain::VoucherData::Indomaret(_) - | domain::VoucherData::SevenEleven(_) - | domain::VoucherData::Lawson(_) - | domain::VoucherData::MiniStop(_) - | domain::VoucherData::FamilyMart(_) - | domain::VoucherData::Seicomart(_) - | domain::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotImplemented( + payments::VoucherData::Alfamart(_) + | payments::VoucherData::Efecty + | payments::VoucherData::PagoEfectivo + | payments::VoucherData::RedCompra + | payments::VoucherData::RedPagos + | payments::VoucherData::Indomaret(_) + | payments::VoucherData::SevenEleven(_) + | payments::VoucherData::Lawson(_) + | payments::VoucherData::MiniStop(_) + | payments::VoucherData::FamilyMart(_) + | payments::VoucherData::Seicomart(_) + | payments::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()), }, - domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + payments::PaymentMethodData::Upi(_) + | payments::PaymentMethodData::MandatePayment + | payments::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()), } } -impl TryFrom<(&domain::Card, Auth3ds)> for StripePaymentMethodData { +impl TryFrom<(&payments::Card, Auth3ds)> for StripePaymentMethodData { type Error = errors::ConnectorError; fn try_from( - (card, payment_method_auth_type): (&domain::Card, Auth3ds), + (card, payment_method_auth_type): (&payments::Card, Auth3ds), ) -> Result { Ok(Self::Card(StripeCardData { payment_method_data_type: StripePaymentMethodType::Card, payment_method_data_card_number: card.card_number.clone(), payment_method_data_card_exp_month: card.card_exp_month.clone(), payment_method_data_card_exp_year: card.card_exp_year.clone(), - payment_method_data_card_cvc: Some(card.card_cvc.clone()), - payment_method_auth_type: Some(payment_method_auth_type), + payment_method_data_card_cvc: card.card_cvc.clone(), + payment_method_auth_type, })) } } -impl TryFrom<(&domain::WalletData, Option)> for StripePaymentMethodData { +impl TryFrom<(&payments::WalletData, Option)> + for StripePaymentMethodData +{ type Error = error_stack::Report; fn try_from( (wallet_data, payment_method_token): ( - &domain::WalletData, + &payments::WalletData, Option, ), ) -> Result { match wallet_data { - domain::WalletData::ApplePay(applepay_data) => { + payments::WalletData::ApplePay(applepay_data) => { let mut apple_pay_decrypt_data = if let Some(types::PaymentMethodToken::ApplePayDecrypt(decrypt_data)) = payment_method_token @@ -1576,48 +1560,49 @@ impl TryFrom<(&domain::WalletData, Option)> for Strip .ok_or(errors::ConnectorError::MissingApplePayTokenData)?; Ok(pmd) } - domain::WalletData::WeChatPayQr(_) => Ok(Self::Wallet(StripeWallet::WechatpayPayment( - WechatpayPayment { + payments::WalletData::WeChatPayQr(_) => Ok(Self::Wallet( + StripeWallet::WechatpayPayment(WechatpayPayment { client: WechatClient::Web, payment_method_data_type: StripePaymentMethodType::Wechatpay, - }, - ))), - domain::WalletData::AliPayRedirect(_) => { + }), + )), + payments::WalletData::AliPayRedirect(_) => { Ok(Self::Wallet(StripeWallet::AlipayPayment(AlipayPayment { payment_method_data_type: StripePaymentMethodType::Alipay, }))) } - domain::WalletData::CashappQr(_) => { + payments::WalletData::CashappQr(_) => { Ok(Self::Wallet(StripeWallet::Cashapp(CashappPayment { payment_method_data_type: StripePaymentMethodType::Cashapp, }))) } - domain::WalletData::GooglePay(gpay_data) => Ok(Self::try_from(gpay_data)?), - domain::WalletData::PaypalRedirect(_) | domain::WalletData::MobilePayRedirect(_) => { + payments::WalletData::GooglePay(gpay_data) => Ok(Self::try_from(gpay_data)?), + payments::WalletData::PaypalRedirect(_) + | payments::WalletData::MobilePayRedirect(_) => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()) } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::WeChatPayRedirect(_) => { + payments::WalletData::AliPayQr(_) + | payments::WalletData::AliPayHkRedirect(_) + | payments::WalletData::MomoRedirect(_) + | payments::WalletData::KakaoPayRedirect(_) + | payments::WalletData::GoPayRedirect(_) + | payments::WalletData::GcashRedirect(_) + | payments::WalletData::ApplePayRedirect(_) + | payments::WalletData::ApplePayThirdPartySdk(_) + | payments::WalletData::DanaRedirect {} + | payments::WalletData::GooglePayRedirect(_) + | payments::WalletData::GooglePayThirdPartySdk(_) + | payments::WalletData::MbWayRedirect(_) + | payments::WalletData::PaypalSdk(_) + | payments::WalletData::SamsungPay(_) + | payments::WalletData::TwintRedirect {} + | payments::WalletData::VippsRedirect {} + | payments::WalletData::TouchNGoRedirect(_) + | payments::WalletData::SwishQr(_) + | payments::WalletData::WeChatPayRedirect(_) => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) @@ -1627,17 +1612,17 @@ impl TryFrom<(&domain::WalletData, Option)> for Strip } } -impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodData { +impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodData { type Error = error_stack::Report; - fn try_from(bank_redirect_data: &domain::BankRedirectData) -> Result { + fn try_from(bank_redirect_data: &payments::BankRedirectData) -> Result { let payment_method_data_type = StripePaymentMethodType::try_from(bank_redirect_data)?; match bank_redirect_data { - domain::BankRedirectData::BancontactCard { .. } => Ok(Self::BankRedirect( + payments::BankRedirectData::BancontactCard { .. } => Ok(Self::BankRedirect( StripeBankRedirectData::StripeBancontactCard(Box::new(StripeBancontactCard { payment_method_data_type, })), )), - domain::BankRedirectData::Blik { blik_code } => Ok(Self::BankRedirect( + payments::BankRedirectData::Blik { blik_code } => Ok(Self::BankRedirect( StripeBankRedirectData::StripeBlik(Box::new(StripeBlik { payment_method_data_type, code: Secret::new(blik_code.clone().ok_or( @@ -1647,7 +1632,7 @@ impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodData { )?), })), )), - domain::BankRedirectData::Eps { bank_name, .. } => Ok(Self::BankRedirect( + payments::BankRedirectData::Eps { bank_name, .. } => Ok(Self::BankRedirect( StripeBankRedirectData::StripeEps(Box::new(StripeEps { payment_method_data_type, bank_name: bank_name @@ -1655,12 +1640,12 @@ impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodData { .transpose()?, })), )), - domain::BankRedirectData::Giropay { .. } => Ok(Self::BankRedirect( + payments::BankRedirectData::Giropay { .. } => Ok(Self::BankRedirect( StripeBankRedirectData::StripeGiropay(Box::new(StripeGiropay { payment_method_data_type, })), )), - domain::BankRedirectData::Ideal { bank_name, .. } => { + payments::BankRedirectData::Ideal { bank_name, .. } => { let bank_name = bank_name .map(|bank_name| StripeBankNames::try_from(&bank_name)) .transpose()?; @@ -1671,7 +1656,7 @@ impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodData { }), ))) } - domain::BankRedirectData::Przelewy24 { bank_name, .. } => { + payments::BankRedirectData::Przelewy24 { bank_name, .. } => { let bank_name = bank_name .map(|bank_name| StripeBankNames::try_from(&bank_name)) .transpose()?; @@ -1682,7 +1667,7 @@ impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodData { })), )) } - domain::BankRedirectData::Sofort { + payments::BankRedirectData::Sofort { country, preferred_language, .. @@ -1695,21 +1680,21 @@ impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodData { preferred_language: preferred_language.clone(), }), ))), - domain::BankRedirectData::OnlineBankingFpx { .. } => { + payments::BankRedirectData::OnlineBankingFpx { .. } => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) .into()) } - domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::Trustly { .. } => { + payments::BankRedirectData::Bizum {} + | payments::BankRedirectData::Interac { .. } + | payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | payments::BankRedirectData::OnlineBankingFinland { .. } + | payments::BankRedirectData::OnlineBankingPoland { .. } + | payments::BankRedirectData::OnlineBankingSlovakia { .. } + | payments::BankRedirectData::OnlineBankingThailand { .. } + | payments::BankRedirectData::OpenBankingUk { .. } + | payments::BankRedirectData::Trustly { .. } => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) @@ -1719,9 +1704,9 @@ impl TryFrom<&domain::BankRedirectData> for StripePaymentMethodData { } } -impl TryFrom<&domain::GooglePayWalletData> for StripePaymentMethodData { +impl TryFrom<&payments::GooglePayWalletData> for StripePaymentMethodData { type Error = error_stack::Report; - fn try_from(gpay_data: &domain::GooglePayWalletData) -> Result { + fn try_from(gpay_data: &payments::GooglePayWalletData) -> Result { Ok(Self::Wallet(StripeWallet::GooglepayToken(GooglePayToken { token: Secret::new( gpay_data @@ -1816,7 +1801,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest { }; let mut payment_method_options = None; - let (mut payment_data, payment_method, billing_address, payment_method_types) = { + let (mut payment_data, payment_method, mandate, billing_address, payment_method_types) = { match item .request .mandate_id @@ -1827,6 +1812,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest { connector_mandate_ids, )) => ( None, + connector_mandate_ids.payment_method_id, connector_mandate_ids.connector_mandate_id, StripeBillingAddress::default(), get_payment_method_type_for_saved_payment_method_payment(item)?, @@ -1841,44 +1827,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest { network_transaction_id: Secret::new(network_transaction_id), }), }); - - let payment_data = match item.request.payment_method_data { - domain::payments::PaymentMethodData::Card(ref card) => { - StripePaymentMethodData::Card(StripeCardData { - payment_method_data_type: StripePaymentMethodType::Card, - payment_method_data_card_number: card.card_number.clone(), - payment_method_data_card_exp_month: card.card_exp_month.clone(), - payment_method_data_card_exp_year: card.card_exp_year.clone(), - payment_method_data_card_cvc: None, - payment_method_auth_type: None, - }) - } - domain::payments::PaymentMethodData::CardRedirect(_) - | domain::payments::PaymentMethodData::Wallet(_) - | domain::payments::PaymentMethodData::PayLater(_) - | domain::payments::PaymentMethodData::BankRedirect(_) - | domain::payments::PaymentMethodData::BankDebit(_) - | domain::payments::PaymentMethodData::BankTransfer(_) - | domain::payments::PaymentMethodData::Crypto(_) - | domain::payments::PaymentMethodData::MandatePayment - | domain::payments::PaymentMethodData::Reward - | domain::payments::PaymentMethodData::Upi(_) - | domain::payments::PaymentMethodData::Voucher(_) - | domain::payments::PaymentMethodData::GiftCard(_) - | domain::payments::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotSupported { - message: "Network tokenization for payment method".to_string(), - connector: "Stripe", - })? - } - }; - - ( - Some(payment_data), - None, - StripeBillingAddress::default(), - None, - ) + (None, None, None, StripeBillingAddress::default(), None) } _ => { let (payment_method_data, payment_method_type, billing_address) = @@ -1900,6 +1849,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest { ( Some(payment_method_data), None, + None, billing_address, payment_method_type, ) @@ -1908,7 +1858,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest { }; payment_data = match item.request.payment_method_data { - domain::PaymentMethodData::Wallet(domain::WalletData::ApplePay(_)) => { + payments::PaymentMethodData::Wallet(payments::WalletData::ApplePay(_)) => { let payment_method_token = item .payment_method_token .to_owned() @@ -1999,17 +1949,6 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest { let meta_data = get_transaction_metadata(item.request.metadata.clone(), order_id); - // We pass browser_info only when payment_data exists. - // Hence, we're pass Null during recurring payments as payment_method_data[type] is not passed - let browser_info = if payment_data.is_some() { - item.request - .browser_info - .clone() - .map(StripeBrowserInformation::from) - } else { - None - }; - Ok(Self { amount: item.request.amount, //hopefully we don't loose some cents here currency: item.request.currency.to_string(), //we need to copy the value and not transfer ownership @@ -2027,6 +1966,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest { billing: billing_address, capture_method: StripeCaptureMethod::from(item.request.capture_method), payment_data, + mandate: mandate.map(Secret::new), payment_method_options, payment_method, customer: item.connector_customer.to_owned().map(Secret::new), @@ -2035,7 +1975,6 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest { setup_future_usage: item.request.setup_future_usage, payment_method_types, expand: Some(ExpandableObjects::LatestCharge), - browser_info, }) } } @@ -2073,15 +2012,6 @@ fn get_payment_method_type_for_saved_payment_method_payment( } } -impl From for StripeBrowserInformation { - fn from(item: types::BrowserInformation) -> Self { - Self { - ip_address: item.ip_address.map(|ip| Secret::new(ip.to_string())), - user_agent: item.user_agent, - } - } -} - impl TryFrom<&types::SetupMandateRouterData> for SetupIntentRequest { type Error = error_stack::Report; fn try_from(item: &types::SetupMandateRouterData) -> Result { @@ -2098,12 +2028,6 @@ impl TryFrom<&types::SetupMandateRouterData> for SetupIntentRequest { item.connector_request_reference_id.clone(), )); - let browser_info = item - .request - .browser_info - .clone() - .map(StripeBrowserInformation::from); - Ok(Self { confirm: true, payment_data, @@ -2115,7 +2039,6 @@ impl TryFrom<&types::SetupMandateRouterData> for SetupIntentRequest { meta_data, payment_method_types: Some(pm_type), expand: Some(ExpandableObjects::LatestAttempt), - browser_info, }) } } @@ -2316,7 +2239,6 @@ impl Deref for PaymentIntentSyncResponse { pub struct StripeAdditionalCardDetails { checks: Option, three_d_secure: Option, - network_transaction_id: Option, } #[derive(Deserialize, Clone, Debug, PartialEq, Eq, Serialize)] @@ -2495,6 +2417,40 @@ fn extract_payment_method_connector_response_from_latest_attempt( .map(types::ConnectorResponseData::with_additional_payment_method_data) } +impl ForeignFrom<(Option, String)> for types::MandateReference { + fn foreign_from( + (payment_method_options, payment_method_id): (Option, String), + ) -> Self { + Self { + connector_mandate_id: payment_method_options.and_then(|options| match options { + StripePaymentMethodOptions::Card { + mandate_options, .. + } => mandate_options.map(|mandate_options| mandate_options.reference.expose()), + StripePaymentMethodOptions::Klarna {} + | StripePaymentMethodOptions::Affirm {} + | StripePaymentMethodOptions::AfterpayClearpay {} + | StripePaymentMethodOptions::Eps {} + | StripePaymentMethodOptions::Giropay {} + | StripePaymentMethodOptions::Ideal {} + | StripePaymentMethodOptions::Sofort {} + | StripePaymentMethodOptions::Ach {} + | StripePaymentMethodOptions::Bacs {} + | StripePaymentMethodOptions::Becs {} + | StripePaymentMethodOptions::WechatPay {} + | StripePaymentMethodOptions::Alipay {} + | StripePaymentMethodOptions::Sepa {} + | StripePaymentMethodOptions::Bancontact {} + | StripePaymentMethodOptions::Przelewy24 {} + | StripePaymentMethodOptions::CustomerBalance {} + | StripePaymentMethodOptions::Blik {} + | StripePaymentMethodOptions::Multibanco {} + | StripePaymentMethodOptions::Cashapp {} => None, + }), + payment_method_id: Some(payment_method_id), + } + } +} + impl TryFrom> for types::RouterData @@ -2510,16 +2466,11 @@ impl services::RedirectForm::from((redirection_url, services::Method::Get)) }); - let mandate_reference = item.response.payment_method.map(|payment_method_id| { - // Implemented Save and re-use payment information for recurring charges - // For more info: https://docs.stripe.com/recurring-payments#accept-recurring-payments - // For backward compatibility payment_method_id & connector_mandate_id is being populated with the same value - let connector_mandate_id = Some(payment_method_id.clone().expose()); - let payment_method_id = Some(payment_method_id.expose()); - types::MandateReference { - connector_mandate_id, - payment_method_id, - } + let mandate_reference = item.response.payment_method.map(|pm| { + types::MandateReference::foreign_from(( + item.response.payment_method_options, + pm.expose(), + )) }); //Note: we might have to call retrieve_setup_intent to get the network_transaction_id in case its not sent in PaymentIntentResponse @@ -2638,32 +2589,26 @@ impl services::RedirectForm::from((redirection_url, services::Method::Get)) }); - let mandate_reference = item - .response - .payment_method - .clone() - .map(|payment_method_id| { - // Implemented Save and re-use payment information for recurring charges - // For more info: https://docs.stripe.com/recurring-payments#accept-recurring-payments - // For backward compatibility payment_method_id & connector_mandate_id is being populated with the same value - let connector_mandate_id = Some(payment_method_id.clone().expose()); - let payment_method_id = match item.response.latest_charge.clone() { + let mandate_reference = item.response.payment_method.clone().map(|pm| { + types::MandateReference::foreign_from(( + item.response.payment_method_options.clone(), + match item.response.latest_charge.clone() { Some(StripeChargeEnum::ChargeObject(charge)) => { match charge.payment_method_details { Some(StripePaymentMethodDetailsResponse::Bancontact { bancontact }) => { bancontact .attached_payment_method .map(|attached_payment_method| attached_payment_method.expose()) - .unwrap_or(payment_method_id.expose()) + .unwrap_or(pm.expose()) } Some(StripePaymentMethodDetailsResponse::Ideal { ideal }) => ideal .attached_payment_method .map(|attached_payment_method| attached_payment_method.expose()) - .unwrap_or(payment_method_id.expose()), + .unwrap_or(pm.expose()), Some(StripePaymentMethodDetailsResponse::Sofort { sofort }) => sofort .attached_payment_method .map(|attached_payment_method| attached_payment_method.expose()) - .unwrap_or(payment_method_id.expose()), + .unwrap_or(pm.expose()), Some(StripePaymentMethodDetailsResponse::Blik) | Some(StripePaymentMethodDetailsResponse::Eps) | Some(StripePaymentMethodDetailsResponse::Fpx) @@ -2681,16 +2626,13 @@ impl | Some(StripePaymentMethodDetailsResponse::Wechatpay) | Some(StripePaymentMethodDetailsResponse::Alipay) | Some(StripePaymentMethodDetailsResponse::CustomerBalance) - | None => payment_method_id.expose(), + | None => pm.expose(), } } - Some(StripeChargeEnum::ChargeId(_)) | None => payment_method_id.expose(), - }; - types::MandateReference { - connector_mandate_id, - payment_method_id: Some(payment_method_id), - } - }); + Some(StripeChargeEnum::ChargeId(_)) | None => pm.expose(), + }, + )) + }); let connector_metadata = get_connector_metadata(item.response.next_action.as_ref(), item.response.amount)?; @@ -2710,23 +2652,12 @@ impl item.response.id.clone(), )) } else { - let network_transaction_id = match item.response.latest_charge.clone() { - Some(StripeChargeEnum::ChargeObject(charge_object)) => charge_object - .payment_method_details - .and_then(|payment_method_details| match payment_method_details { - StripePaymentMethodDetailsResponse::Card { card } => { - card.network_transaction_id - } - _ => None, - }), - _ => None, - }; Ok(types::PaymentsResponseData::TransactionResponse { resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()), redirection_data, mandate_reference, connector_metadata, - network_txn_id: network_transaction_id, + network_txn_id: None, connector_response_reference_id: Some(item.response.id.clone()), incremental_authorization_allowed: None, }) @@ -2757,16 +2688,8 @@ impl services::RedirectForm::from((redirection_url, services::Method::Get)) }); - let mandate_reference = item.response.payment_method.map(|payment_method_id| { - // Implemented Save and re-use payment information for recurring charges - // For more info: https://docs.stripe.com/recurring-payments#accept-recurring-payments - // For backward compatibility payment_method_id & connector_mandate_id is being populated with the same value - let connector_mandate_id = Some(payment_method_id.clone()); - let payment_method_id = Some(payment_method_id); - types::MandateReference { - connector_mandate_id, - payment_method_id, - } + let mandate_reference = item.response.payment_method.map(|pm| { + types::MandateReference::foreign_from((item.response.payment_method_options, pm)) }); let status = enums::AttemptStatus::from(item.response.status); let connector_response_data = item @@ -2782,24 +2705,12 @@ impl item.response.id.clone(), )) } else { - let network_transaction_id = match item.response.latest_attempt { - Some(LatestAttempt::PaymentIntentAttempt(attempt)) => attempt - .payment_method_details - .and_then(|payment_method_details| match payment_method_details { - StripePaymentMethodDetailsResponse::Card { card } => { - card.network_transaction_id - } - _ => None, - }), - _ => None, - }; - Ok(types::PaymentsResponseData::TransactionResponse { resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()), redirection_data, mandate_reference, connector_metadata: None, - network_txn_id: network_transaction_id, + network_txn_id: Option::foreign_from(item.response.latest_attempt), connector_response_reference_id: Some(item.response.id), incremental_authorization_allowed: None, }) @@ -2935,7 +2846,7 @@ pub struct StripeVerifyWithMicroDepositsResponse { pub struct StripeBankTransferDetails { pub amount_remaining: i64, pub currency: String, - pub financial_addresses: Vec, + pub financial_addresses: Vec, pub hosted_instructions_url: Option, pub reference: Option, #[serde(rename = "type")] @@ -2957,7 +2868,7 @@ pub struct QrCodeResponse { } #[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)] -pub struct StripeFinancialInformation { +pub struct StripeFinanicalInformation { pub iban: Option, pub sort_code: Option, pub supported_networks: Vec, @@ -3201,13 +3112,10 @@ impl TryFrom<&types::PaymentsCancelRouterData> for CancelRequest { #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)] #[non_exhaustive] #[serde(rename_all = "snake_case")] -#[serde(untagged)] pub enum StripePaymentMethodOptions { Card { mandate_options: Option, - #[serde(rename = "payment_method_options[card][network_transaction_id]")] network_transaction_id: Option>, - #[serde(flatten)] mit_exemption: Option, // To be used for MIT mandate txns }, Klarna {}, @@ -3238,7 +3146,6 @@ pub enum StripePaymentMethodOptions { #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)] pub struct MitExemption { - #[serde(rename = "payment_method_options[card][mit_exemption][network_transaction_id]")] pub network_transaction_id: Secret, } @@ -3253,7 +3160,6 @@ pub struct LatestPaymentAttempt { pub payment_method_options: Option, pub payment_method_details: Option, } - // #[derive(Deserialize, Debug, Clone, Eq, PartialEq)] // pub struct Card #[derive(serde::Serialize, serde::Deserialize, Clone, Debug, Default, Eq, PartialEq)] @@ -3282,9 +3188,9 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for StripeCreditTransferSo let currency = item.request.get_currency()?; match &item.request.payment_method_data { - Some(domain::PaymentMethodData::BankTransfer(bank_transfer_data)) => { + Some(payments::PaymentMethodData::BankTransfer(bank_transfer_data)) => { match **bank_transfer_data { - domain::BankTransferData::MultibancoBankTransfer { .. } => Ok( + payments::BankTransferData::MultibancoBankTransfer { .. } => Ok( Self::MultibancoBankTansfer(MultibancoCreditTransferSourceRequest { transfer_type: StripeCreditTransferTypes::Multibanco, currency, @@ -3295,7 +3201,7 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for StripeCreditTransferSo return_url: Some(item.get_return_url()?), }), ), - domain::BankTransferData::AchBankTransfer { .. } => { + payments::BankTransferData::AchBankTransfer { .. } => { Ok(Self::AchBankTansfer(AchCreditTransferSourceRequest { transfer_type: StripeCreditTransferTypes::AchCreditTransfer, payment_method_data: AchTransferData { @@ -3304,18 +3210,17 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for StripeCreditTransferSo currency, })) } - domain::BankTransferData::SepaBankTransfer { .. } - | domain::BankTransferData::BacsBankTransfer { .. } - | domain::BankTransferData::PermataBankTransfer { .. } - | domain::BankTransferData::BcaBankTransfer { .. } - | domain::BankTransferData::BniVaBankTransfer { .. } - | domain::BankTransferData::BriVaBankTransfer { .. } - | domain::BankTransferData::CimbVaBankTransfer { .. } - | domain::BankTransferData::DanamonVaBankTransfer { .. } - | domain::BankTransferData::MandiriVaBankTransfer { .. } - | domain::BankTransferData::LocalBankTransfer { .. } - | domain::BankTransferData::Pix { .. } - | domain::BankTransferData::Pse { .. } => { + payments::BankTransferData::SepaBankTransfer { .. } + | payments::BankTransferData::BacsBankTransfer { .. } + | payments::BankTransferData::PermataBankTransfer { .. } + | payments::BankTransferData::BcaBankTransfer { .. } + | payments::BankTransferData::BniVaBankTransfer { .. } + | payments::BankTransferData::BriVaBankTransfer { .. } + | payments::BankTransferData::CimbVaBankTransfer { .. } + | payments::BankTransferData::DanamonVaBankTransfer { .. } + | payments::BankTransferData::MandiriVaBankTransfer { .. } + | payments::BankTransferData::Pix { .. } + | payments::BankTransferData::Pse { .. } => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message( "stripe", @@ -3325,19 +3230,19 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for StripeCreditTransferSo } } } - Some(domain::PaymentMethodData::Card(..)) - | Some(domain::PaymentMethodData::Wallet(..)) - | Some(domain::PaymentMethodData::BankDebit(..)) - | Some(domain::PaymentMethodData::BankRedirect(..)) - | Some(domain::PaymentMethodData::PayLater(..)) - | Some(domain::PaymentMethodData::Crypto(..)) - | Some(domain::PaymentMethodData::Reward) - | Some(domain::PaymentMethodData::MandatePayment) - | Some(domain::PaymentMethodData::Upi(..)) - | Some(domain::PaymentMethodData::GiftCard(..)) - | Some(domain::PaymentMethodData::CardRedirect(..)) - | Some(domain::PaymentMethodData::Voucher(..)) - | Some(domain::PaymentMethodData::CardToken(..)) + Some(payments::PaymentMethodData::Card(..)) + | Some(payments::PaymentMethodData::Wallet(..)) + | Some(payments::PaymentMethodData::BankDebit(..)) + | Some(payments::PaymentMethodData::BankRedirect(..)) + | Some(payments::PaymentMethodData::PayLater(..)) + | Some(payments::PaymentMethodData::Crypto(..)) + | Some(payments::PaymentMethodData::Reward) + | Some(payments::PaymentMethodData::MandatePayment) + | Some(payments::PaymentMethodData::Upi(..)) + | Some(payments::PaymentMethodData::GiftCard(..)) + | Some(payments::PaymentMethodData::CardRedirect(..)) + | Some(payments::PaymentMethodData::Voucher(..)) + | Some(payments::PaymentMethodData::CardToken(..)) | None => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) @@ -3581,14 +3486,13 @@ pub struct WebhookPaymentMethodDetails { pub payment_method: WebhookPaymentMethodType, } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Deserialize)] pub struct WebhookEventObjectData { pub id: String, pub object: WebhookEventObjectType, pub amount: Option, pub currency: String, pub payment_intent: Option, - pub client_secret: Option>, pub reason: Option, #[serde(with = "common_utils::custom_serde::timestamp")] pub created: PrimitiveDateTime, @@ -3597,7 +3501,7 @@ pub struct WebhookEventObjectData { pub metadata: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, strum::Display)] +#[derive(Debug, Clone, Deserialize, strum::Display)] #[serde(rename_all = "snake_case")] pub enum WebhookEventObjectType { PaymentIntent, @@ -3683,7 +3587,7 @@ pub enum WebhookEventStatus { Unknown, } -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct EvidenceDetails { #[serde(with = "common_utils::custom_serde::timestamp")] pub due_by: PrimitiveDateTime, @@ -3691,7 +3595,7 @@ pub struct EvidenceDetails { impl TryFrom<( - domain::PaymentMethodData, + api::PaymentMethodData, enums::AuthenticationType, StripePaymentMethodType, )> for StripePaymentMethodData @@ -3699,99 +3603,98 @@ impl type Error = error_stack::Report; fn try_from( (pm_data, auth_type, pm_type): ( - domain::PaymentMethodData, + api::PaymentMethodData, enums::AuthenticationType, StripePaymentMethodType, ), ) -> Result { match pm_data { - domain::PaymentMethodData::Card(ref ccard) => { + api::PaymentMethodData::Card(ref ccard) => { let payment_method_auth_type = match auth_type { enums::AuthenticationType::ThreeDs => Auth3ds::Any, enums::AuthenticationType::NoThreeDs => Auth3ds::Automatic, }; Ok(Self::try_from((ccard, payment_method_auth_type))?) } - domain::PaymentMethodData::PayLater(_) => Ok(Self::PayLater(StripePayLaterData { + api::PaymentMethodData::PayLater(_) => Ok(Self::PayLater(StripePayLaterData { payment_method_data_type: pm_type, })), - domain::PaymentMethodData::BankRedirect(ref bank_redirect_data) => { + api::PaymentMethodData::BankRedirect(ref bank_redirect_data) => { Ok(Self::try_from(bank_redirect_data)?) } - domain::PaymentMethodData::Wallet(ref wallet_data) => { + payments::PaymentMethodData::Wallet(ref wallet_data) => { Ok(Self::try_from((wallet_data, None))?) } - domain::PaymentMethodData::BankDebit(bank_debit_data) => { + api::PaymentMethodData::BankDebit(bank_debit_data) => { let (_pm_type, bank_data, _) = get_bank_debit_data(&bank_debit_data); Ok(Self::BankDebit(StripeBankDebitData { bank_specific_data: bank_data, })) } - domain::PaymentMethodData::BankTransfer(bank_transfer_data) => match bank_transfer_data - .deref() - { - domain::BankTransferData::AchBankTransfer { billing_details } => { - Ok(Self::BankTransfer(StripeBankTransferData::AchBankTransfer( - Box::new(AchTransferData { - email: billing_details.email.to_owned(), - }), - ))) - } - domain::BankTransferData::MultibancoBankTransfer { billing_details } => Ok( - Self::BankTransfer(StripeBankTransferData::MultibancoBankTransfers(Box::new( - MultibancoTransferData { - email: billing_details.email.to_owned(), - }, - ))), - ), - domain::BankTransferData::SepaBankTransfer { country, .. } => { - Ok(Self::BankTransfer( - StripeBankTransferData::SepaBankTransfer(Box::new(SepaBankTransferData { + api::PaymentMethodData::BankTransfer(bank_transfer_data) => { + match bank_transfer_data.deref() { + payments::BankTransferData::AchBankTransfer { billing_details } => { + Ok(Self::BankTransfer(StripeBankTransferData::AchBankTransfer( + Box::new(AchTransferData { + email: billing_details.email.to_owned(), + }), + ))) + } + payments::BankTransferData::MultibancoBankTransfer { billing_details } => Ok( + Self::BankTransfer(StripeBankTransferData::MultibancoBankTransfers( + Box::new(MultibancoTransferData { + email: billing_details.email.to_owned(), + }), + )), + ), + payments::BankTransferData::SepaBankTransfer { country, .. } => Ok( + Self::BankTransfer(StripeBankTransferData::SepaBankTransfer(Box::new( + SepaBankTransferData { + payment_method_data_type: StripePaymentMethodType::CustomerBalance, + bank_transfer_type: BankTransferType::EuBankTransfer, + balance_funding_type: BankTransferType::BankTransfers, + payment_method_type: StripePaymentMethodType::CustomerBalance, + country: country.to_owned(), + }, + ))), + ), + payments::BankTransferData::BacsBankTransfer { .. } => Ok(Self::BankTransfer( + StripeBankTransferData::BacsBankTransfers(Box::new(BacsBankTransferData { payment_method_data_type: StripePaymentMethodType::CustomerBalance, - bank_transfer_type: BankTransferType::EuBankTransfer, + bank_transfer_type: BankTransferType::GbBankTransfer, balance_funding_type: BankTransferType::BankTransfers, payment_method_type: StripePaymentMethodType::CustomerBalance, - country: country.to_owned(), })), - )) - } - domain::BankTransferData::BacsBankTransfer { .. } => Ok(Self::BankTransfer( - StripeBankTransferData::BacsBankTransfers(Box::new(BacsBankTransferData { - payment_method_data_type: StripePaymentMethodType::CustomerBalance, - bank_transfer_type: BankTransferType::GbBankTransfer, - balance_funding_type: BankTransferType::BankTransfers, - payment_method_type: StripePaymentMethodType::CustomerBalance, - })), - )), - domain::BankTransferData::Pix {} - | domain::BankTransferData::Pse {} - | domain::BankTransferData::PermataBankTransfer { .. } - | domain::BankTransferData::BcaBankTransfer { .. } - | domain::BankTransferData::BniVaBankTransfer { .. } - | domain::BankTransferData::BriVaBankTransfer { .. } - | domain::BankTransferData::CimbVaBankTransfer { .. } - | domain::BankTransferData::DanamonVaBankTransfer { .. } - | domain::BankTransferData::LocalBankTransfer { .. } - | domain::BankTransferData::MandiriVaBankTransfer { .. } => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ) - .into()) + )), + payments::BankTransferData::Pix {} + | payments::BankTransferData::Pse {} + | payments::BankTransferData::PermataBankTransfer { .. } + | payments::BankTransferData::BcaBankTransfer { .. } + | payments::BankTransferData::BniVaBankTransfer { .. } + | payments::BankTransferData::BriVaBankTransfer { .. } + | payments::BankTransferData::CimbVaBankTransfer { .. } + | payments::BankTransferData::DanamonVaBankTransfer { .. } + | payments::BankTransferData::MandiriVaBankTransfer { .. } => { + Err(errors::ConnectorError::NotImplemented( + connector_util::get_unimplemented_payment_method_error_message( + "stripe", + ), + ) + .into()) + } } - }, - domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ))? } + api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::Reward + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + connector_util::get_unimplemented_payment_method_error_message("stripe"), + ))?, } } } @@ -3803,11 +3706,11 @@ pub struct StripeGpayToken { pub fn get_bank_transfer_request_data( req: &types::PaymentsAuthorizeRouterData, - bank_transfer_data: &domain::BankTransferData, + bank_transfer_data: &api_models::payments::BankTransferData, ) -> CustomResult { match bank_transfer_data { - domain::BankTransferData::AchBankTransfer { .. } - | domain::BankTransferData::MultibancoBankTransfer { .. } => { + api_models::payments::BankTransferData::AchBankTransfer { .. } + | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => { let req = ChargesRequest::try_from(req)?; Ok(RequestContent::FormUrlEncoded(Box::new(req))) } @@ -3893,7 +3796,7 @@ pub struct Evidence { // Mandates for bank redirects - ideal and sofort happens through sepa direct debit in stripe fn get_stripe_sepa_dd_mandate_billing_details( - billing_details: &Option, + billing_details: &Option, is_customer_initiated_mandate_payment: Option, ) -> Result { let billing_name = billing_details diff --git a/crates/router/src/connector/stripe/transformers/connect.rs b/crates/router/src/connector/stripe/transformers/connect.rs deleted file mode 100644 index 43bc0f2f510..00000000000 --- a/crates/router/src/connector/stripe/transformers/connect.rs +++ /dev/null @@ -1,480 +0,0 @@ -use api_models; -use common_utils::pii::Email; -use error_stack::ResultExt; -use masking::Secret; -use serde::{Deserialize, Serialize}; - -use super::ErrorDetails; -use crate::{ - connector::utils::{PayoutsData, RouterData}, - core::{errors, payments::CustomerDetailsExt}, - types::{self, storage::enums, PayoutIndividualDetailsExt}, - utils::OptionExt, -}; - -type Error = error_stack::Report; - -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(rename_all = "snake_case")] -pub enum StripeConnectPayoutStatus { - Canceled, - Failed, - InTransit, - Paid, - Pending, -} - -#[derive(Debug, Deserialize, Serialize)] -pub struct StripeConnectErrorResponse { - pub error: ErrorDetails, -} - -// Payouts -#[derive(Clone, Debug, Serialize)] -pub struct StripeConnectPayoutCreateRequest { - amount: i64, - currency: enums::Currency, - destination: String, - transfer_group: String, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct StripeConnectPayoutCreateResponse { - id: String, - description: Option, - source_transaction: Option, -} - -#[derive(Clone, Debug, Default, Serialize, Deserialize)] -pub struct TransferReversals { - object: String, - has_more: bool, - total_count: i32, - url: String, -} - -#[derive(Clone, Debug, Serialize)] -pub struct StripeConnectPayoutFulfillRequest { - amount: i64, - currency: enums::Currency, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct StripeConnectPayoutFulfillResponse { - id: String, - currency: String, - description: Option, - failure_balance_transaction: Option, - failure_code: Option, - failure_message: Option, - original_payout: Option, - reversed_by: Option, - statement_descriptor: Option, - status: StripeConnectPayoutStatus, -} - -#[derive(Clone, Debug, Serialize)] -pub struct StripeConnectReversalRequest { - amount: i64, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct StripeConnectReversalResponse { - id: String, - source_refund: Option, -} - -#[derive(Clone, Debug, Serialize)] -pub struct StripeConnectRecipientCreateRequest { - #[serde(rename = "type")] - account_type: String, - country: Option, - email: Option, - #[serde(rename = "capabilities[card_payments][requested]")] - capabilities_card_payments: Option, - #[serde(rename = "capabilities[transfers][requested]")] - capabilities_transfers: Option, - #[serde(rename = "tos_acceptance[date]")] - tos_acceptance_date: Option, - #[serde(rename = "tos_acceptance[ip]")] - tos_acceptance_ip: Option>, - business_type: String, - #[serde(rename = "business_profile[mcc]")] - business_profile_mcc: Option, - #[serde(rename = "business_profile[url]")] - business_profile_url: Option, - #[serde(rename = "business_profile[name]")] - business_profile_name: Option>, - #[serde(rename = "company[name]")] - company_name: Option>, - #[serde(rename = "company[address][line1]")] - company_address_line1: Option>, - #[serde(rename = "company[address][line2]")] - company_address_line2: Option>, - #[serde(rename = "company[address][postal_code]")] - company_address_postal_code: Option>, - #[serde(rename = "company[address][city]")] - company_address_city: Option>, - #[serde(rename = "company[address][state]")] - company_address_state: Option>, - #[serde(rename = "company[phone]")] - company_phone: Option>, - #[serde(rename = "company[tax_id]")] - company_tax_id: Option>, - #[serde(rename = "company[owners_provided]")] - company_owners_provided: Option, - #[serde(rename = "individual[first_name]")] - individual_first_name: Option>, - #[serde(rename = "individual[last_name]")] - individual_last_name: Option>, - #[serde(rename = "individual[dob][day]")] - individual_dob_day: Option>, - #[serde(rename = "individual[dob][month]")] - individual_dob_month: Option>, - #[serde(rename = "individual[dob][year]")] - individual_dob_year: Option>, - #[serde(rename = "individual[address][line1]")] - individual_address_line1: Option>, - #[serde(rename = "individual[address][line2]")] - individual_address_line2: Option>, - #[serde(rename = "individual[address][postal_code]")] - individual_address_postal_code: Option>, - #[serde(rename = "individual[address][city]")] - individual_address_city: Option, - #[serde(rename = "individual[address][state]")] - individual_address_state: Option>, - #[serde(rename = "individual[email]")] - individual_email: Option, - #[serde(rename = "individual[phone]")] - individual_phone: Option>, - #[serde(rename = "individual[id_number]")] - individual_id_number: Option>, - #[serde(rename = "individual[ssn_last_4]")] - individual_ssn_last_4: Option>, -} - -#[derive(Clone, Debug, Default, Serialize, Deserialize)] -pub struct StripeConnectRecipientCreateResponse { - id: String, -} - -#[derive(Clone, Debug, Serialize)] -#[serde(untagged)] -pub enum StripeConnectRecipientAccountCreateRequest { - Bank(RecipientBankAccountRequest), - Card(RecipientCardAccountRequest), - Token(RecipientTokenRequest), -} - -#[derive(Clone, Debug, Serialize)] -pub struct RecipientTokenRequest { - external_account: String, -} - -#[derive(Clone, Debug, Serialize)] -pub struct RecipientCardAccountRequest { - #[serde(rename = "external_account[object]")] - external_account_object: String, - #[serde(rename = "external_account[number]")] - external_account_number: Secret, - #[serde(rename = "external_account[exp_month]")] - external_account_exp_month: Secret, - #[serde(rename = "external_account[exp_year]")] - external_account_exp_year: Secret, -} - -#[derive(Clone, Debug, Serialize)] -pub struct RecipientBankAccountRequest { - #[serde(rename = "external_account[object]")] - external_account_object: String, - #[serde(rename = "external_account[country]")] - external_account_country: enums::CountryAlpha2, - #[serde(rename = "external_account[currency]")] - external_account_currency: enums::Currency, - #[serde(rename = "external_account[account_holder_name]")] - external_account_account_holder_name: Secret, - #[serde(rename = "external_account[account_number]")] - external_account_account_number: Secret, - #[serde(rename = "external_account[account_holder_type]")] - external_account_account_holder_type: String, - #[serde(rename = "external_account[routing_number]")] - external_account_routing_number: Secret, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct StripeConnectRecipientAccountCreateResponse { - id: String, -} - -// Payouts create/transfer request transform -impl TryFrom<&types::PayoutsRouterData> for StripeConnectPayoutCreateRequest { - type Error = Error; - fn try_from(item: &types::PayoutsRouterData) -> Result { - let request = item.request.to_owned(); - let connector_customer_id = item.get_connector_customer_id()?; - Ok(Self { - amount: request.amount, - currency: request.destination_currency, - destination: connector_customer_id, - transfer_group: request.payout_id, - }) - } -} - -// Payouts create response transform -impl TryFrom> - for types::PayoutsRouterData -{ - type Error = Error; - fn try_from( - item: types::PayoutsResponseRouterData, - ) -> Result { - let response: StripeConnectPayoutCreateResponse = item.response; - - Ok(Self { - response: Ok(types::PayoutsResponseData { - status: Some(enums::PayoutStatus::RequiresFulfillment), - connector_payout_id: response.id, - payout_eligible: None, - should_add_next_step_to_process_tracker: false, - }), - ..item.data - }) - } -} - -// Payouts fulfill request transform -impl TryFrom<&types::PayoutsRouterData> for StripeConnectPayoutFulfillRequest { - type Error = Error; - fn try_from(item: &types::PayoutsRouterData) -> Result { - let request = item.request.to_owned(); - Ok(Self { - amount: request.amount, - currency: request.destination_currency, - }) - } -} - -// Payouts fulfill response transform -impl TryFrom> - for types::PayoutsRouterData -{ - type Error = Error; - fn try_from( - item: types::PayoutsResponseRouterData, - ) -> Result { - let response: StripeConnectPayoutFulfillResponse = item.response; - - Ok(Self { - response: Ok(types::PayoutsResponseData { - status: Some(enums::PayoutStatus::from(response.status)), - connector_payout_id: response.id, - payout_eligible: None, - should_add_next_step_to_process_tracker: false, - }), - ..item.data - }) - } -} - -// Payouts reversal request transform -impl TryFrom<&types::PayoutsRouterData> for StripeConnectReversalRequest { - type Error = Error; - fn try_from(item: &types::PayoutsRouterData) -> Result { - Ok(Self { - amount: item.request.amount, - }) - } -} - -// Payouts reversal response transform -impl TryFrom> - for types::PayoutsRouterData -{ - type Error = Error; - fn try_from( - item: types::PayoutsResponseRouterData, - ) -> Result { - let response: StripeConnectReversalResponse = item.response; - - Ok(Self { - response: Ok(types::PayoutsResponseData { - status: Some(enums::PayoutStatus::Cancelled), - connector_payout_id: response.id, - payout_eligible: None, - should_add_next_step_to_process_tracker: false, - }), - ..item.data - }) - } -} - -// Recipient creation request transform -impl TryFrom<&types::PayoutsRouterData> for StripeConnectRecipientCreateRequest { - type Error = Error; - fn try_from(item: &types::PayoutsRouterData) -> Result { - let request = item.request.to_owned(); - let customer_details = request.get_customer_details()?; - let customer_email = customer_details.get_email()?; - let address = item.get_billing_address()?.clone(); - let payout_vendor_details = request.get_vendor_details()?; - let (vendor_details, individual_details) = ( - payout_vendor_details.vendor_details, - payout_vendor_details.individual_details, - ); - Ok(Self { - account_type: vendor_details.account_type, - country: address.country, - email: Some(customer_email.clone()), - capabilities_card_payments: vendor_details.capabilities_card_payments, - capabilities_transfers: vendor_details.capabilities_transfers, - tos_acceptance_date: individual_details.tos_acceptance_date, - tos_acceptance_ip: individual_details.tos_acceptance_ip, - business_type: vendor_details.business_type, - business_profile_mcc: vendor_details.business_profile_mcc, - business_profile_url: vendor_details.business_profile_url, - business_profile_name: vendor_details.business_profile_name.clone(), - company_name: vendor_details.business_profile_name, - company_address_line1: vendor_details.company_address_line1, - company_address_line2: vendor_details.company_address_line2, - company_address_postal_code: vendor_details.company_address_postal_code, - company_address_city: vendor_details.company_address_city, - company_address_state: vendor_details.company_address_state, - company_phone: vendor_details.company_phone, - company_tax_id: vendor_details.company_tax_id, - company_owners_provided: vendor_details.company_owners_provided, - individual_first_name: address.first_name, - individual_last_name: address.last_name, - individual_dob_day: individual_details.individual_dob_day, - individual_dob_month: individual_details.individual_dob_month, - individual_dob_year: individual_details.individual_dob_year, - individual_address_line1: address.line1, - individual_address_line2: address.line2, - individual_address_postal_code: address.zip, - individual_address_city: address.city, - individual_address_state: address.state, - individual_email: Some(customer_email), - individual_phone: customer_details.phone, - individual_id_number: individual_details.individual_id_number, - individual_ssn_last_4: individual_details.individual_ssn_last_4, - }) - } -} - -// Recipient creation response transform -impl TryFrom> - for types::PayoutsRouterData -{ - type Error = Error; - fn try_from( - item: types::PayoutsResponseRouterData, - ) -> Result { - let response: StripeConnectRecipientCreateResponse = item.response; - - Ok(Self { - response: Ok(types::PayoutsResponseData { - status: Some(enums::PayoutStatus::RequiresVendorAccountCreation), - connector_payout_id: response.id, - payout_eligible: None, - should_add_next_step_to_process_tracker: true, - }), - ..item.data - }) - } -} - -// Recipient account's creation request -impl TryFrom<&types::PayoutsRouterData> for StripeConnectRecipientAccountCreateRequest { - type Error = Error; - fn try_from(item: &types::PayoutsRouterData) -> Result { - let request = item.request.to_owned(); - let payout_method_data = item.get_payout_method_data()?; - let customer_details = request.get_customer_details()?; - let customer_name = customer_details.get_name()?; - let payout_vendor_details = request.get_vendor_details()?; - match payout_method_data { - api_models::payouts::PayoutMethodData::Card(_) => { - Ok(Self::Token(RecipientTokenRequest { - external_account: "tok_visa_debit".to_string(), - })) - } - api_models::payouts::PayoutMethodData::Bank(bank) => match bank { - api_models::payouts::Bank::Ach(bank_details) => { - Ok(Self::Bank(RecipientBankAccountRequest { - external_account_object: "bank_account".to_string(), - external_account_country: bank_details - .bank_country_code - .get_required_value("bank_country_code") - .change_context(errors::ConnectorError::MissingRequiredField { - field_name: "bank_country_code", - })?, - external_account_currency: request.destination_currency.to_owned(), - external_account_account_holder_name: customer_name, - external_account_account_holder_type: payout_vendor_details - .individual_details - .get_external_account_account_holder_type()?, - external_account_account_number: bank_details.bank_account_number, - external_account_routing_number: bank_details.bank_routing_number, - })) - } - api_models::payouts::Bank::Bacs(_) => Err(errors::ConnectorError::NotSupported { - message: "BACS payouts are not supported".to_string(), - connector: "stripe", - } - .into()), - api_models::payouts::Bank::Sepa(_) => Err(errors::ConnectorError::NotSupported { - message: "SEPA payouts are not supported".to_string(), - connector: "stripe", - } - .into()), - api_models::payouts::Bank::Pix(_) => Err(errors::ConnectorError::NotSupported { - message: "PIX payouts are not supported".to_string(), - connector: "stripe", - } - .into()), - }, - api_models::payouts::PayoutMethodData::Wallet(_) => { - Err(errors::ConnectorError::NotSupported { - message: "Payouts via wallets are not supported".to_string(), - connector: "stripe", - } - .into()) - } - } - } -} - -// Recipient account's creation response -impl TryFrom> - for types::PayoutsRouterData -{ - type Error = Error; - fn try_from( - item: types::PayoutsResponseRouterData, - ) -> Result { - let response: StripeConnectRecipientAccountCreateResponse = item.response; - - Ok(Self { - response: Ok(types::PayoutsResponseData { - status: Some(enums::PayoutStatus::RequiresCreation), - connector_payout_id: response.id, - payout_eligible: None, - should_add_next_step_to_process_tracker: false, - }), - ..item.data - }) - } -} - -impl From for enums::PayoutStatus { - fn from(stripe_connect_status: StripeConnectPayoutStatus) -> Self { - match stripe_connect_status { - StripeConnectPayoutStatus::Paid => Self::Success, - StripeConnectPayoutStatus::Failed => Self::Failed, - StripeConnectPayoutStatus::Canceled => Self::Cancelled, - StripeConnectPayoutStatus::Pending | StripeConnectPayoutStatus::InTransit => { - Self::Pending - } - } - } -} diff --git a/crates/router/src/connector/threedsecureio.rs b/crates/router/src/connector/threedsecureio.rs index 77fda3e864e..ecb80433594 100644 --- a/crates/router/src/connector/threedsecureio.rs +++ b/crates/router/src/connector/threedsecureio.rs @@ -303,7 +303,7 @@ impl types::authentication::ConnectorAuthenticationRouterData, errors::ConnectorError, > { - let response: threedsecureio::ThreedsecureioAuthenticationResponse = res + let response = res .response .parse_struct("ThreedsecureioAuthenticationResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; diff --git a/crates/router/src/connector/threedsecureio/transformers.rs b/crates/router/src/connector/threedsecureio/transformers.rs index f0a2f116a40..2d662e5e30f 100644 --- a/crates/router/src/connector/threedsecureio/transformers.rs +++ b/crates/router/src/connector/threedsecureio/transformers.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; use serde_json::{json, to_string}; use crate::{ - connector::utils::{get_card_details, to_connector_meta, AddressDetailsData, CardData}, + connector::utils::{to_connector_meta, AddressDetailsData, CardData, SELECTED_PAYMENT_METHOD}, consts::{BASE64_ENGINE, NO_ERROR_MESSAGE}, core::errors, types::{ @@ -106,7 +106,7 @@ impl ) .change_context(errors::ConnectorError::ParsingFailed)?, connector_authentication_id: pre_authn_response.threeds_server_trans_id, - three_ds_method_data: Some(three_ds_method_data_base64), + three_ds_method_data: three_ds_method_data_base64, three_ds_method_url: pre_authn_response.threeds_method_url, message_version: common_utils::types::SemanticVersion::from_str( &pre_authn_response.acs_end_protocol_version, @@ -243,6 +243,18 @@ impl TryFrom<&types::ConnectorAuthType> for ThreedsecureioAuthType { } } +fn get_card_details( + payment_method_data: api_models::payments::PaymentMethodData, +) -> Result { + match payment_method_data { + api_models::payments::PaymentMethodData::Card(details) => Ok(details), + _ => Err(errors::ConnectorError::NotSupported { + message: SELECTED_PAYMENT_METHOD.to_string(), + connector: "threedsecureio", + })?, + } +} + impl TryFrom<&ThreedsecureioRouterData<&types::authentication::ConnectorAuthenticationRouterData>> for ThreedsecureioAuthenticationRequest { @@ -264,7 +276,7 @@ impl TryFrom<&ThreedsecureioRouterData<&types::authentication::ConnectorAuthenti } } }?; - let card_details = get_card_details(request.payment_method_data.clone(), "threedsecureio")?; + let card_details = get_card_details(request.payment_method_data.clone())?; let currency = request .currency .map(|currency| currency.to_string()) @@ -315,9 +327,6 @@ impl TryFrom<&ThreedsecureioRouterData<&types::authentication::ConnectorAuthenti })?; let meta: ThreeDSecureIoConnectorMetaData = to_connector_meta(request.pre_authentication_data.connector_metadata.clone())?; - - let card_holder_name = billing_address.get_optional_full_name(); - Ok(Self { ds_start_protocol_version: meta.ds_start_protocol_version.clone(), ds_end_protocol_version: meta.ds_end_protocol_version.clone(), @@ -404,7 +413,7 @@ impl TryFrom<&ThreedsecureioRouterData<&types::authentication::ConnectorAuthenti merchant_country_code: connector_meta_data.merchant_country_code, merchant_name: connector_meta_data.merchant_name, message_type: "AReq".to_string(), - message_version: pre_authentication_data.message_version.to_string(), + message_version: pre_authentication_data.message_version.clone(), purchase_amount: item.amount.clone(), purchase_currency: purchase_currency.numeric().to_string(), trans_type: "01".to_string(), @@ -442,7 +451,7 @@ impl TryFrom<&ThreedsecureioRouterData<&types::authentication::ConnectorAuthenti }), DeviceChannel::Browser => None, }, - cardholder_name: card_holder_name, + cardholder_name: card_details.card_holder_name, email: request.email.clone(), }) } diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs index 1f9e77de9cd..ed4978743dd 100644 --- a/crates/router/src/connector/trustpay.rs +++ b/crates/router/src/connector/trustpay.rs @@ -999,9 +999,7 @@ impl services::ConnectorRedirectResponse for Trustpay { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs index c40435c01bb..d898bd24896 100644 --- a/crates/router/src/connector/trustpay/transformers.rs +++ b/crates/router/src/connector/trustpay/transformers.rs @@ -1,5 +1,6 @@ use std::collections::HashMap; +use api_models::payments::BankRedirectData; use common_utils::{ errors::CustomResult, pii::{self, Email}, @@ -17,7 +18,7 @@ use crate::{ consts, core::errors, services, - types::{self, domain, storage::enums, BrowserInformation}, + types::{self, api, storage::enums, BrowserInformation}, }; type Error = error_stack::Report; @@ -228,27 +229,27 @@ pub struct TrustpayMandatoryParams { pub billing_first_name: Secret, } -impl TryFrom<&domain::BankRedirectData> for TrustpayPaymentMethod { +impl TryFrom<&BankRedirectData> for TrustpayPaymentMethod { type Error = Error; - fn try_from(value: &domain::BankRedirectData) -> Result { + fn try_from(value: &BankRedirectData) -> Result { match value { - domain::BankRedirectData::Giropay { .. } => Ok(Self::Giropay), - domain::BankRedirectData::Eps { .. } => Ok(Self::Eps), - domain::BankRedirectData::Ideal { .. } => Ok(Self::IDeal), - domain::BankRedirectData::Sofort { .. } => Ok(Self::Sofort), - domain::BankRedirectData::Blik { .. } => Ok(Self::Blik), - domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::Przelewy24 { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } => { + api_models::payments::BankRedirectData::Giropay { .. } => Ok(Self::Giropay), + api_models::payments::BankRedirectData::Eps { .. } => Ok(Self::Eps), + api_models::payments::BankRedirectData::Ideal { .. } => Ok(Self::IDeal), + api_models::payments::BankRedirectData::Sofort { .. } => Ok(Self::Sofort), + api_models::payments::BankRedirectData::Blik { .. } => Ok(Self::Blik), + api_models::payments::BankRedirectData::BancontactCard { .. } + | api_models::payments::BankRedirectData::Bizum {} + | api_models::payments::BankRedirectData::Interac { .. } + | api_models::payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | api_models::payments::BankRedirectData::OnlineBankingFinland { .. } + | api_models::payments::BankRedirectData::OnlineBankingPoland { .. } + | api_models::payments::BankRedirectData::OnlineBankingSlovakia { .. } + | api_models::payments::BankRedirectData::OpenBankingUk { .. } + | api_models::payments::BankRedirectData::Przelewy24 { .. } + | api_models::payments::BankRedirectData::Trustly { .. } + | api_models::payments::BankRedirectData::OnlineBankingFpx { .. } + | api_models::payments::BankRedirectData::OnlineBankingThailand { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("trustpay"), ) @@ -280,7 +281,7 @@ fn get_card_request_data( browser_info: &BrowserInformation, params: TrustpayMandatoryParams, amount: String, - ccard: &domain::payments::Card, + ccard: &api_models::payments::Card, return_url: String, ) -> Result { let email = item.request.get_email()?; @@ -357,7 +358,7 @@ fn get_debtor_info( fn get_bank_redirection_request_data( item: &types::PaymentsAuthorizeRouterData, - bank_redirection_data: &domain::BankRedirectData, + bank_redirection_data: &BankRedirectData, params: TrustpayMandatoryParams, amount: String, auth: TrustpayAuthType, @@ -417,7 +418,7 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsAuthorizeRouterData>> for Trust let auth = TrustpayAuthType::try_from(&item.router_data.connector_auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => Ok(get_card_request_data( + api::PaymentMethodData::Card(ref ccard) => Ok(get_card_request_data( item.router_data, &default_browser_info, params, @@ -425,7 +426,7 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsAuthorizeRouterData>> for Trust ccard, item.router_data.request.get_return_url()?, )?), - domain::PaymentMethodData::BankRedirect(ref bank_redirection_data) => { + api::PaymentMethodData::BankRedirect(ref bank_redirection_data) => { get_bank_redirection_request_data( item.router_data, bank_redirection_data, @@ -434,23 +435,21 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsAuthorizeRouterData>> for Trust auth, ) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("trustpay"), - ) - .into()) - } + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("trustpay"), + ) + .into()), } } } @@ -1222,7 +1221,7 @@ pub fn get_apple_pay_session( }, ), payment_request_data: Some(api_models::payments::ApplePayPaymentRequest { - country_code: apple_pay_init_result.country_code, + country_code: Some(apple_pay_init_result.country_code), currency_code: apple_pay_init_result.currency_code, supported_networks: Some(apple_pay_init_result.supported_networks.clone()), merchant_capabilities: Some( diff --git a/crates/router/src/connector/tsys/transformers.rs b/crates/router/src/connector/tsys/transformers.rs index 6ffe1f1ed7f..a01576bbb20 100644 --- a/crates/router/src/connector/tsys/transformers.rs +++ b/crates/router/src/connector/tsys/transformers.rs @@ -6,7 +6,7 @@ use crate::{ connector::utils::{self, CardData, PaymentsAuthorizeRequestData, RefundsRequestData}, core::errors, types::{ - self, api, domain, + self, api, storage::{self, enums}, }, }; @@ -41,7 +41,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for TsysPaymentsRequest { type Error = error_stack::Report; fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => { + api::PaymentMethodData::Card(ccard) => { let connector_auth: TsysAuthType = TsysAuthType::try_from(&item.connector_auth_type)?; let auth_data: TsysPaymentAuthSaleRequest = TsysPaymentAuthSaleRequest { @@ -66,23 +66,21 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for TsysPaymentsRequest { Ok(Self::Auth(auth_data)) } } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("tsys"), - ))? - } + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankRedirect(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("tsys"), + ))?, } } } diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index 7e22ba614df..180cf3be4a9 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -1,10 +1,8 @@ use std::collections::HashMap; -#[cfg(feature = "payouts")] -use api_models::payouts::PayoutVendorAccountDetails; use api_models::{ enums::{CanadaStatesAbbreviation, UsStatesAbbreviation}, - payments::{self, OrderDetailsWithAmount}, + payments::{self, BankDebitBilling, OrderDetailsWithAmount}, }; use base64::Engine; use common_utils::{ @@ -12,9 +10,9 @@ use common_utils::{ errors::ReportSwitchExt, pii::{self, Email, IpAddress}, }; +use data_models::payments::payment_attempt::PaymentAttempt; use diesel_models::enums; use error_stack::{report, ResultExt}; -use hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt; use masking::{ExposeInterface, Secret}; use once_cell::sync::Lazy; use regex::Regex; @@ -27,12 +25,12 @@ use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, - payments::{types::AuthenticationData, PaymentData, RecurringMandatePaymentData}, + payments::{PaymentData, RecurringMandatePaymentData}, }, pii::PeekInterface, types::{ - self, api, domain, transformers::ForeignTryFrom, ApplePayPredecryptData, - BrowserInformation, PaymentsCancelData, ResponseId, + self, api, transformers::ForeignTryFrom, ApplePayPredecryptData, BrowserInformation, + PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; @@ -74,9 +72,6 @@ pub trait RouterData { fn get_shipping_address_with_phone_number(&self) -> Result<&api::Address, Error>; fn get_connector_meta(&self) -> Result; fn get_session_token(&self) -> Result; - fn get_billing_first_name(&self) -> Result, Error>; - fn get_billing_email(&self) -> Result; - fn get_billing_phone_number(&self) -> Result, Error>; fn to_connector_meta(&self) -> Result where T: serde::de::DeserializeOwned; @@ -93,18 +88,6 @@ pub trait RouterData { fn get_optional_billing(&self) -> Option<&api::Address>; fn get_optional_shipping(&self) -> Option<&api::Address>; - - fn get_optional_billing_full_name(&self) -> Option>; - fn get_optional_billing_line1(&self) -> Option>; - fn get_optional_billing_line2(&self) -> Option>; - fn get_optional_billing_city(&self) -> Option; - fn get_optional_billing_country(&self) -> Option; - fn get_optional_billing_zip(&self) -> Option>; - fn get_optional_billing_state(&self) -> Option>; - fn get_optional_billing_first_name(&self) -> Option>; - fn get_optional_billing_last_name(&self) -> Option>; - fn get_optional_billing_phone_number(&self) -> Option>; - fn get_optional_billing_email(&self) -> Option; } pub trait PaymentResponseRouterData { @@ -219,140 +202,6 @@ impl RouterData for types::RouterData Result, Error> { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .address - .and_then(|billing_address_details| billing_address_details.first_name.clone()) - }) - .ok_or_else(missing_field_err( - "payment_method_data.billing.address.first_name", - )) - } - - fn get_billing_email(&self) -> Result { - self.address - .get_payment_method_billing() - .and_then(|billing_address| billing_address.email.clone()) - .ok_or_else(missing_field_err("payment_method_data.billing.email")) - } - - fn get_billing_phone_number(&self) -> Result, Error> { - self.address - .get_payment_method_billing() - .and_then(|billing_address| billing_address.clone().phone) - .map(|phone_details| phone_details.get_number_with_country_code()) - .transpose()? - .ok_or_else(missing_field_err("payment_method_data.billing.phone")) - } - - fn get_optional_billing_line1(&self) -> Option> { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .address - .and_then(|billing_address_details| billing_address_details.line1) - }) - } - - fn get_optional_billing_line2(&self) -> Option> { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .address - .and_then(|billing_address_details| billing_address_details.line2) - }) - } - - fn get_optional_billing_city(&self) -> Option { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .address - .and_then(|billing_address_details| billing_address_details.city) - }) - } - - fn get_optional_billing_country(&self) -> Option { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .address - .and_then(|billing_address_details| billing_address_details.country) - }) - } - - fn get_optional_billing_zip(&self) -> Option> { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .address - .and_then(|billing_address_details| billing_address_details.zip) - }) - } - - fn get_optional_billing_state(&self) -> Option> { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .address - .and_then(|billing_address_details| billing_address_details.state) - }) - } - - fn get_optional_billing_first_name(&self) -> Option> { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .address - .and_then(|billing_address_details| billing_address_details.first_name) - }) - } - - fn get_optional_billing_last_name(&self) -> Option> { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .address - .and_then(|billing_address_details| billing_address_details.last_name) - }) - } - - fn get_optional_billing_phone_number(&self) -> Option> { - self.address - .get_payment_method_billing() - .and_then(|billing_address| { - billing_address - .clone() - .phone - .and_then(|phone_data| phone_data.number) - }) - } - - fn get_optional_billing_email(&self) -> Option { - self.address - .get_payment_method_billing() - .and_then(|billing_address| billing_address.clone().email) - } fn to_connector_meta(&self) -> Result where T: serde::de::DeserializeOwned, @@ -408,12 +257,6 @@ impl RouterData for types::RouterData Option> { - self.get_optional_billing() - .and_then(|billing_details| billing_details.address.as_ref()) - .and_then(|billing_address| billing_address.get_optional_full_name()) - } - #[cfg(feature = "payouts")] fn get_payout_method_data(&self) -> Result { self.payout_method_data @@ -521,7 +364,6 @@ impl RevokeMandateRequestData for types::MandateRevokeRequestData { pub trait PaymentsSetupMandateRequestData { fn get_browser_info(&self) -> Result; fn get_email(&self) -> Result; - fn is_card(&self) -> bool; } impl PaymentsSetupMandateRequestData for types::SetupMandateRequestData { @@ -533,16 +375,13 @@ impl PaymentsSetupMandateRequestData for types::SetupMandateRequestData { fn get_email(&self) -> Result { self.email.clone().ok_or_else(missing_field_err("email")) } - fn is_card(&self) -> bool { - matches!(self.payment_method_data, domain::PaymentMethodData::Card(_)) - } } pub trait PaymentsAuthorizeRequestData { fn is_auto_capture(&self) -> Result; fn get_email(&self) -> Result; fn get_browser_info(&self) -> Result; fn get_order_details(&self) -> Result, Error>; - fn get_card(&self) -> Result; + fn get_card(&self) -> Result; fn get_return_url(&self) -> Result; fn connector_mandate_id(&self) -> Option; fn is_mandate_payment(&self) -> bool; @@ -559,8 +398,6 @@ pub trait PaymentsAuthorizeRequestData { fn get_surcharge_amount(&self) -> Option; fn get_tax_on_surcharge_amount(&self) -> Option; fn get_total_surcharge_amount(&self) -> Option; - fn get_metadata_as_object(&self) -> Option; - fn get_authentication_data(&self) -> Result; } pub trait PaymentMethodTokenizationRequestData { @@ -597,9 +434,9 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData { .ok_or_else(missing_field_err("order_details")) } - fn get_card(&self) -> Result { + fn get_card(&self) -> Result { match self.payment_method_data.clone() { - domain::PaymentMethodData::Card(card) => Ok(card), + api::PaymentMethodData::Card(card) => Ok(card), _ => Err(missing_field_err("card")()), } } @@ -644,13 +481,10 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData { .ok_or_else(missing_field_err("return_url")) } fn is_wallet(&self) -> bool { - matches!( - self.payment_method_data, - domain::PaymentMethodData::Wallet(_) - ) + matches!(self.payment_method_data, api::PaymentMethodData::Wallet(_)) } fn is_card(&self) -> bool { - matches!(self.payment_method_data, domain::PaymentMethodData::Card(_)) + matches!(self.payment_method_data, api::PaymentMethodData::Card(_)) } fn get_payment_method_type(&self) -> Result { @@ -695,25 +529,6 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData { fn is_customer_initiated_mandate_payment(&self) -> bool { self.setup_mandate_details.is_some() } - - fn get_metadata_as_object(&self) -> Option { - self.metadata - .clone() - .and_then(|meta_data| match meta_data.peek() { - serde_json::Value::Null - | serde_json::Value::Bool(_) - | serde_json::Value::Number(_) - | serde_json::Value::String(_) - | serde_json::Value::Array(_) => None, - serde_json::Value::Object(_) => Some(meta_data), - }) - } - - fn get_authentication_data(&self) -> Result { - self.authentication_data - .clone() - .ok_or_else(missing_field_err("authentication_data")) - } } pub trait ConnectorCustomerData { @@ -848,66 +663,6 @@ impl PaymentsSyncRequestData for types::PaymentsSyncData { } } -#[cfg(feature = "payouts")] -pub trait CustomerDetails { - fn get_customer_id(&self) -> Result; - fn get_customer_name( - &self, - ) -> Result, errors::ConnectorError>; - fn get_customer_email(&self) -> Result; - fn get_customer_phone( - &self, - ) -> Result, errors::ConnectorError>; - fn get_customer_phone_country_code(&self) -> Result; -} - -#[cfg(feature = "payouts")] -impl CustomerDetails for types::CustomerDetails { - fn get_customer_id(&self) -> Result { - self.customer_id - .clone() - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "customer_id", - }) - } - - fn get_customer_name( - &self, - ) -> Result, errors::ConnectorError> { - self.name - .clone() - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "customer_name", - }) - } - - fn get_customer_email(&self) -> Result { - self.email - .clone() - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "customer_email", - }) - } - - fn get_customer_phone( - &self, - ) -> Result, errors::ConnectorError> { - self.phone - .clone() - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "customer_phone", - }) - } - - fn get_customer_phone_country_code(&self) -> Result { - self.phone_country_code - .clone() - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "customer_phone_country_code", - }) - } -} - pub trait PaymentsCancelRequestData { fn get_amount(&self) -> Result; fn get_currency(&self) -> Result; @@ -960,32 +715,6 @@ impl RefundsRequestData for types::RefundsData { } } -#[cfg(feature = "payouts")] -pub trait PayoutsData { - fn get_transfer_id(&self) -> Result; - fn get_customer_details(&self) -> Result; - fn get_vendor_details(&self) -> Result; -} - -#[cfg(feature = "payouts")] -impl PayoutsData for types::PayoutsData { - fn get_transfer_id(&self) -> Result { - self.connector_payout_id - .clone() - .ok_or_else(missing_field_err("transfer_id")) - } - fn get_customer_details(&self) -> Result { - self.customer_details - .clone() - .ok_or_else(missing_field_err("customer_details")) - } - fn get_vendor_details(&self) -> Result { - self.vendor_details - .clone() - .ok_or_else(missing_field_err("vendor_details")) - } -} - #[derive(Clone, Debug, serde::Serialize)] #[serde(rename_all = "camelCase")] pub struct GooglePayWalletData { @@ -1010,8 +739,8 @@ pub struct GpayTokenizationData { pub token: Secret, } -impl From for GooglePayWalletData { - fn from(data: domain::GooglePayWalletData) -> Self { +impl From for GooglePayWalletData { + fn from(data: api_models::payments::GooglePayWalletData) -> Self { Self { pm_type: data.pm_type, description: data.description, @@ -1078,7 +807,7 @@ pub trait CardData { fn get_expiry_year_as_i32(&self) -> Result, Error>; } -impl CardData for domain::Card { +impl CardData for api::Card { fn get_card_expiry_year_2_digit(&self) -> Result, errors::ConnectorError> { let binding = self.card_exp_year.clone(); let year = binding.peek(); @@ -1173,7 +902,7 @@ pub trait WalletData { fn get_encoded_wallet_token(&self) -> Result; } -impl WalletData for domain::WalletData { +impl WalletData for api::WalletData { fn get_wallet_token(&self) -> Result, Error> { match self { Self::GooglePay(data) => Ok(Secret::new(data.tokenization_data.token.clone())), @@ -1214,7 +943,7 @@ pub trait ApplePay { fn get_applepay_decoded_payment_data(&self) -> Result, Error>; } -impl ApplePay for domain::ApplePayWalletData { +impl ApplePay for payments::ApplePayWalletData { fn get_applepay_decoded_payment_data(&self) -> Result, Error> { let token = Secret::new( String::from_utf8( @@ -1261,7 +990,7 @@ pub trait CryptoData { fn get_pay_currency(&self) -> Result; } -impl CryptoData for domain::CryptoData { +impl CryptoData for api::CryptoData { fn get_pay_currency(&self) -> Result { self.pay_currency .clone() @@ -1273,8 +1002,6 @@ pub trait PhoneDetailsData { fn get_number(&self) -> Result, Error>; fn get_country_code(&self) -> Result; fn get_number_with_country_code(&self) -> Result, Error>; - fn get_number_with_hash_country_code(&self) -> Result, Error>; - fn extract_country_code(&self) -> Result; } impl PhoneDetailsData for api::PhoneDetails { @@ -1283,10 +1010,6 @@ impl PhoneDetailsData for api::PhoneDetails { .clone() .ok_or_else(missing_field_err("billing.phone.country_code")) } - fn extract_country_code(&self) -> Result { - self.get_country_code() - .map(|cc| cc.trim_start_matches('+').to_string()) - } fn get_number(&self) -> Result, Error> { self.number .clone() @@ -1297,16 +1020,6 @@ impl PhoneDetailsData for api::PhoneDetails { let country_code = self.get_country_code()?; Ok(Secret::new(format!("{}{}", country_code, number.peek()))) } - fn get_number_with_hash_country_code(&self) -> Result, Error> { - let number = self.get_number()?; - let country_code = self.get_country_code()?; - let number_without_plus = country_code.trim_start_matches('+'); - Ok(Secret::new(format!( - "{}#{}", - number_without_plus, - number.peek() - ))) - } } pub trait AddressDetailsData { @@ -1321,7 +1034,6 @@ pub trait AddressDetailsData { fn get_country(&self) -> Result<&api_models::enums::CountryAlpha2, Error>; fn get_combined_address_line(&self) -> Result, Error>; fn to_state_code(&self) -> Result, Error>; - fn to_state_code_as_optional(&self) -> Result>, Error>; } impl AddressDetailsData for api::AddressDetails { @@ -1339,12 +1051,7 @@ impl AddressDetailsData for api::AddressDetails { fn get_full_name(&self) -> Result, Error> { let first_name = self.get_first_name()?.peek().to_owned(); - let last_name = self - .get_last_name() - .ok() - .cloned() - .unwrap_or(Secret::new("".to_string())); - let last_name = last_name.peek(); + let last_name = self.get_last_name()?.peek().to_owned(); let full_name = format!("{} {}", first_name, last_name).trim().to_string(); Ok(Secret::new(full_name)) } @@ -1405,25 +1112,13 @@ impl AddressDetailsData for api::AddressDetails { _ => Ok(state.clone()), } } - fn to_state_code_as_optional(&self) -> Result>, Error> { - self.state - .as_ref() - .map(|state| { - if state.peek().len() == 2 { - Ok(state.to_owned()) - } else { - self.to_state_code() - } - }) - .transpose() - } } pub trait BankRedirectBillingData { fn get_billing_name(&self) -> Result, Error>; } -impl BankRedirectBillingData for domain::BankRedirectBilling { +impl BankRedirectBillingData for payments::BankRedirectBilling { fn get_billing_name(&self) -> Result, Error> { self.billing_name .clone() @@ -1435,7 +1130,7 @@ pub trait BankDirectDebitBillingData { fn get_billing_country(&self) -> Result; } -impl BankDirectDebitBillingData for domain::BankDebitBilling { +impl BankDirectDebitBillingData for BankDebitBilling { fn get_billing_country(&self) -> Result { self.address .as_ref() @@ -2104,52 +1799,6 @@ pub fn is_refund_failure(status: enums::RefundStatus) -> bool { } } -impl - From<( - Option, - Option, - Option, - u16, - Option, - Option, - )> for types::ErrorResponse -{ - fn from( - (code, message, reason, http_code, attempt_status, connector_transaction_id): ( - Option, - Option, - Option, - u16, - Option, - Option, - ), - ) -> Self { - Self { - code: code.unwrap_or(consts::NO_ERROR_CODE.to_string()), - message: message - .clone() - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), - reason, - status_code: http_code, - attempt_status, - connector_transaction_id, - } - } -} - -pub fn get_card_details( - payment_method_data: domain::PaymentMethodData, - connector_name: &'static str, -) -> Result { - match payment_method_data { - domain::PaymentMethodData::Card(details) => Ok(details), - _ => Err(errors::ConnectorError::NotSupported { - message: SELECTED_PAYMENT_METHOD.to_string(), - connector: connector_name, - })?, - } -} - #[cfg(test)] mod error_code_error_message_tests { #![allow(clippy::unwrap_used)] diff --git a/crates/router/src/connector/volt/transformers.rs b/crates/router/src/connector/volt/transformers.rs index d3913296c09..317f40216f8 100644 --- a/crates/router/src/connector/volt/transformers.rs +++ b/crates/router/src/connector/volt/transformers.rs @@ -8,7 +8,7 @@ use crate::{ consts, core::errors, services, - types::{self, api, domain, storage::enums as storage_enums}, + types::{self, api, storage::enums as storage_enums}, }; const PASSWORD: &str = "password"; @@ -87,8 +87,8 @@ impl TryFrom<&VoltRouterData<&types::PaymentsAuthorizeRouterData>> for VoltPayme item: &VoltRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::BankRedirect(ref bank_redirect) => match bank_redirect { - domain::BankRedirectData::OpenBankingUk { .. } => { + api::PaymentMethodData::BankRedirect(ref bank_redirect) => match bank_redirect { + api_models::payments::BankRedirectData::OpenBankingUk { .. } => { let amount = item.amount; let currency_code = item.router_data.request.currency; let merchant_internal_reference = @@ -98,11 +98,10 @@ impl TryFrom<&VoltRouterData<&types::PaymentsAuthorizeRouterData>> for VoltPayme let payment_pending_url = item.router_data.request.router_return_url.clone(); let payment_cancel_url = item.router_data.request.router_return_url.clone(); let address = item.router_data.get_billing_address()?; - let first_name = address.get_first_name()?; let shopper = ShopperDetails { email: item.router_data.request.email.clone(), - first_name: first_name.to_owned(), - last_name: address.get_last_name().unwrap_or(first_name).to_owned(), + first_name: address.get_first_name()?.to_owned(), + last_name: address.get_last_name()?.to_owned(), reference: item.router_data.get_customer_id()?.to_owned(), }; let transaction_type = TransactionType::Services; //transaction_type is a form of enum, it is pre defined and value for this can not be taken from user so we are keeping it as Services as this transaction is type of service. @@ -119,41 +118,41 @@ impl TryFrom<&VoltRouterData<&types::PaymentsAuthorizeRouterData>> for VoltPayme transaction_type, }) } - domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Eps { .. } - | domain::BankRedirectData::Giropay { .. } - | domain::BankRedirectData::Ideal { .. } - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::Przelewy24 { .. } - | domain::BankRedirectData::Sofort { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } => { + api_models::payments::BankRedirectData::BancontactCard { .. } + | api_models::payments::BankRedirectData::Bizum {} + | api_models::payments::BankRedirectData::Blik { .. } + | api_models::payments::BankRedirectData::Eps { .. } + | api_models::payments::BankRedirectData::Giropay { .. } + | api_models::payments::BankRedirectData::Ideal { .. } + | api_models::payments::BankRedirectData::Interac { .. } + | api_models::payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | api_models::payments::BankRedirectData::OnlineBankingFinland { .. } + | api_models::payments::BankRedirectData::OnlineBankingPoland { .. } + | api_models::payments::BankRedirectData::OnlineBankingSlovakia { .. } + | api_models::payments::BankRedirectData::Przelewy24 { .. } + | api_models::payments::BankRedirectData::Sofort { .. } + | api_models::payments::BankRedirectData::Trustly { .. } + | api_models::payments::BankRedirectData::OnlineBankingFpx { .. } + | api_models::payments::BankRedirectData::OnlineBankingThailand { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Volt"), ) .into()) } }, - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::Card(_) + | api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::Wallet(_) + | api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Volt"), ) diff --git a/crates/router/src/connector/wise.rs b/crates/router/src/connector/wise.rs index 3a241fe4ed6..e4a49d7c566 100644 --- a/crates/router/src/connector/wise.rs +++ b/crates/router/src/connector/wise.rs @@ -628,7 +628,7 @@ impl _req: &types::PayoutsRouterData, _connectors: &settings::Connectors, ) -> CustomResult, errors::ConnectorError> { - // Eligibility check for cards is not implemented + // Eligiblity check for cards is not implemented Err( errors::ConnectorError::NotImplemented("Payout Eligibility for Wise".to_string()) .into(), diff --git a/crates/router/src/connector/wise/transformers.rs b/crates/router/src/connector/wise/transformers.rs index c3347fd9387..5416db2d439 100644 --- a/crates/router/src/connector/wise/transformers.rs +++ b/crates/router/src/connector/wise/transformers.rs @@ -13,6 +13,7 @@ use crate::{ types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, + transformers::ForeignFrom, }, }; use crate::{core::errors, types}; @@ -319,7 +320,7 @@ fn get_payout_bank_details( }?; match payout_method_data { PayoutMethodData::Bank(payouts::BankPayout::Ach(b)) => Ok(WiseBankDetails { - legal_type: LegalType::from(entity_type), + legal_type: LegalType::foreign_from(entity_type), address: Some(wise_address_details), account_number: Some(b.bank_account_number.to_owned()), abartn: Some(b.bank_routing_number), @@ -327,14 +328,14 @@ fn get_payout_bank_details( ..WiseBankDetails::default() }), PayoutMethodData::Bank(payouts::BankPayout::Bacs(b)) => Ok(WiseBankDetails { - legal_type: LegalType::from(entity_type), + legal_type: LegalType::foreign_from(entity_type), address: Some(wise_address_details), account_number: Some(b.bank_account_number.to_owned()), sort_code: Some(b.bank_sort_code), ..WiseBankDetails::default() }), PayoutMethodData::Bank(payouts::BankPayout::Sepa(b)) => Ok(WiseBankDetails { - legal_type: LegalType::from(entity_type), + legal_type: LegalType::foreign_from(entity_type), address: Some(wise_address_details), iban: Some(b.iban.to_owned()), bic: b.bic, @@ -408,7 +409,6 @@ impl TryFrom status: Some(storage_enums::PayoutStatus::RequiresCreation), connector_payout_id: response.id.to_string(), payout_eligible: None, - should_add_next_step_to_process_tracker: false, }), ..item.data }) @@ -454,7 +454,6 @@ impl TryFrom> status: Some(storage_enums::PayoutStatus::RequiresCreation), connector_payout_id: response.id, payout_eligible: None, - should_add_next_step_to_process_tracker: false, }), ..item.data }) @@ -507,7 +506,7 @@ impl TryFrom> item: types::PayoutsResponseRouterData, ) -> Result { let response: WisePayoutResponse = item.response; - let status = match storage_enums::PayoutStatus::from(response.status) { + let status = match storage_enums::PayoutStatus::foreign_from(response.status) { storage_enums::PayoutStatus::Cancelled => storage_enums::PayoutStatus::Cancelled, _ => storage_enums::PayoutStatus::RequiresFulfillment, }; @@ -517,7 +516,6 @@ impl TryFrom> status: Some(status), connector_payout_id: response.id.to_string(), payout_eligible: None, - should_add_next_step_to_process_tracker: false, }), ..item.data }) @@ -556,10 +554,9 @@ impl TryFrom> Ok(Self { response: Ok(types::PayoutsResponseData { - status: Some(storage_enums::PayoutStatus::from(response.status)), + status: Some(storage_enums::PayoutStatus::foreign_from(response.status)), connector_payout_id: "".to_string(), payout_eligible: None, - should_add_next_step_to_process_tracker: false, }), ..item.data }) @@ -567,8 +564,8 @@ impl TryFrom> } #[cfg(feature = "payouts")] -impl From for storage_enums::PayoutStatus { - fn from(wise_status: WiseStatus) -> Self { +impl ForeignFrom for storage_enums::PayoutStatus { + fn foreign_from(wise_status: WiseStatus) -> Self { match wise_status { WiseStatus::Completed => Self::Success, WiseStatus::Rejected => Self::Failed, @@ -581,8 +578,8 @@ impl From for storage_enums::PayoutStatus { } #[cfg(feature = "payouts")] -impl From for LegalType { - fn from(entity_type: PayoutEntityType) -> Self { +impl ForeignFrom for LegalType { + fn foreign_from(entity_type: PayoutEntityType) -> Self { match entity_type { PayoutEntityType::Individual | PayoutEntityType::Personal diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rs index 3dba5ea24e7..85d7afd8e4a 100644 --- a/crates/router/src/connector/worldline/transformers.rs +++ b/crates/router/src/connector/worldline/transformers.rs @@ -11,7 +11,6 @@ use crate::{ types::{ self, api::{self, enums as api_enums}, - domain, storage::enums, transformers::ForeignFrom, PaymentsAuthorizeData, PaymentsResponseData, @@ -236,36 +235,33 @@ impl >, >, ) -> Result { - let payment_data = - match &item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(card) => { - let card_holder_name = item.router_data.get_optional_billing_full_name(); - WorldlinePaymentMethod::CardPaymentMethodSpecificInput(Box::new( - make_card_request(&item.router_data.request, card, card_holder_name)?, - )) - } - domain::PaymentMethodData::BankRedirect(bank_redirect) => { - WorldlinePaymentMethod::RedirectPaymentMethodSpecificInput(Box::new( - make_bank_redirect_request(&item.router_data.request, bank_redirect)?, - )) - } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("worldline"), - ))? - } - }; + let payment_data = match &item.router_data.request.payment_method_data { + api::PaymentMethodData::Card(card) => { + WorldlinePaymentMethod::CardPaymentMethodSpecificInput(Box::new(make_card_request( + &item.router_data.request, + card, + )?)) + } + api::PaymentMethodData::BankRedirect(bank_redirect) => { + WorldlinePaymentMethod::RedirectPaymentMethodSpecificInput(Box::new( + make_bank_redirect_request(&item.router_data.request, bank_redirect)?, + )) + } + api::PaymentMethodData::CardRedirect(_) + | api::PaymentMethodData::Wallet(_) + | api::PaymentMethodData::PayLater(_) + | api::PaymentMethodData::BankDebit(_) + | api::PaymentMethodData::BankTransfer(_) + | api::PaymentMethodData::Crypto(_) + | api::PaymentMethodData::MandatePayment + | api::PaymentMethodData::Reward + | api::PaymentMethodData::Upi(_) + | api::PaymentMethodData::Voucher(_) + | api::PaymentMethodData::GiftCard(_) + | api::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("worldline"), + ))?, + }; let billing_address = item.router_data.get_billing()?; @@ -318,20 +314,20 @@ impl TryFrom for Gateway { } } -impl TryFrom<&common_enums::enums::BankNames> for WorldlineBic { +impl TryFrom<&api_models::enums::BankNames> for WorldlineBic { type Error = error_stack::Report; - fn try_from(bank: &common_enums::enums::BankNames) -> Result { + fn try_from(bank: &api_models::enums::BankNames) -> Result { match bank { - common_enums::enums::BankNames::AbnAmro => Ok(Self::Abnamro), - common_enums::enums::BankNames::AsnBank => Ok(Self::Asn), - common_enums::enums::BankNames::Ing => Ok(Self::Ing), - common_enums::enums::BankNames::Knab => Ok(Self::Knab), - common_enums::enums::BankNames::Rabobank => Ok(Self::Rabobank), - common_enums::enums::BankNames::Regiobank => Ok(Self::Regiobank), - common_enums::enums::BankNames::SnsBank => Ok(Self::Sns), - common_enums::enums::BankNames::TriodosBank => Ok(Self::Triodos), - common_enums::enums::BankNames::VanLanschot => Ok(Self::Vanlanschot), - common_enums::enums::BankNames::FrieslandBank => Ok(Self::Friesland), + api_models::enums::BankNames::AbnAmro => Ok(Self::Abnamro), + api_models::enums::BankNames::AsnBank => Ok(Self::Asn), + api_models::enums::BankNames::Ing => Ok(Self::Ing), + api_models::enums::BankNames::Knab => Ok(Self::Knab), + api_models::enums::BankNames::Rabobank => Ok(Self::Rabobank), + api_models::enums::BankNames::Regiobank => Ok(Self::Regiobank), + api_models::enums::BankNames::SnsBank => Ok(Self::Sns), + api_models::enums::BankNames::TriodosBank => Ok(Self::Triodos), + api_models::enums::BankNames::VanLanschot => Ok(Self::Vanlanschot), + api_models::enums::BankNames::FrieslandBank => Ok(Self::Friesland), _ => Err(errors::ConnectorError::FlowNotSupported { flow: bank.to_string(), connector: "Worldline".to_string(), @@ -343,8 +339,7 @@ impl TryFrom<&common_enums::enums::BankNames> for WorldlineBic { fn make_card_request( req: &PaymentsAuthorizeData, - ccard: &domain::Card, - card_holder_name: Option>, + ccard: &payments::Card, ) -> Result> { let expiry_year = ccard.card_exp_year.peek(); let secret_value = format!( @@ -357,7 +352,10 @@ fn make_card_request( let expiry_date: Secret = Secret::new(secret_value); let card = Card { card_number: ccard.card_number.clone(), - cardholder_name: card_holder_name.unwrap_or(Secret::new("".to_string())), + cardholder_name: ccard + .card_holder_name + .clone() + .unwrap_or(Secret::new("".to_string())), cvv: ccard.card_cvc.clone(), expiry_date, }; @@ -373,12 +371,12 @@ fn make_card_request( fn make_bank_redirect_request( req: &PaymentsAuthorizeData, - bank_redirect: &domain::BankRedirectData, + bank_redirect: &payments::BankRedirectData, ) -> Result> { let return_url = req.router_return_url.clone(); let redirection_data = RedirectionData { return_url }; let (payment_method_specific_data, payment_product_id) = match bank_redirect { - domain::BankRedirectData::Giropay { + payments::BankRedirectData::Giropay { billing_details, bank_account_iban, .. @@ -398,7 +396,7 @@ fn make_bank_redirect_request( }, 816, ), - domain::BankRedirectData::Ideal { bank_name, .. } => ( + payments::BankRedirectData::Ideal { bank_name, .. } => ( { PaymentMethodSpecificData::PaymentProduct809SpecificInput(Box::new(Ideal { issuer_id: bank_name @@ -408,21 +406,21 @@ fn make_bank_redirect_request( }, 809, ), - domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Eps { .. } - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::Przelewy24 { .. } - | domain::BankRedirectData::Sofort { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } => { + payments::BankRedirectData::BancontactCard { .. } + | payments::BankRedirectData::Bizum {} + | payments::BankRedirectData::Blik { .. } + | payments::BankRedirectData::Eps { .. } + | payments::BankRedirectData::Interac { .. } + | payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | payments::BankRedirectData::OnlineBankingFinland { .. } + | payments::BankRedirectData::OnlineBankingPoland { .. } + | payments::BankRedirectData::OnlineBankingSlovakia { .. } + | payments::BankRedirectData::OpenBankingUk { .. } + | payments::BankRedirectData::Przelewy24 { .. } + | payments::BankRedirectData::Sofort { .. } + | payments::BankRedirectData::Trustly { .. } + | payments::BankRedirectData::OnlineBankingFpx { .. } + | payments::BankRedirectData::OnlineBankingThailand { .. } => { return Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("worldline"), ) diff --git a/crates/router/src/connector/worldpay/transformers.rs b/crates/router/src/connector/worldpay/transformers.rs index 35a2f8cee8a..dd92984eb99 100644 --- a/crates/router/src/connector/worldpay/transformers.rs +++ b/crates/router/src/connector/worldpay/transformers.rs @@ -9,7 +9,7 @@ use crate::{ connector::utils, consts, core::errors, - types::{self, domain, PaymentsAuthorizeData, PaymentsResponseData}, + types::{self, api, PaymentsAuthorizeData, PaymentsResponseData}, }; #[derive(Debug, Serialize)] @@ -41,10 +41,10 @@ impl } } fn fetch_payment_instrument( - payment_method: domain::PaymentMethodData, + payment_method: api::PaymentMethodData, ) -> CustomResult { match payment_method { - domain::PaymentMethodData::Card(card) => Ok(PaymentInstrument::Card(CardPayment { + api::PaymentMethodData::Card(card) => Ok(PaymentInstrument::Card(CardPayment { card_expiry_date: CardExpiryDate { month: utils::CardData::get_expiry_month_as_i8(&card)?, year: utils::CardData::get_expiry_year_as_i32(&card)?, @@ -52,62 +52,68 @@ fn fetch_payment_instrument( card_number: card.card_number, ..CardPayment::default() })), - domain::PaymentMethodData::Wallet(wallet) => match wallet { - domain::WalletData::GooglePay(data) => { + api::PaymentMethodData::Wallet(wallet) => match wallet { + api_models::payments::WalletData::GooglePay(data) => { Ok(PaymentInstrument::Googlepay(WalletPayment { payment_type: PaymentType::Googlepay, wallet_token: Secret::new(data.tokenization_data.token), ..WalletPayment::default() })) } - domain::WalletData::ApplePay(data) => Ok(PaymentInstrument::Applepay(WalletPayment { - payment_type: PaymentType::Applepay, - wallet_token: Secret::new(data.payment_data), - ..WalletPayment::default() - })), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::WeChatPayQr(_) => Err(errors::ConnectorError::NotImplemented( + api_models::payments::WalletData::ApplePay(data) => { + Ok(PaymentInstrument::Applepay(WalletPayment { + payment_type: PaymentType::Applepay, + wallet_token: Secret::new(data.payment_data), + ..WalletPayment::default() + })) + } + api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayRedirect(_) + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) + | api_models::payments::WalletData::WeChatPayQr(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("worldpay"), + ) + .into()) + } + }, + api_models::payments::PaymentMethodData::PayLater(_) + | api_models::payments::PaymentMethodData::BankRedirect(_) + | api_models::payments::PaymentMethodData::BankDebit(_) + | api_models::payments::PaymentMethodData::BankTransfer(_) + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::Voucher(_) + | api_models::payments::PaymentMethodData::CardRedirect(_) + | api_models::payments::PaymentMethodData::GiftCard(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { + Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("worldpay"), ) - .into()), - }, - domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("worldpay"), - ) - .into()), + .into()) + } } } diff --git a/crates/router/src/connector/zen.rs b/crates/router/src/connector/zen.rs index b28ad2e968a..7c28dfcc43a 100644 --- a/crates/router/src/connector/zen.rs +++ b/crates/router/src/connector/zen.rs @@ -197,7 +197,7 @@ impl ConnectorIntegration CustomResult)>, errors::ConnectorError> { let mut headers = self.build_headers(req, connectors)?; let api_headers = match req.request.payment_method_data { - domain::payments::PaymentMethodData::Wallet(_) => None, + api_models::payments::PaymentMethodData::Wallet(_) => None, _ => Some(Self::get_default_header()), }; if let Some(api_header) = api_headers { @@ -216,7 +216,7 @@ impl ConnectorIntegration CustomResult { let endpoint = match &req.request.payment_method_data { - domain::payments::PaymentMethodData::Wallet(_) => { + api_models::payments::PaymentMethodData::Wallet(_) => { let base_url = connectors .zen .secondary_base_url @@ -710,9 +710,7 @@ impl services::ConnectorRedirectResponse for Zen { action: services::PaymentAction, ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + services::PaymentAction::PSync | services::PaymentAction::CompleteAuthorize => { Ok(payments::CallConnectorAction::Trigger) } } diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rs index ead716af721..3e527423578 100644 --- a/crates/router/src/connector/zen/transformers.rs +++ b/crates/router/src/connector/zen/transformers.rs @@ -1,3 +1,4 @@ +use api_models::payments::Card; use cards::CardNumber; use common_utils::{ext_traits::ValueExt, pii}; use error_stack::ResultExt; @@ -13,7 +14,7 @@ use crate::{ consts, core::errors::{self, CustomResult}, services::{self, Method}, - types::{self, api, domain, storage::enums, transformers::ForeignTryFrom}, + types::{self, api, storage::enums, transformers::ForeignTryFrom}, utils::OptionExt, }; @@ -203,18 +204,10 @@ pub struct WalletSessionData { pub pay_wall_secret: Option>, } -impl - TryFrom<( - &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, - )> for ZenPaymentsRequest -{ +impl TryFrom<(&ZenRouterData<&types::PaymentsAuthorizeRouterData>, &Card)> for ZenPaymentsRequest { type Error = error_stack::Report; fn try_from( - value: ( - &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, - ), + value: (&ZenRouterData<&types::PaymentsAuthorizeRouterData>, &Card), ) -> Result { let (item, ccard) = value; let browser_info = item.router_data.request.get_browser_info()?; @@ -257,14 +250,14 @@ impl impl TryFrom<( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::VoucherData, + &api_models::payments::VoucherData, )> for ZenPaymentsRequest { type Error = error_stack::Report; fn try_from( value: ( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::VoucherData, + &api_models::payments::VoucherData, ), ) -> Result { let (item, voucher_data) = value; @@ -278,22 +271,30 @@ impl return_url: item.router_data.request.get_router_return_url()?, }); let payment_channel = match voucher_data { - domain::VoucherData::Boleto { .. } => ZenPaymentChannels::PclBoacompraBoleto, - domain::VoucherData::Efecty => ZenPaymentChannels::PclBoacompraEfecty, - domain::VoucherData::PagoEfectivo => ZenPaymentChannels::PclBoacompraPagoefectivo, - domain::VoucherData::RedCompra => ZenPaymentChannels::PclBoacompraRedcompra, - domain::VoucherData::RedPagos => ZenPaymentChannels::PclBoacompraRedpagos, - domain::VoucherData::Oxxo { .. } - | domain::VoucherData::Alfamart { .. } - | domain::VoucherData::Indomaret { .. } - | domain::VoucherData::SevenEleven { .. } - | domain::VoucherData::Lawson { .. } - | domain::VoucherData::MiniStop { .. } - | domain::VoucherData::FamilyMart { .. } - | domain::VoucherData::Seicomart { .. } - | domain::VoucherData::PayEasy { .. } => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Zen"), - ))?, + api_models::payments::VoucherData::Boleto { .. } => { + ZenPaymentChannels::PclBoacompraBoleto + } + api_models::payments::VoucherData::Efecty => ZenPaymentChannels::PclBoacompraEfecty, + api_models::payments::VoucherData::PagoEfectivo => { + ZenPaymentChannels::PclBoacompraPagoefectivo + } + api_models::payments::VoucherData::RedCompra => { + ZenPaymentChannels::PclBoacompraRedcompra + } + api_models::payments::VoucherData::RedPagos => ZenPaymentChannels::PclBoacompraRedpagos, + api_models::payments::VoucherData::Oxxo { .. } + | api_models::payments::VoucherData::Alfamart { .. } + | api_models::payments::VoucherData::Indomaret { .. } + | api_models::payments::VoucherData::SevenEleven { .. } + | api_models::payments::VoucherData::Lawson { .. } + | api_models::payments::VoucherData::MiniStop { .. } + | api_models::payments::VoucherData::FamilyMart { .. } + | api_models::payments::VoucherData::Seicomart { .. } + | api_models::payments::VoucherData::PayEasy { .. } => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Zen"), + ))? + } }; Ok(Self::ApiRequest(Box::new(ApiRequest { merchant_transaction_id: item.router_data.connector_request_reference_id.clone(), @@ -311,14 +312,14 @@ impl impl TryFrom<( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &Box, + &Box, )> for ZenPaymentsRequest { type Error = error_stack::Report; fn try_from( value: ( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &Box, + &Box, ), ) -> Result { let (item, bank_transfer_data) = value; @@ -332,22 +333,25 @@ impl return_url: item.router_data.request.get_router_return_url()?, }); let payment_channel = match **bank_transfer_data { - domain::BankTransferData::MultibancoBankTransfer { .. } => { + api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => { ZenPaymentChannels::PclBoacompraMultibanco } - domain::BankTransferData::Pix { .. } => ZenPaymentChannels::PclBoacompraPix, - domain::BankTransferData::Pse { .. } => ZenPaymentChannels::PclBoacompraPse, - domain::BankTransferData::SepaBankTransfer { .. } - | domain::BankTransferData::AchBankTransfer { .. } - | domain::BankTransferData::BacsBankTransfer { .. } - | domain::BankTransferData::PermataBankTransfer { .. } - | domain::BankTransferData::BcaBankTransfer { .. } - | domain::BankTransferData::BniVaBankTransfer { .. } - | domain::BankTransferData::BriVaBankTransfer { .. } - | domain::BankTransferData::CimbVaBankTransfer { .. } - | domain::BankTransferData::DanamonVaBankTransfer { .. } - | domain::BankTransferData::LocalBankTransfer { .. } - | domain::BankTransferData::MandiriVaBankTransfer { .. } => { + api_models::payments::BankTransferData::Pix { .. } => { + ZenPaymentChannels::PclBoacompraPix + } + api_models::payments::BankTransferData::Pse { .. } => { + ZenPaymentChannels::PclBoacompraPse + } + api_models::payments::BankTransferData::SepaBankTransfer { .. } + | api_models::payments::BankTransferData::AchBankTransfer { .. } + | api_models::payments::BankTransferData::BacsBankTransfer { .. } + | api_models::payments::BankTransferData::PermataBankTransfer { .. } + | api_models::payments::BankTransferData::BcaBankTransfer { .. } + | api_models::payments::BankTransferData::BniVaBankTransfer { .. } + | api_models::payments::BankTransferData::BriVaBankTransfer { .. } + | api_models::payments::BankTransferData::CimbVaBankTransfer { .. } + | api_models::payments::BankTransferData::DanamonVaBankTransfer { .. } + | api_models::payments::BankTransferData::MandiriVaBankTransfer { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ))? @@ -449,14 +453,14 @@ impl impl TryFrom<( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &api_models::payments::WalletData, )> for ZenPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, wallet_data): ( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &api_models::payments::WalletData, ), ) -> Result { let amount = item.amount.to_owned(); @@ -465,7 +469,7 @@ impl .parse_value("SessionObject") .change_context(errors::ConnectorError::RequestEncodingFailed)?; let (specified_payment_channel, session_data) = match wallet_data { - domain::WalletData::ApplePayRedirect(_) => ( + api_models::payments::WalletData::ApplePayRedirect(_) => ( ZenPaymentChannels::PclApplepay, session .apple_pay @@ -473,7 +477,7 @@ impl wallet_name: "Apple Pay".to_string(), })?, ), - domain::WalletData::GooglePayRedirect(_) => ( + api_models::payments::WalletData::GooglePayRedirect(_) => ( ZenPaymentChannels::PclGooglepay, session .google_pay @@ -481,32 +485,34 @@ impl wallet_name: "Google Pay".to_string(), })?, ), - domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::GooglePay(_) - | domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::WeChatPayQr(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Zen"), - ))?, + api_models::payments::WalletData::WeChatPayRedirect(_) + | api_models::payments::WalletData::PaypalRedirect(_) + | api_models::payments::WalletData::ApplePay(_) + | api_models::payments::WalletData::GooglePay(_) + | api_models::payments::WalletData::AliPayQr(_) + | api_models::payments::WalletData::AliPayRedirect(_) + | api_models::payments::WalletData::AliPayHkRedirect(_) + | api_models::payments::WalletData::MomoRedirect(_) + | api_models::payments::WalletData::KakaoPayRedirect(_) + | api_models::payments::WalletData::GoPayRedirect(_) + | api_models::payments::WalletData::GcashRedirect(_) + | api_models::payments::WalletData::ApplePayThirdPartySdk(_) + | api_models::payments::WalletData::DanaRedirect {} + | api_models::payments::WalletData::GooglePayThirdPartySdk(_) + | api_models::payments::WalletData::MbWayRedirect(_) + | api_models::payments::WalletData::MobilePayRedirect(_) + | api_models::payments::WalletData::PaypalSdk(_) + | api_models::payments::WalletData::SamsungPay(_) + | api_models::payments::WalletData::TwintRedirect {} + | api_models::payments::WalletData::VippsRedirect {} + | api_models::payments::WalletData::TouchNGoRedirect(_) + | api_models::payments::WalletData::CashappQr(_) + | api_models::payments::WalletData::SwishQr(_) + | api_models::payments::WalletData::WeChatPayQr(_) => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Zen"), + ))? + } }; let terminal_uuid = session_data .terminal_uuid @@ -679,32 +685,36 @@ impl TryFrom<&ZenRouterData<&types::PaymentsAuthorizeRouterData>> for ZenPayment item: &ZenRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { match &item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(card) => Self::try_from((item, card)), - domain::PaymentMethodData::Wallet(wallet_data) => Self::try_from((item, wallet_data)), - domain::PaymentMethodData::Voucher(voucher_data) => { + api_models::payments::PaymentMethodData::Card(card) => Self::try_from((item, card)), + api_models::payments::PaymentMethodData::Wallet(wallet_data) => { + Self::try_from((item, wallet_data)) + } + api_models::payments::PaymentMethodData::Voucher(voucher_data) => { Self::try_from((item, voucher_data)) } - domain::PaymentMethodData::BankTransfer(bank_transfer_data) => { + api_models::payments::PaymentMethodData::BankTransfer(bank_transfer_data) => { Self::try_from((item, bank_transfer_data)) } - domain::PaymentMethodData::BankRedirect(bank_redirect_data) => { + api_models::payments::PaymentMethodData::BankRedirect(bank_redirect_data) => { Self::try_from(bank_redirect_data) } - domain::PaymentMethodData::PayLater(paylater_data) => Self::try_from(paylater_data), - domain::PaymentMethodData::BankDebit(bank_debit_data) => { + api_models::payments::PaymentMethodData::PayLater(paylater_data) => { + Self::try_from(paylater_data) + } + api_models::payments::PaymentMethodData::BankDebit(bank_debit_data) => { Self::try_from(bank_debit_data) } - domain::PaymentMethodData::CardRedirect(car_redirect_data) => { + api_models::payments::PaymentMethodData::CardRedirect(car_redirect_data) => { Self::try_from(car_redirect_data) } - domain::PaymentMethodData::GiftCard(gift_card_data) => { + api_models::payments::PaymentMethodData::GiftCard(gift_card_data) => { Self::try_from(gift_card_data.as_ref()) } - domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::CardToken(_) => { + api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::MandatePayment + | api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Upi(_) + | api_models::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ))? @@ -713,27 +723,27 @@ impl TryFrom<&ZenRouterData<&types::PaymentsAuthorizeRouterData>> for ZenPayment } } -impl TryFrom<&domain::BankRedirectData> for ZenPaymentsRequest { +impl TryFrom<&api_models::payments::BankRedirectData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::BankRedirectData) -> Result { + fn try_from(value: &api_models::payments::BankRedirectData) -> Result { match value { - domain::BankRedirectData::Ideal { .. } - | domain::BankRedirectData::Sofort { .. } - | domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::Eps { .. } - | domain::BankRedirectData::Giropay { .. } - | domain::BankRedirectData::Przelewy24 { .. } - | domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } => { + api_models::payments::BankRedirectData::Ideal { .. } + | api_models::payments::BankRedirectData::Sofort { .. } + | api_models::payments::BankRedirectData::BancontactCard { .. } + | api_models::payments::BankRedirectData::Blik { .. } + | api_models::payments::BankRedirectData::Trustly { .. } + | api_models::payments::BankRedirectData::Eps { .. } + | api_models::payments::BankRedirectData::Giropay { .. } + | api_models::payments::BankRedirectData::Przelewy24 { .. } + | api_models::payments::BankRedirectData::Bizum {} + | api_models::payments::BankRedirectData::Interac { .. } + | api_models::payments::BankRedirectData::OnlineBankingCzechRepublic { .. } + | api_models::payments::BankRedirectData::OnlineBankingFinland { .. } + | api_models::payments::BankRedirectData::OnlineBankingPoland { .. } + | api_models::payments::BankRedirectData::OnlineBankingSlovakia { .. } + | api_models::payments::BankRedirectData::OpenBankingUk { .. } + | api_models::payments::BankRedirectData::OnlineBankingFpx { .. } + | api_models::payments::BankRedirectData::OnlineBankingThailand { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ) @@ -743,18 +753,18 @@ impl TryFrom<&domain::BankRedirectData> for ZenPaymentsRequest { } } -impl TryFrom<&domain::payments::PayLaterData> for ZenPaymentsRequest { +impl TryFrom<&api_models::payments::PayLaterData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::payments::PayLaterData) -> Result { + fn try_from(value: &api_models::payments::PayLaterData) -> Result { match value { - domain::payments::PayLaterData::KlarnaRedirect { .. } - | domain::payments::PayLaterData::KlarnaSdk { .. } - | domain::payments::PayLaterData::AffirmRedirect {} - | domain::payments::PayLaterData::AfterpayClearpayRedirect { .. } - | domain::payments::PayLaterData::PayBrightRedirect {} - | domain::payments::PayLaterData::WalleyRedirect {} - | domain::payments::PayLaterData::AlmaRedirect {} - | domain::payments::PayLaterData::AtomeRedirect {} => { + api_models::payments::PayLaterData::KlarnaRedirect { .. } + | api_models::payments::PayLaterData::KlarnaSdk { .. } + | api_models::payments::PayLaterData::AffirmRedirect {} + | api_models::payments::PayLaterData::AfterpayClearpayRedirect { .. } + | api_models::payments::PayLaterData::PayBrightRedirect {} + | api_models::payments::PayLaterData::WalleyRedirect {} + | api_models::payments::PayLaterData::AlmaRedirect {} + | api_models::payments::PayLaterData::AtomeRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ) @@ -764,14 +774,14 @@ impl TryFrom<&domain::payments::PayLaterData> for ZenPaymentsRequest { } } -impl TryFrom<&domain::BankDebitData> for ZenPaymentsRequest { +impl TryFrom<&api_models::payments::BankDebitData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::BankDebitData) -> Result { + fn try_from(value: &api_models::payments::BankDebitData) -> Result { match value { - domain::BankDebitData::AchBankDebit { .. } - | domain::BankDebitData::SepaBankDebit { .. } - | domain::BankDebitData::BecsBankDebit { .. } - | domain::BankDebitData::BacsBankDebit { .. } => { + api_models::payments::BankDebitData::AchBankDebit { .. } + | api_models::payments::BankDebitData::SepaBankDebit { .. } + | api_models::payments::BankDebitData::BecsBankDebit { .. } + | api_models::payments::BankDebitData::BacsBankDebit { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ) @@ -781,14 +791,14 @@ impl TryFrom<&domain::BankDebitData> for ZenPaymentsRequest { } } -impl TryFrom<&domain::payments::CardRedirectData> for ZenPaymentsRequest { +impl TryFrom<&api_models::payments::CardRedirectData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::payments::CardRedirectData) -> Result { + fn try_from(value: &api_models::payments::CardRedirectData) -> Result { match value { - domain::payments::CardRedirectData::Knet {} - | domain::payments::CardRedirectData::Benefit {} - | domain::payments::CardRedirectData::MomoAtm {} - | domain::payments::CardRedirectData::CardRedirect {} => { + api_models::payments::CardRedirectData::Knet {} + | api_models::payments::CardRedirectData::Benefit {} + | api_models::payments::CardRedirectData::MomoAtm {} + | api_models::payments::CardRedirectData::CardRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ) @@ -798,11 +808,12 @@ impl TryFrom<&domain::payments::CardRedirectData> for ZenPaymentsRequest { } } -impl TryFrom<&domain::GiftCardData> for ZenPaymentsRequest { +impl TryFrom<&api_models::payments::GiftCardData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::GiftCardData) -> Result { + fn try_from(value: &api_models::payments::GiftCardData) -> Result { match value { - domain::GiftCardData::PaySafeCard {} | domain::GiftCardData::Givex(_) => { + api_models::payments::GiftCardData::PaySafeCard {} + | api_models::payments::GiftCardData::Givex(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ) diff --git a/crates/router/src/connector/zsl.rs b/crates/router/src/connector/zsl.rs deleted file mode 100644 index 5d5a95b0a83..00000000000 --- a/crates/router/src/connector/zsl.rs +++ /dev/null @@ -1,468 +0,0 @@ -pub mod transformers; - -use std::fmt::Debug; - -use common_utils::ext_traits::ValueExt; -use diesel_models::enums; -use error_stack::ResultExt; -use masking::ExposeInterface; -use transformers as zsl; - -use crate::{ - configs::settings, - connector::utils as connector_utils, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{ - self, - request::{self}, - ConnectorIntegration, ConnectorValidation, - }, - types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - transformers::ForeignFrom, - ErrorResponse, RequestContent, Response, - }, - utils::BytesExt, -}; - -#[derive(Debug, Clone)] -pub struct Zsl; - -impl api::Payment for Zsl {} -impl api::PaymentSession for Zsl {} -impl api::ConnectorAccessToken for Zsl {} -impl api::MandateSetup for Zsl {} -impl api::PaymentAuthorize for Zsl {} -impl api::PaymentSync for Zsl {} -impl api::PaymentCapture for Zsl {} -impl api::PaymentVoid for Zsl {} -impl api::Refund for Zsl {} -impl api::RefundExecute for Zsl {} -impl api::RefundSync for Zsl {} -impl api::PaymentToken for Zsl {} - -impl ConnectorCommonExt for Zsl -where - Self: ConnectorIntegration, -{ - fn build_headers( - &self, - _req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - let header = vec![( - headers::CONTENT_TYPE.to_string(), - self.get_content_type().to_string().into(), - )]; - Ok(header) - } -} - -impl ConnectorCommon for Zsl { - fn id(&self) -> &'static str { - "zsl" - } - - fn get_currency_unit(&self) -> api::CurrencyUnit { - api::CurrencyUnit::Minor - } - - fn common_get_content_type(&self) -> &'static str { - "application/x-www-form-urlencoded" - } - - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { - connectors.zsl.base_url.as_ref() - } - - fn build_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - let response = serde_urlencoded::from_bytes::(&res.response) - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - let error_reason = zsl::ZslResponseStatus::try_from(response.status.clone())?.to_string(); - - Ok(ErrorResponse { - status_code: res.status_code, - code: response.status, - message: error_reason.clone(), - reason: Some(error_reason), - attempt_status: Some(common_enums::AttemptStatus::Failure), - connector_transaction_id: None, - }) - } -} - -impl ConnectorValidation for Zsl { - fn validate_capture_method( - &self, - capture_method: Option, - _pmt: Option, - ) -> CustomResult<(), errors::ConnectorError> { - let capture_method = capture_method.unwrap_or_default(); - match capture_method { - enums::CaptureMethod::Automatic => Ok(()), - enums::CaptureMethod::Manual - | enums::CaptureMethod::ManualMultiple - | enums::CaptureMethod::Scheduled => Err( - connector_utils::construct_not_supported_error_report(capture_method, self.id()), - ), - } - } - - fn is_webhook_source_verification_mandatory(&self) -> bool { - true - } -} - -impl ConnectorIntegration - for Zsl -{ - fn get_headers( - &self, - req: &types::PaymentsAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( - &self, - _req: &types::PaymentsAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult { - Ok(format!("{}ecp", self.base_url(connectors))) - } - - fn get_request_body( - &self, - req: &types::PaymentsAuthorizeRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult { - let connector_router_data = zsl::ZslRouterData::try_from(( - &self.get_currency_unit(), - req.request.currency, - req.request.amount, - req, - ))?; - let connector_req = zsl::ZslPaymentsRequest::try_from(&connector_router_data)?; - Ok(RequestContent::FormUrlEncoded(Box::new(connector_req))) - } - - fn build_request( - &self, - req: &types::PaymentsAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsAuthorizeType::get_url( - self, req, connectors, - )?) - .attach_default_headers() - .headers(types::PaymentsAuthorizeType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsAuthorizeType::get_request_body( - self, req, connectors, - )?) - .build(), - )) - } - - fn handle_response( - &self, - data: &types::PaymentsAuthorizeRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult { - let response = serde_urlencoded::from_bytes::(&res.response) - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i: &mut ConnectorEvent| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } - - fn get_5xx_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) - } -} - -impl ConnectorIntegration - for Zsl -{ - fn handle_response( - &self, - data: &types::PaymentsSyncRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult { - let response: zsl::ZslWebhookResponse = res - .response - .parse_struct("ZslWebhookResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - - event_builder.map(|i: &mut ConnectorEvent| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - - types::RouterData::try_from(types::ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } -} - -impl ConnectorIntegration - for Zsl -{ - fn build_request( - &self, - _req: &types::PaymentsSessionRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Err(errors::ConnectorError::NotSupported { - message: "Session flow".to_owned(), - connector: "Zsl", - } - .into()) - } -} - -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Zsl -{ - fn build_request( - &self, - _req: &types::TokenizationRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Err(errors::ConnectorError::NotSupported { - message: "PaymentMethod Tokenization flow ".to_owned(), - connector: "Zsl", - } - .into()) - } -} - -impl ConnectorIntegration - for Zsl -{ - fn build_request( - &self, - _req: &types::RefreshTokenRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Err(errors::ConnectorError::NotSupported { - message: "AccessTokenAuth flow".to_owned(), - connector: "Zsl", - } - .into()) - } -} - -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Zsl -{ - fn build_request( - &self, - _req: &types::RouterData< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - >, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Err(errors::ConnectorError::NotSupported { - message: "SetupMandate flow".to_owned(), - connector: "Zsl", - } - .into()) - } -} - -impl ConnectorIntegration - for Zsl -{ - fn build_request( - &self, - _req: &types::PaymentsCaptureRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Err(errors::ConnectorError::NotSupported { - message: "Capture flow".to_owned(), - connector: "Zsl", - } - .into()) - } -} - -impl ConnectorIntegration - for Zsl -{ - fn build_request( - &self, - _req: &types::PaymentsCancelRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Err(errors::ConnectorError::NotSupported { - message: "Void flow ".to_owned(), - connector: "Zsl", - } - .into()) - } -} - -impl ConnectorIntegration for Zsl { - fn build_request( - &self, - _req: &types::RefundsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Err(errors::ConnectorError::NotSupported { - message: "Refund flow".to_owned(), - connector: "Zsl", - } - .into()) - } -} - -impl ConnectorIntegration for Zsl { - fn build_request( - &self, - _req: &types::RefundSyncRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - Err(errors::ConnectorError::NotSupported { - message: "Rsync flow ".to_owned(), - connector: "Zsl", - } - .into()) - } -} - -#[async_trait::async_trait] -impl api::IncomingWebhook for Zsl { - fn get_webhook_object_reference_id( - &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - let notif = get_webhook_object_from_body(request.body) - .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?; - Ok(api_models::webhooks::ObjectReferenceId::PaymentId( - api_models::payments::PaymentIdType::PaymentAttemptId(notif.mer_ref), - )) - } - - fn get_webhook_event_type( - &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - let notif = get_webhook_object_from_body(request.body) - .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?; - - Ok(api_models::webhooks::IncomingWebhookEvent::foreign_from( - notif.status, - )) - } - - fn get_webhook_resource_object( - &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult, errors::ConnectorError> { - let response = get_webhook_object_from_body(request.body) - .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?; - Ok(Box::new(response)) - } - - async fn verify_webhook_source( - &self, - request: &api::IncomingWebhookRequestDetails<'_>, - _merchant_account: &types::domain::MerchantAccount, - merchant_connector_account: types::domain::MerchantConnectorAccount, - _connector_label: &str, - ) -> CustomResult { - let connector_account_details = merchant_connector_account - .connector_account_details - .parse_value::("ConnectorAuthType") - .change_context_lazy(|| errors::ConnectorError::WebhookSourceVerificationFailed)?; - let auth_type = zsl::ZslAuthType::try_from(&connector_account_details)?; - let key = auth_type.api_key.expose(); - let mer_id = auth_type.merchant_id.expose(); - let webhook_response = get_webhook_object_from_body(request.body)?; - let signature = zsl::calculate_signature( - webhook_response.enctype, - zsl::ZslSignatureType::WebhookSignature { - status: webhook_response.status, - txn_id: webhook_response.txn_id, - txn_date: webhook_response.txn_date, - paid_ccy: webhook_response.paid_ccy.to_string(), - paid_amt: webhook_response.paid_amt, - mer_ref: webhook_response.mer_ref, - mer_id, - key, - }, - )?; - - Ok(signature.eq(&webhook_response.signature)) - } - - fn get_webhook_api_response( - &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult, errors::ConnectorError> - { - Ok(services::api::ApplicationResponse::TextPlain( - "CALLBACK-OK".to_string(), - )) - } -} - -fn get_webhook_object_from_body( - body: &[u8], -) -> CustomResult { - let response: zsl::ZslWebhookResponse = - serde_urlencoded::from_bytes::(body) - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - Ok(response) -} diff --git a/crates/router/src/connector/zsl/transformers.rs b/crates/router/src/connector/zsl/transformers.rs deleted file mode 100644 index 3ffd5b2ccef..00000000000 --- a/crates/router/src/connector/zsl/transformers.rs +++ /dev/null @@ -1,933 +0,0 @@ -use std::collections::HashMap; - -use base64::Engine; -use common_utils::{crypto::GenerateDigest, date_time, pii::Email}; -use error_stack::ResultExt; -use masking::{ExposeInterface, Secret}; -use ring::digest; -use serde::{Deserialize, Serialize}; - -use crate::{ - connector::utils::{self as connector_utils, PaymentsAuthorizeRequestData, RouterData}, - consts, - core::errors, - services, - types::{self, domain, storage::enums}, -}; - -mod auth_error { - pub const INVALID_SIGNATURE: &str = "INVALID_SIGNATURE"; -} -mod zsl_version { - pub const VERSION_1: &str = "1"; -} - -pub struct ZslRouterData { - pub amount: String, - pub router_data: T, -} - -impl - TryFrom<( - &types::api::CurrencyUnit, - types::storage::enums::Currency, - i64, - T, - )> for ZslRouterData -{ - type Error = error_stack::Report; - fn try_from( - (currency_unit, currency, txn_amount, item): ( - &types::api::CurrencyUnit, - types::storage::enums::Currency, - i64, - T, - ), - ) -> Result { - let amount = connector_utils::get_amount_as_string(currency_unit, txn_amount, currency)?; - Ok(Self { - amount, - router_data: item, - }) - } -} - -pub struct ZslAuthType { - pub(super) api_key: Secret, - pub(super) merchant_id: Secret, -} - -impl TryFrom<&types::ConnectorAuthType> for ZslAuthType { - type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { - match auth_type { - types::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { - api_key: api_key.to_owned(), - merchant_id: key1.clone(), - }), - _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), - } - } -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ZslPaymentsRequest { - process_type: ProcessType, - process_code: ProcessCode, - txn_amt: String, - ccy: api_models::enums::Currency, - mer_ref: String, - mer_txn_date: String, - mer_id: Secret, - lang: String, - success_url: String, - failure_url: String, - success_s2s_url: String, - failure_s2s_url: String, - enctype: EncodingType, - signature: Secret, - country: api_models::enums::CountryAlpha2, - verno: String, - service_code: ServiceCode, - cust_tag: String, - #[serde(flatten)] - payment_method: ZslPaymentMethods, - name: Option>, - family_name: Option>, - tel_phone: Option>, - email: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ZslPaymentMethods { - LocalBankTransfer(LocalBankTransaferRequest), -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct LocalBankTransaferRequest { - bank_code: Option, - pay_method: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub enum ProcessType { - #[serde(rename = "0200")] - PaymentRequest, - #[serde(rename = "0208")] - PaymentResponse, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub enum ProcessCode { - #[serde(rename = "200002")] - API, - #[serde(rename = "200003")] - CallBack, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub enum EncodingType { - #[serde(rename = "1")] - MD5, - #[serde(rename = "2")] - Sha1, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "UPPERCASE")] -pub enum ServiceCode { - MPG, -} - -impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPaymentsRequest { - type Error = error_stack::Report; - fn try_from( - item: &ZslRouterData<&types::PaymentsAuthorizeRouterData>, - ) -> Result { - let payment_method = match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::BankTransfer(bank_transfer_data) => { - match *bank_transfer_data { - domain::BankTransferData::LocalBankTransfer { bank_code } => Ok( - ZslPaymentMethods::LocalBankTransfer(LocalBankTransaferRequest { - bank_code, - pay_method: None, - }), - ), - domain::BankTransferData::AchBankTransfer { .. } - | domain::BankTransferData::SepaBankTransfer { .. } - | domain::BankTransferData::BacsBankTransfer { .. } - | domain::BankTransferData::MultibancoBankTransfer { .. } - | domain::BankTransferData::PermataBankTransfer { .. } - | domain::BankTransferData::BcaBankTransfer { .. } - | domain::BankTransferData::BniVaBankTransfer { .. } - | domain::BankTransferData::BriVaBankTransfer { .. } - | domain::BankTransferData::CimbVaBankTransfer { .. } - | domain::BankTransferData::DanamonVaBankTransfer { .. } - | domain::BankTransferData::MandiriVaBankTransfer { .. } - | domain::BankTransferData::Pix {} - | domain::BankTransferData::Pse {} => { - Err(errors::ConnectorError::NotImplemented( - connector_utils::get_unimplemented_payment_method_error_message( - item.router_data.connector.as_str(), - ), - )) - } - } - } - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { - Err(errors::ConnectorError::NotImplemented( - connector_utils::get_unimplemented_payment_method_error_message( - item.router_data.connector.as_str(), - ), - )) - } - }?; - let auth_type = ZslAuthType::try_from(&item.router_data.connector_auth_type)?; - let key: Secret = auth_type.api_key; - let mer_id = auth_type.merchant_id; - let mer_txn_date = - date_time::format_date(date_time::now(), date_time::DateFormat::YYYYMMDDHHmmss) - .change_context(errors::ConnectorError::RequestEncodingFailed)?; - let txn_amt = item.amount.clone(); - let ccy = item.router_data.request.currency; - let mer_ref = item.router_data.connector_request_reference_id.clone(); - let signature = calculate_signature( - EncodingType::MD5, - ZslSignatureType::RequestSignature { - txn_amt: txn_amt.clone(), - ccy: ccy.to_string(), - mer_ref: mer_ref.clone(), - mer_id: mer_id.clone().expose(), - mer_txn_date: mer_txn_date.clone(), - key: key.expose(), - }, - )?; - let tel_phone = item.router_data.get_optional_billing_phone_number(); - let email = item.router_data.get_optional_billing_email(); - let name = item.router_data.get_optional_billing_first_name(); - let family_name = item.router_data.get_optional_billing_last_name(); - let router_url = item.router_data.request.get_router_return_url()?; - let webhook_url = item.router_data.request.get_webhook_url()?; - let billing_country = item.router_data.get_billing_country()?; - - let lang = item - .router_data - .request - .browser_info - .as_ref() - .and_then(|browser_data| { - browser_data.language.as_ref().map(|language| { - language - .split_once('-') - .map_or(language.to_uppercase(), |(lang, _)| lang.to_uppercase()) - }) - }) - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "browser_info.language", - })?; - - let cust_tag = item - .router_data - .customer_id - .clone() - .and_then(|customer_id| { - let cust_id = customer_id.replace(['_', '-'], ""); - let id_len = cust_id.len(); - if id_len > 10 { - cust_id.get(id_len - 10..id_len).map(|id| id.to_string()) - } else { - Some(cust_id) - } - }) - .ok_or(errors::ConnectorError::MissingRequiredField { - field_name: "customer_id", - })?; - - Ok(Self { - process_type: ProcessType::PaymentRequest, - process_code: ProcessCode::API, - txn_amt, - ccy, - mer_ref, - mer_txn_date, - mer_id, - lang, - success_url: router_url.clone(), - failure_url: router_url.clone(), - success_s2s_url: webhook_url.clone(), - failure_s2s_url: webhook_url.clone(), - enctype: EncodingType::MD5, - signature, - verno: zsl_version::VERSION_1.to_owned(), - service_code: ServiceCode::MPG, - country: billing_country, - payment_method, - name, - family_name, - tel_phone, - email, - cust_tag, - }) - } -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ZslPaymentsResponse { - process_type: ProcessType, - process_code: ProcessCode, - status: String, - mer_ref: String, - mer_id: String, - enctype: EncodingType, - txn_url: String, - signature: Secret, -} - -impl - TryFrom> - for types::RouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::ResponseRouterData, - ) -> Result { - if item.response.status.eq("0") && !item.response.txn_url.is_empty() { - let auth_type = ZslAuthType::try_from(&item.data.connector_auth_type)?; - let key: Secret = auth_type.api_key; - let mer_id = auth_type.merchant_id; - let calculated_signature = calculate_signature( - item.response.enctype, - ZslSignatureType::ResponseSignature { - status: item.response.status.clone(), - txn_url: item.response.txn_url.clone(), - mer_ref: item.response.mer_ref.clone(), - mer_id: mer_id.clone().expose(), - key: key.expose(), - }, - )?; - - if calculated_signature.clone().eq(&item.response.signature) { - let decoded_redirect_url_bytes: Vec = base64::engine::general_purpose::STANDARD - .decode(item.response.txn_url.clone()) - .change_context(errors::ConnectorError::RequestEncodingFailed)?; - - let redirect_url = String::from_utf8(decoded_redirect_url_bytes) - .change_context(errors::ConnectorError::RequestEncodingFailed)?; - - Ok(Self { - status: enums::AttemptStatus::AuthenticationPending, // Redirect is always expected after success response - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.mer_ref.clone(), - ), - redirection_data: Some(services::RedirectForm::Form { - endpoint: redirect_url, - method: services::Method::Get, - form_fields: HashMap::new(), - }), - mandate_reference: None, - connector_metadata: None, - network_txn_id: None, - connector_response_reference_id: Some(item.response.mer_ref.clone()), - incremental_authorization_allowed: None, - }), - ..item.data - }) - } else { - // When the signature check fails - Ok(Self { - status: enums::AttemptStatus::Failure, - response: Err(types::ErrorResponse { - code: consts::NO_ERROR_CODE.to_string(), - message: auth_error::INVALID_SIGNATURE.to_string(), - reason: Some(auth_error::INVALID_SIGNATURE.to_string()), - status_code: item.http_code, - attempt_status: Some(enums::AttemptStatus::Failure), - connector_transaction_id: Some(item.response.mer_ref.clone()), - }), - ..item.data - }) - } - } else { - let error_reason = - ZslResponseStatus::try_from(item.response.status.clone())?.to_string(); - Ok(Self { - status: enums::AttemptStatus::Failure, - response: Err(types::ErrorResponse { - code: item.response.status.clone(), - message: error_reason.clone(), - reason: Some(error_reason.clone()), - status_code: item.http_code, - attempt_status: Some(enums::AttemptStatus::Failure), - connector_transaction_id: Some(item.response.mer_ref.clone()), - }), - ..item.data - }) - } - } -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ZslWebhookResponse { - pub process_type: ProcessType, - pub process_code: ProcessCode, - pub status: String, - pub txn_id: String, - pub txn_date: String, - pub paid_ccy: api_models::enums::Currency, - pub paid_amt: String, - pub consr_paid_ccy: api_models::enums::Currency, - pub consr_paid_amt: String, - pub service_fee_ccy: api_models::enums::Currency, - pub service_fee: String, - pub txn_amt: String, - pub ccy: String, - pub mer_ref: String, - pub mer_txn_date: String, - pub mer_id: String, - pub enctype: EncodingType, - pub signature: Secret, -} - -impl types::transformers::ForeignFrom for api_models::webhooks::IncomingWebhookEvent { - fn foreign_from(status: String) -> Self { - match status.as_str() { - //any response with status != 0 are a failed deposit transaction - "0" => Self::PaymentIntentSuccess, - _ => Self::PaymentIntentFailure, - } - } -} - -impl TryFrom> - for types::RouterData -{ - type Error = error_stack::Report; - fn try_from( - item: types::ResponseRouterData, - ) -> Result { - if item.response.status == "0" { - Ok(Self { - status: enums::AttemptStatus::Charged, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.mer_ref.clone(), - ), - redirection_data: None, - mandate_reference: None, - connector_metadata: None, - network_txn_id: None, - connector_response_reference_id: Some(item.response.mer_ref.clone()), - incremental_authorization_allowed: None, - }), - ..item.data - }) - } else { - let error_reason = - ZslResponseStatus::try_from(item.response.status.clone())?.to_string(); - Ok(Self { - status: enums::AttemptStatus::Failure, - response: Err(types::ErrorResponse { - code: item.response.status.clone(), - message: error_reason.clone(), - reason: Some(error_reason.clone()), - status_code: item.http_code, - attempt_status: Some(enums::AttemptStatus::Failure), - connector_transaction_id: Some(item.response.mer_ref.clone()), - }), - ..item.data - }) - } - } -} - -impl TryFrom for ZslResponseStatus { - type Error = error_stack::Report; - fn try_from(status: String) -> Result { - match status.as_str() { - "0" => Ok(Self::Normal), - "1000" => Ok(Self::InternalError), - "1001" => Ok(Self::BreakDownMessageError), - "1002" => Ok(Self::FormatError), - "1004" => Ok(Self::InvalidTransaction), - "1005" => Ok(Self::TransactionCountryNotFound), - "1006" => Ok(Self::MerchantIdNotFound), - "1007" => Ok(Self::AccountDisabled), - "1008" => Ok(Self::DuplicateMerchantReference), - "1009" => Ok(Self::InvalidPayAmount), - "1010" => Ok(Self::PayAmountNotFound), - "1011" => Ok(Self::InvalidCurrencyCode), - "1012" => Ok(Self::CurrencyCodeNotFound), - "1013" => Ok(Self::ReferenceNotFound), - "1014" => Ok(Self::TransmissionTimeNotFound), - "1015" => Ok(Self::PayMethodNotFound), - "1016" => Ok(Self::BankCodeNotFound), - "1017" => Ok(Self::InvalidShowPayPage), - "1018" => Ok(Self::ShowPayPageNotFound), - "1019" => Ok(Self::SuccessUrlNotFound), - "1020" => Ok(Self::SuccessCallbackUrlNotFound), - "1021" => Ok(Self::FailUrlNotFound), - "1022" => Ok(Self::FailCallbackUrlNotFound), - "1023" => Ok(Self::MacNotFound), - "1025" => Ok(Self::OriginalTransactionNotFound), - "1026" => Ok(Self::DeblockDataError), - "1028" => Ok(Self::PspAckNotYetReturn), - "1029" => Ok(Self::BankBranchNameNotFound), - "1030" => Ok(Self::BankAccountIDNotFound), - "1031" => Ok(Self::BankAccountNameNotFound), - "1032" => Ok(Self::IdentityIDNotFound), - "1033" => Ok(Self::ErrorConnectingToPsp), - "1034" => Ok(Self::CountryPspNotAvailable), - "1035" => Ok(Self::UnsupportedPayAmount), - "1036" => Ok(Self::RecordMismatch), - "1037" => Ok(Self::NoRecord), - "1038" => Ok(Self::PspError), - "1039" => Ok(Self::UnsupportedEncryptionType), - "1040" => Ok(Self::ExceedTransactionLimitCount), - "1041" => Ok(Self::ExceedTransactionLimitAmount), - "1042" => Ok(Self::ExceedTransactionAccountLimitCount), - "1043" => Ok(Self::ExceedTransactionAccountLimitAmount), - "1044" => Ok(Self::ExchangeRateError), - "1045" => Ok(Self::InvalidEncoding), - "1046" => Ok(Self::CustomerNameNotFound), - "1047" => Ok(Self::CustomerFamilyNameNotFound), - "1048" => Ok(Self::CustomerTelPhoneNotFound), - "1049" => Ok(Self::InsufficientFund), - "1050" => Ok(Self::ServiceCodeIsMissing), - "1051" => Ok(Self::CurrencyIdNotMatch), - "1052" => Ok(Self::NoPendingRecord), - "1053" => Ok(Self::NoLoadBalancerRuleDefineForTransaction), - "1054" => Ok(Self::NoPaymentProviderAvailable), - "1055" => Ok(Self::UnsupportedPayMethod), - "1056" => Ok(Self::PendingTransaction), - "1057" => Ok(Self::OtherError1059), - "1058" => Ok(Self::OtherError1058), - "1059" => Ok(Self::OtherError1059), - "1084" => Ok(Self::InvalidRequestId), - "5043" => Ok(Self::BeneficiaryBankAccountIsNotAvailable), - "5053" => Ok(Self::BaidNotFound), - "5057" => Ok(Self::InvalidBaid), - "5059" => Ok(Self::InvalidBaidStatus), - "5107" => Ok(Self::AutoUploadBankDisabled), - "5108" => Ok(Self::InvalidNature), - "5109" => Ok(Self::SmsCreateDateNotFound), - "5110" => Ok(Self::InvalidSmsCreateDate), - "5111" => Ok(Self::RecordNotFound), - "5112" => Ok(Self::InsufficientBaidAvailableBalance), - "5113" => Ok(Self::ExceedTxnAmountLimit), - "5114" => Ok(Self::BaidBalanceNotFound), - "5115" => Ok(Self::AutoUploadIndicatorNotFound), - "5116" => Ok(Self::InvalidBankAcctStatus), - "5117" => Ok(Self::InvalidAutoUploadIndicator), - "5118" => Ok(Self::InvalidPidStatus), - "5119" => Ok(Self::InvalidProviderStatus), - "5120" => Ok(Self::InvalidBankAccountSystemSwitchEnabled), - "5121" => Ok(Self::AutoUploadProviderDisabled), - "5122" => Ok(Self::AutoUploadBankNotFound), - "5123" => Ok(Self::AutoUploadBankAcctNotFound), - "5124" => Ok(Self::AutoUploadProviderNotFound), - "5125" => Ok(Self::UnsupportedBankCode), - "5126" => Ok(Self::BalanceOverrideIndicatorNotFound), - "5127" => Ok(Self::InvalidBalanceOverrideIndicator), - "10000" => Ok(Self::VernoInvalid), - "10001" => Ok(Self::ServiceCodeInvalid), - "10002" => Ok(Self::PspResponseSignatureIsNotValid), - "10003" => Ok(Self::ProcessTypeNotFound), - "10004" => Ok(Self::ProcessCodeNotFound), - "10005" => Ok(Self::EnctypeNotFound), - "10006" => Ok(Self::VernoNotFound), - "10007" => Ok(Self::DepositBankNotFound), - "10008" => Ok(Self::DepositFlowNotFound), - "10009" => Ok(Self::CustDepositDateNotFound), - "10010" => Ok(Self::CustTagNotFound), - "10011" => Ok(Self::CountryValueInvalid), - "10012" => Ok(Self::CurrencyCodeValueInvalid), - "10013" => Ok(Self::MerTxnDateInvalid), - "10014" => Ok(Self::CustDepositDateInvalid), - "10015" => Ok(Self::TxnAmtInvalid), - "10016" => Ok(Self::SuccessCallbackUrlInvalid), - "10017" => Ok(Self::DepositFlowInvalid), - "10018" => Ok(Self::ProcessTypeInvalid), - "10019" => Ok(Self::ProcessCodeInvalid), - "10020" => Ok(Self::UnsupportedMerRefLength), - "10021" => Ok(Self::DepositBankLengthOverLimit), - "10022" => Ok(Self::CustTagLengthOverLimit), - "10023" => Ok(Self::SignatureLengthOverLimit), - "10024" => Ok(Self::RequestContainInvalidTag), - "10025" => Ok(Self::RequestSignatureNotMatch), - "10026" => Ok(Self::InvalidCustomer), - "10027" => Ok(Self::SchemeNotFound), - "10028" => Ok(Self::PspResponseFieldsMissing), - "10029" => Ok(Self::PspResponseMerRefNotMatchWithRequestMerRef), - "10030" => Ok(Self::PspResponseMerIdNotMatchWithRequestMerId), - "10031" => Ok(Self::UpdateDepositFailAfterResponse), - "10032" => Ok(Self::UpdateUsedLimitTransactionCountFailAfterSuccessResponse), - "10033" => Ok(Self::UpdateCustomerLastDepositRecordAfterSuccessResponse), - "10034" => Ok(Self::CreateDepositFail), - "10035" => Ok(Self::CreateDepositMsgFail), - "10036" => Ok(Self::UpdateStatusSubStatusFail), - "10037" => Ok(Self::AddDepositRecordToSchemeAccount), - "10038" => Ok(Self::EmptyResponse), - "10039" => Ok(Self::AubConfirmErrorFromPh), - "10040" => Ok(Self::ProviderEmailAddressNotFound), - "10041" => Ok(Self::AubConnectionTimeout), - "10042" => Ok(Self::AubConnectionIssue), - "10043" => Ok(Self::AubMsgTypeMissing), - "10044" => Ok(Self::AubMsgCodeMissing), - "10045" => Ok(Self::AubVersionMissing), - "10046" => Ok(Self::AubEncTypeMissing), - "10047" => Ok(Self::AubSignMissing), - "10048" => Ok(Self::AubInfoMissing), - "10049" => Ok(Self::AubErrorCodeMissing), - "10050" => Ok(Self::AubMsgTypeInvalid), - "10051" => Ok(Self::AubMsgCodeInvalid), - "10052" => Ok(Self::AubBaidMissing), - "10053" => Ok(Self::AubResponseSignNotMatch), - "10054" => Ok(Self::SmsConnectionTimeout), - "10055" => Ok(Self::SmsConnectionIssue), - "10056" => Ok(Self::SmsConfirmErrorFromPh), - "10057" => Ok(Self::SmsMsgTypeMissing), - "10058" => Ok(Self::SmsMsgCodeMissing), - "10059" => Ok(Self::SmsVersionMissing), - "10060" => Ok(Self::SmsEncTypeMissing), - "10061" => Ok(Self::SmsSignMissing), - "10062" => Ok(Self::SmsInfoMissing), - "10063" => Ok(Self::SmsErrorCodeMissing), - "10064" => Ok(Self::SmsMsgTypeInvalid), - "10065" => Ok(Self::SmsMsgCodeInvalid), - "10066" => Ok(Self::SmsResponseSignNotMatch), - "10067" => Ok(Self::SmsRequestReachMaximumLimit), - "10068" => Ok(Self::SyncConnectionTimeout), - "10069" => Ok(Self::SyncConnectionIssue), - "10070" => Ok(Self::SyncConfirmErrorFromPh), - "10071" => Ok(Self::SyncMsgTypeMissing), - "10072" => Ok(Self::SyncMsgCodeMissing), - "10073" => Ok(Self::SyncVersionMissing), - "10074" => Ok(Self::SyncEncTypeMissing), - "10075" => Ok(Self::SyncSignMissing), - "10076" => Ok(Self::SyncInfoMissing), - "10077" => Ok(Self::SyncErrorCodeMissing), - "10078" => Ok(Self::SyncMsgTypeInvalid), - "10079" => Ok(Self::SyncMsgCodeInvalid), - "10080" => Ok(Self::SyncResponseSignNotMatch), - "10081" => Ok(Self::AccountExpired), - "10082" => Ok(Self::ExceedMaxMinAmount), - "10083" => Ok(Self::WholeNumberAmountLessThanOne), - "10084" => Ok(Self::AddDepositRecordToSchemeChannel), - "10085" => Ok(Self::UpdateUtilizedAmountFailAfterSuccessResponse), - "10086" => Ok(Self::PidResponseInvalidFormat), - "10087" => Ok(Self::PspNameNotFound), - "10088" => Ok(Self::LangIsMissing), - "10089" => Ok(Self::FailureCallbackUrlInvalid), - "10090" => Ok(Self::SuccessRedirectUrlInvalid), - "10091" => Ok(Self::FailureRedirectUrlInvalid), - "10092" => Ok(Self::LangValueInvalid), - "10093" => Ok(Self::OnlineDepositSessionTimeout), - "10094" => Ok(Self::AccessPaymentPageRouteFieldMissing), - "10095" => Ok(Self::AmountNotMatch), - "10096" => Ok(Self::PidCallbackFieldsMissing), - "10097" => Ok(Self::TokenNotMatch), - "10098" => Ok(Self::OperationDuplicated), - "10099" => Ok(Self::PayPageDomainNotAvailable), - "10100" => Ok(Self::PayPageConfirmSignatureNotMatch), - "10101" => Ok(Self::PaymentPageConfirmationFieldMissing), - "10102" => Ok(Self::MultipleCallbackFromPsp), - "10103" => Ok(Self::PidNotAvailable), - "10104" => Ok(Self::PidDepositUrlNotValidOrEmp), - "10105" => Ok(Self::PspSelfRedirectTagNotValid), - "20000" => Ok(Self::InternalError20000), - "20001" => Ok(Self::DepositTimeout), - _ => Err(errors::ConnectorError::ResponseHandlingFailed.into()), - } - } -} - -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, strum::Display)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum ZslResponseStatus { - Normal, - InternalError, - BreakDownMessageError, - FormatError, - InvalidTransaction, - TransactionCountryNotFound, - MerchantIdNotFound, - AccountDisabled, - DuplicateMerchantReference, - InvalidPayAmount, - PayAmountNotFound, - InvalidCurrencyCode, - CurrencyCodeNotFound, - ReferenceNotFound, - TransmissionTimeNotFound, - PayMethodNotFound, - BankCodeNotFound, - InvalidShowPayPage, - ShowPayPageNotFound, - SuccessUrlNotFound, - SuccessCallbackUrlNotFound, - FailUrlNotFound, - FailCallbackUrlNotFound, - MacNotFound, - OriginalTransactionNotFound, - DeblockDataError, - PspAckNotYetReturn, - BankBranchNameNotFound, - BankAccountIDNotFound, - BankAccountNameNotFound, - IdentityIDNotFound, - ErrorConnectingToPsp, - CountryPspNotAvailable, - UnsupportedPayAmount, - RecordMismatch, - NoRecord, - PspError, - UnsupportedEncryptionType, - ExceedTransactionLimitCount, - ExceedTransactionLimitAmount, - ExceedTransactionAccountLimitCount, - ExceedTransactionAccountLimitAmount, - ExchangeRateError, - InvalidEncoding, - CustomerNameNotFound, - CustomerFamilyNameNotFound, - CustomerTelPhoneNotFound, - InsufficientFund, - ServiceCodeIsMissing, - CurrencyIdNotMatch, - NoPendingRecord, - NoLoadBalancerRuleDefineForTransaction, - NoPaymentProviderAvailable, - UnsupportedPayMethod, - PendingTransaction, - OtherError1059, - OtherError1058, - InvalidRequestId, - BeneficiaryBankAccountIsNotAvailable, - BaidNotFound, - InvalidBaid, - InvalidBaidStatus, - AutoUploadBankDisabled, - InvalidNature, - SmsCreateDateNotFound, - InvalidSmsCreateDate, - RecordNotFound, - InsufficientBaidAvailableBalance, - ExceedTxnAmountLimit, - BaidBalanceNotFound, - AutoUploadIndicatorNotFound, - InvalidBankAcctStatus, - InvalidAutoUploadIndicator, - InvalidPidStatus, - InvalidProviderStatus, - InvalidBankAccountSystemSwitchEnabled, - AutoUploadProviderDisabled, - AutoUploadBankNotFound, - AutoUploadBankAcctNotFound, - AutoUploadProviderNotFound, - UnsupportedBankCode, - BalanceOverrideIndicatorNotFound, - InvalidBalanceOverrideIndicator, - VernoInvalid, - ServiceCodeInvalid, - PspResponseSignatureIsNotValid, - ProcessTypeNotFound, - ProcessCodeNotFound, - EnctypeNotFound, - VernoNotFound, - DepositBankNotFound, - DepositFlowNotFound, - CustDepositDateNotFound, - CustTagNotFound, - CountryValueInvalid, - CurrencyCodeValueInvalid, - MerTxnDateInvalid, - CustDepositDateInvalid, - TxnAmtInvalid, - SuccessCallbackUrlInvalid, - DepositFlowInvalid, - ProcessTypeInvalid, - ProcessCodeInvalid, - UnsupportedMerRefLength, - DepositBankLengthOverLimit, - CustTagLengthOverLimit, - SignatureLengthOverLimit, - RequestContainInvalidTag, - RequestSignatureNotMatch, - InvalidCustomer, - SchemeNotFound, - PspResponseFieldsMissing, - PspResponseMerRefNotMatchWithRequestMerRef, - PspResponseMerIdNotMatchWithRequestMerId, - UpdateDepositFailAfterResponse, - UpdateUsedLimitTransactionCountFailAfterSuccessResponse, - UpdateCustomerLastDepositRecordAfterSuccessResponse, - CreateDepositFail, - CreateDepositMsgFail, - UpdateStatusSubStatusFail, - AddDepositRecordToSchemeAccount, - EmptyResponse, - AubConfirmErrorFromPh, - ProviderEmailAddressNotFound, - AubConnectionTimeout, - AubConnectionIssue, - AubMsgTypeMissing, - AubMsgCodeMissing, - AubVersionMissing, - AubEncTypeMissing, - AubSignMissing, - AubInfoMissing, - AubErrorCodeMissing, - AubMsgTypeInvalid, - AubMsgCodeInvalid, - AubBaidMissing, - AubResponseSignNotMatch, - SmsConnectionTimeout, - SmsConnectionIssue, - SmsConfirmErrorFromPh, - SmsMsgTypeMissing, - SmsMsgCodeMissing, - SmsVersionMissing, - SmsEncTypeMissing, - SmsSignMissing, - SmsInfoMissing, - SmsErrorCodeMissing, - SmsMsgTypeInvalid, - SmsMsgCodeInvalid, - SmsResponseSignNotMatch, - SmsRequestReachMaximumLimit, - SyncConnectionTimeout, - SyncConnectionIssue, - SyncConfirmErrorFromPh, - SyncMsgTypeMissing, - SyncMsgCodeMissing, - SyncVersionMissing, - SyncEncTypeMissing, - SyncSignMissing, - SyncInfoMissing, - SyncErrorCodeMissing, - SyncMsgTypeInvalid, - SyncMsgCodeInvalid, - SyncResponseSignNotMatch, - AccountExpired, - ExceedMaxMinAmount, - WholeNumberAmountLessThanOne, - AddDepositRecordToSchemeChannel, - UpdateUtilizedAmountFailAfterSuccessResponse, - PidResponseInvalidFormat, - PspNameNotFound, - LangIsMissing, - FailureCallbackUrlInvalid, - SuccessRedirectUrlInvalid, - FailureRedirectUrlInvalid, - LangValueInvalid, - OnlineDepositSessionTimeout, - AccessPaymentPageRouteFieldMissing, - AmountNotMatch, - PidCallbackFieldsMissing, - TokenNotMatch, - OperationDuplicated, - PayPageDomainNotAvailable, - PayPageConfirmSignatureNotMatch, - PaymentPageConfirmationFieldMissing, - MultipleCallbackFromPsp, - PidNotAvailable, - PidDepositUrlNotValidOrEmp, - PspSelfRedirectTagNotValid, - InternalError20000, - DepositTimeout, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ZslErrorResponse { - pub status: String, -} - -pub enum ZslSignatureType { - RequestSignature { - txn_amt: String, - ccy: String, - mer_ref: String, - mer_id: String, - mer_txn_date: String, - key: String, - }, - ResponseSignature { - status: String, - txn_url: String, - mer_ref: String, - mer_id: String, - key: String, - }, - WebhookSignature { - status: String, - txn_id: String, - txn_date: String, - paid_ccy: String, - paid_amt: String, - mer_ref: String, - mer_id: String, - key: String, - }, -} - -pub fn calculate_signature( - enctype: EncodingType, - signature_data: ZslSignatureType, -) -> Result, error_stack::Report> { - let signature_data = match signature_data { - ZslSignatureType::RequestSignature { - txn_amt, - ccy, - mer_ref, - mer_id, - mer_txn_date, - key, - } => format!("{txn_amt}{ccy}{mer_ref}{mer_id}{mer_txn_date}{key}"), - ZslSignatureType::ResponseSignature { - status, - txn_url, - mer_ref, - mer_id, - key, - } => { - format!("{status}{txn_url}{mer_ref}{mer_id}{key}") - } - ZslSignatureType::WebhookSignature { - status, - txn_id, - txn_date, - paid_ccy, - paid_amt, - mer_ref, - mer_id, - key, - } => format!("{status}{txn_id}{txn_date}{paid_ccy}{paid_amt}{mer_ref}{mer_id}{key}"), - }; - let message = signature_data.as_bytes(); - - let encoded_data = match enctype { - EncodingType::MD5 => hex::encode( - common_utils::crypto::Md5 - .generate_digest(message) - .change_context(errors::ConnectorError::RequestEncodingFailed)?, - ), - EncodingType::Sha1 => { - hex::encode(digest::digest(&digest::SHA1_FOR_LEGACY_USE_ONLY, message)) - } - }; - Ok(Secret::new(encoded_data)) -} diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs index c40d284ee3a..70add106762 100644 --- a/crates/router/src/consts.rs +++ b/crates/router/src/consts.rs @@ -38,8 +38,6 @@ pub(crate) const LOW_BALANCE_ERROR_MESSAGE: &str = "Insufficient balance in the pub(crate) const CONNECTOR_UNAUTHORIZED_ERROR: &str = "Authentication Error from the connector"; pub(crate) const CANNOT_CONTINUE_AUTH: &str = "Cannot continue with Authorization due to failed Liability Shift."; -#[cfg(feature = "payouts")] -pub(crate) const DEFAULT_NOTIFICATION_SCRIPT_LANGUAGE: &str = "en-US"; // General purpose base64 engines pub(crate) const BASE64_ENGINE: base64::engine::GeneralPurpose = @@ -70,8 +68,6 @@ pub const LOCKER_REDIS_EXPIRY_SECONDS: u32 = 60 * 15; // 15 minutes pub const JWT_TOKEN_TIME_IN_SECS: u64 = 60 * 60 * 24 * 2; // 2 days -pub const SINGLE_PURPOSE_TOKEN_TIME_IN_SECS: u64 = 60 * 60 * 24; // 1 day - pub const JWT_TOKEN_COOKIE_NAME: &str = "login_token"; pub const USER_BLACKLIST_PREFIX: &str = "BU_"; @@ -106,10 +102,3 @@ pub const AUTHENTICATION_ID_PREFIX: &str = "authn"; // URL for checking the outgoing call pub const OUTGOING_CALL_URL: &str = "https://api.stripe.com/healthcheck"; - -// 15 minutes = 900 seconds -pub const POLL_ID_TTL: i64 = 900; - -// Default Poll Config -pub const DEFAULT_POLL_DELAY_IN_SECS: i8 = 2; -pub const DEFAULT_POLL_FREQUENCY: i8 = 5; diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs index 02a5873429f..704ac31b733 100644 --- a/crates/router/src/core.rs +++ b/crates/router/src/core.rs @@ -28,7 +28,6 @@ pub mod payments; #[cfg(feature = "payouts")] pub mod payouts; pub mod pm_auth; -pub mod poll; pub mod refunds; pub mod routing; pub mod surcharge_decision_config; diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 7d2fabc3f37..f48227b926e 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -439,7 +439,6 @@ pub async fn update_business_profile_cascade( payment_link_config: None, session_expiry: None, authentication_connector_details: None, - extended_card_info_config: None, }; let update_futures = business_profiles.iter().map(|business_profile| async { @@ -1649,20 +1648,7 @@ pub async fn update_business_profile( }) .transpose()?; - let extended_card_info_config = request - .extended_card_info_config - .as_ref() - .map(|config| { - config - .encode_to_value() - .change_context(errors::ApiErrorResponse::InvalidDataValue { - field_name: "extended_card_info_config", - }) - }) - .transpose()? - .map(Secret::new); - - let business_profile_update = storage::business_profile::BusinessProfileUpdate::Update { + let business_profile_update = storage::business_profile::BusinessProfileUpdateInternal { profile_name: request.profile_name, modified_at: Some(date_time::now()), return_url: request.return_url.map(|return_url| return_url.to_string()), @@ -1690,7 +1676,6 @@ pub async fn update_business_profile( .change_context(errors::ApiErrorResponse::InvalidDataValue { field_name: "authentication_connector_details", })?, - extended_card_info_config, }; let updated_business_profile = db @@ -1706,39 +1691,6 @@ pub async fn update_business_profile( )) } -pub async fn extended_card_info_toggle( - state: AppState, - profile_id: &str, - ext_card_info_choice: admin_types::ExtendedCardInfoChoice, -) -> RouterResponse { - let db = state.store.as_ref(); - let business_profile = db - .find_business_profile_by_profile_id(profile_id) - .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { - id: profile_id.to_string(), - })?; - - if business_profile.is_extended_card_info_enabled.is_none() - || business_profile - .is_extended_card_info_enabled - .is_some_and(|existing_config| existing_config != ext_card_info_choice.enabled) - { - let business_profile_update = - storage::business_profile::BusinessProfileUpdate::ExtendedCardInfoUpdate { - is_extended_card_info_enabled: Some(ext_card_info_choice.enabled), - }; - - db.update_business_profile_by_profile_id(business_profile, business_profile_update) - .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { - id: profile_id.to_owned(), - })?; - } - - Ok(service_api::ApplicationResponse::Json(ext_card_info_choice)) -} - pub(crate) fn validate_auth_and_metadata_type( connector_name: api_models::enums::Connector, val: &types::ConnectorAuthType, @@ -1779,10 +1731,10 @@ pub(crate) fn validate_auth_and_metadata_type( bankofamerica::transformers::BankOfAmericaAuthType::try_from(val)?; Ok(()) } - api_enums::Connector::Billwerk => { - billwerk::transformers::BillwerkAuthType::try_from(val)?; - Ok(()) - } + // api_enums::Connector::Billwerk => { + // billwerk::transformers::BillwerkAuthType::try_from(val)?; + // Ok(()) + // } Added as template code for future usage api_enums::Connector::Bitpay => { bitpay::transformers::BitpayAuthType::try_from(val)?; Ok(()) @@ -1831,10 +1783,6 @@ pub(crate) fn validate_auth_and_metadata_type( dlocal::transformers::DlocalAuthType::try_from(val)?; Ok(()) } - api_enums::Connector::Ebanx => { - ebanx::transformers::EbanxAuthType::try_from(val)?; - Ok(()) - } api_enums::Connector::Fiserv => { fiserv::transformers::FiservAuthType::try_from(val)?; fiserv::transformers::FiservSessionObject::try_from(connector_meta_data)?; @@ -1876,11 +1824,6 @@ pub(crate) fn validate_auth_and_metadata_type( multisafepay::transformers::MultisafepayAuthType::try_from(val)?; Ok(()) } - api_enums::Connector::Netcetera => { - netcetera::transformers::NetceteraAuthType::try_from(val)?; - netcetera::transformers::NetceteraMetaData::try_from(connector_meta_data)?; - Ok(()) - } api_enums::Connector::Nexinets => { nexinets::transformers::NexinetsAuthType::try_from(val)?; Ok(()) @@ -1973,10 +1916,6 @@ pub(crate) fn validate_auth_and_metadata_type( zen::transformers::ZenAuthType::try_from(val)?; Ok(()) } - api_enums::Connector::Zsl => { - zsl::transformers::ZslAuthType::try_from(val)?; - Ok(()) - } api_enums::Connector::Signifyd => { signifyd::transformers::SignifydAuthType::try_from(val)?; Ok(()) diff --git a/crates/router/src/core/authentication.rs b/crates/router/src/core/authentication.rs index f9161f2ccc6..09d8ccc8833 100644 --- a/crates/router/src/core/authentication.rs +++ b/crates/router/src/core/authentication.rs @@ -5,19 +5,16 @@ pub mod types; use api_models::payments; use common_enums::Currency; -use common_utils::{ - errors::CustomResult, - ext_traits::{Encode, StringExt, ValueExt}, -}; +use common_utils::{errors::CustomResult, ext_traits::ValueExt}; use error_stack::{report, ResultExt}; -use masking::{ExposeInterface, PeekInterface}; +use masking::PeekInterface; use super::errors; use crate::{ core::{errors::ApiErrorResponse, payments as payments_core}, routes::AppState, types::{self as core_types, api, authentication::AuthenticationResponseData, storage}, - utils::{check_if_pull_mechanism_for_external_3ds_enabled_from_connector_metadata, OptionExt}, + utils::OptionExt, }; #[allow(clippy::too_many_arguments)] @@ -40,7 +37,6 @@ pub async fn perform_authentication( sdk_information: Option, threeds_method_comp_ind: api_models::payments::ThreeDsCompletionIndicator, email: Option, - webhook_url: String, ) -> CustomResult { let router_data = transformers::construct_authentication_router_data( authentication_connector.clone(), @@ -60,7 +56,6 @@ pub async fn perform_authentication( sdk_information, threeds_method_comp_ind, email, - webhook_url, )?; let response = utils::do_auth_connector_call(state, authentication_connector.clone(), router_data).await?; @@ -122,19 +117,12 @@ pub async fn perform_post_authentication( authentication, should_continue_confirm_transaction, } => { - let is_pull_mechanism_enabled = - check_if_pull_mechanism_for_external_3ds_enabled_from_connector_metadata( - merchant_connector_account - .get_metadata() - .map(|metadata| metadata.expose()), - ); + // let (auth, authentication_data) = authentication; let authentication_status = - if !authentication.authentication_status.is_terminal_status() - && is_pull_mechanism_enabled - { + if !authentication.authentication_status.is_terminal_status() { let router_data = transformers::construct_post_authentication_router_data( authentication_connector.clone(), - business_profile.clone(), + business_profile, merchant_connector_account, &authentication, )?; @@ -144,7 +132,7 @@ pub async fn perform_post_authentication( let updated_authentication = utils::update_trackers( state, router_data, - authentication.clone(), + authentication, payment_data.token.clone(), None, ) @@ -167,17 +155,6 @@ pub async fn perform_post_authentication( Ok(()) } -fn get_payment_id_from_pre_authentication_flow_input( - pre_authentication_flow_input: &types::PreAuthenthenticationFlowInput<'_, F>, -) -> Option { - match pre_authentication_flow_input { - types::PreAuthenthenticationFlowInput::PaymentAuthNFlow { payment_data, .. } => { - Some(payment_data.payment_intent.payment_id.clone()) - } - _ => None, - } -} - pub async fn perform_pre_authentication( state: &AppState, authentication_connector_name: String, @@ -186,17 +163,10 @@ pub async fn perform_pre_authentication( three_ds_connector_account: payments_core::helpers::MerchantConnectorAccountType, payment_connector_account: payments_core::helpers::MerchantConnectorAccountType, ) -> CustomResult<(), ApiErrorResponse> { - let payment_id = get_payment_id_from_pre_authentication_flow_input(&authentication_flow_input); let authentication = utils::create_new_authentication( state, business_profile.merchant_id.clone(), authentication_connector_name.clone(), - business_profile.profile_id.clone(), - payment_id, - three_ds_connector_account - .get_mca_id() - .ok_or(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error while finding mca_id from merchant_connector_account")?, ) .await?; match authentication_flow_input { @@ -211,12 +181,9 @@ pub async fn perform_pre_authentication( &three_ds_connector_account, business_profile.merchant_id.clone(), )?; - let router_data = utils::do_auth_connector_call( - state, - authentication_connector_name.clone(), - router_data, - ) - .await?; + let router_data = + utils::do_auth_connector_call(state, authentication_connector_name, router_data) + .await?; let acquirer_details: types::AcquirerDetails = payment_connector_account .get_metadata() .get_required_value("merchant_connector_account.metadata")? @@ -237,27 +204,6 @@ pub async fn perform_pre_authentication( || authentication.authentication_status.is_failed() { *should_continue_confirm_transaction = false; - // If flow is going through external authentication, set the poll_config in payment_data which can be fetched while sending next_action block in confirm response - let default_poll_config = core_types::PollConfig::default(); - let default_config_str = default_poll_config - .encode_to_string_of_json() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error while stringifying default poll config")?; - let poll_config = state - .store - .find_config_by_key_unwrap_or( - &core_types::PollConfig::get_poll_config_key(authentication_connector_name), - Some(default_config_str), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("The poll config was not found in the DB")?; - let poll_config: core_types::PollConfig = poll_config - .config - .parse_struct("PollConfig") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error while parsing PollConfig")?; - payment_data.poll_config = Some(poll_config) } payment_data.authentication = Some(authentication); } diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rs index d4cad2fbedb..6ade1b37e94 100644 --- a/crates/router/src/core/authentication/transformers.rs +++ b/crates/router/src/core/authentication/transformers.rs @@ -43,7 +43,6 @@ pub fn construct_authentication_router_data( sdk_information: Option, threeds_method_comp_ind: api_models::payments::ThreeDsCompletionIndicator, email: Option, - webhook_url: String, ) -> RouterResult { let authentication_details: api_models::admin::AuthenticationConnectorDetails = business_profile @@ -57,7 +56,7 @@ pub fn construct_authentication_router_data( }) .attach_printable("Error while parsing authentication_details from merchant_account")?; let router_request = types::authentication::ConnectorAuthenticationRequestData { - payment_method_data: From::from(payment_method_data), + payment_method_data, billing_address, shipping_address, browser_details, @@ -73,7 +72,6 @@ pub fn construct_authentication_router_data( email, three_ds_requestor_url: authentication_details.three_ds_requestor_url, threeds_method_comp_ind, - webhook_url, }; construct_router_data( authentication_connector, @@ -168,6 +166,7 @@ pub fn construct_router_data( connector_api_version: None, request: request_data, response: Err(types::ErrorResponse::default()), + payment_method_id: None, connector_request_reference_id: IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_AUTHENTICATION_FLOW.to_owned(), #[cfg(feature = "payouts")] diff --git a/crates/router/src/core/authentication/types.rs b/crates/router/src/core/authentication/types.rs index 4815f4569de..6035d8fa378 100644 --- a/crates/router/src/core/authentication/types.rs +++ b/crates/router/src/core/authentication/types.rs @@ -33,7 +33,7 @@ pub enum PostAuthenthenticationFlowInput<'a, F: Clone> { #[derive(Clone, Debug)] pub struct PreAuthenticationData { pub threeds_server_transaction_id: String, - pub message_version: common_utils::types::SemanticVersion, + pub message_version: String, pub acquirer_bin: Option, pub acquirer_merchant_id: Option, pub connector_metadata: Option, @@ -51,11 +51,11 @@ impl ForeignTryFrom<&storage::Authentication> for PreAuthenticationData { .change_context(error_message)?; let message_version = authentication .message_version - .clone() + .as_ref() .get_required_value("message_version")?; Ok(Self { threeds_server_transaction_id, - message_version, + message_version: message_version.to_string(), acquirer_bin: authentication.acquirer_bin.clone(), acquirer_merchant_id: authentication.acquirer_merchant_id.clone(), connector_metadata: authentication.connector_metadata.clone(), @@ -74,8 +74,3 @@ pub struct AcquirerDetails { pub acquirer_bin: String, pub acquirer_merchant_id: String, } - -#[derive(Clone, Debug, Deserialize)] -pub struct ExternalThreeDSConnectorMetadata { - pub pull_mechanism_for_external_3ds_enabled: Option, -} diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs index e9c0b3ffc68..8d6efc4d685 100644 --- a/crates/router/src/core/authentication/utils.rs +++ b/crates/router/src/core/authentication/utils.rs @@ -144,9 +144,6 @@ pub async fn create_new_authentication( state: &AppState, merchant_id: String, authentication_connector: String, - profile_id: String, - payment_id: Option, - merchant_connector_id: String, ) -> RouterResult { let authentication_id = common_utils::generate_id_with_default_len(consts::AUTHENTICATION_ID_PREFIX); @@ -179,9 +176,6 @@ pub async fn create_new_authentication( acs_trans_id: None, three_dsserver_trans_id: None, acs_signed_content: None, - profile_id, - payment_id, - merchant_connector_id, }; state .store diff --git a/crates/router/src/core/connector_onboarding.rs b/crates/router/src/core/connector_onboarding.rs index b69b2996a6a..21377d0ba0b 100644 --- a/crates/router/src/core/connector_onboarding.rs +++ b/crates/router/src/core/connector_onboarding.rs @@ -3,9 +3,8 @@ use masking::Secret; use crate::{ core::errors::{ApiErrorResponse, RouterResponse, RouterResult}, - routes::app::ReqState, services::{authentication as auth, ApplicationResponse}, - types as oss_types, + types::{self as oss_types}, utils::connector_onboarding as utils, AppState, }; @@ -21,7 +20,6 @@ pub async fn get_action_url( state: AppState, user_from_token: auth::UserFromToken, request: api::ActionUrlRequest, - _req_state: ReqState, ) -> RouterResponse { utils::check_if_connector_exists(&state, &request.connector_id, &user_from_token.merchant_id) .await?; @@ -56,7 +54,6 @@ pub async fn sync_onboarding_status( state: AppState, user_from_token: auth::UserFromToken, request: api::OnboardingSyncRequest, - _req_state: ReqState, ) -> RouterResponse { utils::check_if_connector_exists(&state, &request.connector_id, &user_from_token.merchant_id) .await?; @@ -110,7 +107,6 @@ pub async fn reset_tracking_id( state: AppState, user_from_token: auth::UserFromToken, request: api::ResetTrackingIdRequest, - _req_state: ReqState, ) -> RouterResponse<()> { utils::check_if_connector_exists(&state, &request.connector_id, &user_from_token.merchant_id) .await?; diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs index af97c500f3e..732596d5c1c 100644 --- a/crates/router/src/core/customers.rs +++ b/crates/router/src/core/customers.rs @@ -42,15 +42,10 @@ pub async fn create_customer( // We first need to validate whether the customer with the given customer id already exists // this may seem like a redundant db call, as the insert_customer will anyway return this error // - // Consider a scenario where the address is inserted and then when inserting the customer, + // Consider a scenerio where the address is inserted and then when inserting the customer, // it errors out, now the address that was inserted is not deleted match db - .find_customer_by_customer_id_merchant_id( - customer_id, - merchant_id, - &key_store, - merchant_account.storage_scheme, - ) + .find_customer_by_customer_id_merchant_id(customer_id, merchant_id, &key_store) .await { Err(err) => { @@ -123,7 +118,7 @@ pub async fn create_customer( .attach_printable("Failed while encrypting Customer")?; let customer = db - .insert_customer(new_customer, &key_store, merchant_account.storage_scheme) + .insert_customer(new_customer, &key_store) .await .to_duplicate_response(errors::CustomersErrorResponse::CustomerAlreadyExists)?; @@ -147,7 +142,6 @@ pub async fn retrieve_customer( &req.customer_id, &merchant_account.merchant_id, &key_store, - merchant_account.storage_scheme, ) .await .switch()?; @@ -194,15 +188,13 @@ pub async fn delete_customer( ) -> errors::CustomerResponse { let db = &state.store; - let customer_orig = db - .find_customer_by_customer_id_merchant_id( - &req.customer_id, - &merchant_account.merchant_id, - &key_store, - merchant_account.storage_scheme, - ) - .await - .switch()?; + db.find_customer_by_customer_id_merchant_id( + &req.customer_id, + &merchant_account.merchant_id, + &key_store, + ) + .await + .switch()?; let customer_mandates = db .find_mandate_by_merchant_id_customer_id(&merchant_account.merchant_id, &req.customer_id) @@ -223,10 +215,9 @@ pub async fn delete_customer( ) .await { - // check this in review Ok(customer_payment_methods) => { for pm in customer_payment_methods.into_iter() { - if pm.payment_method == Some(enums::PaymentMethod::Card) { + if pm.payment_method == enums::PaymentMethod::Card { cards::delete_card_from_locker( &state, &req.customer_id, @@ -322,10 +313,8 @@ pub async fn delete_customer( db.update_customer_by_customer_id_merchant_id( req.customer_id.clone(), merchant_account.merchant_id, - customer_orig, updated_customer, &key_store, - merchant_account.storage_scheme, ) .await .switch()?; @@ -354,7 +343,6 @@ pub async fn update_customer( &update_customer.customer_id, &merchant_account.merchant_id, &key_store, - merchant_account.storage_scheme, ) .await .switch()?; @@ -362,7 +350,7 @@ pub async fn update_customer( let key = key_store.key.get_inner().peek(); let address = if let Some(addr) = &update_customer.address { - match customer.address_id.clone() { + match customer.address_id { Some(address_id) => { let customer_address: api_models::payments::AddressDetails = addr.clone(); let update_address = update_customer @@ -371,7 +359,7 @@ pub async fn update_customer( .switch() .attach_printable("Failed while encrypting Address while Update")?; Some( - db.update_address(address_id, update_address, &key_store) + db.update_address(address_id.clone(), update_address, &key_store) .await .switch() .attach_printable(format!( @@ -417,7 +405,6 @@ pub async fn update_customer( .update_customer_by_customer_id_merchant_id( update_customer.customer_id.to_owned(), merchant_account.merchant_id.to_owned(), - customer, async { Ok(storage::CustomerUpdate::Update { name: update_customer @@ -447,7 +434,6 @@ pub async fn update_customer( .switch() .attach_printable("Failed while encrypting while updating customer")?, &key_store, - merchant_account.storage_scheme, ) .await .switch()?; diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs index d80d86460b2..a7d36ff5128 100644 --- a/crates/router/src/core/errors.rs +++ b/crates/router/src/core/errors.rs @@ -10,8 +10,8 @@ use std::fmt::Display; use actix_web::{body::BoxBody, ResponseError}; pub use common_utils::errors::{CustomResult, ParsingError, ValidationError}; +pub use data_models::errors::StorageError as DataStorageError; use diesel_models::errors as storage_errors; -pub use hyperswitch_domain_models::errors::StorageError as DataStorageError; pub use redis_interface::errors::RedisError; use scheduler::errors as sch_errors; use storage_impl::errors as storage_impl_errors; diff --git a/crates/router/src/core/errors/api_error_response.rs b/crates/router/src/core/errors/api_error_response.rs index 0c492f0f089..b3fbbaaf141 100644 --- a/crates/router/src/core/errors/api_error_response.rs +++ b/crates/router/src/core/errors/api_error_response.rs @@ -166,14 +166,10 @@ pub enum ApiErrorResponse { MerchantConnectorAccountNotFound { id: String }, #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Business profile with the given id '{id}' does not exist in our records")] BusinessProfileNotFound { id: String }, - #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Poll with the given id '{id}' does not exist in our records")] - PollNotFound { id: String }, #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Resource ID does not exist in our records")] ResourceIdNotFound, #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Mandate does not exist in our records")] MandateNotFound, - #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Authentication does not exist in our records")] - AuthenticationNotFound { id: String }, #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Failed to update mandate")] MandateUpdateFailed, #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "API Key does not exist in our records")] @@ -264,13 +260,6 @@ pub enum ApiErrorResponse { CurrencyConversionFailed, #[error(error_type = ErrorType::InvalidRequestError, code = "IR_25", message = "Cannot delete the default payment method")] PaymentMethodDeleteFailed, - #[error( - error_type = ErrorType::InvalidRequestError, code = "IR_26", - message = "Invalid Cookie" - )] - InvalidCookie, - #[error(error_type = ErrorType::InvalidRequestError, code = "IR_27", message = "Extended card info does not exist")] - ExtendedCardInfoNotFound, } impl PTError for ApiErrorResponse { diff --git a/crates/router/src/core/errors/transformers.rs b/crates/router/src/core/errors/transformers.rs index 880c0d7b20b..110feb22df3 100644 --- a/crates/router/src/core/errors/transformers.rs +++ b/crates/router/src/core/errors/transformers.rs @@ -229,18 +229,12 @@ impl ErrorSwitch for ApiErrorRespon Self::DisputeNotFound { .. } => { AER::NotFound(ApiError::new("HE", 2, "Dispute does not exist in our records", None)) }, - Self::AuthenticationNotFound { .. } => { - AER::NotFound(ApiError::new("HE", 2, "Authentication does not exist in our records", None)) - }, Self::BusinessProfileNotFound { id } => { AER::NotFound(ApiError::new("HE", 2, format!("Business profile with the given id {id} does not exist"), None)) } Self::FileNotFound => { AER::NotFound(ApiError::new("HE", 2, "File does not exist in our records", None)) } - Self::PollNotFound { .. } => { - AER::NotFound(ApiError::new("HE", 2, "Poll does not exist in our records", None)) - }, Self::FileNotAvailable => { AER::NotFound(ApiError::new("HE", 2, "File not available", None)) } @@ -298,12 +292,6 @@ impl ErrorSwitch for ApiErrorRespon Self::PaymentMethodDeleteFailed => { AER::BadRequest(ApiError::new("IR", 25, "Cannot delete the default payment method", None)) } - Self::InvalidCookie => { - AER::BadRequest(ApiError::new("IR", 26, "Invalid Cookie", None)) - } - Self::ExtendedCardInfoNotFound => { - AER::NotFound(ApiError::new("IR", 27, "Extended card info does not exist", None)) - } } } } diff --git a/crates/router/src/core/errors/user/sample_data.rs b/crates/router/src/core/errors/user/sample_data.rs index 3e72e49d317..84c6c9fa43a 100644 --- a/crates/router/src/core/errors/user/sample_data.rs +++ b/crates/router/src/core/errors/user/sample_data.rs @@ -1,6 +1,6 @@ use api_models::errors::types::{ApiError, ApiErrorResponse}; use common_utils::errors::{CustomResult, ErrorSwitch, ErrorSwitchFrom}; -use hyperswitch_domain_models::errors::StorageError; +use data_models::errors::StorageError; pub type SampleDataResult = CustomResult; diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs index 678a351a4c3..f664c33681c 100644 --- a/crates/router/src/core/errors/utils.rs +++ b/crates/router/src/core/errors/utils.rs @@ -42,7 +42,7 @@ impl StorageErrorExt } impl StorageErrorExt - for error_stack::Result + for error_stack::Result { #[track_caller] fn to_not_found_response( @@ -51,10 +51,8 @@ impl StorageErrorExt ) -> error_stack::Result { self.map_err(|err| { let new_err = match err.current_context() { - hyperswitch_domain_models::errors::StorageError::ValueNotFound(_) => { - not_found_response - } - hyperswitch_domain_models::errors::StorageError::CustomerRedacted => { + data_models::errors::StorageError::ValueNotFound(_) => not_found_response, + data_models::errors::StorageError::CustomerRedacted => { errors::ApiErrorResponse::CustomerRedacted } _ => errors::ApiErrorResponse::InternalServerError, @@ -70,9 +68,7 @@ impl StorageErrorExt ) -> error_stack::Result { self.map_err(|err| { let new_err = match err.current_context() { - hyperswitch_domain_models::errors::StorageError::DuplicateValue { .. } => { - duplicate_response - } + data_models::errors::StorageError::DuplicateValue { .. } => duplicate_response, _ => errors::ApiErrorResponse::InternalServerError, }; err.change_context(new_err) diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs index 5e03033977e..0e3f67c051b 100644 --- a/crates/router/src/core/fraud_check.rs +++ b/crates/router/src/core/fraud_check.rs @@ -1,7 +1,6 @@ use std::fmt::Debug; use api_models::{admin::FrmConfigs, enums as api_enums, payments::AdditionalPaymentData}; -use common_enums::CaptureMethod; use error_stack::ResultExt; use masking::{ExposeInterface, PeekInterface}; use router_env::{ @@ -27,14 +26,11 @@ use crate::{ utils as core_utils, }, db::StorageInterface, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ self as oss_types, - api::{ - fraud_check as frm_api, routing::FrmRoutingAlgorithm, Connector, - FraudCheckConnectorData, Fulfillment, - }, + api::{routing::FrmRoutingAlgorithm, Connector, FraudCheckConnectorData, Fulfillment}, domain, fraud_check as frm_types, storage::{ enums::{ @@ -98,15 +94,6 @@ where .await?; router_data.status = payment_data.payment_attempt.status; - if matches!( - frm_data.fraud_check.frm_transaction_type, - FraudCheckType::PreFrm - ) && matches!( - frm_data.fraud_check.last_step, - FraudCheckLastStep::CheckoutOrSale - ) { - frm_data.fraud_check.last_step = FraudCheckLastStep::TransactionOrRecordRefund - } let connector = FraudCheckConnectorData::get_connector_by_name(&frm_data.connector_details.connector_name)?; @@ -243,11 +230,10 @@ where }) .collect::>() .concat(); - let additional_payment_data = match &payment_data.payment_method_data { Some(pmd) => { let additional_payment_data = - get_additional_payment_data(pmd, db, &profile_id).await; + get_additional_payment_data(pmd, db).await; Some(additional_payment_data) } None => payment_data @@ -309,7 +295,7 @@ where let is_frm_enabled = is_frm_connector_enabled && is_frm_pm_enabled && is_frm_pmt_enabled; logger::debug!( - "is_frm_connector_enabled {:?}, is_frm_pm_enabled: {:?},is_frm_pmt_enabled : {:?}, is_frm_enabled :{:?}", + "frm_configs {:?} {:?} {:?} {:?}", is_frm_connector_enabled, is_frm_pm_enabled, is_frm_pmt_enabled, @@ -437,7 +423,7 @@ where } #[allow(clippy::too_many_arguments)] -pub async fn pre_payment_frm_core<'a, F, Req, Ctx>( +pub async fn pre_payment_frm_core<'a, F>( state: &AppState, merchant_account: &domain::MerchantAccount, payment_data: &mut payments::PaymentData, @@ -447,108 +433,85 @@ pub async fn pre_payment_frm_core<'a, F, Req, Ctx>( should_continue_transaction: &mut bool, should_continue_capture: &mut bool, key_store: domain::MerchantKeyStore, - operation: &BoxedOperation<'_, F, Req, Ctx>, ) -> RouterResult> where F: Send + Clone, { - let mut frm_data = None; - if is_operation_allowed(operation) { - frm_data = if let Some(frm_data) = &mut frm_info.frm_data { - if matches!( - frm_configs.frm_preferred_flow_type, - api_enums::FrmPreferredFlowTypes::Pre - ) { - let fraud_check_operation = &mut frm_info.fraud_check_operation; + if let Some(frm_data) = &mut frm_info.frm_data { + if matches!( + frm_configs.frm_preferred_flow_type, + api_enums::FrmPreferredFlowTypes::Pre + ) { + let fraud_check_operation = &mut frm_info.fraud_check_operation; - let frm_router_data = fraud_check_operation - .to_domain()? - .pre_payment_frm( - state, - payment_data, - frm_data, - merchant_account, - customer, - key_store.clone(), - ) - .await?; - let _router_data = call_frm_service::( + let frm_router_data = fraud_check_operation + .to_domain()? + .pre_payment_frm( state, payment_data, frm_data, merchant_account, - &key_store, customer, + key_store, ) .await?; - let frm_data_updated = fraud_check_operation - .to_update_tracker()? - .update_tracker( - &*state.store, - frm_data.clone(), - payment_data, - None, - frm_router_data, - ) - .await?; - let frm_fraud_check = frm_data_updated.fraud_check.clone(); - payment_data.frm_message = Some(frm_fraud_check.clone()); - if matches!(frm_fraud_check.frm_status, FraudCheckStatus::Fraud) { + let frm_data_updated = fraud_check_operation + .to_update_tracker()? + .update_tracker( + &*state.store, + frm_data.clone(), + payment_data, + None, + frm_router_data, + ) + .await?; + let frm_fraud_check = frm_data_updated.fraud_check.clone(); + payment_data.frm_message = Some(frm_fraud_check.clone()); + if matches!(frm_fraud_check.frm_status, FraudCheckStatus::Fraud) { + if matches!(frm_configs.frm_action, api_enums::FrmAction::CancelTxn) { *should_continue_transaction = false; - if matches!(frm_configs.frm_action, api_enums::FrmAction::CancelTxn) { - frm_info.suggested_action = Some(FrmSuggestion::FrmCancelTransaction); - } else if matches!(frm_configs.frm_action, api_enums::FrmAction::ManualReview) { - *should_continue_capture = false; - frm_info.suggested_action = Some(FrmSuggestion::FrmManualReview); - } + frm_info.suggested_action = Some(FrmSuggestion::FrmCancelTransaction); + } else if matches!(frm_configs.frm_action, api_enums::FrmAction::ManualReview) { + *should_continue_capture = false; + frm_info.suggested_action = Some(FrmSuggestion::FrmManualReview); } - logger::debug!( - "frm_updated_data: {:?} {:?}", - frm_info.fraud_check_operation, - frm_info.suggested_action - ); - Some(frm_data_updated) - } else if matches!( - frm_configs.frm_preferred_flow_type, - api_enums::FrmPreferredFlowTypes::Post - ) { - *should_continue_capture = false; - Some(frm_data.to_owned()) - } else { - Some(frm_data.to_owned()) } + logger::debug!( + "frm_updated_data: {:?} {:?}", + frm_info.fraud_check_operation, + frm_info.suggested_action + ); + Ok(Some(frm_data_updated)) } else { - None - }; + Ok(Some(frm_data.to_owned())) + } + } else { + Ok(None) } - Ok(frm_data) } #[allow(clippy::too_many_arguments)] pub async fn post_payment_frm_core<'a, F>( state: &AppState, - req_state: ReqState, merchant_account: &domain::MerchantAccount, payment_data: &mut payments::PaymentData, frm_info: &mut FrmInfo, frm_configs: FrmConfigsObject, customer: &Option, key_store: domain::MerchantKeyStore, - should_continue_capture: &mut bool, ) -> RouterResult> where F: Send + Clone, { if let Some(frm_data) = &mut frm_info.frm_data { - // Allow the Post flow only if the payment is authorized, + // Allow the Post flow only if the payment is succeeded, // this logic has to be removed if we are going to call /sale or /transaction after failed transaction let fraud_check_operation = &mut frm_info.fraud_check_operation; - if payment_data.payment_attempt.status == AttemptStatus::Authorized { + if payment_data.payment_attempt.status == AttemptStatus::Charged { let frm_router_data_opt = fraud_check_operation .to_domain()? .post_payment_frm( state, - req_state.clone(), payment_data, frm_data, merchant_account, @@ -567,23 +530,18 @@ where frm_router_data.to_owned(), ) .await?; - let frm_fraud_check = frm_data.fraud_check.clone(); + + payment_data.frm_message = Some(frm_data.fraud_check.clone()); + logger::debug!( + "frm_updated_data: {:?} {:?}", + frm_data, + payment_data.frm_message + ); let mut frm_suggestion = None; - payment_data.frm_message = Some(frm_fraud_check.clone()); - if matches!(frm_fraud_check.frm_status, FraudCheckStatus::Fraud) { - if matches!(frm_configs.frm_action, api_enums::FrmAction::CancelTxn) { - frm_info.suggested_action = Some(FrmSuggestion::FrmCancelTransaction); - } else if matches!(frm_configs.frm_action, api_enums::FrmAction::ManualReview) { - frm_info.suggested_action = Some(FrmSuggestion::FrmManualReview); - } - } else if matches!(frm_fraud_check.frm_status, FraudCheckStatus::ManualReview) { - frm_info.suggested_action = Some(FrmSuggestion::FrmManualReview); - } fraud_check_operation .to_domain()? .execute_post_tasks( state, - req_state, &mut frm_data, merchant_account, frm_configs, @@ -591,7 +549,6 @@ where key_store, payment_data, customer, - should_continue_capture, ) .await?; logger::debug!("frm_post_tasks_data: {:?}", frm_data); @@ -631,76 +588,51 @@ pub async fn call_frm_before_connector_call<'a, F, Req, Ctx>( where F: Send + Clone, { - let (is_frm_enabled, frm_routing_algorithm, frm_connector_label, frm_configs) = - should_call_frm(merchant_account, payment_data, db, key_store.clone()).await?; - if let Some((frm_routing_algorithm_val, profile_id)) = - frm_routing_algorithm.zip(frm_connector_label) - { - if let Some(frm_configs) = frm_configs.clone() { - let mut updated_frm_info = make_frm_data_and_fraud_check_operation( - db, - state, - merchant_account, - payment_data.to_owned(), - frm_routing_algorithm_val, - profile_id, - frm_configs.clone(), - customer, - ) - .await?; - - if is_frm_enabled { - pre_payment_frm_core( + if is_operation_allowed(operation) { + let (is_frm_enabled, frm_routing_algorithm, frm_connector_label, frm_configs) = + should_call_frm(merchant_account, payment_data, db, key_store.clone()).await?; + if let Some((frm_routing_algorithm_val, profile_id)) = + frm_routing_algorithm.zip(frm_connector_label) + { + if let Some(frm_configs) = frm_configs.clone() { + let mut updated_frm_info = make_frm_data_and_fraud_check_operation( + db, state, merchant_account, - payment_data, - &mut updated_frm_info, - frm_configs, + payment_data.to_owned(), + frm_routing_algorithm_val, + profile_id, + frm_configs.clone(), customer, - should_continue_transaction, - should_continue_capture, - key_store, - operation, ) .await?; + + if is_frm_enabled { + pre_payment_frm_core( + state, + merchant_account, + payment_data, + &mut updated_frm_info, + frm_configs, + customer, + should_continue_transaction, + should_continue_capture, + key_store, + ) + .await?; + } + *frm_info = Some(updated_frm_info); } - *frm_info = Some(updated_frm_info); } + logger::debug!("frm_configs: {:?} {:?}", frm_configs, is_frm_enabled); + return Ok(frm_configs); } - let fraud_capture_method = frm_info.as_ref().and_then(|frm_info| { - frm_info - .frm_data - .as_ref() - .map(|frm_data| frm_data.fraud_check.payment_capture_method) - }); - if matches!(fraud_capture_method, Some(Some(CaptureMethod::Manual))) - && matches!( - payment_data.payment_attempt.status, - api_models::enums::AttemptStatus::Unresolved - ) - { - if let Some(info) = frm_info { - info.suggested_action = Some(FrmSuggestion::FrmAuthorizeTransaction) - }; - *should_continue_transaction = false; - logger::debug!( - "skipping connector call since payment_capture_method is already {:?}", - fraud_capture_method - ); - }; - logger::debug!("frm_configs: {:?} {:?}", frm_configs, is_frm_enabled); - Ok(frm_configs) + Ok(None) } pub fn is_operation_allowed(operation: &Op) -> bool { - ![ - "PaymentSession", - "PaymentApprove", - "PaymentReject", - "PaymentCapture", - "PaymentsCancel", - ] - .contains(&format!("{operation:?}").as_str()) + !["PaymentSession", "PaymentApprove", "PaymentReject"] + .contains(&format!("{operation:?}").as_str()) } impl From for PaymentDetails { @@ -827,7 +759,6 @@ pub async fn make_fulfillment_api_call( metadata: fraud_check.metadata, modified_at: common_utils::date_time::now(), last_step: FraudCheckLastStep::Fulfillment, - payment_capture_method: fraud_check.payment_capture_method, }; let _updated = db .update_fraud_check_response_with_attempt_id(fraud_check_copy, fraud_check_update) diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rs index 58e82ec21c7..f17a1730088 100644 --- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs +++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs @@ -63,6 +63,7 @@ impl ConstructFlowSpecificData( connector_auth_type: auth_type, description: None, return_url: payment_intent.return_url.clone(), + payment_method_id: payment_attempt.payment_method_id.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rs index ad74f7f7027..cba19769d57 100644 --- a/crates/router/src/core/fraud_check/flows/record_return.rs +++ b/crates/router/src/core/fraud_check/flows/record_return.rs @@ -62,6 +62,7 @@ impl ConstructFlowSpecificData: Send { } #[async_trait] -#[allow(clippy::too_many_arguments)] pub trait Domain: Send + Sync { async fn post_payment_frm<'a>( &'a self, state: &'a AppState, - req_state: ReqState, payment_data: &mut payments::PaymentData, frm_data: &mut FrmData, merchant_account: &domain::MerchantAccount, @@ -80,7 +78,6 @@ pub trait Domain: Send + Sync { async fn execute_post_tasks( &self, _state: &AppState, - _req_state: ReqState, frm_data: &mut FrmData, _merchant_account: &domain::MerchantAccount, _frm_configs: FrmConfigsObject, @@ -88,7 +85,6 @@ pub trait Domain: Send + Sync { _key_store: domain::MerchantKeyStore, _payment_data: &mut payments::PaymentData, _customer: &Option, - _should_continue_capture: &mut bool, ) -> RouterResult> where F: Send + Clone, diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_post.rs b/crates/router/src/core/fraud_check/operation/fraud_check_post.rs index 3a80865bcd0..a6cd0976129 100644 --- a/crates/router/src/core/fraud_check/operation/fraud_check_post.rs +++ b/crates/router/src/core/fraud_check/operation/fraud_check_post.rs @@ -1,8 +1,7 @@ -use api_models::payments::HeaderPayload; use async_trait::async_trait; -use common_enums::{CaptureMethod, FrmSuggestion}; +use common_enums::FrmSuggestion; use common_utils::ext_traits::Encode; -use hyperswitch_domain_models::payments::{ +use data_models::payments::{ payment_attempt::PaymentAttemptUpdate, payment_intent::PaymentIntentUpdate, }; use router_env::{instrument, logger, tracing}; @@ -14,20 +13,18 @@ use crate::{ errors::{RouterResult, StorageErrorExt}, fraud_check::{ self as frm_core, - types::{FrmData, PaymentDetails, PaymentToFrmData, CANCEL_INITIATED}, + types::{FrmData, PaymentDetails, PaymentToFrmData, REFUND_INITIATED}, ConnectorDetailsCore, FrmConfigsObject, }, - payment_methods::Oss, - payments, + payments, refunds, }, db::StorageInterface, - errors, - routes::app::ReqState, - services::{self, api}, + errors, services, types::{ api::{ enums::{AttemptStatus, FrmAction, IntentStatus}, - fraud_check as frm_api, payments as payment_types, Capture, Void, + fraud_check as frm_api, + refunds::{RefundRequest, RefundType}, }, domain, fraud_check::{ @@ -110,7 +107,6 @@ impl GetTracker for FraudCheckPost { metadata: None, modified_at: common_utils::date_time::now(), last_step: FraudCheckLastStep::Processing, - payment_capture_method: payment_data.payment_attempt.capture_method, }) .await } @@ -144,7 +140,6 @@ impl Domain for FraudCheckPost { async fn post_payment_frm<'a>( &'a self, state: &'a AppState, - _req_state: ReqState, payment_data: &mut payments::PaymentData, frm_data: &mut FrmData, merchant_account: &domain::MerchantAccount, @@ -182,7 +177,6 @@ impl Domain for FraudCheckPost { async fn execute_post_tasks( &self, state: &AppState, - req_state: ReqState, frm_data: &mut FrmData, merchant_account: &domain::MerchantAccount, frm_configs: FrmConfigsObject, @@ -190,47 +184,38 @@ impl Domain for FraudCheckPost { key_store: domain::MerchantKeyStore, payment_data: &mut payments::PaymentData, customer: &Option, - _should_continue_capture: &mut bool, ) -> RouterResult> { if matches!(frm_data.fraud_check.frm_status, FraudCheckStatus::Fraud) - && matches!(frm_configs.frm_action, FrmAction::CancelTxn) + && matches!(frm_configs.frm_action, FrmAction::AutoRefund) && matches!( frm_data.fraud_check.last_step, FraudCheckLastStep::CheckoutOrSale ) { - *frm_suggestion = Some(FrmSuggestion::FrmCancelTransaction); - - let cancel_req = api_models::payments::PaymentsCancelRequest { - payment_id: frm_data.payment_intent.payment_id.clone(), - cancellation_reason: frm_data.fraud_check.frm_error.clone(), + *frm_suggestion = Some(FrmSuggestion::FrmAutoRefund); + let ref_req = RefundRequest { + refund_id: None, + payment_id: payment_data.payment_intent.payment_id.clone(), + merchant_id: Some(merchant_account.merchant_id.clone()), + amount: None, + reason: frm_data + .fraud_check + .frm_reason + .clone() + .map(|data| data.to_string()), + refund_type: Some(RefundType::Instant), + metadata: None, merchant_connector_details: None, }; - let cancel_res = Box::pin(payments::payments_core::< - Void, - payment_types::PaymentsResponse, - _, - _, - _, - Oss, - >( + let refund = Box::pin(refunds::refund_create_core( state.clone(), - req_state.clone(), merchant_account.clone(), key_store.clone(), - payments::PaymentCancel, - cancel_req, - api::AuthFlow::Merchant, - payments::CallConnectorAction::Trigger, - None, - HeaderPayload::default(), + ref_req, )) .await?; - logger::debug!("payment_id : {:?} has been cancelled since it has been found fraudulent by configured frm connector",payment_data.payment_attempt.payment_id); - if let services::ApplicationResponse::JsonWithHeaders((payments_response, _)) = - cancel_res - { - payment_data.payment_intent.status = payments_response.status; + if let services::ApplicationResponse::Json(new_refund) = refund { + frm_data.refund = Some(new_refund); } let _router_data = frm_core::call_frm_service::( state, @@ -242,51 +227,6 @@ impl Domain for FraudCheckPost { ) .await?; frm_data.fraud_check.last_step = FraudCheckLastStep::TransactionOrRecordRefund; - } else if matches!(frm_data.fraud_check.frm_status, FraudCheckStatus::Fraud) - && matches!(frm_configs.frm_action, FrmAction::ManualReview) - { - *frm_suggestion = Some(FrmSuggestion::FrmManualReview); - } else if matches!(frm_data.fraud_check.frm_status, FraudCheckStatus::Legit) - && matches!( - frm_data.fraud_check.payment_capture_method, - Some(CaptureMethod::Automatic) - ) - { - let capture_request = api_models::payments::PaymentsCaptureRequest { - payment_id: frm_data.payment_intent.payment_id.clone(), - merchant_id: None, - amount_to_capture: None, - refund_uncaptured_amount: None, - statement_descriptor_suffix: None, - statement_descriptor_prefix: None, - merchant_connector_details: None, - }; - let capture_response = Box::pin(payments::payments_core::< - Capture, - payment_types::PaymentsResponse, - _, - _, - _, - Oss, - >( - state.clone(), - req_state.clone(), - merchant_account.clone(), - key_store.clone(), - payments::PaymentCapture, - capture_request, - api::AuthFlow::Merchant, - payments::CallConnectorAction::Trigger, - None, - HeaderPayload::default(), - )) - .await?; - logger::debug!("payment_id : {:?} has been captured since it has been found legit by configured frm connector",payment_data.payment_attempt.payment_id); - if let services::ApplicationResponse::JsonWithHeaders((payments_response, _)) = - capture_response - { - payment_data.payment_intent.status = payments_response.status; - } }; return Ok(Some(frm_data.to_owned())); } @@ -362,7 +302,6 @@ impl UpdateTracker for FraudCheckPost { metadata: connector_metadata, modified_at: common_utils::date_time::now(), last_step: frm_data.fraud_check.last_step, - payment_capture_method: frm_data.fraud_check.payment_capture_method, }; Some(fraud_check_update) }, @@ -407,7 +346,6 @@ impl UpdateTracker for FraudCheckPost { metadata: connector_metadata, modified_at: common_utils::date_time::now(), last_step: frm_data.fraud_check.last_step, - payment_capture_method: frm_data.fraud_check.payment_capture_method, }; Some(fraud_check_update) } @@ -458,7 +396,6 @@ impl UpdateTracker for FraudCheckPost { metadata: connector_metadata, modified_at: common_utils::date_time::now(), last_step: frm_data.fraud_check.last_step, - payment_capture_method: frm_data.fraud_check.payment_capture_method, }; Some(fraud_check_update) } @@ -475,27 +412,15 @@ impl UpdateTracker for FraudCheckPost { } }; - if let Some(frm_suggestion) = frm_suggestion { - let (payment_attempt_status, payment_intent_status) = match frm_suggestion { - FrmSuggestion::FrmCancelTransaction => { - (AttemptStatus::Failure, IntentStatus::Failed) - } - FrmSuggestion::FrmManualReview => ( - AttemptStatus::Unresolved, - IntentStatus::RequiresMerchantAction, - ), - FrmSuggestion::FrmAuthorizeTransaction => { - (AttemptStatus::Authorized, IntentStatus::RequiresCapture) - } - }; + if frm_suggestion == Some(FrmSuggestion::FrmAutoRefund) { payment_data.payment_attempt = db .update_payment_attempt_with_attempt_id( payment_data.payment_attempt.clone(), PaymentAttemptUpdate::RejectUpdate { - status: payment_attempt_status, + status: AttemptStatus::Failure, error_code: Some(Some(frm_data.fraud_check.frm_status.to_string())), - error_message: Some(Some(CANCEL_INITIATED.to_string())), - updated_by: frm_data.merchant_account.storage_scheme.to_string(), + error_message: Some(Some(REFUND_INITIATED.to_string())), + updated_by: frm_data.merchant_account.storage_scheme.to_string(), // merchant_decision: Some(MerchantDecision::AutoRefunded), }, frm_data.merchant_account.storage_scheme, ) @@ -506,8 +431,8 @@ impl UpdateTracker for FraudCheckPost { .update_payment_intent( payment_data.payment_intent.clone(), PaymentIntentUpdate::RejectUpdate { - status: payment_intent_status, - merchant_decision: Some(MerchantDecision::Rejected.to_string()), + status: IntentStatus::Failed, + merchant_decision: Some(MerchantDecision::AutoRefunded.to_string()), updated_by: frm_data.merchant_account.storage_scheme.to_string(), }, frm_data.merchant_account.storage_scheme, diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs index ae316e7a110..ed582574bf5 100644 --- a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs +++ b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs @@ -18,7 +18,6 @@ use crate::{ }, db::StorageInterface, errors, - routes::app::ReqState, types::{ api::fraud_check as frm_api, domain, @@ -105,7 +104,6 @@ impl GetTracker for FraudCheckPre { metadata: None, modified_at: common_utils::date_time::now(), last_step: FraudCheckLastStep::Processing, - payment_capture_method: payment_data.payment_attempt.capture_method, }) .await } @@ -140,7 +138,6 @@ impl Domain for FraudCheckPre { async fn post_payment_frm<'a>( &'a self, state: &'a AppState, - _req_state: ReqState, payment_data: &mut payments::PaymentData, frm_data: &mut FrmData, merchant_account: &domain::MerchantAccount, @@ -170,7 +167,6 @@ impl Domain for FraudCheckPre { error_code: router_data.request.error_code, error_message: router_data.request.error_message, connector_transaction_id: router_data.request.connector_transaction_id, - connector: router_data.request.connector, }), response: FrmResponse::Transaction(router_data.response), })) @@ -252,7 +248,6 @@ impl UpdateTracker for FraudCheckPre { metadata: connector_metadata, modified_at: common_utils::date_time::now(), last_step: frm_data.fraud_check.last_step, - payment_capture_method: frm_data.fraud_check.payment_capture_method, }; Some(fraud_check_update) } @@ -305,7 +300,6 @@ impl UpdateTracker for FraudCheckPre { metadata: connector_metadata, modified_at: common_utils::date_time::now(), last_step: frm_data.fraud_check.last_step, - payment_capture_method: None, }; Some(fraud_check_update) } diff --git a/crates/router/src/core/fraud_check/types.rs b/crates/router/src/core/fraud_check/types.rs index 5acd722077f..e60458646f3 100644 --- a/crates/router/src/core/fraud_check/types.rs +++ b/crates/router/src/core/fraud_check/types.rs @@ -6,7 +6,7 @@ use api_models::{ }; use common_enums::FrmSuggestion; use common_utils::pii::Email; -use hyperswitch_domain_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent}; +use data_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent}; use masking::Serialize; use serde::Deserialize; use utoipa::ToSchema; @@ -129,18 +129,10 @@ pub struct FrmFulfillmentRequest { #[schema(max_length = 255, example = "fedex")] pub tracking_company: Option, //tracking ID of the product - #[schema(example = r#"["track_8327446667", "track_8327446668"]"#)] - pub tracking_numbers: Option>, + #[schema(max_length = 255, example = "track_8327446667")] + pub tracking_number: Option, //tracking_url for tracking the product - pub tracking_urls: Option>, - // The name of the Shipper. - pub carrier: Option, - // Fulfillment method for the shipment. - pub fulfillment_method: Option, - // Statuses to indicate shipment state. - pub shipment_status: Option, - // The date and time items are ready to be shipped. - pub shipped_at: Option, + pub tracking_url: Option, } #[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] @@ -223,4 +215,4 @@ pub struct FrmFulfillmentSignifydApiResponse { pub shipment_ids: Vec, } -pub const CANCEL_INITIATED: &str = "Cancel Initiated with the processor"; +pub const REFUND_INITIATED: &str = "Refund Initiated with the processor"; diff --git a/crates/router/src/core/health_check.rs b/crates/router/src/core/health_check.rs index e90fe77e808..9997c6261fd 100644 --- a/crates/router/src/core/health_check.rs +++ b/crates/router/src/core/health_check.rs @@ -23,11 +23,6 @@ pub trait HealthCheckInterface { #[cfg(feature = "olap")] async fn health_check_analytics(&self) -> CustomResult; - - #[cfg(feature = "olap")] - async fn health_check_opensearch( - &self, - ) -> CustomResult; } #[async_trait::async_trait] @@ -127,18 +122,6 @@ impl HealthCheckInterface for app::AppState { Ok(HealthState::Running) } - #[cfg(feature = "olap")] - async fn health_check_opensearch( - &self, - ) -> CustomResult { - self.opensearch_client - .deep_health_check() - .await - .change_context(errors::HealthCheckDBError::OpensearchError)?; - - Ok(HealthState::Running) - } - async fn health_check_outgoing( &self, ) -> CustomResult { diff --git a/crates/router/src/core/locker_migration.rs b/crates/router/src/core/locker_migration.rs index bad3b2184b5..53f503e8711 100644 --- a/crates/router/src/core/locker_migration.rs +++ b/crates/router/src/core/locker_migration.rs @@ -85,7 +85,7 @@ pub async fn call_to_locker( for pm in payment_methods .into_iter() - .filter(|pm| matches!(pm.payment_method, Some(storage_enums::PaymentMethod::Card))) + .filter(|pm| matches!(pm.payment_method, storage_enums::PaymentMethod::Card)) { let card = cards::get_card_from_locker( state, @@ -128,8 +128,6 @@ pub async fn call_to_locker( metadata: pm.metadata, customer_id: Some(pm.customer_id), card_network: card.card_brand, - client_secret: None, - payment_method_data: None, }; let add_card_result = cards::add_card_hs( diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs index 939367bd4db..0ad13f0703c 100644 --- a/crates/router/src/core/mandate.rs +++ b/crates/router/src/core/mandate.rs @@ -23,8 +23,7 @@ use crate::{ mandates::{self, MandateResponseExt}, ConnectorData, GetToken, }, - domain, - storage::{self, enums::MerchantStorageScheme}, + domain, storage, transformers::ForeignFrom, }, utils::OptionExt, @@ -40,21 +39,11 @@ pub async fn get_mandate( let mandate = state .store .as_ref() - .find_mandate_by_merchant_id_mandate_id( - &merchant_account.merchant_id, - &req.mandate_id, - merchant_account.storage_scheme, - ) + .find_mandate_by_merchant_id_mandate_id(&merchant_account.merchant_id, &req.mandate_id) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?; Ok(services::ApplicationResponse::Json( - mandates::MandateResponse::from_db_mandate( - &state, - key_store, - mandate, - merchant_account.storage_scheme, - ) - .await?, + mandates::MandateResponse::from_db_mandate(&state, key_store, mandate).await?, )) } @@ -67,11 +56,7 @@ pub async fn revoke_mandate( ) -> RouterResponse { let db = state.store.as_ref(); let mandate = db - .find_mandate_by_merchant_id_mandate_id( - &merchant_account.merchant_id, - &req.mandate_id, - merchant_account.storage_scheme, - ) + .find_mandate_by_merchant_id_mandate_id(&merchant_account.merchant_id, &req.mandate_id) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?; match mandate.mandate_status { @@ -132,8 +117,6 @@ pub async fn revoke_mandate( storage::MandateUpdate::StatusUpdate { mandate_status: storage::enums::MandateStatus::Revoked, }, - mandate, - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?; @@ -173,7 +156,6 @@ pub async fn update_connector_mandate_id( mandate_ids_opt: Option, payment_method_id: Option, resp: Result, - storage_scheme: MerchantStorageScheme, ) -> RouterResponse { let mandate_details = Option::foreign_from(resp); let connector_mandate_id = mandate_details @@ -188,7 +170,7 @@ pub async fn update_connector_mandate_id( //Ignore updation if the payment_attempt mandate_id or connector_mandate_id is not present if let Some((mandate_id, connector_id)) = mandate_ids_opt.zip(connector_mandate_id) { let mandate = db - .find_mandate_by_merchant_id_mandate_id(&merchant_account, &mandate_id, storage_scheme) + .find_mandate_by_merchant_id_mandate_id(&merchant_account, &mandate_id) .await .change_context(errors::ApiErrorResponse::MandateNotFound)?; @@ -211,8 +193,6 @@ pub async fn update_connector_mandate_id( &merchant_account, &mandate_id, update_mandate_details, - mandate, - storage_scheme, ) .await .change_context(errors::ApiErrorResponse::MandateUpdateFailed)?; @@ -246,13 +226,8 @@ pub async fn get_customer_mandates( let mut response_vec = Vec::with_capacity(mandates.len()); for mandate in mandates { response_vec.push( - mandates::MandateResponse::from_db_mandate( - &state, - key_store.clone(), - mandate, - merchant_account.storage_scheme, - ) - .await?, + mandates::MandateResponse::from_db_mandate(&state, key_store.clone(), mandate) + .await?, ); } Ok(services::ApplicationResponse::Json(response_vec)) @@ -261,12 +236,12 @@ pub async fn get_customer_mandates( fn get_insensitive_payment_method_data_if_exists( router_data: &types::RouterData, -) -> Option +) -> Option where FData: MandateBehaviour, { match &router_data.request.get_payment_method_data() { - domain::PaymentMethodData::Card(_) => None, + api_models::payments::PaymentMethodData::Card(_) => None, _ => Some(router_data.request.get_payment_method_data()), } } @@ -276,7 +251,6 @@ pub async fn update_mandate_procedure( mandate: Mandate, merchant_id: &str, pm_id: Option, - storage_scheme: MerchantStorageScheme, ) -> errors::RouterResult> where FData: MandateBehaviour, @@ -291,14 +265,13 @@ where }; let old_record = payments::UpdateHistory { - connector_mandate_id: mandate.connector_mandate_id.clone(), - payment_method_id: mandate.payment_method_id.clone(), - original_payment_id: mandate.original_payment_id.clone(), + connector_mandate_id: mandate.connector_mandate_id, + payment_method_id: mandate.payment_method_id, + original_payment_id: mandate.original_payment_id, }; let mandate_ref = mandate .connector_mandate_ids - .clone() .parse_value::("Connector Reference Id") .change_context(errors::ApiErrorResponse::MandateDeserializationFailed)?; @@ -318,12 +291,11 @@ where .change_context(errors::ApiErrorResponse::InternalServerError) .map(masking::Secret::new)?; - let mandate_id = mandate.mandate_id.clone(); let _update_mandate_details = state .store .update_mandate_by_merchant_id_mandate_id( merchant_id, - &mandate_id, + &mandate.mandate_id, diesel_models::MandateUpdate::ConnectorMandateIdUpdate { connector_mandate_id: mandate_details .as_ref() @@ -333,141 +305,155 @@ where .unwrap_or("Error retrieving the payment_method_id".to_string()), original_payment_id: Some(resp.payment_id.clone()), }, - mandate, - storage_scheme, ) .await .change_context(errors::ApiErrorResponse::MandateUpdateFailed)?; Ok(resp) } - pub async fn mandate_procedure( state: &AppState, - resp: &types::RouterData, - customer_id: &Option, + mut resp: types::RouterData, + maybe_customer: &Option, pm_id: Option, merchant_connector_id: Option, - storage_scheme: MerchantStorageScheme, -) -> errors::RouterResult> +) -> errors::RouterResult> where FData: MandateBehaviour, { - let Ok(ref response) = resp.response else { - return Ok(None); - }; - - match resp.request.get_mandate_id() { - Some(mandate_id) => { - let Some(ref mandate_id) = mandate_id.mandate_id else { - return Ok(None); - }; - let orig_mandate = state - .store - .find_mandate_by_merchant_id_mandate_id( - resp.merchant_id.as_ref(), - mandate_id, - storage_scheme, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?; - let mandate = match orig_mandate.mandate_type { - storage_enums::MandateType::SingleUse => state - .store - .update_mandate_by_merchant_id_mandate_id( - &resp.merchant_id, - mandate_id, - storage::MandateUpdate::StatusUpdate { - mandate_status: storage_enums::MandateStatus::Revoked, - }, - orig_mandate, - storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::MandateUpdateFailed), - storage_enums::MandateType::MultiUse => state - .store - .update_mandate_by_merchant_id_mandate_id( - &resp.merchant_id, - mandate_id, - storage::MandateUpdate::CaptureAmountUpdate { - amount_captured: Some( - orig_mandate.amount_captured.unwrap_or(0) - + resp.request.get_amount(), - ), - }, - orig_mandate, - storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::MandateUpdateFailed), - }?; - metrics::SUBSEQUENT_MANDATE_PAYMENT.add( - &metrics::CONTEXT, - 1, - &[metrics::request::add_attributes( - "connector", - mandate.connector, - )], - ); - Ok(Some(mandate_id.clone())) - } - None => { - let Some(_mandate_details) = resp.request.get_setup_mandate_details() else { - return Ok(None); - }; - let (mandate_reference, network_txn_id) = match &response { - types::PaymentsResponseData::TransactionResponse { - mandate_reference, - network_txn_id, - .. - } => (mandate_reference.clone(), network_txn_id.clone()), - _ => (None, None), - }; - - let mandate_ids = mandate_reference - .as_ref() - .map(|md| { - md.encode_to_value() - .change_context(errors::ApiErrorResponse::MandateSerializationFailed) - .map(masking::Secret::new) - }) - .transpose()?; - - let Some(new_mandate_data) = payment_helper::generate_mandate( - resp.merchant_id.clone(), - resp.payment_id.clone(), - resp.connector.clone(), - resp.request.get_setup_mandate_details().cloned(), - customer_id, - pm_id.get_required_value("payment_method_id")?, - mandate_ids, - network_txn_id, - get_insensitive_payment_method_data_if_exists(resp), - mandate_reference, - merchant_connector_id, - )? - else { - return Ok(None); - }; - - let connector = new_mandate_data.connector.clone(); - logger::debug!("{:?}", new_mandate_data); - - let res_mandate_id = new_mandate_data.mandate_id.clone(); - - state - .store - .insert_mandate(new_mandate_data, storage_scheme) - .await - .to_duplicate_response(errors::ApiErrorResponse::DuplicateMandate)?; - metrics::MANDATE_COUNT.add( - &metrics::CONTEXT, - 1, - &[metrics::request::add_attributes("connector", connector)], - ); - Ok(Some(res_mandate_id)) - } + match resp.response { + Err(_) => {} + Ok(_) => match resp.request.get_mandate_id() { + Some(mandate_id) => { + if let Some(ref mandate_id) = mandate_id.mandate_id { + let mandate = state + .store + .find_mandate_by_merchant_id_mandate_id( + resp.merchant_id.as_ref(), + mandate_id, + ) + .await + .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?; + let mandate = match mandate.mandate_type { + storage_enums::MandateType::SingleUse => state + .store + .update_mandate_by_merchant_id_mandate_id( + &resp.merchant_id, + mandate_id, + storage::MandateUpdate::StatusUpdate { + mandate_status: storage_enums::MandateStatus::Revoked, + }, + ) + .await + .change_context(errors::ApiErrorResponse::MandateUpdateFailed), + storage_enums::MandateType::MultiUse => state + .store + .update_mandate_by_merchant_id_mandate_id( + &resp.merchant_id, + mandate_id, + storage::MandateUpdate::CaptureAmountUpdate { + amount_captured: Some( + mandate.amount_captured.unwrap_or(0) + + resp.request.get_amount(), + ), + }, + ) + .await + .change_context(errors::ApiErrorResponse::MandateUpdateFailed), + }?; + metrics::SUBSEQUENT_MANDATE_PAYMENT.add( + &metrics::CONTEXT, + 1, + &[metrics::request::add_attributes( + "connector", + mandate.connector, + )], + ); + resp.payment_method_id = Some(mandate.payment_method_id); + } + } + None => { + if resp.request.get_setup_mandate_details().is_some() { + resp.payment_method_id = pm_id.clone(); + let (mandate_reference, network_txn_id) = match resp.response.as_ref().ok() { + Some(types::PaymentsResponseData::TransactionResponse { + mandate_reference, + network_txn_id, + .. + }) => (mandate_reference.clone(), network_txn_id.clone()), + _ => (None, None), + }; + + let mandate_ids = mandate_reference + .as_ref() + .map(|md| { + md.encode_to_value() + .change_context( + errors::ApiErrorResponse::MandateSerializationFailed, + ) + .map(masking::Secret::new) + }) + .transpose()?; + + if let Some(new_mandate_data) = payment_helper::generate_mandate( + resp.merchant_id.clone(), + resp.payment_id.clone(), + resp.connector.clone(), + resp.request.get_setup_mandate_details().cloned(), + maybe_customer, + pm_id.get_required_value("payment_method_id")?, + mandate_ids, + network_txn_id, + get_insensitive_payment_method_data_if_exists(&resp), + mandate_reference, + merchant_connector_id, + )? { + let connector = new_mandate_data.connector.clone(); + logger::debug!("{:?}", new_mandate_data); + resp.request + .set_mandate_id(Some(api_models::payments::MandateIds { + mandate_id: Some(new_mandate_data.mandate_id.clone()), + mandate_reference_id: new_mandate_data + .connector_mandate_ids + .clone() + .map(|ids| { + Some(ids) + .parse_value::( + "ConnectorMandateId", + ) + .change_context(errors::ApiErrorResponse::MandateDeserializationFailed) + }) + .transpose()? + .map_or( + new_mandate_data.network_transaction_id.clone().map(|id| { + api_models::payments::MandateReferenceId::NetworkMandateId( + id, + ) + }), + |connector_id| Some(api_models::payments::MandateReferenceId::ConnectorMandateId( + api_models::payments::ConnectorMandateReferenceId { + connector_mandate_id: connector_id.connector_mandate_id, + payment_method_id: connector_id.payment_method_id, + update_history:None, + + } + ))) + })); + state + .store + .insert_mandate(new_mandate_data) + .await + .to_duplicate_response(errors::ApiErrorResponse::DuplicateMandate)?; + metrics::MANDATE_COUNT.add( + &metrics::CONTEXT, + 1, + &[metrics::request::add_attributes("connector", connector)], + ); + }; + } + } + }, } + Ok(resp) } #[instrument(skip(state))] @@ -485,12 +471,7 @@ pub async fn retrieve_mandates_list( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unable to retrieve mandates")?; let mandates_list = future::try_join_all(mandates.into_iter().map(|mandate| { - mandates::MandateResponse::from_db_mandate( - &state, - key_store.clone(), - mandate, - merchant_account.storage_scheme, - ) + mandates::MandateResponse::from_db_mandate(&state, key_store.clone(), mandate) })) .await?; Ok(services::ApplicationResponse::Json(mandates_list)) @@ -514,9 +495,7 @@ pub trait MandateBehaviour { fn get_setup_future_usage(&self) -> Option; fn get_mandate_id(&self) -> Option<&api_models::payments::MandateIds>; fn set_mandate_id(&mut self, new_mandate_id: Option); - fn get_payment_method_data(&self) -> domain::payments::PaymentMethodData; - fn get_setup_mandate_details( - &self, - ) -> Option<&hyperswitch_domain_models::mandates::MandateData>; + fn get_payment_method_data(&self) -> api_models::payments::PaymentMethodData; + fn get_setup_mandate_details(&self) -> Option<&data_models::mandates::MandateData>; fn get_customer_acceptance(&self) -> Option; } diff --git a/crates/router/src/core/mandate/helpers.rs b/crates/router/src/core/mandate/helpers.rs index f3b7b384e2d..704b7ae99f5 100644 --- a/crates/router/src/core/mandate/helpers.rs +++ b/crates/router/src/core/mandate/helpers.rs @@ -1,14 +1,13 @@ -use api_models::payments as api_payments; use common_enums::enums; use common_utils::errors::CustomResult; +use data_models::mandates::MandateData; use diesel_models::Mandate; use error_stack::ResultExt; -use hyperswitch_domain_models::mandates::MandateData; use crate::{ core::{errors, payments}, routes::AppState, - types::{api, domain}, + types::domain, }; pub async fn get_profile_id_for_mandate( @@ -41,40 +40,6 @@ pub async fn get_profile_id_for_mandate( Ok(profile_id) } -pub fn get_mandate_type( - mandate_data: Option, - off_session: Option, - setup_future_usage: Option, - customer_acceptance: Option, - token: Option, -) -> CustomResult, errors::ValidationError> { - match ( - mandate_data.clone(), - off_session, - setup_future_usage, - customer_acceptance.or(mandate_data.and_then(|m_data| m_data.customer_acceptance)), - token, - ) { - (Some(_), Some(_), Some(enums::FutureUsage::OffSession), Some(_), Some(_)) => { - Err(errors::ValidationError::InvalidValue { - message: "Expected one out of recurring_details and mandate_data but got both" - .to_string(), - } - .into()) - } - (_, _, Some(enums::FutureUsage::OffSession), Some(_), Some(_)) - | (_, _, Some(enums::FutureUsage::OffSession), Some(_), _) - | (Some(_), _, Some(enums::FutureUsage::OffSession), _, _) => { - Ok(Some(api::MandateTransactionType::NewMandateTransaction)) - } - - (_, _, Some(enums::FutureUsage::OffSession), _, Some(_)) | (_, Some(_), _, _, _) => Ok( - Some(api::MandateTransactionType::RecurringMandateTransaction), - ), - - _ => Ok(None), - } -} #[derive(Clone)] pub struct MandateGenericData { pub token: Option, diff --git a/crates/router/src/core/mandate/utils.rs b/crates/router/src/core/mandate/utils.rs index ec438ee6d78..7b4933812e5 100644 --- a/crates/router/src/core/mandate/utils.rs +++ b/crates/router/src/core/mandate/utils.rs @@ -59,6 +59,7 @@ pub async fn construct_mandate_revoke_router_data( connector_mandate_id: mandate.connector_mandate_id, }, response: Err(types::ErrorResponse::get_not_implemented()), + payment_method_id: None, connector_request_reference_id: IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_MANDATE_REVOKE_FLOW.to_string(), test_mode: None, diff --git a/crates/router/src/core/metrics.rs b/crates/router/src/core/metrics.rs index 0e36ed165b2..c5a05a169c7 100644 --- a/crates/router/src/core/metrics.rs +++ b/crates/router/src/core/metrics.rs @@ -22,7 +22,7 @@ counter_metric!( counter_metric!( ACCEPT_DISPUTE_STATUS_VALIDATION_FAILURE_METRIC, GLOBAL_METER -); //No. of status validation failures while accepting a dispute +); //No. of status validation failures while accpeting a dispute counter_metric!( EVIDENCE_SUBMISSION_DISPUTE_STATUS_VALIDATION_FAILURE_METRIC, GLOBAL_METER diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs index 3f9f5f017a7..722aad26c0d 100644 --- a/crates/router/src/core/payment_link.rs +++ b/crates/router/src/core/payment_link.rs @@ -1,8 +1,8 @@ use api_models::{admin as admin_types, payments::PaymentLinkStatusWrap}; use common_utils::{ consts::{ - DEFAULT_BACKGROUND_COLOR, DEFAULT_DISPLAY_SDK_ONLY, DEFAULT_ENABLE_SAVED_PAYMENT_METHOD, - DEFAULT_MERCHANT_LOGO, DEFAULT_PRODUCT_IMG, DEFAULT_SDK_LAYOUT, DEFAULT_SESSION_EXPIRY, + DEFAULT_BACKGROUND_COLOR, DEFAULT_MERCHANT_LOGO, DEFAULT_PRODUCT_IMG, DEFAULT_SDK_LAYOUT, + DEFAULT_SESSION_EXPIRY, }, ext_traits::{OptionExt, ValueExt}, }; @@ -46,7 +46,7 @@ pub async fn retrieve_payment_link( Ok(services::ApplicationResponse::Json(response)) } -pub async fn initiate_payment_link_flow( +pub async fn intiate_payment_link_flow( state: AppState, merchant_account: domain::MerchantAccount, merchant_id: String, @@ -86,8 +86,6 @@ pub async fn initiate_payment_link_flow( logo: DEFAULT_MERCHANT_LOGO.to_string(), seller_name: merchant_name_from_merchant_account, sdk_layout: DEFAULT_SDK_LAYOUT.to_owned(), - display_sdk_only: DEFAULT_DISPLAY_SDK_ONLY, - enabled_saved_payment_method: DEFAULT_ENABLE_SAVED_PAYMENT_METHOD, } }; @@ -189,7 +187,7 @@ pub async fn initiate_payment_link_flow( return_url: return_url.clone(), }; let js_script = get_js_script( - &api_models::payments::PaymentLinkData::PaymentLinkStatusDetails(payment_details), + api_models::payments::PaymentLinkData::PaymentLinkStatusDetails(payment_details), )?; let payment_link_error_data = services::PaymentLinkStatusData { js_script, @@ -215,21 +213,15 @@ pub async fn initiate_payment_link_flow( theme: payment_link_config.theme.clone(), merchant_description: payment_intent.description, sdk_layout: payment_link_config.sdk_layout.clone(), - display_sdk_only: payment_link_config.display_sdk_only, - enabled_saved_payment_method: payment_link_config.enabled_saved_payment_method, }; - let js_script = get_js_script(&api_models::payments::PaymentLinkData::PaymentLinkDetails( - &payment_details, + let js_script = get_js_script(api_models::payments::PaymentLinkData::PaymentLinkDetails( + payment_details, ))?; - - let html_meta_tags = get_meta_tags_html(payment_details); - let payment_link_data = services::PaymentLinkFormData { js_script, sdk_url: state.conf.payment_link.sdk_url.clone(), css_script, - html_meta_tags, }; Ok(services::ApplicationResponse::PaymentLinkForm(Box::new( services::api::PaymentLinkAction::PaymentLinkFormData(payment_link_data), @@ -240,10 +232,8 @@ pub async fn initiate_payment_link_flow( The get_js_script function is used to inject dynamic value to payment_link sdk, which is unique to every payment. */ -fn get_js_script( - payment_details: &api_models::payments::PaymentLinkData<'_>, -) -> RouterResult { - let payment_details_str = serde_json::to_string(payment_details) +fn get_js_script(payment_details: api_models::payments::PaymentLinkData) -> RouterResult { + let payment_details_str = serde_json::to_string(&payment_details) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to serialize PaymentLinkData")?; Ok(format!("window.__PAYMENT_DETAILS = {payment_details_str};")) @@ -258,15 +248,6 @@ fn get_color_scheme_css(payment_link_config: api_models::admin::PaymentLinkConfi ) } -fn get_meta_tags_html(payment_details: api_models::payments::PaymentLinkDetails) -> String { - format!( - r#" - "#, - payment_details.merchant_name, - payment_details.merchant_description.unwrap_or_default() - ) -} - fn validate_sdk_requirements( pub_key: Option, currency: Option, @@ -444,35 +425,11 @@ pub fn get_payment_link_config_based_on_priority( }) .unwrap_or(DEFAULT_SDK_LAYOUT.to_owned()); - let display_sdk_only = payment_create_link_config - .as_ref() - .and_then(|pc_config| { - pc_config.config.display_sdk_only.or_else(|| { - business_config - .as_ref() - .and_then(|business_config| business_config.display_sdk_only) - }) - }) - .unwrap_or(DEFAULT_DISPLAY_SDK_ONLY); - - let enabled_saved_payment_method = payment_create_link_config - .as_ref() - .and_then(|pc_config| { - pc_config.config.enabled_saved_payment_method.or_else(|| { - business_config - .as_ref() - .and_then(|business_config| business_config.enabled_saved_payment_method) - }) - }) - .unwrap_or(DEFAULT_ENABLE_SAVED_PAYMENT_METHOD); - let payment_link_config = admin_types::PaymentLinkConfig { theme, logo, seller_name, sdk_layout, - display_sdk_only, - enabled_saved_payment_method, }; Ok((payment_link_config, domain_name)) @@ -549,8 +506,6 @@ pub async fn get_payment_link_status( logo: DEFAULT_MERCHANT_LOGO.to_string(), seller_name: merchant_name_from_merchant_account, sdk_layout: DEFAULT_SDK_LAYOUT.to_owned(), - display_sdk_only: DEFAULT_DISPLAY_SDK_ONLY, - enabled_saved_payment_method: DEFAULT_ENABLE_SAVED_PAYMENT_METHOD, } }; @@ -607,7 +562,7 @@ pub async fn get_payment_link_status( return_url, }; let js_script = get_js_script( - &api_models::payments::PaymentLinkData::PaymentLinkStatusDetails(payment_details), + api_models::payments::PaymentLinkData::PaymentLinkStatusDetails(payment_details), )?; let payment_link_status_data = services::PaymentLinkStatusData { js_script, diff --git a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.css b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.css index 617a28377ac..67aad698210 100644 --- a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.css +++ b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.css @@ -29,6 +29,90 @@ body { /* Firefox */ } +/* add shimmer */ +#payment-details-shimmer{ + min-width: 300px; + width: 100%; + margin: 0; + border: 0; + border-radius: 0; + height: 100%; + position: fixed; + top: 0; + left: 0; + background: linear-gradient(to right, #f6f7f8 0%, #edeef1 50%, #f6f7f8 100%); + background-size: 300%; + animation: shimmer 1.5s infinite linear; + background-position-x: -100%; + justify-content: center; + display: flex; + align-items: center; + flex-direction: column; + z-index: 3; + transition: opacity 0.5s; + opacity: 1; +} + +.reduce-opacity { + opacity: 0 !important; +} + +.shine { + background: #f6f7f8; + background-image: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%); + background-repeat: no-repeat; + background-size: 800px 104px; + display: inline-block; + position: relative; + justify-content: center; + display: flex; + -webkit-animation-duration: 2s; + -webkit-animation-fill-mode: forwards; + -webkit-animation-iteration-count: infinite; + -webkit-animation-name: placeholderShimmer; + -webkit-animation-timing-function: linear; +} + +.wrap { + display: inline-flex; + margin: 10px; +} + +box { + height: 104px; + width: 100px; + border-radius: 25px; +} + +lines { + height: 15px; + width: 200px; + border-radius: 25px; + margin: 7px; +} + +.line-shimmer > :first-child{ + width: 140px; +} + +.line-shimmer { + display: inline-flex; + flex-direction: column; + margin-left: 25px; + margin-top: 15px; + vertical-align: top; +} + +@-webkit-keyframes placeholderShimmer { + 0% { + background-position: -468px 0; + } + + 100% { + background-position: 468px 0; + } +} + /* For ellipsis on text lines */ .ellipsis-container-3 { height: 4em; diff --git a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.html b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.html index fc8121c5057..732e331892f 100644 --- a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.html +++ b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.html @@ -3,94 +3,12 @@ - {{rendered_meta_tag_html}} Payments requested by HyperSwitch {{ preload_link_tags }} @@ -120,10 +38,6 @@ - - @@ -193,7 +107,7 @@
-
+
diff --git a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js index 7ab10e4d27b..da6899923b4 100644 --- a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js +++ b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js @@ -194,52 +194,38 @@ function boot() { // @ts-ignore var paymentDetails = window.__PAYMENT_DETAILS; + var orderDetails = paymentDetails.order_details; + if (orderDetails!==null) { + var charges = 0; - if (paymentDetails.display_sdk_only) { - hide(".checkout-page") - var sdkDisplayWidth = document.querySelector('.hyper-checkout-sdk'); - sdkDisplayWidth.style.width = '100vw'; - } - else { - var orderDetails = paymentDetails.order_details; - if (orderDetails!==null) { - var charges = 0; - - for (var i = 0; i < orderDetails.length; i++) { - charges += parseFloat(orderDetails[i].amount * orderDetails[i].quantity); - } - orderDetails.push({ - "amount": (paymentDetails.amount - charges).toFixed(2), - "product_img_link": "https://live.hyperswitch.io/payment-link-assets/cart_placeholder.png", - "product_name": "Miscellaneous charges\n" + - "(includes taxes, shipping, discounts, offers etc.)", - "quantity": null - }); - } - - if (paymentDetails.merchant_name) { - document.title = "Payment requested by " + paymentDetails.merchant_name; - } - - if (paymentDetails.merchant_logo) { - var link = document.createElement("link"); - link.rel = "icon"; - link.href = paymentDetails.merchant_logo; - link.type = "image/x-icon"; - document.head.appendChild(link); + for (var i = 0; i < orderDetails.length; i++) { + charges += parseFloat(orderDetails[i].amount * orderDetails[i].quantity); } + orderDetails.push({ + "amount": (paymentDetails.amount - charges).toFixed(2), + "product_img_link": "https://live.hyperswitch.io/payment-link-assets/cart_placeholder.png", + "product_name": "Miscellaneous charges\n" + + "(includes taxes, shipping, discounts, offers etc.)", + "quantity": null + }); } - // Render UI - if (paymentDetails.display_sdk_only){ - renderSDKHeader(paymentDetails); + if (paymentDetails.merchant_name) { + document.title = "Payment requested by " + paymentDetails.merchant_name; } - else{ - renderPaymentDetails(paymentDetails); - renderCart(paymentDetails); - renderSDKHeader(paymentDetails); + + if (paymentDetails.merchant_logo) { + var link = document.createElement("link"); + link.rel = "icon"; + link.href = paymentDetails.merchant_logo; + link.type = "image/x-icon"; + document.head.appendChild(link); } + // Render UI + renderPaymentDetails(paymentDetails); + renderSDKHeader(paymentDetails); + renderCart(paymentDetails); // Deal w loaders show("#sdk-spinner"); @@ -369,11 +355,9 @@ function initializeEventListeners(paymentDetails) { * Trigger - post mounting SDK * Use - set relevant classes to elements in the doc for showing SDK **/ -function showSDK(display_sdk_only) { - if (!display_sdk_only) { - show("#hyper-checkout-details"); - } +function showSDK() { show("#hyper-checkout-sdk"); + show("#hyper-checkout-details"); show("#submit"); show("#unified-checkout"); hide("#sdk-spinner"); @@ -417,10 +401,9 @@ function initializeSDK() { ? "accordion" : paymentDetails.sdk_layout; - var enableSavedPaymentMethod = paymentDetails.enabled_saved_payment_method; var unifiedCheckoutOptions = { - displaySavedPaymentMethodsCheckbox: enableSavedPaymentMethod, - displaySavedPaymentMethods: enableSavedPaymentMethod, + displaySavedPaymentMethodsCheckbox: false, + displaySavedPaymentMethods: false, layout: { type: type, //accordion , tabs, spaced accordion spacedAccordionItems: paymentDetails.sdk_layout === "spaced_accordion", @@ -437,7 +420,7 @@ function initializeSDK() { }; unifiedCheckout = widgets.create("payment", unifiedCheckoutOptions); mountUnifiedCheckout("#unified-checkout"); - showSDK(paymentDetails.display_sdk_only); + showSDK(); let shimmer = document.getElementById("payment-details-shimmer"); shimmer.classList.add("reduce-opacity") diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index b2a4959edfb..dd109e99cb9 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -7,8 +7,8 @@ pub use api_models::enums::Connector; use api_models::payments::CardToken; #[cfg(feature = "payouts")] pub use api_models::{enums::PayoutConnectors, payouts as payout_types}; +use data_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent}; use diesel_models::enums; -use hyperswitch_domain_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent}; use crate::{ core::{errors::RouterResult, payments::helpers, pm_auth as core_pm_auth}, @@ -38,7 +38,6 @@ pub trait PaymentMethodRetrieve { payment_intent: &PaymentIntent, card_token_data: Option<&CardToken>, customer: &Option, - storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> RouterResult; } @@ -123,7 +122,6 @@ impl PaymentMethodRetrieve for Oss { payment_intent: &PaymentIntent, card_token_data: Option<&CardToken>, customer: &Option, - storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> RouterResult { let token = match token_data { storage::PaymentTokenData::TemporaryGeneric(generic_token) => { @@ -174,8 +172,6 @@ impl PaymentMethodRetrieve for Oss { .unwrap_or(&card_token.token), payment_intent, card_token_data, - merchant_key_store, - storage_scheme, ) .await .map(|card| Some((card, enums::PaymentMethod::Card)))? @@ -205,8 +201,6 @@ impl PaymentMethodRetrieve for Oss { .unwrap_or(&card_token.token), payment_intent, card_token_data, - merchant_key_store, - storage_scheme, ) .await .map(|card| Some((card, enums::PaymentMethod::Card)))? diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 27d126bce90..59215da32f1 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -7,8 +7,8 @@ use api_models::{ admin::{self, PaymentMethodsEnabled}, enums::{self as api_enums}, payment_methods::{ - BankAccountTokenData, Card, CardDetailUpdate, CardDetailsPaymentMethod, CardNetworkTypes, - CountryCodeWithName, CustomerDefaultPaymentMethodResponse, ListCountriesCurrenciesRequest, + BankAccountTokenData, CardDetailsPaymentMethod, CardNetworkTypes, CountryCodeWithName, + CustomerDefaultPaymentMethodResponse, ListCountriesCurrenciesRequest, ListCountriesCurrenciesResponse, MaskedBankDetails, PaymentExperienceTypes, PaymentMethodsData, RequestPaymentMethodTypes, RequiredFieldInfo, ResponsePaymentMethodIntermediate, ResponsePaymentMethodTypes, @@ -18,7 +18,6 @@ use api_models::{ pm_auth::PaymentMethodAuthConfig, surcharge_decision_configs as api_surcharge_decision_configs, }; -use common_enums::enums::MerchantStorageScheme; use common_utils::{ consts, ext_traits::{AsyncExt, Encode, StringExt, ValueExt}, @@ -44,7 +43,10 @@ use crate::{ configs::settings, core::{ errors::{self, StorageErrorExt}, - payment_methods::{transformers as payment_methods, vault}, + payment_methods::{ + transformers::{self as payment_methods}, + vault, + }, payments::{ helpers, routing::{self, SessionFlowRoutingInput}, @@ -85,59 +87,39 @@ pub async fn create_payment_method( payment_method_data: Option, key_store: &domain::MerchantKeyStore, connector_mandate_details: Option, - status: Option, - network_transaction_id: Option, - storage_scheme: MerchantStorageScheme, ) -> errors::CustomResult { let customer = db - .find_customer_by_customer_id_merchant_id( - customer_id, - merchant_id, - key_store, - storage_scheme, - ) + .find_customer_by_customer_id_merchant_id(customer_id, merchant_id, key_store) .await .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?; - let client_secret = generate_id( - consts::ID_LENGTH, - format!("{payment_method_id}_secret").as_str(), - ); - let response = db - .insert_payment_method( - storage::PaymentMethodNew { - customer_id: customer_id.to_string(), - merchant_id: merchant_id.to_string(), - payment_method_id: payment_method_id.to_string(), - locker_id, - payment_method: req.payment_method, - payment_method_type: req.payment_method_type, - payment_method_issuer: req.payment_method_issuer.clone(), - scheme: req.card_network.clone(), - metadata: pm_metadata.map(masking::Secret::new), - payment_method_data, - connector_mandate_details, - customer_acceptance: customer_acceptance.map(masking::Secret::new), - client_secret: Some(client_secret), - status: status.unwrap_or(enums::PaymentMethodStatus::Active), - network_transaction_id: network_transaction_id.to_owned(), - ..storage::PaymentMethodNew::default() - }, - storage_scheme, - ) + .insert_payment_method(storage::PaymentMethodNew { + customer_id: customer_id.to_string(), + merchant_id: merchant_id.to_string(), + payment_method_id: payment_method_id.to_string(), + locker_id, + payment_method: req.payment_method, + payment_method_type: req.payment_method_type, + payment_method_issuer: req.payment_method_issuer.clone(), + scheme: req.card_network.clone(), + metadata: pm_metadata.map(masking::Secret::new), + payment_method_data, + connector_mandate_details, + customer_acceptance: customer_acceptance.map(masking::Secret::new), + ..storage::PaymentMethodNew::default() + }) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to add payment method in db")?; - if customer.default_payment_method_id.is_none() && req.payment_method.is_some() { + if customer.default_payment_method_id.is_none() { let _ = set_default_payment_method( db, merchant_id.to_string(), key_store.clone(), customer_id, payment_method_id.to_owned(), - storage_scheme, ) .await .map_err(|err| logger::error!(error=?err,"Failed to set the payment method as default")); @@ -169,7 +151,6 @@ pub fn store_default_payment_method( installment_payment_enabled: false, //[#219] payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), last_used_at: Some(common_utils::date_time::now()), - client_secret: None, }; (payment_method_response, None) @@ -186,18 +167,13 @@ pub async fn get_or_insert_payment_method( let mut payment_method_id = resp.payment_method_id.clone(); let mut locker_id = None; let payment_method = { - let existing_pm_by_pmid = db - .find_payment_method(&payment_method_id, merchant_account.storage_scheme) - .await; + let existing_pm_by_pmid = db.find_payment_method(&payment_method_id).await; if let Err(err) = existing_pm_by_pmid { if err.current_context().is_db_not_found() { locker_id = Some(payment_method_id.clone()); let existing_pm_by_locker_id = db - .find_payment_method_by_locker_id( - &payment_method_id, - merchant_account.storage_scheme, - ) + .find_payment_method_by_locker_id(&payment_method_id) .await; match &existing_pm_by_locker_id { @@ -229,8 +205,6 @@ pub async fn get_or_insert_payment_method( None, locker_id, None, - None, - merchant_account.storage_scheme, ) .await } else { @@ -242,253 +216,6 @@ pub async fn get_or_insert_payment_method( } } -#[instrument(skip_all)] -pub async fn get_client_secret_or_add_payment_method( - state: routes::AppState, - req: api::PaymentMethodCreate, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, -) -> errors::RouterResponse { - let db = &*state.store; - let merchant_id = &merchant_account.merchant_id; - let customer_id = req.customer_id.clone().get_required_value("customer_id")?; - - #[cfg(not(feature = "payouts"))] - let condition = req.card.is_some(); - #[cfg(feature = "payouts")] - let condition = req.card.is_some() || req.bank_transfer.is_some() || req.wallet.is_some(); - - if condition { - add_payment_method(state, req, merchant_account, key_store).await - } else { - let payment_method_id = generate_id(consts::ID_LENGTH, "pm"); - - let res = create_payment_method( - db, - &req, - customer_id.as_str(), - payment_method_id.as_str(), - None, - merchant_id.as_str(), - None, - None, - None, - key_store, - None, - Some(enums::PaymentMethodStatus::AwaitingData), - None, - merchant_account.storage_scheme, - ) - .await?; - - Ok(services::api::ApplicationResponse::Json( - api::PaymentMethodResponse::foreign_from(res), - )) - } -} - -#[instrument(skip_all)] -pub fn authenticate_pm_client_secret_and_check_expiry( - req_client_secret: &String, - payment_method: &diesel_models::PaymentMethod, -) -> errors::CustomResult { - let stored_client_secret = payment_method - .client_secret - .clone() - .get_required_value("client_secret") - .change_context(errors::ApiErrorResponse::MissingRequiredField { - field_name: "client_secret", - }) - .attach_printable("client secret not found in db")?; - - if req_client_secret != &stored_client_secret { - Err((errors::ApiErrorResponse::ClientSecretInvalid).into()) - } else { - let current_timestamp = common_utils::date_time::now(); - let session_expiry = payment_method - .created_at - .saturating_add(time::Duration::seconds(consts::DEFAULT_SESSION_EXPIRY)); - - let expired = current_timestamp > session_expiry; - - Ok(expired) - } -} - -#[instrument(skip_all)] -pub async fn add_payment_method_data( - state: routes::AppState, - req: api::PaymentMethodCreate, - merchant_account: domain::MerchantAccount, - key_store: domain::MerchantKeyStore, - pm_id: String, -) -> errors::RouterResponse { - let db = &*state.store; - - let pmd = req - .payment_method_data - .clone() - .get_required_value("payment_method_data")?; - req.payment_method.get_required_value("payment_method")?; - let client_secret = req - .client_secret - .clone() - .get_required_value("client_secret")?; - let payment_method = db - .find_payment_method(pm_id.as_str(), merchant_account.storage_scheme) - .await - .change_context(errors::ApiErrorResponse::PaymentMethodNotFound) - .attach_printable("Unable to find payment method")?; - - if payment_method.status != enums::PaymentMethodStatus::AwaitingData { - return Err((errors::ApiErrorResponse::DuplicatePaymentMethod).into()); - } - - let customer_id = payment_method.customer_id.clone(); - let customer = db - .find_customer_by_customer_id_merchant_id( - customer_id.as_str(), - &merchant_account.merchant_id, - &key_store, - merchant_account.storage_scheme, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?; - - let client_secret_expired = - authenticate_pm_client_secret_and_check_expiry(&client_secret, &payment_method)?; - - if client_secret_expired { - return Err((errors::ApiErrorResponse::ClientSecretExpired).into()); - }; - - match pmd { - api_models::payment_methods::PaymentMethodCreateData::Card(card) => { - helpers::validate_card_expiry(&card.card_exp_month, &card.card_exp_year)?; - let resp = add_card_to_locker( - &state, - req.clone(), - &card, - &customer_id, - &merchant_account, - None, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError); - - match resp { - Ok((mut pm_resp, duplication_check)) => { - if duplication_check.is_some() { - let pm_update = storage::PaymentMethodUpdate::StatusUpdate { - status: Some(enums::PaymentMethodStatus::Inactive), - }; - - db.update_payment_method( - payment_method, - pm_update, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to add payment method in db")?; - - get_or_insert_payment_method( - db, - req.clone(), - &mut pm_resp, - &merchant_account, - &customer_id, - &key_store, - ) - .await?; - - return Ok(services::ApplicationResponse::Json(pm_resp)); - } else { - let locker_id = pm_resp.payment_method_id.clone(); - pm_resp.payment_method_id = pm_id.clone(); - pm_resp.client_secret = Some(client_secret.clone()); - - let card_isin = card.card_number.clone().get_card_isin(); - - let card_info = db - .get_card_info(card_isin.as_str()) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to get card info")?; - - let updated_card = CardDetailsPaymentMethod { - issuer_country: card_info - .as_ref() - .and_then(|ci| ci.card_issuing_country.clone()), - last4_digits: Some(card.card_number.clone().get_last4()), - expiry_month: Some(card.card_exp_month), - expiry_year: Some(card.card_exp_year), - nick_name: card.nick_name, - card_holder_name: card.card_holder_name, - card_network: card_info.as_ref().and_then(|ci| ci.card_network.clone()), - card_isin: Some(card_isin), - card_issuer: card_info.as_ref().and_then(|ci| ci.card_issuer.clone()), - card_type: card_info.as_ref().and_then(|ci| ci.card_type.clone()), - saved_to_locker: true, - }; - - let updated_pmd = Some(PaymentMethodsData::Card(updated_card)); - let pm_data_encrypted = - create_encrypted_payment_method_data(&key_store, updated_pmd).await; - - let pm_update = storage::PaymentMethodUpdate::AdditionalDataUpdate { - payment_method_data: pm_data_encrypted, - status: Some(enums::PaymentMethodStatus::Active), - locker_id: Some(locker_id), - payment_method: req.payment_method, - }; - - db.update_payment_method( - payment_method, - pm_update, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to add payment method in db")?; - - if customer.default_payment_method_id.is_none() { - let _ = set_default_payment_method( - db, - merchant_account.merchant_id.clone(), - key_store.clone(), - customer_id.as_str(), - pm_id, - merchant_account.storage_scheme, - ) - .await - .map_err(|err| logger::error!(error=?err,"Failed to set the payment method as default")); - } - - return Ok(services::ApplicationResponse::Json(pm_resp)); - } - } - Err(e) => { - let pm_update = storage::PaymentMethodUpdate::StatusUpdate { - status: Some(enums::PaymentMethodStatus::Inactive), - }; - - db.update_payment_method( - payment_method, - pm_update, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to update payment method in db")?; - - return Err(e.attach_printable("Failed to add card to locker")); - } - } - } - } -} - #[instrument(skip_all)] pub async fn add_payment_method( state: routes::AppState, @@ -500,9 +227,8 @@ pub async fn add_payment_method( let db = &*state.store; let merchant_id = &merchant_account.merchant_id; let customer_id = req.customer_id.clone().get_required_value("customer_id")?; - let payment_method = req.payment_method.get_required_value("payment_method")?; - let response = match payment_method { + let response = match req.payment_method { #[cfg(feature = "payouts")] api_enums::PaymentMethod::BankTransfer => match req.bank_transfer.clone() { Some(bank) => add_bank_to_locker( @@ -524,18 +250,10 @@ pub async fn add_payment_method( }, api_enums::PaymentMethod::Card => match req.card.clone() { Some(card) => { - helpers::validate_card_expiry(&card.card_exp_month, &card.card_exp_year)?; - add_card_to_locker( - &state, - req.clone(), - &card, - &customer_id, - merchant_account, - None, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Add Card Failed") + add_card_to_locker(&state, req.clone(), &card, &customer_id, merchant_account) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Add Card Failed") } _ => Ok(store_default_payment_method( &req, @@ -645,22 +363,18 @@ pub async fn add_payment_method( payment_method_data: pm_data_encrypted, }; - db.update_payment_method( - existing_pm, - pm_update, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to add payment method in db")?; + db.update_payment_method(existing_pm, pm_update) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed to add payment method in db")?; } } }, None => { let pm_metadata = resp.metadata.as_ref().map(|data| data.peek()); - let locker_id = if resp.payment_method == Some(api_enums::PaymentMethod::Card) - || resp.payment_method == Some(api_enums::PaymentMethod::BankTransfer) + let locker_id = if resp.payment_method == api_enums::PaymentMethod::Card + || resp.payment_method == api_enums::PaymentMethod::BankTransfer { Some(resp.payment_method_id) } else { @@ -678,8 +392,6 @@ pub async fn add_payment_method( None, locker_id, None, - None, - merchant_account.storage_scheme, ) .await?; } @@ -700,8 +412,6 @@ pub async fn insert_payment_method( customer_acceptance: Option, locker_id: Option, connector_mandate_details: Option, - network_transaction_id: Option, - storage_scheme: MerchantStorageScheme, ) -> errors::RouterResult { let pm_card_details = resp .card @@ -720,9 +430,6 @@ pub async fn insert_payment_method( pm_data_encrypted, key_store, connector_mandate_details, - None, - network_transaction_id, - storage_scheme, ) .await } @@ -735,232 +442,47 @@ pub async fn update_customer_payment_method( payment_method_id: &str, key_store: domain::MerchantKeyStore, ) -> errors::RouterResponse { - // Currently update is supported only for cards - if let Some(card_update) = req.card.clone() { - let db = state.store.as_ref(); - - let pm = db - .find_payment_method(payment_method_id, merchant_account.storage_scheme) - .await - .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; - - // Fetch the existing payment method data from db - let existing_card_data = decrypt::( - pm.payment_method_data.clone(), - key_store.key.get_inner().peek(), + let db = state.store.as_ref(); + let pm = db + .delete_payment_method_by_merchant_id_payment_method_id( + &merchant_account.merchant_id, + payment_method_id, ) .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to decrypt card details")? - .map(|x| x.into_inner().expose()) - .map( - |value| -> Result> { - value - .parse_value::("PaymentMethodsData") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to deserialize payment methods data") - }, + .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; + if pm.payment_method == enums::PaymentMethod::Card { + delete_card_from_locker( + &state, + &pm.customer_id, + &pm.merchant_id, + pm.locker_id.as_ref().unwrap_or(&pm.payment_method_id), ) - .transpose()? - .and_then(|pmd| match pmd { - PaymentMethodsData::Card(crd) => Some(api::CardDetailFromLocker::from(crd)), - _ => None, - }) - .ok_or(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to obtain decrypted card object from db")?; - - let is_card_updation_required = - validate_payment_method_update(card_update.clone(), existing_card_data.clone()); - - let response = if is_card_updation_required { - // Fetch the existing card data from locker for getting card number - let card_data_from_locker = get_card_from_locker( - &state, - &pm.customer_id, - &pm.merchant_id, - pm.locker_id.as_ref().unwrap_or(&pm.payment_method_id), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error getting card from locker")?; - - if card_update.card_exp_month.is_some() || card_update.card_exp_year.is_some() { - helpers::validate_card_expiry( - card_update - .card_exp_month - .as_ref() - .unwrap_or(&card_data_from_locker.card_exp_month), - card_update - .card_exp_year - .as_ref() - .unwrap_or(&card_data_from_locker.card_exp_year), - )?; - } - - let updated_card_details = card_update.apply(card_data_from_locker.clone()); - - // Construct new payment method object from request - let new_pm = api::PaymentMethodCreate { - payment_method: pm.payment_method, - payment_method_type: pm.payment_method_type, - payment_method_issuer: pm.payment_method_issuer.clone(), - payment_method_issuer_code: pm.payment_method_issuer_code, - #[cfg(feature = "payouts")] - bank_transfer: req.bank_transfer, - card: Some(updated_card_details.clone()), - #[cfg(feature = "payouts")] - wallet: req.wallet, - metadata: req.metadata, - customer_id: Some(pm.customer_id.clone()), - client_secret: None, - payment_method_data: None, - card_network: req - .card_network - .as_ref() - .map(|card_network| card_network.to_string()), - }; - new_pm.validate()?; - - // Delete old payment method from locker - delete_card_from_locker( - &state, - &pm.customer_id, - &pm.merchant_id, - pm.locker_id.as_ref().unwrap_or(&pm.payment_method_id), - ) - .await?; - - // Add the updated payment method data to locker - let (mut add_card_resp, _) = add_card_to_locker( - &state, - new_pm.clone(), - &updated_card_details, - &pm.customer_id, - &merchant_account, - Some(pm.locker_id.as_ref().unwrap_or(&pm.payment_method_id)), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to add updated payment method to locker")?; - - // Construct new updated card object. Consider a field if passed in request or else populate it with the existing value from existing_card_data - let updated_card = Some(api::CardDetailFromLocker { - scheme: existing_card_data.scheme, - last4_digits: Some(card_data_from_locker.card_number.clone().get_last4()), - issuer_country: existing_card_data.issuer_country, - card_number: existing_card_data.card_number, - expiry_month: card_update - .card_exp_month - .or(existing_card_data.expiry_month), - expiry_year: card_update.card_exp_year.or(existing_card_data.expiry_year), - card_token: existing_card_data.card_token, - card_fingerprint: existing_card_data.card_fingerprint, - card_holder_name: card_update - .card_holder_name - .or(existing_card_data.card_holder_name), - nick_name: card_update.nick_name.or(existing_card_data.nick_name), - card_network: existing_card_data.card_network, - card_isin: existing_card_data.card_isin, - card_issuer: existing_card_data.card_issuer, - card_type: existing_card_data.card_type, - saved_to_locker: true, - }); - - let updated_pmd = updated_card - .as_ref() - .map(|card| PaymentMethodsData::Card(CardDetailsPaymentMethod::from(card.clone()))); - let pm_data_encrypted = - create_encrypted_payment_method_data(&key_store, updated_pmd).await; - - let pm_update = storage::PaymentMethodUpdate::PaymentMethodDataUpdate { - payment_method_data: pm_data_encrypted, - }; - - add_card_resp.payment_method_id = pm.payment_method_id.clone(); - - db.update_payment_method(pm, pm_update, merchant_account.storage_scheme) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to update payment method in db")?; - - add_card_resp - } else { - // Return existing payment method data as response without any changes - api::PaymentMethodResponse { - merchant_id: pm.merchant_id.to_owned(), - customer_id: Some(pm.customer_id), - payment_method_id: pm.payment_method_id, - payment_method: pm.payment_method, - payment_method_type: pm.payment_method_type, - #[cfg(feature = "payouts")] - bank_transfer: None, - card: Some(existing_card_data), - metadata: pm.metadata, - created: Some(pm.created_at), - recurring_enabled: false, - installment_payment_enabled: false, - payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), - last_used_at: Some(common_utils::date_time::now()), - client_secret: None, - } - }; - - Ok(services::ApplicationResponse::Json(response)) - } else { - Err(report!(errors::ApiErrorResponse::NotSupported { - message: "Payment method update for the given payment method is not supported".into() - })) - } -} - -pub fn validate_payment_method_update( - card_updation_obj: CardDetailUpdate, - existing_card_data: api::CardDetailFromLocker, -) -> bool { - // Return true If any one of the below condition returns true, - // If a field is not passed in the update request, return false. - // If the field is present, it depends on the existing field data: - // - If existing field data is not present, or if it is present and doesn't match - // the update request data, then return true. - // - Or else return false - card_updation_obj - .card_exp_month - .map(|exp_month| exp_month.expose()) - .map_or(false, |new_exp_month| { - existing_card_data - .expiry_month - .map(|exp_month| exp_month.expose()) - .map_or(true, |old_exp_month| new_exp_month != old_exp_month) - }) - || card_updation_obj - .card_exp_year - .map(|exp_year| exp_year.expose()) - .map_or(false, |new_exp_year| { - existing_card_data - .expiry_year - .map(|exp_year| exp_year.expose()) - .map_or(true, |old_exp_year| new_exp_year != old_exp_year) - }) - || card_updation_obj - .card_holder_name - .map(|name| name.expose()) - .map_or(false, |new_card_holder_name| { - existing_card_data - .card_holder_name - .map(|name| name.expose()) - .map_or(true, |old_card_holder_name| { - new_card_holder_name != old_card_holder_name - }) - }) - || card_updation_obj - .nick_name - .map(|nick_name| nick_name.expose()) - .map_or(false, |new_nick_name| { - existing_card_data - .nick_name - .map(|nick_name| nick_name.expose()) - .map_or(true, |old_nick_name| new_nick_name != old_nick_name) - }) + .await?; + }; + let new_pm = api::PaymentMethodCreate { + payment_method: pm.payment_method, + payment_method_type: pm.payment_method_type, + payment_method_issuer: pm.payment_method_issuer, + payment_method_issuer_code: pm.payment_method_issuer_code, + #[cfg(feature = "payouts")] + bank_transfer: req.bank_transfer, + card: req.card, + #[cfg(feature = "payouts")] + wallet: req.wallet, + metadata: req.metadata, + customer_id: Some(pm.customer_id), + card_network: req + .card_network + .as_ref() + .map(|card_network| card_network.to_string()), + }; + Box::pin(add_payment_method( + state, + new_pm, + &merchant_account, + &key_store, + )) + .await } // Wrapper function to switch lockers @@ -1036,7 +558,6 @@ pub async fn add_card_to_locker( card: &api::CardDetail, customer_id: &String, merchant_account: &domain::MerchantAccount, - card_reference: Option<&str>, ) -> errors::CustomResult< ( api::PaymentMethodResponse, @@ -1054,7 +575,7 @@ pub async fn add_card_to_locker( customer_id.to_string(), merchant_account, api_enums::LockerChoice::HyperswitchCardVault, - card_reference, + None, ) .await .map_err(|error| { @@ -1083,7 +604,7 @@ pub async fn get_card_from_locker( customer_id: &str, merchant_id: &str, card_reference: &str, -) -> errors::RouterResult { +) -> errors::RouterResult { metrics::GET_FROM_LOCKER.add(&metrics::CONTEXT, 1, &[]); let get_card_from_rs_locker_resp = request::record_operation_time( @@ -1162,12 +683,12 @@ pub async fn add_card_hs( merchant_id: &merchant_account.merchant_id, merchant_customer_id: customer_id.to_owned(), requestor_card_reference: card_reference.map(str::to_string), - card: Card { + card: payment_methods::Card { card_number: card.card_number.to_owned(), name_on_card: card.card_holder_name.to_owned(), card_exp_month: card.card_exp_month.to_owned(), card_exp_year: card.card_exp_year.to_owned(), - card_brand: card.card_network.as_ref().map(ToString::to_string), + card_brand: None, card_isin: None, nick_name: card.nick_name.as_ref().map(masking::Secret::peek).cloned(), }, @@ -1315,32 +836,16 @@ pub async fn update_payment_method( db: &dyn db::StorageInterface, pm: payment_method::PaymentMethod, pm_metadata: serde_json::Value, - storage_scheme: MerchantStorageScheme, ) -> errors::CustomResult<(), errors::VaultError> { let pm_update = payment_method::PaymentMethodUpdate::MetadataUpdate { metadata: Some(pm_metadata), }; - db.update_payment_method(pm, pm_update, storage_scheme) + db.update_payment_method(pm, pm_update) .await .change_context(errors::VaultError::UpdateInPaymentMethodDataTableFailed)?; Ok(()) } -pub async fn update_payment_method_connector_mandate_details( - db: &dyn db::StorageInterface, - pm: payment_method::PaymentMethod, - connector_mandate_details: Option, - storage_scheme: MerchantStorageScheme, -) -> errors::CustomResult<(), errors::VaultError> { - let pm_update = payment_method::PaymentMethodUpdate::ConnectorMandateDetailsUpdate { - connector_mandate_details, - }; - - db.update_payment_method(pm, pm_update, storage_scheme) - .await - .change_context(errors::VaultError::UpdateInPaymentMethodDataTableFailed)?; - Ok(()) -} #[instrument(skip_all)] pub async fn get_card_from_hs_locker<'a>( state: &'a routes::AppState, @@ -1348,7 +853,7 @@ pub async fn get_card_from_hs_locker<'a>( merchant_id: &str, card_reference: &'a str, locker_choice: api_enums::LockerChoice, -) -> errors::CustomResult { +) -> errors::CustomResult { let locker = &state.conf.locker; let jwekey = &state.conf.jwekey.get_inner(); @@ -1602,11 +1107,10 @@ pub async fn mock_delete_card<'a>( //------------------------------------------------------------------------------ pub fn get_banks( state: &routes::AppState, - pm_type: common_enums::enums::PaymentMethodType, + pm_type: api_enums::PaymentMethodType, connectors: Vec, ) -> Result, errors::ApiErrorResponse> { - let mut bank_names_hm: HashMap> = - HashMap::new(); + let mut bank_names_hm: HashMap> = HashMap::new(); if matches!( pm_type, @@ -1742,7 +1246,6 @@ pub async fn list_payment_methods( cust.as_str(), &pi.merchant_id, &key_store, - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound) @@ -1773,7 +1276,7 @@ pub async fn list_payment_methods( Some(api::MandateTransactionType::RecurringMandateTransaction) } else if pa.mandate_details.is_some() || setup_future_usage - .map(|future_usage| future_usage == common_enums::enums::FutureUsage::OffSession) + .map(|future_usage| future_usage == api_enums::FutureUsage::OffSession) .unwrap_or(false) { Some(api::MandateTransactionType::NewMandateTransaction) @@ -1863,7 +1366,7 @@ pub async fn list_payment_methods( let customer_wallet_pm = customer_payment_methods .iter() .filter(|cust_pm| { - cust_pm.payment_method == Some(enums::PaymentMethod::Wallet) + cust_pm.payment_method == enums::PaymentMethod::Wallet }) .collect::>(); @@ -2504,7 +2007,7 @@ pub async fn list_payment_methods( payment_methods: payment_method_responses, mandate_payment: payment_attempt.and_then(|inner| inner.mandate_details).map( |d| match d { - hyperswitch_domain_models::mandates::MandateDataType::SingleUse(i) => { + data_models::mandates::MandateDataType::SingleUse(i) => { api::MandateType::SingleUse(api::MandateAmountData { amount: i.amount, currency: i.currency, @@ -2513,7 +2016,7 @@ pub async fn list_payment_methods( metadata: i.metadata, }) } - hyperswitch_domain_models::mandates::MandateDataType::MultiUse(Some(i)) => { + data_models::mandates::MandateDataType::MultiUse(Some(i)) => { api::MandateType::MultiUse(Some(api::MandateAmountData { amount: i.amount, currency: i.currency, @@ -2522,7 +2025,7 @@ pub async fn list_payment_methods( metadata: i.metadata, })) } - hyperswitch_domain_models::mandates::MandateDataType::MultiUse(None) => { + data_models::mandates::MandateDataType::MultiUse(None) => { api::MandateType::MultiUse(None) } }, @@ -3190,7 +2693,7 @@ pub async fn do_list_customer_pm_fetch_customer_if_not_passed( .await } else { let cloned_secret = req.and_then(|r| r.client_secret.as_ref().cloned()); - let payment_intent: Option = + let payment_intent: Option = helpers::verify_payment_intent_time_and_client_secret( db, &merchant_account, @@ -3233,6 +2736,15 @@ pub async fn list_customer_payment_method( limit: Option, ) -> errors::RouterResponse { let db = &*state.store; + + if let Some(ref payment_intent) = payment_intent { + if payment_intent.payment_link_id.is_some() { + Err(errors::ApiErrorResponse::AccessForbidden { + resource: "saved payment methods".to_string(), + })? + } + }; + let off_session_payment_flag = payment_intent .as_ref() .map(|pi| { @@ -3248,7 +2760,6 @@ pub async fn list_customer_payment_method( customer_id, &merchant_account.merchant_id, &key_store, - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?; @@ -3272,7 +2783,6 @@ pub async fn list_customer_payment_method( &merchant_account.merchant_id, common_enums::PaymentMethodStatus::Active, limit, - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; @@ -3281,9 +2791,7 @@ pub async fn list_customer_payment_method( for pm in resp.into_iter() { let parent_payment_method_token = generate_id(consts::ID_LENGTH, "token"); - let payment_method = pm.payment_method.get_required_value("payment_method")?; - - let payment_method_retrieval_context = match payment_method { + let payment_method_retrieval_context = match pm.payment_method { enums::PaymentMethod::Card => { let card_details = get_card_details_with_locker_fallback(&pm, key, state).await?; @@ -3365,7 +2873,7 @@ pub async fn list_customer_payment_method( }; // Retrieve the masked bank details to be sent as a response - let bank_details = if payment_method == enums::PaymentMethod::BankDebit { + let bank_details = if pm.payment_method == enums::PaymentMethod::BankDebit { get_masked_bank_details(&pm, key) .await .unwrap_or_else(|err| { @@ -3382,7 +2890,7 @@ pub async fn list_customer_payment_method( payment_token: parent_payment_method_token.to_owned(), payment_method_id: pm.payment_method_id.clone(), customer_id: pm.customer_id, - payment_method, + payment_method: pm.payment_method, payment_method_type: pm.payment_method_type, payment_method_issuer: pm.payment_method_issuer, card: payment_method_retrieval_context.card_details, @@ -3686,14 +3194,9 @@ async fn get_bank_account_connector_details( .get_required_value("payment_method_type") .attach_printable("PaymentMethodType not found")?; - let pm = pm - .payment_method - .get_required_value("payment_method") - .attach_printable("PaymentMethod not found")?; - let token_data = BankAccountTokenData { payment_method_type: pm_type, - payment_method: pm, + payment_method: pm.payment_method, connector_details: connector_details.clone(), }; @@ -3709,26 +3212,17 @@ pub async fn set_default_payment_method( key_store: domain::MerchantKeyStore, customer_id: &str, payment_method_id: String, - storage_scheme: MerchantStorageScheme, ) -> errors::RouterResponse { //check for the customer let customer = db - .find_customer_by_customer_id_merchant_id( - customer_id, - &merchant_id, - &key_store, - storage_scheme, - ) + .find_customer_by_customer_id_merchant_id(customer_id, &merchant_id, &key_store) .await .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?; // check for the presence of payment_method let payment_method = db - .find_payment_method(&payment_method_id, storage_scheme) + .find_payment_method(&payment_method_id) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; - let pm = payment_method - .payment_method - .get_required_value("payment_method")?; utils::when( payment_method.customer_id != customer_id || payment_method.merchant_id != merchant_id, @@ -3752,27 +3246,22 @@ pub async fn set_default_payment_method( default_payment_method_id: Some(Some(payment_method_id.to_owned())), }; - let customer_id = customer.customer_id.clone(); - // update the db with the default payment method id let updated_customer_details = db .update_customer_by_customer_id_merchant_id( customer_id.to_owned(), merchant_id.to_owned(), - customer, customer_update, &key_store, - storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to update the default payment method id for the customer")?; - let resp = CustomerDefaultPaymentMethodResponse { default_payment_method_id: updated_customer_details.default_payment_method_id, - customer_id, + customer_id: customer.customer_id, payment_method_type: payment_method.payment_method_type, - payment_method: pm, + payment_method: payment_method.payment_method, }; Ok(services::ApplicationResponse::Json(resp)) @@ -3781,19 +3270,18 @@ pub async fn set_default_payment_method( pub async fn update_last_used_at( pm_id: &str, state: &routes::AppState, - storage_scheme: MerchantStorageScheme, ) -> errors::RouterResult<()> { let update_last_used = storage::PaymentMethodUpdate::LastUsedUpdate { last_used_at: common_utils::date_time::now(), }; let payment_method = state .store - .find_payment_method(pm_id, storage_scheme) + .find_payment_method(pm_id) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; state .store - .update_payment_method(payment_method, update_last_used, storage_scheme) + .update_payment_method(payment_method, update_last_used) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to update the last_used_at in db")?; @@ -3943,16 +3431,15 @@ pub async fn retrieve_payment_method( state: routes::AppState, pm: api::PaymentMethodId, key_store: domain::MerchantKeyStore, - merchant_account: domain::MerchantAccount, ) -> errors::RouterResponse { let db = state.store.as_ref(); let pm = db - .find_payment_method(&pm.payment_method_id, merchant_account.storage_scheme) + .find_payment_method(&pm.payment_method_id) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; let key = key_store.key.peek(); - let card = if pm.payment_method == Some(enums::PaymentMethod::Card) { + let card = if pm.payment_method == enums::PaymentMethod::Card { let card_detail = if state.conf.locker.locker_enabled { let card = get_card_from_locker( &state, @@ -3989,7 +3476,6 @@ pub async fn retrieve_payment_method( installment_payment_enabled: false, payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), last_used_at: Some(pm.last_used_at), - client_secret: pm.client_secret, }, )) } @@ -4003,10 +3489,7 @@ pub async fn delete_payment_method( ) -> errors::RouterResponse { let db = state.store.as_ref(); let key = db - .find_payment_method( - pm_id.payment_method_id.as_str(), - merchant_account.storage_scheme, - ) + .find_payment_method(pm_id.payment_method_id.as_str()) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; @@ -4025,7 +3508,6 @@ pub async fn delete_payment_method( &key.customer_id, &merchant_account.merchant_id, &key_store, - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::InternalServerError) @@ -4037,7 +3519,7 @@ pub async fn delete_payment_method( || Err(errors::ApiErrorResponse::PaymentMethodDeleteFailed), )?; - if key.payment_method == Some(enums::PaymentMethod::Card) { + if key.payment_method == enums::PaymentMethod::Card { let response = delete_card_from_locker( &state, &key.customer_id, @@ -4069,10 +3551,8 @@ pub async fn delete_payment_method( db.update_customer_by_customer_id_merchant_id( key.customer_id, key.merchant_id, - customer, customer_update, &key_store, - merchant_account.storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs index 749508c9740..f639aa59218 100644 --- a/crates/router/src/core/payment_methods/transformers.rs +++ b/crates/router/src/core/payment_methods/transformers.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use api_models::{enums as api_enums, payment_methods::Card}; +use api_models::enums as api_enums; use common_utils::{ ext_traits::{Encode, StringExt}, pii::Email, @@ -27,15 +27,6 @@ pub enum StoreLockerReq<'a> { LockerGeneric(StoreGenericReq<'a>), } -impl StoreLockerReq<'_> { - pub fn update_requestor_card_reference(&mut self, card_reference: Option) { - match self { - Self::LockerCard(c) => c.requestor_card_reference = card_reference, - Self::LockerGeneric(_) => (), - } - } -} - #[derive(Debug, Deserialize, Serialize)] pub struct StoreCardReq<'a> { pub merchant_id: &'a str, @@ -53,6 +44,17 @@ pub struct StoreGenericReq<'a> { pub enc_data: String, } +#[derive(Debug, Deserialize, Serialize)] +pub struct Card { + pub card_number: cards::CardNumber, + pub name_on_card: Option>, + pub card_exp_month: Secret, + pub card_exp_year: Secret, + pub card_brand: Option, + pub card_isin: Option, + pub nick_name: Option, +} + #[derive(Debug, Deserialize, Serialize)] pub struct StoreCardResp { pub status: String, @@ -328,7 +330,6 @@ pub fn mk_add_bank_response_hs( installment_payment_enabled: false, // #[#256] payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), last_used_at: Some(common_utils::date_time::now()), - client_secret: None, } } @@ -374,7 +375,6 @@ pub fn mk_add_card_response_hs( installment_payment_enabled: false, // #[#256] payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), last_used_at: Some(common_utils::date_time::now()), // [#256] - client_secret: None, } } diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs index 6d4f2322a8d..aeb1ea102be 100644 --- a/crates/router/src/core/payment_methods/vault.rs +++ b/crates/router/src/core/payment_methods/vault.rs @@ -1,9 +1,7 @@ -use common_enums::PaymentMethodType; use common_utils::{ crypto::{DecodeMessage, EncodeMessage, GcmAes256}, ext_traits::{BytesExt, Encode}, generate_id_with_default_len, - pii::Email, }; use error_stack::{report, ResultExt}; use masking::PeekInterface; @@ -417,77 +415,55 @@ impl Vaultable for api::CardPayout { } } -#[derive(Debug, serde::Serialize, serde::Deserialize)] -pub struct TokenizedWalletSensitiveValues { - pub email: Option, - pub telephone_number: Option>, - pub wallet_id: Option>, - pub wallet_type: PaymentMethodType, -} - -#[derive(Debug, serde::Serialize, serde::Deserialize)] -pub struct TokenizedWalletInsensitiveValues { - pub customer_id: Option, -} - #[cfg(feature = "payouts")] impl Vaultable for api::WalletPayout { fn get_value1(&self, _customer_id: Option) -> CustomResult { let value1 = match self { - Self::Paypal(paypal_data) => TokenizedWalletSensitiveValues { - email: paypal_data.email.clone(), - telephone_number: paypal_data.telephone_number.clone(), - wallet_id: paypal_data.paypal_id.clone(), - wallet_type: PaymentMethodType::Paypal, - }, - Self::Venmo(venmo_data) => TokenizedWalletSensitiveValues { - email: None, - telephone_number: venmo_data.telephone_number.clone(), - wallet_id: None, - wallet_type: PaymentMethodType::Venmo, + Self::Paypal(paypal_data) => api::TokenizedWalletValue1 { + data: api::WalletData::PaypalRedirect(api_models::payments::PaypalRedirection { + email: paypal_data.email.clone(), + }), }, }; value1 .encode_to_string_of_json() .change_context(errors::VaultError::RequestEncodingFailed) - .attach_printable("Failed to encode wallet data - TokenizedWalletSensitiveValues") + .attach_printable("Failed to encode wallet value1") } fn get_value2(&self, customer_id: Option) -> CustomResult { - let value2 = TokenizedWalletInsensitiveValues { customer_id }; + let value2 = api::TokenizedWalletValue2 { customer_id }; value2 .encode_to_string_of_json() .change_context(errors::VaultError::RequestEncodingFailed) - .attach_printable("Failed to encode data - TokenizedWalletInsensitiveValues") + .attach_printable("Failed to encode wallet value2") } fn from_values( value1: String, value2: String, ) -> CustomResult<(Self, SupplementaryVaultData), errors::VaultError> { - let value1: TokenizedWalletSensitiveValues = value1 - .parse_struct("TokenizedWalletSensitiveValues") + let value1: api::TokenizedWalletValue1 = value1 + .parse_struct("TokenizedWalletValue1") .change_context(errors::VaultError::ResponseDeserializationFailed) - .attach_printable("Could not deserialize into wallet data wallet_sensitive_data")?; + .attach_printable("Could not deserialize into wallet value1")?; - let value2: TokenizedWalletInsensitiveValues = value2 - .parse_struct("TokenizedWalletInsensitiveValues") + let value2: api::TokenizedWalletValue2 = value2 + .parse_struct("TokenizedWalletValue2") .change_context(errors::VaultError::ResponseDeserializationFailed) - .attach_printable("Could not deserialize into wallet data wallet_insensitive_data")?; + .attach_printable("Could not deserialize into wallet value2")?; - let wallet = match value1.wallet_type { - PaymentMethodType::Paypal => Self::Paypal(api_models::payouts::Paypal { - email: value1.email, - telephone_number: value1.telephone_number, - paypal_id: value1.wallet_id, - }), - PaymentMethodType::Venmo => Self::Venmo(api_models::payouts::Venmo { - telephone_number: value1.telephone_number, - }), - _ => Err(errors::VaultError::PayoutMethodNotSupported)?, + let wallet = match value1.data { + api::WalletData::PaypalRedirect(paypal_data) => { + Self::Paypal(api_models::payouts::Paypal { + email: paypal_data.email, + }) + } + _ => Err(errors::VaultError::ResponseDeserializationFailed)?, }; + let supp_data = SupplementaryVaultData { customer_id: value2.customer_id, payment_method_id: None, @@ -504,8 +480,6 @@ pub struct TokenizedBankSensitiveValues { pub bic: Option>, pub bank_sort_code: Option>, pub iban: Option>, - pub pix_key: Option>, - pub tax_id: Option>, } #[derive(Debug, serde::Serialize, serde::Deserialize)] @@ -514,7 +488,6 @@ pub struct TokenizedBankInsensitiveValues { pub bank_name: Option, pub bank_country_code: Option, pub bank_city: Option, - pub bank_branch: Option, } #[cfg(feature = "payouts")] @@ -527,8 +500,6 @@ impl Vaultable for api::BankPayout { bic: None, bank_sort_code: None, iban: None, - pix_key: None, - tax_id: None, }, Self::Bacs(b) => TokenizedBankSensitiveValues { bank_account_number: Some(b.bank_account_number.to_owned()), @@ -536,8 +507,6 @@ impl Vaultable for api::BankPayout { bic: None, bank_sort_code: Some(b.bank_sort_code.to_owned()), iban: None, - pix_key: None, - tax_id: None, }, Self::Sepa(b) => TokenizedBankSensitiveValues { bank_account_number: None, @@ -545,24 +514,13 @@ impl Vaultable for api::BankPayout { bic: b.bic.to_owned(), bank_sort_code: None, iban: Some(b.iban.to_owned()), - pix_key: None, - tax_id: None, - }, - Self::Pix(bank_details) => TokenizedBankSensitiveValues { - bank_account_number: Some(bank_details.bank_account_number.to_owned()), - bank_routing_number: None, - bic: None, - bank_sort_code: None, - iban: None, - pix_key: Some(bank_details.pix_key.to_owned()), - tax_id: bank_details.tax_id.to_owned(), }, }; bank_sensitive_data .encode_to_string_of_json() .change_context(errors::VaultError::RequestEncodingFailed) - .attach_printable("Failed to encode data - bank_sensitive_data") + .attach_printable("Failed to encode wallet data bank_sensitive_data") } fn get_value2(&self, customer_id: Option) -> CustomResult { @@ -572,28 +530,18 @@ impl Vaultable for api::BankPayout { bank_name: b.bank_name.to_owned(), bank_country_code: b.bank_country_code.to_owned(), bank_city: b.bank_city.to_owned(), - bank_branch: None, }, Self::Bacs(b) => TokenizedBankInsensitiveValues { customer_id, bank_name: b.bank_name.to_owned(), bank_country_code: b.bank_country_code.to_owned(), bank_city: b.bank_city.to_owned(), - bank_branch: None, - }, - Self::Sepa(bank_details) => TokenizedBankInsensitiveValues { - customer_id, - bank_name: bank_details.bank_name.to_owned(), - bank_country_code: bank_details.bank_country_code.to_owned(), - bank_city: bank_details.bank_city.to_owned(), - bank_branch: None, }, - Self::Pix(bank_details) => TokenizedBankInsensitiveValues { + Self::Sepa(b) => TokenizedBankInsensitiveValues { customer_id, - bank_name: bank_details.bank_name.to_owned(), - bank_country_code: None, - bank_city: None, - bank_branch: bank_details.bank_branch.to_owned(), + bank_name: b.bank_name.to_owned(), + bank_country_code: b.bank_country_code.to_owned(), + bank_city: b.bank_city.to_owned(), }, }; @@ -618,53 +566,35 @@ impl Vaultable for api::BankPayout { .attach_printable("Could not deserialize into wallet data bank_insensitive_data")?; let bank = match ( - // ACH + BACS + PIX + // ACH + BACS bank_sensitive_data.bank_account_number.to_owned(), bank_sensitive_data.bank_routing_number.to_owned(), // ACH bank_sensitive_data.bank_sort_code.to_owned(), // BACS // SEPA bank_sensitive_data.iban.to_owned(), bank_sensitive_data.bic, - // PIX - bank_sensitive_data.pix_key, - bank_sensitive_data.tax_id, ) { - (Some(ban), Some(brn), None, None, None, None, None) => { - Self::Ach(payouts::AchBankTransfer { - bank_account_number: ban, - bank_routing_number: brn, - bank_name: bank_insensitive_data.bank_name, - bank_country_code: bank_insensitive_data.bank_country_code, - bank_city: bank_insensitive_data.bank_city, - }) - } - (Some(ban), None, Some(bsc), None, None, None, None) => { - Self::Bacs(payouts::BacsBankTransfer { - bank_account_number: ban, - bank_sort_code: bsc, - bank_name: bank_insensitive_data.bank_name, - bank_country_code: bank_insensitive_data.bank_country_code, - bank_city: bank_insensitive_data.bank_city, - }) - } - (None, None, None, Some(iban), bic, None, None) => { - Self::Sepa(payouts::SepaBankTransfer { - iban, - bic, - bank_name: bank_insensitive_data.bank_name, - bank_country_code: bank_insensitive_data.bank_country_code, - bank_city: bank_insensitive_data.bank_city, - }) - } - (Some(ban), None, None, None, None, Some(pix_key), tax_id) => { - Self::Pix(payouts::PixBankTransfer { - bank_account_number: ban, - bank_branch: bank_insensitive_data.bank_branch, - bank_name: bank_insensitive_data.bank_name, - pix_key, - tax_id, - }) - } + (Some(ban), Some(brn), None, None, None) => Self::Ach(payouts::AchBankTransfer { + bank_account_number: ban, + bank_routing_number: brn, + bank_name: bank_insensitive_data.bank_name, + bank_country_code: bank_insensitive_data.bank_country_code, + bank_city: bank_insensitive_data.bank_city, + }), + (Some(ban), None, Some(bsc), None, None) => Self::Bacs(payouts::BacsBankTransfer { + bank_account_number: ban, + bank_sort_code: bsc, + bank_name: bank_insensitive_data.bank_name, + bank_country_code: bank_insensitive_data.bank_country_code, + bank_city: bank_insensitive_data.bank_city, + }), + (None, None, None, Some(iban), bic) => Self::Sepa(payouts::SepaBankTransfer { + iban, + bic, + bank_name: bank_insensitive_data.bank_name, + bank_country_code: bank_insensitive_data.bank_country_code, + bank_city: bank_insensitive_data.bank_city, + }), _ => Err(errors::VaultError::ResponseDeserializationFailed)?, }; diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index 815c604a0e3..b996677f7e6 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -11,37 +11,27 @@ pub mod tokenization; pub mod transformers; pub mod types; -#[cfg(feature = "olap")] -use std::collections::{HashMap, HashSet}; use std::{fmt::Debug, marker::PhantomData, ops::Deref, time::Instant, vec::IntoIter}; -#[cfg(feature = "olap")] -use api_models::admin::MerchantConnectorInfo; use api_models::{ self, enums, mandates::RecurringDetails, payments::{self as payments_api, HeaderPayload}, }; -use common_utils::{ - ext_traits::{AsyncExt, StringExt}, - pii, - types::Surcharge, -}; +use common_utils::{ext_traits::AsyncExt, pii, types::Surcharge}; +use data_models::mandates::{CustomerAcceptance, MandateData}; use diesel_models::{ephemeral_key, fraud_check::FraudCheck}; -use error_stack::{report, ResultExt}; -use events::EventInfo; +use error_stack::ResultExt; use futures::future::join_all; use helpers::ApplePayData; -use hyperswitch_domain_models::mandates::{CustomerAcceptance, MandateData}; -use masking::{ExposeInterface, Secret}; +use masking::Secret; +use maud::{html, PreEscaped}; pub use payment_address::PaymentAddress; use redis_interface::errors::RedisError; use router_env::{instrument, tracing}; #[cfg(feature = "olap")] use router_types::transformers::ForeignFrom; use scheduler::utils as pt_utils; -#[cfg(feature = "olap")] -use strum::IntoEnumIterator; use time; pub use self::operations::{ @@ -63,7 +53,6 @@ use super::{ use crate::core::fraud_check as frm_core; use crate::{ configs::settings::{ApplePayPreDecryptFlow, PaymentMethodTypeTokenFilter}, - connector::utils::missing_field_err, core::{ authentication as authentication_core, errors::{self, CustomResult, RouterResponse, RouterResult}, @@ -72,7 +61,7 @@ use crate::{ }, db::StorageInterface, logger, - routes::{app::ReqState, metrics, payment_methods::ParentPaymentMethodToken, AppState}, + routes::{metrics, payment_methods::ParentPaymentMethodToken, AppState}, services::{self, api::Authenticate}, types::{ self as router_types, @@ -93,7 +82,6 @@ use crate::{ #[instrument(skip_all, fields(payment_id, merchant_id))] pub async fn payments_operation_core( state: &AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, operation: Op, @@ -124,7 +112,7 @@ where // To perform router related operation for PaymentResponse PaymentResponse: Operation, - FData: Send + Sync + Clone, + FData: Send + Sync, Ctx: PaymentMethodRetrieve, { let operation: BoxedOperation<'_, F, Req, Ctx> = Box::new(operation); @@ -141,13 +129,13 @@ where customer_details, mut payment_data, business_profile, - mandate_type, } = operation .to_get_tracker()? .get_trackers( state, &validate_result.payment_id, &req, + validate_result.mandate_type.to_owned(), &merchant_account, &key_store, auth_flow, @@ -162,7 +150,6 @@ where &mut payment_data, customer_details, &key_store, - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound) @@ -179,7 +166,6 @@ where &key_store, &mut payment_data, eligible_connectors, - mandate_type, ) .await?; @@ -227,7 +213,7 @@ where }; #[cfg(feature = "frm")] logger::debug!( - "frm_configs: {:?}\nshould_continue_transaction: {:?}\nshould_continue_capture: {:?}", + "frm_configs: {:?}\nshould_cancel_transaction: {:?}\nshould_continue_capture: {:?}", frm_configs, should_continue_transaction, should_continue_capture, @@ -244,6 +230,7 @@ where &key_store, ) .await?; + if should_continue_transaction { #[cfg(feature = "frm")] match ( @@ -252,15 +239,8 @@ where ) { (false, Some(storage_enums::CaptureMethod::Automatic)) | (false, Some(storage_enums::CaptureMethod::Scheduled)) => { - if let Some(info) = &mut frm_info { - if let Some(frm_data) = &mut info.frm_data { - frm_data.fraud_check.payment_capture_method = - payment_data.payment_attempt.capture_method; - } - } payment_data.payment_attempt.capture_method = Some(storage_enums::CaptureMethod::Manual); - logger::debug!("payment_id : {:?} capture method has been changed to manual, since it has configured Post FRM flow",payment_data.payment_attempt.payment_id); } _ => (), }; @@ -281,14 +261,13 @@ where }; let router_data = call_connector_service( state, - req_state.clone(), &merchant_account, &key_store, - connector.clone(), + connector, &operation, &mut payment_data, &customer, - call_connector_action.clone(), + call_connector_action, &validate_result, schedule_time, header_payload, @@ -305,18 +284,6 @@ where external_latency = router_data.external_latency; //add connector http status code metrics add_connector_http_status_code_metrics(connector_http_status_code); - - operation - .to_post_update_tracker()? - .save_pm_and_mandate( - state, - &router_data, - &merchant_account, - &key_store, - &mut payment_data, - ) - .await?; - operation .to_post_update_tracker()? .update_tracker( @@ -349,14 +316,13 @@ where }; let router_data = call_connector_service( state, - req_state.clone(), &merchant_account, &key_store, connector_data.clone(), &operation, &mut payment_data, &customer, - call_connector_action.clone(), + call_connector_action, &validate_result, schedule_time, header_payload, @@ -381,10 +347,9 @@ where if config_bool && router_data.should_call_gsm() { router_data = retry::do_gsm_actions( state, - req_state.clone(), &mut payment_data, connectors, - connector_data.clone(), + connector_data, router_data, &merchant_account, &key_store, @@ -406,18 +371,6 @@ where external_latency = router_data.external_latency; //add connector http status code metrics add_connector_http_status_code_metrics(connector_http_status_code); - - operation - .to_post_update_tracker()? - .save_pm_and_mandate( - state, - &router_data, - &merchant_account, - &key_store, - &mut payment_data, - ) - .await?; - operation .to_post_update_tracker()? .update_tracker( @@ -457,7 +410,6 @@ where if let Some(fraud_info) = &mut frm_info { Box::pin(frm_core::post_payment_frm_core( state, - req_state, &merchant_account, &mut payment_data, fraud_info, @@ -469,7 +421,6 @@ where .attach_printable("Frm configs label not found")?, &customer, key_store.clone(), - &mut should_continue_capture, )) .await?; } @@ -478,7 +429,6 @@ where .to_update_tracker()? .update_trackers( state, - req_state, payment_data.clone(), customer.clone(), validate_result.storage_scheme, @@ -512,7 +462,6 @@ where .to_update_tracker()? .update_trackers( state, - req_state, payment_data.clone(), customer.clone(), validate_result.storage_scheme, @@ -526,22 +475,14 @@ where let cloned_payment_data = payment_data.clone(); let cloned_customer = customer.clone(); - - operation - .to_domain()? - .store_extended_card_info_temporarily( - state, - &payment_data.payment_intent.payment_id, - &business_profile, - &payment_data.payment_method_data, - ) - .await?; + let cloned_request = req.clone(); crate::utils::trigger_payments_webhook( merchant_account, business_profile, &key_store, cloned_payment_data, + Some(cloned_request), cloned_customer, state, operation, @@ -732,7 +673,6 @@ where #[allow(clippy::too_many_arguments)] pub async fn payments_core( state: AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, operation: Op, @@ -744,10 +684,10 @@ pub async fn payments_core( ) -> RouterResponse where F: Send + Clone + Sync, - FData: Send + Sync + Clone, + FData: Send + Sync, Op: Operation + Send + Sync + Clone, Req: Debug + Authenticate + Clone, - Res: transformers::ToResponse, Op>, + Res: transformers::ToResponse, Op>, // To create connector flow specific interface data PaymentData: ConstructFlowSpecificData, router_types::RouterData: Feature, @@ -766,10 +706,9 @@ where .flat_map(|c| c.foreign_try_into()) .collect() }); - let (payment_data, _req, customer, connector_http_status_code, external_latency) = + let (payment_data, req, customer, connector_http_status_code, external_latency) = payments_operation_core::<_, _, _, _, Ctx>( &state, - req_state, merchant_account, key_store, operation.clone(), @@ -782,6 +721,7 @@ where .await?; Res::generate_response( + Some(req), payment_data, customer, auth_flow, @@ -811,27 +751,21 @@ pub struct PaymentsRedirectResponseData { #[async_trait::async_trait] pub trait PaymentRedirectFlow: Sync { - // Associated type for call_payment_flow response - type PaymentFlowResponse; - - #[allow(clippy::too_many_arguments)] async fn call_payment_flow( &self, state: &AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, merchant_key_store: domain::MerchantKeyStore, req: PaymentsRedirectResponseData, connector_action: CallConnectorAction, - connector: String, - payment_id: String, - ) -> RouterResult; + ) -> RouterResponse; fn get_payment_action(&self) -> services::PaymentAction; fn generate_response( &self, - payment_flow_response: &Self::PaymentFlowResponse, + payments_response: &api_models::payments::PaymentsResponse, + business_profile: diesel_models::business_profile::BusinessProfile, payment_id: String, connector: String, ) -> RouterResult>; @@ -840,7 +774,6 @@ pub trait PaymentRedirectFlow: Sync { async fn handle_payments_redirect_response( &self, state: AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, req: PaymentsRedirectResponseData, @@ -887,20 +820,37 @@ pub trait PaymentRedirectFlow: Sync { .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to decide the response flow")?; - let payment_flow_response = self + let response = self .call_payment_flow( &state, - req_state, merchant_account.clone(), key_store, req.clone(), flow_type, - connector.clone(), - resource_id.clone(), ) - .await?; + .await; + + let payments_response = match response? { + services::ApplicationResponse::Json(response) => Ok(response), + services::ApplicationResponse::JsonWithHeaders((response, _)) => Ok(response), + _ => Err(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed to get the response in json"), + }?; + + let profile_id = payments_response + .profile_id + .as_ref() + .get_required_value("profile_id")?; + + let business_profile = state + .store + .find_business_profile_by_profile_id(profile_id) + .await + .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + id: profile_id.to_string(), + })?; - self.generate_response(&payment_flow_response, resource_id, connector) + self.generate_response(&payments_response, business_profile, resource_id, connector) } } @@ -909,20 +859,14 @@ pub struct PaymentRedirectCompleteAuthorize; #[async_trait::async_trait] impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize { - type PaymentFlowResponse = router_types::RedirectPaymentFlowResponse; - - #[allow(clippy::too_many_arguments)] async fn call_payment_flow( &self, state: &AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, merchant_key_store: domain::MerchantKeyStore, req: PaymentsRedirectResponseData, connector_action: CallConnectorAction, - _connector: String, - _payment_id: String, - ) -> RouterResult { + ) -> RouterResponse { let payment_confirm_req = api::PaymentsRequest { payment_id: Some(req.resource_id.clone()), merchant_id: req.merchant_id.clone(), @@ -934,7 +878,7 @@ impl PaymentRedirectFlow for PaymentRedirectCom }), ..Default::default() }; - let response = Box::pin(payments_core::< + Box::pin(payments_core::< api::CompleteAuthorize, api::PaymentsResponse, _, @@ -943,7 +887,6 @@ impl PaymentRedirectFlow for PaymentRedirectCom Ctx, >( state.clone(), - req_state, merchant_account, merchant_key_store, payment_complete_authorize::CompleteAuthorize, @@ -953,28 +896,7 @@ impl PaymentRedirectFlow for PaymentRedirectCom None, HeaderPayload::default(), )) - .await?; - let payments_response = match response { - services::ApplicationResponse::Json(response) => Ok(response), - services::ApplicationResponse::JsonWithHeaders((response, _)) => Ok(response), - _ => Err(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to get the response in json"), - }?; - let profile_id = payments_response - .profile_id - .as_ref() - .get_required_value("profile_id")?; - let business_profile = state - .store - .find_business_profile_by_profile_id(profile_id) - .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { - id: profile_id.to_string(), - })?; - Ok(router_types::RedirectPaymentFlowResponse { - payments_response, - business_profile, - }) + .await } fn get_payment_action(&self) -> services::PaymentAction { @@ -983,11 +905,11 @@ impl PaymentRedirectFlow for PaymentRedirectCom fn generate_response( &self, - payment_flow_response: &Self::PaymentFlowResponse, + payments_response: &api_models::payments::PaymentsResponse, + business_profile: diesel_models::business_profile::BusinessProfile, payment_id: String, connector: String, ) -> RouterResult> { - let payments_response = &payment_flow_response.payments_response; // There might be multiple redirections needed for some flows // If the status is requires customer action, then send the startpay url again // The redirection data must have been provided and updated by the connector @@ -1023,7 +945,7 @@ impl PaymentRedirectFlow for PaymentRedirectCom | api_models::enums::IntentStatus::Failed | api_models::enums::IntentStatus::Cancelled | api_models::enums::IntentStatus::RequiresCapture| api_models::enums::IntentStatus::Processing=> helpers::get_handle_response_url( payment_id, - &payment_flow_response.business_profile, + &business_profile, payments_response, connector, ), @@ -1040,20 +962,14 @@ pub struct PaymentRedirectSync; #[async_trait::async_trait] impl PaymentRedirectFlow for PaymentRedirectSync { - type PaymentFlowResponse = router_types::RedirectPaymentFlowResponse; - - #[allow(clippy::too_many_arguments)] async fn call_payment_flow( &self, state: &AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, merchant_key_store: domain::MerchantKeyStore, req: PaymentsRedirectResponseData, connector_action: CallConnectorAction, - _connector: String, - _payment_id: String, - ) -> RouterResult { + ) -> RouterResponse { let payment_sync_req = api::PaymentsRetrieveRequest { resource_id: req.resource_id, merchant_id: req.merchant_id, @@ -1070,7 +986,7 @@ impl PaymentRedirectFlow for PaymentRedirectSyn expand_attempts: None, expand_captures: None, }; - let response = Box::pin(payments_core::< + Box::pin(payments_core::< api::PSync, api::PaymentsResponse, _, @@ -1079,7 +995,6 @@ impl PaymentRedirectFlow for PaymentRedirectSyn Ctx, >( state.clone(), - req_state, merchant_account, merchant_key_store, PaymentStatus, @@ -1089,40 +1004,20 @@ impl PaymentRedirectFlow for PaymentRedirectSyn None, HeaderPayload::default(), )) - .await?; - let payments_response = match response { - services::ApplicationResponse::Json(response) => Ok(response), - services::ApplicationResponse::JsonWithHeaders((response, _)) => Ok(response), - _ => Err(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to get the response in json"), - }?; - let profile_id = payments_response - .profile_id - .as_ref() - .get_required_value("profile_id")?; - let business_profile = state - .store - .find_business_profile_by_profile_id(profile_id) - .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { - id: profile_id.to_string(), - })?; - Ok(router_types::RedirectPaymentFlowResponse { - payments_response, - business_profile, - }) + .await } fn generate_response( &self, - payment_flow_response: &Self::PaymentFlowResponse, + payments_response: &api_models::payments::PaymentsResponse, + business_profile: diesel_models::business_profile::BusinessProfile, payment_id: String, connector: String, ) -> RouterResult> { Ok(services::ApplicationResponse::JsonForRedirection( helpers::get_handle_response_url( payment_id, - &payment_flow_response.business_profile, - &payment_flow_response.payments_response, + &business_profile, + payments_response, connector, )?, )) @@ -1138,234 +1033,88 @@ pub struct PaymentAuthenticateCompleteAuthorize; #[async_trait::async_trait] impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize { - type PaymentFlowResponse = router_types::AuthenticatePaymentFlowResponse; - - #[allow(clippy::too_many_arguments)] async fn call_payment_flow( &self, state: &AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, merchant_key_store: domain::MerchantKeyStore, req: PaymentsRedirectResponseData, connector_action: CallConnectorAction, - connector: String, - payment_id: String, - ) -> RouterResult { - let merchant_id = merchant_account.merchant_id.clone(); - let payment_intent = state - .store - .find_payment_intent_by_payment_id_merchant_id( - &payment_id, - &merchant_id, - merchant_account.storage_scheme, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; - let payment_attempt = state - .store - .find_payment_attempt_by_attempt_id_merchant_id( - &payment_intent.active_attempt.get_id(), - &merchant_id, - merchant_account.storage_scheme, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; - let authentication_id = payment_attempt - .authentication_id - .ok_or(errors::ApiErrorResponse::InternalServerError) - .attach_printable("missing authentication_id in payment_attempt")?; - let authentication = state - .store - .find_authentication_by_merchant_id_authentication_id( - merchant_id.clone(), - authentication_id.clone(), - ) - .await - .to_not_found_response(errors::ApiErrorResponse::AuthenticationNotFound { - id: authentication_id, - })?; - // Fetching merchant_connector_account to check if pull_mechanism is enabled for 3ds connector - let authentication_merchant_connector_account = helpers::get_merchant_connector_account( - state, - &merchant_id, - None, - &merchant_key_store, - &payment_intent - .profile_id - .ok_or(errors::ApiErrorResponse::InternalServerError) - .attach_printable("missing profile_id in payment_intent")?, - &payment_attempt - .authentication_connector - .ok_or(errors::ApiErrorResponse::InternalServerError) - .attach_printable("missing authentication connector in payment_intent")?, - None, - ) - .await?; - let is_pull_mechanism_enabled = - crate::utils::check_if_pull_mechanism_for_external_3ds_enabled_from_connector_metadata( - authentication_merchant_connector_account - .get_metadata() - .map(|metadata| metadata.expose()), - ); - let response = if is_pull_mechanism_enabled - || authentication.authentication_type - == Some(common_enums::DecoupledAuthenticationType::Frictionless) - { - let payment_confirm_req = api::PaymentsRequest { - payment_id: Some(req.resource_id.clone()), - merchant_id: req.merchant_id.clone(), - feature_metadata: Some(api_models::payments::FeatureMetadata { - redirect_response: Some(api_models::payments::RedirectResponse { - param: req.param.map(Secret::new), - json_payload: Some( - req.json_payload.unwrap_or(serde_json::json!({})).into(), - ), - }), - }), - ..Default::default() - }; - Box::pin(payments_core::< - api::Authorize, - api::PaymentsResponse, - _, - _, - _, - Ctx, - >( - state.clone(), - req_state, - merchant_account, - merchant_key_store, - PaymentConfirm, - payment_confirm_req, - services::api::AuthFlow::Merchant, - connector_action, - None, - HeaderPayload::with_source(enums::PaymentSource::ExternalAuthenticator), - )) - .await? - } else { - let payment_sync_req = api::PaymentsRetrieveRequest { - resource_id: req.resource_id, - merchant_id: req.merchant_id, - param: req.param, - force_sync: req.force_sync, - connector: req.connector, - merchant_connector_details: req.creds_identifier.map(|creds_id| { - api::MerchantConnectorDetailsWrap { - creds_identifier: creds_id, - encoded_data: None, - } + ) -> RouterResponse { + let payment_confirm_req = api::PaymentsRequest { + payment_id: Some(req.resource_id.clone()), + merchant_id: req.merchant_id.clone(), + feature_metadata: Some(api_models::payments::FeatureMetadata { + redirect_response: Some(api_models::payments::RedirectResponse { + param: req.param.map(Secret::new), + json_payload: Some(req.json_payload.unwrap_or(serde_json::json!({})).into()), }), - client_secret: None, - expand_attempts: None, - expand_captures: None, - }; - Box::pin(payments_core::< - api::PSync, - api::PaymentsResponse, - _, - _, - _, - Ctx, - >( - state.clone(), - req_state, - merchant_account.clone(), - merchant_key_store, - PaymentStatus, - payment_sync_req, - services::api::AuthFlow::Merchant, - connector_action, - None, - HeaderPayload::default(), - )) - .await? - }; - let payments_response = match response { - services::ApplicationResponse::Json(response) => Ok(response), - services::ApplicationResponse::JsonWithHeaders((response, _)) => Ok(response), - _ => Err(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to get the response in json"), - }?; - // When intent status is RequiresCustomerAction, Set poll_id in redis to allow the fetch status of poll through retrieve_poll_status api from client - if payments_response.status == common_enums::IntentStatus::RequiresCustomerAction { - let req_poll_id = - super::utils::get_external_authentication_request_poll_id(&payment_id); - let poll_id = super::utils::get_poll_id(merchant_id.clone(), req_poll_id.clone()); - let redis_conn = state - .store - .get_redis_conn() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to get redis connection")?; - redis_conn - .set_key_with_expiry( - &poll_id, - api_models::poll::PollStatus::Pending.to_string(), - crate::consts::POLL_ID_TTL, - ) - .await - .change_context(errors::StorageError::KVError) - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to add poll_id in redis")?; + }), + ..Default::default() }; - let default_poll_config = router_types::PollConfig::default(); - let default_config_str = default_poll_config - .encode_to_string_of_json() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error while stringifying default poll config")?; - let poll_config = state - .store - .find_config_by_key_unwrap_or( - &router_types::PollConfig::get_poll_config_key(connector), - Some(default_config_str), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("The poll config was not found in the DB")?; - let poll_config: router_types::PollConfig = poll_config - .config - .parse_struct("PollConfig") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error while parsing PollConfig")?; - let profile_id = payments_response - .profile_id - .as_ref() - .get_required_value("profile_id")?; - let business_profile = state - .store - .find_business_profile_by_profile_id(profile_id) - .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { - id: profile_id.to_string(), - })?; - Ok(router_types::AuthenticatePaymentFlowResponse { - payments_response, - poll_config, - business_profile, - }) + Box::pin(payments_core::< + api::Authorize, + api::PaymentsResponse, + _, + _, + _, + Ctx, + >( + state.clone(), + merchant_account, + merchant_key_store, + PaymentConfirm, + payment_confirm_req, + services::api::AuthFlow::Merchant, + connector_action, + None, + HeaderPayload::with_source(enums::PaymentSource::ExternalAuthenticator), + )) + .await } fn generate_response( &self, - payment_flow_response: &Self::PaymentFlowResponse, + payments_response: &api_models::payments::PaymentsResponse, + business_profile: diesel_models::business_profile::BusinessProfile, payment_id: String, connector: String, ) -> RouterResult> { - let payments_response = &payment_flow_response.payments_response; let redirect_response = helpers::get_handle_response_url( - payment_id.clone(), - &payment_flow_response.business_profile, + payment_id, + &business_profile, payments_response, - connector.clone(), + connector, )?; + let return_url_with_query_params = redirect_response.return_url_with_query_params; // html script to check if inside iframe, then send post message to parent for redirection else redirect self to return_url - let html = utils::get_html_redirect_response_for_external_authentication( - redirect_response.return_url_with_query_params, - payments_response, - payment_id, - &payment_flow_response.poll_config, - )?; + let html = html! { + head { + title { "Redirect Form" } + (PreEscaped(format!(r#" + + "#))) + } + } + .into_string(); Ok(services::ApplicationResponse::Form(Box::new( services::RedirectionFormData { redirect_form: services::RedirectForm::Html { html_data: html }, @@ -1377,7 +1126,7 @@ impl PaymentRedirectFlow for PaymentAuthenticat } fn get_payment_action(&self) -> services::PaymentAction { - services::PaymentAction::PaymentAuthenticateCompleteAuthorize + services::PaymentAction::CompleteAuthorize } } @@ -1385,7 +1134,6 @@ impl PaymentRedirectFlow for PaymentAuthenticat #[instrument(skip_all)] pub async fn call_connector_service( state: &AppState, - req_state: ReqState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, connector: api::ConnectorData, @@ -1489,21 +1237,15 @@ where | TokenizationAction::TokenizeInConnectorAndApplepayPreDecrypt ) { let apple_pay_data = match payment_data.payment_method_data.clone() { - Some(payment_data) => { - let domain_data = domain::PaymentMethodData::from(payment_data); - match domain_data { - domain::PaymentMethodData::Wallet(domain::WalletData::ApplePay( - wallet_data, - )) => Some( - ApplePayData::token_json(domain::WalletData::ApplePay(wallet_data)) - .change_context(errors::ApiErrorResponse::InternalServerError)? - .decrypt(state) - .await - .change_context(errors::ApiErrorResponse::InternalServerError)?, - ), - _ => None, - } - } + Some(api_models::payments::PaymentMethodData::Wallet( + api_models::payments::WalletData::ApplePay(wallet_data), + )) => Some( + ApplePayData::token_json(api_models::payments::WalletData::ApplePay(wallet_data)) + .change_context(errors::ApiErrorResponse::InternalServerError)? + .decrypt(state) + .await + .change_context(errors::ApiErrorResponse::InternalServerError)?, + ), _ => None, }; @@ -1577,7 +1319,6 @@ where .to_update_tracker()? .update_trackers( state, - req_state, payment_data.clone(), customer.clone(), merchant_account.storage_scheme, @@ -1595,7 +1336,15 @@ where // and rely on previous status set in router_data router_data.status = payment_data.payment_attempt.status; router_data - .decide_flows(state, &connector, call_connector_action, connector_request) + .decide_flows( + state, + &connector, + customer, + call_connector_action, + merchant_account, + connector_request, + key_store, + ) .await } else { Ok(router_data) @@ -1718,8 +1467,11 @@ where let res = router_data.decide_flows( state, &session_connector_data.connector, + customer, CallConnectorAction::Trigger, + merchant_account, None, + key_store, ); join_handlers.push(res); @@ -1924,12 +1676,6 @@ where } else if connector.connector_name == router_types::Connector::Nmi && !matches!(format!("{operation:?}").as_str(), "CompleteAuthorize") && router_data.auth_type == storage_enums::AuthenticationType::ThreeDs - && !matches!( - payment_data - .payment_attempt - .external_three_ds_authentication_attempted, - Some(true) - ) { router_data = router_data.preprocessing_steps(state, connector).await?; @@ -2387,9 +2133,7 @@ where ) .await?; payment_data.payment_method_data = payment_method_data; - if let Some(payment_method_id) = pm_id { - payment_data.payment_attempt.payment_method_id = Some(payment_method_id); - } + payment_data.payment_attempt.payment_method_id = pm_id; payment_data } else { payment_data @@ -2426,22 +2170,21 @@ pub mod payment_address { billing: Option, payment_method_billing: Option, ) -> Self { - // billing -> .billing, this is the billing details passed in the root of payments request - // payment_method_billing -> .payment_method_data.billing - // Merge the billing details field from both `payment.billing` and `payment.payment_method_data.billing` // The unified payment_method_billing will be used as billing address and passed to the connector module // This unification is required in order to provide backwards compatibility // so that if `payment.billing` is passed it should be sent to the connector module - // Unify the billing details with `payment_method_data.billing` - let unified_payment_method_billing = payment_method_billing - .as_ref() - .map(|payment_method_billing| { - payment_method_billing - .clone() - .unify_address(billing.as_ref()) - }) - .or(billing.clone()); + let unified_payment_method_billing = + match (payment_method_billing.clone(), billing.clone()) { + (Some(payment_method_billing), Some(order_billing)) => Some(api::Address { + address: payment_method_billing.address.or(order_billing.address), + phone: payment_method_billing.phone.or(order_billing.phone), + email: payment_method_billing.email.or(order_billing.email), + }), + (Some(payment_method_billing), None) => Some(payment_method_billing), + (None, Some(order_billing)) => Some(order_billing), + (None, None) => None, + }; Self { shipping, @@ -2459,26 +2202,6 @@ pub mod payment_address { self.unified_payment_method_billing.as_ref() } - /// Unify the billing details from `payment_method_data.[payment_method_data].billing details`. - pub fn unify_with_payment_method_data_billing( - self, - payment_method_data_billing: Option, - ) -> Self { - // Unify the billing details with `payment_method_data.billing_details` - let unified_payment_method_billing = payment_method_data_billing - .map(|payment_method_data_billing| { - payment_method_data_billing.unify_address(self.get_payment_method_billing()) - }) - .or(self.get_payment_method_billing().cloned()); - - Self { - shipping: self.shipping, - billing: self.billing, - unified_payment_method_billing, - payment_method_billing: self.payment_method_billing, - } - } - pub fn get_request_payment_method_billing(&self) -> Option<&api::Address> { self.payment_method_billing.as_ref() } @@ -2537,33 +2260,6 @@ where pub authentication: Option, pub frm_metadata: Option, pub recurring_details: Option, - pub poll_config: Option, -} - -#[derive(Clone, serde::Serialize, Debug)] -pub struct PaymentEvent { - payment_intent: storage::PaymentIntent, - payment_attempt: storage::PaymentAttempt, -} - -impl PaymentData { - fn to_event(&self) -> PaymentEvent { - PaymentEvent { - payment_intent: self.payment_intent.clone(), - payment_attempt: self.payment_attempt.clone(), - } - } -} - -impl EventInfo for PaymentEvent { - type Data = Self; - fn data(&self) -> error_stack::Result { - Ok(self.clone()) - } - - fn key(&self) -> String { - "payment".to_string() - } } #[derive(Debug, Default, Clone)] @@ -2590,22 +2286,6 @@ pub struct CustomerDetails { pub phone_country_code: Option, } -pub trait CustomerDetailsExt { - type Error; - fn get_name(&self) -> Result, Self::Error>; - fn get_email(&self) -> Result; -} - -impl CustomerDetailsExt for CustomerDetails { - type Error = error_stack::Report; - fn get_name(&self) -> Result, Self::Error> { - self.name.clone().ok_or_else(missing_field_err("name")) - } - fn get_email(&self) -> Result { - self.email.clone().ok_or_else(missing_field_err("email")) - } -} - pub fn if_not_create_change_operation<'a, Op, F, Ctx>( status: storage_enums::IntentStatus, confirm: Option, @@ -2713,7 +2393,7 @@ pub async fn list_payments( merchant: domain::MerchantAccount, constraints: api::PaymentListConstraints, ) -> RouterResponse { - use hyperswitch_domain_models::errors::StorageError; + use data_models::errors::StorageError; helpers::validate_payment_list_request(&constraints)?; let merchant_id = &merchant.merchant_id; let db = state.store.as_ref(); @@ -2811,7 +2491,6 @@ pub async fn apply_filters_on_payments( constraints.payment_method, constraints.payment_method_type, constraints.authentication_type, - constraints.merchant_connector_id, merchant.storage_scheme, ) .await @@ -2864,89 +2543,6 @@ pub async fn get_filters_for_payments( )) } -#[cfg(feature = "olap")] -pub async fn get_payment_filters( - state: AppState, - merchant: domain::MerchantAccount, -) -> RouterResponse { - let merchant_connector_accounts = if let services::ApplicationResponse::Json(data) = - super::admin::list_payment_connectors(state, merchant.merchant_id).await? - { - data - } else { - return Err(errors::ApiErrorResponse::InternalServerError.into()); - }; - - let mut connector_map: HashMap> = HashMap::new(); - let mut payment_method_types_map: HashMap< - enums::PaymentMethod, - HashSet, - > = HashMap::new(); - - // populate connector map - merchant_connector_accounts - .iter() - .filter_map(|merchant_connector_account| { - merchant_connector_account - .connector_label - .as_ref() - .map(|label| { - let info = MerchantConnectorInfo { - connector_label: label.clone(), - merchant_connector_id: merchant_connector_account - .merchant_connector_id - .clone(), - }; - (merchant_connector_account.connector_name.clone(), info) - }) - }) - .for_each(|(connector_name, info)| { - connector_map - .entry(connector_name.clone()) - .or_default() - .push(info); - }); - - // populate payment method type map - merchant_connector_accounts - .iter() - .flat_map(|merchant_connector_account| { - merchant_connector_account.payment_methods_enabled.as_ref() - }) - .map(|payment_methods_enabled| { - payment_methods_enabled - .iter() - .filter_map(|payment_method_enabled| { - payment_method_enabled - .payment_method_types - .as_ref() - .map(|types_vec| (payment_method_enabled.payment_method, types_vec.clone())) - }) - }) - .for_each(|payment_methods_enabled| { - payment_methods_enabled.for_each(|(payment_method, payment_method_types_vec)| { - payment_method_types_map - .entry(payment_method) - .or_default() - .extend( - payment_method_types_vec - .iter() - .map(|p| p.payment_method_type), - ); - }); - }); - - Ok(services::ApplicationResponse::Json( - api::PaymentListFiltersV2 { - connector: connector_map, - currency: enums::Currency::iter().collect(), - status: enums::IntentStatus::iter().collect(), - payment_method: payment_method_types_map, - authentication_type: enums::AuthenticationType::iter().collect(), - }, - )) -} - pub async fn add_process_sync_task( db: &dyn StorageInterface, payment_attempt: &storage::PaymentAttempt, @@ -3031,7 +2627,6 @@ pub async fn get_connector_choice( key_store: &domain::MerchantKeyStore, payment_data: &mut PaymentData, eligible_connectors: Option>, - mandate_type: Option, ) -> RouterResult> where F: Send + Clone, @@ -3071,7 +2666,6 @@ where payment_data, Some(straight_through), eligible_connectors, - mandate_type, ) .await? } @@ -3085,7 +2679,6 @@ where payment_data, None, eligible_connectors, - mandate_type, ) .await? } @@ -3102,7 +2695,6 @@ where Ok(connector) } -#[allow(clippy::too_many_arguments)] pub async fn connector_selection( state: &AppState, merchant_account: &domain::MerchantAccount, @@ -3111,7 +2703,6 @@ pub async fn connector_selection( payment_data: &mut PaymentData, request_straight_through: Option, eligible_connectors: Option>, - mandate_type: Option, ) -> RouterResult where F: Send + Clone, @@ -3153,7 +2744,6 @@ where request_straight_through, &mut routing_data, eligible_connectors, - mandate_type, ) .await?; @@ -3187,7 +2777,6 @@ pub async fn decide_connector( request_straight_through: Option, routing_data: &mut storage::RoutingData, eligible_connectors: Option>, - mandate_type: Option, ) -> RouterResult where F: Send + Clone, @@ -3315,13 +2904,10 @@ where .attach_printable("Invalid connector name received")?; return decide_multiplex_connector_for_normal_or_recurring_payment( - &state, payment_data, routing_data, connector_data, - mandate_type, - ) - .await; + ); } if let Some(ref routing_algorithm) = routing_data.routing_info.algorithm { @@ -3372,13 +2958,10 @@ where .attach_printable("Invalid connector name received")?; return decide_multiplex_connector_for_normal_or_recurring_payment( - &state, payment_data, routing_data, connector_data, - mandate_type, - ) - .await; + ); } route_connector_v1( @@ -3389,40 +2972,22 @@ where TransactionData::Payment(payment_data), routing_data, eligible_connectors, - mandate_type, ) .await } -pub async fn decide_multiplex_connector_for_normal_or_recurring_payment( - state: &AppState, +pub fn decide_multiplex_connector_for_normal_or_recurring_payment( payment_data: &mut PaymentData, routing_data: &mut storage::RoutingData, connectors: Vec, - mandate_type: Option, ) -> RouterResult { match ( payment_data.payment_intent.setup_future_usage, payment_data.token_data.as_ref(), payment_data.recurring_details.as_ref(), - payment_data.payment_intent.off_session, - mandate_type, ) { - ( - Some(storage_enums::FutureUsage::OffSession), - Some(_), - None, - None, - Some(api::MandateTransactionType::RecurringMandateTransaction), - ) - | ( - None, - None, - Some(RecurringDetails::PaymentMethodId(_)), - Some(true), - Some(api::MandateTransactionType::RecurringMandateTransaction), - ) - | (None, Some(_), None, Some(true), _) => { + (Some(storage_enums::FutureUsage::OffSession), Some(_), None) + | (None, None, Some(RecurringDetails::PaymentMethodId(_))) => { logger::debug!("performing routing for token-based MIT flow"); let payment_method_info = payment_data @@ -3430,120 +2995,32 @@ pub async fn decide_multiplex_connector_for_normal_or_recurring_payment( - "connector_mandate_details", - ) - }) - .transpose() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("unable to deserialize connector mandate details")?; - - let profile_id = payment_data - .payment_intent - .profile_id - .as_ref() - .ok_or(errors::ApiErrorResponse::ResourceIdNotFound)?; - - let pg_agnostic = state - .store - .find_config_by_key_unwrap_or( - &format!("pg_agnostic_mandate_{}", profile_id), - Some("false".to_string()), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("The pg_agnostic config was not found in the DB")?; + let connector_mandate_details = payment_method_info + .connector_mandate_details + .clone() + .map(|details| { + details.parse_value::("connector_mandate_details") + }) + .transpose() + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("unable to deserialize connector mandate details")? + .get_required_value("connector_mandate_details") + .change_context(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration) + .attach_printable("no eligible connector found for token-based MIT flow since there were no connector mandate details")?; let mut connector_choice = None; - for connector_data in connectors { - let merchant_connector_id = connector_data - .merchant_connector_id - .as_ref() - .ok_or(errors::ApiErrorResponse::InternalServerError)?; - - if is_network_transaction_id_flow( - state, - &pg_agnostic.config, - connector_data.connector_name, - payment_method_info, - ) { - logger::info!("using network_transaction_id for MIT flow"); - let network_transaction_id = payment_method_info - .network_transaction_id - .as_ref() - .ok_or(errors::ApiErrorResponse::InternalServerError)?; - - let mandate_reference_id = - Some(payments_api::MandateReferenceId::NetworkMandateId( - network_transaction_id.to_string(), - )); - - connector_choice = Some((connector_data, mandate_reference_id.clone())); - break; - } else if connector_mandate_details - .clone() - .map(|connector_mandate_details| { - connector_mandate_details.contains_key(merchant_connector_id) - }) - .unwrap_or(false) - { - if let Some(merchant_connector_id) = - connector_data.merchant_connector_id.as_ref() + if let Some(merchant_connector_id) = connector_data.merchant_connector_id.as_ref() { + if let Some(mandate_reference_record) = + connector_mandate_details.get(merchant_connector_id) { - if let Some(mandate_reference_record) = connector_mandate_details.clone() - .get_required_value("connector_mandate_details") - .change_context(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration) - .attach_printable("no eligible connector found for token-based MIT flow since there were no connector mandate details")? - .get(merchant_connector_id) - { - common_utils::fp_utils::when( - mandate_reference_record - .original_payment_authorized_currency - .map(|mandate_currency| mandate_currency != payment_data.currency) - .unwrap_or(false), - || { - Err(report!(errors::ApiErrorResponse::MandateValidationFailed { - reason: "cross currency mandates not supported".into() - })) - }, - )?; - let mandate_reference_id = - Some(payments_api::MandateReferenceId::ConnectorMandateId( - payments_api::ConnectorMandateReferenceId { - connector_mandate_id: Some( - mandate_reference_record.connector_mandate_id.clone(), - ), - payment_method_id: Some( - payment_method_info.payment_method_id.clone(), - ), - update_history: None, - }, - )); - payment_data.recurring_mandate_payment_data = - Some(RecurringMandatePaymentData { - payment_method_type: mandate_reference_record - .payment_method_type, - original_payment_authorized_amount: mandate_reference_record - .original_payment_authorized_amount, - original_payment_authorized_currency: mandate_reference_record - .original_payment_authorized_currency, - }); - - connector_choice = Some((connector_data, mandate_reference_id.clone())); - break; - } + connector_choice = Some((connector_data, mandate_reference_record.clone())); + break; } - } else { - continue; } } - let (chosen_connector_data, mandate_reference_id) = connector_choice + let (chosen_connector_data, mandate_reference_record) = connector_choice .get_required_value("connector_choice") .change_context(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration) .attach_printable("no eligible connector found for token-based MIT payment")?; @@ -3554,16 +3031,26 @@ pub async fn decide_multiplex_connector_for_normal_or_recurring_payment bool { - let ntid_supported_connectors = &state - .conf - .network_transaction_id_supported_connectors - .connector_list; - - pg_agnostic == "true" - && payment_method_info.payment_method == Some(storage_enums::PaymentMethod::Card) - && ntid_supported_connectors.contains(&connector) - && payment_method_info.network_transaction_id.is_some() -} - pub fn should_add_task_to_process_tracker(payment_data: &PaymentData) -> bool { let connector = payment_data.payment_attempt.connector.as_deref(); @@ -3726,7 +3196,6 @@ where Ok(final_list) } -#[allow(clippy::too_many_arguments)] pub async fn route_connector_v1( state: &AppState, merchant_account: &domain::MerchantAccount, @@ -3735,7 +3204,6 @@ pub async fn route_connector_v1( transaction_data: TransactionData<'_, F>, routing_data: &mut storage::RoutingData, eligible_connectors: Option>, - mandate_type: Option, ) -> RouterResult where F: Send + Clone, @@ -3822,13 +3290,10 @@ where match transaction_data { TransactionData::Payment(payment_data) => { decide_multiplex_connector_for_normal_or_recurring_payment( - state, payment_data, routing_data, connector_data, - mandate_type, ) - .await } #[cfg(feature = "payouts")] @@ -3893,7 +3358,6 @@ pub async fn payment_external_authentication( customer_id, &merchant_account.merchant_id, &key_store, - storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) @@ -3965,7 +3429,6 @@ pub async fn payment_external_authentication( &payment_attempt, &payment_intent, &key_store, - storage_scheme, ) .await? .ok_or(errors::ApiErrorResponse::InternalServerError) @@ -3988,11 +3451,6 @@ pub async fn payment_external_authentication( &payment_attempt.clone(), payment_connector_name, )); - let webhook_url = helpers::create_webhook_url( - &state.conf.server.base_url, - merchant_id, - &authentication_connector, - ); let business_profile = state .store @@ -4026,7 +3484,6 @@ pub async fn payment_external_authentication( req.sdk_information, req.threeds_method_comp_ind, optional_customer.and_then(|customer| customer.email.map(common_utils::pii::Email::from)), - webhook_url, )) .await?; Ok(services::ApplicationResponse::Json( @@ -4044,26 +3501,3 @@ pub async fn payment_external_authentication( }, )) } - -#[instrument(skip_all)] -pub async fn get_extended_card_info( - state: AppState, - merchant_id: String, - payment_id: String, -) -> RouterResponse { - let redis_conn = state - .store - .get_redis_conn() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to get redis connection")?; - - let key = helpers::get_redis_key_for_extended_card_info(&merchant_id, &payment_id); - let payload = redis_conn - .get_key::(&key) - .await - .change_context(errors::ApiErrorResponse::ExtendedCardInfoNotFound)?; - - Ok(services::ApplicationResponse::Json( - payments_api::ExtendedCardInfoResponse { payload }, - )) -} diff --git a/crates/router/src/core/payments/access_token.rs b/crates/router/src/core/payments/access_token.rs index 1de9cb60ca0..47f6b7e2ae4 100644 --- a/crates/router/src/core/payments/access_token.rs +++ b/crates/router/src/core/payments/access_token.rs @@ -10,7 +10,7 @@ use crate::{ payments, }, routes::{metrics, AppState}, - services::{self, logger}, + services, types::{self, api as api_types, domain}, }; @@ -64,20 +64,8 @@ pub async fn add_access_token< { let merchant_id = &merchant_account.merchant_id; let store = &*state.store; - - // `merchant_connector_id` may not be present in the below cases - // - when straight through routing is used without passing the `merchant_connector_id` - // - when creds identifier is passed - // - // In these cases fallback to `connector_name`. - // We cannot use multiple merchant connector account in these cases - let merchant_connector_id_or_connector_name = connector - .merchant_connector_id - .clone() - .unwrap_or(connector.connector_name.to_string()); - let old_access_token = store - .get_access_token(merchant_id, &merchant_connector_id_or_connector_name) + .get_access_token(merchant_id, connector.connector.id()) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("DB error when accessing the access token")?; @@ -115,24 +103,19 @@ pub async fn add_access_token< ) .await? .async_map(|access_token| async { - // Store the access token in redis with expiry - // The expiry should be adjusted for network delays from the connector + //Store the access token in db let store = &*state.store; - if let Err(access_token_set_error) = store + // This error should not be propagated, we don't want payments to fail once we have + // the access token, the next request will create new access token + let _ = store .set_access_token( merchant_id, - &merchant_connector_id_or_connector_name, + connector.connector.id(), access_token.clone(), ) .await .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("DB error when setting the access token") - { - // If we are not able to set the access token in redis, the error should just be logged and proceed with the payment - // Payments should not fail, once the access token is successfully created - // The next request will create new access token, if required - logger::error!(access_token_set_error=?access_token_set_error); - } + .attach_printable("DB error when setting the access token"); Some(access_token) }) .await diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs index c7ec86ac5e6..6c952dc2593 100644 --- a/crates/router/src/core/payments/flows.rs +++ b/crates/router/src/core/payments/flows.rs @@ -44,8 +44,11 @@ pub trait Feature { self, state: &AppState, connector: &api::ConnectorData, + maybe_customer: &Option, call_connector_action: payments::CallConnectorAction, + merchant_account: &domain::MerchantAccount, connector_request: Option, + key_store: &domain::MerchantKeyStore, ) -> RouterResult where Self: Sized, @@ -152,7 +155,6 @@ default_imp_for_complete_authorize!( connector::Coinbase, connector::Cryptopay, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globepay, @@ -161,7 +163,6 @@ default_imp_for_complete_authorize!( connector::Iatapay, connector::Klarna, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Noon, connector::Opayo, @@ -182,8 +183,7 @@ default_imp_for_complete_authorize!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_webhook_source_verification { ($($path:ident::$connector:ident),*) => { @@ -229,7 +229,6 @@ default_imp_for_webhook_source_verification!( connector::Cryptopay, connector::Cybersource, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -240,7 +239,6 @@ default_imp_for_webhook_source_verification!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -267,8 +265,7 @@ default_imp_for_webhook_source_verification!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_create_customer { @@ -316,7 +313,6 @@ default_imp_for_create_customer!( connector::Cryptopay, connector::Cybersource, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -326,7 +322,6 @@ default_imp_for_create_customer!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -352,8 +347,7 @@ default_imp_for_create_customer!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_connector_redirect_response { @@ -397,7 +391,6 @@ default_imp_for_connector_redirect_response!( connector::Cryptopay, connector::Cybersource, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globepay, @@ -406,7 +399,6 @@ default_imp_for_connector_redirect_response!( connector::Iatapay, connector::Klarna, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Opayo, connector::Opennode, @@ -426,8 +418,7 @@ default_imp_for_connector_redirect_response!( connector::Volt, connector::Wise, connector::Worldline, - connector::Worldpay, - connector::Zsl + connector::Worldpay ); macro_rules! default_imp_for_connector_request_id { @@ -442,7 +433,6 @@ macro_rules! default_imp_for_connector_request_id { impl api::ConnectorTransactionId for connector::DummyConnector {} default_imp_for_connector_request_id!( - connector::Zsl, connector::Aci, connector::Adyen, connector::Airwallex, @@ -460,7 +450,6 @@ default_imp_for_connector_request_id!( connector::Cryptopay, connector::Cybersource, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -470,7 +459,6 @@ default_imp_for_connector_request_id!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nmi, connector::Noon, connector::Nuvei, @@ -547,7 +535,6 @@ default_imp_for_accept_dispute!( connector::Cryptopay, connector::Cybersource, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -558,7 +545,6 @@ default_imp_for_accept_dispute!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -586,8 +572,7 @@ default_imp_for_accept_dispute!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_file_upload { @@ -656,7 +641,6 @@ default_imp_for_file_upload!( connector::Cryptopay, connector::Cybersource, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -667,7 +651,6 @@ default_imp_for_file_upload!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -694,8 +677,7 @@ default_imp_for_file_upload!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_submit_evidence { @@ -742,7 +724,6 @@ default_imp_for_submit_evidence!( connector::Coinbase, connector::Cryptopay, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -753,7 +734,6 @@ default_imp_for_submit_evidence!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -780,8 +760,7 @@ default_imp_for_submit_evidence!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_defend_dispute { @@ -828,7 +807,6 @@ default_imp_for_defend_dispute!( connector::Coinbase, connector::Cryptopay, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Globepay, connector::Forte, @@ -839,7 +817,6 @@ default_imp_for_defend_dispute!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -867,8 +844,7 @@ default_imp_for_defend_dispute!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_pre_processing_steps{ @@ -913,7 +889,6 @@ default_imp_for_pre_processing_steps!( connector::Coinbase, connector::Cryptopay, connector::Dlocal, - connector::Ebanx, connector::Iatapay, connector::Fiserv, connector::Forte, @@ -923,7 +898,6 @@ default_imp_for_pre_processing_steps!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Noon, connector::Nuvei, @@ -946,8 +920,7 @@ default_imp_for_pre_processing_steps!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_payouts { @@ -988,7 +961,6 @@ default_imp_for_payouts!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -997,6 +969,7 @@ default_imp_for_payouts!( connector::Opennode, connector::Payeezy, connector::Payme, + connector::Paypal, connector::Payu, connector::Placetopay, connector::Powertranz, @@ -1006,6 +979,7 @@ default_imp_for_payouts!( connector::Signifyd, connector::Square, connector::Stax, + connector::Stripe, connector::Shift4, connector::Threedsecureio, connector::Trustpay, @@ -1013,8 +987,7 @@ default_imp_for_payouts!( connector::Volt, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "payouts")] @@ -1072,7 +1045,6 @@ default_imp_for_payouts_create!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1081,6 +1053,7 @@ default_imp_for_payouts_create!( connector::Opennode, connector::Payeezy, connector::Payme, + connector::Paypal, connector::Payu, connector::Placetopay, connector::Powertranz, @@ -1090,6 +1063,7 @@ default_imp_for_payouts_create!( connector::Signifyd, connector::Square, connector::Stax, + connector::Stripe, connector::Shift4, connector::Threedsecureio, connector::Trustpay, @@ -1097,8 +1071,7 @@ default_imp_for_payouts_create!( connector::Volt, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "payouts")] @@ -1159,7 +1132,6 @@ default_imp_for_payouts_eligibility!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1186,8 +1158,7 @@ default_imp_for_payouts_eligibility!( connector::Volt, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "payouts")] @@ -1245,7 +1216,6 @@ default_imp_for_payouts_fulfill!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1254,6 +1224,7 @@ default_imp_for_payouts_fulfill!( connector::Opennode, connector::Payeezy, connector::Payme, + connector::Paypal, connector::Payu, connector::Placetopay, connector::Powertranz, @@ -1263,6 +1234,7 @@ default_imp_for_payouts_fulfill!( connector::Signifyd, connector::Square, connector::Stax, + connector::Stripe, connector::Shift4, connector::Threedsecureio, connector::Trustpay, @@ -1270,8 +1242,7 @@ default_imp_for_payouts_fulfill!( connector::Volt, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "payouts")] @@ -1329,7 +1300,6 @@ default_imp_for_payouts_cancel!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1348,6 +1318,7 @@ default_imp_for_payouts_cancel!( connector::Signifyd, connector::Square, connector::Stax, + connector::Stripe, connector::Shift4, connector::Threedsecureio, connector::Trustpay, @@ -1355,8 +1326,7 @@ default_imp_for_payouts_cancel!( connector::Volt, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "payouts")] @@ -1415,7 +1385,6 @@ default_imp_for_payouts_quote!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1442,8 +1411,7 @@ default_imp_for_payouts_quote!( connector::Volt, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "payouts")] @@ -1502,97 +1470,6 @@ default_imp_for_payouts_recipient!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, - connector::Nexinets, - connector::Nmi, - connector::Noon, - connector::Nuvei, - connector::Opayo, - connector::Opennode, - connector::Payeezy, - connector::Payme, - connector::Paypal, - connector::Payu, - connector::Placetopay, - connector::Powertranz, - connector::Prophetpay, - connector::Rapyd, - connector::Riskified, - connector::Signifyd, - connector::Square, - connector::Stax, - connector::Shift4, - connector::Threedsecureio, - connector::Trustpay, - connector::Tsys, - connector::Volt, - connector::Worldline, - connector::Worldpay, - connector::Zen, - connector::Zsl -); - -#[cfg(feature = "payouts")] -macro_rules! default_imp_for_payouts_recipient_account { - ($($path:ident::$connector:ident),*) => { - $( - impl api::PayoutRecipientAccount for $path::$connector {} - impl - services::ConnectorIntegration< - api::PoRecipientAccount, - types::PayoutsData, - types::PayoutsResponseData, - > for $path::$connector - {} - )* - }; -} - -#[cfg(feature = "payouts")] -#[cfg(feature = "dummy_connector")] -impl api::PayoutRecipientAccount for connector::DummyConnector {} -#[cfg(feature = "payouts")] -#[cfg(feature = "dummy_connector")] -impl - services::ConnectorIntegration< - api::PoRecipientAccount, - types::PayoutsData, - types::PayoutsResponseData, - > for connector::DummyConnector -{ -} - -#[cfg(feature = "payouts")] -default_imp_for_payouts_recipient_account!( - connector::Aci, - connector::Adyen, - connector::Airwallex, - connector::Authorizedotnet, - connector::Bambora, - connector::Bankofamerica, - connector::Billwerk, - connector::Bitpay, - connector::Bluesnap, - connector::Boku, - connector::Braintree, - connector::Cashtocode, - connector::Checkout, - connector::Cryptopay, - connector::Cybersource, - connector::Coinbase, - connector::Dlocal, - connector::Ebanx, - connector::Fiserv, - connector::Forte, - connector::Globalpay, - connector::Globepay, - connector::Gocardless, - connector::Helcim, - connector::Iatapay, - connector::Klarna, - connector::Mollie, - connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1611,16 +1488,15 @@ default_imp_for_payouts_recipient_account!( connector::Signifyd, connector::Square, connector::Stax, + connector::Stripe, connector::Shift4, connector::Threedsecureio, connector::Trustpay, connector::Tsys, connector::Volt, - connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_approve { @@ -1668,7 +1544,6 @@ default_imp_for_approve!( connector::Cybersource, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -1679,7 +1554,6 @@ default_imp_for_approve!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1707,8 +1581,7 @@ default_imp_for_approve!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_reject { @@ -1756,7 +1629,6 @@ default_imp_for_reject!( connector::Cybersource, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -1767,7 +1639,6 @@ default_imp_for_reject!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1795,8 +1666,7 @@ default_imp_for_reject!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_fraud_check { @@ -1828,7 +1698,6 @@ default_imp_for_fraud_check!( connector::Cybersource, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -1839,7 +1708,6 @@ default_imp_for_fraud_check!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1865,8 +1733,7 @@ default_imp_for_fraud_check!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "frm")] @@ -1916,7 +1783,6 @@ default_imp_for_frm_sale!( connector::Cybersource, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -1927,7 +1793,6 @@ default_imp_for_frm_sale!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -1953,8 +1818,7 @@ default_imp_for_frm_sale!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "frm")] @@ -2004,7 +1868,6 @@ default_imp_for_frm_checkout!( connector::Cybersource, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -2015,7 +1878,6 @@ default_imp_for_frm_checkout!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -2041,8 +1903,7 @@ default_imp_for_frm_checkout!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "frm")] @@ -2092,7 +1953,6 @@ default_imp_for_frm_transaction!( connector::Cybersource, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -2103,7 +1963,6 @@ default_imp_for_frm_transaction!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -2129,8 +1988,7 @@ default_imp_for_frm_transaction!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "frm")] @@ -2180,7 +2038,6 @@ default_imp_for_frm_fulfillment!( connector::Cybersource, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -2191,7 +2048,6 @@ default_imp_for_frm_fulfillment!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -2217,8 +2073,7 @@ default_imp_for_frm_fulfillment!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); #[cfg(feature = "frm")] @@ -2268,7 +2123,6 @@ default_imp_for_frm_record_return!( connector::Cybersource, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -2279,7 +2133,6 @@ default_imp_for_frm_record_return!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -2305,8 +2158,7 @@ default_imp_for_frm_record_return!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_incremental_authorization { @@ -2353,7 +2205,6 @@ default_imp_for_incremental_authorization!( connector::Cryptopay, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -2364,7 +2215,6 @@ default_imp_for_incremental_authorization!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Noon, @@ -2392,8 +2242,7 @@ default_imp_for_incremental_authorization!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_revoking_mandates { @@ -2438,7 +2287,6 @@ default_imp_for_revoking_mandates!( connector::Cryptopay, connector::Coinbase, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -2449,7 +2297,6 @@ default_imp_for_revoking_mandates!( connector::Klarna, connector::Mollie, connector::Multisafepay, - connector::Netcetera, connector::Nexinets, connector::Nmi, connector::Nuvei, @@ -2476,8 +2323,7 @@ default_imp_for_revoking_mandates!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); macro_rules! default_imp_for_connector_authentication { @@ -2565,7 +2411,6 @@ default_imp_for_connector_authentication!( connector::Coinbase, connector::Cybersource, connector::Dlocal, - connector::Ebanx, connector::Fiserv, connector::Forte, connector::Globalpay, @@ -2602,6 +2447,5 @@ default_imp_for_connector_authentication!( connector::Wise, connector::Worldline, connector::Worldpay, - connector::Zen, - connector::Zsl + connector::Zen ); diff --git a/crates/router/src/core/payments/flows/approve_flow.rs b/crates/router/src/core/payments/flows/approve_flow.rs index ffa11fdb0f5..14b710de914 100644 --- a/crates/router/src/core/payments/flows/approve_flow.rs +++ b/crates/router/src/core/payments/flows/approve_flow.rs @@ -49,8 +49,11 @@ impl Feature self, _state: &AppState, _connector: &api::ConnectorData, + _customer: &Option, _call_connector_action: payments::CallConnectorAction, + _merchant_account: &domain::MerchantAccount, _connector_request: Option, + _key_store: &domain::MerchantKeyStore, ) -> RouterResult { Err(ApiErrorResponse::NotImplemented { message: NotImplementedMessage::Reason("Flow not supported".to_string()), diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs index 6b64dc04044..7757313d867 100644 --- a/crates/router/src/core/payments/flows/authorize_flow.rs +++ b/crates/router/src/core/payments/flows/authorize_flow.rs @@ -1,7 +1,7 @@ use async_trait::async_trait; use error_stack; +use router_env::tracing::Instrument; -// use router_env::tracing::Instrument; use super::{ConstructFlowSpecificData, Feature}; use crate::{ core::{ @@ -61,8 +61,11 @@ impl Feature for types::PaymentsAu mut self, state: &AppState, connector: &api::ConnectorData, + maybe_customer: &Option, call_connector_action: payments::CallConnectorAction, + merchant_account: &domain::MerchantAccount, connector_request: Option, + key_store: &domain::MerchantKeyStore, ) -> RouterResult { let connector_integration: services::BoxedConnectorIntegration< '_, @@ -74,7 +77,7 @@ impl Feature for types::PaymentsAu if self.should_proceed_with_authorize() { self.decide_authentication_type(); logger::debug!(auth_type=?self.auth_type); - let resp = services::execute_connector_processing_step( + let mut resp = services::execute_connector_processing_step( state, connector_integration, &self, @@ -85,7 +88,73 @@ impl Feature for types::PaymentsAu .to_payment_failed_response()?; metrics::PAYMENT_COUNT.add(&metrics::CONTEXT, 1, &[]); // Metrics - Ok(resp) + + let is_mandate = resp.request.setup_mandate_details.is_some(); + + if is_mandate { + let (payment_method_id, payment_method_status) = + Box::pin(tokenization::save_payment_method( + state, + connector, + resp.to_owned(), + maybe_customer, + merchant_account, + self.request.payment_method_type, + key_store, + Some(resp.request.amount), + Some(resp.request.currency), + )) + .await?; + + resp.payment_method_id = payment_method_id.clone(); + resp.payment_method_status = payment_method_status; + + Ok(mandate::mandate_procedure( + state, + resp, + maybe_customer, + payment_method_id, + connector.merchant_connector_id.clone(), + ) + .await?) + } else { + let connector = connector.clone(); + let response = resp.clone(); + let maybe_customer = maybe_customer.clone(); + let merchant_account = merchant_account.clone(); + let key_store = key_store.clone(); + let state = state.clone(); + + logger::info!("Call to save_payment_method in locker"); + let _task_handle = tokio::spawn( + async move { + logger::info!("Starting async call to save_payment_method in locker"); + + let result = Box::pin(tokenization::save_payment_method( + &state, + &connector, + response, + &maybe_customer, + &merchant_account, + self.request.payment_method_type, + &key_store, + Some(resp.request.amount), + Some(resp.request.currency), + )) + .await; + + if let Err(err) = result { + logger::error!( + "Asynchronously saving card in locker failed : {:?}", + err + ); + } + } + .in_current_span(), + ); + + Ok(resp) + } } else { Ok(self.clone()) } @@ -225,15 +294,13 @@ impl mandate::MandateBehaviour for types::PaymentsAuthorizeData { fn get_mandate_id(&self) -> Option<&api_models::payments::MandateIds> { self.mandate_id.as_ref() } - fn get_payment_method_data(&self) -> domain::payments::PaymentMethodData { + fn get_payment_method_data(&self) -> api_models::payments::PaymentMethodData { self.payment_method_data.clone() } fn get_setup_future_usage(&self) -> Option { self.setup_future_usage } - fn get_setup_mandate_details( - &self, - ) -> Option<&hyperswitch_domain_models::mandates::MandateData> { + fn get_setup_mandate_details(&self) -> Option<&data_models::mandates::MandateData> { self.setup_mandate_details.as_ref() } diff --git a/crates/router/src/core/payments/flows/cancel_flow.rs b/crates/router/src/core/payments/flows/cancel_flow.rs index 5f802a0bbe8..5918380ee0b 100644 --- a/crates/router/src/core/payments/flows/cancel_flow.rs +++ b/crates/router/src/core/payments/flows/cancel_flow.rs @@ -48,8 +48,11 @@ impl Feature self, state: &AppState, connector: &api::ConnectorData, + _customer: &Option, call_connector_action: payments::CallConnectorAction, + _merchant_account: &domain::MerchantAccount, connector_request: Option, + _key_store: &domain::MerchantKeyStore, ) -> RouterResult { metrics::PAYMENT_CANCEL_COUNT.add( &metrics::CONTEXT, diff --git a/crates/router/src/core/payments/flows/capture_flow.rs b/crates/router/src/core/payments/flows/capture_flow.rs index 56ae6500c35..d2b7c8e91bd 100644 --- a/crates/router/src/core/payments/flows/capture_flow.rs +++ b/crates/router/src/core/payments/flows/capture_flow.rs @@ -49,8 +49,11 @@ impl Feature self, state: &AppState, connector: &api::ConnectorData, + _customer: &Option, call_connector_action: payments::CallConnectorAction, + _merchant_account: &domain::MerchantAccount, connector_request: Option, + _key_store: &domain::MerchantKeyStore, ) -> RouterResult { let connector_integration: services::BoxedConnectorIntegration< '_, diff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rs index baf4190395f..68d0ee8d475 100644 --- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs +++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs @@ -63,8 +63,11 @@ impl Feature mut self, state: &AppState, connector: &api::ConnectorData, + _customer: &Option, call_connector_action: payments::CallConnectorAction, + _merchant_account: &domain::MerchantAccount, connector_request: Option, + _key_store: &domain::MerchantKeyStore, ) -> RouterResult { let connector_integration: services::BoxedConnectorIntegration< '_, diff --git a/crates/router/src/core/payments/flows/incremental_authorization_flow.rs b/crates/router/src/core/payments/flows/incremental_authorization_flow.rs index e702483022c..387916bab7c 100644 --- a/crates/router/src/core/payments/flows/incremental_authorization_flow.rs +++ b/crates/router/src/core/payments/flows/incremental_authorization_flow.rs @@ -56,8 +56,11 @@ impl Feature, call_connector_action: payments::CallConnectorAction, + _merchant_account: &domain::MerchantAccount, connector_request: Option, + _key_store: &domain::MerchantKeyStore, ) -> RouterResult { let connector_integration: services::BoxedConnectorIntegration< '_, diff --git a/crates/router/src/core/payments/flows/psync_flow.rs b/crates/router/src/core/payments/flows/psync_flow.rs index f410b65f076..cb7a764985d 100644 --- a/crates/router/src/core/payments/flows/psync_flow.rs +++ b/crates/router/src/core/payments/flows/psync_flow.rs @@ -52,8 +52,11 @@ impl Feature mut self, state: &AppState, connector: &api::ConnectorData, + _customer: &Option, call_connector_action: payments::CallConnectorAction, + _merchant_account: &domain::MerchantAccount, connector_request: Option, + _key_store: &domain::MerchantKeyStore, ) -> RouterResult { let connector_integration: services::BoxedConnectorIntegration< '_, diff --git a/crates/router/src/core/payments/flows/reject_flow.rs b/crates/router/src/core/payments/flows/reject_flow.rs index 89c1585fca1..910cc955e63 100644 --- a/crates/router/src/core/payments/flows/reject_flow.rs +++ b/crates/router/src/core/payments/flows/reject_flow.rs @@ -48,8 +48,11 @@ impl Feature self, _state: &AppState, _connector: &api::ConnectorData, + _customer: &Option, _call_connector_action: payments::CallConnectorAction, + _merchant_account: &domain::MerchantAccount, _connector_request: Option, + _key_store: &domain::MerchantKeyStore, ) -> RouterResult { Err(ApiErrorResponse::NotImplemented { message: NotImplementedMessage::Reason("Flow not supported".to_string()), diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs index 66e0f144807..349c76cd23a 100644 --- a/crates/router/src/core/payments/flows/session_flow.rs +++ b/crates/router/src/core/payments/flows/session_flow.rs @@ -53,8 +53,11 @@ impl Feature for types::PaymentsSessio self, state: &routes::AppState, connector: &api::ConnectorData, + customer: &Option, call_connector_action: payments::CallConnectorAction, + _merchant_account: &domain::MerchantAccount, _connector_request: Option, + _key_store: &domain::MerchantKeyStore, ) -> RouterResult { metrics::SESSION_TOKEN_CREATED.add( &metrics::CONTEXT, @@ -64,8 +67,14 @@ impl Feature for types::PaymentsSessio connector.connector_name.to_string(), )], ); - self.decide_flow(state, connector, Some(true), call_connector_action) - .await + self.decide_flow( + state, + connector, + customer, + Some(true), + call_connector_action, + ) + .await } async fn add_access_token<'a>( @@ -111,8 +120,8 @@ fn get_applepay_metadata( fn build_apple_pay_session_request( state: &routes::AppState, request: payment_types::ApplepaySessionRequest, - apple_pay_merchant_cert: masking::Secret, - apple_pay_merchant_cert_key: masking::Secret, + apple_pay_merchant_cert: String, + apple_pay_merchant_cert_key: String, ) -> RouterResult { let mut url = state.conf.connectors.applepay.base_url.to_owned(); url.push_str("paymentservices/paymentSession"); @@ -159,7 +168,6 @@ async fn create_applepay_session_token( apple_pay_session_request, apple_pay_merchant_cert, apple_pay_merchant_cert_key, - merchant_business_country, ) = match apple_pay_metadata { payment_types::ApplepaySessionTokenMetadata::ApplePayCombined( apple_pay_combined_metadata, @@ -176,8 +184,6 @@ async fn create_applepay_session_token( .clone() .expose(); - let merchant_business_country = session_token_data.merchant_business_country; - let apple_pay_session_request = get_session_request_for_simplified_apple_pay( merchant_identifier, session_token_data, @@ -188,21 +194,22 @@ async fn create_applepay_session_token( .applepay_decrypt_keys .get_inner() .apple_pay_merchant_cert - .clone(); + .clone() + .expose(); let apple_pay_merchant_cert_key = state .conf .applepay_decrypt_keys .get_inner() .apple_pay_merchant_cert_key - .clone(); + .clone() + .expose(); ( payment_request_data, apple_pay_session_request, apple_pay_merchant_cert, apple_pay_merchant_cert_key, - merchant_business_country, ) } payment_types::ApplePayCombinedMetadata::Manual { @@ -211,15 +218,11 @@ async fn create_applepay_session_token( } => { let apple_pay_session_request = get_session_request_for_manual_apple_pay(session_token_data.clone()); - - let merchant_business_country = session_token_data.merchant_business_country; - ( payment_request_data, apple_pay_session_request, session_token_data.certificate.clone(), session_token_data.certificate_keys, - merchant_business_country, ) } }, @@ -227,16 +230,11 @@ async fn create_applepay_session_token( let apple_pay_session_request = get_session_request_for_manual_apple_pay( apple_pay_metadata.session_token_data.clone(), ); - - let merchant_business_country = apple_pay_metadata - .session_token_data - .merchant_business_country; ( apple_pay_metadata.payment_request_data, apple_pay_session_request, apple_pay_metadata.session_token_data.certificate.clone(), apple_pay_metadata.session_token_data.certificate_keys, - merchant_business_country, ) } }; @@ -253,7 +251,6 @@ async fn create_applepay_session_token( payment_request_data, router_data.request.to_owned(), apple_pay_session_request.merchant_identifier.as_str(), - merchant_business_country, )?; let applepay_session_request = build_apple_pay_session_request( @@ -353,14 +350,9 @@ fn get_apple_pay_payment_request( payment_request_data: payment_types::PaymentRequestMetadata, session_data: types::PaymentsSessionData, merchant_identifier: &str, - merchant_business_country: Option, ) -> RouterResult { let applepay_payment_request = payment_types::ApplePayPaymentRequest { - country_code: merchant_business_country.or(session_data.country).ok_or( - errors::ApiErrorResponse::MissingRequiredField { - field_name: "country_code", - }, - )?, + country_code: session_data.country, currency_code: session_data.currency, total: amount_info, merchant_capabilities: Some(payment_request_data.merchant_capabilities), @@ -509,6 +501,7 @@ impl types::PaymentsSessionRouterData { &'b self, state: &'a routes::AppState, connector: &api::ConnectorData, + _customer: &Option, _confirm: Option, call_connector_action: payments::CallConnectorAction, ) -> RouterResult { diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs index 59f7ee17551..0d663df2980 100644 --- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs +++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs @@ -1,10 +1,14 @@ +use api_models::enums::{PaymentMethod, PaymentMethodType}; use async_trait::async_trait; +use error_stack::ResultExt; use super::{ConstructFlowSpecificData, Feature}; use crate::{ + configs::settings, core::{ - errors::{self, ConnectorErrorExt, RouterResult}, + errors::{self, ConnectorErrorExt, RouterResult, StorageErrorExt}, mandate, + payment_methods::cards, payments::{ self, access_token, customers, helpers, tokenization, transformers, PaymentData, }, @@ -53,26 +57,72 @@ impl Feature for types::Setup self, state: &AppState, connector: &api::ConnectorData, + maybe_customer: &Option, call_connector_action: payments::CallConnectorAction, + merchant_account: &domain::MerchantAccount, connector_request: Option, + key_store: &domain::MerchantKeyStore, ) -> RouterResult { - let connector_integration: services::BoxedConnectorIntegration< - '_, - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > = connector.connector.get_connector_integration(); + if let Some(mandate_id) = self + .request + .setup_mandate_details + .as_ref() + .and_then(|mandate_data| mandate_data.update_mandate_id.clone()) + { + Box::pin(self.update_mandate_flow( + state, + merchant_account, + mandate_id, + connector, + key_store, + call_connector_action, + &state.conf.mandates.update_mandate_supported, + connector_request, + maybe_customer, + )) + .await + } else { + let connector_integration: services::BoxedConnectorIntegration< + '_, + api::SetupMandate, + types::SetupMandateRequestData, + types::PaymentsResponseData, + > = connector.connector.get_connector_integration(); - let resp = services::execute_connector_processing_step( - state, - connector_integration, - &self, - call_connector_action.clone(), - connector_request, - ) - .await - .to_setup_mandate_failed_response()?; - Ok(resp) + let mut resp = services::execute_connector_processing_step( + state, + connector_integration, + &self, + call_connector_action.clone(), + connector_request, + ) + .await + .to_setup_mandate_failed_response()?; + + let (pm_id, payment_method_status) = Box::pin(tokenization::save_payment_method( + state, + connector, + resp.to_owned(), + maybe_customer, + merchant_account, + self.request.payment_method_type, + key_store, + resp.request.amount, + Some(resp.request.currency), + )) + .await?; + + resp.payment_method_id = pm_id.clone(); + resp.payment_method_status = payment_method_status; + mandate::mandate_procedure( + state, + resp, + maybe_customer, + pm_id, + connector.merchant_connector_id.clone(), + ) + .await + } } async fn add_access_token<'a>( @@ -156,6 +206,212 @@ impl TryFrom for types::ConnectorCustomerData { } } +#[allow(clippy::too_many_arguments)] +impl types::SetupMandateRouterData { + pub async fn decide_flow<'a, 'b>( + &'b self, + state: &'a AppState, + connector: &api::ConnectorData, + maybe_customer: &Option, + confirm: Option, + call_connector_action: payments::CallConnectorAction, + merchant_account: &domain::MerchantAccount, + key_store: &domain::MerchantKeyStore, + ) -> RouterResult { + match confirm { + Some(true) => { + let connector_integration: services::BoxedConnectorIntegration< + '_, + api::SetupMandate, + types::SetupMandateRequestData, + types::PaymentsResponseData, + > = connector.connector.get_connector_integration(); + let mut resp = services::execute_connector_processing_step( + state, + connector_integration, + self, + call_connector_action, + None, + ) + .await + .to_setup_mandate_failed_response()?; + + let payment_method_type = self.request.payment_method_type; + + let (pm_id, payment_method_status) = Box::pin(tokenization::save_payment_method( + state, + connector, + resp.to_owned(), + maybe_customer, + merchant_account, + payment_method_type, + key_store, + resp.request.amount, + Some(resp.request.currency), + )) + .await?; + + resp.payment_method_id = pm_id.clone(); + resp.payment_method_status = payment_method_status; + + Ok(mandate::mandate_procedure( + state, + resp, + maybe_customer, + pm_id, + connector.merchant_connector_id.clone(), + ) + .await?) + } + _ => Ok(self.clone()), + } + } + + async fn update_mandate_flow( + self, + state: &AppState, + merchant_account: &domain::MerchantAccount, + mandate_id: String, + connector: &api::ConnectorData, + key_store: &domain::MerchantKeyStore, + call_connector_action: payments::CallConnectorAction, + supported_connectors_for_update_mandate: &settings::SupportedPaymentMethodsForMandate, + connector_request: Option, + maybe_customer: &Option, + ) -> RouterResult { + let payment_method_type = self.request.payment_method_type; + + let payment_method = self.request.payment_method_data.get_payment_method(); + let supported_connectors_config = payment_method.zip(payment_method_type).map_or_else( + || { + if payment_method == Some(PaymentMethod::Card) { + cards::filter_pm_based_on_update_mandate_support_for_connector( + supported_connectors_for_update_mandate, + &PaymentMethod::Card, + &PaymentMethodType::Credit, + connector.connector_name, + ) && cards::filter_pm_based_on_update_mandate_support_for_connector( + supported_connectors_for_update_mandate, + &PaymentMethod::Card, + &PaymentMethodType::Debit, + connector.connector_name, + ) + } else { + false + } + }, + |(pm, pmt)| { + cards::filter_pm_based_on_update_mandate_support_for_connector( + supported_connectors_for_update_mandate, + &pm, + &pmt, + connector.connector_name, + ) + }, + ); + if supported_connectors_config { + let connector_integration: services::BoxedConnectorIntegration< + '_, + api::SetupMandate, + types::SetupMandateRequestData, + types::PaymentsResponseData, + > = connector.connector.get_connector_integration(); + + let resp = services::execute_connector_processing_step( + state, + connector_integration, + &self, + call_connector_action.clone(), + connector_request, + ) + .await + .to_setup_mandate_failed_response()?; + let pm_id = Box::pin(tokenization::save_payment_method( + state, + connector, + resp.to_owned(), + maybe_customer, + merchant_account, + self.request.payment_method_type, + key_store, + resp.request.amount, + Some(resp.request.currency), + )) + .await? + .0; + let mandate = state + .store + .find_mandate_by_merchant_id_mandate_id(&merchant_account.merchant_id, &mandate_id) + .await + .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?; + + let profile_id = mandate::helpers::get_profile_id_for_mandate( + state, + merchant_account, + mandate.clone(), + ) + .await?; + match resp.response { + Ok(types::PaymentsResponseData::TransactionResponse { .. }) => { + let connector_integration: services::BoxedConnectorIntegration< + '_, + types::api::MandateRevoke, + types::MandateRevokeRequestData, + types::MandateRevokeResponseData, + > = connector.connector.get_connector_integration(); + let merchant_connector_account = helpers::get_merchant_connector_account( + state, + &merchant_account.merchant_id, + None, + key_store, + &profile_id, + &mandate.connector, + mandate.merchant_connector_id.as_ref(), + ) + .await?; + + let router_data = mandate::utils::construct_mandate_revoke_router_data( + merchant_connector_account, + merchant_account, + mandate.clone(), + ) + .await?; + + let _response = services::execute_connector_processing_step( + state, + connector_integration, + &router_data, + call_connector_action, + None, + ) + .await + .change_context(errors::ApiErrorResponse::InternalServerError)?; + // TODO:Add the revoke mandate task to process tracker + mandate::update_mandate_procedure( + state, + resp, + mandate, + &merchant_account.merchant_id, + pm_id, + ) + .await + } + Ok(_) => Err(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Unexpected response received")?, + Err(_) => Ok(resp), + } + } else { + Err(errors::ApiErrorResponse::PreconditionFailed { + message: format!( + "Update Mandate flow not implemented for the connector {:?}", + connector.connector_name + ), + } + .into()) + } + } +} + impl mandate::MandateBehaviour for types::SetupMandateRequestData { fn get_amount(&self) -> i64 { 0 @@ -173,13 +429,11 @@ impl mandate::MandateBehaviour for types::SetupMandateRequestData { self.mandate_id = new_mandate_id; } - fn get_payment_method_data(&self) -> domain::payments::PaymentMethodData { + fn get_payment_method_data(&self) -> api_models::payments::PaymentMethodData { self.payment_method_data.clone() } - fn get_setup_mandate_details( - &self, - ) -> Option<&hyperswitch_domain_models::mandates::MandateData> { + fn get_setup_mandate_details(&self) -> Option<&data_models::mandates::MandateData> { self.setup_mandate_details.as_ref() } fn get_customer_acceptance(&self) -> Option { diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index d2a2896de8c..0f80b6a52ea 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, str::FromStr}; +use std::borrow::Cow; use api_models::{ mandates::RecurringDetails, @@ -9,13 +9,13 @@ use common_utils::{ ext_traits::{AsyncExt, ByteSliceExt, Encode, ValueExt}, fp_utils, generate_id, pii, }; -use diesel_models::enums; -// TODO : Evaluate all the helper functions () -use error_stack::{report, ResultExt}; -use hyperswitch_domain_models::{ +use data_models::{ mandates::MandateData, payments::{payment_attempt::PaymentAttempt, PaymentIntent}, }; +use diesel_models::enums; +// TODO : Evaluate all the helper functions () +use error_stack::{report, ResultExt}; use josekit::jwe; use masking::{ExposeInterface, PeekInterface}; use openssl::{ @@ -52,9 +52,7 @@ use crate::{ self, types::{self, AsyncLift}, }, - storage::{ - self, enums as storage_enums, ephemeral_key, CardTokenData, CustomerUpdate::Update, - }, + storage::{self, enums as storage_enums, ephemeral_key, CustomerUpdate::Update}, transformers::{ForeignFrom, ForeignTryFrom}, ErrorResponse, MandateReference, RouterData, }, @@ -66,15 +64,15 @@ use crate::{ }; pub fn create_identity_from_certificate_and_key( - encoded_certificate: masking::Secret, - encoded_certificate_key: masking::Secret, + encoded_certificate: String, + encoded_certificate_key: String, ) -> Result> { let decoded_certificate = BASE64_ENGINE - .decode(encoded_certificate.expose()) + .decode(encoded_certificate) .change_context(errors::ApiClientError::CertificateDecodeFailed)?; let decoded_certificate_key = BASE64_ENGINE - .decode(encoded_certificate_key.expose()) + .decode(encoded_certificate_key) .change_context(errors::ApiClientError::CertificateDecodeFailed)?; let certificate = String::from_utf8(decoded_certificate) @@ -417,7 +415,6 @@ pub async fn get_token_pm_type_mandate_details( mandate_type: Option, merchant_account: &domain::MerchantAccount, merchant_key_store: &domain::MerchantKeyStore, - payment_method_id: Option, ) -> RouterResult { let mandate_data = request.mandate_data.clone().map(MandateData::foreign_from); let ( @@ -433,7 +430,7 @@ pub async fn get_token_pm_type_mandate_details( request.payment_token.to_owned(), request.payment_method, request.payment_method_type, - mandate_data.clone(), + Some(mandate_data.clone().get_required_value("mandate_data")?), None, None, None, @@ -466,27 +463,15 @@ pub async fn get_token_pm_type_mandate_details( RecurringDetails::PaymentMethodId(payment_method_id) => { let payment_method_info = state .store - .find_payment_method(payment_method_id, merchant_account.storage_scheme) + .find_payment_method(payment_method_id) .await .to_not_found_response( errors::ApiErrorResponse::PaymentMethodNotFound, )?; - let customer_id = request - .customer_id - .clone() - .get_required_value("customer_id")?; - - verify_mandate_details_for_recurring_payments( - &payment_method_info.merchant_id, - &merchant_account.merchant_id, - &payment_method_info.customer_id, - &customer_id, - )?; - ( None, - payment_method_info.payment_method, + Some(payment_method_info.payment_method), payment_method_info.payment_method_type, None, None, @@ -496,61 +481,41 @@ pub async fn get_token_pm_type_mandate_details( } }, None => { - if let Some(mandate_id) = request.mandate_id.clone() { - let mandate_generic_data = get_token_for_recurring_mandate( - state, - request, - merchant_account, - merchant_key_store, - mandate_id, - ) - .await?; - ( - mandate_generic_data.token, - mandate_generic_data.payment_method, - mandate_generic_data - .payment_method_type - .or(request.payment_method_type), - None, - mandate_generic_data.recurring_mandate_payment_data, - mandate_generic_data.mandate_connector, - None, - ) - } else { - ( - request.payment_token.to_owned(), - request.payment_method, - request.payment_method_type, - None, - None, - None, - None, - ) - } + let mandate_id = request + .mandate_id + .clone() + .get_required_value("mandate_id")?; + let mandate_generic_data = get_token_for_recurring_mandate( + state, + request, + merchant_account, + merchant_key_store, + mandate_id, + ) + .await?; + ( + mandate_generic_data.token, + mandate_generic_data.payment_method, + mandate_generic_data + .payment_method_type + .or(request.payment_method_type), + None, + mandate_generic_data.recurring_mandate_payment_data, + mandate_generic_data.mandate_connector, + None, + ) } } } - None => { - let payment_method_info = payment_method_id - .async_map(|payment_method_id| async move { - state - .store - .find_payment_method(&payment_method_id, merchant_account.storage_scheme) - .await - .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound) - }) - .await - .transpose()?; - ( - request.payment_token.to_owned(), - request.payment_method, - request.payment_method_type, - mandate_data, - None, - None, - payment_method_info, - ) - } + None => ( + request.payment_token.to_owned(), + request.payment_method, + request.payment_method_type, + mandate_data, + None, + None, + None, + ), }; Ok(MandateGenericData { token: payment_token, @@ -573,11 +538,7 @@ pub async fn get_token_for_recurring_mandate( let db = &*state.store; let mandate = db - .find_mandate_by_merchant_id_mandate_id( - &merchant_account.merchant_id, - mandate_id.as_str(), - merchant_account.storage_scheme, - ) + .find_mandate_by_merchant_id_mandate_id(&merchant_account.merchant_id, mandate_id.as_str()) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?; @@ -624,7 +585,7 @@ pub async fn get_token_for_recurring_mandate( )?; let payment_method = db - .find_payment_method(payment_method_id.as_str(), merchant_account.storage_scheme) + .find_payment_method(payment_method_id.as_str()) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; @@ -635,7 +596,7 @@ pub async fn get_token_for_recurring_mandate( merchant_connector_id: mandate.merchant_connector_id, }; - if let Some(diesel_models::enums::PaymentMethod::Card) = payment_method.payment_method { + if let diesel_models::enums::PaymentMethod::Card = payment_method.payment_method { if state.conf.locker.locker_enabled { let _ = cards::get_lookup_key_from_locker( state, @@ -648,14 +609,11 @@ pub async fn get_token_for_recurring_mandate( if let Some(payment_method_from_request) = req.payment_method { let pm: storage_enums::PaymentMethod = payment_method_from_request; - if payment_method - .payment_method - .is_some_and(|payment_method| payment_method != pm) - { + if pm != payment_method.payment_method { Err(report!(errors::ApiErrorResponse::PreconditionFailed { message: "payment method in request does not match previously provided payment \ - method information" + method information" .into() }))? } @@ -663,7 +621,7 @@ pub async fn get_token_for_recurring_mandate( Ok(MandateGenericData { token: Some(token), - payment_method: payment_method.payment_method, + payment_method: Some(payment_method.payment_method), recurring_mandate_payment_data: Some(payments::RecurringMandatePaymentData { payment_method_type, original_payment_authorized_amount, @@ -677,7 +635,7 @@ pub async fn get_token_for_recurring_mandate( } else { Ok(MandateGenericData { token: None, - payment_method: payment_method.payment_method, + payment_method: Some(payment_method.payment_method), recurring_mandate_payment_data: Some(payments::RecurringMandatePaymentData { payment_method_type, original_payment_authorized_amount, @@ -819,57 +777,47 @@ pub fn validate_card_data( }, )?; - validate_card_expiry(&card.card_exp_month, &card.card_exp_year)?; - } - Ok(()) -} - -#[instrument(skip_all)] -pub fn validate_card_expiry( - card_exp_month: &masking::Secret, - card_exp_year: &masking::Secret, -) -> CustomResult<(), errors::ApiErrorResponse> { - let exp_month = card_exp_month - .peek() - .to_string() - .parse::() - .change_context(errors::ApiErrorResponse::InvalidDataValue { - field_name: "card_exp_month", - })?; - let month = ::cards::CardExpirationMonth::try_from(exp_month).change_context( - errors::ApiErrorResponse::PreconditionFailed { - message: "Invalid Expiry Month".to_string(), - }, - )?; - - let mut year_str = card_exp_year.peek().to_string(); - if year_str.len() == 2 { - year_str = format!("20{}", year_str); - } - let exp_year = - year_str - .parse::() + let exp_month = card + .card_exp_month + .peek() + .to_string() + .parse::() .change_context(errors::ApiErrorResponse::InvalidDataValue { - field_name: "card_exp_year", + field_name: "card_exp_month", })?; - let year = ::cards::CardExpirationYear::try_from(exp_year).change_context( - errors::ApiErrorResponse::PreconditionFailed { - message: "Invalid Expiry Year".to_string(), - }, - )?; + let month = ::cards::CardExpirationMonth::try_from(exp_month).change_context( + errors::ApiErrorResponse::PreconditionFailed { + message: "Invalid Expiry Month".to_string(), + }, + )?; + let mut year_str = card.card_exp_year.peek().to_string(); + if year_str.len() == 2 { + year_str = format!("20{}", year_str); + } + let exp_year = + year_str + .parse::() + .change_context(errors::ApiErrorResponse::InvalidDataValue { + field_name: "card_exp_year", + })?; + let year = ::cards::CardExpirationYear::try_from(exp_year).change_context( + errors::ApiErrorResponse::PreconditionFailed { + message: "Invalid Expiry Year".to_string(), + }, + )?; - let card_expiration = ::cards::CardExpiration { month, year }; - let is_expired = card_expiration.is_expired().change_context( - errors::ApiErrorResponse::PreconditionFailed { - message: "Invalid card data".to_string(), - }, - )?; - if is_expired { - Err(report!(errors::ApiErrorResponse::PreconditionFailed { - message: "Card Expired".to_string() - }))? + let card_expiration = ::cards::CardExpiration { month, year }; + let is_expired = card_expiration.is_expired().change_context( + errors::ApiErrorResponse::PreconditionFailed { + message: "Invalid card data".to_string(), + }, + )?; + if is_expired { + Err(report!(errors::ApiErrorResponse::PreconditionFailed { + message: "Card Expired".to_string() + }))? + } } - Ok(()) } @@ -921,7 +869,6 @@ pub fn validate_mandate( pub fn validate_recurring_details_and_token( recurring_details: &Option, payment_token: &Option, - mandate_id: &Option, ) -> CustomResult<(), errors::ApiErrorResponse> { utils::when( recurring_details.is_some() && payment_token.is_some(), @@ -933,12 +880,6 @@ pub fn validate_recurring_details_and_token( }, )?; - utils::when(recurring_details.is_some() && mandate_id.is_some(), || { - Err(report!(errors::ApiErrorResponse::PreconditionFailed { - message: "Expected one out of recurring_details and mandate_id but got both".into() - })) - })?; - Ok(()) } @@ -1139,27 +1080,9 @@ pub fn verify_mandate_details( ) } -pub fn verify_mandate_details_for_recurring_payments( - mandate_merchant_id: &str, - merchant_id: &str, - mandate_customer_id: &str, - customer_id: &str, -) -> RouterResult<()> { - if mandate_merchant_id != merchant_id { - Err(report!(errors::ApiErrorResponse::MandateNotFound))? - } - if mandate_customer_id != customer_id { - Err(report!(errors::ApiErrorResponse::PreconditionFailed { - message: "customer_id must match mandate customer_id".into() - }))? - } - - Ok(()) -} - #[instrument(skip_all)] pub fn payment_attempt_status_fsm( - payment_method_data: Option<&api::payments::PaymentMethodData>, + payment_method_data: &Option, confirm: Option, ) -> storage_enums::AttemptStatus { match payment_method_data { @@ -1172,7 +1095,7 @@ pub fn payment_attempt_status_fsm( } pub fn payment_intent_status_fsm( - payment_method_data: Option<&api::PaymentMethodData>, + payment_method_data: &Option, confirm: Option, ) -> storage_enums::IntentStatus { match payment_method_data { @@ -1244,29 +1167,29 @@ where #[instrument(skip_all)] pub(crate) async fn get_payment_method_create_request( - payment_method_data: Option<&domain::PaymentMethodData>, + payment_method_data: Option<&api::PaymentMethodData>, payment_method: Option, payment_method_type: Option, - customer_id: &Option, - billing_name: Option>, + customer: &domain::Customer, ) -> RouterResult { match payment_method_data { Some(pm_data) => match payment_method { Some(payment_method) => match pm_data { - domain::PaymentMethodData::Card(card) => { + api::PaymentMethodData::Card(card) => { let card_detail = api::CardDetail { card_number: card.card_number.clone(), card_exp_month: card.card_exp_month.clone(), card_exp_year: card.card_exp_year.clone(), - card_holder_name: billing_name, + card_holder_name: card.card_holder_name.clone(), nick_name: card.nick_name.clone(), card_issuing_country: card.card_issuing_country.clone(), card_network: card.card_network.clone(), card_issuer: card.card_issuer.clone(), card_type: card.card_type.clone(), }; + let customer_id = customer.customer_id.clone(); let payment_method_request = api::PaymentMethodCreate { - payment_method: Some(payment_method), + payment_method, payment_method_type, payment_method_issuer: card.card_issuer.clone(), payment_method_issuer_code: None, @@ -1276,19 +1199,17 @@ pub(crate) async fn get_payment_method_create_request( wallet: None, card: Some(card_detail), metadata: None, - customer_id: customer_id.clone(), + customer_id: Some(customer_id), card_network: card .card_network .as_ref() .map(|card_network| card_network.to_string()), - client_secret: None, - payment_method_data: None, }; Ok(payment_method_request) } _ => { let payment_method_request = api::PaymentMethodCreate { - payment_method: Some(payment_method), + payment_method, payment_method_type, payment_method_issuer: None, payment_method_issuer_code: None, @@ -1298,10 +1219,8 @@ pub(crate) async fn get_payment_method_create_request( wallet: None, card: None, metadata: None, - customer_id: customer_id.clone(), + customer_id: Some(customer.customer_id.to_owned()), card_network: None, - client_secret: None, - payment_method_data: None, }; Ok(payment_method_request) @@ -1325,7 +1244,6 @@ pub async fn get_customer_from_details( merchant_id: &str, payment_data: &mut PaymentData, merchant_key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult, errors::StorageError> { match customer_id { None => Ok(None), @@ -1335,7 +1253,6 @@ pub async fn get_customer_from_details( &c_id, merchant_id, merchant_key_store, - storage_scheme, ) .await?; payment_data.email = payment_data.email.clone().or_else(|| { @@ -1474,7 +1391,6 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>( req: Option, merchant_id: &str, key_store: &domain::MerchantKeyStore, - storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> CustomResult<(BoxedOperation<'a, F, R, Ctx>, Option), errors::StorageError> { let request_customer_details = req .get_required_value("customer") @@ -1491,7 +1407,6 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>( &customer_id, merchant_id, key_store, - storage_scheme, ) .await?; @@ -1543,10 +1458,8 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>( db.update_customer_by_customer_id_merchant_id( customer_id, merchant_id.to_string(), - c, customer_update, key_store, - storage_scheme, ) .await } else { @@ -1597,8 +1510,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>( .change_context(errors::StorageError::SerializationFailed) .attach_printable("Failed while encrypting Customer while insert")?; metrics::CUSTOMER_CREATED.add(&metrics::CONTEXT, 1, &[]); - db.insert_customer(new_customer, key_store, storage_scheme) - .await + db.insert_customer(new_customer, key_store).await } }) } @@ -1609,7 +1521,6 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>( customer_id, merchant_id, key_store, - storage_scheme, ) .await? .map(Ok), @@ -1739,8 +1650,6 @@ pub async fn retrieve_card_with_permanent_token( payment_method_id: &str, payment_intent: &PaymentIntent, card_token_data: Option<&CardToken>, - _merchant_key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, ) -> RouterResult { let customer_id = payment_intent .customer_id @@ -1779,36 +1688,27 @@ pub async fn retrieve_card_with_permanent_token( .unwrap_or_default() .card_cvc .unwrap_or_default(), - card_issuer: None, + card_issuer: card.card_brand, nick_name: card.nick_name.map(masking::Secret::new), - card_network: card - .card_brand - .map(|card_brand| enums::CardNetwork::from_str(&card_brand)) - .transpose() - .map_err(|e| { - logger::error!("Failed to parse card network {}", e); - }) - .ok() - .flatten(), + card_network: None, card_type: None, card_issuing_country: None, bank_code: None, }; - cards::update_last_used_at(payment_method_id, state, storage_scheme).await?; + cards::update_last_used_at(payment_method_id, state).await?; Ok(api::PaymentMethodData::Card(api_card)) } pub async fn retrieve_payment_method_from_db_with_token_data( state: &AppState, token_data: &storage::PaymentTokenData, - storage_scheme: storage::enums::MerchantStorageScheme, ) -> RouterResult> { match token_data { storage::PaymentTokenData::PermanentCard(data) => { if let Some(ref payment_method_id) = data.payment_method_id { state .store - .find_payment_method(payment_method_id, storage_scheme) + .find_payment_method(payment_method_id) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound) .attach_printable("error retrieving payment method from DB") @@ -1820,7 +1720,7 @@ pub async fn retrieve_payment_method_from_db_with_token_data( storage::PaymentTokenData::WalletToken(data) => state .store - .find_payment_method(&data.payment_method_id, storage_scheme) + .find_payment_method(&data.payment_method_id) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound) .attach_printable("error retrieveing payment method from DB") @@ -1889,7 +1789,6 @@ pub async fn make_pm_data<'a, F: Clone, R, Ctx: PaymentMethodRetrieve>( payment_data: &mut PaymentData, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, - storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> RouterResult<( BoxedOperation<'a, F, R, Ctx>, Option, @@ -1912,25 +1811,6 @@ pub async fn make_pm_data<'a, F: Clone, R, Ctx: PaymentMethodRetrieve>( } } - if payment_data.token_data.is_none() { - if let Some(payment_method_info) = &payment_data.payment_method_info { - if payment_method_info.payment_method == Some(storage_enums::PaymentMethod::Card) { - payment_data.token_data = - Some(storage::PaymentTokenData::PermanentCard(CardTokenData { - payment_method_id: Some(payment_method_info.payment_method_id.clone()), - locker_id: payment_method_info - .locker_id - .clone() - .or(Some(payment_method_info.payment_method_id.clone())), - token: payment_method_info - .locker_id - .clone() - .unwrap_or(payment_method_info.payment_method_id.clone()), - })); - } - } - } - // TODO: Handle case where payment method and token both are present in request properly. let (payment_method, pm_id) = match (request, payment_data.token_data.as_ref()) { (_, Some(hyperswitch_token)) => { @@ -1941,7 +1821,6 @@ pub async fn make_pm_data<'a, F: Clone, R, Ctx: PaymentMethodRetrieve>( &payment_data.payment_intent, card_token_data.as_ref(), customer, - storage_scheme, ) .await; @@ -2129,14 +2008,8 @@ pub(crate) fn validate_amount_to_capture( pub(crate) fn validate_payment_method_fields_present( req: &api::PaymentsRequest, ) -> RouterResult<()> { - let payment_method_data = - req.payment_method_data - .as_ref() - .and_then(|request_payment_method_data| { - request_payment_method_data.payment_method_data.as_ref() - }); utils::when( - req.payment_method.is_none() && payment_method_data.is_some(), + req.payment_method.is_none() && req.payment_method_data.is_some(), || { Err(errors::ApiErrorResponse::MissingRequiredField { field_name: "payment_method", @@ -2158,7 +2031,7 @@ pub(crate) fn validate_payment_method_fields_present( utils::when( req.payment_method.is_some() - && payment_method_data.is_none() + && req.payment_method_data.is_none() && req.payment_token.is_none() && req.recurring_details.is_none(), || { @@ -2200,14 +2073,14 @@ pub(crate) fn validate_payment_method_fields_present( }; utils::when( - req.payment_method.is_some() && payment_method_data.is_some(), + req.payment_method.is_some() && req.payment_method_data.is_some(), || { - payment_method_data - .cloned() - .map_or(Ok(()), |payment_method_data| { + req.payment_method_data + .clone() + .map_or(Ok(()), |req_payment_method_data| { req.payment_method.map_or(Ok(()), |req_payment_method| { validate_payment_method_and_payment_method_data( - payment_method_data, + req_payment_method_data.payment_method_data, req_payment_method, ) }) @@ -2294,7 +2167,6 @@ pub fn validate_payment_method_type_against_payment_method( | api_enums::PaymentMethodType::CimbVa | api_enums::PaymentMethodType::DanamonVa | api_enums::PaymentMethodType::MandiriVa - | api_enums::PaymentMethodType::LocalBankTransfer ), api_enums::PaymentMethod::BankDebit => matches!( payment_method_type, @@ -2631,16 +2503,16 @@ pub fn generate_mandate( payment_id: String, connector: String, setup_mandate_details: Option, - customer_id: &Option, + customer: &Option, payment_method_id: String, connector_mandate_id: Option, network_txn_id: Option, - payment_method_data_option: Option, + payment_method_data_option: Option, mandate_reference: Option, merchant_connector_id: Option, ) -> CustomResult, errors::ApiErrorResponse> { - match (setup_mandate_details, customer_id) { - (Some(data), Some(cus_id)) => { + match (setup_mandate_details, customer) { + (Some(data), Some(cus)) => { let mandate_id = utils::generate_id(consts::ID_LENGTH, "man"); // The construction of the mandate new must be visible @@ -2651,7 +2523,7 @@ pub fn generate_mandate( .get_required_value("customer_acceptance")?; new_mandate .set_mandate_id(mandate_id) - .set_customer_id(cus_id.clone()) + .set_customer_id(cus.customer_id.clone()) .set_merchant_id(merchant_id) .set_original_payment_id(Some(payment_id)) .set_payment_method_id(payment_method_id) @@ -2678,28 +2550,24 @@ pub fn generate_mandate( Ok(Some( match data.mandate_type.get_required_value("mandate_type")? { - hyperswitch_domain_models::mandates::MandateDataType::SingleUse(data) => { - new_mandate + data_models::mandates::MandateDataType::SingleUse(data) => new_mandate + .set_mandate_amount(Some(data.amount)) + .set_mandate_currency(Some(data.currency)) + .set_mandate_type(storage_enums::MandateType::SingleUse) + .to_owned(), + + data_models::mandates::MandateDataType::MultiUse(op_data) => match op_data { + Some(data) => new_mandate .set_mandate_amount(Some(data.amount)) .set_mandate_currency(Some(data.currency)) - .set_mandate_type(storage_enums::MandateType::SingleUse) - .to_owned() - } - - hyperswitch_domain_models::mandates::MandateDataType::MultiUse(op_data) => { - match op_data { - Some(data) => new_mandate - .set_mandate_amount(Some(data.amount)) - .set_mandate_currency(Some(data.currency)) - .set_start_date(data.start_date) - .set_end_date(data.end_date), - // .set_metadata(data.metadata), - // we are storing PaymentMethodData in metadata of mandate - None => &mut new_mandate, - } - .set_mandate_type(storage_enums::MandateType::MultiUse) - .to_owned() + .set_start_date(data.start_date) + .set_end_date(data.end_date), + // .set_metadata(data.metadata), + // we are storing PaymentMethodData in metadata of mandate + None => &mut new_mandate, } + .set_mandate_type(storage_enums::MandateType::MultiUse) + .to_owned(), }, )) } @@ -2921,9 +2789,7 @@ mod tests { fingerprint_id: None, off_session: None, client_secret: Some("1".to_string()), - active_attempt: hyperswitch_domain_models::RemoteStorageObject::ForeignID( - "nopes".to_string(), - ), + active_attempt: data_models::RemoteStorageObject::ForeignID("nopes".to_string()), business_country: None, business_label: None, order_details: None, @@ -2979,9 +2845,7 @@ mod tests { setup_future_usage: None, off_session: None, client_secret: Some("1".to_string()), - active_attempt: hyperswitch_domain_models::RemoteStorageObject::ForeignID( - "nopes".to_string(), - ), + active_attempt: data_models::RemoteStorageObject::ForeignID("nopes".to_string()), business_country: None, business_label: None, order_details: None, @@ -3036,9 +2900,7 @@ mod tests { off_session: None, client_secret: None, fingerprint_id: None, - active_attempt: hyperswitch_domain_models::RemoteStorageObject::ForeignID( - "nopes".to_string(), - ), + active_attempt: data_models::RemoteStorageObject::ForeignID("nopes".to_string()), business_country: None, business_label: None, order_details: None, @@ -3260,6 +3122,7 @@ pub fn router_data_type_conversion( description: router_data.description, payment_id: router_data.payment_id, payment_method: router_data.payment_method, + payment_method_id: router_data.payment_method_id, return_url: router_data.return_url, status: router_data.status, attempt_id: router_data.attempt_id, @@ -3415,7 +3278,7 @@ impl AttemptType { // In case if fields are not overridden by the request then they contain the same data that was in the previous attempt provided it is populated in this function. #[inline(always)] fn make_new_payment_attempt( - payment_method_data: Option<&api_models::payments::PaymentMethodData>, + payment_method_data: &Option, old_payment_attempt: PaymentAttempt, new_attempt_count: i16, storage_scheme: enums::MerchantStorageScheme, @@ -3513,11 +3376,7 @@ impl AttemptType { let new_payment_attempt = db .insert_payment_attempt( Self::make_new_payment_attempt( - request.payment_method_data.as_ref().and_then( - |request_payment_method_data| { - request_payment_method_data.payment_method_data.as_ref() - }, - ), + &request.payment_method_data, fetched_payment_attempt, new_attempt_count, storage_scheme, @@ -3534,11 +3393,7 @@ impl AttemptType { fetched_payment_intent, storage::PaymentIntentUpdate::StatusAndAttemptUpdate { status: payment_intent_status_fsm( - request.payment_method_data.as_ref().and_then( - |request_payment_method_data| { - request_payment_method_data.payment_method_data.as_ref() - }, - ), + &request.payment_method_data, Some(true), ), active_attempt_id: new_payment_attempt.attempt_id.clone(), @@ -3649,23 +3504,11 @@ mod test { pub async fn get_additional_payment_data( pm_data: &api_models::payments::PaymentMethodData, db: &dyn StorageInterface, - profile_id: &str, ) -> api_models::payments::AdditionalPaymentData { match pm_data { api_models::payments::PaymentMethodData::Card(card_data) => { let card_isin = Some(card_data.card_number.clone().get_card_isin()); - let enable_extended_bin =db - .find_config_by_key_unwrap_or( - format!("{}_enable_extended_card_bin", profile_id).as_str(), - Some("false".to_string())) - .await.map_err(|err| services::logger::error!(message="Failed to fetch the config", extended_card_bin_error=?err)).ok(); - - let card_extended_bin = match enable_extended_bin { - Some(config) if config.config == "true" => { - Some(card_data.card_number.clone().get_card_extended_bin()) - } - _ => None, - }; + let card_extended_bin = Some(card_data.card_number.clone().get_card_extended_bin()); let last4 = Some(card_data.card_number.clone().get_last4()); if card_data.card_issuer.is_some() && card_data.card_network.is_some() @@ -3837,7 +3680,7 @@ pub struct ApplePayHeader { impl ApplePayData { pub fn token_json( - wallet_data: domain::WalletData, + wallet_data: api_models::payments::WalletData, ) -> CustomResult { let json_wallet_data: Self = connector::utils::WalletData::get_wallet_token_as_json( &wallet_data, @@ -4221,7 +4064,6 @@ pub async fn get_payment_method_details_from_payment_token( payment_attempt: &PaymentAttempt, payment_intent: &PaymentIntent, key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, ) -> RouterResult> { let hyperswitch_token = if let Some(token) = payment_attempt.payment_token.clone() { let redis_conn = state @@ -4303,8 +4145,6 @@ pub async fn get_payment_method_details_from_payment_token( .unwrap_or(&card_token.token), payment_intent, None, - key_store, - storage_scheme, ) .await .map(|card| Some((card, enums::PaymentMethod::Card))), @@ -4318,8 +4158,6 @@ pub async fn get_payment_method_details_from_payment_token( .unwrap_or(&card_token.token), payment_intent, None, - key_store, - storage_scheme, ) .await .map(|card| Some((card, enums::PaymentMethod::Card))), @@ -4355,7 +4193,3 @@ pub fn validate_mandate_data_and_future_usage( Ok(()) } } - -pub fn get_redis_key_for_extended_card_info(merchant_id: &str, payment_id: &str) -> String { - format!("{merchant_id}_{payment_id}_extended_card_info") -} diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs index c214decb0b4..b9f9618fa6e 100644 --- a/crates/router/src/core/payments/operations.rs +++ b/crates/router/src/core/payments/operations.rs @@ -32,7 +32,7 @@ use crate::{ payment_methods::PaymentMethodRetrieve, }, db::StorageInterface, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ self, @@ -79,6 +79,7 @@ pub trait Operation: Send + std::fmt::D pub struct ValidateResult<'a> { pub merchant_id: &'a str, pub payment_id: api::PaymentIdType, + pub mandate_type: Option, pub storage_scheme: enums::MerchantStorageScheme, pub requeue: bool, } @@ -97,7 +98,6 @@ pub struct GetTrackerResponse<'a, F: Clone, R, Ctx> { pub customer_details: Option, pub payment_data: PaymentData, pub business_profile: storage::business_profile::BusinessProfile, - pub mandate_type: Option, } #[async_trait] @@ -108,6 +108,7 @@ pub trait GetTracker: Send { state: &'a AppState, payment_id: &api::PaymentIdType, request: &R, + mandate_type: Option, merchant_account: &domain::MerchantAccount, mechant_key_store: &domain::MerchantKeyStore, auth_flow: services::AuthFlow, @@ -124,7 +125,6 @@ pub trait Domain: Send + Sync { payment_data: &mut PaymentData, request: Option, merchant_key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult<(BoxedOperation<'a, F, R, Ctx>, Option), errors::StorageError>; #[allow(clippy::too_many_arguments)] @@ -190,16 +190,6 @@ pub trait Domain: Send + Sync { ) -> CustomResult { Ok(false) } - - async fn store_extended_card_info_temporarily<'a>( - &'a self, - _state: &AppState, - _payment_id: &str, - _business_profile: &storage::BusinessProfile, - _payment_method_data: &Option, - ) -> CustomResult<(), errors::ApiErrorResponse> { - Ok(()) - } } #[async_trait] @@ -208,7 +198,6 @@ pub trait UpdateTracker: Send { async fn update_trackers<'b>( &'b self, db: &'b AppState, - req_state: ReqState, payment_data: D, customer: Option, storage_scheme: enums::MerchantStorageScheme, @@ -222,7 +211,7 @@ pub trait UpdateTracker: Send { } #[async_trait] -pub trait PostUpdateTracker: Send { +pub trait PostUpdateTracker: Send { async fn update_tracker<'b>( &'b self, db: &'b AppState, @@ -232,21 +221,7 @@ pub trait PostUpdateTracker: Send { storage_scheme: enums::MerchantStorageScheme, ) -> RouterResult where - F: 'b + Send + Sync; - - async fn save_pm_and_mandate<'b>( - &self, - _state: &AppState, - _resp: &types::RouterData, - _merchant_account: &domain::MerchantAccount, - _key_store: &domain::MerchantKeyStore, - _payment_data: &mut PaymentData, - ) -> CustomResult<(), errors::ApiErrorResponse> - where - F: 'b + Clone + Send + Sync, - { - Ok(()) - } + F: 'b + Send; } #[async_trait] @@ -265,7 +240,6 @@ where payment_data: &mut PaymentData, _request: Option, merchant_key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsRetrieveRequest, Ctx>, @@ -281,7 +255,6 @@ where &merchant_key_store.merchant_id, payment_data, merchant_key_store, - storage_scheme, ) .await?, )) @@ -303,7 +276,7 @@ where &'a self, state: &'a AppState, payment_data: &mut PaymentData, - storage_scheme: enums::MerchantStorageScheme, + _storage_scheme: enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, ) -> RouterResult<( @@ -317,7 +290,6 @@ where payment_data, merchant_key_store, customer, - storage_scheme, ) .await } @@ -349,7 +321,6 @@ where payment_data: &mut PaymentData, _request: Option, merchant_key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsCaptureRequest, Ctx>, @@ -365,7 +336,6 @@ where &merchant_key_store.merchant_id, payment_data, merchant_key_store, - storage_scheme, ) .await?, )) @@ -424,7 +394,6 @@ where payment_data: &mut PaymentData, _request: Option, merchant_key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsCancelRequest, Ctx>, @@ -440,7 +409,6 @@ where &merchant_key_store.merchant_id, payment_data, merchant_key_store, - storage_scheme, ) .await?, )) @@ -500,7 +468,6 @@ where _payment_data: &mut PaymentData, _request: Option, _merchant_key_store: &domain::MerchantKeyStore, - _storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsRejectRequest, Ctx>, diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs index 87943b4cf2b..e25ef7ed4a4 100644 --- a/crates/router/src/core/payments/operations/payment_approve.rs +++ b/crates/router/src/core/payments/operations/payment_approve.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; -use api_models::enums::{AttemptStatus, FrmSuggestion, IntentStatus}; +use api_models::enums::FrmSuggestion; use async_trait::async_trait; use error_stack::ResultExt; use router_derive::PaymentOperation; @@ -13,7 +13,7 @@ use crate::{ payment_methods::PaymentMethodRetrieve, payments::{helpers, operations, PaymentData}, }, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ api::{self, PaymentIdTypeExt}, @@ -38,6 +38,7 @@ impl state: &'a AppState, payment_id: &api::PaymentIdType, _request: &api::PaymentsCaptureRequest, + _mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -178,7 +179,6 @@ impl frm_metadata: None, authentication: None, recurring_details: None, - poll_config: None, }; let get_trackers_response = operations::GetTrackerResponse { @@ -186,7 +186,6 @@ impl customer_details: None, payment_data, business_profile, - mandate_type: None, }; Ok(get_trackers_response) @@ -201,13 +200,12 @@ impl async fn update_trackers<'b>( &'b self, db: &'b AppState, - _req_state: ReqState, mut payment_data: PaymentData, _customer: Option, storage_scheme: storage_enums::MerchantStorageScheme, _updated_customer: Option, _merchant_key_store: &domain::MerchantKeyStore, - frm_suggestion: Option, + _frm_suggestion: Option, _header_payload: api::HeaderPayload, ) -> RouterResult<( BoxedOperation<'b, F, api::PaymentsCaptureRequest, Ctx>, @@ -216,12 +214,7 @@ impl where F: 'b + Send, { - if matches!(frm_suggestion, Some(FrmSuggestion::FrmAuthorizeTransaction)) { - payment_data.payment_intent.status = IntentStatus::RequiresCapture; // In Approve flow, payment which has payment_capture_method "manual" and attempt status as "Unresolved", - payment_data.payment_attempt.status = AttemptStatus::Authorized; // We shouldn't call the connector instead we need to update the payment attempt and payment intent. - } let intent_status_update = storage::PaymentIntentUpdate::ApproveUpdate { - status: payment_data.payment_intent.status, merchant_decision: Some(api_models::enums::MerchantDecision::Approved.to_string()), updated_by: storage_scheme.to_string(), }; @@ -234,17 +227,6 @@ impl ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; - db.store - .update_payment_attempt_with_attempt_id( - payment_data.payment_attempt.clone(), - storage::PaymentAttemptUpdate::StatusUpdate { - status: payment_data.payment_attempt.status, - updated_by: storage_scheme.to_string(), - }, - storage_scheme, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; Ok((Box::new(self), payment_data)) } @@ -277,6 +259,7 @@ impl request.payment_id.clone(), "payment_id", )?), + mandate_type: None, storage_scheme: merchant_account.storage_scheme, requeue: false, }, diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs index 3e531280831..ab5feb5d9b5 100644 --- a/crates/router/src/core/payments/operations/payment_cancel.rs +++ b/crates/router/src/core/payments/operations/payment_cancel.rs @@ -14,8 +14,7 @@ use crate::{ payment_methods::PaymentMethodRetrieve, payments::{helpers, operations, PaymentData}, }, - events::audit_events::{AuditEvent, AuditEventType}, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ self as core_types, @@ -40,6 +39,7 @@ impl state: &'a AppState, payment_id: &api::PaymentIdType, request: &api::PaymentsCancelRequest, + _mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -188,7 +188,6 @@ impl frm_metadata: None, authentication: None, recurring_details: None, - poll_config: None, }; let get_trackers_response = operations::GetTrackerResponse { @@ -196,7 +195,6 @@ impl customer_details: None, payment_data, business_profile, - mandate_type: None, }; Ok(get_trackers_response) @@ -211,7 +209,6 @@ impl async fn update_trackers<'b>( &'b self, db: &'b AppState, - req_state: ReqState, mut payment_data: PaymentData, _customer: Option, storage_scheme: enums::MerchantStorageScheme, @@ -256,20 +253,13 @@ impl payment_data.payment_attempt.clone(), storage::PaymentAttemptUpdate::VoidUpdate { status: attempt_status_update, - cancellation_reason: cancellation_reason.clone(), + cancellation_reason, updated_by: storage_scheme.to_string(), }, storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; - req_state - .event_context - .event(AuditEvent::new(AuditEventType::PaymentCancelled { - cancellation_reason, - })) - .with(payment_data.to_event()) - .emit(); Ok((Box::new(self), payment_data)) } } @@ -291,6 +281,7 @@ impl operations::ValidateResult { merchant_id: &merchant_account.merchant_id, payment_id: api::PaymentIdType::PaymentIntentId(request.payment_id.to_owned()), + mandate_type: None, storage_scheme: merchant_account.storage_scheme, requeue: false, }, diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs index d4c3f0acad7..4445589f42f 100644 --- a/crates/router/src/core/payments/operations/payment_capture.rs +++ b/crates/router/src/core/payments/operations/payment_capture.rs @@ -13,7 +13,7 @@ use crate::{ payment_methods::PaymentMethodRetrieve, payments::{self, helpers, operations, types::MultipleCaptureData}, }, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ self as core_types, @@ -38,6 +38,7 @@ impl state: &'a AppState, payment_id: &api::PaymentIdType, request: &api::PaymentsCaptureRequest, + _mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -231,7 +232,6 @@ impl frm_metadata: None, authentication: None, recurring_details: None, - poll_config: None, }; let get_trackers_response = operations::GetTrackerResponse { @@ -239,7 +239,6 @@ impl customer_details: None, payment_data, business_profile, - mandate_type: None, }; Ok(get_trackers_response) @@ -255,7 +254,6 @@ impl async fn update_trackers<'b>( &'b self, db: &'b AppState, - _req_state: ReqState, mut payment_data: payments::PaymentData, _customer: Option, storage_scheme: enums::MerchantStorageScheme, @@ -315,6 +313,7 @@ impl operations::ValidateResult { merchant_id: &merchant_account.merchant_id, payment_id: api::PaymentIdType::PaymentIntentId(request.payment_id.to_owned()), + mandate_type: None, storage_scheme: merchant_account.storage_scheme, requeue: false, }, diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs index d31ec14a723..9d0971982a6 100644 --- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs +++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs @@ -10,13 +10,13 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida use crate::{ core::{ errors::{self, CustomResult, RouterResult, StorageErrorExt}, - mandate::helpers as m_helpers, + mandate::helpers::MandateGenericData, payment_methods::PaymentMethodRetrieve, payments::{self, helpers, operations, CustomerDetails, PaymentAddress, PaymentData}, utils as core_utils, }, db::StorageInterface, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ api::{self, PaymentIdTypeExt}, @@ -40,6 +40,7 @@ impl state: &'a AppState, payment_id: &api::PaymentIdType, request: &api::PaymentsRequest, + mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -71,6 +72,23 @@ impl "confirm", )?; + let MandateGenericData { + token, + payment_method, + payment_method_type, + mandate_data, + recurring_mandate_payment_data, + mandate_connector, + payment_method_info, + } = helpers::get_token_pm_type_mandate_details( + state, + request, + mandate_type.to_owned(), + merchant_account, + key_store, + ) + .await?; + let browser_info = request .browser_info .clone() @@ -81,9 +99,6 @@ impl field_name: "browser_info", })?; - let recurring_details = request.recurring_details.clone(); - let customer_acceptance = request.customer_acceptance.clone().map(From::from); - payment_attempt = db .find_payment_attempt_by_payment_id_merchant_id_attempt_id( &payment_intent.payment_id, @@ -94,34 +109,6 @@ impl .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; - let mandate_type = m_helpers::get_mandate_type( - request.mandate_data.clone(), - request.off_session, - payment_intent.setup_future_usage, - request.customer_acceptance.clone(), - request.payment_token.clone(), - ) - .change_context(errors::ApiErrorResponse::MandateValidationFailed { - reason: "Expected one out of recurring_details and mandate_data but got both".into(), - })?; - - let m_helpers::MandateGenericData { - token, - payment_method, - payment_method_type, - mandate_data, - recurring_mandate_payment_data, - mandate_connector, - payment_method_info, - } = helpers::get_token_pm_type_mandate_details( - state, - request, - mandate_type.to_owned(), - merchant_account, - key_store, - payment_attempt.payment_method_id.clone(), - ) - .await?; let token = token.or_else(|| payment_attempt.payment_token.clone()); if let Some(payment_method) = payment_method { @@ -138,7 +125,7 @@ impl &request .payment_method_data .as_ref() - .and_then(|pmd| pmd.payment_method_data.clone()), + .map(|pmd| pmd.payment_method_data.clone()), &request.payment_method_type, &mandate_type, &token, @@ -272,7 +259,7 @@ impl mandate_id: None, mandate_connector, setup_mandate, - customer_acceptance, + customer_acceptance: None, token, token_data, address: PaymentAddress::new( @@ -284,7 +271,7 @@ impl payment_method_data: request .payment_method_data .as_ref() - .and_then(|pmd| pmd.payment_method_data.clone()), + .map(|pmd| pmd.payment_method_data.clone()), payment_method_info, force_sync: None, refunds: vec![], @@ -306,8 +293,7 @@ impl authorizations: vec![], authentication: None, frm_metadata: None, - recurring_details, - poll_config: None, + recurring_details: request.recurring_details.clone(), }; let customer_details = Some(CustomerDetails { @@ -323,7 +309,6 @@ impl customer_details, payment_data, business_profile, - mandate_type, }; Ok(get_trackers_response) @@ -341,7 +326,6 @@ impl Domain, request: Option, key_store: &domain::MerchantKeyStore, - storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsRequest, Ctx>, @@ -356,7 +340,6 @@ impl Domain Domain, - storage_scheme: storage_enums::MerchantStorageScheme, + _storage_scheme: storage_enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, ) -> RouterResult<( @@ -380,7 +363,6 @@ impl Domain async fn update_trackers<'b>( &'b self, _state: &'b AppState, - _req_state: ReqState, payment_data: PaymentData, _customer: Option, _storage_scheme: storage_enums::MerchantStorageScheme, @@ -474,13 +455,12 @@ impl ValidateRequest ValidateRequest state: &'a AppState, payment_id: &api::PaymentIdType, request: &api::PaymentsRequest, + mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, auth_flow: services::AuthFlow, @@ -62,18 +62,47 @@ impl .change_context(errors::ApiErrorResponse::PaymentNotFound)?; // Stage 1 - let store = &*state.store; + let store = state.clone().store; let m_merchant_id = merchant_id.clone(); + let payment_intent_fut = tokio::spawn( + async move { + store + .find_payment_intent_by_payment_id_merchant_id( + &payment_id, + m_merchant_id.as_str(), + storage_scheme, + ) + .map(|x| x.change_context(errors::ApiErrorResponse::PaymentNotFound)) + .await + } + .in_current_span(), + ); + + let m_state = state.clone(); + let m_mandate_type = mandate_type.clone(); + let m_merchant_account = merchant_account.clone(); + let m_request = request.clone(); + let m_key_store = key_store.clone(); + + let mandate_details_fut = tokio::spawn( + async move { + helpers::get_token_pm_type_mandate_details( + &m_state, + &m_request, + m_mandate_type, + &m_merchant_account, + &m_key_store, + ) + .await + } + .in_current_span(), + ); // Parallel calls - level 0 - let mut payment_intent = store - .find_payment_intent_by_payment_id_merchant_id( - &payment_id, - m_merchant_id.as_str(), - storage_scheme, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; + let (mut payment_intent, mandate_details) = tokio::try_join!( + utils::flatten_join_error(payment_intent_fut), + utils::flatten_join_error(mandate_details_fut) + )?; if let Some(order_details) = &request.order_details { helpers::validate_order_details_amount( @@ -323,6 +352,16 @@ impl .setup_future_usage .or(payment_intent.setup_future_usage); + let MandateGenericData { + token, + payment_method, + payment_method_type, + mandate_data, + recurring_mandate_payment_data, + mandate_connector, + payment_method_info, + } = mandate_details; + let browser_info = request .browser_info .clone() @@ -335,16 +374,47 @@ impl })?; let customer_acceptance = request.customer_acceptance.clone().map(From::from); - let recurring_details = request.recurring_details.clone(); - helpers::validate_card_data( request .payment_method_data .as_ref() - .and_then(|pmd| pmd.payment_method_data.clone()), + .map(|pmd| pmd.payment_method_data.clone()), + )?; + + let token = token.or_else(|| payment_attempt.payment_token.clone()); + + helpers::validate_pm_or_token_given( + &request.payment_method, + &request + .payment_method_data + .as_ref() + .map(|pmd| pmd.payment_method_data.clone()), + &request.payment_method_type, + &mandate_type, + &token, )?; + let (token_data, payment_method_info) = if let Some(token) = token.clone() { + let token_data = helpers::retrieve_payment_token_data( + state, + token, + payment_method.or(payment_attempt.payment_method), + ) + .await?; + + let payment_method_info = + helpers::retrieve_payment_method_from_db_with_token_data(state, &token_data) + .await?; + + (Some(token_data), payment_method_info) + } else { + (None, payment_method_info) + }; + + payment_attempt.payment_method = payment_method.or(payment_attempt.payment_method); payment_attempt.browser_info = browser_info; + payment_attempt.payment_method_type = + payment_method_type.or(payment_attempt.payment_method_type); payment_attempt.payment_experience = request .payment_experience @@ -409,29 +479,36 @@ impl .clone() .or(payment_attempt.business_sub_label); + // The operation merges mandate data from both request and payment_attempt + let setup_mandate = mandate_data.map(|mut sm| { + sm.mandate_type = payment_attempt.mandate_details.clone().or(sm.mandate_type); + sm.update_mandate_id = payment_attempt + .mandate_data + .clone() + .and_then(|mandate| mandate.update_mandate_id) + .or(sm.update_mandate_id); + sm + }); + + let mandate_details_present = + payment_attempt.mandate_details.is_some() || request.mandate_data.is_some(); + helpers::validate_mandate_data_and_future_usage( + payment_intent.setup_future_usage, + mandate_details_present, + )?; let n_request_payment_method_data = request .payment_method_data .as_ref() - .and_then(|pmd| pmd.payment_method_data.clone()); + .map(|pmd| pmd.payment_method_data.clone()); let store = state.clone().store; - let profile_id = payment_intent - .profile_id - .clone() - .get_required_value("profile_id") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("'profile_id' not set in payment intent")?; let additional_pm_data_fut = tokio::spawn( async move { Ok(n_request_payment_method_data .async_map(|payment_method_data| async move { - helpers::get_additional_payment_data( - &payment_method_data, - store.as_ref(), - profile_id.as_ref(), - ) - .await + helpers::get_additional_payment_data(&payment_method_data, store.as_ref()) + .await }) .await) } @@ -470,122 +547,21 @@ impl } .in_current_span(), ); - let mandate_type = m_helpers::get_mandate_type( - request.mandate_data.clone(), - request.off_session, - payment_intent.setup_future_usage, - request.customer_acceptance.clone(), - request.payment_token.clone(), - ) - .change_context(errors::ApiErrorResponse::MandateValidationFailed { - reason: "Expected one out of recurring_details and mandate_data but got both".into(), - })?; - - let m_state = state.clone(); - let m_mandate_type = mandate_type.clone(); - let m_merchant_account = merchant_account.clone(); - let m_request = request.clone(); - let m_key_store = key_store.clone(); - - let mandate_details_fut = tokio::spawn( - async move { - helpers::get_token_pm_type_mandate_details( - &m_state, - &m_request, - m_mandate_type, - &m_merchant_account, - &m_key_store, - None, - ) - .await - } - .in_current_span(), - ); // Parallel calls - level 2 - let (mandate_details, additional_pm_data, payment_method_billing) = tokio::try_join!( - utils::flatten_join_error(mandate_details_fut), + let (additional_pm_data, payment_method_billing) = tokio::try_join!( utils::flatten_join_error(additional_pm_data_fut), utils::flatten_join_error(payment_method_billing_future), )?; - let m_helpers::MandateGenericData { - token, - payment_method, - payment_method_type, - mandate_data, - recurring_mandate_payment_data, - mandate_connector, - payment_method_info, - } = mandate_details; - - payment_attempt.payment_method = payment_method.or(payment_attempt.payment_method); - - payment_attempt.payment_method_type = payment_method_type - .or(payment_attempt.payment_method_type) - .or(payment_method_info - .as_ref() - .and_then(|pm_info| pm_info.payment_method_type)); - - let token = token.or_else(|| payment_attempt.payment_token.clone()); - - helpers::validate_pm_or_token_given( - &request.payment_method, - &request - .payment_method_data - .as_ref() - .and_then(|pmd| pmd.payment_method_data.clone()), - &request.payment_method_type, - &mandate_type, - &token, - )?; - - let (token_data, payment_method_info) = if let Some(token) = token.clone() { - let token_data = helpers::retrieve_payment_token_data( - state, - token, - payment_method.or(payment_attempt.payment_method), - ) - .await?; - - let payment_method_info = helpers::retrieve_payment_method_from_db_with_token_data( - state, - &token_data, - storage_scheme, - ) - .await?; - - (Some(token_data), payment_method_info) - } else { - (None, payment_method_info) - }; - // The operation merges mandate data from both request and payment_attempt - let setup_mandate = mandate_data.map(|mut sm| { - sm.mandate_type = payment_attempt.mandate_details.clone().or(sm.mandate_type); - sm.update_mandate_id = payment_attempt - .mandate_data - .clone() - .and_then(|mandate| mandate.update_mandate_id) - .or(sm.update_mandate_id); - sm - }); - - let mandate_details_present = - payment_attempt.mandate_details.is_some() || request.mandate_data.is_some(); - helpers::validate_mandate_data_and_future_usage( - payment_intent.setup_future_usage, - mandate_details_present, - )?; - let payment_method_data_after_card_bin_call = request .payment_method_data .as_ref() - .and_then(|request_payment_method_data| { - request_payment_method_data.payment_method_data.as_ref() - }) .zip(additional_pm_data) .map(|(payment_method_data, additional_payment_data)| { - payment_method_data.apply_additional_payment_data(additional_payment_data) + payment_method_data + .payment_method_data + .apply_additional_payment_data(additional_payment_data) }); let authentication = payment_attempt.authentication_id.as_ref().async_map(|authentication_id| async move { state @@ -645,8 +621,7 @@ impl authorizations: vec![], frm_metadata: request.frm_metadata.clone(), authentication, - recurring_details, - poll_config: None, + recurring_details: request.recurring_details.clone(), }; let get_trackers_response = operations::GetTrackerResponse { @@ -654,7 +629,6 @@ impl customer_details: Some(customer_details), payment_data, business_profile, - mandate_type, }; Ok(get_trackers_response) @@ -672,7 +646,6 @@ impl Domain, request: Option, key_store: &domain::MerchantKeyStore, - storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsRequest, Ctx>, @@ -687,7 +660,6 @@ impl Domain Domain, - storage_scheme: storage_enums::MerchantStorageScheme, + _storage_scheme: storage_enums::MerchantStorageScheme, key_store: &domain::MerchantKeyStore, customer: &Option, ) -> RouterResult<( @@ -705,15 +677,8 @@ impl Domain, Option, )> { - let (op, payment_method_data, pm_id) = helpers::make_pm_data( - Box::new(self), - state, - payment_data, - key_store, - customer, - storage_scheme, - ) - .await?; + let (op, payment_method_data, pm_id) = + helpers::make_pm_data(Box::new(self), state, payment_data, key_store, customer).await?; utils::when(payment_method_data.is_none(), || { Err(errors::ApiErrorResponse::PaymentMethodNotFound) @@ -907,70 +872,6 @@ impl Domain CustomResult { blocklist_utils::validate_data_for_blocklist(state, merchant_account, payment_data).await } - - #[instrument(skip_all)] - async fn store_extended_card_info_temporarily<'a>( - &'a self, - state: &AppState, - payment_id: &str, - business_profile: &storage::BusinessProfile, - payment_method_data: &Option, - ) -> CustomResult<(), errors::ApiErrorResponse> { - if let (Some(true), Some(api::PaymentMethodData::Card(card)), Some(merchant_config)) = ( - business_profile.is_extended_card_info_enabled, - payment_method_data, - business_profile.extended_card_info_config.clone(), - ) { - let merchant_config = merchant_config - .expose() - .parse_value::("ExtendedCardInfoConfig") - .map_err(|err| logger::error!(parse_err=?err,"Error while parsing ExtendedCardInfoConfig")); - - let card_data = ExtendedCardInfo::from(card.clone()) - .encode_to_vec() - .map_err(|err| logger::error!(encode_err=?err,"Error while encoding ExtendedCardInfo to vec")); - - let (Ok(merchant_config), Ok(card_data)) = (merchant_config, card_data) else { - return Ok(()); - }; - - let encrypted_payload = - services::encrypt_jwe(&card_data, merchant_config.public_key.peek()) - .await - .map_err(|err| { - logger::error!(jwe_encryption_err=?err,"Error while JWE encrypting extended card info") - }); - - let Ok(encrypted_payload) = encrypted_payload else { - return Ok(()); - }; - - let redis_conn = state - .store - .get_redis_conn() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to get redis connection")?; - - let key = helpers::get_redis_key_for_extended_card_info( - &business_profile.merchant_id, - payment_id, - ); - - redis_conn - .set_key_with_expiry( - &key, - encrypted_payload.clone(), - (*merchant_config.ttl_in_secs).into(), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to add extended card info in redis")?; - - logger::info!("Extended card info added to redis"); - } - - Ok(()) - } } #[async_trait] @@ -981,7 +882,6 @@ impl async fn update_trackers<'b>( &'b self, state: &'b AppState, - _req_state: ReqState, mut payment_data: PaymentData, customer: Option, storage_scheme: storage_enums::MerchantStorageScheme, @@ -999,7 +899,6 @@ impl let payment_method = payment_data.payment_attempt.payment_method; let browser_info = payment_data.payment_attempt.browser_info.clone(); let frm_message = payment_data.frm_message.clone(); - let capture_method = payment_data.payment_attempt.capture_method; let default_status_result = ( storage_enums::IntentStatus::Processing, @@ -1022,11 +921,7 @@ impl storage_enums::AttemptStatus::Unresolved, (None, None), ), - FrmSuggestion::FrmAuthorizeTransaction => ( - storage_enums::IntentStatus::RequiresCapture, - storage_enums::AttemptStatus::Authorized, - (None, None), - ), + FrmSuggestion::FrmAutoRefund => default_status_result.clone(), }; let status_handler_for_authentication_results = @@ -1069,19 +964,12 @@ impl .clone(); let payment_token = payment_data.token.clone(); let payment_method_type = payment_data.payment_attempt.payment_method_type; - let profile_id = payment_data - .payment_intent - .profile_id - .as_ref() - .get_required_value("profile_id") - .change_context(errors::ApiErrorResponse::InternalServerError)?; let payment_experience = payment_data.payment_attempt.payment_experience; let additional_pm_data = payment_data .payment_method_data .as_ref() .async_map(|payment_method_data| async { - helpers::get_additional_payment_data(payment_method_data, &*state.store, profile_id) - .await + helpers::get_additional_payment_data(payment_method_data, &*state.store).await }) .await .as_ref() @@ -1126,7 +1014,6 @@ impl let m_payment_method_id = payment_data.payment_attempt.payment_method_id.clone(); let m_browser_info = browser_info.clone(); let m_connector = connector.clone(); - let m_capture_method = capture_method; let m_payment_token = payment_token.clone(); let m_additional_pm_data = additional_pm_data.clone(); let m_business_sub_label = business_sub_label.clone(); @@ -1167,7 +1054,6 @@ impl status: attempt_status, payment_method, authentication_type, - capture_method: m_capture_method, browser_info: m_browser_info, connector: m_connector, payment_token: m_payment_token, @@ -1259,10 +1145,8 @@ impl m_db.update_customer_by_customer_id_merchant_id( m_customer_customer_id, m_customer_merchant_id, - customer, m_updated_customer, &m_key_store, - storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) @@ -1315,13 +1199,12 @@ impl ValidateRequest ValidateRequest state: &'a AppState, payment_id: &api::PaymentIdType, request: &api::PaymentsRequest, + mandate_type: Option, merchant_account: &domain::MerchantAccount, merchant_key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -105,22 +104,8 @@ impl id: profile_id.to_string(), })? }; - let customer_acceptance = request.customer_acceptance.clone().map(From::from); - - let recurring_details = request.recurring_details.clone(); - - let mandate_type = m_helpers::get_mandate_type( - request.mandate_data.clone(), - request.off_session, - request.setup_future_usage, - request.customer_acceptance.clone(), - request.payment_token.clone(), - ) - .change_context(errors::ApiErrorResponse::MandateValidationFailed { - reason: "Expected one out of recurring_details and mandate_data but got both".into(), - })?; - let m_helpers::MandateGenericData { + let MandateGenericData { token, payment_method, payment_method_type, @@ -131,10 +116,9 @@ impl } = helpers::get_token_pm_type_mandate_details( state, request, - mandate_type.clone(), + mandate_type, merchant_account, merchant_key_store, - None, ) .await?; @@ -258,7 +242,7 @@ impl .as_ref() .map(|address| address.address_id.clone()), attempt_id, - profile_id.clone(), + profile_id, session_expiry, ) .await?; @@ -275,9 +259,6 @@ impl payment_method_billing_address .as_ref() .map(|address| address.address_id.clone()), - &payment_method_info, - merchant_key_store, - profile_id, ) .await?; @@ -322,7 +303,7 @@ impl }) .async_and_then(|mandate_id| async { let mandate = db - .find_mandate_by_merchant_id_mandate_id(merchant_id, mandate_id, storage_scheme) + .find_mandate_by_merchant_id_mandate_id(merchant_id, mandate_id) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound); Some(mandate.and_then(|mandate_obj| { @@ -390,6 +371,8 @@ impl // The operation merges mandate data from both request and payment_attempt let setup_mandate = mandate_data.map(MandateData::from); + let customer_acceptance = request.customer_acceptance.clone().map(From::from); + let surcharge_details = request.surcharge_details.map(|request_surcharge_details| { payments::types::SurchargeDetails::from((&request_surcharge_details, &payment_attempt)) }); @@ -397,18 +380,14 @@ impl let payment_method_data_after_card_bin_call = request .payment_method_data .as_ref() - .and_then(|payment_method_data_from_request| { - payment_method_data_from_request - .payment_method_data - .as_ref() - }) .zip(additional_payment_data) .map(|(payment_method_data, additional_payment_data)| { - payment_method_data.apply_additional_payment_data(additional_payment_data) + payment_method_data + .payment_method_data + .apply_additional_payment_data(additional_payment_data) }); let amount = payment_attempt.get_total_amount().into(); - let payment_data = PaymentData { flow: PhantomData, payment_intent, @@ -450,8 +429,7 @@ impl authorizations: vec![], authentication: None, frm_metadata: request.frm_metadata.clone(), - recurring_details, - poll_config: None, + recurring_details: request.recurring_details.clone(), }; let get_trackers_response = operations::GetTrackerResponse { @@ -459,7 +437,6 @@ impl customer_details: Some(customer_details), payment_data, business_profile, - mandate_type, }; Ok(get_trackers_response) @@ -477,7 +454,6 @@ impl Domain, request: Option, key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsRequest, Ctx>, @@ -492,7 +468,6 @@ impl Domain Domain, - storage_scheme: enums::MerchantStorageScheme, + _storage_scheme: enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, ) -> RouterResult<( @@ -516,7 +491,6 @@ impl Domain async fn update_trackers<'b>( &'b self, state: &'b AppState, - _req_state: ReqState, mut payment_data: PaymentData, _customer: Option, storage_scheme: enums::MerchantStorageScheme, @@ -706,7 +679,7 @@ impl ValidateRequest ValidateRequest ValidateRequest ValidateRequest, state: &AppState, payment_method_billing_address_id: Option, - payment_method_info: &Option, - key_store: &domain::MerchantKeyStore, - profile_id: String, ) -> RouterResult<( storage::PaymentAttemptNew, Option, )> { - let payment_method_data = - request - .payment_method_data - .as_ref() - .and_then(|payment_method_data_request| { - payment_method_data_request.payment_method_data.as_ref() - }); - let created_at @ modified_at @ last_synced = Some(common_utils::date_time::now()); - let status = helpers::payment_attempt_status_fsm(payment_method_data, request.confirm); + let status = + helpers::payment_attempt_status_fsm(&request.payment_method_data, request.confirm); let (amount, currency) = (money.0, Some(money.1)); - let mut additional_pm_data = request + let additional_pm_data = request .payment_method_data .as_ref() - .and_then(|payment_method_data_request| { - payment_method_data_request.payment_method_data.as_ref() - }) .async_map(|payment_method_data| async { helpers::get_additional_payment_data( - payment_method_data, + &payment_method_data.payment_method_data, &*state.store, - &profile_id, ) .await }) .await; - - if additional_pm_data.is_none() { - // If recurring payment is made using payment_method_id, then fetch payment_method_data from retrieved payment_method object - additional_pm_data = payment_method_info - .as_ref() - .async_map(|pm_info| async { - domain::types::decrypt::( - pm_info.payment_method_data.clone(), - key_store.key.get_inner().peek(), - ) - .await - .map_err(|err| logger::error!("Failed to decrypt card details: {:?}", err)) - .ok() - .flatten() - .map(|x| x.into_inner().expose()) - .and_then(|v| { - serde_json::from_value::(v) - .map_err(|err| { - logger::error!( - "Unable to deserialize payment methods data: {:?}", - err - ) - }) - .ok() - }) - .and_then(|pmd| match pmd { - PaymentMethodsData::Card(crd) => Some(api::CardDetailFromLocker::from(crd)), - _ => None, - }) - }) - .await - .flatten() - .map(|card| { - api_models::payments::AdditionalPaymentData::Card(Box::new(card.into())) - }) - }; - let additional_pm_data_value = additional_pm_data .as_ref() .map(Encode::encode_to_value) @@ -919,9 +841,7 @@ impl PaymentCreate { connector: None, error_message: None, offer_amount: None, - payment_method_id: payment_method_info - .as_ref() - .map(|pm_info| pm_info.payment_method_id.clone()), + payment_method_id: None, cancellation_reason: None, error_code: None, connector_metadata: None, @@ -960,16 +880,8 @@ impl PaymentCreate { session_expiry: PrimitiveDateTime, ) -> RouterResult { let created_at @ modified_at @ last_synced = Some(common_utils::date_time::now()); - - let status = helpers::payment_intent_status_fsm( - request - .payment_method_data - .as_ref() - .and_then(|request_payment_method_data| { - request_payment_method_data.payment_method_data.as_ref() - }), - request.confirm, - ); + let status = + helpers::payment_intent_status_fsm(&request.payment_method_data, request.confirm); let client_secret = crate::utils::generate_id(consts::ID_LENGTH, format!("{payment_id}_secret").as_str()); let (amount, currency) = (money.0, Some(money.1)); @@ -1023,9 +935,7 @@ impl PaymentCreate { metadata: request.metadata.clone(), business_country: request.business_country, business_label: request.business_label.clone(), - active_attempt: hyperswitch_domain_models::RemoteStorageObject::ForeignID( - active_attempt_id, - ), + active_attempt: data_models::RemoteStorageObject::ForeignID(active_attempt_id), order_details, amount_captured: None, customer_id: None, diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs index 8845fe836e2..e1d58b032aa 100644 --- a/crates/router/src/core/payments/operations/payment_reject.rs +++ b/crates/router/src/core/payments/operations/payment_reject.rs @@ -13,7 +13,7 @@ use crate::{ payment_methods::PaymentMethodRetrieve, payments::{helpers, operations, PaymentAddress, PaymentData}, }, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ api::{self, PaymentIdTypeExt}, @@ -37,6 +37,7 @@ impl state: &'a AppState, payment_id: &api::PaymentIdType, _request: &PaymentsCancelRequest, + _mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -174,7 +175,6 @@ impl authentication: None, frm_metadata: None, recurring_details: None, - poll_config: None, }; let get_trackers_response = operations::GetTrackerResponse { @@ -182,7 +182,6 @@ impl customer_details: None, payment_data, business_profile, - mandate_type: None, }; Ok(get_trackers_response) @@ -197,7 +196,6 @@ impl async fn update_trackers<'b>( &'b self, state: &'b AppState, - _req_state: ReqState, mut payment_data: PaymentData, _customer: Option, storage_scheme: enums::MerchantStorageScheme, @@ -275,6 +273,7 @@ impl ValidateRequest PostUpdateTracker, types::PaymentsAuthorizeData> +impl PostUpdateTracker, types::PaymentsAuthorizeData> for PaymentResponse { async fn update_tracker<'b>( @@ -64,7 +62,7 @@ impl PostUpdateTracker, types::PaymentsAuthor storage_scheme: enums::MerchantStorageScheme, ) -> RouterResult> where - F: 'b, + F: 'b + Send, { payment_data.mandate_id = payment_data .mandate_id @@ -81,151 +79,6 @@ impl PostUpdateTracker, types::PaymentsAuthor Ok(payment_data) } - - async fn save_pm_and_mandate<'b>( - &self, - state: &AppState, - resp: &types::RouterData, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, - payment_data: &mut PaymentData, - ) -> CustomResult<(), errors::ApiErrorResponse> - where - F: 'b + Clone + Send + Sync, - { - let customer_id = payment_data.payment_intent.customer_id.clone(); - let save_payment_data = tokenization::SavePaymentMethodData::from(resp); - let profile_id = payment_data.payment_intent.profile_id.clone(); - - let connector_name = payment_data - .payment_attempt - .connector - .clone() - .ok_or_else(|| { - logger::error!("Missing required Param connector_name"); - errors::ApiErrorResponse::MissingRequiredField { - field_name: "connector_name", - } - })?; - let merchant_connector_id = payment_data.payment_attempt.merchant_connector_id.clone(); - let billing_name = resp - .address - .get_payment_method_billing() - .and_then(|billing_details| billing_details.address.as_ref()) - .and_then(|address| address.get_optional_full_name()); - - let save_payment_call_future = Box::pin(tokenization::save_payment_method( - state, - connector_name.clone(), - merchant_connector_id.clone(), - save_payment_data, - customer_id.clone(), - merchant_account, - resp.request.payment_method_type, - key_store, - Some(resp.request.amount), - Some(resp.request.currency), - profile_id, - billing_name.clone(), - )); - - let is_connector_mandate = resp.request.customer_acceptance.is_some() - && matches!( - resp.request.setup_future_usage, - Some(enums::FutureUsage::OffSession) - ); - - let is_legacy_mandate = resp.request.setup_mandate_details.is_some() - && matches!( - resp.request.setup_future_usage, - Some(enums::FutureUsage::OffSession) - ); - - if is_legacy_mandate { - // Mandate is created on the application side and at the connector. - let (payment_method_id, _payment_method_status) = save_payment_call_future.await?; - - let mandate_id = mandate::mandate_procedure( - state, - resp, - &customer_id.clone(), - payment_method_id.clone(), - merchant_connector_id.clone(), - merchant_account.storage_scheme, - ) - .await?; - payment_data.payment_attempt.payment_method_id = payment_method_id; - payment_data.payment_attempt.mandate_id = mandate_id; - Ok(()) - } else if is_connector_mandate { - // The mandate is created on connector's end. - let (payment_method_id, _payment_method_status) = save_payment_call_future.await?; - payment_data.payment_attempt.payment_method_id = payment_method_id; - Ok(()) - } else { - // Save card flow - let save_payment_data = tokenization::SavePaymentMethodData::from(resp); - let merchant_account = merchant_account.clone(); - let key_store = key_store.clone(); - let state = state.clone(); - let customer_id = payment_data.payment_intent.customer_id.clone(); - let profile_id = payment_data.payment_intent.profile_id.clone(); - - let merchant_connector_id = payment_data.payment_attempt.merchant_connector_id.clone(); - let payment_attempt = payment_data.payment_attempt.clone(); - - let amount = resp.request.amount; - let currency = resp.request.currency; - let payment_method_type = resp.request.payment_method_type; - let storage_scheme = merchant_account.clone().storage_scheme; - - logger::info!("Call to save_payment_method in locker"); - let _task_handle = tokio::spawn( - async move { - logger::info!("Starting async call to save_payment_method in locker"); - - let result = Box::pin(tokenization::save_payment_method( - &state, - connector_name, - merchant_connector_id, - save_payment_data, - customer_id, - &merchant_account, - payment_method_type, - &key_store, - Some(amount), - Some(currency), - profile_id, - billing_name, - )) - .await; - - if let Err(err) = result { - logger::error!("Asynchronously saving card in locker failed : {:?}", err); - } else if let Ok((payment_method_id, _pm_status)) = result { - let payment_attempt_update = - storage::PaymentAttemptUpdate::PaymentMethodDetailsUpdate { - payment_method_id, - updated_by: storage_scheme.clone().to_string(), - }; - let respond = state - .store - .update_payment_attempt_with_attempt_id( - payment_attempt, - payment_attempt_update, - storage_scheme, - ) - .await; - if let Err(err) = respond { - logger::error!("Error updating payment attempt: {:?}", err); - }; - } - } - .in_current_span(), - ); - Ok(()) - } - } } #[async_trait] @@ -380,28 +233,6 @@ impl PostUpdateTracker, types::PaymentsSyncData> for )) .await } - - async fn save_pm_and_mandate<'b>( - &self, - state: &AppState, - resp: &types::RouterData, - merchant_account: &domain::MerchantAccount, - _key_store: &domain::MerchantKeyStore, - payment_data: &mut PaymentData, - ) -> CustomResult<(), errors::ApiErrorResponse> - where - F: 'b + Clone + Send + Sync, - { - update_payment_method_status_and_ntid( - state, - payment_data, - resp.status, - resp.response.clone(), - merchant_account.storage_scheme, - ) - .await?; - Ok(()) - } } #[async_trait] @@ -579,67 +410,6 @@ impl PostUpdateTracker, types::SetupMandateRequestDa Ok(payment_data) } - - async fn save_pm_and_mandate<'b>( - &self, - state: &AppState, - resp: &types::RouterData, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, - payment_data: &mut PaymentData, - ) -> CustomResult<(), errors::ApiErrorResponse> - where - F: 'b + Clone + Send + Sync, - { - let billing_name = resp - .address - .get_payment_method_billing() - .and_then(|billing_details| billing_details.address.as_ref()) - .and_then(|address| address.get_optional_full_name()); - let save_payment_data = tokenization::SavePaymentMethodData::from(resp); - let customer_id = payment_data.payment_intent.customer_id.clone(); - let profile_id = payment_data.payment_intent.profile_id.clone(); - let connector_name = payment_data - .payment_attempt - .connector - .clone() - .ok_or_else(|| { - logger::error!("Missing required Param connector_name"); - errors::ApiErrorResponse::MissingRequiredField { - field_name: "connector_name", - } - })?; - let merchant_connector_id = payment_data.payment_attempt.merchant_connector_id.clone(); - let (payment_method_id, _payment_method_status) = - Box::pin(tokenization::save_payment_method( - state, - connector_name, - merchant_connector_id.clone(), - save_payment_data, - customer_id.clone(), - merchant_account, - resp.request.payment_method_type, - key_store, - resp.request.amount, - Some(resp.request.currency), - profile_id, - billing_name, - )) - .await?; - - let mandate_id = mandate::mandate_procedure( - state, - resp, - &customer_id, - payment_method_id.clone(), - merchant_connector_id.clone(), - merchant_account.storage_scheme, - ) - .await?; - payment_data.payment_attempt.payment_method_id = payment_method_id; - payment_data.payment_attempt.mandate_id = mandate_id; - Ok(()) - } } #[async_trait] @@ -666,28 +436,6 @@ impl PostUpdateTracker, types::CompleteAuthorizeData )) .await } - - async fn save_pm_and_mandate<'b>( - &self, - state: &AppState, - resp: &types::RouterData, - merchant_account: &domain::MerchantAccount, - _key_store: &domain::MerchantKeyStore, - payment_data: &mut PaymentData, - ) -> CustomResult<(), errors::ApiErrorResponse> - where - F: 'b + Clone + Send + Sync, - { - update_payment_method_status_and_ntid( - state, - payment_data, - resp.status, - resp.response.clone(), - merchant_account.storage_scheme, - ) - .await?; - Ok(()) - } } #[instrument(skip_all)] @@ -838,10 +586,7 @@ async fn payment_response_update_tracker( let payment_attempt_update = storage::PaymentAttemptUpdate::PreprocessingUpdate { status: updated_attempt_status, - payment_method_id: payment_data - .payment_attempt - .payment_method_id - .clone(), + payment_method_id: Some(router_data.payment_method_id), connector_metadata, preprocessing_step_id, connector_transaction_id, @@ -896,7 +641,7 @@ async fn payment_response_update_tracker( metrics::SUCCESSFUL_PAYMENT.add(&metrics::CONTEXT, 1, &[]); } - let payment_method_id = payment_data.payment_attempt.payment_method_id.clone(); + let payment_method_id = router_data.payment_method_id.clone(); utils::add_apple_pay_payment_status_metrics( router_data.status, @@ -930,8 +675,11 @@ async fn payment_response_update_tracker( amount_capturable: router_data .request .get_amount_capturable(&payment_data, updated_attempt_status), - payment_method_id, - mandate_id: payment_data.payment_attempt.mandate_id.clone(), + payment_method_id: Some(payment_method_id), + mandate_id: payment_data + .mandate_id + .clone() + .and_then(|mandate| mandate.mandate_id), connector_metadata, payment_token: None, error_code: error_status.clone(), @@ -966,10 +714,7 @@ async fn payment_response_update_tracker( status: updated_attempt_status, connector: None, connector_transaction_id, - payment_method_id: payment_data - .payment_attempt - .payment_method_id - .clone(), + payment_method_id: Some(router_data.payment_method_id), error_code: Some(reason.clone().map(|cd| cd.code)), error_message: Some(reason.clone().map(|cd| cd.message)), error_reason: Some(reason.map(|cd| cd.message)), @@ -1087,7 +832,7 @@ async fn payment_response_update_tracker( }; let amount_captured = get_total_amount_captured( - &router_data.request, + router_data.request, router_data.amount_captured, router_data.status, &payment_data, @@ -1116,6 +861,7 @@ async fn payment_response_update_tracker( }, }; + update_payment_method_status(state, &mut payment_data, router_data.status).await?; let m_db = state.clone().store; let m_payment_data_payment_intent = payment_data.payment_intent.clone(); let m_payment_intent_update = payment_intent_update.clone(); @@ -1132,51 +878,10 @@ async fn payment_response_update_tracker( .in_current_span(), ); - // When connector requires redirection for mandate creation it can update the connector mandate_id in payment_methods during Psync and CompleteAuthorize - - let flow_name = core_utils::get_flow_name::()?; - if flow_name == "PSync" || flow_name == "CompleteAuthorize" { - let connector_mandate_id = match router_data.response.clone() { - Ok(resp) => match resp { - types::PaymentsResponseData::TransactionResponse { - ref mandate_reference, - .. - } => { - if let Some(mandate_ref) = mandate_reference { - mandate_ref.connector_mandate_id.clone() - } else { - None - } - } - _ => None, - }, - Err(_) => None, - }; - if let Some(payment_method) = payment_data.payment_method_info.clone() { - let connector_mandate_details = - payments::tokenization::update_connector_mandate_details_in_payment_method( - payment_method.clone(), - payment_method.payment_method_type, - Some(payment_data.payment_attempt.amount), - payment_data.payment_attempt.currency, - payment_data.payment_attempt.merchant_connector_id.clone(), - connector_mandate_id, - )?; - payment_methods::cards::update_payment_method_connector_mandate_details( - &*state.store, - payment_method.clone(), - connector_mandate_details, - storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to update payment method in db")? - } - } // When connector requires redirection for mandate creation it can update the connector mandate_id during Psync and CompleteAuthorize let m_db = state.clone().store; - let m_router_data_merchant_id = router_data.merchant_id.clone(); let m_payment_method_id = payment_data.payment_attempt.payment_method_id.clone(); + let m_router_data_merchant_id = router_data.merchant_id.clone(); let m_payment_data_mandate_id = payment_data .payment_attempt @@ -1195,7 +900,6 @@ async fn payment_response_update_tracker( m_payment_data_mandate_id, m_payment_method_id, m_router_data_response, - storage_scheme, ) .await } @@ -1218,62 +922,19 @@ async fn payment_response_update_tracker( Ok(payment_data) } -async fn update_payment_method_status_and_ntid( +async fn update_payment_method_status( state: &AppState, payment_data: &mut PaymentData, attempt_status: common_enums::AttemptStatus, - payment_response: Result, - storage_scheme: enums::MerchantStorageScheme, ) -> RouterResult<()> { if let Some(id) = &payment_data.payment_attempt.payment_method_id { let pm = state .store - .find_payment_method(id, storage_scheme) + .find_payment_method(id) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; - let pm_resp_network_transaction_id = payment_response - .map(|resp| if let types::PaymentsResponseData::TransactionResponse { network_txn_id: network_transaction_id, .. } = resp { - network_transaction_id - } else {None}) - .map_err(|err| { - logger::error!(error=?err, "Failed to obtain the network_transaction_id from payment response"); - }) - .ok() - .flatten(); - - let network_transaction_id = - if let Some(network_transaction_id) = pm_resp_network_transaction_id { - let profile_id = payment_data - .payment_intent - .profile_id - .as_ref() - .ok_or(errors::ApiErrorResponse::ResourceIdNotFound)?; - - let pg_agnostic = state - .store - .find_config_by_key_unwrap_or( - &format!("pg_agnostic_mandate_{}", profile_id), - Some("false".to_string()), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("The pg_agnostic config was not found in the DB")?; - - if &pg_agnostic.config == "true" - && payment_data.payment_intent.setup_future_usage - == Some(diesel_models::enums::FutureUsage::OffSession) - { - Some(network_transaction_id) - } else { - logger::info!("Skip storing network transaction id"); - None - } - } else { - None - }; - - let pm_update = if pm.status != common_enums::PaymentMethodStatus::Active + if pm.status != common_enums::PaymentMethodStatus::Active && pm.status != attempt_status.into() { let updated_pm_status = common_enums::PaymentMethodStatus::from(attempt_status); @@ -1282,23 +943,16 @@ async fn update_payment_method_status_and_ntid( .payment_method_info .as_mut() .map(|info| info.status = updated_pm_status); - storage::PaymentMethodUpdate::NetworkTransactionIdAndStatusUpdate { - network_transaction_id, + let pm_update = storage::PaymentMethodUpdate::StatusUpdate { status: Some(updated_pm_status), - } - } else { - storage::PaymentMethodUpdate::NetworkTransactionIdAndStatusUpdate { - network_transaction_id, - status: None, - } - }; - - state - .store - .update_payment_method(pm, pm_update, storage_scheme) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to update payment method in db")?; + }; + state + .store + .update_payment_method(pm, pm_update) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed to update payment method in db")?; + } }; Ok(()) } @@ -1357,7 +1011,7 @@ fn get_capture_update_for_unmapped_capture_responses( } fn get_total_amount_captured( - request: &T, + request: T, amount_captured: Option, router_data_status: enums::AttemptStatus, payment_data: &PaymentData, diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs index 808eb20eb12..25b419e3222 100644 --- a/crates/router/src/core/payments/operations/payment_session.rs +++ b/crates/router/src/core/payments/operations/payment_session.rs @@ -15,7 +15,7 @@ use crate::{ payments::{self, helpers, operations, PaymentData}, }, db::StorageInterface, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ api::{self, PaymentIdTypeExt}, @@ -39,6 +39,7 @@ impl state: &'a AppState, payment_id: &api::PaymentIdType, request: &api::PaymentsSessionRequest, + _mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -199,7 +200,6 @@ impl authentication: None, frm_metadata: None, recurring_details: None, - poll_config: None, }; let get_trackers_response = operations::GetTrackerResponse { @@ -207,7 +207,6 @@ impl customer_details: Some(customer_details), payment_data, business_profile, - mandate_type: None, }; Ok(get_trackers_response) @@ -222,7 +221,6 @@ impl async fn update_trackers<'b>( &'b self, state: &'b AppState, - _req_state: ReqState, mut payment_data: PaymentData, _customer: Option, storage_scheme: storage_enums::MerchantStorageScheme, @@ -278,6 +276,7 @@ impl operations::ValidateResult { merchant_id: &merchant_account.merchant_id, payment_id: api::PaymentIdType::PaymentIntentId(given_payment_id), + mandate_type: None, storage_scheme: merchant_account.storage_scheme, requeue: false, }, @@ -301,7 +300,6 @@ where payment_data: &mut PaymentData, request: Option, key_store: &domain::MerchantKeyStore, - storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> errors::CustomResult< ( BoxedOperation<'a, F, api::PaymentsSessionRequest, Ctx>, @@ -316,7 +314,6 @@ where request, &key_store.merchant_id, key_store, - storage_scheme, ) .await } diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs index c7042908b63..465a2e5818d 100644 --- a/crates/router/src/core/payments/operations/payment_start.rs +++ b/crates/router/src/core/payments/operations/payment_start.rs @@ -14,7 +14,7 @@ use crate::{ payments::{helpers, operations, CustomerDetails, PaymentAddress, PaymentData}, }, db::StorageInterface, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ api::{self, PaymentIdTypeExt}, @@ -38,6 +38,7 @@ impl state: &'a AppState, payment_id: &api::PaymentIdType, _request: &api::PaymentsStartRequest, + _mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -186,7 +187,6 @@ impl authentication: None, frm_metadata: None, recurring_details: None, - poll_config: None, }; let get_trackers_response = operations::GetTrackerResponse { @@ -194,7 +194,6 @@ impl customer_details: Some(customer_details), payment_data, business_profile, - mandate_type: None, }; Ok(get_trackers_response) @@ -209,7 +208,6 @@ impl async fn update_trackers<'b>( &'b self, _state: &'b AppState, - _req_state: ReqState, payment_data: PaymentData, _customer: Option, _storage_scheme: storage_enums::MerchantStorageScheme, @@ -254,6 +252,7 @@ impl ValidateRequest, request: Option, key_store: &domain::MerchantKeyStore, - storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsStartRequest, Ctx>, @@ -292,7 +290,6 @@ where request, &key_store.merchant_id, key_store, - storage_scheme, ) .await } @@ -302,7 +299,7 @@ where &'a self, state: &'a AppState, payment_data: &mut PaymentData, - storage_scheme: storage_enums::MerchantStorageScheme, + _storage_scheme: storage_enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, ) -> RouterResult<( @@ -323,7 +320,6 @@ where payment_data, merchant_key_store, customer, - storage_scheme, ) .await } else { diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs index 4c0359c28f0..4d616146908 100644 --- a/crates/router/src/core/payments/operations/payment_status.rs +++ b/crates/router/src/core/payments/operations/payment_status.rs @@ -5,7 +5,7 @@ use async_trait::async_trait; use common_utils::ext_traits::AsyncExt; use error_stack::ResultExt; use router_derive::PaymentOperation; -use router_env::{instrument, logger, tracing}; +use router_env::{instrument, tracing}; use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest}; use crate::{ @@ -18,7 +18,7 @@ use crate::{ }, }, db::StorageInterface, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ api, domain, @@ -71,7 +71,6 @@ impl Domain, request: Option, key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsRequest, Ctx>, @@ -86,7 +85,6 @@ impl Domain Domain, - storage_scheme: enums::MerchantStorageScheme, + _storage_scheme: enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, ) -> RouterResult<( @@ -110,7 +108,6 @@ impl Domain async fn update_trackers<'b>( &'b self, _state: &'b AppState, - _req_state: ReqState, payment_data: PaymentData, _customer: Option, _storage_scheme: enums::MerchantStorageScheme, @@ -181,7 +177,6 @@ impl async fn update_trackers<'b>( &'b self, _state: &'b AppState, - _req_state: ReqState, payment_data: PaymentData, _customer: Option, _storage_scheme: enums::MerchantStorageScheme, @@ -210,6 +205,7 @@ impl state: &'a AppState, payment_id: &api::PaymentIdType, request: &api::PaymentsRetrieveRequest, + _mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -403,29 +399,6 @@ async fn get_tracker_for_sync< .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { id: profile_id.to_string(), })?; - - let payment_method_info = - if let Some(ref payment_method_id) = payment_attempt.payment_method_id.clone() { - match db - .find_payment_method(payment_method_id, storage_scheme) - .await - { - Ok(payment_method) => Some(payment_method), - Err(error) => { - if error.current_context().is_db_not_found() { - logger::info!("Payment Method not found in db {:?}", error); - None - } else { - Err(error) - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error retrieving payment method from db")? - } - } - } - } else { - None - }; - let merchant_id = payment_intent.merchant_id.clone(); let authentication = payment_attempt.authentication_id.clone().async_map(|authentication_id| async move { db.find_authentication_by_merchant_id_authentication_id( @@ -463,7 +436,7 @@ async fn get_tracker_for_sync< token_data: None, confirm: Some(request.force_sync), payment_method_data: None, - payment_method_info, + payment_method_info: None, force_sync: Some( request.force_sync && (helpers::check_force_psync_precondition(&payment_attempt.status) @@ -490,7 +463,6 @@ async fn get_tracker_for_sync< authentication, frm_metadata: None, recurring_details: None, - poll_config: None, }; let get_trackers_response = operations::GetTrackerResponse { @@ -498,7 +470,6 @@ async fn get_tracker_for_sync< customer_details: None, payment_data, business_profile, - mandate_type: None, }; Ok(get_trackers_response) @@ -527,6 +498,7 @@ impl operations::ValidateResult { merchant_id: &merchant_account.merchant_id, payment_id: request.resource_id.clone(), + mandate_type: None, storage_scheme: merchant_account.storage_scheme, requeue: false, }, diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs index 0aaa6006052..a6a41732f1b 100644 --- a/crates/router/src/core/payments/operations/payment_update.rs +++ b/crates/router/src/core/payments/operations/payment_update.rs @@ -13,13 +13,13 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida use crate::{ core::{ errors::{self, CustomResult, RouterResult, StorageErrorExt}, - mandate::helpers as m_helpers, + mandate::helpers::MandateGenericData, payment_methods::PaymentMethodRetrieve, payments::{self, helpers, operations, CustomerDetails, PaymentAddress, PaymentData}, utils as core_utils, }, db::StorageInterface, - routes::{app::ReqState, AppState}, + routes::AppState, services, types::{ api::{self, PaymentIdTypeExt}, @@ -43,6 +43,7 @@ impl state: &'a AppState, payment_id: &api::PaymentIdType, request: &api::PaymentsRequest, + mandate_type: Option, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, auth_flow: services::AuthFlow, @@ -81,7 +82,7 @@ impl request .payment_method_data .as_ref() - .and_then(|pmd| pmd.payment_method_data.clone()), + .map(|pmd| pmd.payment_method_data.clone()), )?; helpers::validate_payment_status_against_not_allowed_statuses( @@ -97,6 +98,23 @@ impl helpers::authenticate_client_secret(request.client_secret.as_ref(), &payment_intent)?; + let MandateGenericData { + token, + payment_method, + payment_method_type, + mandate_data, + recurring_mandate_payment_data, + mandate_connector, + payment_method_info, + } = helpers::get_token_pm_type_mandate_details( + state, + request, + mandate_type.to_owned(), + merchant_account, + key_store, + ) + .await?; + payment_intent = db .find_payment_intent_by_payment_id_merchant_id(&payment_id, merchant_id, storage_scheme) .await @@ -118,37 +136,6 @@ impl .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; - let customer_acceptance = request.customer_acceptance.clone().map(From::from); - let recurring_details = request.recurring_details.clone(); - - let mandate_type = m_helpers::get_mandate_type( - request.mandate_data.clone(), - request.off_session, - payment_intent.setup_future_usage, - request.customer_acceptance.clone(), - request.payment_token.clone(), - ) - .change_context(errors::ApiErrorResponse::MandateValidationFailed { - reason: "Expected one out of recurring_details and mandate_data but got both".into(), - })?; - - let m_helpers::MandateGenericData { - token, - payment_method, - payment_method_type, - mandate_data, - recurring_mandate_payment_data, - mandate_connector, - payment_method_info, - } = helpers::get_token_pm_type_mandate_details( - state, - request, - mandate_type.to_owned(), - merchant_account, - key_store, - None, - ) - .await?; helpers::validate_amount_to_capture_and_capture_method(Some(&payment_attempt), request)?; helpers::validate_request_amount_and_amount_to_capture( @@ -265,7 +252,7 @@ impl &request .payment_method_data .as_ref() - .and_then(|pmd| pmd.payment_method_data.clone()), + .map(|pmd| pmd.payment_method_data.clone()), &request.payment_method_type, &mandate_type, &token, @@ -291,7 +278,7 @@ impl }) .async_and_then(|mandate_id| async { let mandate = db - .find_mandate_by_merchant_id_mandate_id(merchant_id, mandate_id, merchant_account.storage_scheme) + .find_mandate_by_merchant_id_mandate_id(merchant_id, mandate_id) .await .change_context(errors::ApiErrorResponse::MandateNotFound); Some(mandate.and_then(|mandate_obj| { @@ -403,7 +390,7 @@ impl .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { id: profile_id.to_string(), })?; - + let customer_acceptance = request.customer_acceptance.clone().map(From::from); let surcharge_details = request.surcharge_details.map(|request_surcharge_details| { payments::types::SurchargeDetails::from((&request_surcharge_details, &payment_attempt)) }); @@ -430,7 +417,7 @@ impl payment_method_data: request .payment_method_data .as_ref() - .and_then(|pmd| pmd.payment_method_data.clone()), + .map(|pmd| pmd.payment_method_data.clone()), payment_method_info, force_sync: None, refunds: vec![], @@ -452,8 +439,7 @@ impl authorizations: vec![], authentication: None, frm_metadata: request.frm_metadata.clone(), - recurring_details, - poll_config: None, + recurring_details: request.recurring_details.clone(), }; let get_trackers_response = operations::GetTrackerResponse { @@ -461,7 +447,6 @@ impl customer_details: Some(customer_details), payment_data, business_profile, - mandate_type, }; Ok(get_trackers_response) @@ -479,7 +464,6 @@ impl Domain, request: Option, key_store: &domain::MerchantKeyStore, - storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, api::PaymentsRequest, Ctx>, @@ -494,7 +478,6 @@ impl Domain Domain, - storage_scheme: storage_enums::MerchantStorageScheme, + _storage_scheme: storage_enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, ) -> RouterResult<( @@ -518,7 +501,6 @@ impl Domain async fn update_trackers<'b>( &'b self, state: &'b AppState, - _req_state: ReqState, mut payment_data: PaymentData, customer: Option, storage_scheme: storage_enums::MerchantStorageScheme, @@ -593,20 +574,12 @@ impl storage_enums::AttemptStatus::ConfirmationAwaited } }; - let profile_id = payment_data - .payment_intent - .profile_id - .as_ref() - .get_required_value("profile_id") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("'profile_id' not set in payment intent")?; let additional_pm_data = payment_data .payment_method_data .as_ref() .async_map(|payment_method_data| async { - helpers::get_additional_payment_data(payment_method_data, &*state.store, profile_id) - .await + helpers::get_additional_payment_data(payment_method_data, &*state.store).await }) .await .as_ref() @@ -776,12 +749,11 @@ impl ValidateRequest ValidateRequest state: &'a AppState, payment_id: &api::PaymentIdType, request: &PaymentsIncrementalAuthorizationRequest, + _mandate_type: Option, merchant_account: &domain::MerchantAccount, _key_store: &domain::MerchantKeyStore, _auth_flow: services::AuthFlow, @@ -155,7 +153,6 @@ impl authentication: None, frm_metadata: None, recurring_details: None, - poll_config: None, }; let get_trackers_response = operations::GetTrackerResponse { @@ -163,7 +160,6 @@ impl customer_details: None, payment_data, business_profile, - mandate_type: None, }; Ok(get_trackers_response) @@ -179,7 +175,6 @@ impl async fn update_trackers<'b>( &'b self, db: &'b AppState, - _req_state: ReqState, mut payment_data: payments::PaymentData, _customer: Option, storage_scheme: enums::MerchantStorageScheme, @@ -280,6 +275,7 @@ impl operations::ValidateResult { merchant_id: &merchant_account.merchant_id, payment_id: api::PaymentIdType::PaymentIntentId(request.payment_id.to_owned()), + mandate_type: None, storage_scheme: merchant_account.storage_scheme, requeue: false, }, @@ -298,7 +294,6 @@ impl _payment_data: &mut payments::PaymentData, _request: Option, _merchant_key_store: &domain::MerchantKeyStore, - _storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, PaymentsIncrementalAuthorizationRequest, Ctx>, diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs index 58c58ffaef8..09400bb750b 100644 --- a/crates/router/src/core/payments/retry.rs +++ b/crates/router/src/core/payments/retry.rs @@ -19,13 +19,10 @@ use crate::{ }, }, db::StorageInterface, - routes::{ - self, - app::{self, ReqState}, - metrics, - }, - services, - types::{self, api, domain, storage}, + routes, + routes::{app, metrics}, + services, types, + types::{api, domain, storage}, utils, }; @@ -33,7 +30,6 @@ use crate::{ #[allow(clippy::too_many_arguments)] pub async fn do_gsm_actions( state: &app::AppState, - req_state: ReqState, payment_data: &mut payments::PaymentData, mut connectors: IntoIter, original_connector_data: api::ConnectorData, @@ -85,7 +81,6 @@ where if should_step_up { router_data = do_retry( &state.clone(), - req_state.clone(), original_connector_data, operation, customer, @@ -129,7 +124,6 @@ where router_data = do_retry( &state.clone(), - req_state.clone(), connector, operation, customer, @@ -269,7 +263,6 @@ fn get_flow_name() -> RouterResult { #[instrument(skip_all)] pub async fn do_retry( state: &routes::AppState, - req_state: ReqState, connector: api::ConnectorData, operation: &operations::BoxedOperation<'_, F, ApiRequest, Ctx>, customer: &Option, @@ -306,7 +299,6 @@ where payments::call_connector_service( state, - req_state, merchant_account, key_store, connector, @@ -384,7 +376,7 @@ where .connector_response_reference_id .clone(), authentication_type: None, - payment_method_id: payment_data.payment_attempt.payment_method_id.clone(), + payment_method_id: Some(router_data.payment_method_id), mandate_id: payment_data .mandate_id .clone() diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index ff7303c900d..e2502e2ecb6 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -171,10 +171,10 @@ where .customer_acceptance .clone() .map(|cat| match cat.acceptance_type { - hyperswitch_domain_models::mandates::AcceptanceType::Online => { + data_models::mandates::AcceptanceType::Online => { euclid_enums::MandateAcceptanceType::Online } - hyperswitch_domain_models::mandates::AcceptanceType::Offline => { + data_models::mandates::AcceptanceType::Offline => { euclid_enums::MandateAcceptanceType::Offline } }) @@ -184,10 +184,10 @@ where .as_ref() .and_then(|mandate_data| { mandate_data.mandate_type.clone().map(|mt| match mt { - hyperswitch_domain_models::mandates::MandateDataType::SingleUse(_) => { + data_models::mandates::MandateDataType::SingleUse(_) => { euclid_enums::MandateType::SingleUse } - hyperswitch_domain_models::mandates::MandateDataType::MultiUse(_) => { + data_models::mandates::MandateDataType::MultiUse(_) => { euclid_enums::MandateType::MultiUse } }) diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs index 304e6edd62e..10e39b2d1b9 100644 --- a/crates/router/src/core/payments/tokenization.rs +++ b/crates/router/src/core/payments/tokenization.rs @@ -29,97 +29,36 @@ use crate::{ utils::{generate_id, OptionExt}, }; -pub struct SavePaymentMethodData { - request: Req, - response: Result, - payment_method_token: Option, - payment_method: PaymentMethod, - attempt_status: common_enums::AttemptStatus, -} - -impl From<&types::RouterData> - for SavePaymentMethodData -{ - fn from(router_data: &types::RouterData) -> Self { - Self { - request: router_data.request.clone(), - response: router_data.response.clone(), - payment_method_token: router_data.payment_method_token.clone(), - payment_method: router_data.payment_method, - attempt_status: router_data.status, - } - } -} - #[instrument(skip_all)] #[allow(clippy::too_many_arguments)] -pub async fn save_payment_method( +pub async fn save_payment_method( state: &AppState, - connector_name: String, - merchant_connector_id: Option, - save_payment_method_data: SavePaymentMethodData, - customer_id: Option, + connector: &api::ConnectorData, + resp: types::RouterData, + maybe_customer: &Option, merchant_account: &domain::MerchantAccount, payment_method_type: Option, key_store: &domain::MerchantKeyStore, amount: Option, currency: Option, - profile_id: Option, - billing_name: Option>, ) -> RouterResult<(Option, Option)> where - FData: mandate::MandateBehaviour + Clone, + FData: mandate::MandateBehaviour, { let mut pm_status = None; - match save_payment_method_data.response { + match resp.response { Ok(responses) => { let db = &*state.store; let token_store = state .conf .tokenization .0 - .get(&connector_name.to_string()) + .get(&connector.connector_name.to_string()) .map(|token_filter| token_filter.long_lived_token) .unwrap_or(false); - let network_transaction_id = match &responses { - types::PaymentsResponseData::TransactionResponse { network_txn_id, .. } => { - network_txn_id.clone() - } - _ => None, - }; - - let network_transaction_id = - if let Some(network_transaction_id) = network_transaction_id { - let profile_id = profile_id - .as_ref() - .ok_or(errors::ApiErrorResponse::ResourceIdNotFound)?; - - let pg_agnostic = state - .store - .find_config_by_key_unwrap_or( - &format!("pg_agnostic_mandate_{}", profile_id), - Some("false".to_string()), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("The pg_agnostic config was not found in the DB")?; - - if &pg_agnostic.config == "true" - && save_payment_method_data.request.get_setup_future_usage() - == Some(storage_enums::FutureUsage::OffSession) - { - Some(network_transaction_id) - } else { - logger::info!("Skip storing network transaction id"); - None - } - } else { - None - }; - let connector_token = if token_store { - let tokens = save_payment_method_data + let tokens = resp .payment_method_token .to_owned() .get_required_value("payment_token")?; @@ -131,17 +70,17 @@ where })? } }; - Some((connector_name, token)) + Some((connector, token)) } else { None }; - let mandate_data_customer_acceptance = save_payment_method_data + let mandate_data_customer_acceptance = resp .request .get_setup_mandate_details() .and_then(|mandate_data| mandate_data.customer_acceptance.clone()); - let customer_acceptance = save_payment_method_data + let customer_acceptance = resp .request .get_customer_acceptance() .or(mandate_data_customer_acceptance.clone().map(From::from)) @@ -150,36 +89,19 @@ where .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unable to serialize customer acceptance to value")?; - let connector_mandate_id = match responses { - types::PaymentsResponseData::TransactionResponse { - ref mandate_reference, - .. - } => { - if let Some(mandate_ref) = mandate_reference { - mandate_ref.connector_mandate_id.clone() - } else { - None - } - } - _ => None, - }; - let check_for_mit_mandates = save_payment_method_data - .request - .get_setup_mandate_details() - .is_none() - && save_payment_method_data + let connector_mandate_details = if resp.request.get_setup_mandate_details().is_none() + && resp .request .get_setup_future_usage() .map(|future_usage| future_usage == storage_enums::FutureUsage::OffSession) - .unwrap_or(false); - // insert in PaymentMethods if its a off-session mit payment - let connector_mandate_details = if check_for_mit_mandates { + .unwrap_or(false) + { add_connector_mandate_details_in_payment_method( + responses, payment_method_type, amount, currency, - merchant_connector_id.clone(), - connector_mandate_id.clone(), + connector, ) } else { None @@ -190,16 +112,16 @@ where .attach_printable("Unable to serialize customer acceptance to value")?; let pm_id = if customer_acceptance.is_some() { + let customer = maybe_customer.to_owned().get_required_value("customer")?; let payment_method_create_request = helpers::get_payment_method_create_request( - Some(&save_payment_method_data.request.get_payment_method_data()), - Some(save_payment_method_data.payment_method), + Some(&resp.request.get_payment_method_data()), + Some(resp.payment_method), payment_method_type, - &customer_id.clone(), - billing_name, + &customer, ) .await?; - let customer_id = customer_id.to_owned().get_required_value("customer_id")?; let merchant_id = &merchant_account.merchant_id; + let (mut resp, duplication_check) = if !state.conf.locker.locker_enabled { skip_saving_card_in_locker( merchant_account, @@ -207,9 +129,7 @@ where ) .await? } else { - pm_status = Some(common_enums::PaymentMethodStatus::from( - save_payment_method_data.attempt_status, - )); + pm_status = Some(common_enums::PaymentMethodStatus::from(resp.status)); Box::pin(save_in_locker( state, merchant_account, @@ -238,21 +158,14 @@ where Some(duplication_check) => match duplication_check { payment_methods::transformers::DataDuplicationCheck::Duplicated => { let payment_method = { - let existing_pm_by_pmid = db - .find_payment_method( - &payment_method_id, - merchant_account.storage_scheme, - ) - .await; + let existing_pm_by_pmid = + db.find_payment_method(&payment_method_id).await; if let Err(err) = existing_pm_by_pmid { if err.current_context().is_db_not_found() { locker_id = Some(payment_method_id.clone()); let existing_pm_by_locker_id = db - .find_payment_method_by_locker_id( - &payment_method_id, - merchant_account.storage_scheme, - ) + .find_payment_method_by_locker_id(&payment_method_id) .await; match &existing_pm_by_locker_id { @@ -283,10 +196,7 @@ where )?; if let Some(metadata) = pm_metadata { payment_methods::cards::update_payment_method( - db, - pm.clone(), - metadata, - merchant_account.storage_scheme, + db, pm, metadata, ) .await .change_context( @@ -294,23 +204,6 @@ where ) .attach_printable("Failed to add payment method in db")?; }; - // update if its a off-session mit payment - if check_for_mit_mandates { - let connector_mandate_details = - update_connector_mandate_details_in_payment_method( - pm.clone(), - payment_method_type, - amount, - currency, - merchant_connector_id.clone(), - connector_mandate_id.clone(), - )?; - - payment_methods::cards::update_payment_method_connector_mandate_details(db, pm, connector_mandate_details, merchant_account.storage_scheme).await.change_context( - errors::ApiErrorResponse::InternalServerError, - ) - .attach_printable("Failed to update payment method in db")?; - } } Err(err) => { if err.current_context().is_db_not_found() { @@ -319,7 +212,7 @@ where payment_methods::cards::create_payment_method( db, &payment_method_create_request, - customer_id.as_str(), + &customer.customer_id, &resp.payment_method_id, locker_id, merchant_id, @@ -328,9 +221,6 @@ where pm_data_encrypted, key_store, connector_mandate_details, - None, - network_transaction_id, - merchant_account.storage_scheme, ) .await } else { @@ -346,12 +236,8 @@ where payment_methods::transformers::DataDuplicationCheck::MetaDataChanged => { if let Some(card) = payment_method_create_request.card.clone() { let payment_method = { - let existing_pm_by_pmid = db - .find_payment_method( - &payment_method_id, - merchant_account.storage_scheme, - ) - .await; + let existing_pm_by_pmid = + db.find_payment_method(&payment_method_id).await; if let Err(err) = existing_pm_by_pmid { if err.current_context().is_db_not_found() { @@ -359,7 +245,6 @@ where let existing_pm_by_locker_id = db .find_payment_method_by_locker_id( &payment_method_id, - merchant_account.storage_scheme, ) .await; @@ -383,59 +268,35 @@ where resp.payment_method_id = payment_method_id; - let existing_pm = match payment_method { - Ok(pm) => { - // update if its a off-session mit payment - if check_for_mit_mandates { - let connector_mandate_details = - update_connector_mandate_details_in_payment_method( - pm.clone(), - payment_method_type, - amount, - currency, - merchant_connector_id.clone(), - connector_mandate_id.clone(), - )?; - - payment_methods::cards::update_payment_method_connector_mandate_details(db, pm.clone(), connector_mandate_details, merchant_account.storage_scheme).await.change_context( - errors::ApiErrorResponse::InternalServerError, - ) - .attach_printable("Failed to update payment method in db")?; - } - Ok(pm) - } - Err(err) => { - if err.current_context().is_db_not_found() { - payment_methods::cards::insert_payment_method( - db, - &resp, - payment_method_create_request.clone(), - key_store, - &merchant_account.merchant_id, - customer_id.as_str(), - resp.metadata.clone().map(|val| val.expose()), - customer_acceptance, - locker_id, - connector_mandate_details, - network_transaction_id, - merchant_account.storage_scheme, - ) - .await - } else { - Err(err) - .change_context( - errors::ApiErrorResponse::InternalServerError, - ) - .attach_printable( - "Error while finding payment method", + let existing_pm = + match payment_method { + Ok(pm) => Ok(pm), + Err(err) => { + if err.current_context().is_db_not_found() { + payment_methods::cards::insert_payment_method( + db, + &resp, + payment_method_create_request.clone(), + key_store, + &merchant_account.merchant_id, + &customer.customer_id, + resp.metadata.clone().map(|val| val.expose()), + customer_acceptance, + locker_id, + connector_mandate_details, ) + .await + } else { + Err(err) + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Error while finding payment method") + } } - } - }?; + }?; payment_methods::cards::delete_card_from_locker( state, - customer_id.as_str(), + &customer.customer_id, merchant_id, existing_pm .locker_id @@ -448,7 +309,7 @@ where state, payment_method_create_request, &card, - customer_id.clone(), + customer.customer_id.clone(), merchant_account, api::enums::LockerChoice::HyperswitchCardVault, Some( @@ -512,33 +373,27 @@ where payment_method_data: pm_data_encrypted, }; - db.update_payment_method( - existing_pm, - pm_update, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to add payment method in db")?; + db.update_payment_method(existing_pm, pm_update) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed to add payment method in db")?; } } }, None => { let pm_metadata = create_payment_method_metadata(None, connector_token)?; - locker_id = resp.payment_method.and_then(|pm| { - if pm == PaymentMethod::Card { - Some(resp.payment_method_id) - } else { - None - } - }); + locker_id = if resp.payment_method == PaymentMethod::Card { + Some(resp.payment_method_id) + } else { + None + }; resp.payment_method_id = generate_id(consts::ID_LENGTH, "pm"); payment_methods::cards::create_payment_method( db, &payment_method_create_request, - customer_id.as_str(), + &customer.customer_id, &resp.payment_method_id, locker_id, merchant_id, @@ -547,9 +402,6 @@ where pm_data_encrypted, key_store, connector_mandate_details, - None, - network_transaction_id, - merchant_account.storage_scheme, ) .await?; } @@ -588,7 +440,7 @@ async fn skip_saving_card_in_locker( let card_isin = payment_method_request .card .clone() - .map(|c| c.card_number.get_card_isin()); + .map(|c: api_models::payment_methods::CardDetail| c.card_number.get_card_isin()); match payment_method_request.card.clone() { Some(card) => { @@ -624,7 +476,6 @@ async fn skip_saving_card_in_locker( #[cfg(feature = "payouts")] bank_transfer: None, last_used_at: Some(common_utils::date_time::now()), - client_secret: None, }; Ok((pm_resp, None)) @@ -646,7 +497,6 @@ async fn skip_saving_card_in_locker( #[cfg(feature = "payouts")] bank_transfer: None, last_used_at: Some(common_utils::date_time::now()), - client_secret: None, }; Ok((payment_method_response, None)) } @@ -674,7 +524,6 @@ pub async fn save_in_locker( &card, &customer_id, merchant_account, - None, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) @@ -696,7 +545,6 @@ pub async fn save_in_locker( installment_payment_enabled: false, //[#219] payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), //[#219] last_used_at: Some(common_utils::date_time::now()), - client_secret: None, }; Ok((payment_method_response, None)) } @@ -705,7 +553,7 @@ pub async fn save_in_locker( pub fn create_payment_method_metadata( metadata: Option<&pii::SecretSerdeValue>, - connector_token: Option<(String, String)>, + connector_token: Option<(&api::ConnectorData, String)>, ) -> RouterResult> { let mut meta = match metadata { None => serde_json::Map::new(), @@ -720,7 +568,7 @@ pub fn create_payment_method_metadata( }; Ok(connector_token.and_then(|connector_and_token| { meta.insert( - connector_and_token.0, + connector_and_token.0.connector_name.to_string(), serde_json::Value::String(connector_and_token.1), ) })) @@ -809,17 +657,32 @@ pub async fn add_payment_method_token( } } -pub fn add_connector_mandate_details_in_payment_method( +fn add_connector_mandate_details_in_payment_method( + resp: types::PaymentsResponseData, payment_method_type: Option, authorized_amount: Option, authorized_currency: Option, - merchant_connector_id: Option, - connector_mandate_id: Option, + connector: &api::ConnectorData, ) -> Option { let mut mandate_details = HashMap::new(); - if let Some((mca_id, connector_mandate_id)) = - merchant_connector_id.clone().zip(connector_mandate_id) + let connector_mandate_id = match resp { + types::PaymentsResponseData::TransactionResponse { + mandate_reference, .. + } => { + if let Some(mandate_ref) = mandate_reference { + mandate_ref.connector_mandate_id.clone() + } else { + None + } + } + _ => None, + }; + + if let Some((mca_id, connector_mandate_id)) = connector + .merchant_connector_id + .clone() + .zip(connector_mandate_id) { mandate_details.insert( mca_id, @@ -835,64 +698,3 @@ pub fn add_connector_mandate_details_in_payment_method( None } } - -pub fn update_connector_mandate_details_in_payment_method( - payment_method: diesel_models::PaymentMethod, - payment_method_type: Option, - authorized_amount: Option, - authorized_currency: Option, - merchant_connector_id: Option, - connector_mandate_id: Option, -) -> RouterResult> { - let mandate_reference = match payment_method.connector_mandate_details { - Some(_) => { - let mandate_details = payment_method - .connector_mandate_details - .map(|val| { - val.parse_value::("PaymentsMandateReference") - }) - .transpose() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to deserialize to Payment Mandate Reference ")?; - - if let Some((mca_id, connector_mandate_id)) = - merchant_connector_id.clone().zip(connector_mandate_id) - { - let updated_record = storage::PaymentsMandateReferenceRecord { - connector_mandate_id: connector_mandate_id.clone(), - payment_method_type, - original_payment_authorized_amount: authorized_amount, - original_payment_authorized_currency: authorized_currency, - }; - mandate_details.map(|mut payment_mandate_reference| { - payment_mandate_reference - .entry(mca_id) - .and_modify(|pm| *pm = updated_record) - .or_insert(storage::PaymentsMandateReferenceRecord { - connector_mandate_id, - payment_method_type, - original_payment_authorized_amount: authorized_amount, - original_payment_authorized_currency: authorized_currency, - }); - payment_mandate_reference - }) - } else { - None - } - } - None => add_connector_mandate_details_in_payment_method( - payment_method_type, - authorized_amount, - authorized_currency, - merchant_connector_id, - connector_mandate_id, - ), - }; - let connector_mandate_details = mandate_reference - .map(|mand| mand.encode_to_value()) - .transpose() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Unable to serialize customer acceptance to value")?; - - Ok(connector_mandate_details) -} diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index d459f632d8f..d686d741c88 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -1,6 +1,6 @@ use std::{fmt::Debug, marker::PhantomData, str::FromStr}; -use api_models::payments::{FrmMessage, GetAddressFromPaymentMethodData, RequestSurchargeDetails}; +use api_models::payments::{FrmMessage, RequestSurchargeDetails}; #[cfg(feature = "payouts")] use api_models::payouts::PayoutAttemptResponse; use common_enums::RequestIncrementalAuthorization; @@ -53,7 +53,7 @@ where Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled) })?; - let test_mode = merchant_connector_account.is_test_mode_on(); + let test_mode: Option = merchant_connector_account.is_test_mode_on(); let auth_type: types::ConnectorAuthType = merchant_connector_account .get_connector_account_details() @@ -124,11 +124,6 @@ where Some(merchant_connector_account), ); - let payment_method_data_billing = payment_data - .payment_method_data - .as_ref() - .and_then(|payment_method_data| payment_method_data.get_billing_address()); - router_data = types::RouterData { flow: PhantomData, merchant_id: merchant_account.merchant_id.clone(), @@ -141,9 +136,8 @@ where connector_auth_type: auth_type, description: payment_data.payment_intent.description.clone(), return_url: payment_data.payment_intent.return_url.clone(), - address: payment_data - .address - .unify_with_payment_method_data_billing(payment_method_data_billing), + payment_method_id: payment_data.payment_attempt.payment_method_id.clone(), + address: payment_data.address.clone(), auth_type: payment_data .payment_attempt .authentication_type @@ -184,13 +178,14 @@ where Ok(router_data) } -pub trait ToResponse +pub trait ToResponse where Self: Sized, Op: Debug, { #[allow(clippy::too_many_arguments)] fn generate_response( + req: Option, data: D, customer: Option, auth_flow: services::AuthFlow, @@ -203,13 +198,14 @@ where ) -> RouterResponse; } -impl ToResponse, Op> for api::PaymentsResponse +impl ToResponse, Op> for api::PaymentsResponse where F: Clone, Op: Debug, { #[allow(clippy::too_many_arguments)] fn generate_response( + req: Option, payment_data: PaymentData, customer: Option, auth_flow: services::AuthFlow, @@ -239,6 +235,7 @@ where }); payments_to_payments_response( + req, payment_data, captures, customer, @@ -253,13 +250,15 @@ where } } -impl ToResponse, Op> for api::PaymentsSessionResponse +impl ToResponse, Op> for api::PaymentsSessionResponse where + Self: From, F: Clone, Op: Debug, { #[allow(clippy::too_many_arguments)] fn generate_response( + _req: Option, payment_data: PaymentData, _customer: Option, _auth_flow: services::AuthFlow, @@ -285,13 +284,15 @@ where } } -impl ToResponse, Op> for api::VerifyResponse +impl ToResponse, Op> for api::VerifyResponse where + Self: From, F: Clone, Op: Debug, { #[allow(clippy::too_many_arguments)] fn generate_response( + _req: Option, data: PaymentData, customer: Option, _auth_flow: services::AuthFlow, @@ -346,7 +347,8 @@ where // try to use router data here so that already validated things , we don't want to repeat the validations. // Add internal value not found and external value not found so that we can give 500 / Internal server error for internal value not found #[allow(clippy::too_many_arguments)] -pub fn payments_to_payments_response( +pub fn payments_to_payments_response( + payment_request: Option, payment_data: PaymentData, captures: Option>, customer: Option, @@ -488,8 +490,6 @@ where )) } - let customer_details_response = customer.as_ref().map(ForeignInto::foreign_into); - headers.extend( external_latency .map(|latency| { @@ -501,42 +501,44 @@ where .unwrap_or_default(), ); - let output = if payments::is_start_pay(&operation) - && payment_attempt.authentication_data.is_some() - { - let redirection_data = payment_attempt - .authentication_data - .get_required_value("redirection_data")?; - - let form: RedirectForm = serde_json::from_value(redirection_data) - .map_err(|_| errors::ApiErrorResponse::InternalServerError)?; - - services::ApplicationResponse::Form(Box::new(services::RedirectionFormData { - redirect_form: form, - payment_method_data: payment_data.payment_method_data, - amount, - currency: currency.to_string(), - })) - } else { - let mut next_action_response = None; + let output = Ok(match payment_request { + Some(_request) => { + if payments::is_start_pay(&operation) && payment_attempt.authentication_data.is_some() { + let redirection_data = payment_attempt + .authentication_data + .get_required_value("redirection_data")?; + + let form: RedirectForm = serde_json::from_value(redirection_data) + .map_err(|_| errors::ApiErrorResponse::InternalServerError)?; + + services::ApplicationResponse::Form(Box::new(services::RedirectionFormData { + redirect_form: form, + payment_method_data: payment_data.payment_method_data, + amount, + currency: currency.to_string(), + })) + } else { + let mut next_action_response = None; - let bank_transfer_next_steps = bank_transfer_next_steps_check(payment_attempt.clone())?; + let bank_transfer_next_steps = + bank_transfer_next_steps_check(payment_attempt.clone())?; - let next_action_voucher = voucher_next_steps_check(payment_attempt.clone())?; + let next_action_voucher = voucher_next_steps_check(payment_attempt.clone())?; - let next_action_containing_qr_code_url = qr_code_next_steps_check(payment_attempt.clone())?; + let next_action_containing_qr_code_url = + qr_code_next_steps_check(payment_attempt.clone())?; - let next_action_containing_wait_screen = - wait_screen_next_steps_check(payment_attempt.clone())?; + let next_action_containing_wait_screen = + wait_screen_next_steps_check(payment_attempt.clone())?; - if payment_intent.status == enums::IntentStatus::RequiresCustomerAction - || bank_transfer_next_steps.is_some() - || next_action_voucher.is_some() - || next_action_containing_qr_code_url.is_some() - || next_action_containing_wait_screen.is_some() - || payment_data.authentication.is_some() - { - next_action_response = bank_transfer_next_steps + if payment_intent.status == enums::IntentStatus::RequiresCustomerAction + || bank_transfer_next_steps.is_some() + || next_action_voucher.is_some() + || next_action_containing_qr_code_url.is_some() + || next_action_containing_wait_screen.is_some() + || payment_data.authentication.is_some() + { + next_action_response = bank_transfer_next_steps .map(|bank_transfer| { api_models::payments::NextActionData::DisplayBankTransferInformation { bank_transfer_steps_and_charges_details: bank_transfer, @@ -569,8 +571,6 @@ where Some(authentication) => { if payment_intent.status == common_enums::IntentStatus::RequiresCustomerAction && authentication.cavv.is_none() && authentication.is_separate_authn_required(){ // if preAuthn and separate authentication needed. - let poll_config = payment_data.poll_config.unwrap_or_default(); - let request_poll_id = core_utils::get_external_authentication_request_poll_id(&payment_intent.payment_id); let payment_connector_name = payment_attempt.connector .as_ref() .get_required_value("connector")?; @@ -593,7 +593,6 @@ where three_ds_method_data: None, three_ds_method_url: None, }), - poll_config: api_models::payments::PollConfigResponse {poll_id: request_poll_id, delay_in_secs: poll_config.delay_in_secs, frequency: poll_config.frequency}, }, }) }else{ @@ -602,184 +601,259 @@ where }, None => None }); - }; - - // next action check for third party sdk session (for ex: Apple pay through trustpay has third party sdk session response) - if third_party_sdk_session_next_action(&payment_attempt, operation) { - next_action_response = Some( - api_models::payments::NextActionData::ThirdPartySdkSessionToken { - session_token: payment_data.sessions_token.first().cloned(), - }, - ) - } + }; - let mut response: api::PaymentsResponse = Default::default(); - let routed_through = payment_attempt.connector.clone(); + // next action check for third party sdk session (for ex: Apple pay through trustpay has third party sdk session response) + if third_party_sdk_session_next_action(&payment_attempt, operation) { + next_action_response = Some( + api_models::payments::NextActionData::ThirdPartySdkSessionToken { + session_token: payment_data.sessions_token.first().cloned(), + }, + ) + } - let connector_label = routed_through.as_ref().and_then(|connector_name| { - core_utils::get_connector_label( - payment_intent.business_country, - payment_intent.business_label.as_ref(), - payment_attempt.business_sub_label.as_ref(), - connector_name, - ) - }); + let mut response: api::PaymentsResponse = Default::default(); + let routed_through = payment_attempt.connector.clone(); - services::ApplicationResponse::JsonWithHeaders(( - response - .set_net_amount(payment_attempt.net_amount) - .set_payment_id(Some(payment_attempt.payment_id)) - .set_merchant_id(Some(payment_attempt.merchant_id)) - .set_status(payment_intent.status) - .set_amount(payment_attempt.amount) - .set_amount_capturable(Some(payment_attempt.amount_capturable)) - .set_amount_received(payment_intent.amount_captured) - .set_surcharge_details(surcharge_details) - .set_connector(routed_through) - .set_client_secret(payment_intent.client_secret.map(masking::Secret::new)) - .set_created(Some(payment_intent.created_at)) - .set_currency(currency.to_string()) - .set_customer_id(customer.as_ref().map(|cus| cus.clone().customer_id)) - .set_email( - customer - .as_ref() - .and_then(|cus| cus.email.as_ref().map(|s| s.to_owned())), - ) - .set_name( - customer - .as_ref() - .and_then(|cus| cus.name.as_ref().map(|s| s.to_owned())), - ) - .set_phone( - customer - .as_ref() - .and_then(|cus| cus.phone.as_ref().map(|s| s.to_owned())), - ) - .set_mandate_id(mandate_id) - .set_mandate_data( - payment_data.setup_mandate.map(|d| api::MandateData { - customer_acceptance: d.customer_acceptance.map(|d| { - api::CustomerAcceptance { - acceptance_type: match d.acceptance_type { - hyperswitch_domain_models::mandates::AcceptanceType::Online => { - api::AcceptanceType::Online + let connector_label = routed_through.as_ref().and_then(|connector_name| { + core_utils::get_connector_label( + payment_intent.business_country, + payment_intent.business_label.as_ref(), + payment_attempt.business_sub_label.as_ref(), + connector_name, + ) + }); + services::ApplicationResponse::JsonWithHeaders(( + response + .set_net_amount(payment_attempt.net_amount) + .set_payment_id(Some(payment_attempt.payment_id)) + .set_merchant_id(Some(payment_attempt.merchant_id)) + .set_status(payment_intent.status) + .set_amount(payment_attempt.amount) + .set_amount_capturable(Some(payment_attempt.amount_capturable)) + .set_amount_received(payment_intent.amount_captured) + .set_surcharge_details(surcharge_details) + .set_connector(routed_through) + .set_client_secret(payment_intent.client_secret.map(masking::Secret::new)) + .set_created(Some(payment_intent.created_at)) + .set_currency(currency.to_string()) + .set_customer_id(customer.as_ref().map(|cus| cus.clone().customer_id)) + .set_email( + customer + .as_ref() + .and_then(|cus| cus.email.as_ref().map(|s| s.to_owned())), + ) + .set_name( + customer + .as_ref() + .and_then(|cus| cus.name.as_ref().map(|s| s.to_owned())), + ) + .set_phone( + customer + .as_ref() + .and_then(|cus| cus.phone.as_ref().map(|s| s.to_owned())), + ) + .set_mandate_id(mandate_id) + .set_mandate_data( + payment_data.setup_mandate.map(|d| api::MandateData { + customer_acceptance: d.customer_acceptance.map(|d| { + api::CustomerAcceptance { + acceptance_type: match d.acceptance_type { + data_models::mandates::AcceptanceType::Online => { + api::AcceptanceType::Online + } + data_models::mandates::AcceptanceType::Offline => { + api::AcceptanceType::Offline + } + }, + accepted_at: d.accepted_at, + online: d.online.map(|d| api::OnlineMandate { + ip_address: d.ip_address, + user_agent: d.user_agent, + }), } - hyperswitch_domain_models::mandates::AcceptanceType::Offline => { - api::AcceptanceType::Offline + }), + mandate_type: d.mandate_type.map(|d| match d { + data_models::mandates::MandateDataType::MultiUse(Some(i)) => { + api::MandateType::MultiUse(Some(api::MandateAmountData { + amount: i.amount, + currency: i.currency, + start_date: i.start_date, + end_date: i.end_date, + metadata: i.metadata, + })) + } + data_models::mandates::MandateDataType::SingleUse(i) => { + api::MandateType::SingleUse( + api::payments::MandateAmountData { + amount: i.amount, + currency: i.currency, + start_date: i.start_date, + end_date: i.end_date, + metadata: i.metadata, + }, + ) + } + data_models::mandates::MandateDataType::MultiUse(None) => { + api::MandateType::MultiUse(None) } - }, - accepted_at: d.accepted_at, - online: d.online.map(|d| api::OnlineMandate { - ip_address: d.ip_address, - user_agent: d.user_agent, }), - } - }), - mandate_type: d.mandate_type.map(|d| match d { - hyperswitch_domain_models::mandates::MandateDataType::MultiUse(Some(i)) => { - api::MandateType::MultiUse(Some(api::MandateAmountData { - amount: i.amount, - currency: i.currency, - start_date: i.start_date, - end_date: i.end_date, - metadata: i.metadata, - })) - } - hyperswitch_domain_models::mandates::MandateDataType::SingleUse(i) => { - api::MandateType::SingleUse(api::payments::MandateAmountData { - amount: i.amount, - currency: i.currency, - start_date: i.start_date, - end_date: i.end_date, - metadata: i.metadata, - }) - } - hyperswitch_domain_models::mandates::MandateDataType::MultiUse(None) => { - api::MandateType::MultiUse(None) - } - }), - update_mandate_id: d.update_mandate_id, - }), - auth_flow == services::AuthFlow::Merchant, - ) - .set_description(payment_intent.description) - .set_refunds(refunds_response) // refunds.iter().map(refund_to_refund_response), - .set_disputes(disputes_response) - .set_attempts(attempts_response) - .set_captures(captures_response) - .set_payment_method( - payment_attempt.payment_method, - auth_flow == services::AuthFlow::Merchant, - ) - .set_payment_method_data( - payment_method_data_response, - auth_flow == services::AuthFlow::Merchant, - ) - .set_payment_token(payment_attempt.payment_token) - .set_error_message( - payment_attempt - .error_reason - .or(payment_attempt.error_message), - ) - .set_error_code(payment_attempt.error_code) - .set_shipping(payment_data.address.get_shipping().cloned()) - .set_billing(payment_data.address.get_payment_billing().cloned()) - .set_next_action(next_action_response) - .set_return_url(payment_intent.return_url) - .set_cancellation_reason(payment_attempt.cancellation_reason) - .set_authentication_type(payment_attempt.authentication_type) - .set_statement_descriptor_name(payment_intent.statement_descriptor_name) - .set_statement_descriptor_suffix(payment_intent.statement_descriptor_suffix) - .set_setup_future_usage(payment_intent.setup_future_usage) - .set_capture_method(payment_attempt.capture_method) - .set_payment_experience(payment_attempt.payment_experience) - .set_payment_method_type(payment_attempt.payment_method_type) - .set_metadata(payment_intent.metadata) - .set_order_details(payment_intent.order_details) - .set_connector_label(connector_label) - .set_business_country(payment_intent.business_country) - .set_business_label(payment_intent.business_label) - .set_business_sub_label(payment_attempt.business_sub_label) - .set_allowed_payment_method_types(payment_intent.allowed_payment_method_types) - .set_ephemeral_key(payment_data.ephemeral_key.map(ForeignFrom::foreign_from)) - .set_frm_message(frm_message) - .set_merchant_decision(merchant_decision) - .set_manual_retry_allowed(helpers::is_manual_retry_allowed( + update_mandate_id: d.update_mandate_id, + }), + auth_flow == services::AuthFlow::Merchant, + ) + .set_description(payment_intent.description) + .set_refunds(refunds_response) // refunds.iter().map(refund_to_refund_response), + .set_disputes(disputes_response) + .set_attempts(attempts_response) + .set_captures(captures_response) + .set_payment_method( + payment_attempt.payment_method, + auth_flow == services::AuthFlow::Merchant, + ) + .set_payment_method_data( + payment_method_data_response, + auth_flow == services::AuthFlow::Merchant, + ) + .set_payment_token(payment_attempt.payment_token) + .set_error_message( + payment_attempt + .error_reason + .or(payment_attempt.error_message), + ) + .set_error_code(payment_attempt.error_code) + .set_shipping(payment_data.address.get_shipping().cloned()) + .set_billing(payment_data.address.get_payment_billing().cloned()) + .set_next_action(next_action_response) + .set_return_url(payment_intent.return_url) + .set_cancellation_reason(payment_attempt.cancellation_reason) + .set_authentication_type(payment_attempt.authentication_type) + .set_statement_descriptor_name(payment_intent.statement_descriptor_name) + .set_statement_descriptor_suffix(payment_intent.statement_descriptor_suffix) + .set_setup_future_usage(payment_intent.setup_future_usage) + .set_capture_method(payment_attempt.capture_method) + .set_payment_experience(payment_attempt.payment_experience) + .set_payment_method_type(payment_attempt.payment_method_type) + .set_metadata(payment_intent.metadata) + .set_order_details(payment_intent.order_details) + .set_connector_label(connector_label) + .set_business_country(payment_intent.business_country) + .set_business_label(payment_intent.business_label) + .set_business_sub_label(payment_attempt.business_sub_label) + .set_allowed_payment_method_types( + payment_intent.allowed_payment_method_types, + ) + .set_ephemeral_key( + payment_data.ephemeral_key.map(ForeignFrom::foreign_from), + ) + .set_frm_message(frm_message) + .set_merchant_decision(merchant_decision) + .set_manual_retry_allowed(helpers::is_manual_retry_allowed( + &payment_intent.status, + &payment_attempt.status, + connector_request_reference_id_config, + &merchant_id, + )) + .set_connector_transaction_id(payment_attempt.connector_transaction_id) + .set_feature_metadata(payment_intent.feature_metadata) + .set_connector_metadata(payment_intent.connector_metadata) + .set_reference_id(payment_attempt.connector_response_reference_id) + .set_payment_link(payment_link_data) + .set_profile_id(payment_intent.profile_id) + .set_attempt_count(payment_intent.attempt_count) + .set_merchant_connector_id(payment_attempt.merchant_connector_id) + .set_unified_code(payment_attempt.unified_code) + .set_unified_message(payment_attempt.unified_message) + .set_incremental_authorization_allowed( + payment_intent.incremental_authorization_allowed, + ) + .set_external_authentication_details(external_authentication_details) + .set_fingerprint(payment_intent.fingerprint_id) + .set_authorization_count(payment_intent.authorization_count) + .set_incremental_authorizations(incremental_authorizations_response) + .set_expires_on(payment_intent.session_expiry) + .set_external_3ds_authentication_attempted( + payment_attempt.external_three_ds_authentication_attempted, + ) + .set_payment_method_id(payment_attempt.payment_method_id) + .set_payment_method_status( + payment_data.payment_method_info.map(|info| info.status), + ) + .to_owned(), + headers, + )) + } + } + None => services::ApplicationResponse::JsonWithHeaders(( + api::PaymentsResponse { + net_amount: payment_attempt.net_amount, + payment_id: Some(payment_attempt.payment_id), + merchant_id: Some(payment_attempt.merchant_id), + status: payment_intent.status, + amount: payment_attempt.amount, + amount_capturable: None, + amount_received: payment_intent.amount_captured, + client_secret: payment_intent.client_secret.map(masking::Secret::new), + created: Some(payment_intent.created_at), + currency: currency.to_string(), + customer_id: payment_intent.customer_id, + description: payment_intent.description, + refunds: refunds_response, + disputes: disputes_response, + attempts: attempts_response, + captures: captures_response, + payment_method: payment_attempt.payment_method, + capture_method: payment_attempt.capture_method, + error_message: payment_attempt + .error_reason + .or(payment_attempt.error_message), + error_code: payment_attempt.error_code, + payment_method_data: payment_method_data_response, + email: customer + .as_ref() + .and_then(|cus| cus.email.as_ref().map(|s| s.to_owned())), + name: customer + .as_ref() + .and_then(|cus| cus.name.as_ref().map(|s| s.to_owned())), + phone: customer + .as_ref() + .and_then(|cus| cus.phone.as_ref().map(|s| s.to_owned())), + mandate_id, + shipping: payment_data.address.get_shipping().cloned(), + billing: payment_data.address.get_payment_billing().cloned(), + cancellation_reason: payment_attempt.cancellation_reason, + payment_token: payment_attempt.payment_token, + metadata: payment_intent.metadata, + manual_retry_allowed: helpers::is_manual_retry_allowed( &payment_intent.status, &payment_attempt.status, connector_request_reference_id_config, &merchant_id, - )) - .set_connector_transaction_id(payment_attempt.connector_transaction_id) - .set_feature_metadata(payment_intent.feature_metadata) - .set_connector_metadata(payment_intent.connector_metadata) - .set_reference_id(payment_attempt.connector_response_reference_id) - .set_payment_link(payment_link_data) - .set_profile_id(payment_intent.profile_id) - .set_attempt_count(payment_intent.attempt_count) - .set_merchant_connector_id(payment_attempt.merchant_connector_id) - .set_unified_code(payment_attempt.unified_code) - .set_unified_message(payment_attempt.unified_message) - .set_incremental_authorization_allowed( - payment_intent.incremental_authorization_allowed, - ) - .set_external_authentication_details(external_authentication_details) - .set_fingerprint(payment_intent.fingerprint_id) - .set_authorization_count(payment_intent.authorization_count) - .set_incremental_authorizations(incremental_authorizations_response) - .set_expires_on(payment_intent.session_expiry) - .set_external_3ds_authentication_attempted( - payment_attempt.external_three_ds_authentication_attempted, - ) - .set_payment_method_id(payment_attempt.payment_method_id) - .set_payment_method_status(payment_data.payment_method_info.map(|info| info.status)) - .set_customer(customer_details_response.clone()) - .set_browser_info(payment_attempt.browser_info) - .set_updated(Some(payment_intent.modified_at)) - .to_owned(), + ), + order_details: payment_intent.order_details, + frm_message, + connector_transaction_id: payment_attempt.connector_transaction_id, + feature_metadata: payment_intent.feature_metadata, + connector_metadata: payment_intent.connector_metadata, + allowed_payment_method_types: payment_intent.allowed_payment_method_types, + reference_id: payment_attempt.connector_response_reference_id, + attempt_count: payment_intent.attempt_count, + payment_link: payment_link_data, + surcharge_details, + unified_code: payment_attempt.unified_code, + unified_message: payment_attempt.unified_message, + incremental_authorization_allowed: payment_intent.incremental_authorization_allowed, + authorization_count: payment_intent.authorization_count, + incremental_authorizations: incremental_authorizations_response, + external_authentication_details, + expires_on: payment_intent.session_expiry, + external_3ds_authentication_attempted: payment_attempt + .external_three_ds_authentication_attempted, + ..Default::default() + }, headers, - )) - }; + )), + }); metrics::PAYMENT_OPS_COUNT.add( &metrics::CONTEXT, @@ -792,7 +866,7 @@ where ], ); - Ok(output) + output } pub fn third_party_sdk_session_next_action( @@ -886,23 +960,23 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay } #[cfg(feature = "payouts")] -impl ForeignFrom<(storage::Payouts, storage::PayoutAttempt, domain::Customer)> - for api::PayoutCreateResponse -{ - fn foreign_from(item: (storage::Payouts, storage::PayoutAttempt, domain::Customer)) -> Self { - let (payout, payout_attempt, customer) = item; +impl ForeignFrom<(storage::Payouts, storage::PayoutAttempt)> for api::PayoutCreateResponse { + fn foreign_from(item: (storage::Payouts, storage::PayoutAttempt)) -> Self { + let payout = item.0; + let payout_attempt = item.1; let attempt = PayoutAttemptResponse { attempt_id: payout_attempt.payout_attempt_id, status: payout_attempt.status, amount: payout.amount, currency: Some(payout.destination_currency), connector: payout_attempt.connector.clone(), - error_code: payout_attempt.error_code.clone(), - error_message: payout_attempt.error_message.clone(), + error_code: payout_attempt.error_code, + error_message: payout_attempt.error_message, payment_method: Some(payout.payout_type), payout_method_type: None, connector_transaction_id: Some(payout_attempt.connector_payout_id), cancellation_reason: None, + payout_token: payout_attempt.payout_token, unified_code: None, unified_message: None, }; @@ -910,31 +984,20 @@ impl ForeignFrom<(storage::Payouts, storage::PayoutAttempt, domain::Customer)> Self { payout_id: payout.payout_id, merchant_id: payout.merchant_id, + status: payout.status, amount: payout.amount, + created: Some(payout.created_at), currency: payout.destination_currency, + description: payout.description, + metadata: payout.metadata, + customer_id: payout.customer_id, connector: payout_attempt.connector, payout_type: payout.payout_type, - customer_id: customer.customer_id, - auto_fulfill: payout.auto_fulfill, - email: customer.email, - name: customer.name, - phone: customer.phone, - phone_country_code: customer.phone_country_code, - return_url: payout.return_url, - business_country: payout_attempt.business_country, business_label: payout_attempt.business_label, - description: payout.description, - entity_type: payout.entity_type, + business_country: payout_attempt.business_country, recurring: payout.recurring, - metadata: payout.metadata, - status: payout_attempt.status, - error_message: payout_attempt.error_message, - error_code: payout_attempt.error_code, - profile_id: payout.profile_id, - created: Some(payout.created_at), attempts: Some(attempts), - billing: None, - client_secret: None, + ..Default::default() } } } @@ -1153,9 +1216,7 @@ impl TryFrom> for types::PaymentsAuthoriz }); Ok(Self { - payment_method_data: From::from( - payment_method_data.get_required_value("payment_method_data")?, - ), + payment_method_data: payment_method_data.get_required_value("payment_method_data")?, setup_future_usage: payment_data.payment_intent.setup_future_usage, mandate_id: payment_data.mandate_id.clone(), off_session: payment_data.mandate_id.as_ref().map(|_| true), @@ -1222,7 +1283,6 @@ impl TryFrom> for types::PaymentsSyncData None => types::SyncRequestType::SinglePaymentSync, }, payment_method_type: payment_data.payment_attempt.payment_method_type, - currency: payment_data.currency, }) } } @@ -1488,11 +1548,9 @@ impl TryFrom> for types::SetupMandateRequ currency: payment_data.currency, confirm: true, amount: Some(payment_data.amount.into()), - payment_method_data: From::from( - payment_data - .payment_method_data - .get_required_value("payment_method_data")?, - ), + payment_method_data: payment_data + .payment_method_data + .get_required_value("payment_method_data")?, statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix, setup_future_usage: payment_data.payment_intent.setup_future_usage, off_session: payment_data.mandate_id.as_ref().map(|_| true), @@ -1603,7 +1661,7 @@ impl TryFrom> for types::CompleteAuthoriz currency: payment_data.currency, browser_info, email: payment_data.email, - payment_method_data: payment_data.payment_method_data.map(From::from), + payment_method_data: payment_data.payment_method_data, connector_transaction_id: payment_data.payment_attempt.connector_transaction_id, redirect_response, connector_meta: payment_data.payment_attempt.connector_metadata, @@ -1673,7 +1731,7 @@ impl TryFrom> for types::PaymentsPreProce .unwrap_or(payment_data.amount.into()); Ok(Self { - payment_method_data: payment_method_data.map(From::from), + payment_method_data, email: payment_data.email, currency: Some(payment_data.currency), amount: Some(amount), diff --git a/crates/router/src/core/payments/types.rs b/crates/router/src/core/payments/types.rs index b297470bce8..73825558068 100644 --- a/crates/router/src/core/payments/types.rs +++ b/crates/router/src/core/payments/types.rs @@ -7,9 +7,9 @@ use common_utils::{ ext_traits::{Encode, OptionExt}, types as common_types, }; +use data_models::payments::payment_attempt::PaymentAttempt; use diesel_models::business_profile::BusinessProfile; use error_stack::ResultExt; -use hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt; use redis_interface::errors::RedisError; use router_env::{instrument, tracing}; diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs index 25f61919207..566caa7acc5 100644 --- a/crates/router/src/core/payouts.rs +++ b/crates/router/src/core/payouts.rs @@ -1,39 +1,32 @@ -pub mod access_token; pub mod helpers; #[cfg(feature = "payout_retry")] pub mod retry; pub mod validator; + use std::vec::IntoIter; use api_models::enums as api_enums; -use common_utils::{consts, crypto::Encryptable, ext_traits::ValueExt, pii}; +use common_utils::{crypto::Encryptable, ext_traits::ValueExt, pii}; +#[cfg(feature = "olap")] +use data_models::errors::StorageError; use diesel_models::enums as storage_enums; use error_stack::{report, ResultExt}; #[cfg(feature = "olap")] use futures::future::join_all; #[cfg(feature = "olap")] -use hyperswitch_domain_models::errors::StorageError; -#[cfg(feature = "payout_retry")] -use retry::GsmValidation; -#[cfg(feature = "olap")] use router_env::logger; use router_env::{instrument, tracing}; -use scheduler::utils as pt_utils; use serde_json; -use super::{ - errors::{ConnectorErrorExt, StorageErrorExt}, - payments::customers, -}; +use super::errors::{ConnectorErrorExt, StorageErrorExt}; #[cfg(feature = "olap")] -use crate::types::{domain::behaviour::Conversion, transformers::ForeignFrom}; +use crate::types::transformers::ForeignFrom; use crate::{ core::{ - errors::{self, CustomResult, RouterResponse, RouterResult}, + errors::{self, RouterResponse, RouterResult}, payments::{self, helpers as payment_helpers}, utils as core_utils, }, - db::StorageInterface, routes::AppState, services, types::{ @@ -56,7 +49,6 @@ pub struct PayoutData { pub payout_attempt: storage::PayoutAttempt, pub payout_method_data: Option, pub profile_id: String, - pub should_terminate: bool, } // ********************************************** CORE FLOWS ********************************************** @@ -150,27 +142,31 @@ pub async fn get_connector_choice( } } +#[cfg(feature = "payouts")] #[instrument(skip_all)] pub async fn make_connector_decision( state: &AppState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, + req: &payouts::PayoutCreateRequest, connector_call_type: api::ConnectorCallType, - payout_data: &mut PayoutData, -) -> RouterResult<()> { + mut payout_data: PayoutData, +) -> RouterResult { match connector_call_type { api::ConnectorCallType::PreDetermined(connector_data) => { - call_connector_payout( + payout_data = call_connector_payout( state, merchant_account, key_store, + req, &connector_data, - payout_data, + &mut payout_data, ) .await?; #[cfg(feature = "payout_retry")] { + use crate::core::payouts::retry::{self, GsmValidation}; let config_bool = retry::config_should_call_gsm_payout( &*state.store, &merchant_account.merchant_id, @@ -179,35 +175,38 @@ pub async fn make_connector_decision( .await; if config_bool && payout_data.should_call_gsm() { - Box::pin(retry::do_gsm_single_connector_actions( + payout_data = Box::pin(retry::do_gsm_single_connector_actions( state, connector_data, payout_data, merchant_account, key_store, + req, )) .await?; } } - Ok(()) + Ok(payout_data) } api::ConnectorCallType::Retryable(connectors) => { let mut connectors = connectors.into_iter(); let connector_data = get_next_connector(&mut connectors)?; - call_connector_payout( + payout_data = call_connector_payout( state, merchant_account, key_store, + req, &connector_data, - payout_data, + &mut payout_data, ) .await?; #[cfg(feature = "payout_retry")] { + use crate::core::payouts::retry::{self, GsmValidation}; let config_multiple_connector_bool = retry::config_should_call_gsm_payout( &*state.store, &merchant_account.merchant_id, @@ -216,13 +215,14 @@ pub async fn make_connector_decision( .await; if config_multiple_connector_bool && payout_data.should_call_gsm() { - Box::pin(retry::do_gsm_multiple_connector_actions( + payout_data = Box::pin(retry::do_gsm_multiple_connector_actions( state, connectors, connector_data.clone(), payout_data, merchant_account, key_store, + req, )) .await?; } @@ -235,57 +235,24 @@ pub async fn make_connector_decision( .await; if config_single_connector_bool && payout_data.should_call_gsm() { - Box::pin(retry::do_gsm_single_connector_actions( + payout_data = Box::pin(retry::do_gsm_single_connector_actions( state, connector_data, payout_data, merchant_account, key_store, + req, )) .await?; } } - Ok(()) + Ok(payout_data) } _ => Err(errors::ApiErrorResponse::InternalServerError)?, } } -#[instrument(skip_all)] -pub async fn payouts_core( - state: &AppState, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, - payout_data: &mut PayoutData, - routing_algorithm: Option, - eligible_connectors: Option>, -) -> RouterResult<()> { - let payout_attempt = &payout_data.payout_attempt; - - // Form connector data - let connector_call_type = get_connector_choice( - state, - merchant_account, - key_store, - payout_attempt.connector.clone(), - routing_algorithm, - payout_data, - eligible_connectors, - ) - .await?; - - // Call connector steps - Box::pin(make_connector_decision( - state, - merchant_account, - key_store, - connector_call_type, - payout_data, - )) - .await -} - #[instrument(skip_all)] pub async fn payouts_create_core( state: AppState, @@ -309,33 +276,34 @@ pub async fn payouts_create_core( ) .await?; - let payout_attempt = payout_data.payout_attempt.to_owned(); - - // Persist payout method data in temp locker - payout_data.payout_method_data = helpers::make_payout_method_data( + let connector_call_type = get_connector_choice( &state, - req.payout_method_data.as_ref(), - payout_attempt.payout_token.as_deref(), - &payout_attempt.customer_id, - &payout_attempt.merchant_id, - Some(&payout_data.payouts.payout_type.clone()), + &merchant_account, &key_store, - Some(&mut payout_data), - merchant_account.storage_scheme, + None, + req.routing.clone(), + &mut payout_data, + req.connector.clone(), ) .await?; - payouts_core( + payout_data = Box::pin(make_connector_decision( &state, &merchant_account, &key_store, - &mut payout_data, - req.routing.clone(), - req.connector.clone(), - ) + &req, + connector_call_type, + payout_data, + )) .await?; - response_handler(&merchant_account, &payout_data).await + response_handler( + &state, + &merchant_account, + &payouts::PayoutRequest::PayoutCreateRequest(req.to_owned()), + &payout_data, + ) + .await } pub async fn payouts_update_core( @@ -379,18 +347,12 @@ pub async fn payouts_update_core( entity_type: req.entity_type.unwrap_or(payouts.entity_type), metadata: req.metadata.clone().or(payouts.metadata.clone()), status: Some(status), - profile_id: Some(payout_attempt.profile_id.clone()), - confirm: req.confirm, + profile_id: Some(payout_attempt.profile_id), }; let db = &*state.store; payout_data.payouts = db - .update_payout( - &payouts, - updated_payouts, - &payout_attempt, - merchant_account.storage_scheme, - ) + .update_payout(&payouts, updated_payouts, merchant_account.storage_scheme) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error updating payouts")?; @@ -423,7 +385,6 @@ pub async fn payouts_update_core( .update_payout_attempt( &payout_attempt, updated_payout_attempt, - &payout_data.payouts, merchant_account.storage_scheme, ) .await @@ -432,39 +393,61 @@ pub async fn payouts_update_core( } } - let payout_attempt = payout_data.payout_attempt.to_owned(); - - if (req.connector.is_none(), payout_attempt.connector.is_some()) != (true, true) { + if ( + req.connector.is_none(), + payout_data.payout_attempt.connector.is_some(), + ) != (true, true) + { // if the connector is not updated but was provided during payout create payout_data.payout_attempt.connector = None; payout_data.payout_attempt.routing_info = None; + + //fetch payout_method_data + payout_data.payout_method_data = Some( + helpers::make_payout_method_data( + &state, + req.payout_method_data.as_ref(), + payout_data.payout_attempt.payout_token.as_deref(), + &payout_data.payout_attempt.customer_id, + &payout_data.payout_attempt.merchant_id, + Some(&payouts.payout_type), + &key_store, + Some(&payout_data), + merchant_account.storage_scheme, + ) + .await? + .get_required_value("payout_method_data")?, + ); }; - // Update payout method data in temp locker - payout_data.payout_method_data = helpers::make_payout_method_data( + let connector_call_type = get_connector_choice( &state, - req.payout_method_data.as_ref(), - payout_attempt.payout_token.as_deref(), - &payout_attempt.customer_id, - &payout_attempt.merchant_id, - Some(&payout_data.payouts.payout_type.clone()), + &merchant_account, &key_store, - Some(&mut payout_data), - merchant_account.storage_scheme, + None, + req.routing.clone(), + &mut payout_data, + req.connector.clone(), ) .await?; - payouts_core( + payout_data = Box::pin(make_connector_decision( &state, &merchant_account, &key_store, - &mut payout_data, - req.routing.clone(), - req.connector.clone(), - ) + &req, + connector_call_type, + payout_data, + )) .await?; - response_handler(&merchant_account, &payout_data).await + response_handler( + &state, + &merchant_account, + &payouts::PayoutRequest::PayoutCreateRequest(req.to_owned()), + &payout_data, + ) + .await } #[instrument(skip_all)] @@ -482,7 +465,13 @@ pub async fn payouts_retrieve_core( ) .await?; - response_handler(&merchant_account, &payout_data).await + response_handler( + &state, + &merchant_account, + &payouts::PayoutRequest::PayoutRetrieveRequest(req.to_owned()), + &payout_data, + ) + .await } #[instrument(skip_all)] @@ -515,10 +504,9 @@ pub async fn payouts_cancel_core( // Make local cancellation } else if helpers::is_eligible_for_local_payout_cancellation(status) { - let status = storage_enums::PayoutStatus::Cancelled; let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { connector_payout_id: connector_payout_id.to_owned(), - status, + status: storage_enums::PayoutStatus::Cancelled, error_message: Some("Cancelled by user".to_string()), error_code: None, is_eligible: None, @@ -528,23 +516,11 @@ pub async fn payouts_cancel_core( .update_payout_attempt( &payout_attempt, updated_payout_attempt, - &payout_data.payouts, merchant_account.storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = state - .store - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; // Trigger connector's cancellation } else { @@ -567,10 +543,11 @@ pub async fn payouts_cancel_core( .attach_printable("Connector not found for payout cancellation")?, }; - cancel_payout( + payout_data = cancel_payout( &state, &merchant_account, &key_store, + &payouts::PayoutRequest::PayoutActionRequest(req.to_owned()), &connector_data, &mut payout_data, ) @@ -578,7 +555,13 @@ pub async fn payouts_cancel_core( .attach_printable("Payout cancellation failed for given Payout request")?; } - response_handler(&merchant_account, &payout_data).await + response_handler( + &state, + &merchant_account, + &payouts::PayoutRequest::PayoutActionRequest(req.to_owned()), + &payout_data, + ) + .await } #[instrument(skip_all)] @@ -638,18 +621,19 @@ pub async fn payouts_fulfill_core( payout_attempt.payout_token.as_deref(), &payout_attempt.customer_id, &payout_attempt.merchant_id, - Some(&payout_data.payouts.payout_type.clone()), + Some(&payout_data.payouts.payout_type), &key_store, - Some(&mut payout_data), + Some(&payout_data), merchant_account.storage_scheme, ) .await? .get_required_value("payout_method_data")?, ); - fulfill_payout( + payout_data = fulfill_payout( &state, &merchant_account, &key_store, + &payouts::PayoutRequest::PayoutActionRequest(req.to_owned()), &connector_data, &mut payout_data, ) @@ -664,14 +648,19 @@ pub async fn payouts_fulfill_core( })); } - response_handler(&merchant_account, &payout_data).await + response_handler( + &state, + &merchant_account, + &payouts::PayoutRequest::PayoutActionRequest(req.to_owned()), + &payout_data, + ) + .await } #[cfg(feature = "olap")] pub async fn payouts_list_core( state: AppState, merchant_account: domain::MerchantAccount, - key_store: domain::MerchantKeyStore, constraints: payouts::PayoutListConstraints, ) -> RouterResponse { validator::validate_payout_list_request(&constraints)?; @@ -695,35 +684,7 @@ pub async fn payouts_list_core( ) .await { - Ok(payout_attempt) => { - match db - .find_customer_by_customer_id_merchant_id( - &payouts.customer_id, - merchant_id, - &key_store, - merchant_account.storage_scheme, - ) - .await - { - Ok(customer) => Some(Ok((payouts, payout_attempt, customer))), - Err(error) => { - if matches!( - error.current_context(), - storage_impl::errors::StorageError::ValueNotFound(_) - ) { - logger::warn!( - ?error, - "customer missing for customer_id : {}", - payouts.customer_id, - ); - return None; - } - Some(Err(error.change_context(StorageError::ValueNotFound( - format!("customer missing for customer_id : {}", payouts.customer_id), - )))) - } - } - } + Ok(payout_attempt) => Some(Ok((payouts, payout_attempt))), Err(error) => { if matches!(error.current_context(), StorageError::ValueNotFound(_)) { logger::warn!( @@ -738,14 +699,12 @@ pub async fn payouts_list_core( } }); - let pi_pa_tuple_vec: Result< - Vec<(storage::Payouts, storage::PayoutAttempt, domain::Customer)>, - _, - > = join_all(collected_futures) - .await - .into_iter() - .flatten() - .collect::, _>>(); + let pi_pa_tuple_vec: Result, _> = + join_all(collected_futures) + .await + .into_iter() + .flatten() + .collect::, _>>(); let data: Vec = pi_pa_tuple_vec .change_context(errors::ApiErrorResponse::InternalServerError)? @@ -765,17 +724,12 @@ pub async fn payouts_list_core( pub async fn payouts_filtered_list_core( state: AppState, merchant_account: domain::MerchantAccount, - key_store: domain::MerchantKeyStore, filters: payouts::PayoutListFilterConstraints, ) -> RouterResponse { let limit = &filters.limit; validator::validate_payout_list_request_for_joins(*limit)?; let db = state.store.as_ref(); - let list: Vec<( - storage::Payouts, - storage::PayoutAttempt, - diesel_models::Customer, - )> = db + let list: Vec<(storage::Payouts, storage::PayoutAttempt)> = db .filter_payouts_and_attempts( &merchant_account.merchant_id, &filters.clone().into(), @@ -784,20 +738,8 @@ pub async fn payouts_filtered_list_core( .await .to_not_found_response(errors::ApiErrorResponse::PayoutNotFound)?; - let data: Vec = join_all(list.into_iter().map(|(p, pa, c)| async { - match domain::Customer::convert_back(c, &key_store.key).await { - Ok(domain_cust) => Some((p, pa, domain_cust)), - Err(err) => { - logger::warn!(?err, "failed to convert customer for id: {}", p.customer_id); - None - } - } - })) - .await - .into_iter() - .flatten() - .map(ForeignFrom::foreign_from) - .collect(); + let data: Vec = + list.into_iter().map(ForeignFrom::foreign_from).collect(); Ok(services::ApplicationResponse::Json( api::PayoutListResponse { @@ -847,9 +789,10 @@ pub async fn call_connector_payout( state: &AppState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, + req: &payouts::PayoutCreateRequest, connector_data: &api::ConnectorData, payout_data: &mut PayoutData, -) -> RouterResult<()> { +) -> RouterResult { let payout_attempt = &payout_data.payout_attempt.to_owned(); let payouts = &payout_data.payouts.to_owned(); @@ -863,16 +806,14 @@ pub async fn call_connector_payout( routing_info: payout_data.payout_attempt.routing_info.clone(), }; let db = &*state.store; - payout_data.payout_attempt = db - .update_payout_attempt( - &payout_data.payout_attempt, - updated_payout_attempt, - payouts, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating routing info in payout_attempt")?; + db.update_payout_attempt( + &payout_data.payout_attempt, + updated_payout_attempt, + merchant_account.storage_scheme, + ) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Error updating routing info in payout_attempt")?; }; // Fetch / store payout_method_data @@ -880,7 +821,7 @@ pub async fn call_connector_payout( payout_data.payout_method_data = Some( helpers::make_payout_method_data( state, - payout_data.payout_method_data.to_owned().as_ref(), + req.payout_method_data.as_ref(), payout_attempt.payout_token.as_deref(), &payout_attempt.customer_id, &payout_attempt.merchant_id, @@ -894,55 +835,90 @@ pub async fn call_connector_payout( ); } - if let Some(true) = payouts.confirm { + if let Some(true) = req.confirm { // Eligibility flow - complete_payout_eligibility( - state, - merchant_account, - key_store, - connector_data, - payout_data, - ) - .await?; + if payouts.payout_type == storage_enums::PayoutType::Card + && payout_attempt.is_eligible.is_none() + { + *payout_data = check_payout_eligibility( + state, + merchant_account, + key_store, + req, + connector_data, + payout_data, + ) + .await + .attach_printable("Eligibility failed for given Payout request")?; + } - // Create customer flow - complete_create_recipient( - state, - merchant_account, - key_store, - connector_data, - payout_data, - ) - .await?; + // Payout creation flow + utils::when( + !payout_attempt + .is_eligible + .unwrap_or(state.conf.payouts.payout_eligibility), + || { + Err(report!(errors::ApiErrorResponse::PayoutFailed { + data: Some(serde_json::json!({ + "message": "Payout method data is invalid" + })) + }) + .attach_printable("Payout data provided is invalid")) + }, + )?; + if payout_data.payouts.payout_type == storage_enums::PayoutType::Bank + && payout_data.payout_attempt.status == storage_enums::PayoutStatus::RequiresCreation + { + // Create customer flow + *payout_data = create_recipient( + state, + merchant_account, + key_store, + req, + connector_data, + payout_data, + ) + .await + .attach_printable("Creation of customer failed")?; - // Create customer's disbursement account flow - complete_create_recipient_disburse_account( - state, - merchant_account, - key_store, - connector_data, - payout_data, - ) - .await?; + // Create payout flow + *payout_data = create_payout( + state, + merchant_account, + key_store, + req, + connector_data, + payout_data, + ) + .await + .attach_printable("Payout creation failed for given Payout request")?; + } - // Payout creation flow - complete_create_payout( - state, - merchant_account, - key_store, - connector_data, - payout_data, - ) - .await?; + if payout_data.payouts.payout_type == storage_enums::PayoutType::Wallet + && payout_data.payout_attempt.status == storage_enums::PayoutStatus::RequiresCreation + { + // Create payout flow + *payout_data = create_payout( + state, + merchant_account, + key_store, + req, + connector_data, + payout_data, + ) + .await + .attach_printable("Payout creation failed for given Payout request")?; + } }; // Auto fulfillment flow let status = payout_data.payout_attempt.status; if payouts.auto_fulfill && status == storage_enums::PayoutStatus::RequiresFulfillment { - fulfill_payout( + *payout_data = fulfill_payout( state, merchant_account, key_store, + &payouts::PayoutRequest::PayoutCreateRequest(req.to_owned()), connector_data, payout_data, ) @@ -950,43 +926,17 @@ pub async fn call_connector_payout( .attach_printable("Payout fulfillment failed for given Payout request")?; } - Ok(()) -} - -pub async fn complete_create_recipient( - state: &AppState, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, - connector_data: &api::ConnectorData, - payout_data: &mut PayoutData, -) -> RouterResult<()> { - if !payout_data.should_terminate - && payout_data.payout_attempt.status == storage_enums::PayoutStatus::RequiresCreation - && connector_data - .connector_name - .supports_create_recipient(payout_data.payouts.payout_type) - { - create_recipient( - state, - merchant_account, - key_store, - connector_data, - payout_data, - ) - .await - .attach_printable("Creation of customer failed")?; - } - - Ok(()) + Ok(payout_data.to_owned()) } pub async fn create_recipient( state: &AppState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, + req: &payouts::PayoutCreateRequest, connector_data: &api::ConnectorData, payout_data: &mut PayoutData, -) -> RouterResult<()> { +) -> RouterResult { let customer_details = payout_data.customer_details.to_owned(); let connector_name = connector_data.connector_name.to_string(); @@ -1002,11 +952,12 @@ pub async fn create_recipient( ); if should_call_connector { // 1. Form router data - let router_data = core_utils::construct_payout_router_data( + let customer_router_data = core_utils::construct_payout_router_data( state, - &connector_data.connector_name, + &connector_name, merchant_account, key_store, + &payouts::PayoutRequest::PayoutCreateRequest(req.to_owned()), payout_data, ) .await?; @@ -1022,8 +973,8 @@ pub async fn create_recipient( // 3. Call connector service let router_resp = services::execute_connector_processing_step( state, - connector_integration.to_owned(), - &router_data, + connector_integration, + &customer_router_data, payments::CallConnectorAction::Trigger, None, ) @@ -1032,79 +983,26 @@ pub async fn create_recipient( match router_resp.response { Ok(recipient_create_data) => { - let db = &*state.store; if let Some(customer) = customer_details { + let db = &*state.store; let customer_id = customer.customer_id.to_owned(); let merchant_id = merchant_account.merchant_id.to_owned(); - if let Some(updated_customer) = - customers::update_connector_customer_in_customers( - &connector_label, - Some(&customer), - &Some(recipient_create_data.connector_payout_id.clone()), - ) - .await - { - payout_data.customer_details = Some( - db.update_customer_by_customer_id_merchant_id( - customer_id, - merchant_id, - customer, - updated_customer, - key_store, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating customers in db")?, - ) - } - } - - // Add next step to ProcessTracker - if recipient_create_data.should_add_next_step_to_process_tracker { - add_external_account_addition_task( - &*state.store, - payout_data, - common_utils::date_time::now().saturating_add(time::Duration::seconds(consts::STRIPE_ACCOUNT_ONBOARDING_DELAY_IN_SECONDS)), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed while adding attach_payout_account_workflow workflow to process tracker")?; - - // Update payout status in DB - let status = recipient_create_data - .status - .unwrap_or(api_enums::PayoutStatus::RequiresVendorAccountCreation); - let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { - connector_payout_id: recipient_create_data.connector_payout_id, - status, - error_code: None, - error_message: None, - is_eligible: recipient_create_data.payout_eligible, + let updated_customer = storage::CustomerUpdate::ConnectorCustomer { + connector_customer: Some( + serde_json::json!({connector_label: recipient_create_data.connector_payout_id}), + ), }; - payout_data.payout_attempt = db - .update_payout_attempt( - &payout_data.payout_attempt, - updated_payout_attempt, - &payout_data.payouts, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, - merchant_account.storage_scheme, + payout_data.customer_details = Some( + db.update_customer_by_customer_id_merchant_id( + customer_id, + merchant_id, + updated_customer, + key_store, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; - - // Helps callee functions skip the execution - payout_data.should_terminate = true; + .attach_printable("Error updating customers in db")?, + ) } } Err(err) => Err(errors::ApiErrorResponse::PayoutFailed { @@ -1112,65 +1010,24 @@ pub async fn create_recipient( })?, } } - Ok(()) -} - -pub async fn complete_payout_eligibility( - state: &AppState, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, - connector_data: &api::ConnectorData, - payout_data: &mut PayoutData, -) -> RouterResult<()> { - let payout_attempt = &payout_data.payout_attempt.to_owned(); - - if !payout_data.should_terminate - && payout_attempt.is_eligible.is_none() - && connector_data - .connector_name - .supports_payout_eligibility(payout_data.payouts.payout_type) - { - check_payout_eligibility( - state, - merchant_account, - key_store, - connector_data, - payout_data, - ) - .await - .attach_printable("Eligibility failed for given Payout request")?; - } - - utils::when( - !payout_attempt - .is_eligible - .unwrap_or(state.conf.payouts.payout_eligibility), - || { - Err(report!(errors::ApiErrorResponse::PayoutFailed { - data: Some(serde_json::json!({ - "message": "Payout method data is invalid" - })) - }) - .attach_printable("Payout data provided is invalid")) - }, - )?; - - Ok(()) + Ok(payout_data.clone()) } pub async fn check_payout_eligibility( state: &AppState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, + req: &payouts::PayoutCreateRequest, connector_data: &api::ConnectorData, payout_data: &mut PayoutData, -) -> RouterResult<()> { +) -> RouterResult { // 1. Form Router data let router_data = core_utils::construct_payout_router_data( state, - &connector_data.connector_name, + &connector_data.connector_name.to_string(), merchant_account, key_store, + &payouts::PayoutRequest::PayoutCreateRequest(req.to_owned()), payout_data, ) .await?; @@ -1213,22 +1070,11 @@ pub async fn check_payout_eligibility( .update_payout_attempt( payout_attempt, updated_payout_attempt, - &payout_data.payouts, merchant_account.storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; if helpers::is_payout_err_state(status) { return Err(report!(errors::ApiErrorResponse::PayoutFailed { data: Some( @@ -1238,10 +1084,9 @@ pub async fn check_payout_eligibility( } } Err(err) => { - let status = storage_enums::PayoutStatus::Failed; let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { connector_payout_id: String::default(), - status, + status: storage_enums::PayoutStatus::Failed, error_code: Some(err.code), error_message: Some(err.message), is_eligible: Some(false), @@ -1250,118 +1095,37 @@ pub async fn check_payout_eligibility( .update_payout_attempt( &payout_data.payout_attempt, updated_payout_attempt, - &payout_data.payouts, merchant_account.storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; } }; - Ok(()) -} - -pub async fn complete_create_payout( - state: &AppState, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, - connector_data: &api::ConnectorData, - payout_data: &mut PayoutData, -) -> RouterResult<()> { - if !payout_data.should_terminate - && payout_data.payout_attempt.status == storage_enums::PayoutStatus::RequiresCreation - { - if connector_data - .connector_name - .supports_instant_payout(payout_data.payouts.payout_type) - { - // create payout_object only in router - let db = &*state.store; - let payout_attempt = &payout_data.payout_attempt; - let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { - connector_payout_id: "".to_string(), - status: storage::enums::PayoutStatus::RequiresFulfillment, - error_code: None, - error_message: None, - is_eligible: None, - }; - payout_data.payout_attempt = db - .update_payout_attempt( - payout_attempt, - updated_payout_attempt, - &payout_data.payouts, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { - status: storage::enums::PayoutStatus::RequiresFulfillment, - }, - &payout_data.payout_attempt, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; - } else { - // create payout_object in connector as well as router - create_payout( - state, - merchant_account, - key_store, - connector_data, - payout_data, - ) - .await - .attach_printable("Payout creation failed for given Payout request")?; - } - } - Ok(()) + Ok(payout_data.clone()) } pub async fn create_payout( state: &AppState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, + req: &payouts::PayoutCreateRequest, connector_data: &api::ConnectorData, payout_data: &mut PayoutData, -) -> RouterResult<()> { +) -> RouterResult { // 1. Form Router data let mut router_data = core_utils::construct_payout_router_data( state, - &connector_data.connector_name, + &connector_data.connector_name.to_string(), merchant_account, key_store, + &payouts::PayoutRequest::PayoutCreateRequest(req.to_owned()), payout_data, ) .await?; - // 2. Get/Create access token - access_token::create_access_token( - state, - connector_data, - merchant_account, - &mut router_data, - payout_data.payouts.payout_type.to_owned(), - ) - .await?; - - // 3. Fetch connector integration details + // 2. Fetch connector integration details let connector_integration: services::BoxedConnectorIntegration< '_, api::PoCreate, @@ -1369,13 +1133,13 @@ pub async fn create_payout( types::PayoutsResponseData, > = connector_data.connector.get_connector_integration(); - // 4. Execute pretasks + // 3. Execute pretasks connector_integration .execute_pretasks(&mut router_data, state) .await .to_payout_failed_response()?; - // 5. Call connector service + // 4. Call connector service let router_data_resp = services::execute_connector_processing_step( state, connector_integration, @@ -1386,7 +1150,7 @@ pub async fn create_payout( .await .to_payout_failed_response()?; - // 6. Process data returned by the connector + // 5. Process data returned by the connector let db = &*state.store; match router_data_resp.response { Ok(payout_response_data) => { @@ -1405,22 +1169,11 @@ pub async fn create_payout( .update_payout_attempt( payout_attempt, updated_payout_attempt, - &payout_data.payouts, merchant_account.storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; if helpers::is_payout_err_state(status) { return Err(report!(errors::ApiErrorResponse::PayoutFailed { data: Some( @@ -1429,130 +1182,6 @@ pub async fn create_payout( })); } } - Err(err) => { - let status = storage_enums::PayoutStatus::Failed; - let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { - connector_payout_id: String::default(), - status, - error_code: Some(err.code), - error_message: Some(err.message), - is_eligible: None, - }; - payout_data.payout_attempt = db - .update_payout_attempt( - &payout_data.payout_attempt, - updated_payout_attempt, - &payout_data.payouts, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; - } - }; - - Ok(()) -} - -pub async fn complete_create_recipient_disburse_account( - state: &AppState, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, - connector_data: &api::ConnectorData, - payout_data: &mut PayoutData, -) -> RouterResult<()> { - if !payout_data.should_terminate - && payout_data.payout_attempt.status - == storage_enums::PayoutStatus::RequiresVendorAccountCreation - && connector_data - .connector_name - .supports_vendor_disburse_account_create_for_payout() - { - create_recipient_disburse_account( - state, - merchant_account, - key_store, - connector_data, - payout_data, - ) - .await - .attach_printable("Creation of customer failed")?; - } - Ok(()) -} - -pub async fn create_recipient_disburse_account( - state: &AppState, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, - connector_data: &api::ConnectorData, - payout_data: &mut PayoutData, -) -> RouterResult<()> { - // 1. Form Router data - let router_data = core_utils::construct_payout_router_data( - state, - &connector_data.connector_name, - merchant_account, - key_store, - payout_data, - ) - .await?; - - // 2. Fetch connector integration details - let connector_integration: services::BoxedConnectorIntegration< - '_, - api::PoRecipientAccount, - types::PayoutsData, - types::PayoutsResponseData, - > = connector_data.connector.get_connector_integration(); - - // 3. Call connector service - let router_data_resp = services::execute_connector_processing_step( - state, - connector_integration, - &router_data, - payments::CallConnectorAction::Trigger, - None, - ) - .await - .to_payout_failed_response()?; - - // 4. Process data returned by the connector - let db = &*state.store; - match router_data_resp.response { - Ok(payout_response_data) => { - let payout_attempt = &payout_data.payout_attempt; - let status = payout_response_data - .status - .unwrap_or(payout_attempt.status.to_owned()); - let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { - connector_payout_id: payout_response_data.connector_payout_id, - status, - error_code: None, - error_message: None, - is_eligible: payout_response_data.payout_eligible, - }; - payout_data.payout_attempt = db - .update_payout_attempt( - payout_attempt, - updated_payout_attempt, - &payout_data.payouts, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payout_attempt in db")?; - } Err(err) => { let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { connector_payout_id: String::default(), @@ -1565,7 +1194,6 @@ pub async fn create_recipient_disburse_account( .update_payout_attempt( &payout_data.payout_attempt, updated_payout_attempt, - &payout_data.payouts, merchant_account.storage_scheme, ) .await @@ -1574,22 +1202,24 @@ pub async fn create_recipient_disburse_account( } }; - Ok(()) + Ok(payout_data.clone()) } pub async fn cancel_payout( state: &AppState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, + req: &payouts::PayoutRequest, connector_data: &api::ConnectorData, payout_data: &mut PayoutData, -) -> RouterResult<()> { +) -> RouterResult { // 1. Form Router data let router_data = core_utils::construct_payout_router_data( state, - &connector_data.connector_name, + &connector_data.connector_name.to_string(), merchant_account, key_store, + req, payout_data, ) .await?; @@ -1631,28 +1261,16 @@ pub async fn cancel_payout( .update_payout_attempt( &payout_data.payout_attempt, updated_payout_attempt, - &payout_data.payouts, merchant_account.storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; + .attach_printable("Error updating payout_attempt in db")? } Err(err) => { - let status = storage_enums::PayoutStatus::Failed; let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { connector_payout_id: String::default(), - status, + status: storage_enums::PayoutStatus::Failed, error_code: Some(err.code), error_message: Some(err.message), is_eligible: None, @@ -1661,56 +1279,37 @@ pub async fn cancel_payout( .update_payout_attempt( &payout_data.payout_attempt, updated_payout_attempt, - &payout_data.payouts, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, merchant_account.storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; + .attach_printable("Error updating payout_attempt in db")? } }; - Ok(()) + Ok(payout_data.clone()) } pub async fn fulfill_payout( state: &AppState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, + req: &payouts::PayoutRequest, connector_data: &api::ConnectorData, payout_data: &mut PayoutData, -) -> RouterResult<()> { +) -> RouterResult { // 1. Form Router data - let mut router_data = core_utils::construct_payout_router_data( + let router_data = core_utils::construct_payout_router_data( state, - &connector_data.connector_name, + &connector_data.connector_name.to_string(), merchant_account, key_store, + req, payout_data, ) .await?; - // 2. Get/Create access token - access_token::create_access_token( - state, - connector_data, - merchant_account, - &mut router_data, - payout_data.payouts.payout_type.to_owned(), - ) - .await?; - - // 3. Fetch connector integration details + // 2. Fetch connector integration details let connector_integration: services::BoxedConnectorIntegration< '_, api::PoFulfill, @@ -1718,7 +1317,7 @@ pub async fn fulfill_payout( types::PayoutsResponseData, > = connector_data.connector.get_connector_integration(); - // 4. Call connector service + // 3. Call connector service let router_data_resp = services::execute_connector_processing_step( state, connector_integration, @@ -1729,18 +1328,16 @@ pub async fn fulfill_payout( .await .to_payout_failed_response()?; - // 5. Process data returned by the connector + // 4. Process data returned by the connector let db = &*state.store; + let payout_attempt = &payout_data.payout_attempt; match router_data_resp.response { Ok(payout_response_data) => { let status = payout_response_data .status - .unwrap_or(payout_data.payout_attempt.status.to_owned()); + .unwrap_or(payout_attempt.status.to_owned()); payout_data.payouts.status = status; - if payout_data.payouts.recurring - && payout_data.payouts.payout_method_id.clone().is_none() - && !helpers::is_payout_err_state(status) - { + if payout_data.payouts.recurring && payout_data.payouts.payout_method_id.is_none() { helpers::save_payout_data_to_locker( state, payout_data, @@ -1754,7 +1351,7 @@ pub async fn fulfill_payout( .await?; } let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { - connector_payout_id: payout_data.payout_attempt.connector_payout_id.to_owned(), + connector_payout_id: payout_attempt.connector_payout_id.to_owned(), status, error_code: None, error_message: None, @@ -1762,24 +1359,13 @@ pub async fn fulfill_payout( }; payout_data.payout_attempt = db .update_payout_attempt( - &payout_data.payout_attempt, + payout_attempt, updated_payout_attempt, - &payout_data.payouts, merchant_account.storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; if helpers::is_payout_err_state(status) { return Err(report!(errors::ApiErrorResponse::PayoutFailed { data: Some( @@ -1789,10 +1375,9 @@ pub async fn fulfill_payout( } } Err(err) => { - let status = storage_enums::PayoutStatus::Failed; let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate { connector_payout_id: String::default(), - status, + status: storage_enums::PayoutStatus::Failed, error_code: Some(err.code), error_message: Some(err.message), is_eligible: None, @@ -1801,30 +1386,21 @@ pub async fn fulfill_payout( .update_payout_attempt( &payout_data.payout_attempt, updated_payout_attempt, - &payout_data.payouts, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payout_attempt in db")?; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - storage::PayoutsUpdate::StatusUpdate { status }, - &payout_data.payout_attempt, merchant_account.storage_scheme, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in db")?; + .attach_printable("Error updating payout_attempt in db")? } }; - Ok(()) + Ok(payout_data.clone()) } pub async fn response_handler( + _state: &AppState, merchant_account: &domain::MerchantAccount, + _req: &payouts::PayoutRequest, payout_data: &PayoutData, ) -> RouterResponse { let payout_attempt = payout_data.payout_attempt.to_owned(); @@ -1982,8 +1558,6 @@ pub async fn payout_create_db_entries( payout_method_id, profile_id: profile_id.to_string(), attempt_count: 1, - metadata: req.metadata.clone(), - confirm: req.confirm, ..Default::default() }; let payouts = db @@ -2019,11 +1593,7 @@ pub async fn payout_create_db_entries( ..Default::default() }; let payout_attempt = db - .insert_payout_attempt( - payout_attempt_req, - &payouts, - merchant_account.storage_scheme, - ) + .insert_payout_attempt(payout_attempt_req, merchant_account.storage_scheme) .await .to_duplicate_response(errors::ApiErrorResponse::DuplicatePayout { payout_id: payout_id.to_owned(), @@ -2047,7 +1617,6 @@ pub async fn payout_create_db_entries( .as_ref() .cloned() .or(stored_payout_method_data.cloned()), - should_terminate: false, profile_id: profile_id.to_owned(), }) } @@ -2103,7 +1672,6 @@ pub async fn make_payout_data( &payouts.customer_id.to_owned(), merchant_id, key_store, - merchant_account.storage_scheme, ) .await .map_or(None, |c| c); @@ -2122,44 +1690,10 @@ pub async fn make_payout_data( payout_attempt, payout_method_data: None, merchant_connector_account: None, - should_terminate: false, profile_id, }) } -pub async fn add_external_account_addition_task( - db: &dyn StorageInterface, - payout_data: &PayoutData, - schedule_time: time::PrimitiveDateTime, -) -> CustomResult<(), errors::StorageError> { - let runner = storage::ProcessTrackerRunner::AttachPayoutAccountWorkflow; - let task = "STRPE_ATTACH_EXTERNAL_ACCOUNT"; - let tag = ["PAYOUTS", "STRIPE", "ACCOUNT", "CREATE"]; - let process_tracker_id = pt_utils::get_process_tracker_id( - runner, - task, - &payout_data.payout_attempt.payout_attempt_id, - &payout_data.payout_attempt.merchant_id, - ); - let tracking_data = api::PayoutRetrieveRequest { - payout_id: payout_data.payouts.payout_id.to_owned(), - force_sync: None, - merchant_id: Some(payout_data.payouts.merchant_id.to_owned()), - }; - let process_tracker_entry = storage::ProcessTrackerNew::new( - process_tracker_id, - task, - runner, - tag, - tracking_data, - schedule_time, - ) - .map_err(errors::StorageError::from)?; - - db.insert_process(process_tracker_entry).await?; - Ok(()) -} - async fn validate_and_get_business_profile( state: &AppState, profile_id: &String, diff --git a/crates/router/src/core/payouts/access_token.rs b/crates/router/src/core/payouts/access_token.rs deleted file mode 100644 index 8dddc0c570c..00000000000 --- a/crates/router/src/core/payouts/access_token.rs +++ /dev/null @@ -1,194 +0,0 @@ -use common_utils::ext_traits::AsyncExt; -use error_stack::ResultExt; - -use crate::{ - consts, - core::{ - errors::{self, RouterResult}, - payments, - }, - routes::{metrics, AppState}, - services, - types::{self, api as api_types, domain, storage::enums}, -}; - -/// After we get the access token, check if there was an error and if the flow should proceed further -/// Everything is well, continue with the flow -/// There was an error, cannot proceed further -#[cfg(feature = "payouts")] -pub async fn create_access_token( - state: &AppState, - connector_data: &api_types::ConnectorData, - merchant_account: &domain::MerchantAccount, - router_data: &mut types::PayoutsRouterData, - payout_type: enums::PayoutType, -) -> RouterResult<()> { - let connector_access_token = add_access_token_for_payout( - state, - connector_data, - merchant_account, - router_data, - payout_type, - ) - .await?; - - if connector_access_token.connector_supports_access_token { - match connector_access_token.access_token_result { - Ok(access_token) => { - router_data.access_token = access_token; - } - Err(connector_error) => { - router_data.response = Err(connector_error); - } - } - } - - Ok(()) -} - -#[cfg(feature = "payouts")] -pub async fn add_access_token_for_payout( - state: &AppState, - connector: &api_types::ConnectorData, - merchant_account: &domain::MerchantAccount, - router_data: &types::PayoutsRouterData, - payout_type: enums::PayoutType, -) -> RouterResult { - if connector - .connector_name - .supports_access_token_for_payout(payout_type) - { - let merchant_id = &merchant_account.merchant_id; - let store = &*state.store; - let old_access_token = store - .get_access_token(merchant_id, connector.connector.id()) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("DB error when accessing the access token")?; - - let res = match old_access_token { - Some(access_token) => Ok(Some(access_token)), - None => { - let cloned_router_data = router_data.clone(); - let refresh_token_request_data = types::AccessTokenRequestData::try_from( - router_data.connector_auth_type.clone(), - ) - .attach_printable( - "Could not create access token request, invalid connector account credentials", - )?; - - let refresh_token_response_data: Result = - Err(types::ErrorResponse::default()); - let refresh_token_router_data = payments::helpers::router_data_type_conversion::< - _, - api_types::AccessTokenAuth, - _, - _, - _, - _, - >( - cloned_router_data, - refresh_token_request_data, - refresh_token_response_data, - ); - refresh_connector_auth( - state, - connector, - merchant_account, - &refresh_token_router_data, - ) - .await? - .async_map(|access_token| async { - //Store the access token in db - let store = &*state.store; - // This error should not be propagated, we don't want payments to fail once we have - // the access token, the next request will create new access token - let _ = store - .set_access_token( - merchant_id, - connector.connector.id(), - access_token.clone(), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("DB error when setting the access token"); - Some(access_token) - }) - .await - } - }; - - Ok(types::AddAccessTokenResult { - access_token_result: res, - connector_supports_access_token: true, - }) - } else { - Ok(types::AddAccessTokenResult { - access_token_result: Err(types::ErrorResponse::default()), - connector_supports_access_token: false, - }) - } -} - -#[cfg(feature = "payouts")] -pub async fn refresh_connector_auth( - state: &AppState, - connector: &api_types::ConnectorData, - _merchant_account: &domain::MerchantAccount, - router_data: &types::RouterData< - api_types::AccessTokenAuth, - types::AccessTokenRequestData, - types::AccessToken, - >, -) -> RouterResult> { - let connector_integration: services::BoxedConnectorIntegration< - '_, - api_types::AccessTokenAuth, - types::AccessTokenRequestData, - types::AccessToken, - > = connector.connector.get_connector_integration(); - - let access_token_router_data_result = services::execute_connector_processing_step( - state, - connector_integration, - router_data, - payments::CallConnectorAction::Trigger, - None, - ) - .await; - - let access_token_router_data = match access_token_router_data_result { - Ok(router_data) => Ok(router_data.response), - Err(connector_error) => { - // If we receive a timeout error from the connector, then - // the error has to be handled gracefully by updating the payment status to failed. - // further payment flow will not be continued - if connector_error.current_context().is_connector_timeout() { - let error_response = types::ErrorResponse { - code: consts::REQUEST_TIMEOUT_ERROR_CODE.to_string(), - message: consts::REQUEST_TIMEOUT_ERROR_MESSAGE.to_string(), - reason: Some(consts::REQUEST_TIMEOUT_ERROR_MESSAGE.to_string()), - status_code: 504, - attempt_status: None, - connector_transaction_id: None, - }; - - Ok(Err(error_response)) - } else { - Err(connector_error - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Could not refresh access token")) - } - } - }?; - - metrics::ACCESS_TOKEN_CREATION.add( - &metrics::CONTEXT, - 1, - &[metrics::request::add_attributes( - "connector", - connector.connector_name.to_string(), - )], - ); - Ok(access_token_router_data) -} diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs index e521fac9a80..1a94186a86f 100644 --- a/crates/router/src/core/payouts/helpers.rs +++ b/crates/router/src/core/payouts/helpers.rs @@ -1,4 +1,4 @@ -use api_models::{enums, payment_methods::Card, payouts}; +use api_models::enums::PayoutConnectors; use common_utils::{ errors::CustomResult, ext_traits::{AsyncExt, StringExt}, @@ -11,10 +11,10 @@ use router_env::logger; use super::PayoutData; use crate::{ core::{ - errors::{self, RouterResult, StorageErrorExt}, + errors::{self, RouterResult}, payment_methods::{ - cards, - transformers::{DataDuplicationCheck, StoreCardReq, StoreGenericReq, StoreLockerReq}, + cards, transformers, + transformers::{StoreCardReq, StoreGenericReq, StoreLockerReq}, vault, }, payments::{ @@ -48,7 +48,7 @@ pub async fn make_payout_method_data<'a>( merchant_id: &str, payout_type: Option<&api_enums::PayoutType>, merchant_key_store: &domain::MerchantKeyStore, - payout_data: Option<&mut PayoutData>, + payout_data: Option<&PayoutData>, storage_scheme: storage::enums::MerchantStorageScheme, ) -> RouterResult> { let db = &*state.store; @@ -166,16 +166,14 @@ pub async fn make_payout_method_data<'a>( let updated_payout_attempt = storage::PayoutAttemptUpdate::PayoutTokenUpdate { payout_token: lookup_key, }; - payout_data.payout_attempt = db - .update_payout_attempt( - &payout_data.payout_attempt, - updated_payout_attempt, - &payout_data.payouts, - storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating token in payout attempt")?; + db.update_payout_attempt( + &payout_data.payout_attempt, + updated_payout_attempt, + storage_scheme, + ) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Error updating token in payout attempt")?; } Ok(Some(payout_method.clone())) } @@ -187,15 +185,15 @@ pub async fn make_payout_method_data<'a>( pub async fn save_payout_data_to_locker( state: &AppState, - payout_data: &mut PayoutData, + payout_data: &PayoutData, payout_method_data: &api::PayoutMethodData, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, ) -> RouterResult<()> { let payout_attempt = &payout_data.payout_attempt; - let (mut locker_req, card_details, bank_details, wallet_details, payment_method_type) = + let (locker_req, card_details, bank_details, wallet_details, payment_method_type) = match payout_method_data { - payouts::PayoutMethodData::Card(card) => { + api_models::payouts::PayoutMethodData::Card(card) => { let card_detail = api::CardDetail { card_number: card.card_number.to_owned(), card_holder_name: card.card_holder_name.to_owned(), @@ -208,9 +206,9 @@ pub async fn save_payout_data_to_locker( card_type: None, }; let payload = StoreLockerReq::LockerCard(StoreCardReq { - merchant_id: merchant_account.merchant_id.as_ref(), + merchant_id: &merchant_account.merchant_id, merchant_customer_id: payout_attempt.customer_id.to_owned(), - card: Card { + card: transformers::Card { card_number: card.card_number.to_owned(), name_on_card: card.card_holder_name.to_owned(), card_exp_month: card.expiry_month.to_owned(), @@ -252,32 +250,31 @@ pub async fn save_payout_data_to_locker( Ok(hex::encode(e.peek())) })?; let payload = StoreLockerReq::LockerGeneric(StoreGenericReq { - merchant_id: merchant_account.merchant_id.as_ref(), + merchant_id: &merchant_account.merchant_id, merchant_customer_id: payout_attempt.customer_id.to_owned(), enc_data, }); match payout_method_data { - payouts::PayoutMethodData::Bank(bank) => ( + api_models::payouts::PayoutMethodData::Bank(bank) => ( payload, None, Some(bank.to_owned()), None, api_enums::PaymentMethodType::foreign_from(bank.to_owned()), ), - payouts::PayoutMethodData::Wallet(wallet) => ( + api_models::payouts::PayoutMethodData::Wallet(wallet) => ( payload, None, None, Some(wallet.to_owned()), api_enums::PaymentMethodType::foreign_from(wallet.to_owned()), ), - payouts::PayoutMethodData::Card(_) => { + api_models::payouts::PayoutMethodData::Card(_) => { Err(errors::ApiErrorResponse::InternalServerError)? } } } }; - // Store payout method in locker let stored_resp = cards::call_to_locker_hs( state, @@ -288,288 +285,112 @@ pub async fn save_payout_data_to_locker( .await .change_context(errors::ApiErrorResponse::InternalServerError)?; + // Store card_reference in payouts table let db = &*state.store; - - // Handle duplicates - let (should_insert_in_pm_table, metadata_update) = match stored_resp.duplication_check { - // Check if equivalent entry exists in payment_methods - Some(duplication_check) => { - let locker_ref = stored_resp.card_reference.clone(); - - // Use locker ref as payment_method_id - let existing_pm_by_pmid = db - .find_payment_method(&locker_ref, merchant_account.storage_scheme) - .await; - - match existing_pm_by_pmid { - // If found, update locker's metadata [DELETE + INSERT OP], don't insert in payment_method's table - Ok(pm) => ( - false, - if duplication_check == DataDuplicationCheck::MetaDataChanged { - Some(pm.clone()) - } else { - None - }, - ), - - // If not found, use locker ref as locker_id - Err(err) => { - if err.current_context().is_db_not_found() { - match db - .find_payment_method_by_locker_id( - &locker_ref, - merchant_account.storage_scheme, - ) - .await - { - // If found, update locker's metadata [DELETE + INSERT OP], don't insert in payment_methods table - Ok(pm) => ( - false, - if duplication_check == DataDuplicationCheck::MetaDataChanged { - Some(pm.clone()) - } else { - None - }, - ), - Err(err) => { - // If not found, update locker's metadata [DELETE + INSERT OP], and insert in payment_methods table - if err.current_context().is_db_not_found() { - (true, None) - - // Misc. DB errors - } else { - Err(err) - .change_context( - errors::ApiErrorResponse::InternalServerError, - ) - .attach_printable( - "DB failures while finding payment method by locker ID", - )? - } - } - } - // Misc. DB errors - } else { - Err(err) - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("DB failures while finding payment method by pm ID")? - } - } - } - } - - // Not duplicate, should be inserted in payment_methods table - None => (true, None), + let updated_payout = storage::PayoutsUpdate::PayoutMethodIdUpdate { + payout_method_id: Some(stored_resp.card_reference.to_owned()), }; - - // Form payment method entry and card's metadata whenever insertion or metadata update is required - let (card_details_encrypted, new_payment_method) = - if let (api::PayoutMethodData::Card(_), true, _) - | (api::PayoutMethodData::Card(_), _, Some(_)) = ( - payout_method_data, - should_insert_in_pm_table, - metadata_update.as_ref(), - ) { - // Fetch card info from db - let card_isin = card_details - .as_ref() - .map(|c| c.card_number.clone().get_card_isin()); - - let mut payment_method = api::PaymentMethodCreate { - payment_method: Some(api_enums::PaymentMethod::foreign_from( - payout_method_data.to_owned(), - )), - payment_method_type: Some(payment_method_type), - payment_method_issuer: None, - payment_method_issuer_code: None, - bank_transfer: None, - card: card_details.clone(), - wallet: None, - metadata: None, - customer_id: Some(payout_attempt.customer_id.to_owned()), - card_network: None, - client_secret: None, - payment_method_data: None, - }; - - let pm_data = card_isin - .clone() - .async_and_then(|card_isin| async move { - db.get_card_info(&card_isin) - .await - .map_err(|error| services::logger::warn!(card_info_error=?error)) - .ok() - }) + db.update_payout( + &payout_data.payouts, + updated_payout, + merchant_account.storage_scheme, + ) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Error updating payouts in saved payout method")?; + + // fetch card info from db + let card_isin = card_details + .as_ref() + .map(|c| c.card_number.clone().get_card_isin()); + + let pm_data = card_isin + .clone() + .async_and_then(|card_isin| async move { + db.get_card_info(&card_isin) .await - .flatten() - .map(|card_info| { - payment_method.payment_method_issuer = card_info.card_issuer.clone(); - payment_method.card_network = - card_info.card_network.clone().map(|cn| cn.to_string()); - api::payment_methods::PaymentMethodsData::Card( - api::payment_methods::CardDetailsPaymentMethod { - last4_digits: card_details - .as_ref() - .map(|c| c.card_number.clone().get_last4()), - issuer_country: card_info.card_issuing_country, - expiry_month: card_details.as_ref().map(|c| c.card_exp_month.clone()), - expiry_year: card_details.as_ref().map(|c| c.card_exp_year.clone()), - nick_name: card_details.as_ref().and_then(|c| c.nick_name.clone()), - card_holder_name: card_details - .as_ref() - .and_then(|c| c.card_holder_name.clone()), - - card_isin: card_isin.clone(), - card_issuer: card_info.card_issuer, - card_network: card_info.card_network, - card_type: card_info.card_type, - saved_to_locker: true, - }, - ) - }) - .unwrap_or_else(|| { - api::payment_methods::PaymentMethodsData::Card( - api::payment_methods::CardDetailsPaymentMethod { - last4_digits: card_details - .as_ref() - .map(|c| c.card_number.clone().get_last4()), - issuer_country: None, - expiry_month: card_details.as_ref().map(|c| c.card_exp_month.clone()), - expiry_year: card_details.as_ref().map(|c| c.card_exp_year.clone()), - nick_name: card_details.as_ref().and_then(|c| c.nick_name.clone()), - card_holder_name: card_details - .as_ref() - .and_then(|c| c.card_holder_name.clone()), - - card_isin: card_isin.clone(), - card_issuer: None, - card_network: None, - card_type: None, - saved_to_locker: true, - }, - ) - }); - ( - cards::create_encrypted_payment_method_data(key_store, Some(pm_data)).await, - payment_method, + .map_err(|error| services::logger::warn!(card_info_error=?error)) + .ok() + }) + .await + .flatten() + .map(|card_info| { + api::payment_methods::PaymentMethodsData::Card( + api::payment_methods::CardDetailsPaymentMethod { + last4_digits: card_details + .as_ref() + .map(|c| c.card_number.clone().get_last4()), + issuer_country: card_info.card_issuing_country, + expiry_month: card_details.as_ref().map(|c| c.card_exp_month.clone()), + expiry_year: card_details.as_ref().map(|c| c.card_exp_year.clone()), + nick_name: card_details.as_ref().and_then(|c| c.nick_name.clone()), + card_holder_name: card_details + .as_ref() + .and_then(|c| c.card_holder_name.clone()), + + card_isin: card_isin.clone(), + card_issuer: card_info.card_issuer, + card_network: card_info.card_network, + card_type: card_info.card_type, + saved_to_locker: true, + }, ) - } else { - ( - None, - api::PaymentMethodCreate { - payment_method: Some(api_enums::PaymentMethod::foreign_from( - payout_method_data.to_owned(), - )), - payment_method_type: Some(payment_method_type), - payment_method_issuer: None, - payment_method_issuer_code: None, - bank_transfer: bank_details, - card: None, - wallet: wallet_details, - metadata: None, - customer_id: Some(payout_attempt.customer_id.to_owned()), + }) + .unwrap_or_else(|| { + api::payment_methods::PaymentMethodsData::Card( + api::payment_methods::CardDetailsPaymentMethod { + last4_digits: card_details + .as_ref() + .map(|c| c.card_number.clone().get_last4()), + issuer_country: None, + expiry_month: card_details.as_ref().map(|c| c.card_exp_month.clone()), + expiry_year: card_details.as_ref().map(|c| c.card_exp_year.clone()), + nick_name: card_details.as_ref().and_then(|c| c.nick_name.clone()), + card_holder_name: card_details + .as_ref() + .and_then(|c| c.card_holder_name.clone()), + + card_isin: card_isin.clone(), + card_issuer: None, card_network: None, - client_secret: None, - payment_method_data: None, + card_type: None, + saved_to_locker: true, }, ) - }; - - // Insert new entry in payment_methods table - if should_insert_in_pm_table { - let payment_method_id = common_utils::generate_id(crate::consts::ID_LENGTH, "pm"); - cards::create_payment_method( - db, - &new_payment_method, - &payout_attempt.customer_id, - &payment_method_id, - Some(stored_resp.card_reference.clone()), - &merchant_account.merchant_id, - None, - None, - card_details_encrypted.clone(), - key_store, - None, - None, - None, - merchant_account.storage_scheme, - ) - .await?; - } - - /* 1. Delete from locker - * 2. Create new entry in locker - * 3. Handle creation response from locker - * 4. Update card's metadata in payment_methods table - */ - if let Some(existing_pm) = metadata_update { - let card_reference = &existing_pm - .locker_id - .clone() - .unwrap_or(existing_pm.payment_method_id.clone()); - // Delete from locker - cards::delete_card_from_hs_locker( - state, - &payout_attempt.customer_id, - &merchant_account.merchant_id, - card_reference, - ) - .await - .attach_printable( - "Failed to delete PMD from locker as a part of metadata update operation", - )?; - - locker_req.update_requestor_card_reference(Some(card_reference.to_string())); - - // Store in locker - let stored_resp = cards::call_to_locker_hs( - state, - &locker_req, - &payout_attempt.customer_id, - api_enums::LockerChoice::HyperswitchCardVault, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError); - - // Check if locker operation was successful or not, if not, delete the entry from payment_methods table - if let Err(err) = stored_resp { - logger::error!(vault_err=?err); - db.delete_payment_method_by_merchant_id_payment_method_id( - &merchant_account.merchant_id, - &existing_pm.payment_method_id, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; - - Err(errors::ApiErrorResponse::InternalServerError).attach_printable( - "Failed to insert PMD from locker as a part of metadata update operation", - )? - }; - - // Update card's metadata in payment_methods table - let pm_update = storage::PaymentMethodUpdate::PaymentMethodDataUpdate { - payment_method_data: card_details_encrypted, - }; - db.update_payment_method(existing_pm, pm_update, merchant_account.storage_scheme) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to add payment method in db")?; + }); + + let card_details_encrypted = + cards::create_encrypted_payment_method_data(key_store, Some(pm_data)).await; + + // Insert in payment_method table + let payment_method = api::PaymentMethodCreate { + payment_method: api_enums::PaymentMethod::foreign_from(payout_method_data.to_owned()), + payment_method_type: Some(payment_method_type), + payment_method_issuer: None, + payment_method_issuer_code: None, + bank_transfer: bank_details, + card: card_details, + wallet: wallet_details, + metadata: None, + customer_id: Some(payout_attempt.customer_id.to_owned()), + card_network: None, }; - // Store card_reference in payouts table - let updated_payout = storage::PayoutsUpdate::PayoutMethodIdUpdate { - payout_method_id: stored_resp.card_reference.to_owned(), - }; - payout_data.payouts = db - .update_payout( - &payout_data.payouts, - updated_payout, - payout_attempt, - merchant_account.storage_scheme, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error updating payouts in saved payout method")?; + let payment_method_id = common_utils::generate_id(crate::consts::ID_LENGTH, "pm"); + cards::create_payment_method( + db, + &payment_method, + &payout_attempt.customer_id, + &payment_method_id, + Some(stored_resp.card_reference), + &merchant_account.merchant_id, + None, + None, + card_details_encrypted, + key_store, + None, + ) + .await?; Ok(()) } @@ -588,12 +409,7 @@ pub async fn get_or_create_customer_details( let key = key_store.key.get_inner().peek(); match db - .find_customer_optional_by_customer_id_merchant_id( - &customer_id, - merchant_id, - key_store, - merchant_account.storage_scheme, - ) + .find_customer_optional_by_customer_id_merchant_id(&customer_id, merchant_id, key_store) .await .change_context(errors::ApiErrorResponse::InternalServerError)? { @@ -626,7 +442,7 @@ pub async fn get_or_create_customer_details( }; Ok(Some( - db.insert_customer(customer, key_store, merchant_account.storage_scheme) + db.insert_customer(customer, key_store) .await .change_context(errors::ApiErrorResponse::InternalServerError)?, )) @@ -788,7 +604,6 @@ pub async fn decide_payout_connector( TransactionData::<()>::Payout(payout_data), routing_data, eligible_connectors, - None, ) .await } @@ -810,7 +625,7 @@ pub fn should_call_payout_connector_create_customer<'a>( connector_label: &str, ) -> (bool, Option<&'a str>) { // Check if create customer is required for the connector - match enums::PayoutConnectors::try_from(connector.connector_name) { + match PayoutConnectors::try_from(connector.connector_name) { Ok(connector) => { let connector_needs_customer = state .conf diff --git a/crates/router/src/core/payouts/retry.rs b/crates/router/src/core/payouts/retry.rs index 6bbee9a4cec..fbb7ca0ba72 100644 --- a/crates/router/src/core/payouts/retry.rs +++ b/crates/router/src/core/payouts/retry.rs @@ -1,5 +1,6 @@ use std::{cmp::Ordering, str::FromStr, vec::IntoIter}; +use api_models::payouts::PayoutCreateRequest; use error_stack::{report, ResultExt}; use router_env::{ logger, @@ -31,10 +32,11 @@ pub async fn do_gsm_multiple_connector_actions( state: &app::AppState, mut connectors: IntoIter, original_connector_data: api::ConnectorData, - payout_data: &mut PayoutData, + mut payout_data: PayoutData, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, -) -> RouterResult<()> { + req: &PayoutCreateRequest, +) -> RouterResult { let mut retries = None; metrics::AUTO_PAYOUT_RETRY_ELIGIBLE_REQUEST_COUNT.add(&metrics::CONTEXT, 1, &[]); @@ -42,7 +44,7 @@ pub async fn do_gsm_multiple_connector_actions( let mut connector = original_connector_data; loop { - let gsm = get_gsm(state, &connector, payout_data).await?; + let gsm = get_gsm(state, &connector, &payout_data).await?; match get_gsm_decision(gsm) { api_models::gsm::GsmDecision::Retry => { @@ -68,12 +70,13 @@ pub async fn do_gsm_multiple_connector_actions( connector = super::get_next_connector(&mut connectors)?; - Box::pin(do_retry( + payout_data = Box::pin(do_retry( &state.clone(), connector.to_owned(), merchant_account, key_store, payout_data, + req, )) .await?; @@ -89,7 +92,7 @@ pub async fn do_gsm_multiple_connector_actions( api_models::gsm::GsmDecision::DoDefault => break, } } - Ok(()) + Ok(payout_data) } #[instrument(skip_all)] @@ -97,10 +100,11 @@ pub async fn do_gsm_multiple_connector_actions( pub async fn do_gsm_single_connector_actions( state: &app::AppState, original_connector_data: api::ConnectorData, - payout_data: &mut PayoutData, + mut payout_data: PayoutData, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, -) -> RouterResult<()> { + req: &PayoutCreateRequest, +) -> RouterResult { let mut retries = None; metrics::AUTO_PAYOUT_RETRY_ELIGIBLE_REQUEST_COUNT.add(&metrics::CONTEXT, 1, &[]); @@ -108,7 +112,7 @@ pub async fn do_gsm_single_connector_actions( let mut previous_gsm = None; // to compare previous status loop { - let gsm = get_gsm(state, &original_connector_data, payout_data).await?; + let gsm = get_gsm(state, &original_connector_data, &payout_data).await?; // if the error config is same as previous, we break out of the loop if let Ordering::Equal = gsm.cmp(&previous_gsm) { @@ -132,12 +136,13 @@ pub async fn do_gsm_single_connector_actions( break; } - Box::pin(do_retry( + payout_data = Box::pin(do_retry( &state.clone(), original_connector_data.to_owned(), merchant_account, key_store, payout_data, + req, )) .await?; @@ -153,7 +158,7 @@ pub async fn do_gsm_single_connector_actions( api_models::gsm::GsmDecision::DoDefault => break, } } - Ok(()) + Ok(payout_data) } #[instrument(skip_all)] @@ -240,13 +245,22 @@ pub async fn do_retry( connector: api::ConnectorData, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, - payout_data: &mut PayoutData, -) -> RouterResult<()> { + mut payout_data: PayoutData, + req: &PayoutCreateRequest, +) -> RouterResult { metrics::AUTO_RETRY_PAYOUT_COUNT.add(&metrics::CONTEXT, 1, &[]); - modify_trackers(state, &connector, merchant_account, payout_data).await?; + modify_trackers(state, &connector, merchant_account, &mut payout_data).await?; - call_connector_payout(state, merchant_account, key_store, &connector, payout_data).await + call_connector_payout( + state, + merchant_account, + key_store, + req, + &connector, + &mut payout_data, + ) + .await } #[instrument(skip_all)] @@ -271,7 +285,6 @@ pub async fn modify_trackers( .update_payout( &payout_data.payouts, updated_payouts, - &payout_data.payout_attempt, merchant_account.storage_scheme, ) .await @@ -295,11 +308,7 @@ pub async fn modify_trackers( ..Default::default() }; payout_data.payout_attempt = db - .insert_payout_attempt( - payout_attempt_req, - &payouts, - merchant_account.storage_scheme, - ) + .insert_payout_attempt(payout_attempt_req, merchant_account.storage_scheme) .await .to_duplicate_response(errors::ApiErrorResponse::DuplicatePayout { payout_id }) .attach_printable("Error inserting payouts in db")?; @@ -349,7 +358,6 @@ impl GsmValidation for PayoutData { | common_enums::PayoutStatus::Ineligible | common_enums::PayoutStatus::RequiresCreation | common_enums::PayoutStatus::RequiresPayoutMethodData - | common_enums::PayoutStatus::RequiresVendorAccountCreation | common_enums::PayoutStatus::RequiresFulfillment => false, common_enums::PayoutStatus::Failed => true, } diff --git a/crates/router/src/core/payouts/validator.rs b/crates/router/src/core/payouts/validator.rs index 496aab13b13..02ba3066544 100644 --- a/crates/router/src/core/payouts/validator.rs +++ b/crates/router/src/core/payouts/validator.rs @@ -1,7 +1,7 @@ #[cfg(feature = "olap")] use common_utils::errors::CustomResult; +pub use data_models::errors::StorageError; use error_stack::{report, ResultExt}; -pub use hyperswitch_domain_models::errors::StorageError; use router_env::{instrument, tracing}; use super::helpers; diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs index 09ea935ea76..715a7ae12a8 100644 --- a/crates/router/src/core/pm_auth.rs +++ b/crates/router/src/core/pm_auth.rs @@ -5,7 +5,7 @@ use api_models::{ payment_methods::{self, BankAccountAccessCreds}, payments::{AddressDetails, BankDebitBilling, BankDebitData, PaymentMethodData}, }; -use common_enums::{enums::MerchantStorageScheme, PaymentMethodType}; +use common_enums::PaymentMethodType; use hex; pub mod helpers; pub mod transformers; @@ -16,9 +16,9 @@ use common_utils::{ ext_traits::AsyncExt, generate_id, }; +use data_models::payments::PaymentIntent; use error_stack::ResultExt; use helpers::PaymentAuthConnectorDataExt; -use hyperswitch_domain_models::payments::PaymentIntent; use masking::{ExposeInterface, PeekInterface, Secret}; use pm_auth::{ connector::plaid::transformers::PlaidAuthType, @@ -311,7 +311,7 @@ async fn store_bank_details_in_payment_methods( > = HashMap::new(); for pm in payment_methods { - if pm.payment_method == Some(enums::PaymentMethod::BankDebit) { + if pm.payment_method == enums::PaymentMethod::BankDebit { let bank_details_pm_data = decrypt::( pm.payment_method_data.clone(), key, @@ -442,7 +442,7 @@ async fn store_bank_details_in_payment_methods( customer_id: customer_id.clone(), merchant_id: merchant_account.merchant_id.clone(), payment_method_id: pm_id, - payment_method: Some(enums::PaymentMethod::BankDebit), + payment_method: enums::PaymentMethod::BankDebit, payment_method_type: Some(creds.payment_method_type), payment_method_issuer: None, scheme: None, @@ -455,13 +455,7 @@ async fn store_bank_details_in_payment_methods( }; } - store_in_db( - update_entries, - new_entries, - db, - merchant_account.storage_scheme, - ) - .await?; + store_in_db(update_entries, new_entries, db).await?; Ok(()) } @@ -470,16 +464,15 @@ async fn store_in_db( update_entries: Vec<(storage::PaymentMethod, storage::PaymentMethodUpdate)>, new_entries: Vec, db: &dyn StorageInterface, - storage_scheme: MerchantStorageScheme, ) -> RouterResult<()> { let update_entries_futures = update_entries .into_iter() - .map(|(pm, pm_update)| db.update_payment_method(pm, pm_update, storage_scheme)) + .map(|(pm, pm_update)| db.update_payment_method(pm, pm_update)) .collect::>(); let new_entries_futures = new_entries .into_iter() - .map(|pm_new| db.insert_payment_method(pm_new, storage_scheme)) + .map(|pm_new| db.insert_payment_method(pm_new)) .collect::>(); let update_futures = futures::future::join_all(update_entries_futures); @@ -702,7 +695,7 @@ pub async fn retrieve_payment_method_from_auth_service( let mut bank_type = None; if let Some(account_type) = bank_account.account_type.clone() { - bank_type = common_enums::BankType::from_str(account_type.as_str()) + bank_type = api_models::enums::BankType::from_str(account_type.as_str()) .map_err(|error| logger::error!(%error,"unable to parse account_type {account_type:?}")) .ok(); } diff --git a/crates/router/src/core/poll.rs b/crates/router/src/core/poll.rs deleted file mode 100644 index 32a7b0f547c..00000000000 --- a/crates/router/src/core/poll.rs +++ /dev/null @@ -1,45 +0,0 @@ -use api_models::poll::PollResponse; -use common_utils::ext_traits::StringExt; -use error_stack::ResultExt; -use router_env::{instrument, tracing}; - -use super::errors; -use crate::{core::errors::RouterResponse, services::ApplicationResponse, types::domain, AppState}; - -#[instrument(skip_all)] -pub async fn retrieve_poll_status( - state: AppState, - req: crate::types::api::PollId, - merchant_account: domain::MerchantAccount, -) -> RouterResponse { - let redis_conn = state - .store - .get_redis_conn() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to get redis connection")?; - let request_poll_id = req.poll_id; - // prepend 'poll_{merchant_id}_' to restrict access to only fetching Poll IDs, as this is a freely passed string in the request - let poll_id = super::utils::get_poll_id(merchant_account.merchant_id, request_poll_id.clone()); - let redis_value = redis_conn - .get_key::>(poll_id.as_str()) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable_lazy(|| { - format!( - "Error while fetching the value for {} from redis", - poll_id.clone() - ) - })? - .ok_or(errors::ApiErrorResponse::PollNotFound { - id: request_poll_id.clone(), - })?; - let status = redis_value - .parse_enum("PollStatus") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error while parsing PollStatus")?; - let poll_response = PollResponse { - poll_id: request_poll_id, - status, - }; - Ok(ApplicationResponse::Json(poll_response)) -} diff --git a/crates/router/src/core/refunds/validator.rs b/crates/router/src/core/refunds/validator.rs index 49248ae4fea..43d44ebe41d 100644 --- a/crates/router/src/core/refunds/validator.rs +++ b/crates/router/src/core/refunds/validator.rs @@ -107,7 +107,7 @@ pub fn validate_refund_list(limit: Option) -> CustomResult RouterResult<()> { let payment_method = payment_attempt diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs index bec90c51e9c..31825617398 100644 --- a/crates/router/src/core/routing.rs +++ b/crates/router/src/core/routing.rs @@ -9,6 +9,7 @@ use api_models::{ }; #[cfg(not(feature = "business_profile_routing"))] use common_utils::ext_traits::{Encode, StringExt}; +#[cfg(not(feature = "business_profile_routing"))] use diesel_models::configs; #[cfg(feature = "business_profile_routing")] use diesel_models::routing_algorithm::RoutingAlgorithm; @@ -806,37 +807,6 @@ pub async fn retrieve_linked_routing_config( } } -pub async fn upsert_connector_agnostic_mandate_config( - state: AppState, - business_profile_id: &str, - mandate_config: routing_types::DetailedConnectorChoice, -) -> RouterResponse { - let key = helpers::get_pg_agnostic_mandate_config_key(business_profile_id); - - let mandate_config_str = mandate_config.enabled.to_string(); - - let find_config = state - .store - .find_config_by_key_unwrap_or(&key, Some(mandate_config_str.clone())) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("error saving pg agnostic mandate config to db")?; - - if find_config.config != mandate_config_str { - let config_update = configs::ConfigUpdate::Update { - config: Some(mandate_config_str), - }; - state - .store - .update_config_by_key(&key, config_update) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("error saving pg agnostic mandate config to db")?; - } - - Ok(service_api::ApplicationResponse::Json(mandate_config)) -} - pub async fn retrieve_default_routing_config_for_profiles( state: AppState, merchant_account: domain::MerchantAccount, diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs index fb86ba5a87b..febd1cd86dd 100644 --- a/crates/router/src/core/routing/helpers.rs +++ b/crates/router/src/core/routing/helpers.rs @@ -5,7 +5,7 @@ use api_models::routing as routing_types; use common_utils::ext_traits::Encode; use diesel_models::{ - business_profile::{BusinessProfile, BusinessProfileUpdate}, + business_profile::{BusinessProfile, BusinessProfileUpdateInternal}, configs, }; use error_stack::ResultExt; @@ -245,7 +245,7 @@ pub async fn update_business_profile_active_algorithm_ref( storage::enums::TransactionType::Payout => (None, Some(ref_val)), }; - let business_profile_update = BusinessProfileUpdate::Update { + let business_profile_update = BusinessProfileUpdateInternal { profile_name: None, return_url: None, enable_payment_response_hash: None, @@ -263,7 +263,6 @@ pub async fn update_business_profile_active_algorithm_ref( payment_link_config: None, session_expiry: None, authentication_connector_details: None, - extended_card_info_config: None, }; db.update_business_profile_by_profile_id(current_business_profile, business_profile_update) .await @@ -274,9 +273,9 @@ pub async fn update_business_profile_active_algorithm_ref( pub async fn get_merchant_connector_agnostic_mandate_config( db: &dyn StorageInterface, - business_profile_id: &str, + merchant_id: &str, ) -> RouterResult> { - let key = get_pg_agnostic_mandate_config_key(business_profile_id); + let key = get_pg_agnostic_mandate_config_key(merchant_id); let maybe_config = db.find_config_by_key(&key).await; match maybe_config { @@ -313,6 +312,29 @@ pub async fn get_merchant_connector_agnostic_mandate_config( } } +pub async fn update_merchant_connector_agnostic_mandate_config( + db: &dyn StorageInterface, + merchant_id: &str, + mandate_config: Vec, +) -> RouterResult> { + let key = get_pg_agnostic_mandate_config_key(merchant_id); + let mandate_config_str = mandate_config + .encode_to_string_of_json() + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("unable to serialize pg agnostic mandate config during update")?; + + let config_update = configs::ConfigUpdate::Update { + config: Some(mandate_config_str), + }; + + db.update_config_by_key(&key, config_update) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("error saving pg agnostic mandate config to db")?; + + Ok(mandate_config) +} + pub async fn validate_connectors_in_routing_config( db: &dyn StorageInterface, key_store: &domain::MerchantKeyStore, @@ -443,8 +465,8 @@ pub fn get_routing_dictionary_key(merchant_id: &str) -> String { /// Provides the identifier for the specific merchant's agnostic_mandate_config #[inline(always)] -pub fn get_pg_agnostic_mandate_config_key(business_profile_id: &str) -> String { - format!("pg_agnostic_mandate_{business_profile_id}") +pub fn get_pg_agnostic_mandate_config_key(merchant_id: &str) -> String { + format!("pg_agnostic_mandate_{merchant_id}") } /// Provides the identifier for the specific merchant's default_config diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs index 0ae1b162e0e..2702cec8eb5 100644 --- a/crates/router/src/core/user.rs +++ b/crates/router/src/core/user.rs @@ -15,7 +15,7 @@ use super::errors::{StorageErrorExt, UserErrors, UserResponse, UserResult}; use crate::services::email::types as email_types; use crate::{ consts, - routes::{app::ReqState, AppState}, + routes::AppState, services::{authentication as auth, authorization::roles, ApplicationResponse}, types::{domain, transformers::ForeignInto}, utils, @@ -71,26 +71,6 @@ pub async fn signup_with_merchant_id( })) } -pub async fn get_user_details( - state: AppState, - user_from_token: auth::UserFromToken, -) -> UserResponse { - let user = user_from_token.get_user_from_db(&state).await?; - let verification_days_left = utils::user::get_verification_days_left(&state, &user)?; - - Ok(ApplicationResponse::Json( - user_api::GetUserDetailsResponse { - merchant_id: user_from_token.merchant_id, - name: user.get_name(), - email: user.get_email(), - user_id: user.get_user_id().to_string(), - verification_days_left, - role_id: user_from_token.role_id, - org_id: user_from_token.org_id, - }, - )) -} - pub async fn signup( state: AppState, request: user_api::SignUpRequest, @@ -120,13 +100,41 @@ pub async fn signup( auth::cookies::set_cookie_response(response, token) } +pub async fn signin_without_invite_checks( + state: AppState, + request: user_api::SignInRequest, +) -> UserResponse { + let user_from_db: domain::UserFromStorage = state + .store + .find_user_by_email(request.email.clone().expose().expose().as_str()) + .await + .map_err(|e| { + if e.current_context().is_db_not_found() { + e.change_context(UserErrors::InvalidCredentials) + } else { + e.change_context(UserErrors::InternalServerError) + } + })? + .into(); + + user_from_db.compare_password(request.password)?; + + let user_role = user_from_db.get_role_from_db(state.clone()).await?; + utils::user_role::set_role_permissions_in_cache_by_user_role(&state, &user_role).await; + + let token = utils::user::generate_jwt_auth_token(&state, &user_from_db, &user_role).await?; + let response = + utils::user::get_dashboard_entry_response(&state, user_from_db, user_role, token.clone())?; + auth::cookies::set_cookie_response(response, token) +} + pub async fn signin( state: AppState, request: user_api::SignInRequest, -) -> UserResponse { +) -> UserResponse { let user_from_db: domain::UserFromStorage = state .store - .find_user_by_email(&request.email) + .find_user_by_email(request.email.clone().expose().expose().as_str()) .await .map_err(|e| { if e.current_context().is_db_not_found() { @@ -161,48 +169,6 @@ pub async fn signin( let response = signin_strategy.get_signin_response(&state).await?; let token = utils::user::get_token_from_signin_response(&response); - auth::cookies::set_cookie_response( - user_api::SignInWithTokenResponse::SignInResponse(response), - token, - ) -} - -pub async fn signin_token_only_flow( - state: AppState, - request: user_api::SignInRequest, -) -> UserResponse { - let user_from_db: domain::UserFromStorage = state - .store - .find_user_by_email(&request.email) - .await - .to_not_found_response(UserErrors::InvalidCredentials)? - .into(); - - user_from_db.compare_password(request.password)?; - - let next_flow = - domain::NextFlow::from_origin(domain::Origin::SignIn, user_from_db.clone(), &state).await?; - - let token = match next_flow.get_flow() { - domain::UserFlow::SPTFlow(spt_flow) => spt_flow.generate_spt(&state, &next_flow).await, - domain::UserFlow::JWTFlow(jwt_flow) => { - #[cfg(feature = "email")] - { - user_from_db.get_verification_days_left(&state)?; - } - - let user_role = user_from_db - .get_preferred_or_active_user_role_from_db(&state) - .await - .to_not_found_response(UserErrors::InternalServerError)?; - jwt_flow.generate_jwt(&state, &next_flow, &user_role).await - } - }?; - - let response = user_api::SignInWithTokenResponse::Token(user_api::TokenResponse { - token: token.clone(), - token_type: next_flow.get_flow().into(), - }); auth::cookies::set_cookie_response(response, token) } @@ -211,7 +177,10 @@ pub async fn connect_account( state: AppState, request: user_api::ConnectAccountRequest, ) -> UserResponse { - let find_user = state.store.find_user_by_email(&request.email).await; + let find_user = state + .store + .find_user_by_email(request.email.clone().expose().expose().as_str()) + .await; if let Ok(found_user) = find_user { let user_from_db: domain::UserFromStorage = found_user.into(); @@ -371,7 +340,7 @@ pub async fn forgot_password( let user_from_db = state .store - .find_user_by_email(&user_email.into_inner()) + .find_user_by_email(user_email.get_secret().expose().as_str()) .await .map_err(|e| { if e.current_context().is_db_not_found() { @@ -420,9 +389,7 @@ pub async fn reset_password( let user = state .store .update_user_by_email( - &email_token - .get_email() - .change_context(UserErrors::InternalServerError)?, + email_token.get_email(), storage_user::UserUpdate::AccountUpdate { name: None, password: Some(hash_password), @@ -458,11 +425,205 @@ pub async fn reset_password( Ok(ApplicationResponse::StatusOk) } +pub async fn invite_user( + state: AppState, + request: user_api::InviteUserRequest, + user_from_token: auth::UserFromToken, +) -> UserResponse { + let inviter_user = state + .store + .find_user_by_id(user_from_token.user_id.as_str()) + .await + .change_context(UserErrors::InternalServerError)?; + + if inviter_user.email == request.email { + return Err(UserErrors::InvalidRoleOperationWithMessage( + "User Inviting themselves".to_string(), + ) + .into()); + } + + let role_info = roles::RoleInfo::from_role_id( + &state, + &request.role_id, + &user_from_token.merchant_id, + &user_from_token.org_id, + ) + .await + .to_not_found_response(UserErrors::InvalidRoleId)?; + + if !role_info.is_invitable() { + return Err(report!(UserErrors::InvalidRoleId)) + .attach_printable(format!("role_id = {} is not invitable", request.role_id)); + } + + let invitee_email = domain::UserEmail::from_pii_email(request.email.clone())?; + + let invitee_user = state + .store + .find_user_by_email(invitee_email.clone().get_secret().expose().as_str()) + .await; + + if let Ok(invitee_user) = invitee_user { + let invitee_user_from_db = domain::UserFromStorage::from(invitee_user); + + let now = common_utils::date_time::now(); + state + .store + .insert_user_role(UserRoleNew { + user_id: invitee_user_from_db.get_user_id().to_owned(), + merchant_id: user_from_token.merchant_id.clone(), + role_id: request.role_id, + org_id: user_from_token.org_id, + status: { + if cfg!(feature = "email") { + UserStatus::InvitationSent + } else { + UserStatus::Active + } + }, + created_by: user_from_token.user_id.clone(), + last_modified_by: user_from_token.user_id, + created_at: now, + last_modified: now, + }) + .await + .map_err(|e| { + if e.current_context().is_db_unique_violation() { + e.change_context(UserErrors::UserExists) + } else { + e.change_context(UserErrors::InternalServerError) + } + })?; + + let is_email_sent; + #[cfg(feature = "email")] + { + let email_contents = email_types::InviteRegisteredUser { + recipient_email: invitee_email, + user_name: domain::UserName::new(invitee_user_from_db.get_name())?, + settings: state.conf.clone(), + subject: "You have been invited to join Hyperswitch Community!", + merchant_id: user_from_token.merchant_id, + }; + + is_email_sent = state + .email_client + .compose_and_send_email( + Box::new(email_contents), + state.conf.proxy.https_url.as_ref(), + ) + .await + .map(|email_result| logger::info!(?email_result)) + .map_err(|email_result| logger::error!(?email_result)) + .is_ok(); + } + #[cfg(not(feature = "email"))] + { + is_email_sent = false; + } + Ok(ApplicationResponse::Json(user_api::InviteUserResponse { + is_email_sent, + password: None, + })) + } else if invitee_user + .as_ref() + .map_err(|e| e.current_context().is_db_not_found()) + .err() + .unwrap_or(false) + { + let new_user = domain::NewUser::try_from((request.clone(), user_from_token.clone()))?; + + new_user + .insert_user_in_db(state.store.as_ref()) + .await + .change_context(UserErrors::InternalServerError)?; + + let invitation_status = if cfg!(feature = "email") { + UserStatus::InvitationSent + } else { + UserStatus::Active + }; + + let now = common_utils::date_time::now(); + state + .store + .insert_user_role(UserRoleNew { + user_id: new_user.get_user_id().to_owned(), + merchant_id: user_from_token.merchant_id.clone(), + role_id: request.role_id.clone(), + org_id: user_from_token.org_id.clone(), + status: invitation_status, + created_by: user_from_token.user_id.clone(), + last_modified_by: user_from_token.user_id, + created_at: now, + last_modified: now, + }) + .await + .map_err(|e| { + if e.current_context().is_db_unique_violation() { + e.change_context(UserErrors::UserExists) + } else { + e.change_context(UserErrors::InternalServerError) + } + })?; + + let is_email_sent; + #[cfg(feature = "email")] + { + let email_contents = email_types::InviteUser { + recipient_email: invitee_email, + user_name: domain::UserName::new(new_user.get_name())?, + settings: state.conf.clone(), + subject: "You have been invited to join Hyperswitch Community!", + merchant_id: user_from_token.merchant_id, + }; + let send_email_result = state + .email_client + .compose_and_send_email( + Box::new(email_contents), + state.conf.proxy.https_url.as_ref(), + ) + .await; + logger::info!(?send_email_result); + is_email_sent = send_email_result.is_ok(); + } + #[cfg(not(feature = "email"))] + { + is_email_sent = false; + let invited_user_token = auth::UserFromToken { + user_id: new_user.get_user_id(), + merchant_id: user_from_token.merchant_id, + org_id: user_from_token.org_id, + role_id: request.role_id, + }; + + let set_metadata_request = SetMetaDataRequest::IsChangePasswordRequired; + dashboard_metadata::set_metadata( + state.clone(), + invited_user_token, + set_metadata_request, + ) + .await?; + } + + Ok(ApplicationResponse::Json(user_api::InviteUserResponse { + is_email_sent, + password: if cfg!(not(feature = "email")) { + Some(new_user.get_password().get_secret()) + } else { + None + }, + })) + } else { + Err(report!(UserErrors::InternalServerError)) + } +} + pub async fn invite_multiple_user( state: AppState, user_from_token: auth::UserFromToken, requests: Vec, - req_state: ReqState, ) -> UserResponse> { if requests.len() > 10 { return Err(report!(UserErrors::MaxInvitationsError)) @@ -470,7 +631,7 @@ pub async fn invite_multiple_user( } let responses = futures::future::join_all(requests.iter().map(|request| async { - match handle_invitation(&state, &user_from_token, request, &req_state).await { + match handle_invitation(&state, &user_from_token, request).await { Ok(response) => response, Err(error) => InviteMultipleUserResponse { email: request.email.clone(), @@ -489,7 +650,6 @@ async fn handle_invitation( state: &AppState, user_from_token: &auth::UserFromToken, request: &user_api::InviteUserRequest, - req_state: &ReqState, ) -> UserResult { let inviter_user = user_from_token.get_user_from_db(state).await?; @@ -517,7 +677,7 @@ async fn handle_invitation( let invitee_email = domain::UserEmail::from_pii_email(request.email.clone())?; let invitee_user = state .store - .find_user_by_email(&invitee_email.into_inner()) + .find_user_by_email(invitee_email.clone().get_secret().expose().as_str()) .await; if let Ok(invitee_user) = invitee_user { @@ -528,7 +688,7 @@ async fn handle_invitation( .err() .unwrap_or(false) { - handle_new_user_invitation(state, user_from_token, request, req_state.clone()).await + handle_new_user_invitation(state, user_from_token, request).await } else { Err(UserErrors::InternalServerError.into()) } @@ -610,7 +770,6 @@ async fn handle_new_user_invitation( state: &AppState, user_from_token: &auth::UserFromToken, request: &user_api::InviteUserRequest, - req_state: ReqState, ) -> UserResult { let new_user = domain::NewUser::try_from((request.clone(), user_from_token.clone()))?; @@ -651,9 +810,6 @@ async fn handle_new_user_invitation( let is_email_sent; #[cfg(feature = "email")] { - // TODO: Adding this to avoid clippy lints - // Will be adding actual usage for this variable later - let _ = req_state.clone(); let invitee_email = domain::UserEmail::from_pii_email(request.email.clone())?; let email_contents = email_types::InviteUser { recipient_email: invitee_email, @@ -684,13 +840,8 @@ async fn handle_new_user_invitation( }; let set_metadata_request = SetMetaDataRequest::IsChangePasswordRequired; - dashboard_metadata::set_metadata( - state.clone(), - invited_user_token, - set_metadata_request, - req_state, - ) - .await?; + dashboard_metadata::set_metadata(state.clone(), invited_user_token, set_metadata_request) + .await?; } Ok(InviteMultipleUserResponse { @@ -710,12 +861,11 @@ pub async fn resend_invite( state: AppState, user_from_token: auth::UserFromToken, request: user_api::ReInviteUserRequest, - _req_state: ReqState, ) -> UserResponse<()> { let invitee_email = domain::UserEmail::from_pii_email(request.email)?; let user: domain::UserFromStorage = state .store - .find_user_by_email(&invitee_email.clone().into_inner()) + .find_user_by_email(invitee_email.clone().get_secret().expose().as_str()) .await .map_err(|e| { if e.current_context().is_db_not_found() { @@ -782,11 +932,7 @@ pub async fn accept_invite_from_email( let user: domain::UserFromStorage = state .store - .find_user_by_email( - &email_token - .get_email() - .change_context(UserErrors::InternalServerError)?, - ) + .find_user_by_email(email_token.get_email()) .await .change_context(UserErrors::InternalServerError)? .into(); @@ -1027,7 +1173,7 @@ pub async fn create_merchant_account( Ok(ApplicationResponse::StatusOk) } -pub async fn list_merchants_for_user( +pub async fn list_merchant_ids_for_user( state: AppState, user_from_token: auth::UserFromToken, ) -> UserResponse> { @@ -1048,24 +1194,16 @@ pub async fn list_merchants_for_user( .await .change_context(UserErrors::InternalServerError)?; - let roles = - utils::user_role::get_multiple_role_info_for_user_roles(&state, &user_roles).await?; - Ok(ApplicationResponse::Json( - utils::user::get_multiple_merchant_details_with_status( - user_roles, - merchant_accounts, - roles, - )?, + utils::user::get_multiple_merchant_details_with_status(user_roles, merchant_accounts)?, )) } pub async fn get_user_details_in_merchant_account( state: AppState, user_from_token: auth::UserFromToken, - request: user_api::GetUserRoleDetailsRequest, - _req_state: ReqState, -) -> UserResponse { + request: user_api::GetUserDetailsRequest, +) -> UserResponse { let required_user = utils::user::get_user_from_db_by_email(&state, request.email.try_into()?) .await .to_not_found_response(UserErrors::InvalidRoleOperation)?; @@ -1091,7 +1229,7 @@ pub async fn get_user_details_in_merchant_account( .attach_printable("User role exists but the corresponding role doesn't")?; Ok(ApplicationResponse::Json( - user_api::GetUserRoleDetailsResponse { + user_api::GetUserDetailsResponse { email: required_user.get_email(), name: required_user.get_name(), role_id: role_info.get_role_id().to_string(), @@ -1151,6 +1289,40 @@ pub async fn list_users_for_merchant_account( ))) } +#[cfg(feature = "email")] +pub async fn verify_email_without_invite_checks( + state: AppState, + req: user_api::VerifyEmailRequest, +) -> UserResponse { + let token = req.token.clone().expose(); + let email_token = auth::decode_jwt::(&token, &state) + .await + .change_context(UserErrors::LinkInvalid)?; + auth::blacklist::check_email_token_in_blacklist(&state, &token).await?; + let user = state + .store + .find_user_by_email(email_token.get_email()) + .await + .change_context(UserErrors::InternalServerError)?; + let user = state + .store + .update_user_by_user_id(user.user_id.as_str(), storage_user::UserUpdate::VerifyUser) + .await + .change_context(UserErrors::InternalServerError)?; + let user_from_db: domain::UserFromStorage = user.into(); + let user_role = user_from_db.get_role_from_db(state.clone()).await?; + let _ = auth::blacklist::insert_email_token_in_blacklist(&state, &token) + .await + .map_err(|e| logger::error!(?e)); + let token = utils::user::generate_jwt_auth_token(&state, &user_from_db, &user_role).await?; + utils::user_role::set_role_permissions_in_cache_by_user_role(&state, &user_role).await; + + let response = + utils::user::get_dashboard_entry_response(&state, user_from_db, user_role, token.clone())?; + + auth::cookies::set_cookie_response(response, token) +} + #[cfg(feature = "email")] pub async fn verify_email( state: AppState, @@ -1165,11 +1337,7 @@ pub async fn verify_email( let user = state .store - .find_user_by_email( - &email_token - .get_email() - .change_context(UserErrors::InternalServerError)?, - ) + .find_user_by_email(email_token.get_email()) .await .change_context(UserErrors::InternalServerError)?; @@ -1218,7 +1386,7 @@ pub async fn send_verification_mail( let user_email = domain::UserEmail::try_from(req.email)?; let user = state .store - .find_user_by_email(&user_email.into_inner()) + .find_user_by_email(user_email.clone().get_secret().expose().as_str()) .await .map_err(|e| { if e.current_context().is_db_not_found() { @@ -1283,7 +1451,6 @@ pub async fn update_user_details( state: AppState, user_token: auth::UserFromToken, req: user_api::UpdateUserAccountDetailsRequest, - _req_state: ReqState, ) -> UserResponse<()> { let user: domain::UserFromStorage = state .store diff --git a/crates/router/src/core/user/dashboard_metadata.rs b/crates/router/src/core/user/dashboard_metadata.rs index c3512c32f42..328a54c540b 100644 --- a/crates/router/src/core/user/dashboard_metadata.rs +++ b/crates/router/src/core/user/dashboard_metadata.rs @@ -10,7 +10,7 @@ use router_env::logger; use crate::{ core::errors::{UserErrors, UserResponse, UserResult}, - routes::{app::ReqState, AppState}, + routes::AppState, services::{authentication::UserFromToken, ApplicationResponse}, types::domain::{user::dashboard_metadata as types, MerchantKeyStore}, utils::user::dashboard_metadata as utils, @@ -22,7 +22,6 @@ pub async fn set_metadata( state: AppState, user: UserFromToken, request: api::SetMetaDataRequest, - _req_state: ReqState, ) -> UserResponse<()> { let metadata_value = parse_set_request(request)?; let metadata_key = DBEnum::from(&metadata_value); @@ -36,7 +35,6 @@ pub async fn get_multiple_metadata( state: AppState, user: UserFromToken, request: GetMultipleMetaDataPayload, - _req_state: ReqState, ) -> UserResponse> { let metadata_keys: Vec = request.results.into_iter().map(parse_get_request).collect(); @@ -112,9 +110,6 @@ fn parse_set_request(data_enum: api::SetMetaDataRequest) -> UserResult { Ok(types::MetaData::IsChangePasswordRequired(true)) } - api::SetMetaDataRequest::OnboardingSurvey(req) => { - Ok(types::MetaData::OnboardingSurvey(req)) - } } } @@ -142,7 +137,6 @@ fn parse_get_request(data_enum: api::GetMetaDataRequest) -> DBEnum { api::GetMetaDataRequest::SetupWoocomWebhook => DBEnum::SetupWoocomWebhook, api::GetMetaDataRequest::IsMultipleConfiguration => DBEnum::IsMultipleConfiguration, api::GetMetaDataRequest::IsChangePasswordRequired => DBEnum::IsChangePasswordRequired, - api::GetMetaDataRequest::OnboardingSurvey => DBEnum::OnboardingSurvey, } } @@ -222,10 +216,6 @@ fn into_response( DBEnum::IsChangePasswordRequired => Ok(api::GetMetaDataResponse::IsChangePasswordRequired( data.is_some(), )), - DBEnum::OnboardingSurvey => { - let resp = utils::deserialize_to_response(data)?; - Ok(api::GetMetaDataResponse::OnboardingSurvey(resp)) - } } } @@ -556,17 +546,6 @@ async fn insert_metadata( ) .await } - types::MetaData::OnboardingSurvey(data) => { - utils::insert_merchant_scoped_metadata_to_db( - state, - user.user_id, - user.merchant_id, - user.org_id, - metadata_key, - data, - ) - .await - } } } diff --git a/crates/router/src/core/user/sample_data.rs b/crates/router/src/core/user/sample_data.rs index e1bde652305..19b7d3bd815 100644 --- a/crates/router/src/core/user/sample_data.rs +++ b/crates/router/src/core/user/sample_data.rs @@ -1,13 +1,13 @@ use api_models::user::sample_data::SampleDataRequest; use common_utils::errors::ReportSwitchExt; +use data_models::payments::payment_intent::PaymentIntentNew; use diesel_models::{user::sample_data::PaymentAttemptBatchNew, RefundNew}; -use hyperswitch_domain_models::payments::payment_intent::PaymentIntentNew; pub type SampleDataApiResponse = SampleDataResult>; use crate::{ core::errors::sample_data::SampleDataResult, - routes::{app::ReqState, AppState}, + routes::AppState, services::{authentication::UserFromToken, ApplicationResponse}, utils::user::sample_data::generate_sample_data, }; @@ -16,7 +16,6 @@ pub async fn generate_sample_data_for_user( state: AppState, user_from_token: UserFromToken, req: SampleDataRequest, - _req_state: ReqState, ) -> SampleDataApiResponse<()> { let sample_data = generate_sample_data(&state, req, user_from_token.merchant_id.as_str()).await?; @@ -60,7 +59,6 @@ pub async fn delete_sample_data_for_user( state: AppState, user_from_token: UserFromToken, _req: SampleDataRequest, - _req_state: ReqState, ) -> SampleDataApiResponse<()> { let merchant_id_del = user_from_token.merchant_id.as_str(); diff --git a/crates/router/src/core/user_role.rs b/crates/router/src/core/user_role.rs index 3f913b88a3f..2939c7d51b3 100644 --- a/crates/router/src/core/user_role.rs +++ b/crates/router/src/core/user_role.rs @@ -1,14 +1,15 @@ use api_models::{user as user_api, user_role as user_role_api}; use diesel_models::{enums::UserStatus, user_role::UserRoleUpdate}; use error_stack::{report, ResultExt}; +use masking::ExposeInterface; use router_env::logger; use crate::{ consts, core::errors::{StorageErrorExt, UserErrors, UserResponse}, - routes::{app::ReqState, AppState}, + routes::AppState, services::{ - authentication as auth, + authentication::{self as auth}, authorization::{info, roles}, ApplicationResponse, }, @@ -49,7 +50,6 @@ pub async fn update_user_role( state: AppState, user_from_token: auth::UserFromToken, req: user_role_api::UpdateUserRoleRequest, - _req_state: ReqState, ) -> UserResponse<()> { let role_info = roles::RoleInfo::from_role_id( &state, @@ -120,7 +120,6 @@ pub async fn transfer_org_ownership( state: AppState, user_from_token: auth::UserFromToken, req: user_role_api::TransferOrgOwnershipRequest, - _req_state: ReqState, ) -> UserResponse { if user_from_token.role_id != consts::user_role::ROLE_ID_ORGANIZATION_ADMIN { return Err(report!(UserErrors::InvalidRoleOperation)).attach_printable(format!( @@ -170,9 +169,8 @@ pub async fn transfer_org_ownership( pub async fn accept_invitation( state: AppState, - user_token: auth::UserFromSinglePurposeToken, + user_token: auth::UserWithoutMerchantFromToken, req: user_role_api::AcceptInvitationRequest, - _req_state: ReqState, ) -> UserResponse { let user_role = futures::future::join_all(req.merchant_ids.iter().map(|merchant_id| async { state @@ -225,11 +223,15 @@ pub async fn delete_user_role( state: AppState, user_from_token: auth::UserFromToken, request: user_role_api::DeleteUserRoleRequest, - _req_state: ReqState, ) -> UserResponse<()> { let user_from_db: domain::UserFromStorage = state .store - .find_user_by_email(&domain::UserEmail::from_pii_email(request.email)?.into_inner()) + .find_user_by_email( + domain::UserEmail::from_pii_email(request.email)? + .get_secret() + .expose() + .as_str(), + ) .await .map_err(|e| { if e.current_context().is_db_not_found() { @@ -276,7 +278,7 @@ pub async fn delete_user_role( } }; - let deleted_user_role = if user_roles.len() > 1 { + if user_roles.len() > 1 { state .store .delete_user_role_by_user_id_merchant_id( @@ -285,7 +287,9 @@ pub async fn delete_user_role( ) .await .change_context(UserErrors::InternalServerError) - .attach_printable("Error while deleting user role")? + .attach_printable("Error while deleting user role")?; + + Ok(ApplicationResponse::StatusOk) } else { state .store @@ -302,9 +306,8 @@ pub async fn delete_user_role( ) .await .change_context(UserErrors::InternalServerError) - .attach_printable("Error while deleting user role")? - }; + .attach_printable("Error while deleting user role")?; - auth::blacklist::insert_user_in_blacklist(&state, &deleted_user_role.user_id).await?; - Ok(ApplicationResponse::StatusOk) + Ok(ApplicationResponse::StatusOk) + } } diff --git a/crates/router/src/core/user_role/role.rs b/crates/router/src/core/user_role/role.rs index 504d5dd632b..a0cf5a6caf9 100644 --- a/crates/router/src/core/user_role/role.rs +++ b/crates/router/src/core/user_role/role.rs @@ -7,7 +7,7 @@ use error_stack::{report, ResultExt}; use crate::{ consts, core::errors::{StorageErrorExt, UserErrors, UserResponse}, - routes::{app::ReqState, AppState}, + routes::AppState, services::{ authentication::{blacklist, UserFromToken}, authorization::roles::{self, predefined_roles::PREDEFINED_ROLES}, @@ -57,7 +57,6 @@ pub async fn create_role( state: AppState, user_from_token: UserFromToken, req: role_api::CreateRoleRequest, - _req_state: ReqState, ) -> UserResponse { let now = common_utils::date_time::now(); let role_name = RoleName::new(req.role_name)?; diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs index 3923663f5d1..3423ace6e5b 100644 --- a/crates/router/src/core/utils.rs +++ b/crates/router/src/core/utils.rs @@ -1,16 +1,11 @@ use std::{marker::PhantomData, str::FromStr}; use api_models::enums::{DisputeStage, DisputeStatus}; -#[cfg(feature = "payouts")] -use api_models::payouts::PayoutVendorAccountDetails; -use common_enums::{IntentStatus, RequestIncrementalAuthorization}; +use common_enums::RequestIncrementalAuthorization; #[cfg(feature = "payouts")] use common_utils::{crypto::Encryptable, pii::Email}; use common_utils::{errors::CustomResult, ext_traits::AsyncExt}; use error_stack::{report, ResultExt}; -#[cfg(feature = "payouts")] -use masking::PeekInterface; -use maud::{html, PreEscaped}; use router_env::{instrument, tracing}; use uuid::Uuid; @@ -28,16 +23,13 @@ use crate::{ types::{ self, domain, storage::{self, enums}, - ErrorResponse, PollConfig, + ErrorResponse, }, utils::{generate_id, generate_uuid, OptionExt, ValueExt}, }; pub const IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_DISPUTE_FLOW: &str = "irrelevant_connector_request_reference_id_in_dispute_flow"; -#[cfg(feature = "payouts")] -pub const IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_PAYOUTS_FLOW: &str = - "irrelevant_connector_request_reference_id_in_payouts_flow"; const IRRELEVANT_PAYMENT_ID_IN_DISPUTE_FLOW: &str = "irrelevant_payment_id_in_dispute_flow"; const IRRELEVANT_ATTEMPT_ID_IN_DISPUTE_FLOW: &str = "irrelevant_attempt_id_in_dispute_flow"; @@ -72,14 +64,15 @@ pub async fn get_mca_for_payout<'a>( #[instrument(skip_all)] pub async fn construct_payout_router_data<'a, F>( state: &'a AppState, - connector_name: &api_models::enums::Connector, + connector_id: &str, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, + _request: &api_models::payouts::PayoutRequest, payout_data: &mut PayoutData, ) -> RouterResult> { let merchant_connector_account = get_mca_for_payout( state, - &connector_name.to_string(), + connector_id, merchant_account, key_store, payout_data, @@ -123,36 +116,25 @@ pub async fn construct_payout_router_data<'a, F>( let payouts = &payout_data.payouts; let payout_attempt = &payout_data.payout_attempt; let customer_details = &payout_data.customer_details; + let connector_name = payout_attempt + .connector + .clone() + .get_required_value("connector") + .change_context(errors::ApiErrorResponse::InvalidRequestData { + message: "Could not decide to route the connector".to_string(), + })?; let connector_label = format!("{}_{}", payout_data.profile_id, connector_name); let connector_customer_id = customer_details .as_ref() .and_then(|c| c.connector_customer.as_ref()) .and_then(|cc| cc.get(connector_label)) .and_then(|id| serde_json::from_value::(id.to_owned()).ok()); - - let vendor_details: Option = - match api_models::enums::PayoutConnectors::try_from(connector_name.to_owned()).map_err( - |err| report!(errors::ApiErrorResponse::InternalServerError).attach_printable(err), - )? { - api_models::enums::PayoutConnectors::Stripe => { - payout_data.payouts.metadata.to_owned().and_then(|meta| { - let val = meta - .peek() - .to_owned() - .parse_value("PayoutVendorAccountDetails") - .ok(); - val - }) - } - _ => None, - }; - let router_data = types::RouterData { flow: PhantomData, merchant_id: merchant_account.merchant_id.to_owned(), customer_id: None, connector_customer: connector_customer_id, - connector: connector_name.to_string(), + connector: connector_id.to_string(), payment_id: "".to_string(), attempt_id: "".to_string(), status: enums::AttemptStatus::Failure, @@ -160,6 +142,7 @@ pub async fn construct_payout_router_data<'a, F>( connector_auth_type, description: None, return_url: payouts.return_url.to_owned(), + payment_method_id: None, address, auth_type: enums::AuthenticationType::default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -173,7 +156,6 @@ pub async fn construct_payout_router_data<'a, F>( source_currency: payouts.source_currency, entity_type: payouts.entity_type.to_owned(), payout_type: payouts.payout_type, - vendor_details, customer_details: customer_details .to_owned() .map(|c| payments::CustomerDetails { @@ -191,7 +173,7 @@ pub async fn construct_payout_router_data<'a, F>( payment_method_token: None, recurring_mandate_payment_data: None, preprocessing_id: None, - connector_request_reference_id: IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_PAYOUTS_FLOW + connector_request_reference_id: IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_DISPUTE_FLOW .to_string(), payout_method_data: payout_data.payout_method_data.to_owned(), quote_id: None, @@ -310,6 +292,7 @@ pub async fn construct_refund_router_data<'a, F>( connector_auth_type: auth_type, description: None, return_url: payment_intent.return_url.clone(), + payment_method_id: payment_attempt.payment_method_id.clone(), // Does refund need shipping/billing address ? address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), @@ -555,6 +538,7 @@ pub async fn construct_accept_dispute_router_data<'a>( connector_auth_type: auth_type, description: None, return_url: payment_intent.return_url.clone(), + payment_method_id: payment_attempt.payment_method_id.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -649,6 +633,7 @@ pub async fn construct_submit_evidence_router_data<'a>( connector_auth_type: auth_type, description: None, return_url: payment_intent.return_url.clone(), + payment_method_id: payment_attempt.payment_method_id.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -741,6 +726,7 @@ pub async fn construct_upload_file_router_data<'a>( connector_auth_type: auth_type, description: None, return_url: payment_intent.return_url.clone(), + payment_method_id: payment_attempt.payment_method_id.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -837,6 +823,7 @@ pub async fn construct_defend_dispute_router_data<'a>( connector_auth_type: auth_type, description: None, return_url: payment_intent.return_url.clone(), + payment_method_id: payment_attempt.payment_method_id.clone(), address: PaymentAddress::default(), auth_type: payment_attempt.authentication_type.unwrap_or_default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -924,6 +911,7 @@ pub async fn construct_retrieve_file_router_data<'a>( connector_auth_type: auth_type, description: None, return_url: None, + payment_method_id: None, address: PaymentAddress::default(), auth_type: diesel_models::enums::AuthenticationType::default(), connector_meta_data: merchant_connector_account.get_metadata(), @@ -976,7 +964,7 @@ pub fn is_merchant_enabled_for_payment_id_as_connector_request_id( pub fn get_connector_request_reference_id( conf: &Settings, merchant_id: &str, - payment_attempt: &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt, + payment_attempt: &data_models::payments::payment_attempt::PaymentAttempt, ) -> String { let is_config_enabled_for_merchant = is_merchant_enabled_for_payment_id_as_connector_request_id(conf, merchant_id); @@ -1102,96 +1090,6 @@ pub async fn get_profile_id_from_business_details( } } -pub fn get_poll_id(merchant_id: String, unique_id: String) -> String { - format!("poll_{}_{}", merchant_id, unique_id) -} - -pub fn get_external_authentication_request_poll_id(payment_id: &String) -> String { - format!("external_authentication_{}", payment_id) -} - -pub fn get_html_redirect_response_for_external_authentication( - return_url_with_query_params: String, - payment_response: &api_models::payments::PaymentsResponse, - payment_id: String, - poll_config: &PollConfig, -) -> RouterResult { - // if intent_status is requires_customer_action then set poll_id, fetch poll config and do a poll_status post message, else do open_url post message to redirect to return_url - let html = match payment_response.status { - IntentStatus::RequiresCustomerAction => { - // Request poll id sent to client for retrieve_poll_status api - let req_poll_id = get_external_authentication_request_poll_id(&payment_id); - let poll_frequency = poll_config.frequency; - let poll_delay_in_secs = poll_config.delay_in_secs; - html! { - head { - title { "Redirect Form" } - (PreEscaped(format!(r#" - - "#))) - } - } - .into_string() - }, - _ => { - html! { - head { - title { "Redirect Form" } - (PreEscaped(format!(r#" - - "#))) - } - } - .into_string() - }, - }; - Ok(html) -} - #[inline] pub fn get_flow_name() -> RouterResult { Ok(std::any::type_name::() diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rs index 8782126b0b6..3f738df5920 100644 --- a/crates/router/src/core/verification.rs +++ b/crates/router/src/core/verification.rs @@ -22,8 +22,8 @@ pub async fn verify_merchant_creds_for_applepay( .common_merchant_identifier .clone() .expose(); - let cert_data = applepay_merchant_configs.merchant_cert.clone(); - let key_data = applepay_merchant_configs.merchant_cert_key.clone(); + let cert_data = applepay_merchant_configs.merchant_cert.clone().expose(); + let key_data = applepay_merchant_configs.merchant_cert_key.clone().expose(); let applepay_endpoint = &applepay_merchant_configs.applepay_endpoint; let request_body = verifications::ApplepayMerchantVerificationConfigs { diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs index 0bc52081a30..6b25edda702 100644 --- a/crates/router/src/core/webhooks.rs +++ b/crates/router/src/core/webhooks.rs @@ -39,18 +39,13 @@ use crate::{ outgoing_webhook_logs::{OutgoingWebhookEvent, OutgoingWebhookEventMetric}, }, logger, - routes::{ - app::{AppStateInfo, ReqState}, - lock_utils, - metrics::request::add_attributes, - AppState, - }, + routes::{app::AppStateInfo, lock_utils, metrics::request::add_attributes, AppState}, services::{self, authentication as auth}, types::{ api::{self, mandates::MandateResponseExt}, domain::{self, types as domain_types}, storage::{self, enums}, - transformers::{ForeignFrom, ForeignInto, ForeignTryFrom}, + transformers::{ForeignInto, ForeignTryFrom}, }, utils::{self as helper_utils, generate_id, OptionExt, ValueExt}, workflows::outgoing_webhook_retry, @@ -61,7 +56,6 @@ const MERCHANT_ID: &str = "merchant_id"; pub async fn payments_incoming_webhook_flow( state: AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, business_profile: diesel_models::business_profile::BusinessProfile, key_store: domain::MerchantKeyStore, @@ -105,7 +99,6 @@ pub async fn payments_incoming_webhook_flow( Ctx, >( state.clone(), - req_state, merchant_account.clone(), key_store.clone(), payments::operations::PaymentStatus, @@ -307,10 +300,8 @@ pub async fn get_payment_attempt_from_object_reference_id( state: &AppState, object_reference_id: api_models::webhooks::ObjectReferenceId, merchant_account: &domain::MerchantAccount, -) -> CustomResult< - hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt, - errors::ApiErrorResponse, -> { +) -> CustomResult +{ let db = &*state.store; match object_reference_id { api::ObjectReferenceId::PaymentId(api::PaymentIdType::ConnectorTransactionId(ref id)) => db @@ -348,7 +339,7 @@ pub async fn get_or_update_dispute_object( option_dispute: Option, dispute_details: api::disputes::DisputePayload, merchant_id: &str, - payment_attempt: &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt, + payment_attempt: &data_models::payments::payment_attempt::PaymentAttempt, event_type: api_models::webhooks::IncomingWebhookEvent, business_profile: &diesel_models::business_profile::BusinessProfile, connector_name: &str, @@ -418,182 +409,6 @@ pub async fn get_or_update_dispute_object( } } -#[allow(clippy::too_many_arguments)] -pub async fn external_authentication_incoming_webhook_flow( - state: AppState, - req_state: ReqState, - merchant_account: domain::MerchantAccount, - key_store: domain::MerchantKeyStore, - source_verified: bool, - event_type: api_models::webhooks::IncomingWebhookEvent, - request_details: &api::IncomingWebhookRequestDetails<'_>, - connector: &(dyn api::Connector + Sync), - object_ref_id: api::ObjectReferenceId, - business_profile: diesel_models::business_profile::BusinessProfile, - merchant_connector_account: domain::MerchantConnectorAccount, -) -> CustomResult { - if source_verified { - let authentication_details = connector - .get_external_authentication_details(request_details) - .switch()?; - let trans_status = authentication_details.trans_status; - let authentication_update = storage::AuthenticationUpdate::PostAuthenticationUpdate { - authentication_status: common_enums::AuthenticationStatus::foreign_from( - trans_status.clone(), - ), - trans_status, - authentication_value: authentication_details.authentication_value, - eci: authentication_details.eci, - }; - let authentication = - if let webhooks::ObjectReferenceId::ExternalAuthenticationID(authentication_id_type) = - object_ref_id - { - match authentication_id_type { - webhooks::AuthenticationIdType::AuthenticationId(authentication_id) => state - .store - .find_authentication_by_merchant_id_authentication_id( - merchant_account.merchant_id.clone(), - authentication_id.clone(), - ) - .await - .to_not_found_response(errors::ApiErrorResponse::AuthenticationNotFound { - id: authentication_id, - }) - .attach_printable("Error while fetching authentication record"), - webhooks::AuthenticationIdType::ConnectorAuthenticationId( - connector_authentication_id, - ) => state - .store - .find_authentication_by_merchant_id_connector_authentication_id( - merchant_account.merchant_id.clone(), - connector_authentication_id.clone(), - ) - .await - .to_not_found_response(errors::ApiErrorResponse::AuthenticationNotFound { - id: connector_authentication_id, - }) - .attach_printable("Error while fetching authentication record"), - } - } else { - Err(errors::ApiErrorResponse::WebhookProcessingFailure).attach_printable( - "received a non-external-authentication id for retrieving authentication", - ) - }?; - let updated_authentication = state - .store - .update_authentication_by_merchant_id_authentication_id( - authentication, - authentication_update, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error while updating authentication")?; - // Check if it's a payment authentication flow, payment_id would be there only for payment authentication flows - if let Some(payment_id) = updated_authentication.payment_id { - let is_pull_mechanism_enabled = helper_utils::check_if_pull_mechanism_for_external_3ds_enabled_from_connector_metadata(merchant_connector_account.metadata.map(|metadata| metadata.expose())); - // Merchant doesn't have pull mechanism enabled and if it's challenge flow, we have to authorize whenever we receive a ARes webhook - if !is_pull_mechanism_enabled - && updated_authentication.authentication_type - == Some(common_enums::DecoupledAuthenticationType::Challenge) - && event_type == webhooks::IncomingWebhookEvent::ExternalAuthenticationARes - { - let payment_confirm_req = api::PaymentsRequest { - payment_id: Some(api_models::payments::PaymentIdType::PaymentIntentId( - payment_id, - )), - merchant_id: Some(merchant_account.merchant_id.clone()), - ..Default::default() - }; - let payments_response = Box::pin(payments::payments_core::< - api::Authorize, - api::PaymentsResponse, - _, - _, - _, - Ctx, - >( - state.clone(), - req_state, - merchant_account.clone(), - key_store.clone(), - payments::PaymentConfirm, - payment_confirm_req, - services::api::AuthFlow::Merchant, - payments::CallConnectorAction::Trigger, - None, - HeaderPayload::with_source(enums::PaymentSource::ExternalAuthenticator), - )) - .await?; - match payments_response { - services::ApplicationResponse::JsonWithHeaders((payments_response, _)) => { - let payment_id = payments_response - .payment_id - .clone() - .get_required_value("payment_id") - .change_context(errors::ApiErrorResponse::WebhookProcessingFailure) - .attach_printable("payment id not received from payments core")?; - let status = payments_response.status; - let event_type: Option = - payments_response.status.foreign_into(); - // Set poll_id as completed in redis to allow the fetch status of poll through retrieve_poll_status api from client - let poll_id = super::utils::get_poll_id( - merchant_account.merchant_id.clone(), - super::utils::get_external_authentication_request_poll_id(&payment_id), - ); - let redis_conn = state - .store - .get_redis_conn() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to get redis connection")?; - redis_conn - .set_key_without_modifying_ttl( - &poll_id, - api_models::poll::PollStatus::Completed.to_string(), - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to add poll_id in redis")?; - // If event is NOT an UnsupportedEvent, trigger Outgoing Webhook - if let Some(outgoing_event_type) = event_type { - let primary_object_created_at = payments_response.created; - create_event_and_trigger_outgoing_webhook( - state, - merchant_account, - business_profile, - &key_store, - outgoing_event_type, - enums::EventClass::Payments, - payment_id.clone(), - enums::EventObjectType::PaymentDetails, - api::OutgoingWebhookContent::PaymentDetails(payments_response), - primary_object_created_at, - ) - .await?; - }; - let response = WebhookResponseTracker::Payment { payment_id, status }; - Ok(response) - } - _ => Err(errors::ApiErrorResponse::WebhookProcessingFailure).attach_printable( - "Did not get payment id as object reference id in webhook payments flow", - )?, - } - } else { - Ok(WebhookResponseTracker::NoEffect) - } - } else { - Ok(WebhookResponseTracker::NoEffect) - } - } else { - logger::error!( - "Webhook source verification failed for external authentication webhook flow" - ); - Err(report!( - errors::ApiErrorResponse::WebhookAuthenticationFailed - )) - } -} - pub async fn mandates_incoming_webhook_flow( state: AppState, merchant_account: domain::MerchantAccount, @@ -612,7 +427,6 @@ pub async fn mandates_incoming_webhook_flow( .find_mandate_by_merchant_id_mandate_id( &merchant_account.merchant_id, mandate_id.as_str(), - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?, @@ -622,7 +436,6 @@ pub async fn mandates_incoming_webhook_flow( .find_mandate_by_merchant_id_connector_mandate_id( &merchant_account.merchant_id, connector_mandate_id.as_str(), - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?, @@ -632,14 +445,11 @@ pub async fn mandates_incoming_webhook_flow( let mandate_status = common_enums::MandateStatus::foreign_try_from(event_type) .change_context(errors::ApiErrorResponse::WebhookProcessingFailure) .attach_printable("event type to mandate status mapping failed")?; - let mandate_id = mandate.mandate_id.clone(); let updated_mandate = db .update_mandate_by_merchant_id_mandate_id( &merchant_account.merchant_id, - &mandate_id, + &mandate.mandate_id, storage::MandateUpdate::StatusUpdate { mandate_status }, - mandate, - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?; @@ -648,7 +458,6 @@ pub async fn mandates_incoming_webhook_flow( &state, key_store.clone(), updated_mandate.clone(), - merchant_account.storage_scheme, ) .await?, ); @@ -754,7 +563,6 @@ pub async fn disputes_incoming_webhook_flow( async fn bank_transfer_webhook_flow( state: AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, business_profile: diesel_models::business_profile::BusinessProfile, key_store: domain::MerchantKeyStore, @@ -785,7 +593,6 @@ async fn bank_transfer_webhook_flow( Ctx, >( state.clone(), - req_state, merchant_account.to_owned(), key_store.clone(), payments::PaymentConfirm, @@ -1080,69 +887,9 @@ async fn trigger_webhook_to_merchant( ); logger::debug!(outgoing_webhook_response=?response); - let update_event_if_client_error = - |state: AppState, - merchant_key_store: domain::MerchantKeyStore, - merchant_id: String, - event_id: String, - error_message: String| async move { - let is_webhook_notified = false; - - let response_to_store = OutgoingWebhookResponseContent { - body: None, - headers: None, - status_code: None, - error_message: Some(error_message), - }; - - let event_update = domain::EventUpdate::UpdateResponse { - is_webhook_notified, - response: Some( - domain_types::encrypt( - response_to_store - .encode_to_string_of_json() - .change_context( - errors::WebhooksFlowError::OutgoingWebhookResponseEncodingFailed, - ) - .map(Secret::new)?, - merchant_key_store.key.get_inner().peek(), - ) - .await - .change_context(errors::WebhooksFlowError::WebhookEventUpdationFailed) - .attach_printable("Failed to encrypt outgoing webhook response content")?, - ), - }; - - state - .store - .update_event_by_merchant_id_event_id( - &merchant_id, - &event_id, - event_update, - &merchant_key_store, - ) - .await - .change_context(errors::WebhooksFlowError::WebhookEventUpdationFailed) - }; - let api_client_error_handler = - |state: AppState, - merchant_key_store: domain::MerchantKeyStore, - merchant_id: String, - event_id: String, - client_error: error_stack::Report, - delivery_attempt: enums::WebhookDeliveryAttempt| async move { - // Not including detailed error message in response information since it contains too - // much of diagnostic information to be exposed to the merchant. - update_event_if_client_error( - state, - merchant_key_store, - merchant_id, - event_id, - "Unable to send request to merchant server".to_string(), - ) - .await?; - + |client_error: error_stack::Report, + delivery_attempt: enums::WebhookDeliveryAttempt| { let error = client_error.change_context(errors::WebhooksFlowError::CallToMerchantFailed); logger::error!( @@ -1150,8 +897,6 @@ async fn trigger_webhook_to_merchant( ?delivery_attempt, "An error occurred when sending webhook to merchant" ); - - Ok::<_, error_stack::Report>(()) }; let update_event_in_storage = |state: AppState, merchant_key_store: domain::MerchantKeyStore, @@ -1189,10 +934,9 @@ async fn trigger_webhook_to_merchant( Secret::from(String::from("Non-UTF-8 response body")) }); let response_to_store = OutgoingWebhookResponseContent { - body: Some(response_body), - headers: Some(response_headers), - status_code: Some(status_code.as_u16()), - error_message: None, + body: response_body, + headers: response_headers, + status_code: status_code.as_u16(), }; let event_update = domain::EventUpdate::UpdateResponse { @@ -1209,7 +953,7 @@ async fn trigger_webhook_to_merchant( ) .await .change_context(errors::WebhooksFlowError::WebhookEventUpdationFailed) - .attach_printable("Failed to encrypt outgoing webhook response content")?, + .attach_printable("Failed to encrypt outgoing webhook request content")?, ), }; state @@ -1223,19 +967,16 @@ async fn trigger_webhook_to_merchant( .await .change_context(errors::WebhooksFlowError::WebhookEventUpdationFailed) }; - let increment_webhook_outgoing_received_count = |merchant_id: String| { - metrics::WEBHOOK_OUTGOING_RECEIVED_COUNT.add( - &metrics::CONTEXT, - 1, - &[metrics::KeyValue::new(MERCHANT_ID, merchant_id)], - ) - }; let success_response_handler = |state: AppState, merchant_id: String, process_tracker: Option, business_status: &'static str| async move { - increment_webhook_outgoing_received_count(merchant_id); + metrics::WEBHOOK_OUTGOING_RECEIVED_COUNT.add( + &metrics::CONTEXT, + 1, + &[metrics::KeyValue::new(MERCHANT_ID, merchant_id)], + ); match process_tracker { Some(process_tracker) => state @@ -1265,17 +1006,7 @@ async fn trigger_webhook_to_merchant( match delivery_attempt { enums::WebhookDeliveryAttempt::InitialAttempt => match response { - Err(client_error) => { - api_client_error_handler( - state.clone(), - merchant_key_store.clone(), - business_profile.merchant_id.clone(), - event_id.clone(), - client_error, - delivery_attempt, - ) - .await? - } + Err(client_error) => api_client_error_handler(client_error, delivery_attempt), Ok(response) => { let status_code = response.status(); let _updated_event = update_event_in_storage( @@ -1312,15 +1043,7 @@ async fn trigger_webhook_to_merchant( .attach_printable("`process_tracker` is unavailable in automatic retry flow")?; match response { Err(client_error) => { - api_client_error_handler( - state.clone(), - merchant_key_store.clone(), - business_profile.merchant_id.clone(), - event_id.clone(), - client_error, - delivery_attempt, - ) - .await?; + api_client_error_handler(client_error, delivery_attempt); // Schedule a retry attempt for webhook delivery outgoing_webhook_retry::retry_webhook_delivery_task( &*state.store, @@ -1372,41 +1095,10 @@ async fn trigger_webhook_to_merchant( } } } - enums::WebhookDeliveryAttempt::ManualRetry => match response { - Err(client_error) => { - api_client_error_handler( - state.clone(), - merchant_key_store.clone(), - business_profile.merchant_id.clone(), - event_id.clone(), - client_error, - delivery_attempt, - ) - .await? - } - Ok(response) => { - let status_code = response.status(); - let _updated_event = update_event_in_storage( - state.clone(), - merchant_key_store.clone(), - business_profile.merchant_id.clone(), - event_id.clone(), - response, - ) - .await?; - - if status_code.is_success() { - increment_webhook_outgoing_received_count(business_profile.merchant_id.clone()); - } else { - error_response_handler( - business_profile.merchant_id, - delivery_attempt, - status_code.as_u16(), - "Ignoring error when sending webhook to merchant", - ); - } - } - }, + enums::WebhookDeliveryAttempt::ManualRetry => { + // Will be updated when manual retry is implemented + Err(errors::WebhooksFlowError::NotReceivedByMerchant)? + } } Ok(()) @@ -1447,11 +1139,9 @@ fn raise_webhooks_analytics_event( state.event_handler().log_event(&webhook_event); } -#[allow(clippy::too_many_arguments)] pub async fn webhooks_wrapper( flow: &impl router_env::types::FlowMetric, state: AppState, - req_state: ReqState, req: &actix_web::HttpRequest, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, @@ -1462,7 +1152,6 @@ pub async fn webhooks_wrapper( state.clone(), - req_state, req, merchant_account.clone(), key_store, @@ -1471,8 +1160,6 @@ pub async fn webhooks_wrapper( state: AppState, - req_state: ReqState, req: &actix_web::HttpRequest, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, @@ -1569,7 +1255,7 @@ pub async fn webhooks_core Box::pin(payments_incoming_webhook_flow::( state.clone(), - req_state, merchant_account, business_profile, key_store, @@ -1806,7 +1495,7 @@ pub async fn webhooks_core Box::pin(bank_transfer_webhook_flow::( state.clone(), - req_state, merchant_account, business_profile, key_store, @@ -1839,24 +1527,6 @@ pub async fn webhooks_core { - Box::pin(external_authentication_incoming_webhook_flow::( - state.clone(), - req_state, - merchant_account, - key_store, - source_verified, - event_type, - &request_details, - connector, - object_ref_id, - business_profile, - merchant_connector_account, - )) - .await - .attach_printable("Incoming webhook flow for external authentication failed")? - } - _ => Err(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unsupported Flow Type received in incoming webhooks")?, } @@ -1922,39 +1592,6 @@ pub async fn get_payment_id( .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound) } -fn get_connector_by_connector_name( - state: &AppState, - connector_name: &str, - merchant_connector_id: Option, -) -> CustomResult<(&'static (dyn api::Connector + Sync), String), errors::ApiErrorResponse> { - let authentication_connector = - api_models::enums::convert_authentication_connector(connector_name); - let (connector, connector_name) = if authentication_connector.is_some() { - let authentication_connector_data = - api::AuthenticationConnectorData::get_connector_by_name(connector_name)?; - ( - authentication_connector_data.connector, - authentication_connector_data.connector_name.to_string(), - ) - } else { - let connector_data = api::ConnectorData::get_connector_by_name( - &state.conf.connectors, - connector_name, - api::GetToken::Connector, - merchant_connector_id, - ) - .change_context(errors::ApiErrorResponse::InvalidRequestData { - message: "invalid connector name received".to_string(), - }) - .attach_printable("Failed construction of ConnectorData")?; - ( - connector_data.connector, - connector_data.connector_name.to_string(), - ) - }; - Ok((*connector, connector_name)) -} - /// This function fetches the merchant connector account ( if the url used is /{merchant_connector_id}) /// if merchant connector id is not passed in the request, then this will return None for mca async fn fetch_optional_mca_and_connector( @@ -1963,11 +1600,7 @@ async fn fetch_optional_mca_and_connector( connector_name_or_mca_id: &str, key_store: &domain::MerchantKeyStore, ) -> CustomResult< - ( - Option, - &'static (dyn api::Connector + Sync), - String, - ), + (Option, api::ConnectorData), errors::ApiErrorResponse, > { let db = &state.store; @@ -1985,18 +1618,33 @@ async fn fetch_optional_mca_and_connector( .attach_printable( "error while fetching merchant_connector_account from connector_id", )?; - let (connector, connector_name) = get_connector_by_connector_name( - state, + + let connector = api::ConnectorData::get_connector_by_name( + &state.conf.connectors, &mca.connector_name, + api::GetToken::Connector, Some(mca.merchant_connector_id.clone()), - )?; + ) + .change_context(errors::ApiErrorResponse::InvalidRequestData { + message: "invalid connector name received".to_string(), + }) + .attach_printable("Failed construction of ConnectorData")?; - Ok((Some(mca), connector, connector_name)) + Ok((Some(mca), connector)) } else { // Merchant connector account is already being queried, it is safe to set connector id as None - let (connector, connector_name) = - get_connector_by_connector_name(state, connector_name_or_mca_id, None)?; - Ok((None, connector, connector_name)) + let connector = api::ConnectorData::get_connector_by_name( + &state.conf.connectors, + connector_name_or_mca_id, + api::GetToken::Connector, + None, + ) + .change_context(errors::ApiErrorResponse::InvalidRequestData { + message: "invalid connector name received".to_string(), + }) + .attach_printable("Failed construction of ConnectorData")?; + + Ok((None, connector)) } } diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs index 3bf8c7c7f21..739d7b20fdd 100644 --- a/crates/router/src/core/webhooks/utils.rs +++ b/crates/router/src/core/webhooks/utils.rs @@ -83,6 +83,7 @@ pub async fn construct_webhook_router_data<'a>( connector_auth_type: auth_type, description: None, return_url: None, + payment_method_id: None, address: PaymentAddress::default(), auth_type: diesel_models::enums::AuthenticationType::default(), connector_meta_data: None, diff --git a/crates/router/src/core/webhooks/webhook_events.rs b/crates/router/src/core/webhooks/webhook_events.rs index 6db214c2b05..c719200384f 100644 --- a/crates/router/src/core/webhooks/webhook_events.rs +++ b/crates/router/src/core/webhooks/webhook_events.rs @@ -1,21 +1,19 @@ use error_stack::ResultExt; -use masking::PeekInterface; use router_env::{instrument, tracing}; use crate::{ core::errors::{self, RouterResponse, StorageErrorExt}, routes::AppState, services::ApplicationResponse, - types::{api, domain, storage, transformers::ForeignTryFrom}, - utils::{OptionExt, StringExt}, + types::{api, domain, transformers::ForeignTryFrom}, }; const INITIAL_DELIVERY_ATTEMPTS_LIST_MAX_LIMIT: i64 = 100; #[derive(Debug)] -enum MerchantAccountOrBusinessProfile { - MerchantAccount(domain::MerchantAccount), - BusinessProfile(storage::BusinessProfile), +enum MerchantIdOrProfileId { + MerchantId(String), + ProfileId(String), } #[instrument(skip(state))] @@ -29,22 +27,22 @@ pub async fn list_initial_delivery_attempts( let store = state.store.as_ref(); - let (account, key_store) = + let (identifier, key_store) = determine_identifier_and_get_key_store(state.clone(), merchant_id_or_profile_id).await?; let events = match constraints { api_models::webhook_events::EventListConstraintsInternal::ObjectIdFilter { object_id } => { - match account { - MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account) => store + match identifier { + MerchantIdOrProfileId::MerchantId(merchant_id) => store .list_initial_events_by_merchant_id_primary_object_id( - &merchant_account.merchant_id, + &merchant_id, &object_id, &key_store, ) .await, - MerchantAccountOrBusinessProfile::BusinessProfile(business_profile) => store + MerchantIdOrProfileId::ProfileId(profile_id) => store .list_initial_events_by_profile_id_primary_object_id( - &business_profile.profile_id, + &profile_id, &object_id, &key_store, ) @@ -71,10 +69,10 @@ pub async fn list_initial_delivery_attempts( _ => None, }; - match account { - MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account) => store + match identifier { + MerchantIdOrProfileId::MerchantId(merchant_id) => store .list_initial_events_by_merchant_id_constraints( - &merchant_account.merchant_id, + &merchant_id, created_after, created_before, limit, @@ -82,9 +80,9 @@ pub async fn list_initial_delivery_attempts( &key_store, ) .await, - MerchantAccountOrBusinessProfile::BusinessProfile(business_profile) => store + MerchantIdOrProfileId::ProfileId(profile_id) => store .list_initial_events_by_profile_id_constraints( - &business_profile.profile_id, + &profile_id, created_after, created_before, limit, @@ -114,23 +112,23 @@ pub async fn list_delivery_attempts( ) -> RouterResponse> { let store = state.store.as_ref(); - let (account, key_store) = + let (identifier, key_store) = determine_identifier_and_get_key_store(state.clone(), merchant_id_or_profile_id).await?; - let events = match account { - MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account) => { + let events = match identifier { + MerchantIdOrProfileId::MerchantId(merchant_id) => { store .list_events_by_merchant_id_initial_attempt_id( - &merchant_account.merchant_id, + &merchant_id, &initial_attempt_id, &key_store, ) .await } - MerchantAccountOrBusinessProfile::BusinessProfile(business_profile) => { + MerchantIdOrProfileId::ProfileId(profile_id) => { store .list_events_by_profile_id_initial_attempt_id( - &business_profile.profile_id, + &profile_id, &initial_attempt_id, &key_store, ) @@ -155,108 +153,10 @@ pub async fn list_delivery_attempts( } } -#[instrument(skip(state))] -pub async fn retry_delivery_attempt( - state: AppState, - merchant_id_or_profile_id: String, - event_id: String, -) -> RouterResponse { - let store = state.store.as_ref(); - - let (account, key_store) = - determine_identifier_and_get_key_store(state.clone(), merchant_id_or_profile_id).await?; - - let event_to_retry = store - .find_event_by_merchant_id_event_id(&key_store.merchant_id, &event_id, &key_store) - .await - .to_not_found_response(errors::ApiErrorResponse::EventNotFound)?; - - let business_profile = match account { - MerchantAccountOrBusinessProfile::MerchantAccount(_) => { - let business_profile_id = event_to_retry - .business_profile_id - .get_required_value("business_profile_id") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to read business profile ID from event to retry")?; - store - .find_business_profile_by_profile_id(&business_profile_id) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to find business profile") - } - MerchantAccountOrBusinessProfile::BusinessProfile(business_profile) => Ok(business_profile), - }?; - - let delivery_attempt = storage::enums::WebhookDeliveryAttempt::ManualRetry; - let new_event_id = super::utils::generate_event_id(); - let idempotent_event_id = super::utils::get_idempotent_event_id( - &event_to_retry.primary_object_id, - event_to_retry.event_type, - delivery_attempt, - ); - - let now = common_utils::date_time::now(); - let new_event = domain::Event { - event_id: new_event_id.clone(), - event_type: event_to_retry.event_type, - event_class: event_to_retry.event_class, - is_webhook_notified: false, - primary_object_id: event_to_retry.primary_object_id, - primary_object_type: event_to_retry.primary_object_type, - created_at: now, - merchant_id: Some(business_profile.merchant_id.clone()), - business_profile_id: Some(business_profile.profile_id.clone()), - primary_object_created_at: event_to_retry.primary_object_created_at, - idempotent_event_id: Some(idempotent_event_id), - initial_attempt_id: event_to_retry.initial_attempt_id, - request: event_to_retry.request, - response: None, - delivery_attempt: Some(delivery_attempt), - }; - - let event = store - .insert_event(new_event, &key_store) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to insert event")?; - - // We only allow retrying deliveries for events with `request` populated. - let request_content = event - .request - .as_ref() - .get_required_value("request") - .change_context(errors::ApiErrorResponse::InternalServerError)? - .peek() - .parse_struct("OutgoingWebhookRequestContent") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to parse webhook event request information")?; - - super::trigger_webhook_and_raise_event( - state.clone(), - business_profile, - &key_store, - event, - request_content, - delivery_attempt, - None, - None, - ) - .await; - - let updated_event = store - .find_event_by_merchant_id_event_id(&key_store.merchant_id, &new_event_id, &key_store) - .await - .to_not_found_response(errors::ApiErrorResponse::EventNotFound)?; - - Ok(ApplicationResponse::Json( - api::webhook_events::EventRetrieveResponse::try_from(updated_event)?, - )) -} - async fn determine_identifier_and_get_key_store( state: AppState, merchant_id_or_profile_id: String, -) -> errors::RouterResult<(MerchantAccountOrBusinessProfile, domain::MerchantKeyStore)> { +) -> errors::RouterResult<(MerchantIdOrProfileId, domain::MerchantKeyStore)> { let store = state.store.as_ref(); match store .get_merchant_key_store_by_merchant_id( @@ -265,25 +165,13 @@ async fn determine_identifier_and_get_key_store( ) .await { - // Since a merchant key store was found with `merchant_id` = `merchant_id_or_profile_id`, - // `merchant_id_or_profile_id` is a valid merchant ID. - // Find a merchant account having `merchant_id` = `merchant_id_or_profile_id`. - Ok(key_store) => { - let merchant_account = store - .find_merchant_account_by_merchant_id(&merchant_id_or_profile_id, &key_store) - .await - .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?; - - Ok(( - MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account), - key_store, - )) - } + // Valid merchant ID + Ok(key_store) => Ok(( + MerchantIdOrProfileId::MerchantId(merchant_id_or_profile_id), + key_store, + )), - // Since no merchant key store was found with `merchant_id` = `merchant_id_or_profile_id`, - // `merchant_id_or_profile_id` is not a valid merchant ID. - // Assuming that `merchant_id_or_profile_id` is a business profile ID, try to find a - // business profile having `profile_id` = `merchant_id_or_profile_id`. + // Invalid merchant ID, check if we can find a business profile with the identifier Err(error) if error.current_context().is_db_not_found() => { router_env::logger::debug!( ?error, @@ -307,7 +195,7 @@ async fn determine_identifier_and_get_key_store( .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?; Ok(( - MerchantAccountOrBusinessProfile::BusinessProfile(business_profile), + MerchantIdOrProfileId::ProfileId(business_profile.profile_id), key_store, )) } diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs index 9b222486d18..9f9e61a5ffc 100644 --- a/crates/router/src/db.rs +++ b/crates/router/src/db.rs @@ -35,20 +35,18 @@ pub mod routing_algorithm; pub mod user; pub mod user_role; +use data_models::payments::{ + payment_attempt::PaymentAttemptInterface, payment_intent::PaymentIntentInterface, +}; +#[cfg(feature = "payouts")] +use data_models::payouts::{payout_attempt::PayoutAttemptInterface, payouts::PayoutsInterface}; +#[cfg(not(feature = "payouts"))] +use data_models::{PayoutAttemptInterface, PayoutsInterface}; use diesel_models::{ fraud_check::{FraudCheck, FraudCheckNew, FraudCheckUpdate}, organization::{Organization, OrganizationNew, OrganizationUpdate}, }; use error_stack::ResultExt; -use hyperswitch_domain_models::payments::{ - payment_attempt::PaymentAttemptInterface, payment_intent::PaymentIntentInterface, -}; -#[cfg(feature = "payouts")] -use hyperswitch_domain_models::payouts::{ - payout_attempt::PayoutAttemptInterface, payouts::PayoutsInterface, -}; -#[cfg(not(feature = "payouts"))] -use hyperswitch_domain_models::{PayoutAttemptInterface, PayoutsInterface}; use masking::PeekInterface; use redis_interface::errors::RedisError; use storage_impl::{errors::StorageError, redis::kv_store::RedisConnInterface, MockDb}; diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs index 8eb281184f6..fc68f0e303d 100644 --- a/crates/router/src/db/address.rs +++ b/crates/router/src/db/address.rs @@ -275,7 +275,7 @@ mod storage { use error_stack::{report, ResultExt}; use redis_interface::HsetnxReply; use router_env::{instrument, tracing}; - use storage_impl::redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}; + use storage_impl::redis::kv_store::{kv_wrapper, KvOperation}; use super::AddressInterface; use crate::{ @@ -335,10 +335,7 @@ mod storage { let address = match storage_scheme { MerchantStorageScheme::PostgresOnly => database_call().await, MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPaymentId { - merchant_id, - payment_id, - }; + let key = format!("mid_{}_pid_{}", merchant_id, payment_id); let field = format!("add_{}", address_id); Box::pin(db_utils::try_redis_get_else_try_database_get( async { @@ -409,11 +406,7 @@ mod storage { .await } MerchantStorageScheme::RedisKv => { - let merchant_id = address.merchant_id.clone(); - let key = PartitionKey::MerchantIdPaymentId { - merchant_id: &merchant_id, - payment_id: &payment_id, - }; + let key = format!("mid_{}_pid_{}", address.merchant_id.clone(), payment_id); let field = format!("add_{}", address.address_id); let updated_address = AddressUpdateInternal::from(address_update.clone()) .create_address(address.clone()); @@ -437,7 +430,7 @@ mod storage { (&field, redis_value), redis_entry, ), - key, + &key, ) .await .change_context(errors::StorageError::KVError)? @@ -482,10 +475,7 @@ mod storage { .await } MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPaymentId { - merchant_id: &merchant_id, - payment_id, - }; + let key = format!("mid_{}_pid_{}", merchant_id, payment_id); let field = format!("add_{}", &address_new.address_id); let created_address = diesel_models::Address { id: Some(0i32), @@ -523,7 +513,7 @@ mod storage { &created_address, redis_entry, ), - key, + &key, ) .await .change_context(errors::StorageError::KVError)? diff --git a/crates/router/src/db/authentication.rs b/crates/router/src/db/authentication.rs index 0f4aef679c5..a2c7f050052 100644 --- a/crates/router/src/db/authentication.rs +++ b/crates/router/src/db/authentication.rs @@ -22,12 +22,6 @@ pub trait AuthenticationInterface { authentication_id: String, ) -> CustomResult; - async fn find_authentication_by_merchant_id_connector_authentication_id( - &self, - merchant_id: String, - connector_authentication_id: String, - ) -> CustomResult; - async fn update_authentication_by_merchant_id_authentication_id( &self, previous_state: storage::Authentication, @@ -65,21 +59,6 @@ impl AuthenticationInterface for Store { .map_err(|error| report!(errors::StorageError::from(error))) } - async fn find_authentication_by_merchant_id_connector_authentication_id( - &self, - merchant_id: String, - connector_authentication_id: String, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - storage::Authentication::find_authentication_by_merchant_id_connector_authentication_id( - &conn, - &merchant_id, - &connector_authentication_id, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - #[instrument(skip_all)] async fn update_authentication_by_merchant_id_authentication_id( &self, @@ -145,9 +124,6 @@ impl AuthenticationInterface for MockDb { acs_trans_id: authentication.acs_trans_id, three_ds_server_trans_id: authentication.three_dsserver_trans_id, acs_signed_content: authentication.acs_signed_content, - profile_id: authentication.profile_id, - payment_id: authentication.payment_id, - merchant_connector_id: authentication.merchant_connector_id, }; authentications.push(authentication.clone()); Ok(authentication) @@ -169,14 +145,6 @@ impl AuthenticationInterface for MockDb { ).cloned() } - async fn find_authentication_by_merchant_id_connector_authentication_id( - &self, - _merchant_id: String, - _connector_authentication_id: String, - ) -> CustomResult { - Err(errors::StorageError::MockDbError)? - } - async fn update_authentication_by_merchant_id_authentication_id( &self, previous_state: storage::Authentication, diff --git a/crates/router/src/db/business_profile.rs b/crates/router/src/db/business_profile.rs index 7b5ade8c965..4d5a94b370a 100644 --- a/crates/router/src/db/business_profile.rs +++ b/crates/router/src/db/business_profile.rs @@ -30,7 +30,7 @@ pub trait BusinessProfileInterface { async fn update_business_profile_by_profile_id( &self, current_state: business_profile::BusinessProfile, - business_profile_update: business_profile::BusinessProfileUpdate, + business_profile_update: business_profile::BusinessProfileUpdateInternal, ) -> CustomResult; async fn delete_business_profile_by_profile_id_merchant_id( @@ -90,7 +90,7 @@ impl BusinessProfileInterface for Store { async fn update_business_profile_by_profile_id( &self, current_state: business_profile::BusinessProfile, - business_profile_update: business_profile::BusinessProfileUpdate, + business_profile_update: business_profile::BusinessProfileUpdateInternal, ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; storage::business_profile::BusinessProfile::update_by_profile_id( @@ -169,7 +169,7 @@ impl BusinessProfileInterface for MockDb { async fn update_business_profile_by_profile_id( &self, current_state: business_profile::BusinessProfile, - business_profile_update: business_profile::BusinessProfileUpdate, + business_profile_update: business_profile::BusinessProfileUpdateInternal, ) -> CustomResult { self.business_profiles .lock() diff --git a/crates/router/src/db/customers.rs b/crates/router/src/db/customers.rs index 00fb7e4a08f..081a41e0073 100644 --- a/crates/router/src/db/customers.rs +++ b/crates/router/src/db/customers.rs @@ -1,25 +1,29 @@ use common_utils::ext_traits::AsyncExt; -use error_stack::ResultExt; +use error_stack::{report, ResultExt}; use futures::future::try_join_all; +use masking::PeekInterface; use router_env::{instrument, tracing}; -use super::MockDb; +use super::{MockDb, Store}; use crate::{ - core::errors::{self, CustomResult}, + connection, + core::{ + customers::REDACTED, + errors::{self, CustomResult}, + }, types::{ domain::{ self, behaviour::{Conversion, ReverseConversion}, }, - storage::{self as storage_types, enums::MerchantStorageScheme}, + storage, }, }; #[async_trait::async_trait] pub trait CustomerInterface where - domain::Customer: - Conversion, + domain::Customer: Conversion, { async fn delete_customer_by_customer_id_merchant_id( &self, @@ -32,17 +36,14 @@ where customer_id: &str, merchant_id: &str, key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, ) -> CustomResult, errors::StorageError>; async fn update_customer_by_customer_id_merchant_id( &self, customer_id: String, merchant_id: String, - customer: domain::Customer, - customer_update: storage_types::CustomerUpdate, + customer: storage::CustomerUpdate, key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, ) -> CustomResult; async fn find_customer_by_customer_id_merchant_id( @@ -50,7 +51,6 @@ where customer_id: &str, merchant_id: &str, key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, ) -> CustomResult; async fn list_customers_by_merchant_id( @@ -63,423 +63,134 @@ where &self, customer_data: domain::Customer, key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, ) -> CustomResult; } -#[cfg(feature = "kv_store")] -mod storage { - use common_utils::ext_traits::AsyncExt; - use diesel_models::kv; - use error_stack::{report, ResultExt}; - use futures::future::try_join_all; - use masking::PeekInterface; - use router_env::{instrument, tracing}; - use storage_impl::redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}; - - use super::CustomerInterface; - use crate::{ - connection, - core::{ - customers::REDACTED, - errors::{self, CustomResult}, - }, - services::Store, - types::{ - domain::{ - self, - behaviour::{Conversion, ReverseConversion}, - }, - storage::{self as storage_types, enums::MerchantStorageScheme}, - }, - utils::db_utils, - }; - - #[async_trait::async_trait] - impl CustomerInterface for Store { - #[instrument(skip_all)] - // check customer not found in kv and fallback to db - async fn find_customer_optional_by_customer_id_merchant_id( - &self, - customer_id: &str, - merchant_id: &str, - key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - let database_call = || async { - storage_types::Customer::find_optional_by_customer_id_merchant_id( - &conn, - customer_id, - merchant_id, - ) - .await - .map_err(|err| report!(errors::StorageError::from(err))) - }; - - let maybe_customer = match storage_scheme { - MerchantStorageScheme::PostgresOnly => database_call().await, - MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdCustomerId { - merchant_id, - customer_id, - }; - let field = format!("cust_{}", customer_id); - Box::pin(db_utils::try_redis_get_else_try_database_get( - // check for ValueNotFound - async { - kv_wrapper( - self, - KvOperation::::HGet(&field), - key, - ) - .await? - .try_into_hget() - .map(Some) - }, - database_call, - )) +#[async_trait::async_trait] +impl CustomerInterface for Store { + #[instrument(skip_all)] + async fn find_customer_optional_by_customer_id_merchant_id( + &self, + customer_id: &str, + merchant_id: &str, + key_store: &domain::MerchantKeyStore, + ) -> CustomResult, errors::StorageError> { + let conn = connection::pg_connection_read(self).await?; + let maybe_customer: Option = + storage::Customer::find_optional_by_customer_id_merchant_id( + &conn, + customer_id, + merchant_id, + ) + .await + .map_err(|error| report!(errors::StorageError::from(error)))? + .async_map(|c| async { + c.convert(key_store.key.get_inner()) .await - } - }?; - - let maybe_result = maybe_customer - .async_map(|c| async { - c.convert(key_store.key.get_inner()) - .await - .change_context(errors::StorageError::DecryptionError) - }) - .await - .transpose()?; - - maybe_result.map_or(Ok(None), |customer: domain::Customer| match customer.name { + .change_context(errors::StorageError::DecryptionError) + }) + .await + .transpose()?; + maybe_customer.map_or(Ok(None), |customer| { + // in the future, once #![feature(is_some_and)] is stable, we can make this more concise: + // `if customer.name.is_some_and(|ref name| name == REDACTED) ...` + match customer.name { Some(ref name) if name.peek() == REDACTED => { Err(errors::StorageError::CustomerRedacted)? } _ => Ok(Some(customer)), - }) - } - - #[instrument(skip_all)] - async fn update_customer_by_customer_id_merchant_id( - &self, - customer_id: String, - merchant_id: String, - customer: domain::Customer, - customer_update: storage_types::CustomerUpdate, - key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - let customer = Conversion::convert(customer) - .await - .change_context(errors::StorageError::EncryptionError)?; - let database_call = || async { - storage_types::Customer::update_by_customer_id_merchant_id( - &conn, - customer_id.clone(), - merchant_id.clone(), - customer_update.clone().into(), - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - }; - - let updated_object = match storage_scheme { - MerchantStorageScheme::PostgresOnly => database_call().await, - MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdCustomerId { - merchant_id: merchant_id.as_str(), - customer_id: customer_id.as_str(), - }; - let field = format!("cust_{}", customer_id); - let updated_customer = - diesel_models::CustomerUpdateInternal::from(customer_update.clone()) - .apply_changeset(customer.clone()); - - let redis_value = serde_json::to_string(&updated_customer) - .change_context(errors::StorageError::KVError)?; - - let redis_entry = kv::TypedSql { - op: kv::DBOperation::Update { - updatable: kv::Updateable::CustomerUpdate(kv::CustomerUpdateMems { - orig: customer, - update_data: customer_update.into(), - }), - }, - }; - - kv_wrapper::<(), _, _>( - self, - KvOperation::Hset::( - (&field, redis_value), - redis_entry, - ), - key, - ) - .await - .change_context(errors::StorageError::KVError)? - .try_into_hset() - .change_context(errors::StorageError::KVError)?; - - Ok(updated_customer) - } - }; + } + }) + } - updated_object? - .convert(key_store.key.get_inner()) + #[instrument(skip_all)] + async fn update_customer_by_customer_id_merchant_id( + &self, + customer_id: String, + merchant_id: String, + customer: storage::CustomerUpdate, + key_store: &domain::MerchantKeyStore, + ) -> CustomResult { + let conn = connection::pg_connection_write(self).await?; + storage::Customer::update_by_customer_id_merchant_id( + &conn, + customer_id, + merchant_id, + customer.into(), + ) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + .async_and_then(|c| async { + c.convert(key_store.key.get_inner()) .await .change_context(errors::StorageError::DecryptionError) - } + }) + .await + } - #[instrument(skip_all)] - async fn find_customer_by_customer_id_merchant_id( - &self, - customer_id: &str, - merchant_id: &str, - key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - let database_call = || async { - storage_types::Customer::find_by_customer_id_merchant_id( - &conn, - customer_id, - merchant_id, - ) + #[instrument(skip_all)] + async fn find_customer_by_customer_id_merchant_id( + &self, + customer_id: &str, + merchant_id: &str, + key_store: &domain::MerchantKeyStore, + ) -> CustomResult { + let conn = connection::pg_connection_read(self).await?; + let customer: domain::Customer = + storage::Customer::find_by_customer_id_merchant_id(&conn, customer_id, merchant_id) .await .map_err(|error| report!(errors::StorageError::from(error))) - }; - - let customer = match storage_scheme { - MerchantStorageScheme::PostgresOnly => database_call().await, - MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdCustomerId { - merchant_id, - customer_id, - }; - let field = format!("cust_{}", customer_id); - Box::pin(db_utils::try_redis_get_else_try_database_get( - async { - kv_wrapper( - self, - KvOperation::::HGet(&field), - key, - ) - .await? - .try_into_hget() - }, - database_call, - )) - .await - } - }?; - - let result: domain::Customer = customer - .convert(key_store.key.get_inner()) - .await - .change_context(errors::StorageError::DecryptionError)?; - //.await - - match result.name { - Some(ref name) if name.peek() == REDACTED => { - Err(errors::StorageError::CustomerRedacted)? - } - _ => Ok(result), - } - } - - #[instrument(skip_all)] - async fn list_customers_by_merchant_id( - &self, - merchant_id: &str, - key_store: &domain::MerchantKeyStore, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - - let encrypted_customers = - storage_types::Customer::list_by_merchant_id(&conn, merchant_id) - .await - .map_err(|error| report!(errors::StorageError::from(error)))?; - - let customers = try_join_all(encrypted_customers.into_iter().map( - |encrypted_customer| async { - encrypted_customer - .convert(key_store.key.get_inner()) + .async_and_then(|c| async { + c.convert(key_store.key.get_inner()) .await .change_context(errors::StorageError::DecryptionError) - }, - )) - .await?; - - Ok(customers) + }) + .await?; + match customer.name { + Some(ref name) if name.peek() == REDACTED => { + Err(errors::StorageError::CustomerRedacted)? + } + _ => Ok(customer), } + } - #[instrument(skip_all)] - async fn insert_customer( - &self, - customer_data: domain::Customer, - key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let customer_id = customer_data.customer_id.clone(); - let merchant_id = customer_data.merchant_id.clone(); - let new_customer = customer_data - .construct_new() - .await - .change_context(errors::StorageError::EncryptionError)?; - - let create_customer = match storage_scheme { - MerchantStorageScheme::PostgresOnly => { - let conn = connection::pg_connection_write(self).await?; - new_customer - .insert(&conn) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdCustomerId { - merchant_id: merchant_id.as_str(), - customer_id: customer_id.as_str(), - }; - let field = format!("cust_{}", customer_id.clone()); - - let redis_entry = kv::TypedSql { - op: kv::DBOperation::Insert { - insertable: kv::Insertable::Customer(new_customer.clone()), - }, - }; - let storage_customer = new_customer.into(); - - match kv_wrapper::( - self, - KvOperation::HSetNx::( - &field, - &storage_customer, - redis_entry, - ), - key, - ) - .await - .change_context(errors::StorageError::KVError)? - .try_into_hsetnx() - { - Ok(redis_interface::HsetnxReply::KeyNotSet) => { - Err(report!(errors::StorageError::DuplicateValue { - entity: "customer", - key: Some(customer_id), - })) - } - Ok(redis_interface::HsetnxReply::KeySet) => Ok(storage_customer), - Err(er) => Err(er).change_context(errors::StorageError::KVError), - } - } - }?; - - create_customer - .convert(key_store.key.get_inner()) - .await - .change_context(errors::StorageError::DecryptionError) - } + #[instrument(skip_all)] + async fn list_customers_by_merchant_id( + &self, + merchant_id: &str, + key_store: &domain::MerchantKeyStore, + ) -> CustomResult, errors::StorageError> { + let conn = connection::pg_connection_read(self).await?; - #[instrument(skip_all)] - async fn delete_customer_by_customer_id_merchant_id( - &self, - customer_id: &str, - merchant_id: &str, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - storage_types::Customer::delete_by_customer_id_merchant_id( - &conn, - customer_id, - merchant_id, - ) + let encrypted_customers = storage::Customer::list_by_merchant_id(&conn, merchant_id) .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - } -} - -#[cfg(not(feature = "kv_store"))] -mod storage { - use common_utils::ext_traits::AsyncExt; - use error_stack::{report, ResultExt}; - use futures::future::try_join_all; - use masking::PeekInterface; - use router_env::{instrument, tracing}; + .map_err(|error| report!(errors::StorageError::from(error)))?; - use super::CustomerInterface; - use crate::{ - connection, - core::{ - customers::REDACTED, - errors::{self, CustomResult}, - }, - services::Store, - types::{ - domain::{ - self, - behaviour::{Conversion, ReverseConversion}, + let customers = try_join_all(encrypted_customers.into_iter().map( + |encrypted_customer| async { + encrypted_customer + .convert(key_store.key.get_inner()) + .await + .change_context(errors::StorageError::DecryptionError) }, - storage::{self as storage_types, enums::MerchantStorageScheme}, - }, - }; + )) + .await?; - #[async_trait::async_trait] - impl CustomerInterface for Store { - #[instrument(skip_all)] - async fn find_customer_optional_by_customer_id_merchant_id( - &self, - customer_id: &str, - merchant_id: &str, - key_store: &domain::MerchantKeyStore, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - let maybe_customer: Option = - storage_types::Customer::find_optional_by_customer_id_merchant_id( - &conn, - customer_id, - merchant_id, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error)))? - .async_map(|c| async { - c.convert(key_store.key.get_inner()) - .await - .change_context(errors::StorageError::DecryptionError) - }) - .await - .transpose()?; - maybe_customer.map_or(Ok(None), |customer| { - // in the future, once #![feature(is_some_and)] is stable, we can make this more concise: - // `if customer.name.is_some_and(|ref name| name == REDACTED) ...` - match customer.name { - Some(ref name) if name.peek() == REDACTED => { - Err(errors::StorageError::CustomerRedacted)? - } - _ => Ok(Some(customer)), - } - }) - } + Ok(customers) + } - #[instrument(skip_all)] - async fn update_customer_by_customer_id_merchant_id( - &self, - customer_id: String, - merchant_id: String, - _customer: domain::Customer, - customer_update: storage_types::CustomerUpdate, - key_store: &domain::MerchantKeyStore, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - storage_types::Customer::update_by_customer_id_merchant_id( - &conn, - customer_id, - merchant_id, - customer_update.into(), - ) + #[instrument(skip_all)] + async fn insert_customer( + &self, + customer_data: domain::Customer, + key_store: &domain::MerchantKeyStore, + ) -> CustomResult { + let conn = connection::pg_connection_write(self).await?; + customer_data + .construct_new() + .await + .change_context(errors::StorageError::EncryptionError)? + .insert(&conn) .await .map_err(|error| report!(errors::StorageError::from(error))) .async_and_then(|c| async { @@ -488,103 +199,18 @@ mod storage { .change_context(errors::StorageError::DecryptionError) }) .await - } - - #[instrument(skip_all)] - async fn find_customer_by_customer_id_merchant_id( - &self, - customer_id: &str, - merchant_id: &str, - key_store: &domain::MerchantKeyStore, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - let customer: domain::Customer = - storage_types::Customer::find_by_customer_id_merchant_id( - &conn, - customer_id, - merchant_id, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - .async_and_then(|c| async { - c.convert(key_store.key.get_inner()) - .await - .change_context(errors::StorageError::DecryptionError) - }) - .await?; - match customer.name { - Some(ref name) if name.peek() == REDACTED => { - Err(errors::StorageError::CustomerRedacted)? - } - _ => Ok(customer), - } - } - - #[instrument(skip_all)] - async fn list_customers_by_merchant_id( - &self, - merchant_id: &str, - key_store: &domain::MerchantKeyStore, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - - let encrypted_customers = - storage_types::Customer::list_by_merchant_id(&conn, merchant_id) - .await - .map_err(|error| report!(errors::StorageError::from(error)))?; - - let customers = try_join_all(encrypted_customers.into_iter().map( - |encrypted_customer| async { - encrypted_customer - .convert(key_store.key.get_inner()) - .await - .change_context(errors::StorageError::DecryptionError) - }, - )) - .await?; - - Ok(customers) - } - - #[instrument(skip_all)] - async fn insert_customer( - &self, - customer_data: domain::Customer, - key_store: &domain::MerchantKeyStore, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - customer_data - .construct_new() - .await - .change_context(errors::StorageError::EncryptionError)? - .insert(&conn) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - .async_and_then(|c| async { - c.convert(key_store.key.get_inner()) - .await - .change_context(errors::StorageError::DecryptionError) - }) - .await - } + } - #[instrument(skip_all)] - async fn delete_customer_by_customer_id_merchant_id( - &self, - customer_id: &str, - merchant_id: &str, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - storage_types::Customer::delete_by_customer_id_merchant_id( - &conn, - customer_id, - merchant_id, - ) + #[instrument(skip_all)] + async fn delete_customer_by_customer_id_merchant_id( + &self, + customer_id: &str, + merchant_id: &str, + ) -> CustomResult { + let conn = connection::pg_connection_write(self).await?; + storage::Customer::delete_by_customer_id_merchant_id(&conn, customer_id, merchant_id) .await .map_err(|error| report!(errors::StorageError::from(error))) - } } } @@ -596,7 +222,6 @@ impl CustomerInterface for MockDb { customer_id: &str, merchant_id: &str, key_store: &domain::MerchantKeyStore, - _storage_scheme: MerchantStorageScheme, ) -> CustomResult, errors::StorageError> { let customers = self.customers.lock().await; let customer = customers @@ -644,10 +269,8 @@ impl CustomerInterface for MockDb { &self, _customer_id: String, _merchant_id: String, - _customer: domain::Customer, - _customer_update: storage_types::CustomerUpdate, + _customer: storage::CustomerUpdate, _key_store: &domain::MerchantKeyStore, - _storage_scheme: MerchantStorageScheme, ) -> CustomResult { // [#172]: Implement function for `MockDb` Err(errors::StorageError::MockDbError)? @@ -658,7 +281,6 @@ impl CustomerInterface for MockDb { _customer_id: &str, _merchant_id: &str, _key_store: &domain::MerchantKeyStore, - _storage_scheme: MerchantStorageScheme, ) -> CustomResult { // [#172]: Implement function for `MockDb` Err(errors::StorageError::MockDbError)? @@ -669,7 +291,6 @@ impl CustomerInterface for MockDb { &self, customer_data: domain::Customer, key_store: &domain::MerchantKeyStore, - _storage_scheme: MerchantStorageScheme, ) -> CustomResult { let mut customers = self.customers.lock().await; diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index 0aaa47365fc..dc8b9b791d4 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -1,7 +1,14 @@ use std::sync::Arc; use common_enums::enums::MerchantStorageScheme; -use common_utils::{errors::CustomResult, pii}; +use common_utils::errors::CustomResult; +use data_models::payments::{ + payment_attempt::PaymentAttemptInterface, payment_intent::PaymentIntentInterface, +}; +#[cfg(feature = "payouts")] +use data_models::payouts::{payout_attempt::PayoutAttemptInterface, payouts::PayoutsInterface}; +#[cfg(not(feature = "payouts"))] +use data_models::{PayoutAttemptInterface, PayoutsInterface}; use diesel_models::{ enums, enums::ProcessTrackerStatus, @@ -9,15 +16,6 @@ use diesel_models::{ reverse_lookup::{ReverseLookup, ReverseLookupNew}, user_role as user_storage, }; -use hyperswitch_domain_models::payments::{ - payment_attempt::PaymentAttemptInterface, payment_intent::PaymentIntentInterface, -}; -#[cfg(feature = "payouts")] -use hyperswitch_domain_models::payouts::{ - payout_attempt::PayoutAttemptInterface, payouts::PayoutsInterface, -}; -#[cfg(not(feature = "payouts"))] -use hyperswitch_domain_models::{PayoutAttemptInterface, PayoutsInterface}; use masking::Secret; use redis_interface::{errors::RedisError, RedisConnectionPool, RedisEntryId}; use router_env::logger; @@ -34,8 +32,6 @@ use super::{ user::{sample_data::BatchSampleDataInterface, UserInterface}, user_role::UserRoleInterface, }; -#[cfg(feature = "payouts")] -use crate::services::kafka::payout::KafkaPayout; use crate::{ core::errors::{self, ProcessTrackerError}, db::{ @@ -326,15 +322,9 @@ impl CustomerInterface for KafkaStore { customer_id: &str, merchant_id: &str, key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, ) -> CustomResult, errors::StorageError> { self.diesel_store - .find_customer_optional_by_customer_id_merchant_id( - customer_id, - merchant_id, - key_store, - storage_scheme, - ) + .find_customer_optional_by_customer_id_merchant_id(customer_id, merchant_id, key_store) .await } @@ -342,19 +332,15 @@ impl CustomerInterface for KafkaStore { &self, customer_id: String, merchant_id: String, - customer: domain::Customer, - customer_update: storage::CustomerUpdate, + customer: storage::CustomerUpdate, key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store .update_customer_by_customer_id_merchant_id( customer_id, merchant_id, customer, - customer_update, key_store, - storage_scheme, ) .await } @@ -374,15 +360,9 @@ impl CustomerInterface for KafkaStore { customer_id: &str, merchant_id: &str, key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store - .find_customer_by_customer_id_merchant_id( - customer_id, - merchant_id, - key_store, - storage_scheme, - ) + .find_customer_by_customer_id_merchant_id(customer_id, merchant_id, key_store) .await } @@ -390,10 +370,9 @@ impl CustomerInterface for KafkaStore { &self, customer_data: domain::Customer, key_store: &domain::MerchantKeyStore, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store - .insert_customer(customer_data, key_store, storage_scheme) + .insert_customer(customer_data, key_store) .await } } @@ -670,10 +649,9 @@ impl MandateInterface for KafkaStore { &self, merchant_id: &str, mandate_id: &str, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store - .find_mandate_by_merchant_id_mandate_id(merchant_id, mandate_id, storage_scheme) + .find_mandate_by_merchant_id_mandate_id(merchant_id, mandate_id) .await } @@ -681,14 +659,9 @@ impl MandateInterface for KafkaStore { &self, merchant_id: &str, connector_mandate_id: &str, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store - .find_mandate_by_merchant_id_connector_mandate_id( - merchant_id, - connector_mandate_id, - storage_scheme, - ) + .find_mandate_by_merchant_id_connector_mandate_id(merchant_id, connector_mandate_id) .await } @@ -706,18 +679,10 @@ impl MandateInterface for KafkaStore { &self, merchant_id: &str, mandate_id: &str, - mandate_update: storage::MandateUpdate, - mandate: storage::Mandate, - storage_scheme: MerchantStorageScheme, + mandate: storage::MandateUpdate, ) -> CustomResult { self.diesel_store - .update_mandate_by_merchant_id_mandate_id( - merchant_id, - mandate_id, - mandate_update, - mandate, - storage_scheme, - ) + .update_mandate_by_merchant_id_mandate_id(merchant_id, mandate_id, mandate) .await } @@ -734,11 +699,8 @@ impl MandateInterface for KafkaStore { async fn insert_mandate( &self, mandate: storage::MandateNew, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { - self.diesel_store - .insert_mandate(mandate, storage_scheme) - .await + self.diesel_store.insert_mandate(mandate).await } } @@ -861,21 +823,21 @@ impl ConnectorAccessToken for KafkaStore { async fn get_access_token( &self, merchant_id: &str, - merchant_connector_id: &str, + connector_name: &str, ) -> CustomResult, errors::StorageError> { self.diesel_store - .get_access_token(merchant_id, merchant_connector_id) + .get_access_token(merchant_id, connector_name) .await } async fn set_access_token( &self, merchant_id: &str, - merchant_connector_id: &str, + connector_name: &str, access_token: AccessToken, ) -> CustomResult<(), errors::StorageError> { self.diesel_store - .set_access_token(merchant_id, merchant_connector_id, access_token) + .set_access_token(merchant_id, connector_name, access_token) .await } } @@ -1240,11 +1202,11 @@ impl PaymentAttemptInterface for KafkaStore { async fn get_filters_for_payments( &self, - pi: &[hyperswitch_domain_models::payments::PaymentIntent], + pi: &[data_models::payments::PaymentIntent], merchant_id: &str, storage_scheme: MerchantStorageScheme, ) -> CustomResult< - hyperswitch_domain_models::payments::payment_attempt::PaymentListFilters, + data_models::payments::payment_attempt::PaymentListFilters, errors::DataStorageError, > { self.diesel_store @@ -1260,7 +1222,6 @@ impl PaymentAttemptInterface for KafkaStore { payment_method: Option>, payment_method_type: Option>, authentication_type: Option>, - merchant_connector_id: Option>, storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store @@ -1271,7 +1232,6 @@ impl PaymentAttemptInterface for KafkaStore { payment_method, payment_method_type, authentication_type, - merchant_connector_id, storage_scheme, ) .await @@ -1346,7 +1306,7 @@ impl PaymentIntentInterface for KafkaStore { async fn filter_payment_intent_by_constraints( &self, merchant_id: &str, - filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints, + filters: &data_models::payments::payment_intent::PaymentIntentFetchConstraints, storage_scheme: MerchantStorageScheme, ) -> CustomResult, errors::DataStorageError> { self.diesel_store @@ -1374,12 +1334,12 @@ impl PaymentIntentInterface for KafkaStore { async fn get_filtered_payment_intents_attempt( &self, merchant_id: &str, - constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints, + constraints: &data_models::payments::payment_intent::PaymentIntentFetchConstraints, storage_scheme: MerchantStorageScheme, ) -> CustomResult< Vec<( - hyperswitch_domain_models::payments::PaymentIntent, - hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt, + data_models::payments::PaymentIntent, + data_models::payments::payment_attempt::PaymentAttempt, )>, errors::DataStorageError, > { @@ -1392,7 +1352,7 @@ impl PaymentIntentInterface for KafkaStore { async fn get_filtered_active_attempt_ids_for_total_count( &self, merchant_id: &str, - constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints, + constraints: &data_models::payments::payment_intent::PaymentIntentFetchConstraints, storage_scheme: MerchantStorageScheme, ) -> CustomResult, errors::DataStorageError> { self.diesel_store @@ -1420,10 +1380,9 @@ impl PaymentMethodInterface for KafkaStore { async fn find_payment_method( &self, payment_method_id: &str, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store - .find_payment_method(payment_method_id, storage_scheme) + .find_payment_method(payment_method_id) .await } @@ -1444,7 +1403,6 @@ impl PaymentMethodInterface for KafkaStore { merchant_id: &str, status: common_enums::PaymentMethodStatus, limit: Option, - storage_scheme: MerchantStorageScheme, ) -> CustomResult, errors::StorageError> { self.diesel_store .find_payment_method_by_customer_id_merchant_id_status( @@ -1452,7 +1410,6 @@ impl PaymentMethodInterface for KafkaStore { merchant_id, status, limit, - storage_scheme, ) .await } @@ -1475,31 +1432,26 @@ impl PaymentMethodInterface for KafkaStore { async fn find_payment_method_by_locker_id( &self, locker_id: &str, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store - .find_payment_method_by_locker_id(locker_id, storage_scheme) + .find_payment_method_by_locker_id(locker_id) .await } async fn insert_payment_method( &self, m: storage::PaymentMethodNew, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { - self.diesel_store - .insert_payment_method(m, storage_scheme) - .await + self.diesel_store.insert_payment_method(m).await } async fn update_payment_method( &self, payment_method: storage::PaymentMethod, payment_method_update: storage::PaymentMethodUpdate, - storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store - .update_payment_method(payment_method, payment_method_update, storage_scheme) + .update_payment_method(payment_method, payment_method_update) .await } @@ -1539,58 +1491,30 @@ impl PayoutAttemptInterface for KafkaStore { &self, this: &storage::PayoutAttempt, payout_attempt_update: storage::PayoutAttemptUpdate, - payouts: &storage::Payouts, storage_scheme: MerchantStorageScheme, ) -> CustomResult { - let updated_payout_attempt = self - .diesel_store - .update_payout_attempt(this, payout_attempt_update, payouts, storage_scheme) - .await?; - if let Err(err) = self - .kafka_producer - .log_payout( - &KafkaPayout::from_storage(payouts, &updated_payout_attempt), - Some(KafkaPayout::from_storage(payouts, this)), - ) + self.diesel_store + .update_payout_attempt(this, payout_attempt_update, storage_scheme) .await - { - logger::error!(message="Failed to update analytics entry for Payouts {payouts:?}\n{updated_payout_attempt:?}", error_message=?err); - }; - - Ok(updated_payout_attempt) } async fn insert_payout_attempt( &self, payout_attempt: storage::PayoutAttemptNew, - payouts: &storage::Payouts, storage_scheme: MerchantStorageScheme, ) -> CustomResult { - let payout_attempt_new = self - .diesel_store - .insert_payout_attempt(payout_attempt, payouts, storage_scheme) - .await?; - if let Err(err) = self - .kafka_producer - .log_payout( - &KafkaPayout::from_storage(payouts, &payout_attempt_new), - None, - ) + self.diesel_store + .insert_payout_attempt(payout_attempt, storage_scheme) .await - { - logger::error!(message="Failed to add analytics entry for Payouts {payouts:?}\n{payout_attempt_new:?}", error_message=?err); - }; - - Ok(payout_attempt_new) } async fn get_filters_for_payouts( &self, - payouts: &[hyperswitch_domain_models::payouts::payouts::Payouts], + payouts: &[data_models::payouts::payouts::Payouts], merchant_id: &str, storage_scheme: MerchantStorageScheme, ) -> CustomResult< - hyperswitch_domain_models::payouts::payout_attempt::PayoutListFilters, + data_models::payouts::payout_attempt::PayoutListFilters, errors::DataStorageError, > { self.diesel_store @@ -1620,24 +1544,11 @@ impl PayoutsInterface for KafkaStore { &self, this: &storage::Payouts, payout_update: storage::PayoutsUpdate, - payout_attempt: &storage::PayoutAttempt, storage_scheme: MerchantStorageScheme, ) -> CustomResult { - let payout = self - .diesel_store - .update_payout(this, payout_update, payout_attempt, storage_scheme) - .await?; - if let Err(err) = self - .kafka_producer - .log_payout( - &KafkaPayout::from_storage(&payout, payout_attempt), - Some(KafkaPayout::from_storage(this, payout_attempt)), - ) + self.diesel_store + .update_payout(this, payout_update, storage_scheme) .await - { - logger::error!(message="Failed to update analytics entry for Payouts {payout:?}\n{payout_attempt:?}", error_message=?err); - }; - Ok(payout) } async fn insert_payout( @@ -1665,7 +1576,7 @@ impl PayoutsInterface for KafkaStore { async fn filter_payouts_by_constraints( &self, merchant_id: &str, - filters: &hyperswitch_domain_models::payouts::PayoutFetchConstraints, + filters: &data_models::payouts::PayoutFetchConstraints, storage_scheme: MerchantStorageScheme, ) -> CustomResult, errors::DataStorageError> { self.diesel_store @@ -1677,16 +1588,10 @@ impl PayoutsInterface for KafkaStore { async fn filter_payouts_and_attempts( &self, merchant_id: &str, - filters: &hyperswitch_domain_models::payouts::PayoutFetchConstraints, + filters: &data_models::payouts::PayoutFetchConstraints, storage_scheme: MerchantStorageScheme, - ) -> CustomResult< - Vec<( - storage::Payouts, - storage::PayoutAttempt, - diesel_models::Customer, - )>, - errors::DataStorageError, - > { + ) -> CustomResult, errors::DataStorageError> + { self.diesel_store .filter_payouts_and_attempts(merchant_id, filters, storage_scheme) .await @@ -2041,7 +1946,7 @@ impl BusinessProfileInterface for KafkaStore { async fn update_business_profile_by_profile_id( &self, current_state: business_profile::BusinessProfile, - business_profile_update: business_profile::BusinessProfileUpdate, + business_profile_update: business_profile::BusinessProfileUpdateInternal, ) -> CustomResult { self.diesel_store .update_business_profile_by_profile_id(current_state, business_profile_update) @@ -2271,7 +2176,7 @@ impl UserInterface for KafkaStore { async fn find_user_by_email( &self, - user_email: &pii::Email, + user_email: &str, ) -> CustomResult { self.diesel_store.find_user_by_email(user_email).await } @@ -2295,7 +2200,7 @@ impl UserInterface for KafkaStore { async fn update_user_by_email( &self, - user_email: &pii::Email, + user_email: &str, user: storage::UserUpdate, ) -> CustomResult { self.diesel_store @@ -2378,7 +2283,7 @@ impl UserRoleInterface for KafkaStore { &self, user_id: &str, merchant_id: &str, - ) -> CustomResult { + ) -> CustomResult { self.diesel_store .delete_user_role_by_user_id_merchant_id(user_id, merchant_id) .await @@ -2484,11 +2389,9 @@ impl DashboardMetadataInterface for KafkaStore { impl BatchSampleDataInterface for KafkaStore { async fn insert_payment_intents_batch_for_sample_data( &self, - batch: Vec, - ) -> CustomResult< - Vec, - hyperswitch_domain_models::errors::StorageError, - > { + batch: Vec, + ) -> CustomResult, data_models::errors::StorageError> + { let payment_intents_list = self .diesel_store .insert_payment_intents_batch_for_sample_data(batch) @@ -2507,8 +2410,8 @@ impl BatchSampleDataInterface for KafkaStore { &self, batch: Vec, ) -> CustomResult< - Vec, - hyperswitch_domain_models::errors::StorageError, + Vec, + data_models::errors::StorageError, > { let payment_attempts_list = self .diesel_store @@ -2527,8 +2430,7 @@ impl BatchSampleDataInterface for KafkaStore { async fn insert_refunds_batch_for_sample_data( &self, batch: Vec, - ) -> CustomResult, hyperswitch_domain_models::errors::StorageError> - { + ) -> CustomResult, data_models::errors::StorageError> { let refunds_list = self .diesel_store .insert_refunds_batch_for_sample_data(batch) @@ -2543,10 +2445,8 @@ impl BatchSampleDataInterface for KafkaStore { async fn delete_payment_intents_for_sample_data( &self, merchant_id: &str, - ) -> CustomResult< - Vec, - hyperswitch_domain_models::errors::StorageError, - > { + ) -> CustomResult, data_models::errors::StorageError> + { let payment_intents_list = self .diesel_store .delete_payment_intents_for_sample_data(merchant_id) @@ -2565,8 +2465,8 @@ impl BatchSampleDataInterface for KafkaStore { &self, merchant_id: &str, ) -> CustomResult< - Vec, - hyperswitch_domain_models::errors::StorageError, + Vec, + data_models::errors::StorageError, > { let payment_attempts_list = self .diesel_store @@ -2586,8 +2486,7 @@ impl BatchSampleDataInterface for KafkaStore { async fn delete_refunds_for_sample_data( &self, merchant_id: &str, - ) -> CustomResult, hyperswitch_domain_models::errors::StorageError> - { + ) -> CustomResult, data_models::errors::StorageError> { let refunds_list = self .diesel_store .delete_refunds_for_sample_data(merchant_id) @@ -2657,19 +2556,6 @@ impl AuthenticationInterface for KafkaStore { .await } - async fn find_authentication_by_merchant_id_connector_authentication_id( - &self, - merchant_id: String, - connector_authentication_id: String, - ) -> CustomResult { - self.diesel_store - .find_authentication_by_merchant_id_connector_authentication_id( - merchant_id, - connector_authentication_id, - ) - .await - } - async fn update_authentication_by_merchant_id_authentication_id( &self, previous_state: storage::Authentication, diff --git a/crates/router/src/db/mandate.rs b/crates/router/src/db/mandate.rs index 1751657e3f9..273d34a68af 100644 --- a/crates/router/src/db/mandate.rs +++ b/crates/router/src/db/mandate.rs @@ -1,9 +1,11 @@ -use error_stack::ResultExt; +use error_stack::{report, ResultExt}; +use router_env::{instrument, tracing}; -use super::MockDb; +use super::{MockDb, Store}; use crate::{ - core::errors::{self, CustomResult}, - types::storage::{self as storage_types, enums::MerchantStorageScheme}, + connection, + core::{errors, errors::CustomResult}, + types::storage::{self, MandateDbExt}, }; #[async_trait::async_trait] @@ -12,439 +14,116 @@ pub trait MandateInterface { &self, merchant_id: &str, mandate_id: &str, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult; + ) -> CustomResult; async fn find_mandate_by_merchant_id_connector_mandate_id( &self, merchant_id: &str, connector_mandate_id: &str, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult; + ) -> CustomResult; async fn find_mandate_by_merchant_id_customer_id( &self, merchant_id: &str, customer_id: &str, - ) -> CustomResult, errors::StorageError>; + ) -> CustomResult, errors::StorageError>; async fn update_mandate_by_merchant_id_mandate_id( &self, merchant_id: &str, mandate_id: &str, - mandate_update: storage_types::MandateUpdate, - mandate: storage_types::Mandate, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult; + mandate: storage::MandateUpdate, + ) -> CustomResult; async fn find_mandates_by_merchant_id( &self, merchant_id: &str, mandate_constraints: api_models::mandates::MandateListConstraints, - ) -> CustomResult, errors::StorageError>; + ) -> CustomResult, errors::StorageError>; async fn insert_mandate( &self, - mandate: storage_types::MandateNew, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult; + mandate: storage::MandateNew, + ) -> CustomResult; } -#[cfg(feature = "kv_store")] -mod storage { - use common_utils::fallback_reverse_lookup_not_found; - use diesel_models::kv; - use error_stack::{report, ResultExt}; - use redis_interface::HsetnxReply; - use router_env::{instrument, tracing}; - use storage_impl::redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}; - - use super::MandateInterface; - use crate::{ - connection, - core::errors::{self, utils::RedisErrorExt, CustomResult}, - db::reverse_lookup::ReverseLookupInterface, - services::Store, - types::storage::{self as storage_types, enums::MerchantStorageScheme, MandateDbExt}, - utils::db_utils, - }; - - #[async_trait::async_trait] - impl MandateInterface for Store { - #[instrument(skip_all)] - async fn find_mandate_by_merchant_id_mandate_id( - &self, - merchant_id: &str, - mandate_id: &str, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - let database_call = || async { - storage_types::Mandate::find_by_merchant_id_mandate_id( - &conn, - merchant_id, - mandate_id, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - }; - - match storage_scheme { - MerchantStorageScheme::PostgresOnly => database_call().await, - MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdMandateId { - merchant_id, - mandate_id, - }; - let field = format!("mandate_{}", mandate_id); - - Box::pin(db_utils::try_redis_get_else_try_database_get( - async { - kv_wrapper( - self, - KvOperation::::HGet(&field), - key, - ) - .await? - .try_into_hget() - }, - database_call, - )) - .await - } - } - } - - #[instrument(skip_all)] - async fn find_mandate_by_merchant_id_connector_mandate_id( - &self, - merchant_id: &str, - connector_mandate_id: &str, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - let database_call = || async { - storage_types::Mandate::find_by_merchant_id_connector_mandate_id( - &conn, - merchant_id, - connector_mandate_id, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - }; - - match storage_scheme { - MerchantStorageScheme::PostgresOnly => database_call().await, - MerchantStorageScheme::RedisKv => { - let lookup_id = - format!("mid_{}_conn_mandate_{}", merchant_id, connector_mandate_id); - let lookup = fallback_reverse_lookup_not_found!( - self.get_lookup_by_lookup_id(&lookup_id, storage_scheme) - .await, - database_call().await - ); - - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; - - Box::pin(db_utils::try_redis_get_else_try_database_get( - async { - kv_wrapper( - self, - KvOperation::::HGet(&lookup.sk_id), - key, - ) - .await? - .try_into_hget() - }, - database_call, - )) - .await - } - } - } - - #[instrument(skip_all)] - async fn find_mandate_by_merchant_id_customer_id( - &self, - merchant_id: &str, - customer_id: &str, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - storage_types::Mandate::find_by_merchant_id_customer_id(&conn, merchant_id, customer_id) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - - #[instrument(skip_all)] - async fn update_mandate_by_merchant_id_mandate_id( - &self, - merchant_id: &str, - mandate_id: &str, - mandate_update: storage_types::MandateUpdate, - mandate: storage_types::Mandate, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - - match storage_scheme { - MerchantStorageScheme::PostgresOnly => { - storage_types::Mandate::update_by_merchant_id_mandate_id( - &conn, - merchant_id, - mandate_id, - storage_types::MandateUpdateInternal::from(mandate_update), - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdMandateId { - merchant_id, - mandate_id, - }; - let field = format!("mandate_{}", mandate_id); - let key_str = key.to_string(); - - if let diesel_models::MandateUpdate::ConnectorMandateIdUpdate { - connector_mandate_id: Some(val), - .. - } = &mandate_update - { - let rev_lookup = diesel_models::ReverseLookupNew { - sk_id: field.clone(), - pk_id: key_str.clone(), - lookup_id: format!("mid_{}_conn_mandate_{}", merchant_id, val), - source: "mandate".to_string(), - updated_by: storage_scheme.to_string(), - }; - self.insert_reverse_lookup(rev_lookup, storage_scheme) - .await?; - } - - let m_update = diesel_models::MandateUpdateInternal::from(mandate_update); - let updated_mandate = m_update.clone().apply_changeset(mandate.clone()); - - let redis_value = serde_json::to_string(&updated_mandate) - .change_context(errors::StorageError::SerializationFailed)?; - - let redis_entry = kv::TypedSql { - op: kv::DBOperation::Update { - updatable: kv::Updateable::MandateUpdate(kv::MandateUpdateMems { - orig: mandate, - update_data: m_update, - }), - }, - }; - - kv_wrapper::<(), _, _>( - self, - KvOperation::::Hset( - (&field, redis_value), - redis_entry, - ), - key, - ) - .await - .map_err(|err| err.to_redis_failed_response(&key_str))? - .try_into_hset() - .change_context(errors::StorageError::KVError)?; - - Ok(updated_mandate) - } - } - } - - #[instrument(skip_all)] - async fn find_mandates_by_merchant_id( - &self, - merchant_id: &str, - mandate_constraints: api_models::mandates::MandateListConstraints, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - storage_types::Mandate::filter_by_constraints(&conn, merchant_id, mandate_constraints) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - - #[instrument(skip_all)] - async fn insert_mandate( - &self, - mandate: storage_types::MandateNew, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - - match storage_scheme { - MerchantStorageScheme::PostgresOnly => mandate - .insert(&conn) - .await - .map_err(|error| report!(errors::StorageError::from(error))), - MerchantStorageScheme::RedisKv => { - let mandate_id = mandate.mandate_id.clone(); - let merchant_id = mandate.merchant_id.clone(); - let connector_mandate_id = mandate.connector_mandate_id.clone(); - - let key = PartitionKey::MerchantIdMandateId { - merchant_id: merchant_id.as_str(), - mandate_id: mandate_id.as_str(), - }; - let key_str = key.to_string(); - let field = format!("mandate_{}", mandate_id); - - let storage_mandate = storage_types::Mandate::from(&mandate); - - let redis_entry = kv::TypedSql { - op: kv::DBOperation::Insert { - insertable: kv::Insertable::Mandate(mandate), - }, - }; - - if let Some(connector_val) = connector_mandate_id { - let lookup_id = - format!("mid_{}_conn_mandate_{}", merchant_id, connector_val); - - let reverse_lookup_entry = diesel_models::ReverseLookupNew { - sk_id: field.clone(), - pk_id: key_str.clone(), - lookup_id, - source: "mandate".to_string(), - updated_by: storage_scheme.to_string(), - }; - - self.insert_reverse_lookup(reverse_lookup_entry, storage_scheme) - .await?; - } - - match kv_wrapper::( - self, - KvOperation::::HSetNx( - &field, - &storage_mandate, - redis_entry, - ), - key, - ) - .await - .map_err(|err| err.to_redis_failed_response(&key_str))? - .try_into_hsetnx() - { - Ok(HsetnxReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue { - entity: "mandate", - key: Some(storage_mandate.mandate_id), - } - .into()), - Ok(HsetnxReply::KeySet) => Ok(storage_mandate), - Err(er) => Err(er).change_context(errors::StorageError::KVError), - } - } - } - } +#[async_trait::async_trait] +impl MandateInterface for Store { + #[instrument(skip_all)] + async fn find_mandate_by_merchant_id_mandate_id( + &self, + merchant_id: &str, + mandate_id: &str, + ) -> CustomResult { + let conn = connection::pg_connection_read(self).await?; + storage::Mandate::find_by_merchant_id_mandate_id(&conn, merchant_id, mandate_id) + .await + .map_err(|error| report!(errors::StorageError::from(error))) } -} - -#[cfg(not(feature = "kv_store"))] -mod storage { - use error_stack::report; - use router_env::{instrument, tracing}; - - use super::MandateInterface; - use crate::{ - connection, - core::errors::{self, CustomResult}, - services::Store, - types::storage::{self as storage_types, enums::MerchantStorageScheme, MandateDbExt}, - }; - #[async_trait::async_trait] - impl MandateInterface for Store { - #[instrument(skip_all)] - async fn find_mandate_by_merchant_id_mandate_id( - &self, - merchant_id: &str, - mandate_id: &str, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - storage_types::Mandate::find_by_merchant_id_mandate_id(&conn, merchant_id, mandate_id) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } + #[instrument(skip_all)] + async fn find_mandate_by_merchant_id_connector_mandate_id( + &self, + merchant_id: &str, + connector_mandate_id: &str, + ) -> CustomResult { + let conn = connection::pg_connection_read(self).await?; + storage::Mandate::find_by_merchant_id_connector_mandate_id( + &conn, + merchant_id, + connector_mandate_id, + ) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + } - #[instrument(skip_all)] - async fn find_mandate_by_merchant_id_connector_mandate_id( - &self, - merchant_id: &str, - connector_mandate_id: &str, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - storage_types::Mandate::find_by_merchant_id_connector_mandate_id( - &conn, - merchant_id, - connector_mandate_id, - ) + #[instrument(skip_all)] + async fn find_mandate_by_merchant_id_customer_id( + &self, + merchant_id: &str, + customer_id: &str, + ) -> CustomResult, errors::StorageError> { + let conn = connection::pg_connection_read(self).await?; + storage::Mandate::find_by_merchant_id_customer_id(&conn, merchant_id, customer_id) .await .map_err(|error| report!(errors::StorageError::from(error))) - } - - #[instrument(skip_all)] - async fn find_mandate_by_merchant_id_customer_id( - &self, - merchant_id: &str, - customer_id: &str, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - storage_types::Mandate::find_by_merchant_id_customer_id(&conn, merchant_id, customer_id) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } + } - #[instrument(skip_all)] - async fn update_mandate_by_merchant_id_mandate_id( - &self, - merchant_id: &str, - mandate_id: &str, - mandate_update: storage_types::MandateUpdate, - _mandate: storage_types::Mandate, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - storage_types::Mandate::update_by_merchant_id_mandate_id( - &conn, - merchant_id, - mandate_id, - storage_types::MandateUpdateInternal::from(mandate_update), - ) + #[instrument(skip_all)] + async fn update_mandate_by_merchant_id_mandate_id( + &self, + merchant_id: &str, + mandate_id: &str, + mandate: storage::MandateUpdate, + ) -> CustomResult { + let conn = connection::pg_connection_write(self).await?; + storage::Mandate::update_by_merchant_id_mandate_id(&conn, merchant_id, mandate_id, mandate) .await .map_err(|error| report!(errors::StorageError::from(error))) - } + } - #[instrument(skip_all)] - async fn find_mandates_by_merchant_id( - &self, - merchant_id: &str, - mandate_constraints: api_models::mandates::MandateListConstraints, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - storage_types::Mandate::filter_by_constraints(&conn, merchant_id, mandate_constraints) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } + #[instrument(skip_all)] + async fn find_mandates_by_merchant_id( + &self, + merchant_id: &str, + mandate_constraints: api_models::mandates::MandateListConstraints, + ) -> CustomResult, errors::StorageError> { + let conn = connection::pg_connection_read(self).await?; + storage::Mandate::filter_by_constraints(&conn, merchant_id, mandate_constraints) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + } - #[instrument(skip_all)] - async fn insert_mandate( - &self, - mandate: storage_types::MandateNew, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - mandate - .insert(&conn) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } + #[instrument(skip_all)] + async fn insert_mandate( + &self, + mandate: storage::MandateNew, + ) -> CustomResult { + let conn = connection::pg_connection_write(self).await?; + mandate + .insert(&conn) + .await + .map_err(|error| report!(errors::StorageError::from(error))) } } @@ -454,8 +133,7 @@ impl MandateInterface for MockDb { &self, merchant_id: &str, mandate_id: &str, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { + ) -> CustomResult { self.mandates .lock() .await @@ -470,8 +148,7 @@ impl MandateInterface for MockDb { &self, merchant_id: &str, connector_mandate_id: &str, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { + ) -> CustomResult { self.mandates .lock() .await @@ -489,7 +166,7 @@ impl MandateInterface for MockDb { &self, merchant_id: &str, customer_id: &str, - ) -> CustomResult, errors::StorageError> { + ) -> CustomResult, errors::StorageError> { return Ok(self .mandates .lock() @@ -506,10 +183,8 @@ impl MandateInterface for MockDb { &self, merchant_id: &str, mandate_id: &str, - mandate_update: storage_types::MandateUpdate, - _mandate: storage_types::Mandate, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { + mandate_update: storage::MandateUpdate, + ) -> CustomResult { let mut mandates = self.mandates.lock().await; match mandates .iter_mut() @@ -517,13 +192,13 @@ impl MandateInterface for MockDb { { Some(mandate) => { match mandate_update { - storage_types::MandateUpdate::StatusUpdate { mandate_status } => { + storage::MandateUpdate::StatusUpdate { mandate_status } => { mandate.mandate_status = mandate_status; } - storage_types::MandateUpdate::CaptureAmountUpdate { amount_captured } => { + storage::MandateUpdate::CaptureAmountUpdate { amount_captured } => { mandate.amount_captured = amount_captured; } - storage_types::MandateUpdate::ConnectorReferenceUpdate { + storage::MandateUpdate::ConnectorReferenceUpdate { connector_mandate_ids, } => { mandate.connector_mandate_ids = connector_mandate_ids; @@ -553,7 +228,7 @@ impl MandateInterface for MockDb { &self, merchant_id: &str, mandate_constraints: api_models::mandates::MandateListConstraints, - ) -> CustomResult, errors::StorageError> { + ) -> CustomResult, errors::StorageError> { let mandates = self.mandates.lock().await; let mandates_iter = mandates.iter().filter(|mandate| { let mut checker = mandate.merchant_id == merchant_id; @@ -588,7 +263,7 @@ impl MandateInterface for MockDb { mandate_constraints.offset.unwrap_or(0) }) as usize; - let mandates: Vec = if let Some(limit) = mandate_constraints.limit { + let mandates: Vec = if let Some(limit) = mandate_constraints.limit { #[allow(clippy::as_conversions)] mandates_iter .skip(offset) @@ -603,11 +278,10 @@ impl MandateInterface for MockDb { async fn insert_mandate( &self, - mandate_new: storage_types::MandateNew, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { + mandate_new: storage::MandateNew, + ) -> CustomResult { let mut mandates = self.mandates.lock().await; - let mandate = storage_types::Mandate { + let mandate = storage::Mandate { id: i32::try_from(mandates.len()).change_context(errors::StorageError::MockDbError)?, mandate_id: mandate_new.mandate_id.clone(), customer_id: mandate_new.customer_id, diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs index 8f50f5f5426..b7c85560804 100644 --- a/crates/router/src/db/merchant_connector_account.rs +++ b/crates/router/src/db/merchant_connector_account.rs @@ -24,13 +24,13 @@ pub trait ConnectorAccessToken { async fn get_access_token( &self, merchant_id: &str, - merchant_connector_id_or_connector_name: &str, + connector_name: &str, ) -> CustomResult, errors::StorageError>; async fn set_access_token( &self, merchant_id: &str, - merchant_connector_id_or_connector_name: &str, + connector_name: &str, access_token: types::AccessToken, ) -> CustomResult<(), errors::StorageError>; } @@ -41,16 +41,12 @@ impl ConnectorAccessToken for Store { async fn get_access_token( &self, merchant_id: &str, - merchant_connector_id_or_connector_name: &str, + connector_name: &str, ) -> CustomResult, errors::StorageError> { //TODO: Handle race condition // This function should acquire a global lock on some resource, if access token is already // being refreshed by other request then wait till it finishes and use the same access token - let key = common_utils::access_token::create_access_token_key( - merchant_id, - merchant_connector_id_or_connector_name, - ); - + let key = format!("access_token_{merchant_id}_{connector_name}"); let maybe_token = self .get_redis_conn() .map_err(Into::::into)? @@ -59,9 +55,10 @@ impl ConnectorAccessToken for Store { .change_context(errors::StorageError::KVError) .attach_printable("DB error when getting access token")?; - let access_token = maybe_token - .map(|token| token.parse_struct::("AccessToken")) + let access_token: Option = maybe_token + .map(|token| token.parse_struct("AccessToken")) .transpose() + .change_context(errors::ParsingError::UnknownError) .change_context(errors::StorageError::DeserializationFailed)?; Ok(access_token) @@ -71,13 +68,10 @@ impl ConnectorAccessToken for Store { async fn set_access_token( &self, merchant_id: &str, - merchant_connector_id_or_connector_name: &str, + connector_name: &str, access_token: types::AccessToken, ) -> CustomResult<(), errors::StorageError> { - let key = common_utils::access_token::create_access_token_key( - merchant_id, - merchant_connector_id_or_connector_name, - ); + let key = format!("access_token_{merchant_id}_{connector_name}"); let serialized_access_token = access_token .encode_to_string_of_json() .change_context(errors::StorageError::SerializationFailed)?; @@ -94,7 +88,7 @@ impl ConnectorAccessToken for MockDb { async fn get_access_token( &self, _merchant_id: &str, - _merchant_connector_id_or_connector_name: &str, + _connector_name: &str, ) -> CustomResult, errors::StorageError> { Ok(None) } @@ -102,7 +96,7 @@ impl ConnectorAccessToken for MockDb { async fn set_access_token( &self, _merchant_id: &str, - _merchant_connector_id_or_connector_name: &str, + _connector_name: &str, _access_token: types::AccessToken, ) -> CustomResult<(), errors::StorageError> { Ok(()) diff --git a/crates/router/src/db/payment_method.rs b/crates/router/src/db/payment_method.rs index 528861a70aa..14f650127dd 100644 --- a/crates/router/src/db/payment_method.rs +++ b/crates/router/src/db/payment_method.rs @@ -1,10 +1,12 @@ use diesel_models::payment_method::PaymentMethodUpdateInternal; -use error_stack::ResultExt; +use error_stack::{report, ResultExt}; +use router_env::{instrument, tracing}; -use super::MockDb; +use super::{MockDb, Store}; use crate::{ + connection, core::errors::{self, CustomResult}, - types::storage::{self as storage_types, enums::MerchantStorageScheme}, + types::storage, }; #[async_trait::async_trait] @@ -12,21 +14,19 @@ pub trait PaymentMethodInterface { async fn find_payment_method( &self, payment_method_id: &str, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult; + ) -> CustomResult; async fn find_payment_method_by_locker_id( &self, locker_id: &str, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult; + ) -> CustomResult; async fn find_payment_method_by_customer_id_merchant_id_list( &self, customer_id: &str, merchant_id: &str, limit: Option, - ) -> CustomResult, errors::StorageError>; + ) -> CustomResult, errors::StorageError>; async fn find_payment_method_by_customer_id_merchant_id_status( &self, @@ -34,8 +34,7 @@ pub trait PaymentMethodInterface { merchant_id: &str, status: common_enums::PaymentMethodStatus, limit: Option, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult, errors::StorageError>; + ) -> CustomResult, errors::StorageError>; async fn get_payment_method_count_by_customer_id_merchant_id_status( &self, @@ -46,521 +45,140 @@ pub trait PaymentMethodInterface { async fn insert_payment_method( &self, - payment_method_new: storage_types::PaymentMethodNew, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult; + payment_method_new: storage::PaymentMethodNew, + ) -> CustomResult; async fn update_payment_method( &self, - payment_method: storage_types::PaymentMethod, - payment_method_update: storage_types::PaymentMethodUpdate, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult; + payment_method: storage::PaymentMethod, + payment_method_update: storage::PaymentMethodUpdate, + ) -> CustomResult; async fn delete_payment_method_by_merchant_id_payment_method_id( &self, merchant_id: &str, payment_method_id: &str, - ) -> CustomResult; + ) -> CustomResult; } -#[cfg(feature = "kv_store")] -mod storage { - use common_utils::fallback_reverse_lookup_not_found; - use diesel_models::{kv, PaymentMethodUpdateInternal}; - use error_stack::{report, ResultExt}; - use redis_interface::HsetnxReply; - use router_env::{instrument, tracing}; - use storage_impl::redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}; - - use super::PaymentMethodInterface; - use crate::{ - connection, - core::errors::{self, utils::RedisErrorExt, CustomResult}, - db::reverse_lookup::ReverseLookupInterface, - services::Store, - types::storage::{self as storage_types, enums::MerchantStorageScheme}, - utils::db_utils, - }; - - #[async_trait::async_trait] - impl PaymentMethodInterface for Store { - #[instrument(skip_all)] - async fn find_payment_method( - &self, - payment_method_id: &str, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - let database_call = || async { - storage_types::PaymentMethod::find_by_payment_method_id(&conn, payment_method_id) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - }; - - match storage_scheme { - MerchantStorageScheme::PostgresOnly => database_call().await, - MerchantStorageScheme::RedisKv => { - let lookup_id = format!("payment_method_{}", payment_method_id); - let lookup = fallback_reverse_lookup_not_found!( - self.get_lookup_by_lookup_id(&lookup_id, storage_scheme) - .await, - database_call().await - ); - - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; - - Box::pin(db_utils::try_redis_get_else_try_database_get( - async { - kv_wrapper( - self, - KvOperation::::HGet(&lookup.sk_id), - key, - ) - .await? - .try_into_hget() - }, - database_call, - )) - .await - } - } - } - - #[instrument(skip_all)] - async fn find_payment_method_by_locker_id( - &self, - locker_id: &str, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - let database_call = || async { - storage_types::PaymentMethod::find_by_locker_id(&conn, locker_id) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - }; - - match storage_scheme { - MerchantStorageScheme::PostgresOnly => database_call().await, - MerchantStorageScheme::RedisKv => { - let lookup_id = format!("payment_method_locker_{}", locker_id); - let lookup = fallback_reverse_lookup_not_found!( - self.get_lookup_by_lookup_id(&lookup_id, storage_scheme) - .await, - database_call().await - ); - - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; - - Box::pin(db_utils::try_redis_get_else_try_database_get( - async { - kv_wrapper( - self, - KvOperation::::HGet(&lookup.sk_id), - key, - ) - .await? - .try_into_hget() - }, - database_call, - )) - .await - } - } - } - // not supported in kv - #[instrument(skip_all)] - async fn get_payment_method_count_by_customer_id_merchant_id_status( - &self, - customer_id: &str, - merchant_id: &str, - status: common_enums::PaymentMethodStatus, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - storage_types::PaymentMethod::get_count_by_customer_id_merchant_id_status( - &conn, - customer_id, - merchant_id, - status, - ) +#[async_trait::async_trait] +impl PaymentMethodInterface for Store { + #[instrument(skip_all)] + async fn find_payment_method( + &self, + payment_method_id: &str, + ) -> CustomResult { + let conn = connection::pg_connection_read(self).await?; + storage::PaymentMethod::find_by_payment_method_id(&conn, payment_method_id) .await .map_err(|error| report!(errors::StorageError::from(error))) - } - - #[instrument(skip_all)] - async fn insert_payment_method( - &self, - payment_method_new: storage_types::PaymentMethodNew, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - match storage_scheme { - MerchantStorageScheme::PostgresOnly => { - let conn = connection::pg_connection_write(self).await?; - payment_method_new - .insert(&conn) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - MerchantStorageScheme::RedisKv => { - let merchant_id = payment_method_new.merchant_id.clone(); - let customer_id = payment_method_new.customer_id.clone(); - - let key = PartitionKey::MerchantIdCustomerId { - merchant_id: &merchant_id, - customer_id: &customer_id, - }; - let key_str = key.to_string(); - let field = - format!("payment_method_id_{}", payment_method_new.payment_method_id); - - let reverse_lookup_entry = |v: String| diesel_models::ReverseLookupNew { - sk_id: field.clone(), - pk_id: key_str.clone(), - lookup_id: v, - source: "payment_method".to_string(), - updated_by: storage_scheme.to_string(), - }; - - let lookup_id1 = - format!("payment_method_{}", &payment_method_new.payment_method_id); - let mut reverse_lookups = vec![lookup_id1]; - if let Some(locker_id) = &payment_method_new.locker_id { - reverse_lookups.push(format!("payment_method_locker_{}", locker_id)) - } - - let results = reverse_lookups.into_iter().map(|v| { - self.insert_reverse_lookup(reverse_lookup_entry(v), storage_scheme) - }); - - futures::future::try_join_all(results).await?; - - let storage_payment_method = (&payment_method_new).into(); - - let redis_entry = kv::TypedSql { - op: kv::DBOperation::Insert { - insertable: kv::Insertable::PaymentMethod(payment_method_new), - }, - }; - - match kv_wrapper::( - self, - KvOperation::::HSetNx( - &field, - &storage_payment_method, - redis_entry, - ), - key, - ) - .await - .map_err(|err| err.to_redis_failed_response(&key_str))? - .try_into_hsetnx() - { - Ok(HsetnxReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue { - entity: "payment_method", - key: Some(storage_payment_method.payment_method_id), - } - .into()), - Ok(HsetnxReply::KeySet) => Ok(storage_payment_method), - Err(er) => Err(er).change_context(errors::StorageError::KVError), - } - } - } - } - - #[instrument(skip_all)] - async fn update_payment_method( - &self, - payment_method: storage_types::PaymentMethod, - payment_method_update: storage_types::PaymentMethodUpdate, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - match storage_scheme { - MerchantStorageScheme::PostgresOnly => { - let conn = connection::pg_connection_write(self).await?; - payment_method - .update_with_payment_method_id(&conn, payment_method_update.into()) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - MerchantStorageScheme::RedisKv => { - let merchant_id = payment_method.merchant_id.clone(); - let customer_id = payment_method.customer_id.clone(); - let key = PartitionKey::MerchantIdCustomerId { - merchant_id: &merchant_id, - customer_id: &customer_id, - }; - let key_str = key.to_string(); - let field = format!("payment_method_id_{}", payment_method.payment_method_id); - - let p_update: PaymentMethodUpdateInternal = payment_method_update.into(); - let updated_payment_method = - p_update.clone().apply_changeset(payment_method.clone()); - - let redis_value = serde_json::to_string(&updated_payment_method) - .change_context(errors::StorageError::SerializationFailed)?; - - let redis_entry = kv::TypedSql { - op: kv::DBOperation::Update { - updatable: kv::Updateable::PaymentMethodUpdate( - kv::PaymentMethodUpdateMems { - orig: payment_method, - update_data: p_update, - }, - ), - }, - }; - - kv_wrapper::<(), _, _>( - self, - KvOperation::::Hset( - (&field, redis_value), - redis_entry, - ), - key, - ) - .await - .map_err(|err| err.to_redis_failed_response(&key_str))? - .try_into_hset() - .change_context(errors::StorageError::KVError)?; - - Ok(updated_payment_method) - } - } - } + } - #[instrument(skip_all)] - async fn find_payment_method_by_customer_id_merchant_id_list( - &self, - customer_id: &str, - merchant_id: &str, - limit: Option, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - storage_types::PaymentMethod::find_by_customer_id_merchant_id( - &conn, - customer_id, - merchant_id, - limit, - ) + #[instrument(skip_all)] + async fn find_payment_method_by_locker_id( + &self, + locker_id: &str, + ) -> CustomResult { + let conn = connection::pg_connection_read(self).await?; + storage::PaymentMethod::find_by_locker_id(&conn, locker_id) .await .map_err(|error| report!(errors::StorageError::from(error))) - } - - #[instrument(skip_all)] - async fn find_payment_method_by_customer_id_merchant_id_status( - &self, - customer_id: &str, - merchant_id: &str, - status: common_enums::PaymentMethodStatus, - limit: Option, - storage_scheme: MerchantStorageScheme, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - let database_call = || async { - storage_types::PaymentMethod::find_by_customer_id_merchant_id_status( - &conn, - customer_id, - merchant_id, - status, - limit, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - }; - - match storage_scheme { - MerchantStorageScheme::PostgresOnly => database_call().await, - MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdCustomerId { - merchant_id, - customer_id, - }; - - let pattern = "payment_method_id_*"; - - let redis_fut = async { - let kv_result = kv_wrapper::( - self, - KvOperation::::Scan(pattern), - key, - ) - .await? - .try_into_scan(); - kv_result.map(|payment_methods| { - payment_methods - .into_iter() - .filter(|pm| pm.status == status) - .collect() - }) - }; + } - Box::pin(db_utils::find_all_combined_kv_database( - redis_fut, - database_call, - limit, - )) - .await - } - } - } + #[instrument(skip_all)] + async fn get_payment_method_count_by_customer_id_merchant_id_status( + &self, + customer_id: &str, + merchant_id: &str, + status: common_enums::PaymentMethodStatus, + ) -> CustomResult { + let conn = connection::pg_connection_read(self).await?; + storage::PaymentMethod::get_count_by_customer_id_merchant_id_status( + &conn, + customer_id, + merchant_id, + status, + ) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + } - async fn delete_payment_method_by_merchant_id_payment_method_id( - &self, - merchant_id: &str, - payment_method_id: &str, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - storage_types::PaymentMethod::delete_by_merchant_id_payment_method_id( - &conn, - merchant_id, - payment_method_id, - ) + #[instrument(skip_all)] + async fn insert_payment_method( + &self, + payment_method_new: storage::PaymentMethodNew, + ) -> CustomResult { + let conn = connection::pg_connection_write(self).await?; + payment_method_new + .insert(&conn) .await .map_err(|error| report!(errors::StorageError::from(error))) - } } -} - -#[cfg(not(feature = "kv_store"))] -mod storage { - use error_stack::report; - use router_env::{instrument, tracing}; - use super::PaymentMethodInterface; - use crate::{ - connection, - core::errors::{self, CustomResult}, - services::Store, - types::storage::{self as storage_types, enums::MerchantStorageScheme}, - }; - #[async_trait::async_trait] - impl PaymentMethodInterface for Store { - #[instrument(skip_all)] - async fn find_payment_method( - &self, - payment_method_id: &str, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - storage_types::PaymentMethod::find_by_payment_method_id(&conn, payment_method_id) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - - #[instrument(skip_all)] - async fn find_payment_method_by_locker_id( - &self, - locker_id: &str, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - storage_types::PaymentMethod::find_by_locker_id(&conn, locker_id) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - - #[instrument(skip_all)] - async fn get_payment_method_count_by_customer_id_merchant_id_status( - &self, - customer_id: &str, - merchant_id: &str, - status: common_enums::PaymentMethodStatus, - ) -> CustomResult { - let conn = connection::pg_connection_read(self).await?; - storage_types::PaymentMethod::get_count_by_customer_id_merchant_id_status( - &conn, - customer_id, - merchant_id, - status, - ) + #[instrument(skip_all)] + async fn update_payment_method( + &self, + payment_method: storage::PaymentMethod, + payment_method_update: storage::PaymentMethodUpdate, + ) -> CustomResult { + let conn = connection::pg_connection_write(self).await?; + payment_method + .update_with_payment_method_id(&conn, payment_method_update) .await .map_err(|error| report!(errors::StorageError::from(error))) - } - - #[instrument(skip_all)] - async fn insert_payment_method( - &self, - payment_method_new: storage_types::PaymentMethodNew, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - payment_method_new - .insert(&conn) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } - - #[instrument(skip_all)] - async fn update_payment_method( - &self, - payment_method: storage_types::PaymentMethod, - payment_method_update: storage_types::PaymentMethodUpdate, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - payment_method - .update_with_payment_method_id(&conn, payment_method_update.into()) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } + } - #[instrument(skip_all)] - async fn find_payment_method_by_customer_id_merchant_id_list( - &self, - customer_id: &str, - merchant_id: &str, - limit: Option, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - storage_types::PaymentMethod::find_by_customer_id_merchant_id( - &conn, - customer_id, - merchant_id, - limit, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } + #[instrument(skip_all)] + async fn find_payment_method_by_customer_id_merchant_id_list( + &self, + customer_id: &str, + merchant_id: &str, + limit: Option, + ) -> CustomResult, errors::StorageError> { + let conn = connection::pg_connection_read(self).await?; + storage::PaymentMethod::find_by_customer_id_merchant_id( + &conn, + customer_id, + merchant_id, + limit, + ) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + } - #[instrument(skip_all)] - async fn find_payment_method_by_customer_id_merchant_id_status( - &self, - customer_id: &str, - merchant_id: &str, - status: common_enums::PaymentMethodStatus, - limit: Option, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult, errors::StorageError> { - let conn = connection::pg_connection_read(self).await?; - storage_types::PaymentMethod::find_by_customer_id_merchant_id_status( - &conn, - customer_id, - merchant_id, - status, - limit, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } + #[instrument(skip_all)] + async fn find_payment_method_by_customer_id_merchant_id_status( + &self, + customer_id: &str, + merchant_id: &str, + status: common_enums::PaymentMethodStatus, + limit: Option, + ) -> CustomResult, errors::StorageError> { + let conn = connection::pg_connection_read(self).await?; + storage::PaymentMethod::find_by_customer_id_merchant_id_status( + &conn, + customer_id, + merchant_id, + status, + limit, + ) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + } - async fn delete_payment_method_by_merchant_id_payment_method_id( - &self, - merchant_id: &str, - payment_method_id: &str, - ) -> CustomResult { - let conn = connection::pg_connection_write(self).await?; - storage_types::PaymentMethod::delete_by_merchant_id_payment_method_id( - &conn, - merchant_id, - payment_method_id, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - } + async fn delete_payment_method_by_merchant_id_payment_method_id( + &self, + merchant_id: &str, + payment_method_id: &str, + ) -> CustomResult { + let conn = connection::pg_connection_write(self).await?; + storage::PaymentMethod::delete_by_merchant_id_payment_method_id( + &conn, + merchant_id, + payment_method_id, + ) + .await + .map_err(|error| report!(errors::StorageError::from(error))) } } @@ -569,8 +187,7 @@ impl PaymentMethodInterface for MockDb { async fn find_payment_method( &self, payment_method_id: &str, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { + ) -> CustomResult { let payment_methods = self.payment_methods.lock().await; let payment_method = payment_methods .iter() @@ -589,8 +206,7 @@ impl PaymentMethodInterface for MockDb { async fn find_payment_method_by_locker_id( &self, locker_id: &str, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { + ) -> CustomResult { let payment_methods = self.payment_methods.lock().await; let payment_method = payment_methods .iter() @@ -626,12 +242,11 @@ impl PaymentMethodInterface for MockDb { async fn insert_payment_method( &self, - payment_method_new: storage_types::PaymentMethodNew, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { + payment_method_new: storage::PaymentMethodNew, + ) -> CustomResult { let mut payment_methods = self.payment_methods.lock().await; - let payment_method = storage_types::PaymentMethod { + let payment_method = storage::PaymentMethod { id: i32::try_from(payment_methods.len()) .change_context(errors::StorageError::MockDbError)?, customer_id: payment_method_new.customer_id, @@ -660,8 +275,6 @@ impl PaymentMethodInterface for MockDb { connector_mandate_details: payment_method_new.connector_mandate_details, customer_acceptance: payment_method_new.customer_acceptance, status: payment_method_new.status, - client_secret: payment_method_new.client_secret, - network_transaction_id: payment_method_new.network_transaction_id, }; payment_methods.push(payment_method.clone()); Ok(payment_method) @@ -672,9 +285,9 @@ impl PaymentMethodInterface for MockDb { customer_id: &str, merchant_id: &str, _limit: Option, - ) -> CustomResult, errors::StorageError> { + ) -> CustomResult, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; - let payment_methods_found: Vec = payment_methods + let payment_methods_found: Vec = payment_methods .iter() .filter(|pm| pm.customer_id == customer_id && pm.merchant_id == merchant_id) .cloned() @@ -696,10 +309,9 @@ impl PaymentMethodInterface for MockDb { merchant_id: &str, status: common_enums::PaymentMethodStatus, _limit: Option, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult, errors::StorageError> { + ) -> CustomResult, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; - let payment_methods_found: Vec = payment_methods + let payment_methods_found: Vec = payment_methods .iter() .filter(|pm| { pm.customer_id == customer_id @@ -723,7 +335,7 @@ impl PaymentMethodInterface for MockDb { &self, merchant_id: &str, payment_method_id: &str, - ) -> CustomResult { + ) -> CustomResult { let mut payment_methods = self.payment_methods.lock().await; match payment_methods.iter().position(|pm| { pm.merchant_id == merchant_id && pm.payment_method_id == payment_method_id @@ -741,10 +353,9 @@ impl PaymentMethodInterface for MockDb { async fn update_payment_method( &self, - payment_method: storage_types::PaymentMethod, - payment_method_update: storage_types::PaymentMethodUpdate, - _storage_scheme: MerchantStorageScheme, - ) -> CustomResult { + payment_method: storage::PaymentMethod, + payment_method_update: storage::PaymentMethodUpdate, + ) -> CustomResult { let pm_update_res = self .payment_methods .lock() diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs index ca3921d6199..c62f8469515 100644 --- a/crates/router/src/db/refund.rs +++ b/crates/router/src/db/refund.rs @@ -275,7 +275,7 @@ mod storage { use error_stack::{report, ResultExt}; use redis_interface::HsetnxReply; use router_env::{instrument, tracing}; - use storage_impl::redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}; + use storage_impl::redis::kv_store::{kv_wrapper, KvOperation}; use super::RefundInterface; use crate::{ @@ -315,9 +315,7 @@ mod storage { database_call().await ); - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; + let key = &lookup.pk_id; Box::pin(db_utils::try_redis_get_else_try_database_get( async { kv_wrapper( @@ -349,13 +347,7 @@ mod storage { .map_err(|error| report!(errors::StorageError::from(error))) } enums::MerchantStorageScheme::RedisKv => { - let merchant_id = new.merchant_id.clone(); - let payment_id = new.payment_id.clone(); - let key = PartitionKey::MerchantIdPaymentId { - merchant_id: &merchant_id, - payment_id: &payment_id, - }; - let key_str = key.to_string(); + let key = format!("mid_{}_pid_{}", new.merchant_id, new.payment_id); // TODO: need to add an application generated payment attempt id to distinguish between multiple attempts for the same payment id // Check for database presence as well Maybe use a read replica here ? let created_refund = storage_types::Refund { @@ -406,7 +398,7 @@ mod storage { "ref_ref_id_{}_{}", created_refund.merchant_id, created_refund.refund_id ), - pk_id: key_str.clone(), + pk_id: key.clone(), source: "refund".to_string(), updated_by: storage_scheme.to_string(), }, @@ -417,7 +409,7 @@ mod storage { "ref_inter_ref_{}_{}", created_refund.merchant_id, created_refund.internal_reference_id ), - pk_id: key_str.clone(), + pk_id: key.clone(), source: "refund".to_string(), updated_by: storage_scheme.to_string(), }, @@ -432,7 +424,7 @@ mod storage { connector_refund_id, created_refund.connector ), - pk_id: key_str.clone(), + pk_id: key.clone(), source: "refund".to_string(), updated_by: storage_scheme.to_string(), }) @@ -450,10 +442,10 @@ mod storage { &created_refund, redis_entry, ), - key, + &key, ) .await - .map_err(|err| err.to_redis_failed_response(&key_str))? + .map_err(|err| err.to_redis_failed_response(&key))? .try_into_hsetnx() { Ok(HsetnxReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue { @@ -496,9 +488,7 @@ mod storage { database_call().await ); - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; + let key = &lookup.pk_id; let pattern = db_utils::generate_hscan_pattern_for_refund(&lookup.sk_id); @@ -534,13 +524,7 @@ mod storage { .map_err(|error| report!(errors::StorageError::from(error))) } enums::MerchantStorageScheme::RedisKv => { - let merchant_id = this.merchant_id.clone(); - let payment_id = this.payment_id.clone(); - let key = PartitionKey::MerchantIdPaymentId { - merchant_id: &merchant_id, - payment_id: &payment_id, - }; - let key_str = key.to_string(); + let key = format!("mid_{}_pid_{}", this.merchant_id, this.payment_id); let field = format!("pa_{}_ref_{}", &this.attempt_id, &this.refund_id); let updated_refund = refund.clone().apply_changeset(this.clone()); @@ -563,10 +547,10 @@ mod storage { (&field, redis_value), redis_entry, ), - key, + &key, ) .await - .map_err(|err| err.to_redis_failed_response(&key_str))? + .map_err(|err| err.to_redis_failed_response(&key))? .try_into_hset() .change_context(errors::StorageError::KVError)?; @@ -598,9 +582,7 @@ mod storage { database_call().await ); - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; + let key = &lookup.pk_id; Box::pin(db_utils::try_redis_get_else_try_database_get( async { kv_wrapper( @@ -648,9 +630,7 @@ mod storage { database_call().await ); - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; + let key = &lookup.pk_id; Box::pin(db_utils::try_redis_get_else_try_database_get( async { kv_wrapper( @@ -688,10 +668,7 @@ mod storage { match storage_scheme { enums::MerchantStorageScheme::PostgresOnly => database_call().await, enums::MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPaymentId { - merchant_id, - payment_id, - }; + let key = format!("mid_{merchant_id}_pid_{payment_id}"); Box::pin(db_utils::try_redis_get_else_try_database_get( async { kv_wrapper( diff --git a/crates/router/src/db/reverse_lookup.rs b/crates/router/src/db/reverse_lookup.rs index 121ec06ec1f..852d6359c97 100644 --- a/crates/router/src/db/reverse_lookup.rs +++ b/crates/router/src/db/reverse_lookup.rs @@ -69,7 +69,7 @@ mod storage { use error_stack::{report, ResultExt}; use redis_interface::SetnxReply; use router_env::{instrument, tracing}; - use storage_impl::redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}; + use storage_impl::redis::kv_store::{kv_wrapper, KvOperation}; use super::{ReverseLookupInterface, Store}; use crate::{ @@ -115,12 +115,7 @@ mod storage { match kv_wrapper::( self, KvOperation::SetNx(&created_rev_lookup, redis_entry), - PartitionKey::CombinationKey { - combination: &format!( - "reverse_lookup_{}", - &created_rev_lookup.lookup_id - ), - }, + format!("reverse_lookup_{}", &created_rev_lookup.lookup_id), ) .await .map_err(|err| err.to_redis_failed_response(&created_rev_lookup.lookup_id))? @@ -158,9 +153,7 @@ mod storage { kv_wrapper( self, KvOperation::::Get, - PartitionKey::CombinationKey { - combination: &format!("reverse_lookup_{id}"), - }, + format!("reverse_lookup_{id}"), ) .await? .try_into_get() diff --git a/crates/router/src/db/user.rs b/crates/router/src/db/user.rs index 47b3d376a16..a96829a756e 100644 --- a/crates/router/src/db/user.rs +++ b/crates/router/src/db/user.rs @@ -7,7 +7,6 @@ use super::MockDb; use crate::{ connection, core::errors::{self, CustomResult}, - pii, services::Store, }; pub mod sample_data; @@ -21,7 +20,7 @@ pub trait UserInterface { async fn find_user_by_email( &self, - user_email: &pii::Email, + user_email: &str, ) -> CustomResult; async fn find_user_by_id( @@ -37,7 +36,7 @@ pub trait UserInterface { async fn update_user_by_email( &self, - user_email: &pii::Email, + user_email: &str, user: storage::UserUpdate, ) -> CustomResult; @@ -69,7 +68,7 @@ impl UserInterface for Store { #[instrument(skip_all)] async fn find_user_by_email( &self, - user_email: &pii::Email, + user_email: &str, ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; storage::User::find_by_user_email(&conn, user_email) @@ -103,7 +102,7 @@ impl UserInterface for Store { #[instrument(skip_all)] async fn update_user_by_email( &self, - user_email: &pii::Email, + user_email: &str, user: storage::UserUpdate, ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; @@ -169,16 +168,20 @@ impl UserInterface for MockDb { async fn find_user_by_email( &self, - user_email: &pii::Email, + user_email: &str, ) -> CustomResult { let users = self.users.lock().await; + let user_email_pii: common_utils::pii::Email = user_email + .to_string() + .try_into() + .map_err(|_| errors::StorageError::MockDbError)?; users .iter() - .find(|user| user.email.eq(user_email)) + .find(|user| user.email == user_email_pii) .cloned() .ok_or( errors::StorageError::ValueNotFound(format!( - "No user available for email = {user_email:?}" + "No user available for email = {user_email}" )) .into(), ) @@ -243,13 +246,17 @@ impl UserInterface for MockDb { async fn update_user_by_email( &self, - user_email: &pii::Email, + user_email: &str, update_user: storage::UserUpdate, ) -> CustomResult { let mut users = self.users.lock().await; + let user_email_pii: common_utils::pii::Email = user_email + .to_string() + .try_into() + .map_err(|_| errors::StorageError::MockDbError)?; users .iter_mut() - .find(|user| user.email.eq(user_email)) + .find(|user| user.email == user_email_pii) .map(|user| { *user = match &update_user { storage::UserUpdate::VerifyUser => storage::User { @@ -275,7 +282,7 @@ impl UserInterface for MockDb { }) .ok_or( errors::StorageError::ValueNotFound(format!( - "No user available for user_email = {user_email:?}" + "No user available for user_email = {user_email}" )) .into(), ) diff --git a/crates/router/src/db/user/sample_data.rs b/crates/router/src/db/user/sample_data.rs index f7926021afd..ae98332cfc4 100644 --- a/crates/router/src/db/user/sample_data.rs +++ b/crates/router/src/db/user/sample_data.rs @@ -1,3 +1,7 @@ +use data_models::{ + errors::StorageError, + payments::{payment_attempt::PaymentAttempt, payment_intent::PaymentIntentNew, PaymentIntent}, +}; use diesel_models::{ errors::DatabaseError, query::user::sample_data as sample_data_queries, @@ -5,10 +9,6 @@ use diesel_models::{ user::sample_data::PaymentAttemptBatchNew, }; use error_stack::{Report, ResultExt}; -use hyperswitch_domain_models::{ - errors::StorageError, - payments::{payment_attempt::PaymentAttempt, payment_intent::PaymentIntentNew, PaymentIntent}, -}; use storage_impl::DataModelExt; use crate::{connection::pg_connection_write, core::errors::CustomResult, services::Store}; diff --git a/crates/router/src/db/user_role.rs b/crates/router/src/db/user_role.rs index e31a2663354..2f61f70b2a8 100644 --- a/crates/router/src/db/user_role.rs +++ b/crates/router/src/db/user_role.rs @@ -48,7 +48,7 @@ pub trait UserRoleInterface { &self, user_id: &str, merchant_id: &str, - ) -> CustomResult; + ) -> CustomResult; async fn list_user_roles_by_user_id( &self, @@ -145,9 +145,8 @@ impl UserRoleInterface for Store { &self, user_id: &str, merchant_id: &str, - ) -> CustomResult { + ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; - storage::UserRole::delete_by_user_id_merchant_id( &conn, user_id.to_owned(), @@ -460,19 +459,18 @@ impl UserRoleInterface for MockDb { &self, user_id: &str, merchant_id: &str, - ) -> CustomResult { + ) -> CustomResult { let mut user_roles = self.user_roles.lock().await; - - match user_roles + let user_role_index = user_roles .iter() - .position(|role| role.user_id == user_id && role.merchant_id == merchant_id) - { - Some(index) => Ok(user_roles.remove(index)), - None => Err(errors::StorageError::ValueNotFound( - "Cannot find user role to delete".to_string(), - ) - .into()), - } + .position(|user_role| { + user_role.user_id == user_id && user_role.merchant_id == merchant_id + }) + .ok_or(errors::StorageError::ValueNotFound(format!( + "No user available for user_id = {user_id}" + )))?; + user_roles.remove(user_role_index); + Ok(true) } async fn list_user_roles_by_user_id( @@ -523,7 +521,7 @@ impl UserRoleInterface for super::KafkaStore { &self, user_id: &str, merchant_id: &str, - ) -> CustomResult { + ) -> CustomResult { self.diesel_store .delete_user_role_by_user_id_merchant_id(user_id, merchant_id) .await diff --git a/crates/router/src/events.rs b/crates/router/src/events.rs index 4bca5824835..5f6d978d455 100644 --- a/crates/router/src/events.rs +++ b/crates/router/src/events.rs @@ -1,11 +1,8 @@ +use data_models::errors::{StorageError, StorageResult}; use error_stack::ResultExt; -use events::{EventsError, Message, MessagingInterface}; -use hyperswitch_domain_models::errors::{StorageError, StorageResult}; -use masking::ErasedMaskSerialize; use router_env::logger; use serde::{Deserialize, Serialize}; use storage_impl::errors::ApplicationError; -use time::PrimitiveDateTime; use crate::{ db::KafkaProducer, @@ -17,6 +14,7 @@ pub mod audit_events; pub mod connector_api_logs; pub mod event_logger; pub mod outgoing_webhook_logs; + #[derive(Debug, Serialize, Clone, Copy)] #[serde(rename_all = "snake_case")] pub enum EventType { @@ -28,8 +26,6 @@ pub enum EventType { OutgoingWebhookLogs, Dispute, AuditEvent, - #[cfg(feature = "payouts")] - Payout, } #[derive(Debug, Default, Deserialize, Clone)] @@ -43,7 +39,6 @@ pub enum EventsConfig { Logs, } -#[allow(clippy::large_enum_variant)] #[derive(Debug, Clone)] pub enum EventsHandler { Kafka(KafkaProducer), @@ -86,21 +81,3 @@ impl EventsHandler { }; } } - -impl MessagingInterface for EventsHandler { - type MessageClass = EventType; - - fn send_message( - &self, - data: T, - timestamp: PrimitiveDateTime, - ) -> error_stack::Result<(), EventsError> - where - T: Message + ErasedMaskSerialize, - { - match self { - Self::Kafka(a) => a.send_message(data, timestamp), - Self::Logs(a) => a.send_message(data, timestamp), - } - } -} diff --git a/crates/router/src/events/api_logs.rs b/crates/router/src/events/api_logs.rs index ddf7a9db06a..beb0334d707 100644 --- a/crates/router/src/events/api_logs.rs +++ b/crates/router/src/events/api_logs.rs @@ -20,7 +20,7 @@ use crate::{ PaymentLinkFormData, }, types::api::{ - AttachEvidenceRequest, Config, ConfigUpdate, CreateFileRequest, DisputeId, FileId, PollId, + AttachEvidenceRequest, Config, ConfigUpdate, CreateFileRequest, DisputeId, FileId, }, }; @@ -150,11 +150,3 @@ impl ApiEventMetric for DisputeId { }) } } - -impl ApiEventMetric for PollId { - fn get_api_event_type(&self) -> Option { - Some(ApiEventsType::Poll { - poll_id: self.poll_id.clone(), - }) - } -} diff --git a/crates/router/src/events/audit_events.rs b/crates/router/src/events/audit_events.rs index 0f186e691b9..6000d37527d 100644 --- a/crates/router/src/events/audit_events.rs +++ b/crates/router/src/events/audit_events.rs @@ -1,26 +1,31 @@ -use events::{Event, EventInfo}; +use data_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent}; use serde::Serialize; -use time::PrimitiveDateTime; + +use crate::services::kafka::KafkaMessage; #[derive(Debug, Clone, Serialize)] -#[serde(tag = "event_type")] pub enum AuditEventType { - Error { error_message: String }, + Error { + error_message: String, + }, PaymentCreated, ConnectorDecided, ConnectorCalled, RefundCreated, RefundSuccess, RefundFail, - PaymentCancelled { cancellation_reason: Option }, + PaymentUpdate { + payment_id: String, + merchant_id: String, + payment_intent: PaymentIntent, + payment_attempt: PaymentAttempt, + }, } #[derive(Debug, Clone, Serialize)] pub struct AuditEvent { - #[serde(flatten)] event_type: AuditEventType, - #[serde(with = "common_utils::custom_serde::iso8601")] - created_at: PrimitiveDateTime, + created_at: time::PrimitiveDateTime, } impl AuditEvent { @@ -32,43 +37,12 @@ impl AuditEvent { } } -impl Event for AuditEvent { - type EventType = super::EventType; - - fn timestamp(&self) -> PrimitiveDateTime { - self.created_at - } - - fn identifier(&self) -> String { - let event_type = match &self.event_type { - AuditEventType::Error { .. } => "error", - AuditEventType::PaymentCreated => "payment_created", - AuditEventType::ConnectorDecided => "connector_decided", - AuditEventType::ConnectorCalled => "connector_called", - AuditEventType::RefundCreated => "refund_created", - AuditEventType::RefundSuccess => "refund_success", - AuditEventType::RefundFail => "refund_fail", - AuditEventType::PaymentCancelled { .. } => "payment_cancelled", - }; - format!( - "{event_type}-{}", - self.timestamp().assume_utc().unix_timestamp_nanos() - ) +impl KafkaMessage for AuditEvent { + fn key(&self) -> String { + format!("{}", self.created_at.assume_utc().unix_timestamp_nanos()) } - fn class(&self) -> Self::EventType { + fn event_type(&self) -> super::EventType { super::EventType::AuditEvent } } - -impl EventInfo for AuditEvent { - type Data = Self; - - fn data(&self) -> error_stack::Result { - Ok(self.clone()) - } - - fn key(&self) -> String { - "event".to_string() - } -} diff --git a/crates/router/src/events/event_logger.rs b/crates/router/src/events/event_logger.rs index 235ee4a3e3c..6851128bf46 100644 --- a/crates/router/src/events/event_logger.rs +++ b/crates/router/src/events/event_logger.rs @@ -1,8 +1,3 @@ -use events::{EventsError, Message, MessagingInterface}; -use masking::ErasedMaskSerialize; -use time::PrimitiveDateTime; - -use super::EventType; use crate::services::{kafka::KafkaMessage, logger}; #[derive(Clone, Debug, Default)] @@ -11,22 +6,6 @@ pub struct EventLogger {} impl EventLogger { #[track_caller] pub(super) fn log_event(&self, event: &T) { - logger::info!(event = ?event.masked_serialize().unwrap_or_else(|e| serde_json::json!({"error": e.to_string()})), event_type =? event.event_type(), event_id =? event.key(), log_type =? "event"); - } -} - -impl MessagingInterface for EventLogger { - type MessageClass = EventType; - - fn send_message( - &self, - data: T, - _timestamp: PrimitiveDateTime, - ) -> error_stack::Result<(), EventsError> - where - T: Message + ErasedMaskSerialize, - { - logger::info!(event =? data.masked_serialize().unwrap_or_else(|e| serde_json::json!({"error": e.to_string()})), event_type =? data.get_message_class(), event_id =? data.identifier(), log_type =? "event"); - Ok(()) + logger::info!(event = ?serde_json::to_value(event).unwrap_or(serde_json::json!({"error": "serialization failed"})), event_type =? event.event_type(), event_id =? event.key(), log_type = "event"); } } diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs index fdabd07fa01..a8d6e792f3c 100644 --- a/crates/router/src/lib.rs +++ b/crates/router/src/lib.rs @@ -71,7 +71,6 @@ pub mod headers { pub const X_WEBHOOK_SIGNATURE: &str = "X-Webhook-Signature-512"; pub const X_REQUEST_ID: &str = "X-Request-Id"; pub const STRIPE_COMPATIBLE_WEBHOOK_SIGNATURE: &str = "Stripe-Signature"; - pub const STRIPE_COMPATIBLE_CONNECT_ACCOUNT: &str = "Stripe-Account"; } pub mod pii { @@ -126,7 +125,6 @@ pub fn mk_app( .service(routes::EphemeralKey::server(state.clone())) .service(routes::Webhooks::server(state.clone())) .service(routes::PaymentMethods::server(state.clone())) - .service(routes::Poll::server(state.clone())) } #[cfg(feature = "olap")] diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs index cd216cb0e81..bf335a5e718 100644 --- a/crates/router/src/routes.rs +++ b/crates/router/src/routes.rs @@ -31,7 +31,6 @@ pub mod payments; pub mod payouts; #[cfg(any(feature = "olap", feature = "oltp"))] pub mod pm_auth; -pub mod poll; #[cfg(feature = "recon")] pub mod recon; pub mod refunds; @@ -60,7 +59,7 @@ pub use self::app::Recon; pub use self::app::{ ApiKeys, AppState, BusinessProfile, Cache, Cards, Configs, ConnectorOnboarding, Customers, Disputes, EphemeralKey, Files, Gsm, Health, Mandates, MerchantAccount, - MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments, Poll, Refunds, User, Webhooks, + MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments, Refunds, User, Webhooks, }; #[cfg(feature = "olap")] pub use self::app::{Blocklist, Routing, Verify, WebhookEvents}; diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs index 63d9f840a00..f5a6a49b9c9 100644 --- a/crates/router/src/routes/admin.rs +++ b/crates/router/src/routes/admin.rs @@ -35,7 +35,7 @@ pub async fn merchant_account_create( state, &req, json_payload.into_inner(), - |state, _, req, _| create_merchant_account(state, req), + |state, _, req| create_merchant_account(state, req), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) @@ -74,7 +74,7 @@ pub async fn retrieve_merchant_account( state, &req, payload, - |state, _, req, _| get_merchant_account(state, req), + |state, _, req| get_merchant_account(state, req), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -102,7 +102,7 @@ pub async fn merchant_account_list( state, &req, query_params.into_inner(), - |state, _, request, _| list_merchant_account(state, request), + |state, _, request| list_merchant_account(state, request), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) @@ -139,7 +139,7 @@ pub async fn update_merchant_account( state, &req, json_payload.into_inner(), - |state, _, req, _| merchant_account_update(state, &merchant_id, req), + |state, _, req| merchant_account_update(state, &merchant_id, req), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -184,7 +184,7 @@ pub async fn delete_merchant_account( state, &req, payload, - |state, _, req, _| merchant_account_delete(state, req.merchant_id), + |state, _, req| merchant_account_delete(state, req.merchant_id), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, ) @@ -219,7 +219,7 @@ pub async fn payment_connector_create( state, &req, json_payload.into_inner(), - |state, _, req, _| create_payment_connector(state, req, &merchant_id), + |state, _, req| create_payment_connector(state, req, &merchant_id), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -270,7 +270,7 @@ pub async fn payment_connector_retrieve( state, &req, payload, - |state, _, req, _| { + |state, _, req| { retrieve_payment_connector(state, req.merchant_id, req.merchant_connector_id) }, auth::auth_type( @@ -317,7 +317,7 @@ pub async fn payment_connector_list( state, &req, merchant_id.to_owned(), - |state, _, merchant_id, _| list_payment_connectors(state, merchant_id), + |state, _, merchant_id| list_payment_connectors(state, merchant_id), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -365,9 +365,7 @@ pub async fn payment_connector_update( state, &req, json_payload.into_inner(), - |state, _, req, _| { - update_payment_connector(state, &merchant_id, &merchant_connector_id, req) - }, + |state, _, req| update_payment_connector(state, &merchant_id, &merchant_connector_id, req), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -418,9 +416,7 @@ pub async fn payment_connector_delete( state, &req, payload, - |state, _, req, _| { - delete_payment_connector(state, req.merchant_id, req.merchant_connector_id) - }, + |state, _, req| delete_payment_connector(state, req.merchant_id, req.merchant_connector_id), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -452,7 +448,7 @@ pub async fn merchant_account_toggle_kv( state, &req, payload, - |state, _, payload, _| kv_for_merchant(state, payload.merchant_id, payload.kv_enabled), + |state, _, payload| kv_for_merchant(state, payload.merchant_id, payload.kv_enabled), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, ) @@ -474,7 +470,7 @@ pub async fn business_profile_create( state, &req, payload, - |state, _, req, _| create_business_profile(state, req, &merchant_id), + |state, _, req| create_business_profile(state, req, &merchant_id), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -501,7 +497,7 @@ pub async fn business_profile_retrieve( state, &req, profile_id, - |state, _, profile_id, _| retrieve_business_profile(state, profile_id), + |state, _, profile_id| retrieve_business_profile(state, profile_id), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -529,7 +525,7 @@ pub async fn business_profile_update( state, &req, json_payload.into_inner(), - |state, _, req, _| update_business_profile(state, &profile_id, &merchant_id, req), + |state, _, req| update_business_profile(state, &profile_id, &merchant_id, req), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -556,7 +552,7 @@ pub async fn business_profile_delete( state, &req, profile_id, - |state, _, profile_id, _| delete_business_profile(state, profile_id, &merchant_id), + |state, _, profile_id| delete_business_profile(state, profile_id, &merchant_id), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, ) @@ -576,7 +572,7 @@ pub async fn business_profiles_list( state, &req, merchant_id.clone(), - |state, _, merchant_id, _| list_business_profile(state, merchant_id), + |state, _, merchant_id| list_business_profile(state, merchant_id), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -606,31 +602,9 @@ pub async fn merchant_account_kv_status( state, &req, merchant_id, - |state, _, req, _| check_merchant_account_kv_status(state, req), + |state, _, req| check_merchant_account_kv_status(state, req), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, ) .await } - -#[instrument(skip_all, fields(flow = ?Flow::ToggleExtendedCardInfo))] -pub async fn toggle_extended_card_info( - state: web::Data, - req: HttpRequest, - path: web::Path<(String, String)>, - json_payload: web::Json, -) -> HttpResponse { - let flow = Flow::ToggleExtendedCardInfo; - let (_, profile_id) = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - json_payload.into_inner(), - |state, _, req, _| extended_card_info_toggle(state, &profile_id, req), - &auth::AdminApiAuth, - api_locking::LockAction::NotApplicable, - )) - .await -} diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs index 55959589152..2e95fd536cf 100644 --- a/crates/router/src/routes/api_keys.rs +++ b/crates/router/src/routes/api_keys.rs @@ -41,7 +41,7 @@ pub async fn api_key_create( state, &req, payload, - |state, _, payload, _| async { + |state, _, payload| async { api_keys::create_api_key(state, payload, merchant_id.clone()).await }, auth::auth_type( @@ -88,7 +88,7 @@ pub async fn api_key_retrieve( state, &req, (&merchant_id, &key_id), - |state, _, (merchant_id, key_id), _| api_keys::retrieve_api_key(state, merchant_id, key_id), + |state, _, (merchant_id, key_id)| api_keys::retrieve_api_key(state, merchant_id, key_id), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -138,7 +138,7 @@ pub async fn api_key_update( state, &req, payload, - |state, _, payload, _| api_keys::update_api_key(state, payload), + |state, _, payload| api_keys::update_api_key(state, payload), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -184,7 +184,7 @@ pub async fn api_key_revoke( state, &req, (&merchant_id, &key_id), - |state, _, (merchant_id, key_id), _| api_keys::revoke_api_key(state, merchant_id, key_id), + |state, _, (merchant_id, key_id)| api_keys::revoke_api_key(state, merchant_id, key_id), auth::auth_type( &auth::AdminApiAuth, &auth::JWTAuthMerchantFromRoute { @@ -233,7 +233,7 @@ pub async fn api_key_list( state, &req, (limit, offset, merchant_id.clone()), - |state, _, (limit, offset, merchant_id), _| async move { + |state, _, (limit, offset, merchant_id)| async move { api_keys::list_api_keys(state, merchant_id, limit, offset).await }, auth::auth_type( diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index 19a632bf895..01ed994a9d3 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -23,6 +23,8 @@ use super::blocklist; use super::dummy_connector::*; #[cfg(feature = "payouts")] use super::payouts::*; +#[cfg(feature = "oltp")] +use super::pm_auth; #[cfg(feature = "olap")] use super::routing as cloud_routing; #[cfg(feature = "olap")] @@ -39,10 +41,6 @@ use super::{configs::*, customers::*, mandates::*, payments::*, refunds::*}; use super::{currency, payment_methods::*}; #[cfg(feature = "oltp")] use super::{ephemeral_key::*, webhooks::*}; -#[cfg(feature = "oltp")] -use super::{pm_auth, poll::retrieve_poll_status}; -#[cfg(feature = "olap")] -pub use crate::analytics::opensearch::OpenSearchClient; use crate::configs::secrets_transformers; #[cfg(all(feature = "frm", feature = "oltp"))] use crate::routes::fraud_check as frm_routes; @@ -59,11 +57,6 @@ pub use crate::{ services::get_store, }; -#[derive(Clone)] -pub struct ReqState { - pub event_context: events::EventContext, -} - #[derive(Clone)] pub struct AppState { pub flow_name: String, @@ -75,8 +68,6 @@ pub struct AppState { pub api_client: Box, #[cfg(feature = "olap")] pub pool: crate::analytics::AnalyticsProvider, - #[cfg(feature = "olap")] - pub opensearch_client: OpenSearchClient, pub request_id: Option, pub file_storage_client: Box, pub encryption_client: Box, @@ -181,14 +172,6 @@ impl AppState { .await .expect("Failed to create event handler"); - #[allow(clippy::expect_used)] - #[cfg(feature = "olap")] - let opensearch_client = conf - .opensearch - .get_opensearch_client() - .await - .expect("Failed to create opensearch client"); - let store: Box = match storage_impl { StorageImpl::Postgresql | StorageImpl::PostgresqlTest => match &event_handler { EventsHandler::Kafka(kafka_client) => Box::new( @@ -235,8 +218,6 @@ impl AppState { event_handler, #[cfg(feature = "olap")] pool, - #[cfg(feature = "olap")] - opensearch_client, request_id: None, file_storage_client, encryption_client, @@ -258,12 +239,6 @@ impl AppState { )) .await } - - pub fn get_req_state(&self) -> ReqState { - ReqState { - event_context: events::EventContext::new(self.event_handler.clone()), - } - } } pub struct Health; @@ -332,7 +307,6 @@ impl Payments { .route(web::post().to(payments_list_by_filter)), ) .service(web::resource("/filter").route(web::post().to(get_filters_for_payments))) - .service(web::resource("/filter_v2").route(web::get().to(get_payment_filters))) } #[cfg(feature = "oltp")] { @@ -396,9 +370,6 @@ impl Payments { ) .service( web::resource("/{payment_id}/3ds/authentication").route(web::post().to(payments_external_authentication)), - ) - .service( - web::resource("/{payment_id}/extended_card_info").route(web::get().to(retrieve_extended_card_info)), ); } route @@ -466,10 +437,6 @@ impl Routing { ) })), ) - .service( - web::resource("/business_profile/{business_profile_id}/configs/pg_agnostic_mit") - .route(web::post().to(cloud_routing::upsert_connector_agnostic_mandate_config)), - ) .service( web::resource("/default") .route(web::get().to(|state, req| { @@ -793,16 +760,9 @@ impl PaymentMethods { .service( web::resource("/{payment_method_id}") .route(web::get().to(payment_method_retrieve_api)) + .route(web::post().to(payment_method_update_api)) .route(web::delete().to(payment_method_delete_api)), ) - .service( - web::resource("/{payment_method_id}/update") - .route(web::post().to(payment_method_update_api)), - ) - .service( - web::resource("/{payment_method_id}/save") - .route(web::post().to(save_payment_method_api)), - ) .service( web::resource("/auth/link").route(web::post().to(pm_auth::link_token_create)), ) @@ -999,17 +959,6 @@ impl Configs { } } -pub struct Poll; - -#[cfg(feature = "oltp")] -impl Poll { - pub fn server(config: AppState) -> Scope { - web::scope("/poll") - .app_data(web::Data::new(config)) - .service(web::resource("/status/{poll_id}").route(web::get().to(retrieve_poll_status))) - } -} - pub struct ApiKeys; #[cfg(feature = "olap")] @@ -1121,17 +1070,10 @@ impl BusinessProfile { .route(web::get().to(business_profiles_list)), ) .service( - web::scope("/{profile_id}") - .service( - web::resource("") - .route(web::get().to(business_profile_retrieve)) - .route(web::post().to(business_profile_update)) - .route(web::delete().to(business_profile_delete)), - ) - .service( - web::resource("/toggle_extended_card_info") - .route(web::post().to(toggle_extended_card_info)), - ), + web::resource("/{profile_id}") + .route(web::get().to(business_profile_retrieve)) + .route(web::post().to(business_profile_update)) + .route(web::delete().to(business_profile_delete)), ) } } @@ -1177,7 +1119,9 @@ impl User { let mut route = web::scope("/user").app_data(web::Data::new(state)); route = route - .service(web::resource("").route(web::get().to(get_user_details))) + .service( + web::resource("/signin").route(web::post().to(user_signin_without_invite_checks)), + ) .service(web::resource("/v2/signin").route(web::post().to(user_signin))) .service(web::resource("/signout").route(web::post().to(signout))) .service(web::resource("/change_password").route(web::post().to(change_password))) @@ -1187,9 +1131,7 @@ impl User { web::resource("/create_merchant") .route(web::post().to(user_merchant_account_create)), ) - // TODO: Remove this endpoint once migration to /merchants/list is done - .service(web::resource("/switch/list").route(web::get().to(list_merchants_for_user))) - .service(web::resource("/merchants/list").route(web::get().to(list_merchants_for_user))) + .service(web::resource("/switch/list").route(web::get().to(list_merchant_ids_for_user))) .service(web::resource("/permission_info").route(web::get().to(get_authorization_info))) .service(web::resource("/update").route(web::post().to(update_user_account_details))) .service( @@ -1210,6 +1152,10 @@ impl User { web::resource("/signup_with_merchant_id") .route(web::post().to(user_signup_with_merchant_id)), ) + .service( + web::resource("/verify_email") + .route(web::post().to(verify_email_without_invite_checks)), + ) .service(web::resource("/v2/verify_email").route(web::post().to(verify_email))) .service( web::resource("/verify_email_request") @@ -1233,6 +1179,7 @@ impl User { .service( web::resource("/list").route(web::get().to(list_users_for_merchant_account)), ) + .service(web::resource("/invite").route(web::post().to(invite_user))) .service( web::resource("/invite_multiple").route(web::post().to(invite_multiple_user)), ) @@ -1296,15 +1243,8 @@ impl WebhookEvents { .app_data(web::Data::new(config)) .service(web::resource("").route(web::get().to(list_initial_webhook_delivery_attempts))) .service( - web::scope("/{event_id}") - .service( - web::resource("attempts") - .route(web::get().to(list_webhook_delivery_attempts)), - ) - .service( - web::resource("retry") - .route(web::post().to(retry_webhook_delivery_attempt)), - ), + web::resource("/{event_id}/attempts") + .route(web::get().to(list_webhook_delivery_attempts)), ) } } diff --git a/crates/router/src/routes/blocklist.rs b/crates/router/src/routes/blocklist.rs index bd0ae9f6c66..87072d2c777 100644 --- a/crates/router/src/routes/blocklist.rs +++ b/crates/router/src/routes/blocklist.rs @@ -31,7 +31,7 @@ pub async fn add_entry_to_blocklist( state, &req, json_payload.into_inner(), - |state, auth: auth::AuthenticationData, body, _| { + |state, auth: auth::AuthenticationData, body| { blocklist::add_entry_to_blocklist(state, auth.merchant_account, body) }, auth::auth_type( @@ -67,7 +67,7 @@ pub async fn remove_entry_from_blocklist( state, &req, json_payload.into_inner(), - |state, auth: auth::AuthenticationData, body, _| { + |state, auth: auth::AuthenticationData, body| { blocklist::remove_entry_from_blocklist(state, auth.merchant_account, body) }, auth::auth_type( @@ -105,7 +105,7 @@ pub async fn list_blocked_payment_methods( state, &req, query_payload.into_inner(), - |state, auth: auth::AuthenticationData, query, _| { + |state, auth: auth::AuthenticationData, query| { blocklist::list_blocklist_entries(state, auth.merchant_account, query) }, auth::auth_type( @@ -143,7 +143,7 @@ pub async fn toggle_blocklist_guard( state, &req, query_payload.into_inner(), - |state, auth: auth::AuthenticationData, query, _| { + |state, auth: auth::AuthenticationData, query| { blocklist::toggle_blocklist_guard(state, auth.merchant_account, query) }, auth::auth_type( diff --git a/crates/router/src/routes/cache.rs b/crates/router/src/routes/cache.rs index e7742d2d18c..520d6ab7db2 100644 --- a/crates/router/src/routes/cache.rs +++ b/crates/router/src/routes/cache.rs @@ -22,7 +22,7 @@ pub async fn invalidate( state, &req, &key, - |state, _, key, _| cache::invalidate(state, key), + |state, _, key| cache::invalidate(state, key), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, ) diff --git a/crates/router/src/routes/cards_info.rs b/crates/router/src/routes/cards_info.rs index 4d65fc72036..79a2061ac4c 100644 --- a/crates/router/src/routes/cards_info.rs +++ b/crates/router/src/routes/cards_info.rs @@ -46,7 +46,7 @@ pub async fn card_iin_info( state, &req, payload, - |state, auth, req, _| cards_info::retrieve_card_info(state, auth.merchant_account, req), + |state, auth, req| cards_info::retrieve_card_info(state, auth.merchant_account, req), &*auth, api_locking::LockAction::NotApplicable, ) diff --git a/crates/router/src/routes/configs.rs b/crates/router/src/routes/configs.rs index 74b9cd73b1e..d7e96f40235 100644 --- a/crates/router/src/routes/configs.rs +++ b/crates/router/src/routes/configs.rs @@ -22,7 +22,7 @@ pub async fn config_key_create( state, &req, payload, - |state, _, data, _| configs::set_config(state, data), + |state, _, data| configs::set_config(state, data), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, ) @@ -42,7 +42,7 @@ pub async fn config_key_retrieve( state, &req, &key, - |state, _, key, _| configs::read_config(state, key), + |state, _, key| configs::read_config(state, key), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, ) @@ -65,7 +65,7 @@ pub async fn config_key_update( state, &req, &payload, - |state, _, payload, _| configs::update_config(state, payload), + |state, _, payload| configs::update_config(state, payload), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, ) @@ -86,7 +86,7 @@ pub async fn config_key_delete( state, &req, key, - |state, _, key, _| configs::config_delete(state, key), + |state, _, key| configs::config_delete(state, key), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, ) diff --git a/crates/router/src/routes/currency.rs b/crates/router/src/routes/currency.rs index e80bd53d8df..74a559e88e9 100644 --- a/crates/router/src/routes/currency.rs +++ b/crates/router/src/routes/currency.rs @@ -14,7 +14,7 @@ pub async fn retrieve_forex(state: web::Data, req: HttpRequest) -> Htt state, &req, (), - |state, _auth: auth::AuthenticationData, _, _| currency::retrieve_forex(state), + |state, _auth: auth::AuthenticationData, _| currency::retrieve_forex(state), auth::auth_type( &auth::ApiKeyAuth, &auth::DashboardNoPermissionAuth, @@ -39,7 +39,7 @@ pub async fn convert_forex( state.clone(), &req, (), - |state, _, _, _| { + |state, _, _| { currency::convert_forex( state, *amount, diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs index 64fa8e83d49..a20d2dd026b 100644 --- a/crates/router/src/routes/customers.rs +++ b/crates/router/src/routes/customers.rs @@ -20,7 +20,7 @@ pub async fn customers_create( state, &req, json_payload.into_inner(), - |state, auth, req, _| create_customer(state, auth.merchant_account, auth.key_store, req), + |state, auth, req| create_customer(state, auth.merchant_account, auth.key_store, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::CustomerWrite), @@ -57,7 +57,7 @@ pub async fn customers_retrieve( state, &req, payload, - |state, auth, req, _| retrieve_customer(state, auth.merchant_account, auth.key_store, req), + |state, auth, req| retrieve_customer(state, auth.merchant_account, auth.key_store, req), &*auth, api_locking::LockAction::NotApplicable, ) @@ -73,9 +73,7 @@ pub async fn customers_list(state: web::Data, req: HttpRequest) -> Htt state, &req, (), - |state, auth, _, _| { - list_customers(state, auth.merchant_account.merchant_id, auth.key_store) - }, + |state, auth, _| list_customers(state, auth.merchant_account.merchant_id, auth.key_store), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::CustomerRead), @@ -101,7 +99,7 @@ pub async fn customers_update( state, &req, json_payload.into_inner(), - |state, auth, req, _| update_customer(state, auth.merchant_account, req, auth.key_store), + |state, auth, req| update_customer(state, auth.merchant_account, req, auth.key_store), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::CustomerWrite), @@ -128,7 +126,7 @@ pub async fn customers_delete( state, &req, payload, - |state, auth, req, _| delete_customer(state, auth.merchant_account, req, auth.key_store), + |state, auth, req| delete_customer(state, auth.merchant_account, req, auth.key_store), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::CustomerWrite), @@ -154,7 +152,7 @@ pub async fn get_customer_mandates( state, &req, customer_id, - |state, auth, req, _| { + |state, auth, req| { crate::core::mandate::get_customer_mandates( state, auth.merchant_account, diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rs index a4a6c7507a4..28b3e0db211 100644 --- a/crates/router/src/routes/disputes.rs +++ b/crates/router/src/routes/disputes.rs @@ -43,7 +43,7 @@ pub async fn retrieve_dispute( state, &req, dispute_id, - |state, auth, req, _| disputes::retrieve_dispute(state, auth.merchant_account, req), + |state, auth, req| disputes::retrieve_dispute(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::DisputeRead), @@ -90,7 +90,7 @@ pub async fn retrieve_disputes_list( state, &req, payload, - |state, auth, req, _| disputes::retrieve_disputes_list(state, auth.merchant_account, req), + |state, auth, req| disputes::retrieve_disputes_list(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::DisputeRead), @@ -130,7 +130,7 @@ pub async fn accept_dispute( state, &req, dispute_id, - |state, auth, req, _| { + |state, auth, req| { disputes::accept_dispute(state, auth.merchant_account, auth.key_store, req) }, auth::auth_type( @@ -167,7 +167,7 @@ pub async fn submit_dispute_evidence( state, &req, json_payload.into_inner(), - |state, auth, req, _| { + |state, auth, req| { disputes::submit_evidence(state, auth.merchant_account, auth.key_store, req) }, auth::auth_type( @@ -212,7 +212,7 @@ pub async fn attach_dispute_evidence( state, &req, attach_evidence_request, - |state, auth, req, _| { + |state, auth, req| { disputes::attach_evidence(state, auth.merchant_account, auth.key_store, req) }, auth::auth_type( @@ -255,9 +255,7 @@ pub async fn retrieve_dispute_evidence( state, &req, dispute_id, - |state, auth, req, _| { - disputes::retrieve_dispute_evidence(state, auth.merchant_account, req) - }, + |state, auth, req| disputes::retrieve_dispute_evidence(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::DisputeRead), @@ -295,7 +293,7 @@ pub async fn delete_dispute_evidence( state, &req, json_payload.into_inner(), - |state, auth, req, _| disputes::delete_evidence(state, auth.merchant_account, req), + |state, auth, req| disputes::delete_evidence(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::DisputeWrite), diff --git a/crates/router/src/routes/dummy_connector.rs b/crates/router/src/routes/dummy_connector.rs index 79338fc620c..7d2aad7e348 100644 --- a/crates/router/src/routes/dummy_connector.rs +++ b/crates/router/src/routes/dummy_connector.rs @@ -27,7 +27,7 @@ pub async fn dummy_connector_authorize_payment( state, &req, payload, - |state, _, req, _| core::payment_authorize(state, req), + |state, _, req| core::payment_authorize(state, req), &auth::NoAuth, api_locking::LockAction::NotApplicable, ) @@ -51,7 +51,7 @@ pub async fn dummy_connector_complete_payment( state, &req, payload, - |state, _, req, _| core::payment_complete(state, req), + |state, _, req| core::payment_complete(state, req), &auth::NoAuth, api_locking::LockAction::NotApplicable, ) @@ -70,7 +70,7 @@ pub async fn dummy_connector_payment( state, &req, payload, - |state, _, req, _| core::payment(state, req), + |state, _, req| core::payment(state, req), &auth::NoAuth, api_locking::LockAction::NotApplicable, ) @@ -90,7 +90,7 @@ pub async fn dummy_connector_payment_data( state, &req, payload, - |state, _, req, _| core::payment_data(state, req), + |state, _, req| core::payment_data(state, req), &auth::NoAuth, api_locking::LockAction::NotApplicable, ) @@ -111,7 +111,7 @@ pub async fn dummy_connector_refund( state, &req, payload, - |state, _, req, _| core::refund_payment(state, req), + |state, _, req| core::refund_payment(state, req), &auth::NoAuth, api_locking::LockAction::NotApplicable, ) @@ -131,7 +131,7 @@ pub async fn dummy_connector_refund_data( state, &req, payload, - |state, _, req, _| core::refund_data(state, req), + |state, _, req| core::refund_data(state, req), &auth::NoAuth, api_locking::LockAction::NotApplicable, ) diff --git a/crates/router/src/routes/ephemeral_key.rs b/crates/router/src/routes/ephemeral_key.rs index bfe7c353c28..a9e70c1b33c 100644 --- a/crates/router/src/routes/ephemeral_key.rs +++ b/crates/router/src/routes/ephemeral_key.rs @@ -21,7 +21,7 @@ pub async fn ephemeral_key_create( state, &req, payload, - |state, auth, req, _| { + |state, auth, req| { helpers::make_ephemeral_key(state, req.customer_id, auth.merchant_account.merchant_id) }, &auth::ApiKeyAuth, @@ -42,7 +42,7 @@ pub async fn ephemeral_key_delete( state, &req, payload, - |state, _, req, _| helpers::delete_ephemeral_key(state, req), + |state, _, req| helpers::delete_ephemeral_key(state, req), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, ) diff --git a/crates/router/src/routes/files.rs b/crates/router/src/routes/files.rs index 92be12b2bc9..63dfb38c614 100644 --- a/crates/router/src/routes/files.rs +++ b/crates/router/src/routes/files.rs @@ -44,7 +44,7 @@ pub async fn files_create( state, &req, create_file_request, - |state, auth, req, _| files_create_core(state, auth.merchant_account, auth.key_store, req), + |state, auth, req| files_create_core(state, auth.merchant_account, auth.key_store, req), auth::auth_type( &auth::ApiKeyAuth, &auth::DashboardNoPermissionAuth, @@ -86,7 +86,7 @@ pub async fn files_delete( state, &req, file_id, - |state, auth, req, _| files_delete_core(state, auth.merchant_account, req), + |state, auth, req| files_delete_core(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::DashboardNoPermissionAuth, @@ -128,9 +128,7 @@ pub async fn files_retrieve( state, &req, file_id, - |state, auth, req, _| { - files_retrieve_core(state, auth.merchant_account, auth.key_store, req) - }, + |state, auth, req| files_retrieve_core(state, auth.merchant_account, auth.key_store, req), auth::auth_type( &auth::ApiKeyAuth, &auth::DashboardNoPermissionAuth, diff --git a/crates/router/src/routes/fraud_check.rs b/crates/router/src/routes/fraud_check.rs index f0b73015f3c..d4363a236bb 100644 --- a/crates/router/src/routes/fraud_check.rs +++ b/crates/router/src/routes/fraud_check.rs @@ -20,7 +20,7 @@ pub async fn frm_fulfillment( state.clone(), &req, json_payload.into_inner(), - |state, auth, req, _| { + |state, auth, req| { frm_core::frm_fulfillment_core(state, auth.merchant_account, auth.key_store, req) }, &services::authentication::ApiKeyAuth, diff --git a/crates/router/src/routes/gsm.rs b/crates/router/src/routes/gsm.rs index 77a0cb0a645..ff70635959f 100644 --- a/crates/router/src/routes/gsm.rs +++ b/crates/router/src/routes/gsm.rs @@ -39,7 +39,7 @@ pub async fn create_gsm_rule( state.clone(), &req, payload, - |state, _, payload, _| gsm::create_gsm_rule(state, payload), + |state, _, payload| gsm::create_gsm_rule(state, payload), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) @@ -76,7 +76,7 @@ pub async fn get_gsm_rule( state.clone(), &req, gsm_retrieve_req, - |state, _, gsm_retrieve_req, _| gsm::retrieve_gsm_rule(state, gsm_retrieve_req), + |state, _, gsm_retrieve_req| gsm::retrieve_gsm_rule(state, gsm_retrieve_req), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) @@ -114,7 +114,7 @@ pub async fn update_gsm_rule( state.clone(), &req, payload, - |state, _, payload, _| gsm::update_gsm_rule(state, payload), + |state, _, payload| gsm::update_gsm_rule(state, payload), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) @@ -153,7 +153,7 @@ pub async fn delete_gsm_rule( state, &req, payload, - |state, _, payload, _| gsm::delete_gsm_rule(state, payload), + |state, _, payload| gsm::delete_gsm_rule(state, payload), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) diff --git a/crates/router/src/routes/health.rs b/crates/router/src/routes/health.rs index 7d35a91a31e..2afb1c064ec 100644 --- a/crates/router/src/routes/health.rs +++ b/crates/router/src/routes/health.rs @@ -33,7 +33,7 @@ pub async fn deep_health_check( state, &request, (), - |state, _, _, _| deep_health_check_func(state), + |state, _, _| deep_health_check_func(state), &auth::NoAuth, api_locking::LockAction::NotApplicable, )) @@ -74,10 +74,6 @@ async fn deep_health_check_func(state: app::AppState) -> RouterResponse RouterResponse RouterResponse RouterResponse for ApiIdentifier { @@ -99,8 +98,7 @@ impl From for ApiIdentifier { | Flow::PaymentMethodsDelete | Flow::ValidatePaymentMethod | Flow::ListCountriesCurrencies - | Flow::DefaultPaymentMethodsSet - | Flow::PaymentMethodSave => Self::PaymentMethods, + | Flow::DefaultPaymentMethodsSet => Self::PaymentMethods, Flow::PmAuthLinkTokenCreate | Flow::PmAuthExchangeToken => Self::PaymentMethodAuth, @@ -116,12 +114,10 @@ impl From for ApiIdentifier { | Flow::PaymentsSessionToken | Flow::PaymentsStart | Flow::PaymentsList - | Flow::PaymentsFilters | Flow::PaymentsRedirect | Flow::PaymentsIncrementalAuthorization | Flow::PaymentsExternalAuthentication - | Flow::PaymentsAuthorize - | Flow::GetExtendedCardInfo => Self::Payments, + | Flow::PaymentsAuthorize => Self::Payments, Flow::PayoutsCreate | Flow::PayoutsRetrieve @@ -141,8 +137,7 @@ impl From for ApiIdentifier { Flow::FrmFulfillment | Flow::IncomingWebhookReceive | Flow::WebhookEventInitialDeliveryAttemptList - | Flow::WebhookEventDeliveryAttemptList - | Flow::WebhookEventDeliveryRetry => Self::Webhooks, + | Flow::WebhookEventDeliveryAttemptList => Self::Webhooks, Flow::ApiKeyCreate | Flow::ApiKeyRetrieve @@ -167,8 +162,7 @@ impl From for ApiIdentifier { | Flow::BusinessProfileUpdate | Flow::BusinessProfileRetrieve | Flow::BusinessProfileDelete - | Flow::BusinessProfileList - | Flow::ToggleExtendedCardInfo => Self::Business, + | Flow::BusinessProfileList => Self::Business, Flow::PaymentLinkRetrieve | Flow::PaymentLinkInitiate @@ -185,6 +179,7 @@ impl From for ApiIdentifier { Flow::UserConnectAccount | Flow::UserSignUp + | Flow::UserSignInWithoutInviteChecks | Flow::UserSignIn | Flow::Signout | Flow::ChangePassword @@ -198,13 +193,14 @@ impl From for ApiIdentifier { | Flow::DeleteSampleData | Flow::UserMerchantAccountList | Flow::GetUserDetails - | Flow::GetUserRoleDetails | Flow::ListUsersForMerchantAccount | Flow::ForgotPassword | Flow::ResetPassword + | Flow::InviteUser | Flow::InviteMultipleUser | Flow::ReInviteUser | Flow::UserSignUpWithMerchantId + | Flow::VerifyEmailWithoutInviteChecks | Flow::VerifyEmail | Flow::AcceptInviteFromEmail | Flow::VerifyEmailRequest @@ -229,9 +225,6 @@ impl From for ApiIdentifier { | Flow::ReconTokenRequest | Flow::ReconServiceRequest | Flow::ReconVerifyToken => Self::Recon, - Flow::CreateConnectorAgnosticMandateConfig => Self::Routing, - - Flow::RetrievePollStatus => Self::Poll, } } } diff --git a/crates/router/src/routes/locker_migration.rs b/crates/router/src/routes/locker_migration.rs index 2a8b1ca7911..a3df0c3a229 100644 --- a/crates/router/src/routes/locker_migration.rs +++ b/crates/router/src/routes/locker_migration.rs @@ -19,7 +19,7 @@ pub async fn rust_locker_migration( state, &req, &merchant_id, - |state, _, _, _| locker_migration::rust_locker_migration(state, &merchant_id), + |state, _, _| locker_migration::rust_locker_migration(state, &merchant_id), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) diff --git a/crates/router/src/routes/mandates.rs b/crates/router/src/routes/mandates.rs index 365f9a43248..3e47d78da8a 100644 --- a/crates/router/src/routes/mandates.rs +++ b/crates/router/src/routes/mandates.rs @@ -41,9 +41,7 @@ pub async fn get_mandate( state, &req, mandate_id, - |state, auth, req, _| { - mandate::get_mandate(state, auth.merchant_account, auth.key_store, req) - }, + |state, auth, req| mandate::get_mandate(state, auth.merchant_account, auth.key_store, req), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, ) @@ -82,7 +80,7 @@ pub async fn revoke_mandate( state, &req, mandate_id, - |state, auth, req, _| { + |state, auth, req| { mandate::revoke_mandate(state, auth.merchant_account, auth.key_store, req) }, &auth::ApiKeyAuth, @@ -126,7 +124,7 @@ pub async fn retrieve_mandates_list( state, &req, payload, - |state, auth, req, _| { + |state, auth, req| { mandate::retrieve_mandates_list(state, auth.merchant_account, auth.key_store, req) }, auth::auth_type( diff --git a/crates/router/src/routes/payment_link.rs b/crates/router/src/routes/payment_link.rs index 7742f6c1c0e..4d79b923163 100644 --- a/crates/router/src/routes/payment_link.rs +++ b/crates/router/src/routes/payment_link.rs @@ -44,7 +44,7 @@ pub async fn payment_link_retrieve( state, &req, payload.clone(), - |state, _auth, _, _| retrieve_payment_link(state, path.clone()), + |state, _auth, _| retrieve_payment_link(state, path.clone()), &*auth_type, api_locking::LockAction::NotApplicable, ) @@ -67,8 +67,8 @@ pub async fn initiate_payment_link( state, &req, payload.clone(), - |state, auth, _, _| { - initiate_payment_link_flow( + |state, auth, _| { + intiate_payment_link_flow( state, auth.merchant_account, payload.merchant_id.clone(), @@ -117,7 +117,7 @@ pub async fn payments_link_list( state, &req, payload, - |state, auth, payload, _| list_payment_link(state, auth.merchant_account, payload), + |state, auth, payload| list_payment_link(state, auth.merchant_account, payload), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, ) @@ -140,7 +140,7 @@ pub async fn payment_link_status( state, &req, payload.clone(), - |state, auth, _, _| { + |state, auth, _| { get_payment_link_status( state, auth.merchant_account, diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs index e9dacd9f84f..7ef20994e2e 100644 --- a/crates/router/src/routes/payment_methods.rs +++ b/crates/router/src/routes/payment_methods.rs @@ -23,14 +23,13 @@ pub async fn create_payment_method_api( json_payload: web::Json, ) -> HttpResponse { let flow = Flow::PaymentMethodsCreate; - Box::pin(api::server_wrap( flow, state, &req, json_payload.into_inner(), - |state, auth, req, _| async move { - Box::pin(cards::get_client_secret_or_add_payment_method( + |state, auth, req| async move { + Box::pin(cards::add_payment_method( state, req, &auth.merchant_account, @@ -44,41 +43,6 @@ pub async fn create_payment_method_api( .await } -#[instrument(skip_all, fields(flow = ?Flow::PaymentMethodSave))] -pub async fn save_payment_method_api( - state: web::Data, - req: HttpRequest, - json_payload: web::Json, - path: web::Path, -) -> HttpResponse { - let flow = Flow::PaymentMethodSave; - let payload = json_payload.into_inner(); - let pm_id = path.into_inner(); - let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload) { - Ok((auth, _auth_flow)) => (auth, _auth_flow), - Err(e) => return api::log_and_return_error_response(e), - }; - - Box::pin(api::server_wrap( - flow, - state, - &req, - payload, - |state, auth, req, _| { - Box::pin(cards::add_payment_method_data( - state, - req, - auth.merchant_account, - auth.key_store, - pm_id.clone(), - )) - }, - &*auth, - api_locking::LockAction::NotApplicable, - )) - .await -} - #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsList))] pub async fn list_payment_method_api( state: web::Data, @@ -97,7 +61,7 @@ pub async fn list_payment_method_api( state, &req, payload, - |state, auth, req, _| { + |state, auth, req| { cards::list_payment_methods(state, auth.merchant_account, auth.key_store, req) }, &*auth, @@ -149,7 +113,7 @@ pub async fn list_customer_payment_method_api( state, &req, payload, - |state, auth, req, _| { + |state, auth, req| { cards::do_list_customer_pm_fetch_customer_if_not_passed( state, auth.merchant_account, @@ -205,7 +169,7 @@ pub async fn list_customer_payment_method_api_client( state, &req, payload, - |state, auth, req, _| { + |state, auth, req| { cards::do_list_customer_pm_fetch_customer_if_not_passed( state, auth.merchant_account, @@ -237,9 +201,7 @@ pub async fn payment_method_retrieve_api( state, &req, payload, - |state, auth, pm, _| { - cards::retrieve_payment_method(state, pm, auth.key_store, auth.merchant_account) - }, + |state, auth, pm| cards::retrieve_payment_method(state, pm, auth.key_store), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, )) @@ -255,28 +217,22 @@ pub async fn payment_method_update_api( ) -> HttpResponse { let flow = Flow::PaymentMethodsUpdate; let payment_method_id = path.into_inner(); - let payload = json_payload.into_inner(); - - let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload) { - Ok((auth, _auth_flow)) => (auth, _auth_flow), - Err(e) => return api::log_and_return_error_response(e), - }; Box::pin(api::server_wrap( flow, state, &req, - payload, - |state, auth, req, _| { + json_payload.into_inner(), + |state, auth, payload| { cards::update_customer_payment_method( state, auth.merchant_account, - req, + payload, &payment_method_id, auth.key_store, ) }, - &*auth, + &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, )) .await @@ -297,7 +253,7 @@ pub async fn payment_method_delete_api( state, &req, pm, - |state, auth, req, _| { + |state, auth, req| { cards::delete_payment_method(state, auth.merchant_account, req, auth.key_store) }, &auth::ApiKeyAuth, @@ -319,7 +275,7 @@ pub async fn list_countries_currencies_for_connector_payment_method( state, &req, payload, - |state, _auth: auth::AuthenticationData, req, _| { + |state, _auth: auth::AuthenticationData, req| { cards::list_countries_currencies_for_connector_payment_method(state, req) }, #[cfg(not(feature = "release"))] @@ -356,14 +312,13 @@ pub async fn default_payment_method_set_api( state, &req, payload, - |_state, auth: auth::AuthenticationData, default_payment_method, _| { + |_state, auth: auth::AuthenticationData, default_payment_method| { cards::set_default_payment_method( db, auth.merchant_account.merchant_id, auth.key_store, &customer_id, default_payment_method.payment_method_id, - auth.merchant_account.storage_scheme, ) }, &*ephemeral_auth, diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs index c9e1cf14ce3..eda181f5a8b 100644 --- a/crates/router/src/routes/payments.rs +++ b/crates/router/src/routes/payments.rs @@ -9,7 +9,6 @@ use api_models::payments::HeaderPayload; use error_stack::report; use router_env::{env, instrument, tracing, types, Flow}; -use super::app::ReqState; use crate::{ self as app, core::{ @@ -124,11 +123,10 @@ pub async fn payments_create( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { authorize_verify_select::<_, Oss>( payments::PaymentCreate, state, - req_state, auth.merchant_account, auth.key_store, payment_types::HeaderPayload::default(), @@ -188,7 +186,7 @@ pub async fn payments_start( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::< api_types::Authorize, payment_types::PaymentsResponse, @@ -198,7 +196,6 @@ pub async fn payments_start( Oss, >( state, - req_state, auth.merchant_account, auth.key_store, payments::operations::PaymentStart, @@ -270,10 +267,9 @@ pub async fn payments_retrieve( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentStatus, @@ -343,10 +339,9 @@ pub async fn payments_retrieve_with_gateway_creds( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentStatus, @@ -413,11 +408,10 @@ pub async fn payments_update( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { authorize_verify_select::<_, Oss>( payments::PaymentUpdate, state, - req_state, auth.merchant_account, auth.key_store, payment_types::HeaderPayload::default(), @@ -491,11 +485,10 @@ pub async fn payments_confirm( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { authorize_verify_select::<_, Oss>( payments::PaymentConfirm, state, - req_state, auth.merchant_account, auth.key_store, header_payload, @@ -550,7 +543,7 @@ pub async fn payments_capture( state, &req, payload, - |state, auth, payload, req_state| { + |state, auth, payload| { payments::payments_core::< api_types::Capture, payment_types::PaymentsResponse, @@ -560,7 +553,6 @@ pub async fn payments_capture( Oss, >( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentCapture, @@ -609,7 +601,7 @@ pub async fn payments_connector_session( state, &req, payload, - |state, auth, payload, req_state| { + |state, auth, payload| { payments::payments_core::< api_types::Session, payment_types::PaymentsSessionResponse, @@ -619,7 +611,6 @@ pub async fn payments_connector_session( Oss, >( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentSession, @@ -681,11 +672,10 @@ pub async fn payments_redirect_response( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { >::handle_payments_redirect_response( &payments::PaymentRedirectSync {}, state, - req_state, auth.merchant_account, auth.key_store, req, @@ -742,11 +732,10 @@ pub async fn payments_redirect_response_with_creds_identifier( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { >::handle_payments_redirect_response( &payments::PaymentRedirectSync {}, state, - req_state, auth.merchant_account, auth.key_store, req, @@ -785,12 +774,11 @@ pub async fn payments_complete_authorize( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { >::handle_payments_redirect_response( &payments::PaymentRedirectCompleteAuthorize {}, state, - req_state, auth.merchant_account, auth.key_store, req, @@ -840,10 +828,9 @@ pub async fn payments_cancel( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentCancel, @@ -898,7 +885,7 @@ pub async fn payments_list( state, &req, payload, - |state, auth, req, _| payments::list_payments(state, auth.merchant_account, req), + |state, auth, req| payments::list_payments(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::PaymentRead), @@ -922,10 +909,12 @@ pub async fn payments_list_by_filter( state, &req, payload, - |state, auth: auth::AuthenticationData, req, _| { - payments::apply_filters_on_payments(state, auth.merchant_account, req) - }, - &auth::JWTAuth(Permission::PaymentRead), + |state, auth, req| payments::apply_filters_on_payments(state, auth.merchant_account, req), + auth::auth_type( + &auth::ApiKeyAuth, + &auth::JWTAuth(Permission::PaymentRead), + req.headers(), + ), api_locking::LockAction::NotApplicable, ) .await @@ -944,31 +933,12 @@ pub async fn get_filters_for_payments( state, &req, payload, - |state, auth: auth::AuthenticationData, req, _| { - payments::get_filters_for_payments(state, auth.merchant_account, req) - }, - &auth::JWTAuth(Permission::PaymentRead), - api_locking::LockAction::NotApplicable, - ) - .await -} - -#[instrument(skip_all, fields(flow = ?Flow::PaymentsFilters))] -#[cfg(feature = "olap")] -pub async fn get_payment_filters( - state: web::Data, - req: actix_web::HttpRequest, -) -> impl Responder { - let flow = Flow::PaymentsFilters; - api::server_wrap( - flow, - state, - &req, - (), - |state, auth: auth::AuthenticationData, _, _| { - payments::get_payment_filters(state, auth.merchant_account) - }, - &auth::JWTAuth(Permission::PaymentRead), + |state, auth, req| payments::get_filters_for_payments(state, auth.merchant_account, req), + auth::auth_type( + &auth::ApiKeyAuth, + &auth::JWTAuth(Permission::PaymentRead), + req.headers(), + ), api_locking::LockAction::NotApplicable, ) .await @@ -998,7 +968,7 @@ pub async fn payments_approve( state, &http_req, payload.clone(), - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::< api_types::Capture, payment_types::PaymentsResponse, @@ -1008,7 +978,6 @@ pub async fn payments_approve( Oss, >( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentApprove, @@ -1059,7 +1028,7 @@ pub async fn payments_reject( state, &http_req, payload.clone(), - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::< api_types::Void, payment_types::PaymentsResponse, @@ -1069,7 +1038,6 @@ pub async fn payments_reject( Oss, >( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentReject, @@ -1097,11 +1065,9 @@ pub async fn payments_reject( .await } -#[allow(clippy::too_many_arguments)] async fn authorize_verify_select( operation: Op, state: app::AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, header_payload: HeaderPayload, @@ -1143,7 +1109,6 @@ where Ctx, >( state, - req_state, merchant_account, key_store, operation, @@ -1165,7 +1130,6 @@ where Ctx, >( state, - req_state, merchant_account, key_store, operation, @@ -1218,7 +1182,7 @@ pub async fn payments_incremental_authorization( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { payments::payments_core::< api_types::IncrementalAuthorization, payment_types::PaymentsResponse, @@ -1228,7 +1192,6 @@ pub async fn payments_incremental_authorization( Oss, >( state, - req_state, auth.merchant_account, auth.key_store, payments::PaymentIncrementalAuthorization, @@ -1283,7 +1246,7 @@ pub async fn payments_external_authentication( state, &req, payload, - |state, auth, req, _| { + |state, auth, req| { payments::payment_external_authentication( state, auth.merchant_account, @@ -1341,11 +1304,10 @@ pub async fn post_3ds_payments_authorize( state, &req, payload, - |state, auth, req, req_state| { + |state, auth, req| { >::handle_payments_redirect_response( &payments::PaymentAuthenticateCompleteAuthorize {}, state, - req_state, auth.merchant_account, auth.key_store, req, @@ -1357,30 +1319,6 @@ pub async fn post_3ds_payments_authorize( .await } -/// Retrieve endpoint for merchant to fetch the encrypted customer payment method data -#[instrument(skip_all, fields(flow = ?Flow::GetExtendedCardInfo, payment_id))] -pub async fn retrieve_extended_card_info( - state: web::Data, - req: actix_web::HttpRequest, - path: web::Path, -) -> impl Responder { - let flow = Flow::GetExtendedCardInfo; - let payment_id = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - payment_id, - |state, auth, payment_id, _| { - payments::get_extended_card_info(state, auth.merchant_account.merchant_id, payment_id) - }, - &auth::ApiKeyAuth, - api_locking::LockAction::NotApplicable, - )) - .await -} - pub fn get_or_generate_payment_id( payload: &mut payment_types::PaymentsRequest, ) -> errors::RouterResult<()> { diff --git a/crates/router/src/routes/payouts.rs b/crates/router/src/routes/payouts.rs index 315c6e6bd0a..0eeb0f27f07 100644 --- a/crates/router/src/routes/payouts.rs +++ b/crates/router/src/routes/payouts.rs @@ -38,9 +38,7 @@ pub async fn payouts_create( state, &req, json_payload.into_inner(), - |state, auth, req, _| { - payouts_create_core(state, auth.merchant_account, auth.key_store, req) - }, + |state, auth, req| payouts_create_core(state, auth.merchant_account, auth.key_store, req), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, )) @@ -70,8 +68,7 @@ pub async fn payouts_retrieve( ) -> HttpResponse { let payout_retrieve_request = payout_types::PayoutRetrieveRequest { payout_id: path.into_inner(), - force_sync: query_params.force_sync.to_owned(), - merchant_id: query_params.merchant_id.to_owned(), + force_sync: query_params.force_sync, }; let flow = Flow::PayoutsRetrieve; Box::pin(api::server_wrap( @@ -79,9 +76,7 @@ pub async fn payouts_retrieve( state, &req, payout_retrieve_request, - |state, auth, req, _| { - payouts_retrieve_core(state, auth.merchant_account, auth.key_store, req) - }, + |state, auth, req| payouts_retrieve_core(state, auth.merchant_account, auth.key_store, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::PayoutRead), @@ -123,9 +118,7 @@ pub async fn payouts_update( state, &req, payout_update_payload, - |state, auth, req, _| { - payouts_update_core(state, auth.merchant_account, auth.key_store, req) - }, + |state, auth, req| payouts_update_core(state, auth.merchant_account, auth.key_store, req), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, )) @@ -163,9 +156,7 @@ pub async fn payouts_cancel( state, &req, payload, - |state, auth, req, _| { - payouts_cancel_core(state, auth.merchant_account, auth.key_store, req) - }, + |state, auth, req| payouts_cancel_core(state, auth.merchant_account, auth.key_store, req), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, )) @@ -203,9 +194,7 @@ pub async fn payouts_fulfill( state, &req, payload, - |state, auth, req, _| { - payouts_fulfill_core(state, auth.merchant_account, auth.key_store, req) - }, + |state, auth, req| payouts_fulfill_core(state, auth.merchant_account, auth.key_store, req), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, )) @@ -239,7 +228,7 @@ pub async fn payouts_list( state, &req, payload, - |state, auth, req, _| payouts_list_core(state, auth.merchant_account, auth.key_store, req), + |state, auth, req| payouts_list_core(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::PayoutRead), @@ -277,9 +266,7 @@ pub async fn payouts_list_by_filter( state, &req, payload, - |state, auth, req, _| { - payouts_filtered_list_core(state, auth.merchant_account, auth.key_store, req) - }, + |state, auth, req| payouts_filtered_list_core(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::PayoutRead), @@ -317,9 +304,7 @@ pub async fn payouts_list_available_filters( state, &req, payload, - |state, auth, req, _| { - payouts_list_available_filters_core(state, auth.merchant_account, req) - }, + |state, auth, req| payouts_list_available_filters_core(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::PayoutRead), diff --git a/crates/router/src/routes/pm_auth.rs b/crates/router/src/routes/pm_auth.rs index e0cce9c515c..cfadd787c31 100644 --- a/crates/router/src/routes/pm_auth.rs +++ b/crates/router/src/routes/pm_auth.rs @@ -24,7 +24,7 @@ pub async fn link_token_create( state, &req, payload, - |state, auth, payload, _| { + |state, auth, payload| { crate::core::pm_auth::create_link_token( state, auth.merchant_account, @@ -58,7 +58,7 @@ pub async fn exchange_token( state, &req, payload, - |state, auth, payload, _| { + |state, auth, payload| { crate::core::pm_auth::exchange_token_core( state, auth.merchant_account, diff --git a/crates/router/src/routes/poll.rs b/crates/router/src/routes/poll.rs deleted file mode 100644 index 39bb63832a9..00000000000 --- a/crates/router/src/routes/poll.rs +++ /dev/null @@ -1,46 +0,0 @@ -use actix_web::{web, HttpRequest, HttpResponse}; -use router_env::{instrument, tracing, Flow}; - -use super::app::AppState; -use crate::{ - core::{api_locking, poll}, - services::{api, authentication as auth}, - types::api::PollId, -}; - -/// Poll - Retrieve Poll Status -#[utoipa::path( - get, - path = "/poll/status/{poll_id}", - params( - ("poll_id" = String, Path, description = "The identifier for poll") - ), - responses( - (status = 200, description = "The poll status was retrieved successfully", body = PollResponse), - (status = 404, description = "Poll not found") - ), - tag = "Poll", - operation_id = "Retrieve Poll Status", - security(("publishable_key" = [])) -)] -#[instrument(skip_all, fields(flow = ?Flow::RetrievePollStatus))] -pub async fn retrieve_poll_status( - state: web::Data, - req: HttpRequest, - path: web::Path, -) -> HttpResponse { - let flow = Flow::RetrievePollStatus; - let poll_id = PollId { - poll_id: path.into_inner(), - }; - api::server_wrap( - flow, - state, - &req, - poll_id, - |state, auth, req, _| poll::retrieve_poll_status(state, req, auth.merchant_account), - &auth::PublishableKeyAuth, - api_locking::LockAction::NotApplicable, - ) - .await -} diff --git a/crates/router/src/routes/recon.rs b/crates/router/src/routes/recon.rs index 7845f52c924..faa41d9d1d2 100644 --- a/crates/router/src/routes/recon.rs +++ b/crates/router/src/routes/recon.rs @@ -35,7 +35,7 @@ pub async fn update_merchant( state, &req, json_payload.into_inner(), - |state, _user, req, _| recon_merchant_account_update(state, req), + |state, _user, req| recon_merchant_account_update(state, req), &auth::ReconAdmin, api_locking::LockAction::NotApplicable, )) @@ -49,7 +49,7 @@ pub async fn request_for_recon(state: web::Data, http_req: HttpRequest state, &http_req, (), - |state, user: UserFromToken, _req, _| send_recon_request(state, user), + |state, user: UserFromToken, _req| send_recon_request(state, user), &auth::DashboardNoPermissionAuth, api_locking::LockAction::NotApplicable, )) @@ -63,7 +63,7 @@ pub async fn get_recon_token(state: web::Data, req: HttpRequest) -> Ht state, &req, (), - |state, user: ReconUser, _, _| generate_recon_token(state, user), + |state, user: ReconUser, _| generate_recon_token(state, user), &auth::ReconJWT, api_locking::LockAction::NotApplicable, )) diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs index d68c7138213..ef9ffb41124 100644 --- a/crates/router/src/routes/refunds.rs +++ b/crates/router/src/routes/refunds.rs @@ -36,7 +36,7 @@ pub async fn refunds_create( state, &req, json_payload.into_inner(), - |state, auth, req, _| refund_create_core(state, auth.merchant_account, auth.key_store, req), + |state, auth, req| refund_create_core(state, auth.merchant_account, auth.key_store, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::RefundWrite), @@ -88,7 +88,7 @@ pub async fn refunds_retrieve( state, &req, refund_request, - |state, auth, refund_request, _| { + |state, auth, refund_request| { refund_response_wrapper( state, auth.merchant_account, @@ -139,7 +139,7 @@ pub async fn refunds_retrieve_with_body( state, &req, json_payload.into_inner(), - |state, auth, req, _| { + |state, auth, req| { refund_response_wrapper( state, auth.merchant_account, @@ -187,7 +187,7 @@ pub async fn refunds_update( state, &req, refund_update_req, - |state, auth, req, _| refund_update_core(state, auth.merchant_account, req), + |state, auth, req| refund_update_core(state, auth.merchant_account, req), &auth::ApiKeyAuth, api_locking::LockAction::NotApplicable, ) @@ -220,7 +220,7 @@ pub async fn refunds_list( state, &req, payload.into_inner(), - |state, auth, req, _| refund_list(state, auth.merchant_account, req), + |state, auth, req| refund_list(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::RefundRead), @@ -257,7 +257,7 @@ pub async fn refunds_filter_list( state, &req, payload.into_inner(), - |state, auth, req, _| refund_filter_list(state, auth.merchant_account, req), + |state, auth, req| refund_filter_list(state, auth.merchant_account, req), auth::auth_type( &auth::ApiKeyAuth, &auth::JWTAuth(Permission::RefundRead), diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs index 8438424546c..1476fc7b3d6 100644 --- a/crates/router/src/routes/routing.rs +++ b/crates/router/src/routes/routing.rs @@ -31,7 +31,7 @@ pub async fn routing_create_config( state, &req, json_payload.into_inner(), - |state, auth: auth::AuthenticationData, payload, _| { + |state, auth: auth::AuthenticationData, payload| { routing::create_routing_config( state, auth.merchant_account, @@ -67,7 +67,7 @@ pub async fn routing_link_config( state, &req, path.into_inner(), - |state, auth: auth::AuthenticationData, algorithm_id, _| { + |state, auth: auth::AuthenticationData, algorithm_id| { routing::link_routing_config( state, auth.merchant_account, @@ -104,7 +104,7 @@ pub async fn routing_retrieve_config( state, &req, algorithm_id, - |state, auth: auth::AuthenticationData, algorithm_id, _| { + |state, auth: auth::AuthenticationData, algorithm_id| { routing::retrieve_routing_config(state, auth.merchant_account, algorithm_id) }, #[cfg(not(feature = "release"))] @@ -136,7 +136,7 @@ pub async fn list_routing_configs( state, &req, query.into_inner(), - |state, auth: auth::AuthenticationData, query_params, _| { + |state, auth: auth::AuthenticationData, query_params| { routing::retrieve_merchant_routing_dictionary( state, auth.merchant_account, @@ -165,7 +165,7 @@ pub async fn list_routing_configs( state, &req, (), - |state, auth: auth::AuthenticationData, _, _| { + |state, auth: auth::AuthenticationData, _| { routing::retrieve_merchant_routing_dictionary(state, auth.merchant_account) }, #[cfg(not(feature = "release"))] @@ -200,7 +200,7 @@ pub async fn routing_unlink_config( state, &req, payload.into_inner(), - |state, auth: auth::AuthenticationData, payload_req, _| { + |state, auth: auth::AuthenticationData, payload_req| { routing::unlink_routing_config( state, auth.merchant_account, @@ -229,7 +229,7 @@ pub async fn routing_unlink_config( state, &req, (), - |state, auth: auth::AuthenticationData, _, _| { + |state, auth: auth::AuthenticationData, _| { routing::unlink_routing_config( state, auth.merchant_account, @@ -264,7 +264,7 @@ pub async fn routing_update_default_config( state, &req, json_payload.into_inner(), - |state, auth: auth::AuthenticationData, updated_config, _| { + |state, auth: auth::AuthenticationData, updated_config| { routing::update_default_routing_config( state, auth.merchant_account, @@ -297,7 +297,7 @@ pub async fn routing_retrieve_default_config( state, &req, (), - |state, auth: auth::AuthenticationData, _, _| { + |state, auth: auth::AuthenticationData, _| { routing::retrieve_default_routing_config(state, auth.merchant_account, transaction_type) }, #[cfg(not(feature = "release"))] @@ -326,7 +326,7 @@ pub async fn upsert_surcharge_decision_manager_config( state, &req, json_payload.into_inner(), - |state, auth: auth::AuthenticationData, update_decision, _| { + |state, auth: auth::AuthenticationData, update_decision| { surcharge_decision_config::upsert_surcharge_decision_config( state, auth.key_store, @@ -358,7 +358,7 @@ pub async fn delete_surcharge_decision_manager_config( state, &req, (), - |state, auth: auth::AuthenticationData, (), _| { + |state, auth: auth::AuthenticationData, ()| { surcharge_decision_config::delete_surcharge_decision_config( state, auth.key_store, @@ -390,7 +390,7 @@ pub async fn retrieve_surcharge_decision_manager_config( state, &req, (), - |state, auth: auth::AuthenticationData, _, _| { + |state, auth: auth::AuthenticationData, _| { surcharge_decision_config::retrieve_surcharge_decision_config( state, auth.merchant_account, @@ -422,7 +422,7 @@ pub async fn upsert_decision_manager_config( state, &req, json_payload.into_inner(), - |state, auth: auth::AuthenticationData, update_decision, _| { + |state, auth: auth::AuthenticationData, update_decision| { conditional_config::upsert_conditional_config( state, auth.key_store, @@ -455,7 +455,7 @@ pub async fn delete_decision_manager_config( state, &req, (), - |state, auth: auth::AuthenticationData, (), _| { + |state, auth: auth::AuthenticationData, ()| { conditional_config::delete_conditional_config( state, auth.key_store, @@ -487,7 +487,7 @@ pub async fn retrieve_decision_manager_config( state, &req, (), - |state, auth: auth::AuthenticationData, _, _| { + |state, auth: auth::AuthenticationData, _| { conditional_config::retrieve_conditional_config(state, auth.merchant_account) }, #[cfg(not(feature = "release"))] @@ -520,7 +520,7 @@ pub async fn routing_retrieve_linked_config( state, &req, query.into_inner(), - |state, auth: AuthenticationData, query_params, _| { + |state, auth: AuthenticationData, query_params| { routing::retrieve_linked_routing_config( state, auth.merchant_account, @@ -549,7 +549,7 @@ pub async fn routing_retrieve_linked_config( state, &req, (), - |state, auth: auth::AuthenticationData, _, _| { + |state, auth: auth::AuthenticationData, _| { routing::retrieve_linked_routing_config(state, auth.merchant_account) }, #[cfg(not(feature = "release"))] @@ -566,41 +566,6 @@ pub async fn routing_retrieve_linked_config( } } -#[cfg(feature = "olap")] -#[instrument(skip_all)] -pub async fn upsert_connector_agnostic_mandate_config( - state: web::Data, - req: HttpRequest, - json_payload: web::Json, - path: web::Path, -) -> impl Responder { - use crate::services::authentication::AuthenticationData; - - let flow = Flow::CreateConnectorAgnosticMandateConfig; - let business_profile_id = path.into_inner(); - - Box::pin(oss_api::server_wrap( - flow, - state, - &req, - json_payload.into_inner(), - |state, _auth: AuthenticationData, mandate_config, _| { - Box::pin(routing::upsert_connector_agnostic_mandate_config( - state, - &business_profile_id, - mandate_config, - )) - }, - auth::auth_type( - &auth::ApiKeyAuth, - &auth::JWTAuth(Permission::RoutingWrite), - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} - #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_retrieve_default_config_for_profiles( @@ -613,7 +578,7 @@ pub async fn routing_retrieve_default_config_for_profiles( state, &req, (), - |state, auth: auth::AuthenticationData, _, _| { + |state, auth: auth::AuthenticationData, _| { routing::retrieve_default_routing_config_for_profiles( state, auth.merchant_account, @@ -655,7 +620,7 @@ pub async fn routing_update_default_config_for_profile( state, &req, routing_payload_wrapper, - |state, auth: auth::AuthenticationData, wrapper, _| { + |state, auth: auth::AuthenticationData, wrapper| { routing::update_default_routing_config_for_profile( state, auth.merchant_account, diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs index 4d841913bc0..c296d3d93b3 100644 --- a/crates/router/src/routes/user.rs +++ b/crates/router/src/routes/user.rs @@ -19,20 +19,6 @@ use crate::{ utils::user::dashboard_metadata::{parse_string_to_enums, set_ip_address_if_required}, }; -pub async fn get_user_details(state: web::Data, req: HttpRequest) -> HttpResponse { - let flow = Flow::GetUserDetails; - Box::pin(api::server_wrap( - flow, - state, - &req, - (), - |state, user, _, _| user_core::get_user_details(state, user), - &auth::DashboardNoPermissionAuth, - api_locking::LockAction::NotApplicable, - )) - .await -} - #[cfg(feature = "email")] pub async fn user_signup_with_merchant_id( state: web::Data, @@ -46,7 +32,7 @@ pub async fn user_signup_with_merchant_id( state, &http_req, req_payload.clone(), - |state, _, req_body, _| user_core::signup_with_merchant_id(state, req_body), + |state, _, req_body| user_core::signup_with_merchant_id(state, req_body), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) @@ -65,7 +51,26 @@ pub async fn user_signup( state, &http_req, req_payload.clone(), - |state, _, req_body, _| user_core::signup(state, req_body), + |state, _, req_body| user_core::signup(state, req_body), + &auth::NoAuth, + api_locking::LockAction::NotApplicable, + )) + .await +} + +pub async fn user_signin_without_invite_checks( + state: web::Data, + http_req: HttpRequest, + json_payload: web::Json, +) -> HttpResponse { + let flow = Flow::UserSignInWithoutInviteChecks; + let req_payload = json_payload.into_inner(); + Box::pin(api::server_wrap( + flow.clone(), + state, + &http_req, + req_payload.clone(), + |state, _, req_body| user_core::signin_without_invite_checks(state, req_body), &auth::NoAuth, api_locking::LockAction::NotApplicable, )) @@ -76,23 +81,15 @@ pub async fn user_signin( state: web::Data, http_req: HttpRequest, json_payload: web::Json, - query: web::Query, ) -> HttpResponse { let flow = Flow::UserSignIn; let req_payload = json_payload.into_inner(); - let is_token_only = query.into_inner().token_only; Box::pin(api::server_wrap( flow.clone(), state, &http_req, req_payload.clone(), - |state, _, req_body, _| async move { - if let Some(true) = is_token_only { - user_core::signin_token_only_flow(state, req_body).await - } else { - user_core::signin(state, req_body).await - } - }, + |state, _, req_body| user_core::signin(state, req_body), &auth::NoAuth, api_locking::LockAction::NotApplicable, )) @@ -112,7 +109,7 @@ pub async fn user_connect_account( state, &http_req, req_payload.clone(), - |state, _, req_body, _| user_core::connect_account(state, req_body), + |state, _, req_body| user_core::connect_account(state, req_body), &auth::NoAuth, api_locking::LockAction::NotApplicable, )) @@ -126,7 +123,7 @@ pub async fn signout(state: web::Data, http_req: HttpRequest) -> HttpR state.clone(), &http_req, (), - |state, user, _, _| user_core::signout(state, user), + |state, user, _| user_core::signout(state, user), &auth::DashboardNoPermissionAuth, api_locking::LockAction::NotApplicable, )) @@ -144,7 +141,7 @@ pub async fn change_password( state.clone(), &http_req, json_payload.into_inner(), - |state, user, req, _| user_core::change_password(state, req, user), + |state, user, req| user_core::change_password(state, req, user), &auth::DashboardNoPermissionAuth, api_locking::LockAction::NotApplicable, )) @@ -214,7 +211,7 @@ pub async fn internal_user_signup( state.clone(), &http_req, json_payload.into_inner(), - |state, _, req, _| user_core::create_internal_user(state, req), + |state, _, req| user_core::create_internal_user(state, req), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) @@ -232,7 +229,7 @@ pub async fn switch_merchant_id( state.clone(), &http_req, json_payload.into_inner(), - |state, user, req, _| user_core::switch_merchant_id(state, req, user), + |state, user, req| user_core::switch_merchant_id(state, req, user), &auth::DashboardNoPermissionAuth, api_locking::LockAction::NotApplicable, )) @@ -250,7 +247,7 @@ pub async fn user_merchant_account_create( state, &req, json_payload.into_inner(), - |state, auth: auth::UserFromToken, json_payload, _| { + |state, auth: auth::UserFromToken, json_payload| { user_core::create_merchant_account(state, auth, json_payload) }, &auth::JWTAuth(Permission::MerchantAccountCreate), @@ -300,14 +297,17 @@ pub async fn delete_sample_data( .await } -pub async fn list_merchants_for_user(state: web::Data, req: HttpRequest) -> HttpResponse { +pub async fn list_merchant_ids_for_user( + state: web::Data, + req: HttpRequest, +) -> HttpResponse { let flow = Flow::UserMerchantAccountList; Box::pin(api::server_wrap( flow, state, &req, (), - |state, user, _, _| user_core::list_merchants_for_user(state, user), + |state, user, _| user_core::list_merchant_ids_for_user(state, user), &auth::DashboardNoPermissionAuth, api_locking::LockAction::NotApplicable, )) @@ -317,7 +317,7 @@ pub async fn list_merchants_for_user(state: web::Data, req: HttpReques pub async fn get_user_role_details( state: web::Data, req: HttpRequest, - payload: web::Query, + payload: web::Query, ) -> HttpResponse { let flow = Flow::GetUserDetails; Box::pin(api::server_wrap( @@ -342,7 +342,7 @@ pub async fn list_users_for_merchant_account( state.clone(), &req, (), - |state, user, _, _| user_core::list_users_for_merchant_account(state, user), + |state, user, _| user_core::list_users_for_merchant_account(state, user), &auth::JWTAuth(Permission::UsersRead), api_locking::LockAction::NotApplicable, )) @@ -361,7 +361,7 @@ pub async fn forgot_password( state.clone(), &req, payload.into_inner(), - |state, _, payload, _| user_core::forgot_password(state, payload), + |state, _, payload| user_core::forgot_password(state, payload), &auth::NoAuth, api_locking::LockAction::NotApplicable, )) @@ -380,12 +380,30 @@ pub async fn reset_password( state.clone(), &req, payload.into_inner(), - |state, _, payload, _| user_core::reset_password(state, payload), + |state, _, payload| user_core::reset_password(state, payload), &auth::NoAuth, api_locking::LockAction::NotApplicable, )) .await } + +pub async fn invite_user( + state: web::Data, + req: HttpRequest, + payload: web::Json, +) -> HttpResponse { + let flow = Flow::InviteUser; + Box::pin(api::server_wrap( + flow, + state.clone(), + &req, + payload.into_inner(), + |state, user, payload| user_core::invite_user(state, payload, user), + &auth::JWTAuth(Permission::UsersWrite), + api_locking::LockAction::NotApplicable, + )) + .await +} pub async fn invite_multiple_user( state: web::Data, req: HttpRequest, @@ -435,7 +453,26 @@ pub async fn accept_invite_from_email( state.clone(), &req, payload.into_inner(), - |state, _, request_payload, _| user_core::accept_invite_from_email(state, request_payload), + |state, _, request_payload| user_core::accept_invite_from_email(state, request_payload), + &auth::NoAuth, + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[cfg(feature = "email")] +pub async fn verify_email_without_invite_checks( + state: web::Data, + http_req: HttpRequest, + json_payload: web::Json, +) -> HttpResponse { + let flow = Flow::VerifyEmailWithoutInviteChecks; + Box::pin(api::server_wrap( + flow.clone(), + state, + &http_req, + json_payload.into_inner(), + |state, _, req_payload| user_core::verify_email_without_invite_checks(state, req_payload), &auth::NoAuth, api_locking::LockAction::NotApplicable, )) @@ -454,7 +491,7 @@ pub async fn verify_email( state, &http_req, json_payload.into_inner(), - |state, _, req_payload, _| user_core::verify_email(state, req_payload), + |state, _, req_payload| user_core::verify_email(state, req_payload), &auth::NoAuth, api_locking::LockAction::NotApplicable, )) @@ -473,7 +510,7 @@ pub async fn verify_email_request( state.clone(), &http_req, json_payload.into_inner(), - |state, _, req_body, _| user_core::send_verification_mail(state, req_body), + |state, _, req_body| user_core::send_verification_mail(state, req_body), &auth::NoAuth, api_locking::LockAction::NotApplicable, )) @@ -488,7 +525,7 @@ pub async fn verify_recon_token(state: web::Data, http_req: HttpReques state.clone(), &http_req, (), - |state, user, _req, _| user_core::verify_token(state, user), + |state, user, _req| user_core::verify_token(state, user), &auth::ReconJWT, api_locking::LockAction::NotApplicable, )) diff --git a/crates/router/src/routes/user_role.rs b/crates/router/src/routes/user_role.rs index 59c07b79855..65e2aa4cdb8 100644 --- a/crates/router/src/routes/user_role.rs +++ b/crates/router/src/routes/user_role.rs @@ -1,6 +1,5 @@ use actix_web::{web, HttpRequest, HttpResponse}; use api_models::user_role::{self as user_role_api, role as role_api}; -use common_enums::TokenPurpose; use router_env::Flow; use super::AppState; @@ -28,7 +27,7 @@ pub async fn get_authorization_info( state.clone(), &http_req, (), - |state, _: (), _, _| async move { + |state, _: (), _| async move { // TODO: Permissions to be deprecated once groups are stable if respond_with_groups { user_role_core::get_authorization_info_with_groups(state).await @@ -55,7 +54,7 @@ pub async fn get_role_from_token( state.clone(), &req, (), - |state, user, _, _| async move { + |state, user, _| async move { // TODO: Permissions to be deprecated once groups are stable if respond_with_groups { role_core::get_role_from_token_with_groups(state, user).await @@ -99,7 +98,7 @@ pub async fn list_all_roles( state.clone(), &req, (), - |state, user, _, _| async move { + |state, user, _| async move { // TODO: Permissions to be deprecated once groups are stable if respond_with_groups { role_core::list_invitable_roles_with_groups(state, user).await @@ -129,7 +128,7 @@ pub async fn get_role( state.clone(), &req, request_payload, - |state, user, payload, _| async move { + |state, user, payload| async move { // TODO: Permissions to be deprecated once groups are stable if respond_with_groups { role_core::get_role_with_groups(state, user, payload).await @@ -157,7 +156,7 @@ pub async fn update_role( state.clone(), &req, json_payload.into_inner(), - |state, user, req, _| role_core::update_role(state, user, req, &role_id), + |state, user, req| role_core::update_role(state, user, req, &role_id), &auth::JWTAuth(Permission::UsersWrite), api_locking::LockAction::NotApplicable, )) @@ -215,7 +214,7 @@ pub async fn accept_invitation( &req, payload, user_role_core::accept_invitation, - &auth::SinglePurposeJWTAuth(TokenPurpose::AcceptInvite), + &auth::UserWithoutMerchantJWTAuth, api_locking::LockAction::NotApplicable, )) .await diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs index 00662663113..91fd204ba2f 100644 --- a/crates/router/src/routes/verification.rs +++ b/crates/router/src/routes/verification.rs @@ -22,7 +22,7 @@ pub async fn apple_pay_merchant_registration( state, &req, json_payload.into_inner(), - |state, _, body, _| { + |state, _, body| { verification::verify_merchant_creds_for_applepay( state.clone(), body, @@ -54,7 +54,7 @@ pub async fn retrieve_apple_pay_verified_domains( state, &req, merchant_id.clone(), - |state, _, _, _| { + |state, _, _| { verification::get_verified_apple_domains_with_mid_mca_id( state, merchant_id.to_string(), diff --git a/crates/router/src/routes/verify_connector.rs b/crates/router/src/routes/verify_connector.rs index c045b3a8e6a..bfb1b781ada 100644 --- a/crates/router/src/routes/verify_connector.rs +++ b/crates/router/src/routes/verify_connector.rs @@ -20,7 +20,7 @@ pub async fn payment_connector_verify( state, &req, json_payload.into_inner(), - |state, _: (), req, _| verify_connector::verify_connector_credentials(state, req), + |state, _: (), req| verify_connector::verify_connector_credentials(state, req), &auth::JWTAuth(Permission::MerchantConnectorAccountWrite), api_locking::LockAction::NotApplicable, )) diff --git a/crates/router/src/routes/webhook_events.rs b/crates/router/src/routes/webhook_events.rs index ef1d64f54e9..2761ebbd1dc 100644 --- a/crates/router/src/routes/webhook_events.rs +++ b/crates/router/src/routes/webhook_events.rs @@ -7,7 +7,6 @@ use crate::{ services::{api, authentication as auth, authorization::permissions::Permission}, types::api::webhook_events::{ EventListConstraints, EventListRequestInternal, WebhookDeliveryAttemptListRequestInternal, - WebhookDeliveryRetryRequestInternal, }, }; @@ -32,7 +31,7 @@ pub async fn list_initial_webhook_delivery_attempts( state, &req, request_internal, - |state, _, request_internal, _| { + |state, _, request_internal| { webhook_events::list_initial_delivery_attempts( state, request_internal.merchant_id_or_profile_id, @@ -71,7 +70,7 @@ pub async fn list_webhook_delivery_attempts( state, &req, request_internal, - |state, _, request_internal, _| { + |state, _, request_internal| { webhook_events::list_delivery_attempts( state, request_internal.merchant_id_or_profile_id, @@ -90,42 +89,3 @@ pub async fn list_webhook_delivery_attempts( ) .await } - -#[instrument(skip_all, fields(flow = ?Flow::WebhookEventDeliveryRetry))] -pub async fn retry_webhook_delivery_attempt( - state: web::Data, - req: HttpRequest, - path: web::Path<(String, String)>, -) -> impl Responder { - let flow = Flow::WebhookEventDeliveryRetry; - let (merchant_id_or_profile_id, event_id) = path.into_inner(); - - let request_internal = WebhookDeliveryRetryRequestInternal { - merchant_id_or_profile_id: merchant_id_or_profile_id.clone(), - event_id, - }; - - api::server_wrap( - flow, - state, - &req, - request_internal, - |state, _, request_internal, _| { - webhook_events::retry_delivery_attempt( - state, - request_internal.merchant_id_or_profile_id, - request_internal.event_id, - ) - }, - auth::auth_type( - &auth::AdminApiAuth, - &auth::JWTAuthMerchantOrProfileFromRoute { - merchant_id_or_profile_id, - required_permission: Permission::WebhookEventWrite, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - ) - .await -} diff --git a/crates/router/src/routes/webhooks.rs b/crates/router/src/routes/webhooks.rs index 073b1c57000..10eb4ef75e4 100644 --- a/crates/router/src/routes/webhooks.rs +++ b/crates/router/src/routes/webhooks.rs @@ -25,17 +25,16 @@ pub async fn receive_incoming_webhook( flow.clone(), state, &req, - (), - |state, auth, _, req_state| { + WebhookBytes(body), + |state, auth, payload| { webhooks::webhooks_wrapper::( &flow, state.to_owned(), - req_state, &req, auth.merchant_account, auth.key_store, &connector_id_or_name, - body.clone(), + payload.0, ) }, &auth::MerchantIdAuth(merchant_id), diff --git a/crates/router/src/services.rs b/crates/router/src/services.rs index 5af325a46f7..6b604498c71 100644 --- a/crates/router/src/services.rs +++ b/crates/router/src/services.rs @@ -13,8 +13,8 @@ pub mod recon; #[cfg(feature = "email")] pub mod email; +use data_models::errors::StorageResult; use error_stack::ResultExt; -use hyperswitch_domain_models::errors::StorageResult; use masking::{ExposeInterface, StrongSecret}; #[cfg(feature = "kv_store")] use storage_impl::KVRouterStore; diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs index 30c3ce164e2..95eb4a44c8a 100644 --- a/crates/router/src/services/api.rs +++ b/crates/router/src/services/api.rs @@ -45,7 +45,7 @@ use crate::{ }, logger, routes::{ - app::{AppStateInfo, ReqState}, + app::AppStateInfo, metrics::{self, request as metrics_request}, AppState, }, @@ -386,6 +386,7 @@ where .await; let external_latency = current_time.elapsed().as_millis(); logger::info!(raw_connector_request=?masked_request_body); + logger::info!(raw_connector_response=?response); let status_code = response .as_ref() .map(|i| { @@ -852,7 +853,6 @@ pub struct PaymentLinkFormData { pub js_script: String, pub css_script: String, pub sdk_url: String, - pub html_meta_tags: String, } #[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)] @@ -873,7 +873,6 @@ pub struct RedirectionFormData { pub enum PaymentAction { PSync, CompleteAuthorize, - PaymentAuthenticateCompleteAuthorize, } #[derive(Debug, Eq, PartialEq, Serialize)] @@ -943,27 +942,23 @@ pub enum AuthFlow { Merchant, } -#[allow(clippy::too_many_arguments)] -#[instrument( - skip(request, payload, state, func, api_auth, request_state), - fields(merchant_id) -)] -pub async fn server_wrap_util<'a, 'b, U, T, Q, F, Fut, E, OErr>( +#[instrument(skip(request, payload, state, func, api_auth), fields(merchant_id))] +pub async fn server_wrap_util<'a, 'b, A, U, T, Q, F, Fut, E, OErr>( flow: &'a impl router_env::types::FlowMetric, - state: web::Data, - mut request_state: ReqState, + state: web::Data, request: &'a HttpRequest, payload: T, func: F, - api_auth: &dyn AuthenticateAndFetch, + api_auth: &dyn AuthenticateAndFetch, lock_action: api_locking::LockAction, ) -> CustomResult, OErr> where - F: Fn(AppState, U, T, ReqState) -> Fut, + F: Fn(A, U, T) -> Fut, 'b: 'a, Fut: Future, E>>, Q: Serialize + Debug + 'a + ApiEventMetric, T: Debug + Serialize + ApiEventMetric, + A: AppStateInfo + Clone, E: ErrorSwitch + error_stack::Context, OErr: ResponseError + error_stack::Context + Serialize, errors::ApiErrorResponse: ErrorSwitch, @@ -973,15 +968,9 @@ where .attach_printable("Unable to extract request id from request") .change_context(errors::ApiErrorResponse::InternalServerError.switch())?; - request_state.event_context.record_info(request_id); - request_state - .event_context - .record_info(("flow".to_string(), flow.to_string())); - // request_state.event_context.record_info(request.clone()); - - let mut app_state = state.get_ref().clone(); + let mut request_state = state.get_ref().clone(); - app_state.add_request_id(request_id); + request_state.add_request_id(request_id); let start_instant = Instant::now(); let serialized_request = masking::masked_serialize(&payload) .attach_printable("Failed to serialize json request") @@ -991,34 +980,32 @@ where // Currently auth failures are not recorded as API events let (auth_out, auth_type) = api_auth - .authenticate_and_fetch(request.headers(), &app_state) + .authenticate_and_fetch(request.headers(), &request_state) .await .switch()?; - request_state.event_context.record_info(auth_type.clone()); - let merchant_id = auth_type .get_merchant_id() .unwrap_or("MERCHANT_ID_NOT_FOUND") .to_string(); - app_state.add_merchant_id(Some(merchant_id.clone())); + request_state.add_merchant_id(Some(merchant_id.clone())); - app_state.add_flow_name(flow.to_string()); + request_state.add_flow_name(flow.to_string()); tracing::Span::current().record("merchant_id", &merchant_id); let output = { lock_action .clone() - .perform_locking_action(&app_state, merchant_id.to_owned()) + .perform_locking_action(&request_state, merchant_id.to_owned()) .await .switch()?; - let res = func(app_state.clone(), auth_out, payload, request_state) + let res = func(request_state.clone(), auth_out, payload) .await .switch(); lock_action - .free_lock_action(&app_state, merchant_id.to_owned()) + .free_lock_action(&request_state, merchant_id.to_owned()) .await .switch()?; res @@ -1094,24 +1081,24 @@ where skip(request, state, func, api_auth, payload), fields(request_method, request_url_path, status_code) )] -pub async fn server_wrap<'a, T, U, Q, F, Fut, E>( +pub async fn server_wrap<'a, A, T, U, Q, F, Fut, E>( flow: impl router_env::types::FlowMetric, - state: web::Data, + state: web::Data, request: &'a HttpRequest, payload: T, func: F, - api_auth: &dyn AuthenticateAndFetch, + api_auth: &dyn AuthenticateAndFetch, lock_action: api_locking::LockAction, ) -> HttpResponse where - F: Fn(AppState, U, T, ReqState) -> Fut, + F: Fn(A, U, T) -> Fut, Fut: Future, E>>, Q: Serialize + Debug + ApiEventMetric + 'a, T: Debug + Serialize + ApiEventMetric, + A: AppStateInfo + Clone, ApplicationResponse: Debug, E: ErrorSwitch + error_stack::Context, { - let req_state = state.get_req_state(); let request_method = request.method().as_str(); let url_path = request.path(); @@ -1148,7 +1135,6 @@ where server_wrap_util( &flow, state.clone(), - req_state, request, payload, func, @@ -1991,13 +1977,6 @@ pub fn build_payment_link_html( let _ = tera.add_raw_template("payment_link", &html_template); - context.insert("rendered_meta_tag_html", &payment_link_data.html_meta_tags); - - context.insert( - "preload_link_tags", - &get_preload_link_html_template(&payment_link_data.sdk_url), - ); - context.insert( "preload_link_tags", &get_preload_link_html_template(&payment_link_data.sdk_url), diff --git a/crates/router/src/services/api/client.rs b/crates/router/src/services/api/client.rs index 43a36ca321d..5aef1da268e 100644 --- a/crates/router/src/services/api/client.rs +++ b/crates/router/src/services/api/client.rs @@ -82,8 +82,8 @@ fn get_base_client( pub(super) fn create_client( proxy_config: &Proxy, should_bypass_proxy: bool, - client_certificate: Option>, - client_certificate_key: Option>, + client_certificate: Option, + client_certificate_key: Option, ) -> CustomResult { match (client_certificate, client_certificate_key) { (Some(encoded_certificate), Some(encoded_certificate_key)) => { @@ -153,8 +153,8 @@ where &self, method: Method, url: String, - certificate: Option>, - certificate_key: Option>, + certificate: Option, + certificate_key: Option, ) -> CustomResult, ApiClientError>; async fn send_request( @@ -222,8 +222,8 @@ impl ProxyClient { pub fn get_reqwest_client( &self, base_url: String, - client_certificate: Option>, - client_certificate_key: Option>, + client_certificate: Option, + client_certificate_key: Option, ) -> CustomResult { match (client_certificate, client_certificate_key) { (Some(certificate), Some(certificate_key)) => { @@ -324,8 +324,8 @@ impl ApiClient for ProxyClient { &self, method: Method, url: String, - certificate: Option>, - certificate_key: Option>, + certificate: Option, + certificate_key: Option, ) -> CustomResult, ApiClientError> { let client_builder = self .get_reqwest_client(url.clone(), certificate, certificate_key) @@ -379,8 +379,8 @@ impl ApiClient for MockApiClient { &self, _method: Method, _url: String, - _certificate: Option>, - _certificate_key: Option>, + _certificate: Option, + _certificate_key: Option, ) -> CustomResult, ApiClientError> { // [#2066]: Add Mock implementation for ApiClient Err(ApiClientError::UnexpectedState.into()) diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs index 5f15474115d..d2247150d3c 100644 --- a/crates/router/src/services/authentication.rs +++ b/crates/router/src/services/authentication.rs @@ -1,15 +1,10 @@ use actix_web::http::header::HeaderMap; -use api_models::{ - payment_methods::{PaymentMethodCreate, PaymentMethodListRequest}, - payments, -}; +use api_models::{payment_methods::PaymentMethodListRequest, payments}; use async_trait::async_trait; -use common_enums::TokenPurpose; use common_utils::date_time; use error_stack::{report, ResultExt}; use jsonwebtoken::{decode, Algorithm, DecodingKey, Validation}; use masking::PeekInterface; -use router_env::logger; use serde::Serialize; use self::blacklist::BlackList; @@ -38,6 +33,7 @@ use crate::{ utils::OptionExt, }; pub mod blacklist; +#[cfg(feature = "olap")] pub mod cookies; #[derive(Clone, Debug)] @@ -65,10 +61,6 @@ pub enum AuthenticationType { UserJwt { user_id: String, }, - SinglePurposeJWT { - user_id: String, - purpose: TokenPurpose, - }, MerchantId { merchant_id: String, }, @@ -81,17 +73,6 @@ pub enum AuthenticationType { NoAuth, } -impl events::EventInfo for AuthenticationType { - type Data = Self; - fn data(&self) -> error_stack::Result { - Ok(self.clone()) - } - - fn key(&self) -> String { - "auth_info".to_string() - } -} - impl AuthenticationType { pub fn get_merchant_id(&self) -> Option<&str> { match self { @@ -106,47 +87,28 @@ impl AuthenticationType { user_id: _, } | Self::WebhookAuth { merchant_id } => Some(merchant_id.as_ref()), - Self::AdminApiKey - | Self::UserJwt { .. } - | Self::SinglePurposeJWT { .. } - | Self::NoAuth => None, + Self::AdminApiKey | Self::UserJwt { .. } | Self::NoAuth => None, } } } -#[cfg(feature = "olap")] #[derive(Clone, Debug)] -pub struct UserFromSinglePurposeToken { +pub struct UserWithoutMerchantFromToken { pub user_id: String, - pub origin: domain::Origin, } -#[cfg(feature = "olap")] #[derive(serde::Serialize, serde::Deserialize)] -pub struct SinglePurposeToken { +pub struct UserAuthToken { pub user_id: String, - pub purpose: TokenPurpose, - pub origin: domain::Origin, pub exp: u64, } #[cfg(feature = "olap")] -impl SinglePurposeToken { - pub async fn new_token( - user_id: String, - purpose: TokenPurpose, - origin: domain::Origin, - settings: &Settings, - ) -> UserResult { - let exp_duration = - std::time::Duration::from_secs(consts::SINGLE_PURPOSE_TOKEN_TIME_IN_SECS); +impl UserAuthToken { + pub async fn new_token(user_id: String, settings: &Settings) -> UserResult { + let exp_duration = std::time::Duration::from_secs(consts::JWT_TOKEN_TIME_IN_SECS); let exp = jwt::generate_exp(exp_duration)?.as_secs(); - let token_payload = Self { - user_id, - purpose, - origin, - exp, - }; + let token_payload = Self { user_id, exp }; jwt::generate_jwt(&token_payload, settings).await } } @@ -310,13 +272,12 @@ where } } -#[cfg(feature = "olap")] #[derive(Debug)] -pub(crate) struct SinglePurposeJWTAuth(pub TokenPurpose); +pub struct UserWithoutMerchantJWTAuth; #[cfg(feature = "olap")] #[async_trait] -impl AuthenticateAndFetch for SinglePurposeJWTAuth +impl AuthenticateAndFetch for UserWithoutMerchantJWTAuth where A: AppStateInfo + Sync, { @@ -324,24 +285,18 @@ where &self, request_headers: &HeaderMap, state: &A, - ) -> RouterResult<(UserFromSinglePurposeToken, AuthenticationType)> { - let payload = parse_jwt_payload::(request_headers, state).await?; + ) -> RouterResult<(UserWithoutMerchantFromToken, AuthenticationType)> { + let payload = parse_jwt_payload::(request_headers, state).await?; if payload.check_in_blacklist(state).await? { return Err(errors::ApiErrorResponse::InvalidJwtToken.into()); } - if self.0 != payload.purpose { - return Err(errors::ApiErrorResponse::InvalidJwtToken.into()); - } - Ok(( - UserFromSinglePurposeToken { + UserWithoutMerchantFromToken { user_id: payload.user_id.clone(), - origin: payload.origin.clone(), }, - AuthenticationType::SinglePurposeJWT { + AuthenticationType::UserJwt { user_id: payload.user_id, - purpose: payload.purpose, }, )) } @@ -642,17 +597,10 @@ where T: serde::de::DeserializeOwned, A: AppStateInfo + Sync, { - let token = match get_cookie_from_header(headers).and_then(cookies::parse_cookie) { - Ok(cookies) => cookies, - Err(e) => { - let token = get_jwt_from_authorization_header(headers); - if token.is_err() { - logger::error!(?e); - } - token?.to_owned() - } - }; - decode_jwt(&token, state).await + let token = get_jwt_from_authorization_header(headers)?; + let payload = decode_jwt(token, state).await?; + + Ok(payload) } #[async_trait] @@ -864,12 +812,6 @@ impl ClientSecretFetch for PaymentMethodListRequest { } } -impl ClientSecretFetch for PaymentMethodCreate { - fn get_client_secret(&self) -> Option<&String> { - self.client_secret.as_ref() - } -} - impl ClientSecretFetch for api_models::cards_info::CardsInfoRequest { fn get_client_secret(&self) -> Option<&String> { self.client_secret.as_ref() @@ -900,12 +842,6 @@ impl ClientSecretFetch for api_models::pm_auth::ExchangeTokenCreateRequest { } } -impl ClientSecretFetch for api_models::payment_methods::PaymentMethodUpdate { - fn get_client_secret(&self) -> Option<&String> { - self.client_secret.as_ref() - } -} - pub fn get_auth_type_and_flow( headers: &HeaderMap, ) -> RouterResult<( @@ -978,9 +914,6 @@ pub async fn is_ephemeral_auth( pub fn is_jwt_auth(headers: &HeaderMap) -> bool { headers.get(crate::headers::AUTHORIZATION).is_some() - || get_cookie_from_header(headers) - .and_then(cookies::parse_cookie) - .is_ok() } pub async fn decode_jwt(token: &str, state: &impl AppStateInfo) -> RouterResult @@ -1026,13 +959,6 @@ pub fn get_jwt_from_authorization_header(headers: &HeaderMap) -> RouterResult<&s .ok_or(errors::ApiErrorResponse::InvalidJwtToken.into()) } -pub fn get_cookie_from_header(headers: &HeaderMap) -> RouterResult<&str> { - headers - .get(cookies::get_cookie_header()) - .and_then(|header_value| header_value.to_str().ok()) - .ok_or(errors::ApiErrorResponse::InvalidCookie.into()) -} - pub fn strip_jwt_token(token: &str) -> RouterResult<&str> { token .strip_prefix("Bearer ") diff --git a/crates/router/src/services/authentication/blacklist.rs b/crates/router/src/services/authentication/blacklist.rs index c1abb064752..7c1cbf27e10 100644 --- a/crates/router/src/services/authentication/blacklist.rs +++ b/crates/router/src/services/authentication/blacklist.rs @@ -5,9 +5,7 @@ use common_utils::date_time; use error_stack::ResultExt; use redis_interface::RedisConnectionPool; -use super::AuthToken; -#[cfg(feature = "olap")] -use super::SinglePurposeToken; +use super::{AuthToken, UserAuthToken}; #[cfg(feature = "email")] use crate::consts::{EMAIL_TOKEN_BLACKLIST_PREFIX, EMAIL_TOKEN_TIME_IN_SECS}; use crate::{ @@ -156,9 +154,8 @@ impl BlackList for AuthToken { } } -#[cfg(feature = "olap")] #[async_trait::async_trait] -impl BlackList for SinglePurposeToken { +impl BlackList for UserAuthToken { async fn check_in_blacklist(&self, state: &A) -> RouterResult where A: AppStateInfo + Sync, diff --git a/crates/router/src/services/authentication/cookies.rs b/crates/router/src/services/authentication/cookies.rs index 96518840800..d7fc4c10315 100644 --- a/crates/router/src/services/authentication/cookies.rs +++ b/crates/router/src/services/authentication/cookies.rs @@ -1,27 +1,15 @@ -use cookie::Cookie; -#[cfg(feature = "olap")] use cookie::{ time::{Duration, OffsetDateTime}, - SameSite, + Cookie, SameSite, }; -use error_stack::{report, ResultExt}; -#[cfg(feature = "olap")] -use masking::Mask; -#[cfg(feature = "olap")] -use masking::{ExposeInterface, Secret}; +use masking::{ExposeInterface, Mask, Secret}; use crate::{ - consts::JWT_TOKEN_COOKIE_NAME, - core::errors::{ApiErrorResponse, RouterResult}, -}; -#[cfg(feature = "olap")] -use crate::{ - consts::JWT_TOKEN_TIME_IN_SECS, + consts::{JWT_TOKEN_COOKIE_NAME, JWT_TOKEN_TIME_IN_SECS}, core::errors::{UserErrors, UserResponse}, services::ApplicationResponse, }; -#[cfg(feature = "olap")] pub fn set_cookie_response(response: R, token: Secret) -> UserResponse { let jwt_expiry_in_seconds = JWT_TOKEN_TIME_IN_SECS .try_into() @@ -31,17 +19,16 @@ pub fn set_cookie_response(response: R, token: Secret) -> UserRespons let header_value = create_cookie(token, expiry, max_age) .to_string() .into_masked(); - let header_key = get_set_cookie_header(); + let header_key = get_cookie_header(); let header = vec![(header_key, header_value)]; Ok(ApplicationResponse::JsonWithHeaders((response, header))) } -#[cfg(feature = "olap")] pub fn remove_cookie_response() -> UserResponse<()> { let (expiry, max_age) = get_expiry_and_max_age_from_seconds(0); - let header_key = get_set_cookie_header(); + let header_key = get_cookie_header(); let header_value = create_cookie("".to_string().into(), expiry, max_age) .to_string() .into_masked(); @@ -49,19 +36,6 @@ pub fn remove_cookie_response() -> UserResponse<()> { Ok(ApplicationResponse::JsonWithHeaders(((), header))) } -pub fn parse_cookie(cookies: &str) -> RouterResult { - Cookie::split_parse(cookies) - .find_map(|cookie| { - cookie - .ok() - .filter(|parsed_cookie| parsed_cookie.name() == JWT_TOKEN_COOKIE_NAME) - .map(|parsed_cookie| parsed_cookie.value().to_owned()) - }) - .ok_or(report!(ApiErrorResponse::InvalidCookie)) - .attach_printable("Cookie Parsing Failed") -} - -#[cfg(feature = "olap")] fn create_cookie<'c>( token: Secret, expires: OffsetDateTime, @@ -77,18 +51,12 @@ fn create_cookie<'c>( .build() } -#[cfg(feature = "olap")] fn get_expiry_and_max_age_from_seconds(seconds: i64) -> (OffsetDateTime, Duration) { let max_age = Duration::seconds(seconds); let expiry = OffsetDateTime::now_utc().saturating_add(max_age); (expiry, max_age) } -#[cfg(feature = "olap")] -fn get_set_cookie_header() -> String { +fn get_cookie_header() -> String { actix_http::header::SET_COOKIE.to_string() } - -pub fn get_cookie_header() -> String { - actix_http::header::COOKIE.to_string() -} diff --git a/crates/router/src/services/authorization/permission_groups.rs b/crates/router/src/services/authorization/permission_groups.rs index f3275a78fd0..b68bef213cd 100644 --- a/crates/router/src/services/authorization/permission_groups.rs +++ b/crates/router/src/services/authorization/permission_groups.rs @@ -75,13 +75,12 @@ pub static USERS_MANAGE: [Permission; 2] = pub static MERCHANT_DETAILS_VIEW: [Permission; 1] = [Permission::MerchantAccountRead]; -pub static MERCHANT_DETAILS_MANAGE: [Permission; 6] = [ +pub static MERCHANT_DETAILS_MANAGE: [Permission; 5] = [ Permission::MerchantAccountWrite, Permission::ApiKeyRead, Permission::ApiKeyWrite, Permission::MerchantAccountRead, Permission::WebhookEventRead, - Permission::WebhookEventWrite, ]; pub static ORGANIZATION_MANAGE: [Permission; 2] = [ diff --git a/crates/router/src/services/authorization/permissions.rs b/crates/router/src/services/authorization/permissions.rs index 583b22fe86c..997eff8274e 100644 --- a/crates/router/src/services/authorization/permissions.rs +++ b/crates/router/src/services/authorization/permissions.rs @@ -31,7 +31,6 @@ pub enum Permission { UsersWrite, MerchantAccountCreate, WebhookEventRead, - WebhookEventWrite, PayoutRead, PayoutWrite, } @@ -72,7 +71,6 @@ impl Permission { Self::UsersWrite => "Invite users, assign and update roles", Self::MerchantAccountCreate => "Create merchant account", Self::WebhookEventRead => "View webhook events", - Self::WebhookEventWrite => "Trigger retries for webhook events", Self::PayoutRead => "View all payouts", Self::PayoutWrite => "Create payout, download payout data", } diff --git a/crates/router/src/services/email/types.rs b/crates/router/src/services/email/types.rs index 323f98a56df..2fbe7d606e5 100644 --- a/crates/router/src/services/email/types.rs +++ b/crates/router/src/services/email/types.rs @@ -1,8 +1,5 @@ use api_models::user::dashboard_metadata::ProdIntent; -use common_utils::{ - errors::{self, CustomResult}, - pii, -}; +use common_utils::errors::CustomResult; use error_stack::ResultExt; use external_services::email::{EmailContents, EmailData, EmailError}; use masking::{ExposeInterface, PeekInterface, Secret}; @@ -170,8 +167,8 @@ impl EmailToken { jwt::generate_jwt(&token_payload, settings).await } - pub fn get_email(&self) -> CustomResult { - pii::Email::try_from(self.email.clone()) + pub fn get_email(&self) -> &str { + self.email.as_str() } pub fn get_merchant_id(&self) -> Option<&str> { diff --git a/crates/router/src/services/kafka.rs b/crates/router/src/services/kafka.rs index ba9806b29d1..373c268f85b 100644 --- a/crates/router/src/services/kafka.rs +++ b/crates/router/src/services/kafka.rs @@ -1,33 +1,27 @@ use std::sync::Arc; -use bigdecimal::ToPrimitive; use common_utils::errors::CustomResult; use error_stack::{report, ResultExt}; -use events::{EventsError, Message, MessagingInterface}; use rdkafka::{ config::FromClientConfig, producer::{BaseRecord, DefaultProducerContext, Producer, ThreadedProducer}, }; -#[cfg(feature = "payouts")] -pub mod payout; + use crate::events::EventType; mod dispute; mod payment_attempt; mod payment_intent; mod refund; +use data_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent}; use diesel_models::refund::Refund; -use hyperswitch_domain_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent}; use serde::Serialize; -use time::{OffsetDateTime, PrimitiveDateTime}; +use time::OffsetDateTime; -#[cfg(feature = "payouts")] -use self::payout::KafkaPayout; use self::{ dispute::KafkaDispute, payment_attempt::KafkaPaymentAttempt, payment_intent::KafkaPaymentIntent, refund::KafkaRefund, }; use crate::types::storage::Dispute; - // Using message queue result here to avoid confusion with Kafka result provided by library pub type MQResult = CustomResult; @@ -97,8 +91,6 @@ pub struct KafkaSettings { outgoing_webhook_logs_topic: String, dispute_analytics_topic: String, audit_events_topic: String, - #[cfg(feature = "payouts")] - payout_analytics_topic: String, } impl KafkaSettings { @@ -164,13 +156,6 @@ impl KafkaSettings { )) })?; - #[cfg(feature = "payouts")] - common_utils::fp_utils::when(self.payout_analytics_topic.is_default_or_empty(), || { - Err(ApplicationError::InvalidConfigurationValueError( - "Kafka Payout Analytics topic must not be empty".into(), - )) - })?; - Ok(()) } } @@ -186,8 +171,6 @@ pub struct KafkaProducer { outgoing_webhook_logs_topic: String, dispute_analytics_topic: String, audit_events_topic: String, - #[cfg(feature = "payouts")] - payout_analytics_topic: String, } struct RdKafkaProducer(ThreadedProducer); @@ -227,8 +210,6 @@ impl KafkaProducer { outgoing_webhook_logs_topic: conf.outgoing_webhook_logs_topic.clone(), dispute_analytics_topic: conf.dispute_analytics_topic.clone(), audit_events_topic: conf.audit_events_topic.clone(), - #[cfg(feature = "payouts")] - payout_analytics_topic: conf.payout_analytics_topic.clone(), }) } @@ -243,8 +224,6 @@ impl KafkaProducer { EventType::OutgoingWebhookLogs => &self.outgoing_webhook_logs_topic, EventType::Dispute => &self.dispute_analytics_topic, EventType::AuditEvent => &self.audit_events_topic, - #[cfg(feature = "payouts")] - EventType::Payout => &self.payout_analytics_topic, }; self.producer .0 @@ -361,30 +340,6 @@ impl KafkaProducer { .attach_printable_lazy(|| format!("Failed to add positive dispute event {dispute:?}")) } - #[cfg(feature = "payouts")] - pub async fn log_payout( - &self, - payout: &KafkaPayout<'_>, - old_payout: Option>, - ) -> MQResult<()> { - if let Some(negative_event) = old_payout { - self.log_event(&KafkaEvent::old(&negative_event)) - .attach_printable_lazy(|| { - format!("Failed to add negative payout event {negative_event:?}") - })?; - }; - self.log_event(&KafkaEvent::new(payout)) - .attach_printable_lazy(|| format!("Failed to add positive payout event {payout:?}")) - } - - #[cfg(feature = "payouts")] - pub async fn log_payout_delete(&self, delete_old_payout: &KafkaPayout<'_>) -> MQResult<()> { - self.log_event(&KafkaEvent::old(delete_old_payout)) - .attach_printable_lazy(|| { - format!("Failed to add negative payout event {delete_old_payout:?}") - }) - } - pub fn get_topic(&self, event: EventType) -> &str { match event { EventType::ApiLogs => &self.api_logs_topic, @@ -395,8 +350,6 @@ impl KafkaProducer { EventType::OutgoingWebhookLogs => &self.outgoing_webhook_logs_topic, EventType::Dispute => &self.dispute_analytics_topic, EventType::AuditEvent => &self.audit_events_topic, - #[cfg(feature = "payouts")] - EventType::Payout => &self.payout_analytics_topic, } } } @@ -412,41 +365,3 @@ impl Drop for RdKafkaProducer { } } } - -impl MessagingInterface for KafkaProducer { - type MessageClass = EventType; - - fn send_message( - &self, - data: T, - timestamp: PrimitiveDateTime, - ) -> error_stack::Result<(), EventsError> - where - T: Message + masking::ErasedMaskSerialize, - { - let topic = self.get_topic(data.get_message_class()); - let json_data = data - .masked_serialize() - .and_then(|i| serde_json::to_vec(&i)) - .change_context(EventsError::SerializationError)?; - self.producer - .0 - .send( - BaseRecord::to(topic) - .key(&data.identifier()) - .payload(&json_data) - .timestamp( - (timestamp.assume_utc().unix_timestamp_nanos() / 1_000) - .to_i64() - .unwrap_or_else(|| { - // kafka producer accepts milliseconds - // try converting nanos to millis if that fails convert seconds to millis - timestamp.assume_utc().unix_timestamp() * 1_000 - }), - ), - ) - .map_err(|(error, record)| report!(error).attach_printable(format!("{record:?}"))) - .change_context(KafkaError::GenericError) - .change_context(EventsError::PublishError) - } -} diff --git a/crates/router/src/services/kafka/payment_attempt.rs b/crates/router/src/services/kafka/payment_attempt.rs index 9f442876fab..787a633b0c5 100644 --- a/crates/router/src/services/kafka/payment_attempt.rs +++ b/crates/router/src/services/kafka/payment_attempt.rs @@ -1,8 +1,6 @@ // use diesel_models::enums::MandateDetails; +use data_models::{mandates::MandateDetails, payments::payment_attempt::PaymentAttempt}; use diesel_models::enums as storage_enums; -use hyperswitch_domain_models::{ - mandates::MandateDetails, payments::payment_attempt::PaymentAttempt, -}; use time::OffsetDateTime; #[derive(serde::Serialize, Debug)] diff --git a/crates/router/src/services/kafka/payment_intent.rs b/crates/router/src/services/kafka/payment_intent.rs index 2edd0d49ccc..6a756c664d4 100644 --- a/crates/router/src/services/kafka/payment_intent.rs +++ b/crates/router/src/services/kafka/payment_intent.rs @@ -1,5 +1,5 @@ +use data_models::payments::PaymentIntent; use diesel_models::enums as storage_enums; -use hyperswitch_domain_models::payments::PaymentIntent; use time::OffsetDateTime; #[derive(serde::Serialize, Debug)] diff --git a/crates/router/src/services/kafka/payout.rs b/crates/router/src/services/kafka/payout.rs deleted file mode 100644 index 6b25c724eb8..00000000000 --- a/crates/router/src/services/kafka/payout.rs +++ /dev/null @@ -1,90 +0,0 @@ -use common_utils::pii; -use diesel_models::enums as storage_enums; -use hyperswitch_domain_models::payouts::{payout_attempt::PayoutAttempt, payouts::Payouts}; -use time::OffsetDateTime; - -#[derive(serde::Serialize, Debug)] -pub struct KafkaPayout<'a> { - pub payout_id: &'a String, - pub payout_attempt_id: &'a String, - pub merchant_id: &'a String, - pub customer_id: &'a String, - pub address_id: &'a String, - pub profile_id: &'a String, - pub payout_method_id: Option<&'a String>, - pub payout_type: storage_enums::PayoutType, - pub amount: i64, - pub destination_currency: storage_enums::Currency, - pub source_currency: storage_enums::Currency, - pub description: Option<&'a String>, - pub recurring: bool, - pub auto_fulfill: bool, - pub return_url: Option<&'a String>, - pub entity_type: storage_enums::PayoutEntityType, - pub metadata: Option, - #[serde(with = "time::serde::timestamp")] - pub created_at: OffsetDateTime, - #[serde(with = "time::serde::timestamp")] - pub last_modified_at: OffsetDateTime, - pub attempt_count: i16, - pub status: storage_enums::PayoutStatus, - - pub connector: Option<&'a String>, - pub connector_payout_id: &'a String, - pub is_eligible: Option, - pub error_message: Option<&'a String>, - pub error_code: Option<&'a String>, - pub business_country: Option, - pub business_label: Option<&'a String>, - pub merchant_connector_id: Option<&'a String>, -} - -impl<'a> KafkaPayout<'a> { - pub fn from_storage(payouts: &'a Payouts, payout_attempt: &'a PayoutAttempt) -> Self { - Self { - payout_id: &payouts.payout_id, - payout_attempt_id: &payout_attempt.payout_attempt_id, - merchant_id: &payouts.merchant_id, - customer_id: &payouts.customer_id, - address_id: &payouts.address_id, - profile_id: &payouts.profile_id, - payout_method_id: payouts.payout_method_id.as_ref(), - payout_type: payouts.payout_type, - amount: payouts.amount, - destination_currency: payouts.destination_currency, - source_currency: payouts.source_currency, - description: payouts.description.as_ref(), - recurring: payouts.recurring, - auto_fulfill: payouts.auto_fulfill, - return_url: payouts.return_url.as_ref(), - entity_type: payouts.entity_type, - metadata: payouts.metadata.clone(), - created_at: payouts.created_at.assume_utc(), - last_modified_at: payouts.last_modified_at.assume_utc(), - attempt_count: payouts.attempt_count, - status: payouts.status, - connector: payout_attempt.connector.as_ref(), - connector_payout_id: &payout_attempt.connector_payout_id, - is_eligible: payout_attempt.is_eligible, - error_message: payout_attempt.error_message.as_ref(), - error_code: payout_attempt.error_code.as_ref(), - business_country: payout_attempt.business_country, - business_label: payout_attempt.business_label.as_ref(), - merchant_connector_id: payout_attempt.merchant_connector_id.as_ref(), - } - } -} - -impl<'a> super::KafkaMessage for KafkaPayout<'a> { - fn key(&self) -> String { - format!("{}_{}", self.merchant_id, self.payout_attempt_id) - } - - fn creation_timestamp(&self) -> Option { - Some(self.last_modified_at.unix_timestamp()) - } - - fn event_type(&self) -> crate::events::EventType { - crate::events::EventType::Payout - } -} diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs index 37491615be9..76cdee669f8 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -24,26 +24,23 @@ pub use api_models::{enums::PayoutConnectors, payouts as payout_types}; use common_enums::MandateStatus; pub use common_utils::request::RequestContent; use common_utils::{pii, pii::Email}; +use data_models::mandates::{CustomerAcceptance, MandateData}; use error_stack::ResultExt; -use hyperswitch_domain_models::mandates::{CustomerAcceptance, MandateData}; use masking::Secret; use serde::Serialize; -use self::storage::enums as storage_enums; +use self::{api::payments, storage::enums as storage_enums}; pub use crate::core::payments::{payment_address::PaymentAddress, CustomerDetails}; #[cfg(feature = "payouts")] +use crate::core::utils::IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_DISPUTE_FLOW; use crate::{ - connector::utils::missing_field_err, - core::utils::IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_PAYOUTS_FLOW, -}; -use crate::{ - consts, core::{ - errors::{self}, + errors::{self, RouterResult}, payments::{types, PaymentData, RecurringMandatePaymentData}, }, services, types::{transformers::ForeignFrom, types::AuthenticationData}, + utils::OptionExt, }; pub type PaymentsAuthorizeRouterData = RouterData; @@ -193,9 +190,6 @@ pub type PayoutFulfillType = pub type PayoutRecipientType = dyn services::ConnectorIntegration; #[cfg(feature = "payouts")] -pub type PayoutRecipientAccountType = - dyn services::ConnectorIntegration; -#[cfg(feature = "payouts")] pub type PayoutQuoteType = dyn services::ConnectorIntegration; @@ -303,6 +297,9 @@ pub struct RouterData { /// Contains flow-specific data that the connector responds with. pub response: Result, + /// Contains any error response that the connector returns. + pub payment_method_id: Option, + /// Contains a reference ID that should be sent in the connector request pub connector_request_reference_id: String, @@ -311,7 +308,7 @@ pub struct RouterData { pub payout_method_data: Option, #[cfg(feature = "payouts")] - /// Contains payout's quote ID + /// Contains payout method data pub quote_id: Option, pub test_mode: Option, @@ -397,23 +394,6 @@ pub struct PayoutsData { pub payout_type: storage_enums::PayoutType, pub entity_type: storage_enums::PayoutEntityType, pub customer_details: Option, - pub vendor_details: Option, -} - -#[cfg(feature = "payouts")] -pub trait PayoutIndividualDetailsExt { - type Error; - fn get_external_account_account_holder_type(&self) -> Result; -} - -#[cfg(feature = "payouts")] -impl PayoutIndividualDetailsExt for api_models::payouts::PayoutIndividualDetails { - type Error = error_stack::Report; - fn get_external_account_account_holder_type(&self) -> Result { - self.external_account_account_holder_type - .clone() - .ok_or_else(missing_field_err("external_account_account_holder_type")) - } } #[cfg(feature = "payouts")] @@ -422,12 +402,17 @@ pub struct PayoutsResponseData { pub status: Option, pub connector_payout_id: String, pub payout_eligible: Option, - pub should_add_next_step_to_process_tracker: bool, +} + +#[derive(Clone, Debug, Default)] +pub struct PayoutsFulfillResponseData { + pub status: Option, + pub reference_id: Option, } #[derive(Debug, Clone)] pub struct PaymentsAuthorizeData { - pub payment_method_data: domain::payments::PaymentMethodData, + pub payment_method_data: payments::PaymentMethodData, /// total amount (original_amount + surcharge_amount + tax_on_surcharge_amount) /// If connector supports separate field for surcharge amount, consider using below functions defined on `PaymentsAuthorizeData` to fetch original amount and surcharge amount separately /// ``` @@ -512,12 +497,12 @@ pub struct ConnectorCustomerData { pub phone: Option>, pub name: Option>, pub preprocessing_id: Option, - pub payment_method_data: domain::PaymentMethodData, + pub payment_method_data: payments::PaymentMethodData, } #[derive(Debug, Clone)] pub struct PaymentMethodTokenizationData { - pub payment_method_data: domain::payments::PaymentMethodData, + pub payment_method_data: payments::PaymentMethodData, pub browser_info: Option, pub currency: storage_enums::Currency, pub amount: Option, @@ -525,7 +510,7 @@ pub struct PaymentMethodTokenizationData { #[derive(Debug, Clone)] pub struct PaymentsPreProcessingData { - pub payment_method_data: Option, + pub payment_method_data: Option, pub amount: Option, pub email: Option, pub currency: Option, @@ -544,7 +529,7 @@ pub struct PaymentsPreProcessingData { #[derive(Debug, Clone)] pub struct CompleteAuthorizeData { - pub payment_method_data: Option, + pub payment_method_data: Option, pub amount: i64, pub email: Option, pub currency: storage_enums::Currency, @@ -580,7 +565,6 @@ pub struct PaymentsSyncData { pub sync_type: SyncRequestType, pub mandate_id: Option, pub payment_method_type: Option, - pub currency: storage_enums::Currency, } #[derive(Debug, Default, Clone)] @@ -626,7 +610,7 @@ pub struct PaymentsSessionData { #[derive(Debug, Clone)] pub struct SetupMandateRequestData { pub currency: storage_enums::Currency, - pub payment_method_data: domain::PaymentMethodData, + pub payment_method_data: payments::PaymentMethodData, pub amount: Option, pub confirm: bool, pub statement_descriptor_suffix: Option, @@ -1163,40 +1147,6 @@ pub struct RetrieveFileResponse { pub file_data: Vec, } -#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] -pub struct PollConfig { - pub delay_in_secs: i8, - pub frequency: i8, -} - -impl PollConfig { - pub fn get_poll_config_key(connector: String) -> String { - format!("poll_config_external_three_ds_{connector}") - } -} - -impl Default for PollConfig { - fn default() -> Self { - Self { - delay_in_secs: consts::DEFAULT_POLL_DELAY_IN_SECS, - frequency: consts::DEFAULT_POLL_FREQUENCY, - } - } -} - -#[derive(Clone, Debug)] -pub struct RedirectPaymentFlowResponse { - pub payments_response: api_models::payments::PaymentsResponse, - pub business_profile: diesel_models::business_profile::BusinessProfile, -} - -#[derive(Clone, Debug)] -pub struct AuthenticatePaymentFlowResponse { - pub payments_response: api_models::payments::PaymentsResponse, - pub poll_config: PollConfig, - pub business_profile: diesel_models::business_profile::BusinessProfile, -} - #[derive(Debug, Clone, Default, serde::Deserialize, serde::Serialize)] pub struct ConnectorResponse { pub merchant_id: String, @@ -1251,10 +1201,6 @@ pub enum ConnectorAuthType { CurrencyAuthKey { auth_key_map: HashMap, }, - CertificateAuth { - certificate: Secret, - private_key: Secret, - }, #[default] NoKey, } @@ -1293,13 +1239,6 @@ impl From for ConnectorAuthType { Self::CurrencyAuthKey { auth_key_map } } api_models::admin::ConnectorAuthType::NoKey => Self::NoKey, - api_models::admin::ConnectorAuthType::CertificateAuth { - certificate, - private_key, - } => Self::CertificateAuth { - certificate, - private_key, - }, } } } @@ -1334,13 +1273,6 @@ impl ForeignFrom for api_models::admin::ConnectorAuthType { Self::CurrencyAuthKey { auth_key_map } } ConnectorAuthType::NoKey => Self::NoKey, - ConnectorAuthType::CertificateAuth { - certificate, - private_key, - } => Self::CertificateAuth { - certificate, - private_key, - }, } } } @@ -1461,20 +1393,32 @@ impl From<&RouterData> } pub trait Tokenizable { + fn get_pm_data(&self) -> RouterResult; fn set_session_token(&mut self, token: Option); } impl Tokenizable for SetupMandateRequestData { + fn get_pm_data(&self) -> RouterResult { + Ok(self.payment_method_data.clone()) + } fn set_session_token(&mut self, _token: Option) {} } impl Tokenizable for PaymentsAuthorizeData { + fn get_pm_data(&self) -> RouterResult { + Ok(self.payment_method_data.clone()) + } fn set_session_token(&mut self, token: Option) { self.session_token = token; } } impl Tokenizable for CompleteAuthorizeData { + fn get_pm_data(&self) -> RouterResult { + self.payment_method_data + .clone() + .get_required_value("payment_method_data") + } fn set_session_token(&mut self, _token: Option) {} } @@ -1538,6 +1482,7 @@ impl From<(&RouterData, T2)> amount_captured: data.amount_captured, access_token: data.access_token.clone(), response: data.response.clone(), + payment_method_id: data.payment_method_id.clone(), payment_id: data.payment_id.clone(), session_token: data.session_token.clone(), reference_id: data.reference_id.clone(), @@ -1598,6 +1543,7 @@ impl amount_captured: data.amount_captured, access_token: data.access_token.clone(), response: data.response.clone(), + payment_method_id: data.payment_method_id.clone(), payment_id: data.payment_id.clone(), session_token: data.session_token.clone(), reference_id: data.reference_id.clone(), @@ -1607,7 +1553,7 @@ impl preprocessing_id: None, connector_customer: data.connector_customer.clone(), connector_request_reference_id: - IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_PAYOUTS_FLOW.to_string(), + IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_DISPUTE_FLOW.to_string(), payout_method_data: data.payout_method_data.clone(), quote_id: data.quote_id.clone(), test_mode: data.test_mode, diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs index 57f51c7b8b0..4b72c7ac2e6 100644 --- a/crates/router/src/types/api.rs +++ b/crates/router/src/types/api.rs @@ -17,7 +17,6 @@ pub mod payment_methods; pub mod payments; #[cfg(feature = "payouts")] pub mod payouts; -pub mod poll; pub mod refunds; pub mod routing; #[cfg(feature = "olap")] @@ -36,7 +35,7 @@ pub use self::fraud_check::*; pub use self::payouts::*; pub use self::{ admin::*, api_keys::*, authentication::*, configs::*, customers::*, disputes::*, files::*, - payment_link::*, payment_methods::*, payments::*, poll::*, refunds::*, webhooks::*, + payment_link::*, payment_methods::*, payments::*, refunds::*, webhooks::*, }; use super::ErrorResponse; use crate::{ @@ -93,7 +92,7 @@ pub trait ConnectorMandateRevoke: pub trait ConnectorTransactionId: ConnectorCommon + Sync { fn connector_transaction_id( &self, - payment_attempt: hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt, + payment_attempt: data_models::payments::payment_attempt::PaymentAttempt, ) -> Result, errors::ApiErrorResponse> { Ok(payment_attempt.connector_transaction_id) } @@ -327,7 +326,7 @@ impl ConnectorData { enums::Connector::Authorizedotnet => Ok(Box::new(&connector::Authorizedotnet)), enums::Connector::Bambora => Ok(Box::new(&connector::Bambora)), enums::Connector::Bankofamerica => Ok(Box::new(&connector::Bankofamerica)), - enums::Connector::Billwerk => Ok(Box::new(&connector::Billwerk)), + // enums::Connector::Billwerk => Ok(Box::new(&connector::Billwerk)), Added as template code for future usage enums::Connector::Bitpay => Ok(Box::new(&connector::Bitpay)), enums::Connector::Bluesnap => Ok(Box::new(&connector::Bluesnap)), enums::Connector::Boku => Ok(Box::new(&connector::Boku)), @@ -352,7 +351,6 @@ impl ConnectorData { enums::Connector::DummyConnector6 => Ok(Box::new(&connector::DummyConnector::<6>)), #[cfg(feature = "dummy_connector")] enums::Connector::DummyConnector7 => Ok(Box::new(&connector::DummyConnector::<7>)), - enums::Connector::Ebanx => Ok(Box::new(&connector::Ebanx)), enums::Connector::Fiserv => Ok(Box::new(&connector::Fiserv)), enums::Connector::Forte => Ok(Box::new(&connector::Forte)), enums::Connector::Globalpay => Ok(Box::new(&connector::Globalpay)), @@ -381,14 +379,12 @@ impl ConnectorData { enums::Connector::Worldline => Ok(Box::new(&connector::Worldline)), enums::Connector::Worldpay => Ok(Box::new(&connector::Worldpay)), enums::Connector::Multisafepay => Ok(Box::new(&connector::Multisafepay)), - enums::Connector::Netcetera => Ok(Box::new(&connector::Netcetera)), enums::Connector::Nexinets => Ok(Box::new(&connector::Nexinets)), enums::Connector::Paypal => Ok(Box::new(&connector::Paypal)), enums::Connector::Trustpay => Ok(Box::new(&connector::Trustpay)), enums::Connector::Tsys => Ok(Box::new(&connector::Tsys)), enums::Connector::Volt => Ok(Box::new(&connector::Volt)), enums::Connector::Zen => Ok(Box::new(&connector::Zen)), - enums::Connector::Zsl => Ok(Box::new(&connector::Zsl)), enums::Connector::Signifyd | enums::Connector::Plaid | enums::Connector::Riskified @@ -428,7 +424,6 @@ pub trait Payouts: + PayoutFulfill + PayoutQuote + PayoutRecipient - + PayoutRecipientAccount { } #[cfg(not(feature = "payouts"))] diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs index 77fe8371817..2cc0e21d64f 100644 --- a/crates/router/src/types/api/admin.rs +++ b/crates/router/src/types/api/admin.rs @@ -175,8 +175,6 @@ impl ForeignTryFrom<(domain::MerchantAccount, BusinessProfileCreate)> .change_context(errors::ApiErrorResponse::InvalidDataValue { field_name: "authentication_connector_details", })?, - is_extended_card_info_enabled: None, - extended_card_info_config: None, }) } } diff --git a/crates/router/src/types/api/authentication.rs b/crates/router/src/types/api/authentication.rs index dddb9c79879..b69533db5a2 100644 --- a/crates/router/src/types/api/authentication.rs +++ b/crates/router/src/types/api/authentication.rs @@ -47,13 +47,6 @@ pub enum MessageCategory { NonPayment, } -#[derive(Clone, serde::Deserialize, Debug, serde::Serialize, PartialEq, Eq)] -pub struct ExternalAuthenticationPayload { - pub trans_status: common_enums::TransactionStatus, - pub authentication_value: Option, - pub eci: Option, -} - pub trait ConnectorAuthentication: services::ConnectorIntegration< Authentication, @@ -114,7 +107,6 @@ impl AuthenticationConnectorData { enums::AuthenticationConnectors::Threedsecureio => { Ok(Box::new(&connector::Threedsecureio)) } - enums::AuthenticationConnectors::Netcetera => Ok(Box::new(&connector::Netcetera)), } } } diff --git a/crates/router/src/types/api/mandates.rs b/crates/router/src/types/api/mandates.rs index 0e80fd224da..10c56973dd3 100644 --- a/crates/router/src/types/api/mandates.rs +++ b/crates/router/src/types/api/mandates.rs @@ -1,6 +1,5 @@ use api_models::mandates; pub use api_models::mandates::{MandateId, MandateResponse, MandateRevokedResponse}; -use common_utils::ext_traits::OptionExt; use error_stack::ResultExt; use masking::PeekInterface; use serde::{Deserialize, Serialize}; @@ -29,7 +28,6 @@ pub(crate) trait MandateResponseExt: Sized { state: &AppState, key_store: domain::MerchantKeyStore, mandate: storage::Mandate, - storage_scheme: storage_enums::MerchantStorageScheme, ) -> RouterResult; } @@ -39,21 +37,14 @@ impl MandateResponseExt for MandateResponse { state: &AppState, key_store: domain::MerchantKeyStore, mandate: storage::Mandate, - storage_scheme: storage_enums::MerchantStorageScheme, ) -> RouterResult { let db = &*state.store; let payment_method = db - .find_payment_method(&mandate.payment_method_id, storage_scheme) + .find_payment_method(&mandate.payment_method_id) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; - let pm = payment_method - .payment_method - .get_required_value("payment_method") - .change_context(errors::ApiErrorResponse::PaymentMethodNotFound) - .attach_printable("payment_method not found")?; - - let card = if pm == storage_enums::PaymentMethod::Card { + let card = if payment_method.payment_method == storage_enums::PaymentMethod::Card { // if locker is disabled , decrypt the payment method data let card_details = if state.conf.locker.locker_enabled { let card = payment_methods::cards::get_card_from_locker( @@ -102,7 +93,7 @@ impl MandateResponseExt for MandateResponse { }), card, status: mandate.mandate_status, - payment_method: pm.to_string(), + payment_method: payment_method.payment_method.to_string(), payment_method_type, payment_method_id: mandate.payment_method_id, }) diff --git a/crates/router/src/types/api/payment_methods.rs b/crates/router/src/types/api/payment_methods.rs index 6bf100e4d67..13c9ec61f2a 100644 --- a/crates/router/src/types/api/payment_methods.rs +++ b/crates/router/src/types/api/payment_methods.rs @@ -2,8 +2,8 @@ pub use api_models::payment_methods::{ CardDetail, CardDetailFromLocker, CardDetailsPaymentMethod, CustomerPaymentMethod, CustomerPaymentMethodsListResponse, DefaultPaymentMethod, DeleteTokenizeByTokenRequest, GetTokenizePayloadRequest, GetTokenizePayloadResponse, ListCountriesCurrenciesRequest, - PaymentMethodCreate, PaymentMethodCreateData, PaymentMethodDeleteResponse, PaymentMethodId, - PaymentMethodList, PaymentMethodListRequest, PaymentMethodListResponse, PaymentMethodResponse, + PaymentMethodCreate, PaymentMethodDeleteResponse, PaymentMethodId, PaymentMethodList, + PaymentMethodListRequest, PaymentMethodListResponse, PaymentMethodResponse, PaymentMethodUpdate, PaymentMethodsData, TokenizePayloadEncrypted, TokenizePayloadRequest, TokenizedCardValue1, TokenizedCardValue2, TokenizedWalletValue1, TokenizedWalletValue2, }; @@ -21,14 +21,15 @@ pub(crate) trait PaymentMethodCreateExt { // convert self.payment_method_type to payment_method and compare it against self.payment_method impl PaymentMethodCreateExt for PaymentMethodCreate { fn validate(&self) -> RouterResult<()> { - if let Some(pm) = self.payment_method { - if let Some(payment_method_type) = self.payment_method_type { - if !validate_payment_method_type_against_payment_method(pm, payment_method_type) { - return Err(report!(errors::ApiErrorResponse::InvalidRequestData { - message: "Invalid 'payment_method_type' provided".to_string() - }) - .attach_printable("Invalid payment method type")); - } + if let Some(payment_method_type) = self.payment_method_type { + if !validate_payment_method_type_against_payment_method( + self.payment_method, + payment_method_type, + ) { + return Err(report!(errors::ApiErrorResponse::InvalidRequestData { + message: "Invalid 'payment_method_type' provided".to_string() + }) + .attach_printable("Invalid payment method type")); } } Ok(()) diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs index e36c68c27d5..370e0ca3509 100644 --- a/crates/router/src/types/api/payments.rs +++ b/crates/router/src/types/api/payments.rs @@ -3,10 +3,10 @@ pub use api_models::payments::{ CryptoData, CustomerAcceptance, HeaderPayload, MandateAmountData, MandateData, MandateTransactionType, MandateType, MandateValidationFields, NextActionType, OnlineMandate, PayLaterData, PaymentIdType, PaymentListConstraints, PaymentListFilterConstraints, - PaymentListFilters, PaymentListFiltersV2, PaymentListResponse, PaymentListResponseV2, - PaymentMethodData, PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp, - PaymentRetrieveBody, PaymentRetrieveBodyWithCredentials, PaymentsApproveRequest, - PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest, + PaymentListFilters, PaymentListResponse, PaymentListResponseV2, PaymentMethodData, + PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp, PaymentRetrieveBody, + PaymentRetrieveBodyWithCredentials, PaymentsApproveRequest, PaymentsCancelRequest, + PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest, PaymentsIncrementalAuthorizationRequest, PaymentsRedirectRequest, PaymentsRedirectionResponse, PaymentsRejectRequest, PaymentsRequest, PaymentsResponse, PaymentsResponseForm, PaymentsRetrieveRequest, PaymentsSessionRequest, PaymentsSessionResponse, PaymentsStartRequest, @@ -261,7 +261,7 @@ mod payments_test { PaymentsRequest { amount: Some(Amount::from(200)), payment_method_data: Some(PaymentMethodDataRequest { - payment_method_data: Some(PaymentMethodData::Card(card())), + payment_method_data: PaymentMethodData::Card(card()), billing: None, }), ..PaymentsRequest::default() diff --git a/crates/router/src/types/api/payouts.rs b/crates/router/src/types/api/payouts.rs index 53f015290df..bed87173b84 100644 --- a/crates/router/src/types/api/payouts.rs +++ b/crates/router/src/types/api/payouts.rs @@ -2,7 +2,7 @@ pub use api_models::payouts::{ AchBankTransfer, BacsBankTransfer, Bank as BankPayout, Card as CardPayout, PayoutActionRequest, PayoutCreateRequest, PayoutCreateResponse, PayoutListConstraints, PayoutListFilterConstraints, PayoutListFilters, PayoutListResponse, PayoutMethodData, PayoutRequest, PayoutRetrieveBody, - PayoutRetrieveRequest, PixBankTransfer, SepaBankTransfer, Wallet as WalletPayout, + PayoutRetrieveRequest, SepaBankTransfer, Wallet as WalletPayout, }; use crate::{services::api, types}; @@ -25,9 +25,6 @@ pub struct PoQuote; #[derive(Debug, Clone)] pub struct PoRecipient; -#[derive(Debug, Clone)] -pub struct PoRecipientAccount; - pub trait PayoutCancel: api::ConnectorIntegration { @@ -57,8 +54,3 @@ pub trait PayoutRecipient: api::ConnectorIntegration { } - -pub trait PayoutRecipientAccount: - api::ConnectorIntegration -{ -} diff --git a/crates/router/src/types/api/poll.rs b/crates/router/src/types/api/poll.rs deleted file mode 100644 index 2722b72f673..00000000000 --- a/crates/router/src/types/api/poll.rs +++ /dev/null @@ -1,6 +0,0 @@ -use serde; - -#[derive(Default, Debug, serde::Deserialize, serde::Serialize)] -pub struct PollId { - pub poll_id: String, -} diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs index 39891a7075d..85bb9bf72af 100644 --- a/crates/router/src/types/api/verify_connector.rs +++ b/crates/router/src/types/api/verify_connector.rs @@ -8,7 +8,7 @@ use crate::{ core::errors, services, services::ConnectorIntegration, - types::{self, api, domain, storage::enums as storage_enums}, + types::{self, api, storage::enums as storage_enums}, AppState, }; @@ -16,13 +16,13 @@ use crate::{ pub struct VerifyConnectorData { pub connector: &'static (dyn types::api::Connector + Sync), pub connector_auth: types::ConnectorAuthType, - pub card_details: domain::Card, + pub card_details: api::Card, } impl VerifyConnectorData { fn get_payment_authorize_data(&self) -> types::PaymentsAuthorizeData { types::PaymentsAuthorizeData { - payment_method_data: domain::PaymentMethodData::Card(self.card_details.clone()), + payment_method_data: api::PaymentMethodData::Card(self.card_details.clone()), email: None, customer_name: None, amount: 1000, @@ -81,6 +81,7 @@ impl VerifyConnectorData { payment_method: storage_enums::PaymentMethod::Card, amount_captured: None, preprocessing_id: None, + payment_method_id: None, connector_customer: None, connector_auth_type: self.connector_auth.clone(), connector_meta_data: None, diff --git a/crates/router/src/types/api/webhook_events.rs b/crates/router/src/types/api/webhook_events.rs index 950f6dc6a04..4c702b70385 100644 --- a/crates/router/src/types/api/webhook_events.rs +++ b/crates/router/src/types/api/webhook_events.rs @@ -2,5 +2,4 @@ pub use api_models::webhook_events::{ EventListConstraints, EventListConstraintsInternal, EventListItemResponse, EventListRequestInternal, EventRetrieveResponse, OutgoingWebhookRequestContent, OutgoingWebhookResponseContent, WebhookDeliveryAttemptListRequestInternal, - WebhookDeliveryRetryRequestInternal, }; diff --git a/crates/router/src/types/api/webhooks.rs b/crates/router/src/types/api/webhooks.rs index b6972c19b0e..88219d301b3 100644 --- a/crates/router/src/types/api/webhooks.rs +++ b/crates/router/src/types/api/webhooks.rs @@ -1,7 +1,7 @@ use api_models::admin::MerchantConnectorWebhookDetails; pub use api_models::webhooks::{ - AuthenticationIdType, IncomingWebhookDetails, IncomingWebhookEvent, MerchantWebhookConfig, - ObjectReferenceId, OutgoingWebhook, OutgoingWebhookContent, WebhookFlow, + IncomingWebhookDetails, IncomingWebhookEvent, MerchantWebhookConfig, ObjectReferenceId, + OutgoingWebhook, OutgoingWebhookContent, WebhookFlow, }; use common_utils::ext_traits::ValueExt; use error_stack::ResultExt; @@ -270,14 +270,4 @@ pub trait IncomingWebhook: ConnectorCommon + Sync { ) -> CustomResult { Err(errors::ConnectorError::NotImplemented("get_dispute_details method".to_string()).into()) } - - fn get_external_authentication_details( - &self, - _request: &IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Err(errors::ConnectorError::NotImplemented( - "get_external_authentication_details method".to_string(), - ) - .into()) - } } diff --git a/crates/router/src/types/authentication.rs b/crates/router/src/types/authentication.rs index 7ea937b9ffd..4cd1f3faebc 100644 --- a/crates/router/src/types/authentication.rs +++ b/crates/router/src/types/authentication.rs @@ -1,10 +1,11 @@ +use api_models::payments; use cards::CardNumber; use common_utils::pii::Email; use serde::{Deserialize, Serialize}; use super::{ api::{self, authentication}, - domain, BrowserInformation, RouterData, + BrowserInformation, RouterData, }; use crate::services; @@ -14,7 +15,7 @@ pub enum AuthenticationResponseData { threeds_server_transaction_id: String, maximum_supported_3ds_version: common_utils::types::SemanticVersion, connector_authentication_id: String, - three_ds_method_data: Option, + three_ds_method_data: String, three_ds_method_url: Option, message_version: common_utils::types::SemanticVersion, connector_metadata: Option, @@ -100,7 +101,7 @@ pub struct PreAuthNRequestData { #[derive(Clone, Debug)] pub struct ConnectorAuthenticationRequestData { - pub payment_method_data: domain::PaymentMethodData, + pub payment_method_data: payments::PaymentMethodData, pub billing_address: api_models::payments::Address, pub shipping_address: Option, pub browser_details: Option, @@ -114,7 +115,6 @@ pub struct ConnectorAuthenticationRequestData { pub email: Option, pub threeds_method_comp_ind: api_models::payments::ThreeDsCompletionIndicator, pub three_ds_requestor_url: String, - pub webhook_url: String, } #[derive(Clone, Debug)] diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs index e5f6b8c9660..3b6633defcf 100644 --- a/crates/router/src/types/domain.rs +++ b/crates/router/src/types/domain.rs @@ -5,7 +5,6 @@ mod event; mod merchant_account; mod merchant_connector_account; mod merchant_key_store; -pub mod payments; pub mod types; #[cfg(feature = "olap")] pub mod user; @@ -16,6 +15,5 @@ pub use event::*; pub use merchant_account::*; pub use merchant_connector_account::*; pub use merchant_key_store::*; -pub use payments::*; #[cfg(feature = "olap")] pub use user::*; diff --git a/crates/router/src/types/domain/payments.rs b/crates/router/src/types/domain/payments.rs deleted file mode 100644 index fe34f2092b9..00000000000 --- a/crates/router/src/types/domain/payments.rs +++ /dev/null @@ -1,1076 +0,0 @@ -use common_utils::pii::{self, Email}; -use masking::Secret; -use serde::{Deserialize, Serialize}; - -// We need to derive Serialize and Deserialize because some parts of payment method data are being -// stored in the database as serde_json::Value -#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)] -pub enum PaymentMethodData { - Card(Card), - CardRedirect(CardRedirectData), - Wallet(WalletData), - PayLater(PayLaterData), - BankRedirect(BankRedirectData), - BankDebit(BankDebitData), - BankTransfer(Box), - Crypto(CryptoData), - MandatePayment, - Reward, - Upi(UpiData), - Voucher(VoucherData), - GiftCard(Box), - CardToken(CardToken), -} - -impl PaymentMethodData { - pub fn get_payment_method(&self) -> Option { - match self { - Self::Card(_) => Some(common_enums::PaymentMethod::Card), - Self::CardRedirect(_) => Some(common_enums::PaymentMethod::CardRedirect), - Self::Wallet(_) => Some(common_enums::PaymentMethod::Wallet), - Self::PayLater(_) => Some(common_enums::PaymentMethod::PayLater), - Self::BankRedirect(_) => Some(common_enums::PaymentMethod::BankRedirect), - Self::BankDebit(_) => Some(common_enums::PaymentMethod::BankDebit), - Self::BankTransfer(_) => Some(common_enums::PaymentMethod::BankTransfer), - Self::Crypto(_) => Some(common_enums::PaymentMethod::Crypto), - Self::Reward => Some(common_enums::PaymentMethod::Reward), - Self::Upi(_) => Some(common_enums::PaymentMethod::Upi), - Self::Voucher(_) => Some(common_enums::PaymentMethod::Voucher), - Self::GiftCard(_) => Some(common_enums::PaymentMethod::GiftCard), - Self::CardToken(_) | Self::MandatePayment => None, - } - } -} - -#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)] -pub struct Card { - pub card_number: cards::CardNumber, - pub card_exp_month: Secret, - pub card_exp_year: Secret, - pub card_cvc: Secret, - pub card_issuer: Option, - pub card_network: Option, - pub card_type: Option, - pub card_issuing_country: Option, - pub bank_code: Option, - pub nick_name: Option>, -} - -#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)] -pub enum CardRedirectData { - Knet {}, - Benefit {}, - MomoAtm {}, - CardRedirect {}, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub enum PayLaterData { - KlarnaRedirect { - billing_email: Email, - billing_country: common_enums::CountryAlpha2, - }, - KlarnaSdk { - token: String, - }, - AffirmRedirect {}, - AfterpayClearpayRedirect { - billing_email: Email, - billing_name: Secret, - }, - PayBrightRedirect {}, - WalleyRedirect {}, - AlmaRedirect {}, - AtomeRedirect {}, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] - -pub enum WalletData { - AliPayQr(Box), - AliPayRedirect(AliPayRedirection), - AliPayHkRedirect(AliPayHkRedirection), - MomoRedirect(MomoRedirection), - KakaoPayRedirect(KakaoPayRedirection), - GoPayRedirect(GoPayRedirection), - GcashRedirect(GcashRedirection), - ApplePay(ApplePayWalletData), - ApplePayRedirect(Box), - ApplePayThirdPartySdk(Box), - DanaRedirect {}, - GooglePay(GooglePayWalletData), - GooglePayRedirect(Box), - GooglePayThirdPartySdk(Box), - MbWayRedirect(Box), - MobilePayRedirect(Box), - PaypalRedirect(PaypalRedirection), - PaypalSdk(PayPalWalletData), - SamsungPay(Box), - TwintRedirect {}, - VippsRedirect {}, - TouchNGoRedirect(Box), - WeChatPayRedirect(Box), - WeChatPayQr(Box), - CashappQr(Box), - SwishQr(SwishQrData), -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] - -pub struct SamsungPayWalletData { - /// The encrypted payment token from Samsung - pub token: Secret, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] - -pub struct GooglePayWalletData { - /// The type of payment method - pub pm_type: String, - /// User-facing message to describe the payment method that funds this transaction. - pub description: String, - /// The information of the payment method - pub info: GooglePayPaymentMethodInfo, - /// The tokenization data of Google pay - pub tokenization_data: GpayTokenizationData, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct ApplePayRedirectData {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct GooglePayRedirectData {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct GooglePayThirdPartySdkData {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct ApplePayThirdPartySdkData {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct WeChatPayRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct WeChatPay {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct WeChatPayQr {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct CashappQr {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct PaypalRedirection { - /// paypal's email address - pub email: Option, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct AliPayQr {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct AliPayRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct AliPayHkRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct MomoRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct KakaoPayRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct GoPayRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct GcashRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct MobilePayRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct MbWayRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] - -pub struct GooglePayPaymentMethodInfo { - /// The name of the card network - pub card_network: String, - /// The details of the card - pub card_details: String, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct PayPalWalletData { - /// Token generated for the Apple pay - pub token: String, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct TouchNGoRedirection {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct SwishQrData {} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct GpayTokenizationData { - /// The type of the token - pub token_type: String, - /// Token generated for the wallet - pub token: String, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct ApplePayWalletData { - /// The payment data of Apple pay - pub payment_data: String, - /// The payment method of Apple pay - pub payment_method: ApplepayPaymentMethod, - /// The unique identifier for the transaction - pub transaction_identifier: String, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -pub struct ApplepayPaymentMethod { - pub display_name: String, - pub network: String, - pub pm_type: String, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] - -pub enum BankRedirectData { - BancontactCard { - card_number: Option, - card_exp_month: Option>, - card_exp_year: Option>, - card_holder_name: Option>, - billing_details: Option, - }, - Bizum {}, - Blik { - blik_code: Option, - }, - Eps { - billing_details: Option, - bank_name: Option, - country: Option, - }, - Giropay { - billing_details: Option, - bank_account_bic: Option>, - bank_account_iban: Option>, - country: Option, - }, - Ideal { - billing_details: Option, - bank_name: Option, - country: Option, - }, - Interac { - country: common_enums::CountryAlpha2, - email: Email, - }, - OnlineBankingCzechRepublic { - issuer: common_enums::BankNames, - }, - OnlineBankingFinland { - email: Option, - }, - OnlineBankingPoland { - issuer: common_enums::BankNames, - }, - OnlineBankingSlovakia { - issuer: common_enums::BankNames, - }, - OpenBankingUk { - issuer: Option, - country: Option, - }, - Przelewy24 { - bank_name: Option, - billing_details: BankRedirectBilling, - }, - Sofort { - billing_details: Option, - country: Option, - preferred_language: Option, - }, - Trustly { - country: common_enums::CountryAlpha2, - }, - OnlineBankingFpx { - issuer: common_enums::BankNames, - }, - OnlineBankingThailand { - issuer: common_enums::BankNames, - }, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] -pub struct BankRedirectBilling { - pub billing_name: Option>, - pub email: Option, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] -#[serde(rename_all = "snake_case")] -pub struct CryptoData { - pub pay_currency: Option, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] -#[serde(rename_all = "snake_case")] -pub struct UpiData { - pub vpa_id: Option>, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum VoucherData { - Boleto(Box), - Efecty, - PagoEfectivo, - RedCompra, - RedPagos, - Alfamart(Box), - Indomaret(Box), - Oxxo, - SevenEleven(Box), - Lawson(Box), - MiniStop(Box), - FamilyMart(Box), - Seicomart(Box), - PayEasy(Box), -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -pub struct BoletoVoucherData { - /// The shopper's social security number - pub social_security_number: Option>, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -pub struct AlfamartVoucherData {} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -pub struct IndomaretVoucherData {} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -pub struct JCSVoucherData {} - -#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, Eq, PartialEq)] -#[serde(rename_all = "snake_case")] -pub enum GiftCardData { - Givex(GiftCardDetails), - PaySafeCard {}, -} - -#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, Eq, PartialEq)] -#[serde(rename_all = "snake_case")] -pub struct GiftCardDetails { - /// The gift card number - pub number: Secret, - /// The card verification code. - pub cvc: Secret, -} - -#[derive(Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone, Default)] -#[serde(rename_all = "snake_case")] -pub struct CardToken { - /// The card holder's name - pub card_holder_name: Option>, - - /// The CVC number for the card - pub card_cvc: Option>, -} - -#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, Eq, PartialEq)] -#[serde(rename_all = "snake_case")] -pub enum BankDebitData { - AchBankDebit { - billing_details: BankDebitBilling, - account_number: Secret, - routing_number: Secret, - card_holder_name: Option>, - bank_account_holder_name: Option>, - bank_name: Option, - bank_type: Option, - bank_holder_type: Option, - }, - SepaBankDebit { - billing_details: BankDebitBilling, - iban: Secret, - bank_account_holder_name: Option>, - }, - BecsBankDebit { - billing_details: BankDebitBilling, - account_number: Secret, - bsb_number: Secret, - bank_account_holder_name: Option>, - }, - BacsBankDebit { - billing_details: BankDebitBilling, - account_number: Secret, - sort_code: Secret, - bank_account_holder_name: Option>, - }, -} - -#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, Eq, PartialEq)] -pub struct BankDebitBilling { - pub name: Secret, - pub email: Email, - pub address: Option, -} - -#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] -#[serde(rename_all = "snake_case")] -pub enum BankTransferData { - AchBankTransfer { - /// The billing details for ACH Bank Transfer - billing_details: AchBillingDetails, - }, - SepaBankTransfer { - /// The billing details for SEPA - billing_details: SepaAndBacsBillingDetails, - - /// The two-letter ISO country code for SEPA and BACS - country: api_models::enums::CountryAlpha2, - }, - BacsBankTransfer { - /// The billing details for SEPA - billing_details: SepaAndBacsBillingDetails, - }, - MultibancoBankTransfer { - /// The billing details for Multibanco - billing_details: MultibancoBillingDetails, - }, - PermataBankTransfer { - /// The billing details for Permata Bank Transfer - billing_details: DokuBillingDetails, - }, - BcaBankTransfer { - /// The billing details for BCA Bank Transfer - billing_details: DokuBillingDetails, - }, - BniVaBankTransfer { - /// The billing details for BniVa Bank Transfer - billing_details: DokuBillingDetails, - }, - BriVaBankTransfer { - /// The billing details for BniVa Bank Transfer - billing_details: DokuBillingDetails, - }, - CimbVaBankTransfer { - /// The billing details for BniVa Bank Transfer - billing_details: DokuBillingDetails, - }, - DanamonVaBankTransfer { - /// The billing details for BniVa Bank Transfer - billing_details: DokuBillingDetails, - }, - MandiriVaBankTransfer { - /// The billing details for BniVa Bank Transfer - billing_details: DokuBillingDetails, - }, - Pix {}, - Pse {}, - LocalBankTransfer { - bank_code: Option, - }, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] -pub struct AchBillingDetails { - /// The Email ID for ACH billing - pub email: Email, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] -pub struct DokuBillingDetails { - /// The billing first name for Doku - pub first_name: Secret, - /// The billing second name for Doku - pub last_name: Option>, - /// The Email ID for Doku billing - pub email: Email, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] -pub struct MultibancoBillingDetails { - pub email: Email, -} - -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] -pub struct SepaAndBacsBillingDetails { - /// The Email ID for SEPA and BACS billing - pub email: Email, - /// The billing name for SEPA and BACS billing - pub name: Secret, -} - -impl From for PaymentMethodData { - fn from(api_model_payment_method_data: api_models::payments::PaymentMethodData) -> Self { - match api_model_payment_method_data { - api_models::payments::PaymentMethodData::Card(card_data) => { - Self::Card(Card::from(card_data)) - } - api_models::payments::PaymentMethodData::CardRedirect(card_redirect) => { - Self::CardRedirect(From::from(card_redirect)) - } - api_models::payments::PaymentMethodData::Wallet(wallet_data) => { - Self::Wallet(From::from(wallet_data)) - } - api_models::payments::PaymentMethodData::PayLater(pay_later_data) => { - Self::PayLater(From::from(pay_later_data)) - } - api_models::payments::PaymentMethodData::BankRedirect(bank_redirect_data) => { - Self::BankRedirect(From::from(bank_redirect_data)) - } - api_models::payments::PaymentMethodData::BankDebit(bank_debit_data) => { - Self::BankDebit(From::from(bank_debit_data)) - } - api_models::payments::PaymentMethodData::BankTransfer(bank_transfer_data) => { - Self::BankTransfer(Box::new(From::from(*bank_transfer_data))) - } - api_models::payments::PaymentMethodData::Crypto(crypto_data) => { - Self::Crypto(From::from(crypto_data)) - } - api_models::payments::PaymentMethodData::MandatePayment => Self::MandatePayment, - api_models::payments::PaymentMethodData::Reward => Self::Reward, - api_models::payments::PaymentMethodData::Upi(upi_data) => { - Self::Upi(From::from(upi_data)) - } - api_models::payments::PaymentMethodData::Voucher(voucher_data) => { - Self::Voucher(From::from(voucher_data)) - } - api_models::payments::PaymentMethodData::GiftCard(gift_card) => { - Self::GiftCard(Box::new(From::from(*gift_card))) - } - api_models::payments::PaymentMethodData::CardToken(card_token) => { - Self::CardToken(From::from(card_token)) - } - } - } -} - -impl From for Card { - fn from(value: api_models::payments::Card) -> Self { - let api_models::payments::Card { - card_number, - card_exp_month, - card_exp_year, - card_holder_name: _, - card_cvc, - card_issuer, - card_network, - card_type, - card_issuing_country, - bank_code, - nick_name, - } = value; - - Self { - card_number, - card_exp_month, - card_exp_year, - card_cvc, - card_issuer, - card_network, - card_type, - card_issuing_country, - bank_code, - nick_name, - } - } -} - -impl From for CardRedirectData { - fn from(value: api_models::payments::CardRedirectData) -> Self { - match value { - api_models::payments::CardRedirectData::Knet {} => Self::Knet {}, - api_models::payments::CardRedirectData::Benefit {} => Self::Benefit {}, - api_models::payments::CardRedirectData::MomoAtm {} => Self::MomoAtm {}, - api_models::payments::CardRedirectData::CardRedirect {} => Self::CardRedirect {}, - } - } -} - -impl From for WalletData { - fn from(value: api_models::payments::WalletData) -> Self { - match value { - api_models::payments::WalletData::AliPayQr(_) => Self::AliPayQr(Box::new(AliPayQr {})), - api_models::payments::WalletData::AliPayRedirect(_) => { - Self::AliPayRedirect(AliPayRedirection {}) - } - api_models::payments::WalletData::AliPayHkRedirect(_) => { - Self::AliPayHkRedirect(AliPayHkRedirection {}) - } - api_models::payments::WalletData::MomoRedirect(_) => { - Self::MomoRedirect(MomoRedirection {}) - } - api_models::payments::WalletData::KakaoPayRedirect(_) => { - Self::KakaoPayRedirect(KakaoPayRedirection {}) - } - api_models::payments::WalletData::GoPayRedirect(_) => { - Self::GoPayRedirect(GoPayRedirection {}) - } - api_models::payments::WalletData::GcashRedirect(_) => { - Self::GcashRedirect(GcashRedirection {}) - } - api_models::payments::WalletData::ApplePay(apple_pay_data) => { - Self::ApplePay(ApplePayWalletData::from(apple_pay_data)) - } - api_models::payments::WalletData::ApplePayRedirect(_) => { - Self::ApplePayRedirect(Box::new(ApplePayRedirectData {})) - } - api_models::payments::WalletData::ApplePayThirdPartySdk(_) => { - Self::ApplePayThirdPartySdk(Box::new(ApplePayThirdPartySdkData {})) - } - api_models::payments::WalletData::DanaRedirect {} => Self::DanaRedirect {}, - api_models::payments::WalletData::GooglePay(google_pay_data) => { - Self::GooglePay(GooglePayWalletData::from(google_pay_data)) - } - api_models::payments::WalletData::GooglePayRedirect(_) => { - Self::GooglePayRedirect(Box::new(GooglePayRedirectData {})) - } - api_models::payments::WalletData::GooglePayThirdPartySdk(_) => { - Self::GooglePayThirdPartySdk(Box::new(GooglePayThirdPartySdkData {})) - } - api_models::payments::WalletData::MbWayRedirect(..) => { - Self::MbWayRedirect(Box::new(MbWayRedirection {})) - } - api_models::payments::WalletData::MobilePayRedirect(_) => { - Self::MobilePayRedirect(Box::new(MobilePayRedirection {})) - } - api_models::payments::WalletData::PaypalRedirect(paypal_redirect_data) => { - Self::PaypalRedirect(PaypalRedirection { - email: paypal_redirect_data.email, - }) - } - api_models::payments::WalletData::PaypalSdk(paypal_sdk_data) => { - Self::PaypalSdk(PayPalWalletData { - token: paypal_sdk_data.token, - }) - } - api_models::payments::WalletData::SamsungPay(samsung_pay_data) => { - Self::SamsungPay(Box::new(SamsungPayWalletData { - token: samsung_pay_data.token, - })) - } - api_models::payments::WalletData::TwintRedirect {} => Self::TwintRedirect {}, - api_models::payments::WalletData::VippsRedirect {} => Self::VippsRedirect {}, - api_models::payments::WalletData::TouchNGoRedirect(_) => { - Self::TouchNGoRedirect(Box::new(TouchNGoRedirection {})) - } - api_models::payments::WalletData::WeChatPayRedirect(_) => { - Self::WeChatPayRedirect(Box::new(WeChatPayRedirection {})) - } - api_models::payments::WalletData::WeChatPayQr(_) => { - Self::WeChatPayQr(Box::new(WeChatPayQr {})) - } - api_models::payments::WalletData::CashappQr(_) => { - Self::CashappQr(Box::new(CashappQr {})) - } - api_models::payments::WalletData::SwishQr(_) => Self::SwishQr(SwishQrData {}), - } - } -} - -impl From for GooglePayWalletData { - fn from(value: api_models::payments::GooglePayWalletData) -> Self { - Self { - pm_type: value.pm_type, - description: value.description, - info: GooglePayPaymentMethodInfo { - card_network: value.info.card_network, - card_details: value.info.card_details, - }, - tokenization_data: GpayTokenizationData { - token_type: value.tokenization_data.token_type, - token: value.tokenization_data.token, - }, - } - } -} - -impl From for ApplePayWalletData { - fn from(value: api_models::payments::ApplePayWalletData) -> Self { - Self { - payment_data: value.payment_data, - payment_method: ApplepayPaymentMethod { - display_name: value.payment_method.display_name, - network: value.payment_method.network, - pm_type: value.payment_method.pm_type, - }, - transaction_identifier: value.transaction_identifier, - } - } -} - -impl From for PayLaterData { - fn from(value: api_models::payments::PayLaterData) -> Self { - match value { - api_models::payments::PayLaterData::KlarnaRedirect { - billing_email, - billing_country, - } => Self::KlarnaRedirect { - billing_email, - billing_country, - }, - api_models::payments::PayLaterData::KlarnaSdk { token } => Self::KlarnaSdk { token }, - api_models::payments::PayLaterData::AffirmRedirect {} => Self::AffirmRedirect {}, - api_models::payments::PayLaterData::AfterpayClearpayRedirect { - billing_email, - billing_name, - } => Self::AfterpayClearpayRedirect { - billing_email, - billing_name, - }, - api_models::payments::PayLaterData::PayBrightRedirect {} => Self::PayBrightRedirect {}, - api_models::payments::PayLaterData::WalleyRedirect {} => Self::WalleyRedirect {}, - api_models::payments::PayLaterData::AlmaRedirect {} => Self::AlmaRedirect {}, - api_models::payments::PayLaterData::AtomeRedirect {} => Self::AtomeRedirect {}, - } - } -} - -impl From for BankRedirectData { - fn from(value: api_models::payments::BankRedirectData) -> Self { - match value { - api_models::payments::BankRedirectData::BancontactCard { - card_number, - card_exp_month, - card_exp_year, - card_holder_name, - billing_details, - } => Self::BancontactCard { - card_number, - card_exp_month, - card_exp_year, - card_holder_name, - billing_details: billing_details.map(BankRedirectBilling::from), - }, - api_models::payments::BankRedirectData::Bizum {} => Self::Bizum {}, - api_models::payments::BankRedirectData::Blik { blik_code } => Self::Blik { blik_code }, - api_models::payments::BankRedirectData::Eps { - billing_details, - bank_name, - country, - } => Self::Eps { - billing_details: billing_details.map(BankRedirectBilling::from), - bank_name, - country, - }, - api_models::payments::BankRedirectData::Giropay { - billing_details, - bank_account_bic, - bank_account_iban, - country, - } => Self::Giropay { - billing_details: billing_details.map(BankRedirectBilling::from), - bank_account_bic, - bank_account_iban, - country, - }, - api_models::payments::BankRedirectData::Ideal { - billing_details, - bank_name, - country, - } => Self::Ideal { - billing_details: billing_details.map(BankRedirectBilling::from), - bank_name, - country, - }, - api_models::payments::BankRedirectData::Interac { country, email } => { - Self::Interac { country, email } - } - api_models::payments::BankRedirectData::OnlineBankingCzechRepublic { issuer } => { - Self::OnlineBankingCzechRepublic { issuer } - } - api_models::payments::BankRedirectData::OnlineBankingFinland { email } => { - Self::OnlineBankingFinland { email } - } - api_models::payments::BankRedirectData::OnlineBankingPoland { issuer } => { - Self::OnlineBankingPoland { issuer } - } - api_models::payments::BankRedirectData::OnlineBankingSlovakia { issuer } => { - Self::OnlineBankingSlovakia { issuer } - } - api_models::payments::BankRedirectData::OpenBankingUk { issuer, country } => { - Self::OpenBankingUk { issuer, country } - } - api_models::payments::BankRedirectData::Przelewy24 { - bank_name, - billing_details, - } => Self::Przelewy24 { - bank_name, - billing_details: BankRedirectBilling { - billing_name: billing_details.billing_name, - email: billing_details.email, - }, - }, - api_models::payments::BankRedirectData::Sofort { - billing_details, - country, - preferred_language, - } => Self::Sofort { - billing_details: billing_details.map(BankRedirectBilling::from), - country, - preferred_language, - }, - api_models::payments::BankRedirectData::Trustly { country } => { - Self::Trustly { country } - } - api_models::payments::BankRedirectData::OnlineBankingFpx { issuer } => { - Self::OnlineBankingFpx { issuer } - } - api_models::payments::BankRedirectData::OnlineBankingThailand { issuer } => { - Self::OnlineBankingThailand { issuer } - } - } - } -} - -impl From for BankRedirectBilling { - fn from(billing: api_models::payments::BankRedirectBilling) -> Self { - Self { - billing_name: billing.billing_name, - email: billing.email, - } - } -} - -impl From for CryptoData { - fn from(value: api_models::payments::CryptoData) -> Self { - let api_models::payments::CryptoData { pay_currency } = value; - Self { pay_currency } - } -} - -impl From for UpiData { - fn from(value: api_models::payments::UpiData) -> Self { - let api_models::payments::UpiData { vpa_id } = value; - Self { vpa_id } - } -} - -impl From for VoucherData { - fn from(value: api_models::payments::VoucherData) -> Self { - match value { - api_models::payments::VoucherData::Boleto(boleto_data) => { - Self::Boleto(Box::new(BoletoVoucherData { - social_security_number: boleto_data.social_security_number, - })) - } - api_models::payments::VoucherData::Alfamart(_) => { - Self::Alfamart(Box::new(AlfamartVoucherData {})) - } - api_models::payments::VoucherData::Indomaret(_) => { - Self::Indomaret(Box::new(IndomaretVoucherData {})) - } - api_models::payments::VoucherData::SevenEleven(_) - | api_models::payments::VoucherData::Lawson(_) - | api_models::payments::VoucherData::MiniStop(_) - | api_models::payments::VoucherData::FamilyMart(_) - | api_models::payments::VoucherData::Seicomart(_) - | api_models::payments::VoucherData::PayEasy(_) => { - Self::SevenEleven(Box::new(JCSVoucherData {})) - } - api_models::payments::VoucherData::Efecty => Self::Efecty, - api_models::payments::VoucherData::PagoEfectivo => Self::PagoEfectivo, - api_models::payments::VoucherData::RedCompra => Self::RedCompra, - api_models::payments::VoucherData::RedPagos => Self::RedPagos, - api_models::payments::VoucherData::Oxxo => Self::Oxxo, - } - } -} - -impl From for GiftCardData { - fn from(value: api_models::payments::GiftCardData) -> Self { - match value { - api_models::payments::GiftCardData::Givex(details) => Self::Givex(GiftCardDetails { - number: details.number, - cvc: details.cvc, - }), - api_models::payments::GiftCardData::PaySafeCard {} => Self::PaySafeCard {}, - } - } -} - -impl From for CardToken { - fn from(value: api_models::payments::CardToken) -> Self { - let api_models::payments::CardToken { - card_holder_name, - card_cvc, - } = value; - Self { - card_holder_name, - card_cvc, - } - } -} - -impl From for BankDebitData { - fn from(value: api_models::payments::BankDebitData) -> Self { - match value { - api_models::payments::BankDebitData::AchBankDebit { - billing_details, - account_number, - routing_number, - card_holder_name, - bank_account_holder_name, - bank_name, - bank_type, - bank_holder_type, - } => Self::AchBankDebit { - billing_details: BankDebitBilling { - name: billing_details.name, - email: billing_details.email, - address: billing_details.address, - }, - account_number, - routing_number, - card_holder_name, - bank_account_holder_name, - bank_name, - bank_type, - bank_holder_type, - }, - api_models::payments::BankDebitData::SepaBankDebit { - billing_details, - iban, - bank_account_holder_name, - } => Self::SepaBankDebit { - billing_details: BankDebitBilling { - name: billing_details.name, - email: billing_details.email, - address: billing_details.address, - }, - iban, - bank_account_holder_name, - }, - api_models::payments::BankDebitData::BecsBankDebit { - billing_details, - account_number, - bsb_number, - bank_account_holder_name, - } => Self::BecsBankDebit { - billing_details: BankDebitBilling { - name: billing_details.name, - email: billing_details.email, - address: billing_details.address, - }, - account_number, - bsb_number, - bank_account_holder_name, - }, - api_models::payments::BankDebitData::BacsBankDebit { - billing_details, - account_number, - sort_code, - bank_account_holder_name, - } => Self::BacsBankDebit { - billing_details: BankDebitBilling { - name: billing_details.name, - email: billing_details.email, - address: billing_details.address, - }, - account_number, - sort_code, - bank_account_holder_name, - }, - } - } -} - -impl From for BankTransferData { - fn from(value: api_models::payments::BankTransferData) -> Self { - match value { - api_models::payments::BankTransferData::AchBankTransfer { billing_details } => { - Self::AchBankTransfer { - billing_details: AchBillingDetails { - email: billing_details.email, - }, - } - } - api_models::payments::BankTransferData::SepaBankTransfer { - billing_details, - country, - } => Self::SepaBankTransfer { - billing_details: SepaAndBacsBillingDetails { - email: billing_details.email, - name: billing_details.name, - }, - country, - }, - api_models::payments::BankTransferData::BacsBankTransfer { billing_details } => { - Self::BacsBankTransfer { - billing_details: SepaAndBacsBillingDetails { - email: billing_details.email, - name: billing_details.name, - }, - } - } - api_models::payments::BankTransferData::MultibancoBankTransfer { billing_details } => { - Self::MultibancoBankTransfer { - billing_details: MultibancoBillingDetails { - email: billing_details.email, - }, - } - } - api_models::payments::BankTransferData::PermataBankTransfer { billing_details } => { - Self::PermataBankTransfer { - billing_details: DokuBillingDetails::from(billing_details), - } - } - api_models::payments::BankTransferData::BcaBankTransfer { billing_details } => { - Self::BcaBankTransfer { - billing_details: DokuBillingDetails::from(billing_details), - } - } - api_models::payments::BankTransferData::BniVaBankTransfer { billing_details } => { - Self::BniVaBankTransfer { - billing_details: DokuBillingDetails::from(billing_details), - } - } - api_models::payments::BankTransferData::BriVaBankTransfer { billing_details } => { - Self::BriVaBankTransfer { - billing_details: DokuBillingDetails::from(billing_details), - } - } - api_models::payments::BankTransferData::CimbVaBankTransfer { billing_details } => { - Self::CimbVaBankTransfer { - billing_details: DokuBillingDetails::from(billing_details), - } - } - api_models::payments::BankTransferData::DanamonVaBankTransfer { billing_details } => { - Self::DanamonVaBankTransfer { - billing_details: DokuBillingDetails::from(billing_details), - } - } - api_models::payments::BankTransferData::MandiriVaBankTransfer { billing_details } => { - Self::MandiriVaBankTransfer { - billing_details: DokuBillingDetails::from(billing_details), - } - } - api_models::payments::BankTransferData::Pix {} => Self::Pix {}, - api_models::payments::BankTransferData::Pse {} => Self::Pse {}, - api_models::payments::BankTransferData::LocalBankTransfer { bank_code } => { - Self::LocalBankTransfer { bank_code } - } - } - } -} - -impl From for DokuBillingDetails { - fn from(billing: api_models::payments::DokuBillingDetails) -> Self { - Self { - first_name: billing.first_name, - last_name: billing.last_name, - email: billing.email, - } - } -} diff --git a/crates/router/src/types/domain/user.rs b/crates/router/src/types/domain/user.rs index b4b5df2f46c..4625a72f5dd 100644 --- a/crates/router/src/types/domain/user.rs +++ b/crates/router/src/types/domain/user.rs @@ -3,7 +3,6 @@ use std::{collections::HashSet, ops, str::FromStr}; use api_models::{ admin as admin_api, organization as api_org, user as user_api, user_role as user_role_api, }; -use common_enums::TokenPurpose; use common_utils::{errors::CustomResult, pii}; use diesel_models::{ enums::UserStatus, @@ -32,8 +31,6 @@ use crate::{ }; pub mod dashboard_metadata; -pub mod decision_manager; -pub use decision_manager::*; #[derive(Clone)] pub struct UserName(Secret); @@ -88,13 +85,11 @@ static BLOCKED_EMAIL: Lazy> = Lazy::new(|| { impl UserEmail { pub fn new(email: Secret) -> UserResult { - use validator::ValidateEmail; - let email_string = email.expose(); let email = pii::Email::from_str(&email_string).change_context(UserErrors::EmailParsingError)?; - if email_string.validate_email() { + if validator::validate_email(&email_string) { let (_username, domain) = match email_string.as_str().split_once('@') { Some((u, d)) => (u, d), None => return Err(UserErrors::EmailParsingError.into()), @@ -110,10 +105,8 @@ impl UserEmail { } pub fn from_pii_email(email: pii::Email) -> UserResult { - use validator::ValidateEmail; - let email_string = email.peek(); - if email_string.validate_email() { + if validator::validate_email(email_string) { let (_username, domain) = match email_string.split_once('@') { Some((u, d)) => (u, d), None => return Err(UserErrors::EmailParsingError.into()), @@ -518,7 +511,7 @@ impl NewUser { pub async fn check_if_already_exists_in_db(&self, state: AppState) -> UserResult<()> { if state .store - .find_user_by_email(&self.get_email().into_inner()) + .find_user_by_email(self.get_email().into_inner().expose().expose().as_str()) .await .is_ok() { @@ -788,29 +781,6 @@ impl UserFromStorage { .find_user_role_by_user_id_merchant_id(self.get_user_id(), merchant_id) .await } - - pub async fn get_preferred_or_active_user_role_from_db( - &self, - state: &AppState, - ) -> CustomResult { - if let Some(preferred_merchant_id) = self.get_preferred_merchant_id() { - self.get_role_from_db_by_merchant_id(state, &preferred_merchant_id) - .await - } else { - state - .store - .list_user_roles_by_user_id(&self.0.user_id) - .await? - .into_iter() - .find(|role| role.status == UserStatus::Active) - .ok_or( - errors::StorageError::ValueNotFound( - "No active role found for user".to_string(), - ) - .into(), - ) - } - } } impl From for user_role_api::ModuleInfo { @@ -922,24 +892,17 @@ impl SignInWithMultipleRolesStrategy { .await .change_context(UserErrors::InternalServerError)?; - let roles = - utils::user_role::get_multiple_role_info_for_user_roles(state, &self.user_roles) - .await?; - let merchant_details = utils::user::get_multiple_merchant_details_with_status( self.user_roles, merchant_accounts, - roles, )?; Ok(user_api::SignInResponse::MerchantSelect( user_api::MerchantSelectResponse { name: self.user.get_name(), email: self.user.get_email(), - token: auth::SinglePurposeToken::new_token( + token: auth::UserAuthToken::new_token( self.user.get_user_id().to_string(), - TokenPurpose::AcceptInvite, - Origin::SignIn, &state.conf, ) .await? diff --git a/crates/router/src/types/domain/user/dashboard_metadata.rs b/crates/router/src/types/domain/user/dashboard_metadata.rs index 665ee1ab022..9c00809238e 100644 --- a/crates/router/src/types/domain/user/dashboard_metadata.rs +++ b/crates/router/src/types/domain/user/dashboard_metadata.rs @@ -26,7 +26,6 @@ pub enum MetaData { SetupWoocomWebhook(bool), IsMultipleConfiguration(bool), IsChangePasswordRequired(bool), - OnboardingSurvey(api::OnboardingSurvey), } impl From<&MetaData> for DBEnum { @@ -54,7 +53,6 @@ impl From<&MetaData> for DBEnum { MetaData::SetupWoocomWebhook(_) => Self::SetupWoocomWebhook, MetaData::IsMultipleConfiguration(_) => Self::IsMultipleConfiguration, MetaData::IsChangePasswordRequired(_) => Self::IsChangePasswordRequired, - MetaData::OnboardingSurvey(_) => Self::OnboardingSurvey, } } } diff --git a/crates/router/src/types/domain/user/decision_manager.rs b/crates/router/src/types/domain/user/decision_manager.rs deleted file mode 100644 index b5aff779106..00000000000 --- a/crates/router/src/types/domain/user/decision_manager.rs +++ /dev/null @@ -1,257 +0,0 @@ -use common_enums::TokenPurpose; -use diesel_models::{enums::UserStatus, user_role::UserRole}; -use masking::Secret; - -use super::UserFromStorage; -use crate::{ - core::errors::{UserErrors, UserResult}, - routes::AppState, - services::authentication as auth, -}; - -#[derive(Eq, PartialEq, Clone, Copy)] -pub enum UserFlow { - SPTFlow(SPTFlow), - JWTFlow(JWTFlow), -} - -impl UserFlow { - async fn is_required(&self, user: &UserFromStorage, state: &AppState) -> UserResult { - match self { - Self::SPTFlow(flow) => flow.is_required(user, state).await, - Self::JWTFlow(flow) => flow.is_required(user, state).await, - } - } -} - -#[derive(Eq, PartialEq, Clone, Copy)] -pub enum SPTFlow { - TOTP, - VerifyEmail, - AcceptInvitationFromEmail, - ForceSetPassword, - MerchantSelect, - ResetPassword, -} - -impl SPTFlow { - async fn is_required(&self, user: &UserFromStorage, state: &AppState) -> UserResult { - match self { - // TOTP - Self::TOTP => Ok(true), - // Main email APIs - Self::AcceptInvitationFromEmail | Self::ResetPassword => Ok(true), - Self::VerifyEmail => Ok(user.0.is_verified), - // Final Checks - // TODO: this should be based on last_password_modified_at as a placeholder using false - Self::ForceSetPassword => Ok(false), - Self::MerchantSelect => user - .get_roles_from_db(state) - .await - .map(|roles| !roles.iter().any(|role| role.status == UserStatus::Active)), - } - } - - pub async fn generate_spt( - self, - state: &AppState, - next_flow: &NextFlow, - ) -> UserResult> { - auth::SinglePurposeToken::new_token( - next_flow.user.get_user_id().to_string(), - self.into(), - next_flow.origin.clone(), - &state.conf, - ) - .await - .map(|token| token.into()) - } -} - -#[derive(Eq, PartialEq, Clone, Copy)] -pub enum JWTFlow { - UserInfo, -} - -impl JWTFlow { - async fn is_required(&self, _user: &UserFromStorage, _state: &AppState) -> UserResult { - Ok(true) - } - - pub async fn generate_jwt( - self, - state: &AppState, - next_flow: &NextFlow, - user_role: &UserRole, - ) -> UserResult> { - auth::AuthToken::new_token( - next_flow.user.get_user_id().to_string(), - user_role.merchant_id.clone(), - user_role.role_id.clone(), - &state.conf, - user_role.org_id.clone(), - ) - .await - .map(|token| token.into()) - } -} - -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] -#[serde(rename_all = "snake_case")] -pub enum Origin { - SignIn, - SignUp, - MagicLink, - VerifyEmail, - AcceptInvitationFromEmail, - ResetPassword, -} - -impl Origin { - fn get_flows(&self) -> &'static [UserFlow] { - match self { - Self::SignIn => &SIGNIN_FLOW, - Self::SignUp => &SIGNUP_FLOW, - Self::VerifyEmail => &VERIFY_EMAIL_FLOW, - Self::MagicLink => &MAGIC_LINK_FLOW, - Self::AcceptInvitationFromEmail => &ACCEPT_INVITATION_FROM_EMAIL_FLOW, - Self::ResetPassword => &RESET_PASSWORD_FLOW, - } - } -} - -const SIGNIN_FLOW: [UserFlow; 4] = [ - UserFlow::SPTFlow(SPTFlow::TOTP), - UserFlow::SPTFlow(SPTFlow::ForceSetPassword), - UserFlow::SPTFlow(SPTFlow::MerchantSelect), - UserFlow::JWTFlow(JWTFlow::UserInfo), -]; - -const SIGNUP_FLOW: [UserFlow; 4] = [ - UserFlow::SPTFlow(SPTFlow::TOTP), - UserFlow::SPTFlow(SPTFlow::ForceSetPassword), - UserFlow::SPTFlow(SPTFlow::MerchantSelect), - UserFlow::JWTFlow(JWTFlow::UserInfo), -]; - -const MAGIC_LINK_FLOW: [UserFlow; 5] = [ - UserFlow::SPTFlow(SPTFlow::TOTP), - UserFlow::SPTFlow(SPTFlow::VerifyEmail), - UserFlow::SPTFlow(SPTFlow::ForceSetPassword), - UserFlow::SPTFlow(SPTFlow::MerchantSelect), - UserFlow::JWTFlow(JWTFlow::UserInfo), -]; - -const VERIFY_EMAIL_FLOW: [UserFlow; 5] = [ - UserFlow::SPTFlow(SPTFlow::TOTP), - UserFlow::SPTFlow(SPTFlow::VerifyEmail), - UserFlow::SPTFlow(SPTFlow::ForceSetPassword), - UserFlow::SPTFlow(SPTFlow::MerchantSelect), - UserFlow::JWTFlow(JWTFlow::UserInfo), -]; - -const ACCEPT_INVITATION_FROM_EMAIL_FLOW: [UserFlow; 4] = [ - UserFlow::SPTFlow(SPTFlow::TOTP), - UserFlow::SPTFlow(SPTFlow::AcceptInvitationFromEmail), - UserFlow::SPTFlow(SPTFlow::ForceSetPassword), - UserFlow::JWTFlow(JWTFlow::UserInfo), -]; - -const RESET_PASSWORD_FLOW: [UserFlow; 2] = [ - UserFlow::SPTFlow(SPTFlow::TOTP), - UserFlow::SPTFlow(SPTFlow::ResetPassword), -]; - -pub struct CurrentFlow { - origin: Origin, - current_flow_index: usize, -} - -impl CurrentFlow { - pub fn new(origin: Origin, current_flow: UserFlow) -> UserResult { - let flows = origin.get_flows(); - let index = flows - .iter() - .position(|flow| flow == ¤t_flow) - .ok_or(UserErrors::InternalServerError)?; - - Ok(Self { - origin, - current_flow_index: index, - }) - } - - pub async fn next(&self, user: UserFromStorage, state: &AppState) -> UserResult { - let flows = self.origin.get_flows(); - let remaining_flows = flows.iter().skip(self.current_flow_index + 1); - for flow in remaining_flows { - if flow.is_required(&user, state).await? { - return Ok(NextFlow { - origin: self.origin.clone(), - next_flow: *flow, - user, - }); - } - } - Err(UserErrors::InternalServerError.into()) - } -} - -pub struct NextFlow { - origin: Origin, - next_flow: UserFlow, - user: UserFromStorage, -} - -impl NextFlow { - pub async fn from_origin( - origin: Origin, - user: UserFromStorage, - state: &AppState, - ) -> UserResult { - let flows = origin.get_flows(); - for flow in flows { - if flow.is_required(&user, state).await? { - return Ok(Self { - origin, - next_flow: *flow, - user, - }); - } - } - Err(UserErrors::InternalServerError.into()) - } - - pub fn get_flow(&self) -> UserFlow { - self.next_flow - } -} - -impl From for TokenPurpose { - fn from(value: UserFlow) -> Self { - match value { - UserFlow::SPTFlow(flow) => flow.into(), - UserFlow::JWTFlow(flow) => flow.into(), - } - } -} - -impl From for TokenPurpose { - fn from(value: SPTFlow) -> Self { - match value { - SPTFlow::TOTP => Self::TOTP, - SPTFlow::VerifyEmail => Self::VerifyEmail, - SPTFlow::AcceptInvitationFromEmail => Self::AcceptInvitationFromEmail, - SPTFlow::MerchantSelect => Self::AcceptInvite, - SPTFlow::ResetPassword | SPTFlow::ForceSetPassword => Self::ResetPassword, - } - } -} - -impl From for TokenPurpose { - fn from(value: JWTFlow) -> Self { - match value { - JWTFlow::UserInfo => Self::UserInfo, - } - } -} diff --git a/crates/router/src/types/fraud_check.rs b/crates/router/src/types/fraud_check.rs index b6f1d10888d..191e74422f9 100644 --- a/crates/router/src/types/fraud_check.rs +++ b/crates/router/src/types/fraud_check.rs @@ -103,8 +103,6 @@ pub struct FraudCheckTransactionData { pub error_code: Option, pub error_message: Option, pub connector_transaction_id: Option, - //The name of the payment gateway or financial institution that processed the transaction. - pub connector: Option, } pub type FrmFulfillmentRouterData = diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs index 77550bedabe..ec164000b32 100644 --- a/crates/router/src/types/storage.rs +++ b/crates/router/src/types/storage.rs @@ -39,19 +39,19 @@ pub mod user_role; use std::collections::HashMap; -pub use diesel_models::{ - ProcessTracker, ProcessTrackerNew, ProcessTrackerRunner, ProcessTrackerUpdate, -}; -pub use hyperswitch_domain_models::payments::{ +pub use data_models::payments::{ payment_attempt::{PaymentAttempt, PaymentAttemptNew, PaymentAttemptUpdate}, payment_intent::{PaymentIntentNew, PaymentIntentUpdate}, PaymentIntent, }; #[cfg(feature = "payouts")] -pub use hyperswitch_domain_models::payouts::{ +pub use data_models::payouts::{ payout_attempt::{PayoutAttempt, PayoutAttemptNew, PayoutAttemptUpdate}, payouts::{Payouts, PayoutsNew, PayoutsUpdate}, }; +pub use diesel_models::{ + ProcessTracker, ProcessTrackerNew, ProcessTrackerRunner, ProcessTrackerUpdate, +}; pub use scheduler::db::process_tracker; pub use self::{ diff --git a/crates/router/src/types/storage/business_profile.rs b/crates/router/src/types/storage/business_profile.rs index d7c7d66b99e..2ab7597bcda 100644 --- a/crates/router/src/types/storage/business_profile.rs +++ b/crates/router/src/types/storage/business_profile.rs @@ -1,3 +1,3 @@ pub use diesel_models::business_profile::{ - BusinessProfile, BusinessProfileNew, BusinessProfileUpdate, BusinessProfileUpdateInternal, + BusinessProfile, BusinessProfileNew, BusinessProfileUpdateInternal, }; diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs index 41e1aae635d..0d840326f9b 100644 --- a/crates/router/src/types/storage/payment_attempt.rs +++ b/crates/router/src/types/storage/payment_attempt.rs @@ -1,8 +1,8 @@ -use diesel_models::{capture::CaptureNew, enums}; -use error_stack::ResultExt; -pub use hyperswitch_domain_models::payments::payment_attempt::{ +pub use data_models::payments::payment_attempt::{ PaymentAttempt, PaymentAttemptNew, PaymentAttemptUpdate, }; +use diesel_models::{capture::CaptureNew, enums}; +use error_stack::ResultExt; use crate::{ core::errors, errors::RouterResult, types::transformers::ForeignFrom, utils::OptionExt, diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index ef12e32d57c..8a53a58aabd 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -1,9 +1,6 @@ // use actix_web::HttpMessage; use actix_web::http::header::HeaderMap; -use api_models::{ - enums as api_enums, gsm as gsm_api_types, payment_methods, payments, - routing::ConnectorSelection, -}; +use api_models::{enums as api_enums, gsm as gsm_api_types, payments, routing::ConnectorSelection}; use common_utils::{ consts::X_HS_LATENCY, crypto::Encryptable, @@ -74,28 +71,6 @@ impl ForeignFrom for storage_enums::RefundType } } -impl ForeignFrom for payment_methods::PaymentMethodResponse { - fn foreign_from(item: diesel_models::PaymentMethod) -> Self { - Self { - merchant_id: item.merchant_id, - customer_id: Some(item.customer_id), - payment_method_id: item.payment_method_id, - payment_method: item.payment_method, - payment_method_type: item.payment_method_type, - card: None, - recurring_enabled: false, - installment_payment_enabled: false, - payment_experience: None, - metadata: item.metadata, - created: Some(item.created_at), - #[cfg(feature = "payouts")] - bank_transfer: None, - last_used_at: None, - client_secret: item.client_secret, - } - } -} - impl ForeignFrom for storage_enums::IntentStatus { fn foreign_from(s: storage_enums::AttemptStatus) -> Self { match s { @@ -213,7 +188,7 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { api_enums::Connector::Authorizedotnet => Self::Authorizedotnet, api_enums::Connector::Bambora => Self::Bambora, api_enums::Connector::Bankofamerica => Self::Bankofamerica, - api_enums::Connector::Billwerk => Self::Billwerk, + // api_enums::Connector::Billwerk => Self::Billwerk, Added as template code for future usage api_enums::Connector::Bitpay => Self::Bitpay, api_enums::Connector::Bluesnap => Self::Bluesnap, api_enums::Connector::Boku => Self::Boku, @@ -224,7 +199,6 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { api_enums::Connector::Cryptopay => Self::Cryptopay, api_enums::Connector::Cybersource => Self::Cybersource, api_enums::Connector::Dlocal => Self::Dlocal, - api_enums::Connector::Ebanx => Self::Ebanx, api_enums::Connector::Fiserv => Self::Fiserv, api_enums::Connector::Forte => Self::Forte, api_enums::Connector::Globalpay => Self::Globalpay, @@ -235,11 +209,6 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { api_enums::Connector::Klarna => Self::Klarna, api_enums::Connector::Mollie => Self::Mollie, api_enums::Connector::Multisafepay => Self::Multisafepay, - api_enums::Connector::Netcetera => { - Err(common_utils::errors::ValidationError::InvalidValue { - message: "netcetera is not a routable connector".to_string(), - })? - } api_enums::Connector::Nexinets => Self::Nexinets, api_enums::Connector::Nmi => Self::Nmi, api_enums::Connector::Noon => Self::Noon, @@ -278,7 +247,6 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { api_enums::Connector::Worldline => Self::Worldline, api_enums::Connector::Worldpay => Self::Worldpay, api_enums::Connector::Zen => Self::Zen, - api_enums::Connector::Zsl => Self::Zsl, #[cfg(feature = "dummy_connector")] api_enums::Connector::DummyConnector1 => Self::DummyConnector1, #[cfg(feature = "dummy_connector")] @@ -315,34 +283,30 @@ impl ForeignFrom for api_models::payments::Man } // TODO: remove foreign from since this conversion won't be needed in the router crate once data models is treated as a single & primary source of truth for structure information -impl ForeignFrom - for hyperswitch_domain_models::mandates::MandateData -{ +impl ForeignFrom for data_models::mandates::MandateData { fn foreign_from(d: api_models::payments::MandateData) -> Self { Self { customer_acceptance: d.customer_acceptance.map(|d| { - hyperswitch_domain_models::mandates::CustomerAcceptance { + data_models::mandates::CustomerAcceptance { acceptance_type: match d.acceptance_type { api_models::payments::AcceptanceType::Online => { - hyperswitch_domain_models::mandates::AcceptanceType::Online + data_models::mandates::AcceptanceType::Online } api_models::payments::AcceptanceType::Offline => { - hyperswitch_domain_models::mandates::AcceptanceType::Offline + data_models::mandates::AcceptanceType::Offline } }, accepted_at: d.accepted_at, - online: d - .online - .map(|d| hyperswitch_domain_models::mandates::OnlineMandate { - ip_address: d.ip_address, - user_agent: d.user_agent, - }), + online: d.online.map(|d| data_models::mandates::OnlineMandate { + ip_address: d.ip_address, + user_agent: d.user_agent, + }), } }), mandate_type: d.mandate_type.map(|d| match d { api_models::payments::MandateType::MultiUse(Some(i)) => { - hyperswitch_domain_models::mandates::MandateDataType::MultiUse(Some( - hyperswitch_domain_models::mandates::MandateAmountData { + data_models::mandates::MandateDataType::MultiUse(Some( + data_models::mandates::MandateAmountData { amount: i.amount, currency: i.currency, start_date: i.start_date, @@ -352,8 +316,8 @@ impl ForeignFrom )) } api_models::payments::MandateType::SingleUse(i) => { - hyperswitch_domain_models::mandates::MandateDataType::SingleUse( - hyperswitch_domain_models::mandates::MandateAmountData { + data_models::mandates::MandateDataType::SingleUse( + data_models::mandates::MandateAmountData { amount: i.amount, currency: i.currency, start_date: i.start_date, @@ -363,7 +327,7 @@ impl ForeignFrom ) } api_models::payments::MandateType::MultiUse(None) => { - hyperswitch_domain_models::mandates::MandateDataType::MultiUse(None) + data_models::mandates::MandateDataType::MultiUse(None) } }), update_mandate_id: d.update_mandate_id, @@ -430,8 +394,7 @@ impl ForeignFrom for api_enums::PaymentMethod { | api_enums::PaymentMethodType::Gcash | api_enums::PaymentMethodType::Momo | api_enums::PaymentMethodType::Cashapp - | api_enums::PaymentMethodType::KakaoPay - | api_enums::PaymentMethodType::Venmo => Self::Wallet, + | api_enums::PaymentMethodType::KakaoPay => Self::Wallet, api_enums::PaymentMethodType::Affirm | api_enums::PaymentMethodType::Alma | api_enums::PaymentMethodType::AfterpayClearpay @@ -490,7 +453,6 @@ impl ForeignFrom for api_enums::PaymentMethod { | api_enums::PaymentMethodType::CimbVa | api_enums::PaymentMethodType::DanamonVa | api_enums::PaymentMethodType::MandiriVa - | api_enums::PaymentMethodType::LocalBankTransfer | api_enums::PaymentMethodType::Pix => Self::BankTransfer, api_enums::PaymentMethodType::Givex | api_enums::PaymentMethodType::PaySafeCard => { Self::GiftCard @@ -624,7 +586,6 @@ impl<'a> From<&'a domain::Address> for api_types::Address { && address.line2.is_none() && address.line3.is_none() && address.state.is_none() - && address.country.is_none() && address.zip.is_none() && address.first_name.is_none() && address.last_name.is_none() @@ -966,7 +927,6 @@ impl ForeignFrom for api_enums::PaymentMethodType { api_models::payouts::Bank::Ach(_) => Self::Ach, api_models::payouts::Bank::Bacs(_) => Self::Bacs, api_models::payouts::Bank::Sepa(_) => Self::Sepa, - api_models::payouts::Bank::Pix(_) => Self::Pix, } } } @@ -976,7 +936,6 @@ impl ForeignFrom for api_enums::PaymentMethodType { fn foreign_from(value: api_models::payouts::Wallet) -> Self { match value { api_models::payouts::Wallet::Paypal(_) => Self::Paypal, - api_models::payouts::Wallet::Venmo(_) => Self::Venmo, } } } @@ -1171,24 +1130,6 @@ impl ForeignFrom for gsm_api_types::GsmResponse { } } -impl ForeignFrom<&domain::Customer> for api_models::payments::CustomerDetails { - fn foreign_from(customer: &domain::Customer) -> Self { - Self { - id: customer.customer_id.clone(), - name: customer - .name - .as_ref() - .map(|name| name.get_inner().to_owned()), - email: customer.email.clone().map(Into::into), - phone: customer - .phone - .as_ref() - .map(|phone| phone.get_inner().to_owned()), - phone_country_code: customer.phone_country_code.clone(), - } - } -} - #[cfg(feature = "olap")] impl ForeignTryFrom for api_types::webhook_events::EventListConstraintsInternal diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs index 341c560e4d2..56f68e33d3b 100644 --- a/crates/router/src/utils.rs +++ b/crates/router/src/utils.rs @@ -23,8 +23,8 @@ pub use common_utils::{ fp_utils::when, validation::validate_email, }; +use data_models::payments::PaymentIntent; use error_stack::ResultExt; -use hyperswitch_domain_models::payments::PaymentIntent; use image::Luma; use masking::ExposeInterface; use nanoid::nanoid; @@ -38,7 +38,6 @@ pub use self::ext_traits::{OptionExt, ValidateCall}; use crate::{ consts, core::{ - authentication::types::ExternalThreeDSConnectorMetadata, errors::{self, CustomResult, RouterResult, StorageErrorExt}, utils, webhooks as webhooks_core, }, @@ -177,15 +176,15 @@ impl QrImage { let qrcode_image_buffer = qr_code.render::>().build(); let qrcode_dynamic_image = image::DynamicImage::ImageLuma8(qrcode_image_buffer); - let mut image_bytes = std::io::BufWriter::new(std::io::Cursor::new(Vec::new())); + let mut image_bytes = Vec::new(); // Encodes qrcode_dynamic_image and write it to image_bytes - let _ = qrcode_dynamic_image.write_to(&mut image_bytes, image::ImageFormat::Png); + let _ = qrcode_dynamic_image.write_to(&mut image_bytes, image::ImageOutputFormat::Png); let image_data_source = format!( "{},{}", consts::QR_IMAGE_DATA_SOURCE_STRING, - consts::BASE64_ENGINE.encode(image_bytes.get_ref().get_ref()) + consts::BASE64_ENGINE.encode(image_bytes) ); Ok(Self { data: image_data_source, @@ -299,7 +298,6 @@ pub async fn find_payment_intent_from_mandate_id_type( .find_mandate_by_merchant_id_mandate_id( &merchant_account.merchant_id, mandate_id.as_str(), - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?, @@ -307,7 +305,6 @@ pub async fn find_payment_intent_from_mandate_id_type( .find_mandate_by_merchant_id_connector_mandate_id( &merchant_account.merchant_id, connector_mandate_id.as_str(), - merchant_account.storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?, @@ -324,98 +321,6 @@ pub async fn find_payment_intent_from_mandate_id_type( .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound) } -pub async fn find_mca_from_authentication_id_type( - db: &dyn StorageInterface, - authentication_id_type: webhooks::AuthenticationIdType, - merchant_account: &domain::MerchantAccount, - key_store: &domain::MerchantKeyStore, -) -> CustomResult { - let authentication = match authentication_id_type { - webhooks::AuthenticationIdType::AuthenticationId(authentication_id) => db - .find_authentication_by_merchant_id_authentication_id( - merchant_account.merchant_id.clone(), - authentication_id, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::InternalServerError)?, - webhooks::AuthenticationIdType::ConnectorAuthenticationId(connector_authentication_id) => { - db.find_authentication_by_merchant_id_connector_authentication_id( - merchant_account.merchant_id.clone(), - connector_authentication_id, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::InternalServerError)? - } - }; - db.find_by_merchant_connector_account_merchant_id_merchant_connector_id( - &merchant_account.merchant_id, - &authentication.merchant_connector_id, - key_store, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound { - id: authentication.merchant_connector_id.to_string(), - }) -} - -pub async fn get_mca_from_payment_intent( - db: &dyn StorageInterface, - merchant_account: &domain::MerchantAccount, - payment_intent: PaymentIntent, - key_store: &domain::MerchantKeyStore, - connector_name: &str, -) -> CustomResult { - let payment_attempt = db - .find_payment_attempt_by_attempt_id_merchant_id( - &payment_intent.active_attempt.get_id(), - &merchant_account.merchant_id, - merchant_account.storage_scheme, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; - - match payment_attempt.merchant_connector_id { - Some(merchant_connector_id) => db - .find_by_merchant_connector_account_merchant_id_merchant_connector_id( - &merchant_account.merchant_id, - &merchant_connector_id, - key_store, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound { - id: merchant_connector_id, - }), - None => { - let profile_id = match payment_intent.profile_id { - Some(profile_id) => profile_id, - None => utils::get_profile_id_from_business_details( - payment_intent.business_country, - payment_intent.business_label.as_ref(), - merchant_account, - payment_intent.profile_id.as_ref(), - db, - false, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("profile_id is not set in payment_intent")?, - }; - - db.find_merchant_connector_account_by_profile_id_connector_name( - &profile_id, - connector_name, - key_store, - ) - .await - .to_not_found_response( - errors::ApiErrorResponse::MerchantConnectorAccountNotFound { - id: format!("profile_id {profile_id} and connector_name {connector_name}"), - }, - ) - } - } -} - pub async fn get_mca_from_object_reference_id( db: &dyn StorageInterface, object_reference_id: webhooks::ObjectReferenceId, @@ -423,6 +328,8 @@ pub async fn get_mca_from_object_reference_id( connector_name: &str, key_store: &domain::MerchantKeyStore, ) -> CustomResult { + let merchant_id = merchant_account.merchant_id.clone(); + match merchant_account.default_profile.as_ref() { Some(profile_id) => db .find_merchant_connector_account_by_profile_id_connector_name( @@ -434,55 +341,78 @@ pub async fn get_mca_from_object_reference_id( .to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound { id: format!("profile_id {profile_id} and connector_name {connector_name}"), }), - _ => match object_reference_id { - webhooks::ObjectReferenceId::PaymentId(payment_id_type) => { - get_mca_from_payment_intent( - db, - merchant_account, + _ => { + let payment_intent = match object_reference_id { + webhooks::ObjectReferenceId::PaymentId(payment_id_type) => { find_payment_intent_from_payment_id_type(db, payment_id_type, merchant_account) - .await?, - key_store, - connector_name, - ) - .await - } - webhooks::ObjectReferenceId::RefundId(refund_id_type) => { - get_mca_from_payment_intent( - db, - merchant_account, + .await? + } + webhooks::ObjectReferenceId::RefundId(refund_id_type) => { find_payment_intent_from_refund_id_type( db, refund_id_type, merchant_account, connector_name, ) - .await?, - key_store, - connector_name, - ) - .await - } - webhooks::ObjectReferenceId::MandateId(mandate_id_type) => { - get_mca_from_payment_intent( - db, - merchant_account, + .await? + } + webhooks::ObjectReferenceId::MandateId(mandate_id_type) => { find_payment_intent_from_mandate_id_type(db, mandate_id_type, merchant_account) - .await?, - key_store, - connector_name, - ) - .await - } - webhooks::ObjectReferenceId::ExternalAuthenticationID(authentication_id_type) => { - find_mca_from_authentication_id_type( - db, - authentication_id_type, - merchant_account, - key_store, + .await? + } + }; + + let payment_attempt = db + .find_payment_attempt_by_attempt_id_merchant_id( + &payment_intent.active_attempt.get_id(), + &merchant_id, + merchant_account.storage_scheme, ) .await + .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; + + match payment_attempt.merchant_connector_id { + Some(merchant_connector_id) => db + .find_by_merchant_connector_account_merchant_id_merchant_connector_id( + &merchant_id, + &merchant_connector_id, + key_store, + ) + .await + .to_not_found_response( + errors::ApiErrorResponse::MerchantConnectorAccountNotFound { + id: merchant_connector_id, + }, + ), + None => { + let profile_id = utils::get_profile_id_from_business_details( + payment_intent.business_country, + payment_intent.business_label.as_ref(), + merchant_account, + payment_intent.profile_id.as_ref(), + db, + false, + ) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("profile_id is not set in payment_intent")?; + + db.find_merchant_connector_account_by_profile_id_connector_name( + &profile_id, + connector_name, + key_store, + ) + .await + .to_not_found_response( + errors::ApiErrorResponse::MerchantConnectorAccountNotFound { + id: format!( + "profile_id {profile_id} and connector_name {connector_name}" + ), + }, + ) + } } - }, + } } } @@ -805,24 +735,13 @@ pub fn add_apple_pay_payment_status_metrics( } } -pub fn check_if_pull_mechanism_for_external_3ds_enabled_from_connector_metadata( - metadata: Option, -) -> bool { - let external_three_ds_connector_metadata: Option = metadata - .parse_value("ExternalThreeDSConnectorMetadata") - .map_err(|err| logger::warn!(parsing_error=?err,"Error while parsing ExternalThreeDSConnectorMetadata")) - .ok(); - external_three_ds_connector_metadata - .and_then(|metadata| metadata.pull_mechanism_for_external_3ds_enabled) - .unwrap_or(true) -} - #[allow(clippy::too_many_arguments)] -pub async fn trigger_payments_webhook( +pub async fn trigger_payments_webhook( merchant_account: domain::MerchantAccount, business_profile: diesel_models::business_profile::BusinessProfile, key_store: &domain::MerchantKeyStore, payment_data: crate::core::payments::PaymentData, + req: Option, customer: Option, state: &crate::routes::AppState, operation: Op, @@ -849,9 +768,9 @@ where enums::IntentStatus::Succeeded | enums::IntentStatus::Failed | enums::IntentStatus::PartiallyCaptured - | enums::IntentStatus::RequiresMerchantAction ) { let payments_response = crate::core::payments::transformers::payments_to_payments_response( + req, payment_data, captures, customer, diff --git a/crates/router/src/utils/db_utils.rs b/crates/router/src/utils/db_utils.rs index 67641a3fe7b..219b6f9777f 100644 --- a/crates/router/src/utils/db_utils.rs +++ b/crates/router/src/utils/db_utils.rs @@ -36,73 +36,3 @@ where }, } } - -pub async fn find_all_combined_kv_database( - redis_fut: RFut, - database_call: F, - limit: Option, -) -> error_stack::Result, errors::StorageError> -where - T: UniqueConstraints, - F: FnOnce() -> DFut, - RFut: - futures::Future, redis_interface::errors::RedisError>>, - DFut: futures::Future, errors::StorageError>>, -{ - let trunc = |v: &mut Vec<_>| { - if let Some(l) = limit.and_then(|v| TryInto::try_into(v).ok()) { - v.truncate(l); - } - }; - - let limit_satisfies = |len: usize, limit: i64| { - TryInto::try_into(limit) - .ok() - .map_or(true, |val: usize| len >= val) - }; - - let redis_output = redis_fut.await; - match (redis_output, limit) { - (Ok(mut kv_rows), Some(lim)) if limit_satisfies(kv_rows.len(), lim) => { - trunc(&mut kv_rows); - Ok(kv_rows) - } - (Ok(kv_rows), _) => database_call().await.map(|db_rows| { - let mut res = union_vec(kv_rows, db_rows); - trunc(&mut res); - res - }), - (Err(redis_error), _) => match redis_error.current_context() { - redis_interface::errors::RedisError::NotFound => { - metrics::KV_MISS.add(&metrics::CONTEXT, 1, &[]); - database_call().await - } - // Keeping the key empty here since the error would never go here. - _ => Err(redis_error.to_redis_failed_response("")), - }, - } -} - -use std::collections::HashSet; - -use storage_impl::UniqueConstraints; - -fn union_vec(mut kv_rows: Vec, sql_rows: Vec) -> Vec -where - T: UniqueConstraints, -{ - let mut kv_unique_keys = HashSet::new(); - - kv_rows.iter().for_each(|v| { - kv_unique_keys.insert(v.unique_constraints().concat()); - }); - - sql_rows.into_iter().for_each(|v| { - let unique_key = v.unique_constraints().concat(); - if !kv_unique_keys.contains(&unique_key) { - kv_rows.push(v); - } - }); - - kv_rows -} diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs index bde0fb72bd3..f8b7d86c74a 100644 --- a/crates/router/src/utils/user.rs +++ b/crates/router/src/utils/user.rs @@ -3,8 +3,8 @@ use std::collections::HashMap; use api_models::user as user_api; use common_utils::errors::CustomResult; use diesel_models::{enums::UserStatus, user_role::UserRole}; -use error_stack::ResultExt; -use masking::Secret; +use error_stack::{report, ResultExt}; +use masking::{ExposeInterface, Secret}; use crate::{ core::errors::{StorageError, UserErrors, UserResult}, @@ -137,38 +137,24 @@ pub fn get_verification_days_left( pub fn get_multiple_merchant_details_with_status( user_roles: Vec, merchant_accounts: Vec, - roles: Vec, ) -> UserResult> { - let merchant_account_map = merchant_accounts + let roles: HashMap<_, _> = user_roles .into_iter() - .map(|merchant_account| (merchant_account.merchant_id.clone(), merchant_account)) - .collect::>(); + .map(|user_role| (user_role.merchant_id.clone(), user_role)) + .collect(); - let role_map = roles + merchant_accounts .into_iter() - .map(|role_info| (role_info.get_role_id().to_string(), role_info)) - .collect::>(); - - user_roles - .into_iter() - .map(|user_role| { - let merchant_account = merchant_account_map - .get(&user_role.merchant_id) - .ok_or(UserErrors::InternalServerError) - .attach_printable("Merchant account for user role doesn't exist")?; - - let role_info = role_map - .get(&user_role.role_id) - .ok_or(UserErrors::InternalServerError) - .attach_printable("Role info for user role doesn't exist")?; + .map(|merchant| { + let role = roles + .get(merchant.merchant_id.as_str()) + .ok_or(report!(UserErrors::InternalServerError)) + .attach_printable("Merchant exists but user role doesn't")?; Ok(user_api::UserMerchantAccount { - merchant_id: user_role.merchant_id, - merchant_name: merchant_account.merchant_name.clone(), - is_active: user_role.status == UserStatus::Active, - role_id: user_role.role_id, - role_name: role_info.get_role_name().to_string(), - org_id: user_role.org_id, + merchant_id: merchant.merchant_id.clone(), + merchant_name: merchant.merchant_name.clone(), + is_active: role.status == UserStatus::Active, }) }) .collect() @@ -180,7 +166,7 @@ pub async fn get_user_from_db_by_email( ) -> CustomResult { state .store - .find_user_by_email(&email.into_inner()) + .find_user_by_email(email.get_secret().expose().as_str()) .await .map(UserFromStorage::from) } diff --git a/crates/router/src/utils/user/dashboard_metadata.rs b/crates/router/src/utils/user/dashboard_metadata.rs index 3979a864944..e18a6401173 100644 --- a/crates/router/src/utils/user/dashboard_metadata.rs +++ b/crates/router/src/utils/user/dashboard_metadata.rs @@ -214,7 +214,6 @@ pub fn separate_metadata_type_based_on_scope( | DBEnum::DownloadWoocom | DBEnum::ConfigureWoocom | DBEnum::SetupWoocomWebhook - | DBEnum::OnboardingSurvey | DBEnum::IsMultipleConfiguration => merchant_scoped.push(key), DBEnum::Feedback | DBEnum::ProdIntent | DBEnum::IsChangePasswordRequired => { user_scoped.push(key) diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs index 2216cb10554..8469bf770d2 100644 --- a/crates/router/src/utils/user/sample_data.rs +++ b/crates/router/src/utils/user/sample_data.rs @@ -2,9 +2,9 @@ use api_models::{ enums::Connector::{DummyConnector4, DummyConnector7}, user::sample_data::SampleDataRequest, }; +use data_models::payments::payment_intent::PaymentIntentNew; use diesel_models::{user::sample_data::PaymentAttemptBatchNew, RefundNew}; use error_stack::ResultExt; -use hyperswitch_domain_models::payments::payment_intent::PaymentIntentNew; use rand::{prelude::SliceRandom, thread_rng, Rng}; use time::OffsetDateTime; @@ -187,9 +187,7 @@ pub async fn generate_sample_data( client_secret: Some(client_secret), business_country: business_country_default, business_label: business_label_default.clone(), - active_attempt: hyperswitch_domain_models::RemoteStorageObject::ForeignID( - attempt_id.clone(), - ), + active_attempt: data_models::RemoteStorageObject::ForeignID(attempt_id.clone()), attempt_count: 1, customer_id: Some("hs-dashboard-user".to_string()), amount_captured: Some(amount * 100), diff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rs index ba4c2878667..1fb58f983af 100644 --- a/crates/router/src/utils/user_role.rs +++ b/crates/router/src/utils/user_role.rs @@ -8,7 +8,7 @@ use router_env::logger; use crate::{ consts, - core::errors::{StorageErrorExt, UserErrors, UserResult}, + core::errors::{UserErrors, UserResult}, routes::AppState, services::authorization::{self as authz, permissions::Permission, roles}, types::domain, @@ -44,7 +44,6 @@ impl From for user_role_api::Permission { Permission::UsersWrite => Self::UsersWrite, Permission::MerchantAccountCreate => Self::MerchantAccountCreate, Permission::WebhookEventRead => Self::WebhookEventRead, - Permission::WebhookEventWrite => Self::WebhookEventWrite, Permission::PayoutRead => Self::PayoutRead, Permission::PayoutWrite => Self::PayoutWrite, } @@ -141,22 +140,3 @@ pub async fn set_role_permissions_in_cache_if_required( .change_context(UserErrors::InternalServerError) .attach_printable("Error setting permissions in redis") } - -pub async fn get_multiple_role_info_for_user_roles( - state: &AppState, - user_roles: &[UserRole], -) -> UserResult> { - futures::future::try_join_all(user_roles.iter().map(|user_role| async { - let role = roles::RoleInfo::from_role_id( - state, - &user_role.role_id, - &user_role.merchant_id, - &user_role.org_id, - ) - .await - .to_not_found_response(UserErrors::InternalServerError) - .attach_printable("Role for user role doesn't exist")?; - Ok::<_, error_stack::Report>(role) - })) - .await -} diff --git a/crates/router/src/utils/verify_connector.rs b/crates/router/src/utils/verify_connector.rs index 617cb415ee0..acb2f609631 100644 --- a/crates/router/src/utils/verify_connector.rs +++ b/crates/router/src/utils/verify_connector.rs @@ -1,15 +1,15 @@ use api_models::enums::Connector; use error_stack::ResultExt; -use crate::{core::errors, types::domain}; +use crate::{core::errors, types::api}; pub fn generate_card_from_details( card_number: String, card_exp_year: String, card_exp_month: String, card_cvv: String, -) -> errors::RouterResult { - Ok(domain::Card { +) -> errors::RouterResult { + Ok(api::Card { card_number: card_number .parse::() .change_context(errors::ApiErrorResponse::InternalServerError) @@ -19,6 +19,7 @@ pub fn generate_card_from_details( card_network: None, card_exp_year: masking::Secret::new(card_exp_year), card_exp_month: masking::Secret::new(card_exp_month), + card_holder_name: Some(masking::Secret::new("HyperSwitch".to_string())), nick_name: None, card_type: None, card_issuing_country: None, @@ -26,9 +27,7 @@ pub fn generate_card_from_details( }) } -pub fn get_test_card_details( - connector_name: Connector, -) -> errors::RouterResult> { +pub fn get_test_card_details(connector_name: Connector) -> errors::RouterResult> { match connector_name { Connector::Stripe => Some(generate_card_from_details( "4242424242424242".to_string(), diff --git a/crates/router/src/workflows.rs b/crates/router/src/workflows.rs index 7b29ded5185..6158031079c 100644 --- a/crates/router/src/workflows.rs +++ b/crates/router/src/workflows.rs @@ -1,7 +1,5 @@ #[cfg(feature = "email")] pub mod api_key_expiry; -#[cfg(feature = "payouts")] -pub mod attach_payout_account_workflow; pub mod outgoing_webhook_retry; pub mod payment_sync; pub mod refund_router; diff --git a/crates/router/src/workflows/attach_payout_account_workflow.rs b/crates/router/src/workflows/attach_payout_account_workflow.rs deleted file mode 100644 index 98d3f7844b4..00000000000 --- a/crates/router/src/workflows/attach_payout_account_workflow.rs +++ /dev/null @@ -1,72 +0,0 @@ -use common_utils::ext_traits::{OptionExt, ValueExt}; -use scheduler::{ - consumer::{self, workflows::ProcessTrackerWorkflow}, - errors, -}; - -use crate::{ - core::payouts, - errors as core_errors, - routes::AppState, - types::{api, storage}, -}; - -pub struct AttachPayoutAccountWorkflow; - -#[async_trait::async_trait] -impl ProcessTrackerWorkflow for AttachPayoutAccountWorkflow { - async fn execute_workflow<'a>( - &'a self, - state: &'a AppState, - process: storage::ProcessTracker, - ) -> Result<(), errors::ProcessTrackerError> { - // Gather context - let db = &*state.store; - let tracking_data: api::PayoutRetrieveRequest = process - .tracking_data - .clone() - .parse_value("PayoutRetrieveRequest")?; - - let merchant_id = tracking_data - .merchant_id - .clone() - .get_required_value("merchant_id")?; - - let key_store = db - .get_merchant_key_store_by_merchant_id( - merchant_id.as_ref(), - &db.get_master_key().to_vec().into(), - ) - .await?; - - let merchant_account = db - .find_merchant_account_by_merchant_id(&merchant_id, &key_store) - .await?; - - let request = api::payouts::PayoutRequest::PayoutRetrieveRequest(tracking_data); - - let mut payout_data = - payouts::make_payout_data(state, &merchant_account, &key_store, &request).await?; - - payouts::payouts_core( - state, - &merchant_account, - &key_store, - &mut payout_data, - None, - None, - ) - .await?; - - Ok(()) - } - - async fn error_handler<'a>( - &'a self, - state: &'a AppState, - process: storage::ProcessTracker, - error: errors::ProcessTrackerError, - ) -> core_errors::CustomResult<(), errors::ProcessTrackerError> { - consumer::consumer_error_handler(state.store.as_scheduler(), process, error).await - } -} diff --git a/crates/router/src/workflows/outgoing_webhook_retry.rs b/crates/router/src/workflows/outgoing_webhook_retry.rs index 760993decb4..0a9a103a059 100644 --- a/crates/router/src/workflows/outgoing_webhook_retry.rs +++ b/crates/router/src/workflows/outgoing_webhook_retry.rs @@ -17,7 +17,7 @@ use crate::{ core::webhooks::{self as webhooks_core, types::OutgoingWebhookTrackingData}, db::StorageInterface, errors, logger, - routes::{app::ReqState, AppState}, + routes::AppState, types::{domain, storage}, }; @@ -120,7 +120,7 @@ impl ProcessTrackerWorkflow for OutgoingWebhookRetryWorkflow { &key_store, event, request_content, - delivery_attempt, + storage::enums::WebhookDeliveryAttempt::AutomaticRetry, None, Some(process), ) @@ -134,10 +134,8 @@ impl ProcessTrackerWorkflow for OutgoingWebhookRetryWorkflow { .find_merchant_account_by_merchant_id(&tracking_data.merchant_id, &key_store) .await?; - // TODO: Add request state for the PT flows as well let (content, event_type) = get_outgoing_webhook_content_and_event_type( state.clone(), - state.get_req_state(), merchant_account.clone(), key_store.clone(), &tracking_data, @@ -174,7 +172,7 @@ impl ProcessTrackerWorkflow for OutgoingWebhookRetryWorkflow { &key_store, event, request_content, - delivery_attempt, + storage::enums::WebhookDeliveryAttempt::AutomaticRetry, Some(content), Some(process), ) @@ -314,7 +312,6 @@ pub(crate) async fn retry_webhook_delivery_task( #[instrument(skip_all)] async fn get_outgoing_webhook_content_and_event_type( state: AppState, - req_state: ReqState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, tracking_data: &OutgoingWebhookTrackingData, @@ -353,7 +350,6 @@ async fn get_outgoing_webhook_content_and_event_type( let payments_response = match Box::pin(payments_core::( state, - req_state, merchant_account, key_store, PaymentStatus, diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs index 5dbfff8342e..051157f504b 100644 --- a/crates/router/src/workflows/payment_sync.rs +++ b/crates/router/src/workflows/payment_sync.rs @@ -59,7 +59,6 @@ impl ProcessTrackerWorkflow for PaymentsSyncWorkflow { ) .await?; - // TODO: Add support for ReqState in PT flows let (mut payment_data, _, customer, _, _) = Box::pin(payment_flows::payments_operation_core::< api::PSync, @@ -69,7 +68,6 @@ impl ProcessTrackerWorkflow for PaymentsSyncWorkflow { Oss, >( state, - state.get_req_state(), merchant_account.clone(), key_store.clone(), operations::PaymentStatus, @@ -123,9 +121,9 @@ impl ProcessTrackerWorkflow for PaymentsSyncWorkflow { .as_ref() .is_none() { - let payment_intent_update = hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::PGStatusUpdate { status: api_models::enums::IntentStatus::Failed,updated_by: merchant_account.storage_scheme.to_string(), incremental_authorization_allowed: Some(false) }; + let payment_intent_update = data_models::payments::payment_intent::PaymentIntentUpdate::PGStatusUpdate { status: api_models::enums::IntentStatus::Failed,updated_by: merchant_account.storage_scheme.to_string(), incremental_authorization_allowed: Some(false) }; let payment_attempt_update = - hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::ErrorUpdate { + data_models::payments::payment_attempt::PaymentAttemptUpdate::ErrorUpdate { connector: None, status: api_models::enums::AttemptStatus::AuthenticationFailed, error_code: None, @@ -178,11 +176,16 @@ impl ProcessTrackerWorkflow for PaymentsSyncWorkflow { // Trigger the outgoing webhook to notify the merchant about failed payment let operation = operations::PaymentStatus; - Box::pin(utils::trigger_payments_webhook( + Box::pin(utils::trigger_payments_webhook::< + _, + api_models::payments::PaymentsRequest, + _, + >( merchant_account, business_profile, &key_store, payment_data, + None, customer, state, operation, @@ -300,7 +303,7 @@ mod tests { vec![schedule_time_delta, first_retry_time_delta], vec![ cpt_default.start_after, - cpt_default.frequencies.first().unwrap().0 + *cpt_default.frequency.first().unwrap() ] ); } diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs index 710d90a4ea3..a2c05a1a67a 100644 --- a/crates/router/tests/connectors/aci.rs +++ b/crates/router/tests/connectors/aci.rs @@ -1,6 +1,5 @@ use std::{marker::PhantomData, str::FromStr}; -use api_models::payments::{Address, AddressDetails, PhoneDetails}; use masking::Secret; use router::{ configs::settings::Settings, @@ -33,13 +32,15 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData { description: Some("This is a test".to_string()), return_url: None, payment_method_status: None, + payment_method_id: None, request: types::PaymentsAuthorizeData { amount: 1000, currency: enums::Currency::USD, - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(types::api::Card { card_number: cards::CardNumber::from_str("4200000000000000").unwrap(), card_exp_month: Secret::new("10".to_string()), card_exp_year: Secret::new("2025".to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new("999".to_string()), card_issuer: None, card_network: None, @@ -77,22 +78,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData { customer_acceptance: None, }, response: Err(types::ErrorResponse::default()), - address: PaymentAddress::new( - None, - None, - Some(Address { - address: Some(AddressDetails { - first_name: Some(Secret::new("John".to_string())), - last_name: Some(Secret::new("Doe".to_string())), - ..Default::default() - }), - phone: Some(PhoneDetails { - number: Some(Secret::new("8056594427".to_string())), - country_code: Some("+351".to_string()), - }), - email: None, - }), - ), + address: PaymentAddress::default(), connector_meta_data: None, amount_captured: None, access_token: None, @@ -132,6 +118,7 @@ fn construct_refund_router_data() -> types::RefundsRouterData { connector: "aci".to_string(), payment_id: uuid::Uuid::new_v4().to_string(), attempt_id: uuid::Uuid::new_v4().to_string(), + payment_method_id: None, payment_method_status: None, status: enums::AttemptStatus::default(), payment_method: enums::PaymentMethod::Card, @@ -253,10 +240,11 @@ async fn payments_create_failure() { > = connector.connector.get_connector_integration(); let mut request = construct_payment_router_data(); request.request.payment_method_data = - types::domain::PaymentMethodData::Card(types::domain::Card { + types::api::PaymentMethodData::Card(types::api::Card { card_number: cards::CardNumber::from_str("4200000000000000").unwrap(), card_exp_month: Secret::new("10".to_string()), card_exp_year: Secret::new("2025".to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new("99".to_string()), card_issuer: None, card_network: None, diff --git a/crates/router/tests/connectors/adyen.rs b/crates/router/tests/connectors/adyen.rs index 468834ca495..d1b0a3858e3 100644 --- a/crates/router/tests/connectors/adyen.rs +++ b/crates/router/tests/connectors/adyen.rs @@ -1,8 +1,8 @@ use std::str::FromStr; -use api_models::payments::{Address, AddressDetails, PhoneDetails}; +use api_models::payments::{Address, AddressDetails}; use masking::Secret; -use router::types::{self, storage::enums, PaymentAddress}; +use router::types::{self, api, storage::enums, PaymentAddress}; use crate::{ connector_auth, @@ -61,14 +61,9 @@ impl AdyenTest { zip: Some(Secret::new("94122".to_string())), line1: Some(Secret::new("1467".to_string())), line2: Some(Secret::new("Harrison Street".to_string())), - line3: None, - first_name: Some(Secret::new("John".to_string())), - last_name: Some(Secret::new("Dough".to_string())), - }), - phone: Some(PhoneDetails { - number: Some(Secret::new("8056594427".to_string())), - country_code: Some("+351".to_string()), + ..Default::default() }), + phone: None, email: None, }), None, @@ -102,16 +97,16 @@ impl AdyenTest { None, )), payout_method_data: match payout_type { - enums::PayoutType::Card => Some(types::api::PayoutMethodData::Card( - types::api::payouts::CardPayout { + enums::PayoutType::Card => { + Some(api::PayoutMethodData::Card(api::payouts::CardPayout { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), expiry_month: Secret::new("3".to_string()), expiry_year: Secret::new("2030".to_string()), card_holder_name: Some(Secret::new("John Doe".to_string())), - }, - )), - enums::PayoutType::Bank => Some(types::api::PayoutMethodData::Bank( - types::api::payouts::BankPayout::Sepa(types::api::SepaBankTransfer { + })) + } + enums::PayoutType::Bank => Some(api::PayoutMethodData::Bank( + api::payouts::BankPayout::Sepa(api::SepaBankTransfer { iban: "NL46TEST0136169112".to_string().into(), bic: Some("ABNANL2A".to_string().into()), bank_name: Some("Deutsche Bank".to_string()), @@ -119,11 +114,9 @@ impl AdyenTest { bank_city: Some("Amsterdam".to_string()), }), )), - enums::PayoutType::Wallet => Some(types::api::PayoutMethodData::Wallet( - types::api::payouts::WalletPayout::Paypal(api_models::payouts::Paypal { + enums::PayoutType::Wallet => Some(api::PayoutMethodData::Wallet( + api::payouts::WalletPayout::Paypal(api_models::payouts::Paypal { email: Email::from_str("EmailUsedForPayPalAccount@example.com").ok(), - telephone_number: None, - paypal_id: None, }), )), }, @@ -141,10 +134,11 @@ impl AdyenTest { Some(types::PaymentsAuthorizeData { amount: 3500, currency: enums::Currency::USD, - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(types::api::Card { card_number: cards::CardNumber::from_str(card_number).unwrap(), card_exp_month: Secret::new(card_exp_month.to_string()), card_exp_year: Secret::new(card_exp_year.to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new(card_cvc.to_string()), card_issuer: None, card_network: None, @@ -443,7 +437,7 @@ async fn should_refund_succeeded_payment_multiple_times() { } } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { @@ -451,7 +445,7 @@ async fn should_fail_payment_for_incorrect_card_number() { .make_payment( Some(types::PaymentsAuthorizeData { router_return_url: Some(String::from("http://localhost:8080")), - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4024007134364842").unwrap(), ..utils::CCardType::default().0 }), @@ -471,7 +465,7 @@ async fn should_fail_payment_for_incorrect_cvc() { .make_payment( Some(types::PaymentsAuthorizeData { router_return_url: Some(String::from("http://localhost:8080")), - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -494,7 +488,7 @@ async fn should_fail_payment_for_invalid_exp_month() { .make_payment( Some(types::PaymentsAuthorizeData { router_return_url: Some(String::from("http://localhost:8080")), - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -515,7 +509,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { .make_payment( Some(types::PaymentsAuthorizeData { router_return_url: Some(String::from("http://localhost:8080")), - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/airwallex.rs b/crates/router/tests/connectors/airwallex.rs index 95b07162ac3..cfc4c0c003d 100644 --- a/crates/router/tests/connectors/airwallex.rs +++ b/crates/router/tests/connectors/airwallex.rs @@ -1,8 +1,7 @@ use std::str::FromStr; -use api_models::payments::{Address, AddressDetails}; use masking::{PeekInterface, Secret}; -use router::types::{self, domain, storage::enums, AccessToken}; +use router::types::{self, api, storage::enums, AccessToken}; use crate::{ connector_auth, @@ -52,28 +51,16 @@ fn get_access_token() -> Option { fn get_default_payment_info() -> Option { Some(utils::PaymentInfo { access_token: get_access_token(), - address: Some(types::PaymentAddress::new( - None, - None, - Some(Address { - address: Some(AddressDetails { - first_name: Some(Secret::new("John".to_string())), - last_name: Some(Secret::new("Doe".to_string())), - ..Default::default() - }), - phone: None, - email: None, - }), - )), ..Default::default() }) } fn payment_method_details() -> Option { Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4035501000000008").unwrap(), card_exp_month: Secret::new("02".to_string()), card_exp_year: Secret::new("2035".to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new("123".to_string()), card_issuer: None, card_network: None, @@ -362,7 +349,7 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[serial_test::serial] #[actix_web::test] @@ -370,7 +357,7 @@ async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("1234567891011").unwrap(), ..utils::CCardType::default().0 }), @@ -393,7 +380,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -416,7 +403,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -439,7 +426,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/authorizedotnet.rs b/crates/router/tests/connectors/authorizedotnet.rs index 2b9a79b0b7b..3ae4298e836 100644 --- a/crates/router/tests/connectors/authorizedotnet.rs +++ b/crates/router/tests/connectors/authorizedotnet.rs @@ -1,11 +1,11 @@ use std::str::FromStr; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, - utils::{self, ConnectorActions, PaymentInfo}, + utils::{self, ConnectorActions}, }; #[derive(Clone, Copy)] @@ -37,11 +37,12 @@ impl utils::Connector for AuthorizedotnetTest { } static CONNECTOR: AuthorizedotnetTest = AuthorizedotnetTest {}; -fn get_payment_method_data() -> domain::Card { - domain::Card { +fn get_payment_method_data() -> api::Card { + api::Card { card_number: cards::CardNumber::from_str("5424000000000015").unwrap(), card_exp_month: Secret::new("02".to_string()), card_exp_year: Secret::new("2035".to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new("123".to_string()), ..Default::default() } @@ -55,13 +56,11 @@ async fn should_only_authorize_payment() { .authorize_payment( Some(types::PaymentsAuthorizeData { amount: 300, - payment_method_data: types::domain::PaymentMethodData::Card( - get_payment_method_data(), - ), + payment_method_data: types::api::PaymentMethodData::Card(get_payment_method_data()), capture_method: Some(diesel_models::enums::CaptureMethod::Manual), ..utils::PaymentAuthorizeType::default().0 }), - Some(PaymentInfo::with_default_billing_name()), + None, ) .await .expect("Authorize payment response"); @@ -92,13 +91,11 @@ async fn should_capture_authorized_payment() { .authorize_payment( Some(types::PaymentsAuthorizeData { amount: 301, - payment_method_data: types::domain::PaymentMethodData::Card( - get_payment_method_data(), - ), + payment_method_data: types::api::PaymentMethodData::Card(get_payment_method_data()), capture_method: Some(diesel_models::enums::CaptureMethod::Manual), ..utils::PaymentAuthorizeType::default().0 }), - Some(PaymentInfo::with_default_billing_name()), + None, ) .await .expect("Authorize payment response"); @@ -156,13 +153,11 @@ async fn should_partially_capture_authorized_payment() { .authorize_payment( Some(types::PaymentsAuthorizeData { amount: 302, - payment_method_data: types::domain::PaymentMethodData::Card( - get_payment_method_data(), - ), + payment_method_data: types::api::PaymentMethodData::Card(get_payment_method_data()), capture_method: Some(diesel_models::enums::CaptureMethod::Manual), ..utils::PaymentAuthorizeType::default().0 }), - Some(PaymentInfo::with_default_billing_name()), + None, ) .await .expect("Authorize payment response"); @@ -220,13 +215,11 @@ async fn should_sync_authorized_payment() { .authorize_payment( Some(types::PaymentsAuthorizeData { amount: 303, - payment_method_data: types::domain::PaymentMethodData::Card( - get_payment_method_data(), - ), + payment_method_data: types::api::PaymentMethodData::Card(get_payment_method_data()), capture_method: Some(diesel_models::enums::CaptureMethod::Manual), ..utils::PaymentAuthorizeType::default().0 }), - Some(PaymentInfo::with_default_billing_name()), + None, ) .await .expect("Authorize payment response"); @@ -256,13 +249,11 @@ async fn should_void_authorized_payment() { .authorize_payment( Some(types::PaymentsAuthorizeData { amount: 304, - payment_method_data: types::domain::PaymentMethodData::Card( - get_payment_method_data(), - ), + payment_method_data: types::api::PaymentMethodData::Card(get_payment_method_data()), capture_method: Some(diesel_models::enums::CaptureMethod::Manual), ..utils::PaymentAuthorizeType::default().0 }), - Some(PaymentInfo::with_default_billing_name()), + None, ) .await .expect("Authorize payment response"); @@ -307,9 +298,7 @@ async fn should_make_payment() { .make_payment( Some(types::PaymentsAuthorizeData { amount: 310, - payment_method_data: types::domain::PaymentMethodData::Card( - get_payment_method_data(), - ), + payment_method_data: types::api::PaymentMethodData::Card(get_payment_method_data()), capture_method: Some(diesel_models::enums::CaptureMethod::Manual), ..utils::PaymentAuthorizeType::default().0 }), @@ -347,9 +336,7 @@ async fn should_sync_auto_captured_payment() { .make_payment( Some(types::PaymentsAuthorizeData { amount: 311, - payment_method_data: types::domain::PaymentMethodData::Card( - get_payment_method_data(), - ), + payment_method_data: types::api::PaymentMethodData::Card(get_payment_method_data()), capture_method: Some(diesel_models::enums::CaptureMethod::Manual), ..utils::PaymentAuthorizeType::default().0 }), @@ -402,7 +389,7 @@ async fn should_fail_payment_for_empty_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("").unwrap(), ..utils::CCardType::default().0 }), @@ -425,7 +412,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -448,7 +435,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -470,7 +457,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), @@ -493,9 +480,7 @@ async fn should_fail_void_payment_for_auto_capture() { .make_payment( Some(types::PaymentsAuthorizeData { amount: 307, - payment_method_data: types::domain::PaymentMethodData::Card( - get_payment_method_data(), - ), + payment_method_data: types::api::PaymentMethodData::Card(get_payment_method_data()), capture_method: Some(diesel_models::enums::CaptureMethod::Manual), ..utils::PaymentAuthorizeType::default().0 }), diff --git a/crates/router/tests/connectors/bambora.rs b/crates/router/tests/connectors/bambora.rs index 5cd82d097aa..9da29bb3033 100644 --- a/crates/router/tests/connectors/bambora.rs +++ b/crates/router/tests/connectors/bambora.rs @@ -1,7 +1,8 @@ use std::str::FromStr; +use api_models::payments::PaymentMethodData; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -40,7 +41,7 @@ static CONNECTOR: BamboraTest = BamboraTest {}; fn get_default_payment_authorize_data() -> Option { Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4030000010001234").unwrap(), card_exp_year: Secret::new("25".to_string()), card_cvc: Secret::new("123".to_string()), @@ -109,7 +110,6 @@ async fn should_sync_authorized_payment() { sync_type: types::SyncRequestType::SinglePaymentSync, connector_meta: None, payment_method_type: None, - currency: enums::Currency::USD, }), None, ) @@ -225,7 +225,6 @@ async fn should_sync_auto_captured_payment() { sync_type: types::SyncRequestType::SinglePaymentSync, connector_meta: None, payment_method_type: None, - currency: enums::Currency::USD, }), None, ) @@ -289,14 +288,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("1234567891011").unwrap(), card_exp_year: Secret::new("25".to_string()), ..utils::CCardType::default().0 @@ -319,7 +318,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("25".to_string()), card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 @@ -342,7 +341,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), card_number: cards::CardNumber::from_str("4030000010001234").unwrap(), card_exp_year: Secret::new("25".to_string()), @@ -367,7 +366,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), card_number: cards::CardNumber::from_str("4030000010001234").unwrap(), card_cvc: Secret::new("123".to_string()), diff --git a/crates/router/tests/connectors/bankofamerica.rs b/crates/router/tests/connectors/bankofamerica.rs index ca54e9c97b9..766078fa19c 100644 --- a/crates/router/tests/connectors/bankofamerica.rs +++ b/crates/router/tests/connectors/bankofamerica.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -296,14 +296,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -325,7 +325,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -347,7 +347,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/billwerk.rs b/crates/router/tests/connectors/billwerk.rs index 6795aa40115..1dec066e5d2 100644 --- a/crates/router/tests/connectors/billwerk.rs +++ b/crates/router/tests/connectors/billwerk.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -296,14 +296,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -325,7 +325,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -347,7 +347,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/bitpay.rs b/crates/router/tests/connectors/bitpay.rs index df82775d6cf..d26a4c0cd6b 100644 --- a/crates/router/tests/connectors/bitpay.rs +++ b/crates/router/tests/connectors/bitpay.rs @@ -1,5 +1,6 @@ +use api_models::payments::CryptoData; use masking::Secret; -use router::types::{self, api, domain, storage::enums, PaymentAddress}; +use router::types::{self, api, storage::enums, PaymentAddress}; use crate::{ connector_auth, @@ -67,7 +68,7 @@ fn payment_method_details() -> Option { Some(types::PaymentsAuthorizeData { amount: 1, currency: enums::Currency::USD, - payment_method_data: types::domain::PaymentMethodData::Crypto(domain::CryptoData { + payment_method_data: types::api::PaymentMethodData::Crypto(CryptoData { pay_currency: None, }), confirm: true, diff --git a/crates/router/tests/connectors/bluesnap.rs b/crates/router/tests/connectors/bluesnap.rs index 2e02f259341..ac89e4e6ea5 100644 --- a/crates/router/tests/connectors/bluesnap.rs +++ b/crates/router/tests/connectors/bluesnap.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use api_models::payments::{Address, AddressDetails}; use common_utils::pii::Email; use masking::Secret; -use router::types::{self, domain, storage::enums, ConnectorAuthType, PaymentAddress}; +use router::types::{self, api, storage::enums, ConnectorAuthType, PaymentAddress}; use crate::{ connector_auth, @@ -401,7 +401,8 @@ async fn should_fail_payment_for_incorrect_cvc() { .make_payment( Some(types::PaymentsAuthorizeData { email: Some(Email::from_str("test@gmail.com").unwrap()), - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -426,7 +427,8 @@ async fn should_fail_payment_for_invalid_exp_month() { .make_payment( Some(types::PaymentsAuthorizeData { email: Some(Email::from_str("test@gmail.com").unwrap()), - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -451,7 +453,8 @@ async fn should_fail_payment_for_incorrect_expiry_year() { .make_payment( Some(types::PaymentsAuthorizeData { email: Some(Email::from_str("test@gmail.com").unwrap()), - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/boku.rs b/crates/router/tests/connectors/boku.rs index 2f496562e1d..9c8ac961cac 100644 --- a/crates/router/tests/connectors/boku.rs +++ b/crates/router/tests/connectors/boku.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -295,14 +295,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -324,7 +324,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -346,7 +346,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/cashtocode.rs b/crates/router/tests/connectors/cashtocode.rs index 616a080699b..c8dd4abff23 100644 --- a/crates/router/tests/connectors/cashtocode.rs +++ b/crates/router/tests/connectors/cashtocode.rs @@ -1,5 +1,5 @@ use api_models::payments::{Address, AddressDetails}; -use router::types::{self, domain, storage::enums}; +use router::types::{self, storage::enums}; use crate::{ connector_auth, @@ -39,7 +39,7 @@ static CONNECTOR: CashtocodeTest = CashtocodeTest {}; impl CashtocodeTest { fn get_payment_authorize_data( payment_method_type: Option, - payment_method_data: types::domain::PaymentMethodData, + payment_method_data: types::api::PaymentMethodData, ) -> Option { Some(types::PaymentsAuthorizeData { amount: 1000, @@ -102,7 +102,7 @@ async fn should_fetch_pay_url_classic() { .make_payment( CashtocodeTest::get_payment_authorize_data( Some(enums::PaymentMethodType::ClassicReward), - domain::payments::PaymentMethodData::Reward, + api_models::payments::PaymentMethodData::Reward, ), CashtocodeTest::get_payment_info(), ) @@ -120,7 +120,7 @@ async fn should_fetch_pay_url_evoucher() { .make_payment( CashtocodeTest::get_payment_authorize_data( Some(enums::PaymentMethodType::Evoucher), - domain::payments::PaymentMethodData::Reward, + api_models::payments::PaymentMethodData::Reward, ), CashtocodeTest::get_payment_info(), ) diff --git a/crates/router/tests/connectors/checkout.rs b/crates/router/tests/connectors/checkout.rs index 85b55afc8ea..1c369332ef2 100644 --- a/crates/router/tests/connectors/checkout.rs +++ b/crates/router/tests/connectors/checkout.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -311,7 +311,7 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[serial_test::serial] @@ -320,7 +320,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -343,7 +343,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -366,7 +366,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/coinbase.rs b/crates/router/tests/connectors/coinbase.rs index 0136284c826..a88f1380944 100644 --- a/crates/router/tests/connectors/coinbase.rs +++ b/crates/router/tests/connectors/coinbase.rs @@ -1,5 +1,6 @@ +use api_models::payments::CryptoData; use masking::Secret; -use router::types::{self, api, domain, storage::enums, PaymentAddress}; +use router::types::{self, api, storage::enums, PaymentAddress}; use serde_json::json; use crate::{ @@ -69,7 +70,7 @@ fn payment_method_details() -> Option { Some(types::PaymentsAuthorizeData { amount: 1, currency: enums::Currency::USD, - payment_method_data: types::domain::PaymentMethodData::Crypto(domain::CryptoData { + payment_method_data: types::api::PaymentMethodData::Crypto(CryptoData { pay_currency: None, }), confirm: true, diff --git a/crates/router/tests/connectors/cryptopay.rs b/crates/router/tests/connectors/cryptopay.rs index 56c0e29f621..4d7825f7dec 100644 --- a/crates/router/tests/connectors/cryptopay.rs +++ b/crates/router/tests/connectors/cryptopay.rs @@ -1,5 +1,6 @@ +use api_models::payments::CryptoData; use masking::Secret; -use router::types::{self, api, domain, storage::enums, PaymentAddress}; +use router::types::{self, api, storage::enums, PaymentAddress}; use crate::{ connector_auth, @@ -68,7 +69,7 @@ fn payment_method_details() -> Option { Some(types::PaymentsAuthorizeData { amount: 1, currency: enums::Currency::USD, - payment_method_data: types::domain::PaymentMethodData::Crypto(domain::CryptoData { + payment_method_data: types::api::PaymentMethodData::Crypto(CryptoData { pay_currency: Some("XRP".to_string()), }), confirm: true, diff --git a/crates/router/tests/connectors/cybersource.rs b/crates/router/tests/connectors/cybersource.rs index 98ec44abd8a..d438ff45f62 100644 --- a/crates/router/tests/connectors/cybersource.rs +++ b/crates/router/tests/connectors/cybersource.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use common_utils::pii::Email; use masking::Secret; use router::types::{ - self, api, domain, + self, api, storage::{self, enums}, }; @@ -160,7 +160,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = Cybersource {} .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("13".to_string()), ..utils::CCardType::default().0 }), @@ -185,7 +185,7 @@ async fn should_fail_payment_for_invalid_exp_year() { let response = Cybersource {} .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2022".to_string()), ..utils::CCardType::default().0 }), @@ -203,7 +203,7 @@ async fn should_fail_payment_for_invalid_card_cvc() { let response = Cybersource {} .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("2131233213".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/dlocal.rs b/crates/router/tests/connectors/dlocal.rs index edb24646bcb..0767bb9ac3c 100644 --- a/crates/router/tests/connectors/dlocal.rs +++ b/crates/router/tests/connectors/dlocal.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use api_models::payments::Address; use masking::Secret; -use router::types::{self, api, domain, storage::enums, PaymentAddress}; +use router::types::{self, api, storage::enums, PaymentAddress}; use crate::{ connector_auth, @@ -282,14 +282,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("1891011").unwrap(), ..utils::CCardType::default().0 }), @@ -310,7 +310,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("1ad2345".to_string()), ..utils::CCardType::default().0 }), @@ -331,7 +331,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("201".to_string()), ..utils::CCardType::default().0 }), @@ -352,7 +352,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("20001".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/dummyconnector.rs b/crates/router/tests/connectors/dummyconnector.rs index 76f72b64907..75252e85edc 100644 --- a/crates/router/tests/connectors/dummyconnector.rs +++ b/crates/router/tests/connectors/dummyconnector.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use cards::CardNumber; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -298,14 +298,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: CardNumber::from_str("1234567891011").unwrap(), ..utils::CCardType::default().0 }), @@ -327,7 +327,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -349,7 +349,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -371,7 +371,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/ebanx.rs b/crates/router/tests/connectors/ebanx.rs deleted file mode 100644 index 8571ed1e3f8..00000000000 --- a/crates/router/tests/connectors/ebanx.rs +++ /dev/null @@ -1,420 +0,0 @@ -use masking::Secret; -use router::types::{self, storage::enums}; -use test_utils::connector_auth; - -use crate::utils::{self, ConnectorActions}; - -#[derive(Clone, Copy)] -struct EbanxTest; -impl ConnectorActions for EbanxTest {} -impl utils::Connector for EbanxTest { - fn get_data(&self) -> types::api::ConnectorData { - use router::connector::Ebanx; - types::api::ConnectorData { - connector: Box::new(&Ebanx), - connector_name: types::Connector::Ebanx, - get_token: types::api::GetToken::Connector, - merchant_connector_id: None, - } - } - - fn get_auth_token(&self) -> types::ConnectorAuthType { - utils::to_connector_auth_type( - connector_auth::ConnectorAuthentication::new() - .ebanx - .expect("Missing connector authentication configuration") - .into(), - ) - } - - fn get_name(&self) -> String { - "ebanx".to_string() - } -} - -static CONNECTOR: EbanxTest = EbanxTest {}; - -fn get_default_payment_info() -> Option { - None -} - -fn payment_method_details() -> Option { - None -} - -// Cards Positive Tests -// Creates a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_only_authorize_payment() { - let response = CONNECTOR - .authorize_payment(payment_method_details(), get_default_payment_info()) - .await - .expect("Authorize payment response"); - assert_eq!(response.status, enums::AttemptStatus::Authorized); -} - -// Captures a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_capture_authorized_payment() { - let response = CONNECTOR - .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info()) - .await - .expect("Capture payment response"); - assert_eq!(response.status, enums::AttemptStatus::Charged); -} - -// Partially captures a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_partially_capture_authorized_payment() { - let response = CONNECTOR - .authorize_and_capture_payment( - payment_method_details(), - Some(types::PaymentsCaptureData { - amount_to_capture: 50, - ..utils::PaymentCaptureType::default().0 - }), - get_default_payment_info(), - ) - .await - .expect("Capture payment response"); - assert_eq!(response.status, enums::AttemptStatus::Charged); -} - -// Synchronizes a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_sync_authorized_payment() { - let authorize_response = CONNECTOR - .authorize_payment(payment_method_details(), get_default_payment_info()) - .await - .expect("Authorize payment response"); - let txn_id = utils::get_connector_transaction_id(authorize_response.response); - let response = CONNECTOR - .psync_retry_till_status_matches( - enums::AttemptStatus::Authorized, - Some(types::PaymentsSyncData { - connector_transaction_id: router::types::ResponseId::ConnectorTransactionId( - txn_id.unwrap(), - ), - ..Default::default() - }), - get_default_payment_info(), - ) - .await - .expect("PSync response"); - assert_eq!(response.status, enums::AttemptStatus::Authorized,); -} - -// Voids a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_void_authorized_payment() { - let response = CONNECTOR - .authorize_and_void_payment( - payment_method_details(), - Some(types::PaymentsCancelData { - connector_transaction_id: String::from(""), - cancellation_reason: Some("requested_by_customer".to_string()), - ..Default::default() - }), - get_default_payment_info(), - ) - .await - .expect("Void payment response"); - assert_eq!(response.status, enums::AttemptStatus::Voided); -} - -// Refunds a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_refund_manually_captured_payment() { - let response = CONNECTOR - .capture_payment_and_refund( - payment_method_details(), - None, - None, - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Partially refunds a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_partially_refund_manually_captured_payment() { - let response = CONNECTOR - .capture_payment_and_refund( - payment_method_details(), - None, - Some(types::RefundsData { - refund_amount: 50, - ..utils::PaymentRefundType::default().0 - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Synchronizes a refund using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_sync_manually_captured_refund() { - let refund_response = CONNECTOR - .capture_payment_and_refund( - payment_method_details(), - None, - None, - get_default_payment_info(), - ) - .await - .unwrap(); - let response = CONNECTOR - .rsync_retry_till_status_matches( - enums::RefundStatus::Success, - refund_response.response.unwrap().connector_refund_id, - None, - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Creates a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_make_payment() { - let authorize_response = CONNECTOR - .make_payment(payment_method_details(), get_default_payment_info()) - .await - .unwrap(); - assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); -} - -// Synchronizes a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_sync_auto_captured_payment() { - let authorize_response = CONNECTOR - .make_payment(payment_method_details(), get_default_payment_info()) - .await - .unwrap(); - assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); - let txn_id = utils::get_connector_transaction_id(authorize_response.response); - assert_ne!(txn_id, None, "Empty connector transaction id"); - let response = CONNECTOR - .psync_retry_till_status_matches( - enums::AttemptStatus::Charged, - Some(types::PaymentsSyncData { - connector_transaction_id: router::types::ResponseId::ConnectorTransactionId( - txn_id.unwrap(), - ), - capture_method: Some(enums::CaptureMethod::Automatic), - ..Default::default() - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!(response.status, enums::AttemptStatus::Charged,); -} - -// Refunds a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_refund_auto_captured_payment() { - let response = CONNECTOR - .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Partially refunds a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_partially_refund_succeeded_payment() { - let refund_response = CONNECTOR - .make_payment_and_refund( - payment_method_details(), - Some(types::RefundsData { - refund_amount: 50, - ..utils::PaymentRefundType::default().0 - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - refund_response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_refund_succeeded_payment_multiple_times() { - CONNECTOR - .make_payment_and_multiple_refund( - payment_method_details(), - Some(types::RefundsData { - refund_amount: 50, - ..utils::PaymentRefundType::default().0 - }), - get_default_payment_info(), - ) - .await; -} - -// Synchronizes a refund using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_sync_refund() { - let refund_response = CONNECTOR - .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) - .await - .unwrap(); - let response = CONNECTOR - .rsync_retry_till_status_matches( - enums::RefundStatus::Success, - refund_response.response.unwrap().connector_refund_id, - None, - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Cards Negative scenarios -// Creates a payment with incorrect CVC. -#[actix_web::test] -async fn should_fail_payment_for_incorrect_cvc() { - let response = CONNECTOR - .make_payment( - Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { - card_cvc: Secret::new("12345".to_string()), - ..utils::CCardType::default().0 - }), - ..utils::PaymentAuthorizeType::default().0 - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap_err().message, - "Your card's security code is invalid.".to_string(), - ); -} - -// Creates a payment with incorrect expiry month. -#[actix_web::test] -async fn should_fail_payment_for_invalid_exp_month() { - let response = CONNECTOR - .make_payment( - Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { - card_exp_month: Secret::new("20".to_string()), - ..utils::CCardType::default().0 - }), - ..utils::PaymentAuthorizeType::default().0 - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap_err().message, - "Your card's expiration month is invalid.".to_string(), - ); -} - -// Creates a payment with incorrect expiry year. -#[actix_web::test] -async fn should_fail_payment_for_incorrect_expiry_year() { - let response = CONNECTOR - .make_payment( - Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { - card_exp_year: Secret::new("2000".to_string()), - ..utils::CCardType::default().0 - }), - ..utils::PaymentAuthorizeType::default().0 - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap_err().message, - "Your card's expiration year is invalid.".to_string(), - ); -} - -// Voids a payment using automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_fail_void_payment_for_auto_capture() { - let authorize_response = CONNECTOR - .make_payment(payment_method_details(), get_default_payment_info()) - .await - .unwrap(); - assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); - let txn_id = utils::get_connector_transaction_id(authorize_response.response); - assert_ne!(txn_id, None, "Empty connector transaction id"); - let void_response = CONNECTOR - .void_payment(txn_id.unwrap(), None, get_default_payment_info()) - .await - .unwrap(); - assert_eq!( - void_response.response.unwrap_err().message, - "You cannot cancel this PaymentIntent because it has a status of succeeded." - ); -} - -// Captures a payment using invalid connector payment id. -#[actix_web::test] -async fn should_fail_capture_for_invalid_payment() { - let capture_response = CONNECTOR - .capture_payment("123456789".to_string(), None, get_default_payment_info()) - .await - .unwrap(); - assert_eq!( - capture_response.response.unwrap_err().message, - String::from("No such payment_intent: '123456789'") - ); -} - -// Refunds a payment with refund amount higher than payment amount. -#[actix_web::test] -async fn should_fail_for_refund_amount_higher_than_payment_amount() { - let response = CONNECTOR - .make_payment_and_refund( - payment_method_details(), - Some(types::RefundsData { - refund_amount: 150, - ..utils::PaymentRefundType::default().0 - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap_err().message, - "Refund amount (₹1.50) is greater than charge amount (₹1.00)", - ); -} - -// Connector dependent test cases goes here - -// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests diff --git a/crates/router/tests/connectors/fiserv.rs b/crates/router/tests/connectors/fiserv.rs index 050d6a54067..36d5f66dbcc 100644 --- a/crates/router/tests/connectors/fiserv.rs +++ b/crates/router/tests/connectors/fiserv.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use serde_json::json; use crate::{ @@ -42,10 +42,11 @@ impl utils::Connector for FiservTest { fn payment_method_details() -> Option { Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4005550000000019").unwrap(), card_exp_month: Secret::new("02".to_string()), card_exp_year: Secret::new("2035".to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new("123".to_string()), card_issuer: None, card_network: None, @@ -62,7 +63,7 @@ fn payment_method_details() -> Option { fn get_default_payment_info() -> Option { Some(utils::PaymentInfo { connector_meta_data: Some(json!({"terminalId": "10000001"})), - ..utils::PaymentInfo::with_default_billing_name() + ..Default::default() }) } @@ -339,7 +340,7 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] #[serial_test::serial] @@ -347,7 +348,7 @@ async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("1234567891011").unwrap(), ..utils::CCardType::default().0 }), @@ -370,7 +371,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -393,7 +394,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -416,7 +417,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/forte.rs b/crates/router/tests/connectors/forte.rs index c58cab38a22..19dbaa26f35 100644 --- a/crates/router/tests/connectors/forte.rs +++ b/crates/router/tests/connectors/forte.rs @@ -2,7 +2,7 @@ use std::{str::FromStr, time::Duration}; use cards::CardNumber; use masking::Secret; -use router::types::{self, api, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -41,7 +41,7 @@ static CONNECTOR: ForteTest = ForteTest {}; fn get_payment_data() -> Option { Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: CardNumber::from_str("4111111111111111").unwrap(), ..utils::CCardType::default().0 }), @@ -157,7 +157,6 @@ async fn should_sync_authorized_payment() { connector_meta: None, mandate_id: None, payment_method_type: None, - currency: enums::Currency::USD, }), get_default_payment_info(), ) @@ -460,14 +459,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -489,7 +488,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -512,7 +511,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), @@ -624,13 +623,13 @@ async fn should_fail_for_refund_amount_higher_than_payment_amount() { // [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card issuer. #[actix_web::test] async fn should_throw_not_implemented_for_unsupported_issuer() { let authorize_data = Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: CardNumber::from_str("6759649826438453").unwrap(), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/globalpay.rs b/crates/router/tests/connectors/globalpay.rs index e2ca19869f5..8afa2f0ccf5 100644 --- a/crates/router/tests/connectors/globalpay.rs +++ b/crates/router/tests/connectors/globalpay.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use masking::Secret; -use router::types::{self, api, domain, storage::enums, AccessToken, ConnectorAuthType}; +use router::types::{self, api, storage::enums, AccessToken, ConnectorAuthType}; use serde_json::json; use crate::{ @@ -137,7 +137,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4024007134364842").unwrap(), ..utils::CCardType::default().0 }), @@ -345,7 +345,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), @@ -367,7 +367,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/globepay.rs b/crates/router/tests/connectors/globepay.rs index 70167970210..fcf61dd6b33 100644 --- a/crates/router/tests/connectors/globepay.rs +++ b/crates/router/tests/connectors/globepay.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -297,14 +297,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -326,7 +326,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -348,7 +348,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/gocardless.rs b/crates/router/tests/connectors/gocardless.rs index 0564ea7da6d..f19e90941b2 100644 --- a/crates/router/tests/connectors/gocardless.rs +++ b/crates/router/tests/connectors/gocardless.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -295,14 +295,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -324,7 +324,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -346,7 +346,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/helcim.rs b/crates/router/tests/connectors/helcim.rs index dc3bb4d47e6..c9a891988f3 100644 --- a/crates/router/tests/connectors/helcim.rs +++ b/crates/router/tests/connectors/helcim.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -295,14 +295,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -324,7 +324,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -346,7 +346,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs index eb1c00a227b..eb428a36cb9 100644 --- a/crates/router/tests/connectors/main.rs +++ b/crates/router/tests/connectors/main.rs @@ -26,7 +26,6 @@ mod cybersource; mod dlocal; #[cfg(feature = "dummy_connector")] mod dummyconnector; -mod ebanx; mod fiserv; mod forte; mod globalpay; @@ -36,7 +35,6 @@ mod helcim; mod iatapay; mod mollie; mod multisafepay; -mod netcetera; mod nexinets; mod nmi; mod noon; @@ -66,4 +64,3 @@ mod wise; mod worldline; mod worldpay; mod zen; -mod zsl; diff --git a/crates/router/tests/connectors/multisafepay.rs b/crates/router/tests/connectors/multisafepay.rs index f35fe05bf36..98b615b8034 100644 --- a/crates/router/tests/connectors/multisafepay.rs +++ b/crates/router/tests/connectors/multisafepay.rs @@ -1,6 +1,6 @@ use api_models::payments::{Address, AddressDetails}; use masking::Secret; -use router::types::{self, domain, storage::enums, PaymentAddress}; +use router::types::{self, api, storage::enums, PaymentAddress}; use crate::{ connector_auth, @@ -323,7 +323,7 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[ignore = "Connector doesn't fail invalid cvv scenario"] #[actix_web::test] @@ -331,7 +331,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("123498765".to_string()), ..utils::CCardType::default().0 }), @@ -350,7 +350,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -369,7 +369,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/netcetera.rs b/crates/router/tests/connectors/netcetera.rs deleted file mode 100644 index f06e2a0f5d7..00000000000 --- a/crates/router/tests/connectors/netcetera.rs +++ /dev/null @@ -1,352 +0,0 @@ -use router::types::{self, storage::enums}; -use test_utils::connector_auth; - -use crate::utils::{self, ConnectorActions}; - -#[derive(Clone, Copy)] -struct NetceteraTest; -impl ConnectorActions for NetceteraTest {} -impl utils::Connector for NetceteraTest { - fn get_data(&self) -> types::api::ConnectorData { - use router::connector::Netcetera; - types::api::ConnectorData { - connector: Box::new(&Netcetera), - connector_name: types::Connector::Netcetera, - get_token: types::api::GetToken::Connector, - merchant_connector_id: None, - } - } - - fn get_auth_token(&self) -> types::ConnectorAuthType { - utils::to_connector_auth_type( - connector_auth::ConnectorAuthentication::new() - .netcetera - .expect("Missing connector authentication configuration") - .into(), - ) - } - - fn get_name(&self) -> String { - "netcetera".to_string() - } -} - -static CONNECTOR: NetceteraTest = NetceteraTest {}; - -fn get_default_payment_info() -> Option { - None -} - -fn payment_method_details() -> Option { - None -} - -// Cards Positive Tests -// Creates a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_only_authorize_payment() { - let response = CONNECTOR - .authorize_payment(payment_method_details(), get_default_payment_info()) - .await - .expect("Authorize payment response"); - assert_eq!(response.status, enums::AttemptStatus::Authorized); -} - -// Captures a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_capture_authorized_payment() { - let response = CONNECTOR - .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info()) - .await - .expect("Capture payment response"); - assert_eq!(response.status, enums::AttemptStatus::Charged); -} - -// Partially captures a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_partially_capture_authorized_payment() { - let response = CONNECTOR - .authorize_and_capture_payment( - payment_method_details(), - Some(types::PaymentsCaptureData { - amount_to_capture: 50, - ..utils::PaymentCaptureType::default().0 - }), - get_default_payment_info(), - ) - .await - .expect("Capture payment response"); - assert_eq!(response.status, enums::AttemptStatus::Charged); -} - -// Synchronizes a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_sync_authorized_payment() { - let authorize_response = CONNECTOR - .authorize_payment(payment_method_details(), get_default_payment_info()) - .await - .expect("Authorize payment response"); - let txn_id = utils::get_connector_transaction_id(authorize_response.response); - let response = CONNECTOR - .psync_retry_till_status_matches( - enums::AttemptStatus::Authorized, - Some(types::PaymentsSyncData { - connector_transaction_id: router::types::ResponseId::ConnectorTransactionId( - txn_id.unwrap(), - ), - ..Default::default() - }), - get_default_payment_info(), - ) - .await - .expect("PSync response"); - assert_eq!(response.status, enums::AttemptStatus::Authorized,); -} - -// Voids a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_void_authorized_payment() { - let response = CONNECTOR - .authorize_and_void_payment( - payment_method_details(), - Some(types::PaymentsCancelData { - connector_transaction_id: String::from(""), - cancellation_reason: Some("requested_by_customer".to_string()), - ..Default::default() - }), - get_default_payment_info(), - ) - .await - .expect("Void payment response"); - assert_eq!(response.status, enums::AttemptStatus::Voided); -} - -// Refunds a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_refund_manually_captured_payment() { - let response = CONNECTOR - .capture_payment_and_refund( - payment_method_details(), - None, - None, - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Partially refunds a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_partially_refund_manually_captured_payment() { - let response = CONNECTOR - .capture_payment_and_refund( - payment_method_details(), - None, - Some(types::RefundsData { - refund_amount: 50, - ..utils::PaymentRefundType::default().0 - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Synchronizes a refund using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_sync_manually_captured_refund() { - let refund_response = CONNECTOR - .capture_payment_and_refund( - payment_method_details(), - None, - None, - get_default_payment_info(), - ) - .await - .unwrap(); - let response = CONNECTOR - .rsync_retry_till_status_matches( - enums::RefundStatus::Success, - refund_response.response.unwrap().connector_refund_id, - None, - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Creates a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_make_payment() { - let authorize_response = CONNECTOR - .make_payment(payment_method_details(), get_default_payment_info()) - .await - .unwrap(); - assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); -} - -// Synchronizes a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_sync_auto_captured_payment() { - let authorize_response = CONNECTOR - .make_payment(payment_method_details(), get_default_payment_info()) - .await - .unwrap(); - assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); - let txn_id = utils::get_connector_transaction_id(authorize_response.response); - assert_ne!(txn_id, None, "Empty connector transaction id"); - let response = CONNECTOR - .psync_retry_till_status_matches( - enums::AttemptStatus::Charged, - Some(types::PaymentsSyncData { - connector_transaction_id: router::types::ResponseId::ConnectorTransactionId( - txn_id.unwrap(), - ), - capture_method: Some(enums::CaptureMethod::Automatic), - ..Default::default() - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!(response.status, enums::AttemptStatus::Charged,); -} - -// Refunds a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_refund_auto_captured_payment() { - let response = CONNECTOR - .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Partially refunds a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_partially_refund_succeeded_payment() { - let refund_response = CONNECTOR - .make_payment_and_refund( - payment_method_details(), - Some(types::RefundsData { - refund_amount: 50, - ..utils::PaymentRefundType::default().0 - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - refund_response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_refund_succeeded_payment_multiple_times() { - CONNECTOR - .make_payment_and_multiple_refund( - payment_method_details(), - Some(types::RefundsData { - refund_amount: 50, - ..utils::PaymentRefundType::default().0 - }), - get_default_payment_info(), - ) - .await; -} - -// Synchronizes a refund using the automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_sync_refund() { - let refund_response = CONNECTOR - .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) - .await - .unwrap(); - let response = CONNECTOR - .rsync_retry_till_status_matches( - enums::RefundStatus::Success, - refund_response.response.unwrap().connector_refund_id, - None, - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap().refund_status, - enums::RefundStatus::Success, - ); -} - -// Voids a payment using automatic capture flow (Non 3DS). -#[actix_web::test] -async fn should_fail_void_payment_for_auto_capture() { - let authorize_response = CONNECTOR - .make_payment(payment_method_details(), get_default_payment_info()) - .await - .unwrap(); - assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); - let txn_id = utils::get_connector_transaction_id(authorize_response.response); - assert_ne!(txn_id, None, "Empty connector transaction id"); - let void_response = CONNECTOR - .void_payment(txn_id.unwrap(), None, get_default_payment_info()) - .await - .unwrap(); - assert_eq!( - void_response.response.unwrap_err().message, - "You cannot cancel this PaymentIntent because it has a status of succeeded." - ); -} - -// Captures a payment using invalid connector payment id. -#[actix_web::test] -async fn should_fail_capture_for_invalid_payment() { - let capture_response = CONNECTOR - .capture_payment("123456789".to_string(), None, get_default_payment_info()) - .await - .unwrap(); - assert_eq!( - capture_response.response.unwrap_err().message, - String::from("No such payment_intent: '123456789'") - ); -} - -// Refunds a payment with refund amount higher than payment amount. -#[actix_web::test] -async fn should_fail_for_refund_amount_higher_than_payment_amount() { - let response = CONNECTOR - .make_payment_and_refund( - payment_method_details(), - Some(types::RefundsData { - refund_amount: 150, - ..utils::PaymentRefundType::default().0 - }), - get_default_payment_info(), - ) - .await - .unwrap(); - assert_eq!( - response.response.unwrap_err().message, - "Refund amount (₹1.50) is greater than charge amount (₹1.00)", - ); -} - -// Connector dependent test cases goes here - -// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests diff --git a/crates/router/tests/connectors/nexinets.rs b/crates/router/tests/connectors/nexinets.rs index 5948855ae8d..174e49fbc82 100644 --- a/crates/router/tests/connectors/nexinets.rs +++ b/crates/router/tests/connectors/nexinets.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use cards::CardNumber; use masking::Secret; -use router::types::{self, domain, storage::enums, PaymentsAuthorizeData}; +use router::types::{self, api, storage::enums, PaymentsAuthorizeData}; use crate::{ connector_auth, @@ -41,7 +41,7 @@ impl utils::Connector for NexinetsTest { fn payment_method_details() -> Option { Some(PaymentsAuthorizeData { currency: diesel_models::enums::Currency::EUR, - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: CardNumber::from_str("374111111111111").unwrap(), ..utils::CCardType::default().0 }), @@ -125,7 +125,6 @@ async fn should_sync_authorized_payment() { connector_meta, mandate_id: None, payment_method_type: None, - currency: enums::Currency::EUR, }), None, ) @@ -506,7 +505,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -528,7 +527,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -550,7 +549,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/nmi.rs b/crates/router/tests/connectors/nmi.rs index 5b569fa497f..24e1d69a600 100644 --- a/crates/router/tests/connectors/nmi.rs +++ b/crates/router/tests/connectors/nmi.rs @@ -1,6 +1,6 @@ use std::{str::FromStr, time::Duration}; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -38,7 +38,7 @@ static CONNECTOR: NmiTest = NmiTest {}; fn get_payment_authorize_data() -> Option { Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/noon.rs b/crates/router/tests/connectors/noon.rs index 7e0bb954c6c..0f736e3e528 100644 --- a/crates/router/tests/connectors/noon.rs +++ b/crates/router/tests/connectors/noon.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use masking::Secret; use router::types::{ - self, + self, api, storage::{self, enums}, }; @@ -305,14 +305,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("1234567891011").unwrap(), ..utils::CCardType::default().0 }), @@ -334,7 +334,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -356,7 +356,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -378,7 +378,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/nuvei.rs b/crates/router/tests/connectors/nuvei.rs index 04a83b3a606..5d266fb46fe 100644 --- a/crates/router/tests/connectors/nuvei.rs +++ b/crates/router/tests/connectors/nuvei.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use masking::Secret; use router::types::{ - self, + self, api, storage::{self, enums}, }; use serde_json::json; @@ -44,7 +44,7 @@ static CONNECTOR: NuveiTest = NuveiTest {}; fn get_payment_data() -> Option { Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4444 3333 2222 1111").unwrap(), ..utils::CCardType::default().0 }), @@ -242,14 +242,14 @@ async fn should_partially_refund_succeeded_payment() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("1234567891011").unwrap(), ..utils::CCardType::default().0 }), @@ -271,7 +271,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -293,7 +293,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -315,7 +315,7 @@ async fn should_succeed_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4000027891380961").unwrap(), card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 diff --git a/crates/router/tests/connectors/opayo.rs b/crates/router/tests/connectors/opayo.rs index f4badf9b116..97d744d1e9d 100644 --- a/crates/router/tests/connectors/opayo.rs +++ b/crates/router/tests/connectors/opayo.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -300,14 +300,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("1234567891011").unwrap(), ..utils::CCardType::default().0 }), @@ -329,7 +329,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -351,7 +351,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -373,7 +373,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/opennode.rs b/crates/router/tests/connectors/opennode.rs index e4d347c26d1..b01b251b24d 100644 --- a/crates/router/tests/connectors/opennode.rs +++ b/crates/router/tests/connectors/opennode.rs @@ -1,5 +1,6 @@ +use api_models::payments::CryptoData; use masking::Secret; -use router::types::{self, api, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -68,7 +69,7 @@ fn payment_method_details() -> Option { Some(types::PaymentsAuthorizeData { amount: 1, currency: enums::Currency::USD, - payment_method_data: types::domain::PaymentMethodData::Crypto(domain::CryptoData { + payment_method_data: types::api::PaymentMethodData::Crypto(CryptoData { pay_currency: None, }), confirm: true, diff --git a/crates/router/tests/connectors/payeezy.rs b/crates/router/tests/connectors/payeezy.rs index bfc0cb13650..0cdf709f362 100644 --- a/crates/router/tests/connectors/payeezy.rs +++ b/crates/router/tests/connectors/payeezy.rs @@ -5,7 +5,7 @@ use cards::CardNumber; use masking::Secret; use router::{ core::errors, - types::{self, storage::enums, PaymentsAuthorizeData}, + types::{self, api, storage::enums, PaymentsAuthorizeData}, }; use crate::{ @@ -46,7 +46,7 @@ impl utils::Connector for PayeezyTest { impl PayeezyTest { fn get_payment_data() -> Option { Some(PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: CardNumber::from_str("4012000033330026").unwrap(), ..utils::CCardType::default().0 }), @@ -365,13 +365,13 @@ async fn should_refund_succeeded_payment_multiple_times() { #[ignore] async fn should_sync_refund() {} -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card issuer. #[actix_web::test] async fn should_throw_not_implemented_for_unsupported_issuer() { let authorize_data = Some(PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: CardNumber::from_str("630495060000000000").unwrap(), ..utils::CCardType::default().0 }), @@ -396,7 +396,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345d".to_string()), ..utils::CCardType::default().0 }), @@ -418,7 +418,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -440,7 +440,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs index 5e9531a4f7a..62c1bac94d6 100644 --- a/crates/router/tests/connectors/payme.rs +++ b/crates/router/tests/connectors/payme.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use api_models::payments::{Address, AddressDetails, OrderDetailsWithAmount}; use common_utils::pii::Email; use masking::Secret; -use router::types::{self, domain, storage::enums, PaymentAddress}; +use router::types::{self, api, storage::enums, PaymentAddress}; use crate::{ connector_auth, @@ -90,11 +90,12 @@ fn payment_method_details() -> Option { router_return_url: Some("https://hyperswitch.io".to_string()), webhook_url: Some("https://hyperswitch.io".to_string()), email: Some(Email::from_str("test@gmail.com").unwrap()), - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_cvc: Secret::new("123".to_string()), card_exp_month: Secret::new("10".to_string()), card_exp_year: Secret::new("2025".to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), ..utils::CCardType::default().0 }), amount: 1000, @@ -362,7 +363,7 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { @@ -371,7 +372,7 @@ async fn should_fail_payment_for_incorrect_cvc() { Some(types::PaymentsAuthorizeData { amount: 100, currency: enums::Currency::ILS, - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -409,7 +410,7 @@ async fn should_fail_payment_for_invalid_exp_month() { Some(types::PaymentsAuthorizeData { amount: 100, currency: enums::Currency::ILS, - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -447,7 +448,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { Some(types::PaymentsAuthorizeData { amount: 100, currency: enums::Currency::ILS, - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2012".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/paypal.rs b/crates/router/tests/connectors/paypal.rs index bded135f45d..874f6cda1d9 100644 --- a/crates/router/tests/connectors/paypal.rs +++ b/crates/router/tests/connectors/paypal.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use masking::Secret; -use router::types::{self, domain, storage::enums, AccessToken, ConnectorAuthType}; +use router::types::{self, api, storage::enums, AccessToken, ConnectorAuthType}; use crate::{ connector_auth, @@ -56,7 +56,7 @@ fn get_default_payment_info() -> Option { fn get_payment_data() -> Option { Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4000020000000000").unwrap(), ..utils::CCardType::default().0 }), @@ -142,7 +142,6 @@ async fn should_sync_authorized_payment() { sync_type: types::SyncRequestType::SinglePaymentSync, connector_meta, payment_method_type: None, - currency: enums::Currency::USD, }), get_default_payment_info(), ) @@ -340,7 +339,6 @@ async fn should_sync_auto_captured_payment() { sync_type: types::SyncRequestType::SinglePaymentSync, connector_meta, payment_method_type: None, - currency: enums::Currency::USD, }), get_default_payment_info(), ) @@ -442,7 +440,7 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] @@ -450,7 +448,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -476,7 +474,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -502,7 +500,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/payu.rs b/crates/router/tests/connectors/payu.rs index fc916e33677..c73205d9fd3 100644 --- a/crates/router/tests/connectors/payu.rs +++ b/crates/router/tests/connectors/payu.rs @@ -1,5 +1,5 @@ use masking::PeekInterface; -use router::types::{self, domain, storage::enums, AccessToken, ConnectorAuthType}; +use router::types::{self, api, storage::enums, AccessToken, ConnectorAuthType}; use crate::{ connector_auth, @@ -89,15 +89,15 @@ async fn should_authorize_gpay_payment() { let authorize_response = Payu {} .authorize_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: domain::PaymentMethodData::Wallet(domain::WalletData::GooglePay( - domain::GooglePayWalletData { + payment_method_data: types::api::PaymentMethodData::Wallet(api::WalletData::GooglePay( + api_models::payments::GooglePayWalletData { pm_type: "CARD".to_string(), description: "Visa1234567890".to_string(), - info: domain::GooglePayPaymentMethodInfo { + info: api_models::payments::GooglePayPaymentMethodInfo { card_network: "VISA".to_string(), card_details: "1234".to_string(), }, - tokenization_data: domain::GpayTokenizationData { + tokenization_data: api_models::payments::GpayTokenizationData { token_type: "payu".to_string(), token: r#"{"signature":"MEUCIQD7Ta+d9+buesrH2KKkF+03AqTen+eHHN8KFleHoKaiVAIgGvAXyI0Vg3ws8KlF7agW/gmXJhpJOOPkqiNVbn/4f0Y\u003d","protocolVersion":"ECv1","signedMessage":"{\"encryptedMessage\":\"UcdGP9F/1loU0aXvVj6VqGRPA5EAjHYfJrXD0N+5O13RnaJXKWIjch1zzjpy9ONOZHqEGAqYKIcKcpe5ppN4Fpd0dtbm1H4u+lA+SotCff3euPV6sne22/Pl/MNgbz5QvDWR0UjcXvIKSPNwkds1Ib7QMmH4GfZ3vvn6s534hxAmcv/LlkeM4FFf6py9crJK5fDIxtxRJncfLuuPeAXkyy+u4zE33HmT34Oe5MSW/kYZVz31eWqFy2YCIjbJcC9ElMluoOKSZ305UG7tYGB1LCFGQLtLxphrhPu1lEmGEZE1t2cVDoCzjr3rm1OcfENc7eNC4S+ko6yrXh1ZX06c/F9kunyLn0dAz8K5JLIwLdjw3wPADVSd3L0eM7jkzhH80I6nWkutO0x8BFltxWl+OtzrnAe093OUncH6/DK1pCxtJaHdw1WUWrzULcdaMZmPfA\\u003d\\u003d\",\"ephemeralPublicKey\":\"BH7A1FUBWiePkjh/EYmsjY/63D/6wU+4UmkLh7WW6v7PnoqQkjrFpc4kEP5a1Op4FkIlM9LlEs3wGdFB8xIy9cM\\u003d\",\"tag\":\"e/EOsw2Y2wYpJngNWQqH7J62Fhg/tzmgDl6UFGuAN+A\\u003d\"}"}"# .to_string()//Generate new GooglePay token this is bound to expire }, diff --git a/crates/router/tests/connectors/placetopay.rs b/crates/router/tests/connectors/placetopay.rs index 41675b9751b..b7c70c789da 100644 --- a/crates/router/tests/connectors/placetopay.rs +++ b/crates/router/tests/connectors/placetopay.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -295,14 +295,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -324,7 +324,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -346,7 +346,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/powertranz.rs b/crates/router/tests/connectors/powertranz.rs index 0701ec006d9..eca3f86b569 100644 --- a/crates/router/tests/connectors/powertranz.rs +++ b/crates/router/tests/connectors/powertranz.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -303,14 +303,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -332,7 +332,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -354,7 +354,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/prophetpay.rs b/crates/router/tests/connectors/prophetpay.rs index 9a0e2dbfa0e..94220c11a6a 100644 --- a/crates/router/tests/connectors/prophetpay.rs +++ b/crates/router/tests/connectors/prophetpay.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -295,14 +295,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -324,7 +324,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -346,7 +346,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/rapyd.rs b/crates/router/tests/connectors/rapyd.rs index 61bc7ccdf15..c53f4e8d8b1 100644 --- a/crates/router/tests/connectors/rapyd.rs +++ b/crates/router/tests/connectors/rapyd.rs @@ -2,12 +2,12 @@ use std::str::FromStr; use futures::future::OptionFuture; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use serial_test::serial; use crate::{ connector_auth, - utils::{self, ConnectorActions, PaymentInfo}, + utils::{self, ConnectorActions}, }; struct Rapyd; @@ -42,10 +42,11 @@ async fn should_only_authorize_payment() { let response = Rapyd {} .authorize_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("02".to_string()), card_exp_year: Secret::new("2024".to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new("123".to_string()), card_issuer: None, card_network: None, @@ -57,7 +58,7 @@ async fn should_only_authorize_payment() { capture_method: Some(diesel_models::enums::CaptureMethod::Manual), ..utils::PaymentAuthorizeType::default().0 }), - Some(PaymentInfo::with_default_billing_name()), + None, ) .await .unwrap(); @@ -69,10 +70,11 @@ async fn should_authorize_and_capture_payment() { let response = Rapyd {} .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("02".to_string()), card_exp_year: Secret::new("2024".to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new("123".to_string()), card_issuer: None, card_network: None, @@ -83,7 +85,7 @@ async fn should_authorize_and_capture_payment() { }), ..utils::PaymentAuthorizeType::default().0 }), - Some(PaymentInfo::with_default_billing_name()), + None, ) .await .unwrap(); @@ -93,10 +95,7 @@ async fn should_authorize_and_capture_payment() { #[actix_web::test] async fn should_capture_already_authorized_payment() { let connector = Rapyd {}; - let authorize_response = connector - .authorize_payment(None, Some(PaymentInfo::with_default_billing_name())) - .await - .unwrap(); + let authorize_response = connector.authorize_payment(None, None).await.unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized); let txn_id = utils::get_connector_transaction_id(authorize_response.response); let response: OptionFuture<_> = txn_id @@ -115,10 +114,7 @@ async fn should_capture_already_authorized_payment() { #[serial] async fn voiding_already_authorized_payment_fails() { let connector = Rapyd {}; - let authorize_response = connector - .authorize_payment(None, Some(PaymentInfo::with_default_billing_name())) - .await - .unwrap(); + let authorize_response = connector.authorize_payment(None, None).await.unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized); let txn_id = utils::get_connector_transaction_id(authorize_response.response); let response: OptionFuture<_> = txn_id @@ -157,7 +153,7 @@ async fn should_fail_payment_for_incorrect_card_number() { let response = Rapyd {} .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("0000000000000000").unwrap(), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml index a1f7919cd78..bd17f279c2d 100644 --- a/crates/router/tests/connectors/sample_auth.toml +++ b/crates/router/tests/connectors/sample_auth.toml @@ -199,22 +199,6 @@ key1= "Trankey" api_key="API Key" -[ebanx] -api_key="API Key" - [billwerk] api_key="API Key" - - -[netcetera] -certificate="Certificate" -private_key="Private Key" - - -[ebanx] -api_key="API Key" - -[zsl] -api_key= "Key" -key1= "Merchant id" diff --git a/crates/router/tests/connectors/shift4.rs b/crates/router/tests/connectors/shift4.rs index 8f11fbfa1d8..fe7a232b3e5 100644 --- a/crates/router/tests/connectors/shift4.rs +++ b/crates/router/tests/connectors/shift4.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -144,14 +144,14 @@ async fn should_void_authorized_payment() { assert_eq!(response.unwrap().status, enums::AttemptStatus::Pending); //shift4 doesn't allow voiding a payment } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4024007134364842").unwrap(), ..utils::CCardType::default().0 }), @@ -173,7 +173,7 @@ async fn should_succeed_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("asdasd".to_string()), //shift4 accept invalid CVV as it doesn't accept CVV ..utils::CCardType::default().0 }), @@ -192,7 +192,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -214,7 +214,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/square.rs b/crates/router/tests/connectors/square.rs index 01d90c73c42..62aa8b6d246 100644 --- a/crates/router/tests/connectors/square.rs +++ b/crates/router/tests/connectors/square.rs @@ -2,7 +2,7 @@ use std::{str::FromStr, time::Duration}; use masking::Secret; use router::types::{ - self, + self, api, storage::{self, enums}, PaymentsResponseData, }; @@ -62,7 +62,7 @@ fn payment_method_details() -> Option { fn token_details() -> Option { Some(types::PaymentMethodTokenizationData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("04".to_string()), card_exp_year: Secret::new("2027".to_string()), @@ -428,14 +428,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let token_response = CONNECTOR .create_connector_pm_token( Some(types::PaymentMethodTokenizationData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("11".to_string()), card_exp_year: Secret::new("2027".to_string()), @@ -466,7 +466,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let token_response = CONNECTOR .create_connector_pm_token( Some(types::PaymentMethodTokenizationData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("20".to_string()), card_exp_year: Secret::new("2027".to_string()), @@ -497,7 +497,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let token_response = CONNECTOR .create_connector_pm_token( Some(types::PaymentMethodTokenizationData { - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("11".to_string()), card_exp_year: Secret::new("2000".to_string()), diff --git a/crates/router/tests/connectors/stax.rs b/crates/router/tests/connectors/stax.rs index d16f209a49a..a1d41f9a92b 100644 --- a/crates/router/tests/connectors/stax.rs +++ b/crates/router/tests/connectors/stax.rs @@ -1,7 +1,7 @@ use std::{str::FromStr, time::Duration}; use masking::Secret; -use router::types::{self, domain, storage::enums, PaymentsResponseData}; +use router::types::{self, api, storage::enums, PaymentsResponseData}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -63,7 +63,7 @@ fn customer_details() -> Option { fn token_details() -> Option { Some(types::PaymentMethodTokenizationData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("04".to_string()), card_exp_year: Secret::new("2027".to_string()), @@ -455,7 +455,7 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { @@ -473,7 +473,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let token_response = CONNECTOR .create_connector_pm_token( Some(types::PaymentMethodTokenizationData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("11".to_string()), card_exp_year: Secret::new("2027".to_string()), @@ -511,7 +511,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let token_response = CONNECTOR .create_connector_pm_token( Some(types::PaymentMethodTokenizationData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("20".to_string()), card_exp_year: Secret::new("2027".to_string()), @@ -549,7 +549,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let token_response = CONNECTOR .create_connector_pm_token( Some(types::PaymentMethodTokenizationData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4111111111111111").unwrap(), card_exp_month: Secret::new("04".to_string()), card_exp_year: Secret::new("2000".to_string()), diff --git a/crates/router/tests/connectors/stripe.rs b/crates/router/tests/connectors/stripe.rs index 3dcaeba45b0..735dedeffba 100644 --- a/crates/router/tests/connectors/stripe.rs +++ b/crates/router/tests/connectors/stripe.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -37,7 +37,7 @@ impl utils::Connector for Stripe { fn get_payment_authorize_data() -> Option { Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4242424242424242").unwrap(), ..utils::CCardType::default().0 }), @@ -158,7 +158,7 @@ async fn should_fail_payment_for_incorrect_card_number() { let response = Stripe {} .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4024007134364842").unwrap(), ..utils::CCardType::default().0 }), @@ -180,7 +180,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = Stripe {} .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("13".to_string()), ..utils::CCardType::default().0 }), @@ -202,7 +202,7 @@ async fn should_fail_payment_for_invalid_exp_year() { let response = Stripe {} .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2022".to_string()), ..utils::CCardType::default().0 }), @@ -221,7 +221,7 @@ async fn should_fail_payment_for_invalid_card_cvc() { let response = Stripe {} .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/trustpay.rs b/crates/router/tests/connectors/trustpay.rs index 48cd165767c..cf659e349dc 100644 --- a/crates/router/tests/connectors/trustpay.rs +++ b/crates/router/tests/connectors/trustpay.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use masking::Secret; -use router::types::{self, api, domain, storage::enums, BrowserInformation}; +use router::types::{self, api, storage::enums, BrowserInformation}; use crate::{ connector_auth, @@ -53,7 +53,7 @@ fn get_default_browser_info() -> BrowserInformation { fn get_default_payment_authorize_data() -> Option { Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4200000000000000").unwrap(), card_exp_year: Secret::new("25".to_string()), card_cvc: Secret::new("123".to_string()), @@ -177,12 +177,12 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { let payment_authorize_data = types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("1234567891011").unwrap(), card_exp_year: Secret::new("25".to_string()), card_cvc: Secret::new("123".to_string()), @@ -205,7 +205,7 @@ async fn should_fail_payment_for_incorrect_card_number() { #[actix_web::test] async fn should_fail_payment_for_incorrect_expiry_year() { let payment_authorize_data = Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: cards::CardNumber::from_str("4200000000000000").unwrap(), card_exp_year: Secret::new("22".to_string()), card_cvc: Secret::new("123".to_string()), diff --git a/crates/router/tests/connectors/tsys.rs b/crates/router/tests/connectors/tsys.rs index d7a688bd128..e7a0d747f44 100644 --- a/crates/router/tests/connectors/tsys.rs +++ b/crates/router/tests/connectors/tsys.rs @@ -2,7 +2,7 @@ use std::{str::FromStr, time::Duration}; use cards::CardNumber; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -46,7 +46,7 @@ fn get_default_payment_info() -> Option { fn payment_method_details(amount: i64) -> Option { Some(types::PaymentsAuthorizeData { amount, - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: CardNumber::from_str("4111111111111111").unwrap(), ..utils::CCardType::default().0 }), @@ -339,14 +339,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("".to_string()), ..utils::CCardType::default().0 }), @@ -368,7 +368,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -390,7 +390,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("abcd".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs index 9678eca73f3..8effc2479c1 100644 --- a/crates/router/tests/connectors/utils.rs +++ b/crates/router/tests/connectors/utils.rs @@ -11,7 +11,7 @@ use router::{ core::{errors, errors::ConnectorError, payments}, db::StorageImpl, routes, services, - types::{self, storage::enums, AccessToken, PaymentAddress, RouterData}, + types::{self, api, storage::enums, AccessToken, PaymentAddress, RouterData}, }; use test_utils::connector_auth::ConnectorAuthType; use tokio::sync::oneshot; @@ -49,32 +49,11 @@ pub struct PaymentInfo { pub connector_customer: Option, pub payment_method_token: Option, #[cfg(feature = "payouts")] - pub payout_method_data: Option, + pub payout_method_data: Option, pub currency: Option, pub country: Option, } -impl PaymentInfo { - pub fn with_default_billing_name() -> Self { - Self { - address: Some(types::PaymentAddress::new( - None, - None, - Some(types::api::Address { - address: Some(types::api::AddressDetails { - first_name: Some(Secret::new("John".to_string())), - last_name: Some(Secret::new("Doe".to_string())), - ..Default::default() - }), - phone: None, - email: None, - }), - )), - ..Default::default() - } - } -} - #[async_trait] pub trait ConnectorActions: Connector { /// For initiating payments when `CaptureMethod` is set to `Manual` @@ -484,7 +463,6 @@ pub trait ConnectorActions: Connector { phone: Some(Secret::new("620874518".to_string())), phone_country_code: Some("+31".to_string()), }), - vendor_details: None, }, payment_info, ) @@ -503,6 +481,7 @@ pub trait ConnectorActions: Connector { payment_id: uuid::Uuid::new_v4().to_string(), attempt_id: uuid::Uuid::new_v4().to_string(), status: enums::AttemptStatus::default(), + payment_method_id: None, auth_type: info .clone() .map_or(enums::AuthenticationType::NoThreeDs, |a| { @@ -885,17 +864,18 @@ pub struct PaymentCaptureType(pub types::PaymentsCaptureData); pub struct PaymentCancelType(pub types::PaymentsCancelData); pub struct PaymentSyncType(pub types::PaymentsSyncData); pub struct PaymentRefundType(pub types::RefundsData); -pub struct CCardType(pub types::domain::Card); +pub struct CCardType(pub api::Card); pub struct BrowserInfoType(pub types::BrowserInformation); pub struct CustomerType(pub types::ConnectorCustomerData); pub struct TokenType(pub types::PaymentMethodTokenizationData); impl Default for CCardType { fn default() -> Self { - Self(types::domain::Card { + Self(api::Card { card_number: cards::CardNumber::from_str("4200000000000000").unwrap(), card_exp_month: Secret::new("10".to_string()), card_exp_year: Secret::new("2025".to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new("999".to_string()), card_issuer: None, card_network: None, @@ -910,7 +890,7 @@ impl Default for CCardType { impl Default for PaymentAuthorizeType { fn default() -> Self { let data = types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(CCardType::default().0), + payment_method_data: types::api::PaymentMethodData::Card(CCardType::default().0), amount: 100, currency: enums::Currency::USD, confirm: true, @@ -997,7 +977,6 @@ impl Default for PaymentSyncType { sync_type: types::SyncRequestType::SinglePaymentSync, connector_meta: None, payment_method_type: None, - currency: enums::Currency::USD, }; Self(data) } @@ -1024,7 +1003,7 @@ impl Default for PaymentRefundType { impl Default for CustomerType { fn default() -> Self { let data = types::ConnectorCustomerData { - payment_method_data: types::domain::PaymentMethodData::Card(CCardType::default().0), + payment_method_data: types::api::PaymentMethodData::Card(CCardType::default().0), description: None, email: Email::from_str("test@juspay.in").ok(), phone: None, @@ -1038,7 +1017,7 @@ impl Default for CustomerType { impl Default for TokenType { fn default() -> Self { let data = types::PaymentMethodTokenizationData { - payment_method_data: types::domain::PaymentMethodData::Card(CCardType::default().0), + payment_method_data: types::api::PaymentMethodData::Card(CCardType::default().0), browser_info: None, amount: Some(100), currency: enums::Currency::USD, diff --git a/crates/router/tests/connectors/volt.rs b/crates/router/tests/connectors/volt.rs index 7bcdf63d918..0df21640c77 100644 --- a/crates/router/tests/connectors/volt.rs +++ b/crates/router/tests/connectors/volt.rs @@ -1,5 +1,5 @@ use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; @@ -295,14 +295,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -324,7 +324,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -346,7 +346,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/worldline.rs b/crates/router/tests/connectors/worldline.rs index 21a5a574122..c81dcf15bde 100644 --- a/crates/router/tests/connectors/worldline.rs +++ b/crates/router/tests/connectors/worldline.rs @@ -48,8 +48,6 @@ impl WorldlineTest { Some(Address { address: Some(AddressDetails { country: Some(api_models::enums::CountryAlpha2::US), - first_name: Some(Secret::new(String::from("John"))), - last_name: Some(Secret::new(String::from("Dough"))), ..Default::default() }), phone: None, @@ -71,10 +69,11 @@ impl WorldlineTest { Some(types::PaymentsAuthorizeData { amount: 3500, currency: enums::Currency::USD, - payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(types::api::Card { card_number: cards::CardNumber::from_str(card_number).unwrap(), card_exp_month: Secret::new(card_exp_month.to_string()), card_exp_year: Secret::new(card_exp_year.to_string()), + card_holder_name: Some(masking::Secret::new("John Doe".to_string())), card_cvc: Secret::new(card_cvc.to_string()), card_issuer: None, card_network: None, diff --git a/crates/router/tests/connectors/worldpay.rs b/crates/router/tests/connectors/worldpay.rs index 649b1bebbb1..bf598e0b37b 100644 --- a/crates/router/tests/connectors/worldpay.rs +++ b/crates/router/tests/connectors/worldpay.rs @@ -1,5 +1,5 @@ use futures::future::OptionFuture; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use serde_json::json; use serial_test::serial; use wiremock::{ @@ -62,15 +62,15 @@ async fn should_authorize_gpay_payment() { let response = conn .authorize_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Wallet( - domain::WalletData::GooglePay(domain::GooglePayWalletData { + payment_method_data: types::api::PaymentMethodData::Wallet( + api::WalletData::GooglePay(api_models::payments::GooglePayWalletData { pm_type: "CARD".to_string(), description: "Visa1234567890".to_string(), - info: domain::GooglePayPaymentMethodInfo { + info: api_models::payments::GooglePayPaymentMethodInfo { card_network: "VISA".to_string(), card_details: "1234".to_string(), }, - tokenization_data: domain::GpayTokenizationData { + tokenization_data: api_models::payments::GpayTokenizationData { token_type: "worldpay".to_string(), token: "someToken".to_string(), }, @@ -97,11 +97,11 @@ async fn should_authorize_applepay_payment() { let response = conn .authorize_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Wallet( - domain::WalletData::ApplePay(domain::ApplePayWalletData { + payment_method_data: types::api::PaymentMethodData::Wallet( + api::WalletData::ApplePay(api_models::payments::ApplePayWalletData { payment_data: "someData".to_string(), transaction_identifier: "someId".to_string(), - payment_method: domain::ApplepayPaymentMethod { + payment_method: api_models::payments::ApplepayPaymentMethod { display_name: "someName".to_string(), network: "visa".to_string(), pm_type: "card".to_string(), diff --git a/crates/router/tests/connectors/zen.rs b/crates/router/tests/connectors/zen.rs index 95017e7da0e..14b52e7104e 100644 --- a/crates/router/tests/connectors/zen.rs +++ b/crates/router/tests/connectors/zen.rs @@ -4,7 +4,7 @@ use api_models::payments::OrderDetailsWithAmount; use cards::CardNumber; use common_utils::pii::Email; use masking::Secret; -use router::types::{self, domain, storage::enums}; +use router::types::{self, api, storage::enums}; use crate::{ connector_auth, @@ -104,7 +104,6 @@ async fn should_sync_authorized_payment() { connector_meta: None, mandate_id: None, payment_method_type: None, - currency: enums::Currency::USD, }), None, ) @@ -220,7 +219,6 @@ async fn should_sync_auto_captured_payment() { connector_meta: None, mandate_id: None, payment_method_type: None, - currency: enums::Currency::USD, }), None, ) @@ -303,14 +301,14 @@ async fn should_sync_refund() { ); } -// Cards Negative scenarios +// Cards Negative scenerios // Creates a payment with incorrect card number. #[actix_web::test] async fn should_fail_payment_for_incorrect_card_number() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_number: CardNumber::from_str("1234567891011").unwrap(), ..utils::CCardType::default().0 }), @@ -351,7 +349,7 @@ async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), @@ -392,7 +390,7 @@ async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), @@ -433,7 +431,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { - payment_method_data: types::domain::PaymentMethodData::Card(domain::Card { + payment_method_data: types::api::PaymentMethodData::Card(api::Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), diff --git a/crates/router/tests/connectors/zsl.rs b/crates/router/tests/connectors/zsl.rs deleted file mode 100644 index 21942020cfd..00000000000 --- a/crates/router/tests/connectors/zsl.rs +++ /dev/null @@ -1,59 +0,0 @@ -use router::types::{self, storage::enums}; -use test_utils::connector_auth; - -use crate::utils::{self, ConnectorActions}; - -struct ZslTest; -impl ConnectorActions for ZslTest {} -impl utils::Connector for ZslTest { - fn get_data(&self) -> types::api::ConnectorData { - use router::connector::Zsl; - types::api::ConnectorData { - connector: Box::new(&Zsl), - connector_name: types::Connector::Adyen, - // Added as Dummy connector as template code is added for future usage - get_token: types::api::GetToken::Connector, - merchant_connector_id: None, - } - } - - fn get_auth_token(&self) -> types::ConnectorAuthType { - utils::to_connector_auth_type( - connector_auth::ConnectorAuthentication::new() - .zsl - .expect("Missing connector authentication configuration") - .into(), - ) - } - - fn get_name(&self) -> String { - "zsl".to_string() - } -} - -static CONNECTOR: ZslTest = ZslTest {}; - -fn get_default_payment_info() -> Option { - None -} - -fn payment_method_details() -> Option { - None -} - -// Partially captures a payment using the manual capture flow (Non 3DS). -#[actix_web::test] -async fn should_partially_capture_authorized_payment() { - let response = CONNECTOR - .authorize_and_capture_payment( - payment_method_details(), - Some(types::PaymentsCaptureData { - amount_to_capture: 50, - ..utils::PaymentCaptureType::default().0 - }), - get_default_payment_info(), - ) - .await - .expect("Capture payment response"); - assert_eq!(response.status, enums::AttemptStatus::AuthenticationPending); -} diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs index 646a11d4cdd..1108a0b4b8c 100644 --- a/crates/router/tests/payments.rs +++ b/crates/router/tests/payments.rs @@ -317,7 +317,7 @@ async fn payments_create_core() { setup_future_usage: Some(api_enums::FutureUsage::OnSession), authentication_type: Some(api_enums::AuthenticationType::NoThreeDs), payment_method_data: Some(api::PaymentMethodDataRequest { - payment_method_data: Some(api::PaymentMethodData::Card(api::Card { + payment_method_data: api::PaymentMethodData::Card(api::Card { card_number: "4242424242424242".to_string().try_into().unwrap(), card_exp_month: "10".to_string().into(), card_exp_year: "35".to_string().into(), @@ -329,7 +329,7 @@ async fn payments_create_core() { card_issuing_country: None, bank_code: None, nick_name: Some(masking::Secret::new("nick_name".into())), - })), + }), billing: None, }), payment_method: Some(api_enums::PaymentMethod::Card), @@ -373,8 +373,7 @@ async fn payments_create_core() { _, Oss, >( - state.clone(), - state.get_req_state(), + state, merchant_account, key_store, payments::PaymentCreate, @@ -499,7 +498,7 @@ async fn payments_create_core_adyen_no_redirect() { setup_future_usage: Some(api_enums::FutureUsage::OnSession), authentication_type: Some(api_enums::AuthenticationType::NoThreeDs), payment_method_data: Some(api::PaymentMethodDataRequest { - payment_method_data: Some(api::PaymentMethodData::Card(api::Card { + payment_method_data: api::PaymentMethodData::Card(api::Card { card_number: "5555 3412 4444 1115".to_string().try_into().unwrap(), card_exp_month: "03".to_string().into(), card_exp_year: "2030".to_string().into(), @@ -511,7 +510,7 @@ async fn payments_create_core_adyen_no_redirect() { card_issuing_country: None, bank_code: None, nick_name: Some(masking::Secret::new("nick_name".into())), - })), + }), billing: None, }), payment_method: Some(api_enums::PaymentMethod::Card), @@ -556,8 +555,7 @@ async fn payments_create_core_adyen_no_redirect() { _, Oss, >( - state.clone(), - state.get_req_state(), + state, merchant_account, key_store, payments::PaymentCreate, diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs index 9b622d11fd1..5718b964ff8 100644 --- a/crates/router/tests/payments2.rs +++ b/crates/router/tests/payments2.rs @@ -77,7 +77,7 @@ async fn payments_create_core() { setup_future_usage: None, authentication_type: Some(api_enums::AuthenticationType::NoThreeDs), payment_method_data: Some(api::PaymentMethodDataRequest { - payment_method_data: Some(api::PaymentMethodData::Card(api::Card { + payment_method_data: api::PaymentMethodData::Card(api::Card { card_number: "4242424242424242".to_string().try_into().unwrap(), card_exp_month: "10".to_string().into(), card_exp_year: "35".to_string().into(), @@ -89,7 +89,7 @@ async fn payments_create_core() { card_issuing_country: None, bank_code: None, nick_name: Some(masking::Secret::new("nick_name".into())), - })), + }), billing: None, }), payment_method: Some(api_enums::PaymentMethod::Card), @@ -133,8 +133,7 @@ async fn payments_create_core() { _, Oss, >( - state.clone(), - state.get_req_state(), + state, merchant_account, key_store, payments::PaymentCreate, @@ -266,7 +265,7 @@ async fn payments_create_core_adyen_no_redirect() { setup_future_usage: Some(api_enums::FutureUsage::OffSession), authentication_type: Some(api_enums::AuthenticationType::NoThreeDs), payment_method_data: Some(api::PaymentMethodDataRequest { - payment_method_data: Some(api::PaymentMethodData::Card(api::Card { + payment_method_data: api::PaymentMethodData::Card(api::Card { card_number: "5555 3412 4444 1115".to_string().try_into().unwrap(), card_exp_month: "03".to_string().into(), card_exp_year: "2030".to_string().into(), @@ -278,7 +277,7 @@ async fn payments_create_core_adyen_no_redirect() { card_type: None, card_issuing_country: None, nick_name: Some(masking::Secret::new("nick_name".into())), - })), + }), billing: None, }), @@ -324,8 +323,7 @@ async fn payments_create_core_adyen_no_redirect() { _, Oss, >( - state.clone(), - state.get_req_state(), + state, merchant_account, key_store, payments::PaymentCreate, diff --git a/crates/router_derive/Cargo.toml b/crates/router_derive/Cargo.toml index 79378407946..07e95b9232c 100644 --- a/crates/router_derive/Cargo.toml +++ b/crates/router_derive/Cargo.toml @@ -12,13 +12,14 @@ proc-macro = true doctest = false [dependencies] -indexmap = "2.2.6" -proc-macro2 = "1.0.79" -quote = "1.0.35" -syn = { version = "2.0.57", features = ["full", "extra-traits"] } # the full feature does not seem to encompass all the features -strum = { version = "0.26.2", features = ["derive"] } +indexmap = "2.1.0" +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = { version = "2.0.5", features = ["full", "extra-traits"] } # the full feature does not seem to encompass all the features +strum = { version = "0.24.1", features = ["derive"] } [dev-dependencies] -diesel = { version = "2.1.5", features = ["postgres"] } -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" +diesel = { version = "2.1.0", features = ["postgres"] } +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" + diff --git a/crates/router_env/Cargo.toml b/crates/router_env/Cargo.toml index 3b95d5f22fd..c161d02b8d2 100644 --- a/crates/router_env/Cargo.toml +++ b/crates/router_env/Cargo.toml @@ -9,33 +9,33 @@ license.workspace = true [dependencies] cargo_metadata = "0.18.1" -config = { version = "0.14.0", features = ["toml"] } +config = { version = "0.13.3", features = ["toml"] } error-stack = "0.4.1" gethostname = "0.4.3" -once_cell = "1.19.0" +once_cell = "1.18.0" opentelemetry = { version = "0.19.0", features = ["rt-tokio-current-thread", "metrics"] } opentelemetry-otlp = { version = "0.12.0", features = ["metrics"] } rustc-hash = "1.1" -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" -serde_path_to_error = "0.1.16" -strum = { version = "0.26.2", features = ["derive"] } -time = { version = "0.3.35", default-features = false, features = ["formatting"] } -tokio = { version = "1.37.0" } -tracing = { version = "0.1.40" } +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" +serde_path_to_error = "0.1.14" +strum = { version = "0.24.1", features = ["derive"] } +time = { version = "0.3.21", default-features = false, features = ["formatting"] } +tokio = { version = "1.36.0" } +tracing = { version = "0.1.37" } tracing-actix-web = { version = "0.7.10", features = ["opentelemetry_0_19", "uuid_v7"], optional = true } -tracing-appender = { version = "0.2.3" } +tracing-appender = { version = "0.2.2" } tracing-attributes = "0.1.27" tracing-opentelemetry = { version = "0.19.0" } -tracing-subscriber = { version = "0.3.18", default-features = true, features = ["env-filter", "json", "registry"] } -vergen = { version = "8.3.1", optional = true, features = ["cargo", "git", "git2", "rustc"] } +tracing-subscriber = { version = "0.3.17", default-features = true, features = ["env-filter", "json", "registry"] } +vergen = { version = "8.2.1", optional = true, features = ["cargo", "git", "git2", "rustc"] } [dev-dependencies] -tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] } [build-dependencies] cargo_metadata = "0.18.1" -vergen = { version = "8.3.1", features = ["cargo", "git", "git2", "rustc"], optional = true } +vergen = { version = "8.2.1", features = ["cargo", "git", "git2", "rustc"], optional = true } [features] default = ["actix_web", "payouts"] diff --git a/crates/router_env/src/lib.rs b/crates/router_env/src/lib.rs index 20518a98070..5ad0f706706 100644 --- a/crates/router_env/src/lib.rs +++ b/crates/router_env/src/lib.rs @@ -22,6 +22,7 @@ pub mod vergen; pub use logger::*; pub use once_cell; pub use opentelemetry; +use strum::Display; pub use tracing; #[cfg(feature = "actix_web")] pub use tracing_actix_web; @@ -29,3 +30,34 @@ pub use tracing_appender; #[doc(inline)] pub use self::env::*; +use crate::types::FlowMetric; + +/// Analytics Flow routes Enums +/// Info - Dimensions and filters available for the domain +/// Filters - Set of values present for the dimension +/// Metrics - Analytical data on dimensions and metrics +#[derive(Debug, Display, Clone, PartialEq, Eq)] +pub enum AnalyticsFlow { + GetInfo, + GetPaymentMetrics, + GetRefundsMetrics, + GetSdkMetrics, + GetPaymentFilters, + GetRefundFilters, + GetSdkEventFilters, + GetApiEvents, + GetSdkEvents, + GeneratePaymentReport, + GenerateDisputeReport, + GenerateRefundReport, + GetApiEventMetrics, + GetApiEventFilters, + GetConnectorEvents, + GetOutgoingWebhookEvents, + GetGlobalSearchResults, + GetSearchResults, + GetDisputeFilters, + GetDisputeMetrics, +} + +impl FlowMetric for AnalyticsFlow {} diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs index 26cb619d74c..df322da9429 100644 --- a/crates/router_env/src/logger/types.rs +++ b/crates/router_env/src/logger/types.rs @@ -113,8 +113,6 @@ pub enum Flow { PaymentMethodsCreate, /// Payment methods list flow. PaymentMethodsList, - /// Payment method save flow - PaymentMethodSave, /// Customer payment methods list flow. CustomerPaymentMethodsList, /// List Customers for a merchant @@ -153,8 +151,6 @@ pub enum Flow { PaymentsStart, /// Payments list flow. PaymentsList, - // Payments filters flow - PaymentsFilters, #[cfg(feature = "payouts")] /// Payouts create flow PayoutsCreate, @@ -210,8 +206,6 @@ pub enum Flow { RoutingRetrieveConfig, /// Routing retrieve active config RoutingRetrieveActiveConfig, - /// Update connector agnostic mandate config - CreateConnectorAgnosticMandateConfig, /// Routing retrieve default config RoutingRetrieveDefaultConfig, /// Routing retrieve dictionary @@ -302,6 +296,8 @@ pub enum Flow { UserSignUp, /// User Sign Up UserSignUpWithMerchantId, + /// User Sign In without invite checks + UserSignInWithoutInviteChecks, /// User Sign In UserSignIn, /// User connect account @@ -348,10 +344,8 @@ pub enum Flow { DeleteSampleData, /// List merchant accounts for user UserMerchantAccountList, - /// Get details of a user + /// Get details of a user in a merchant account GetUserDetails, - /// Get details of a user role in a merchant account - GetUserRoleDetails, /// List users for merchant account ListUsersForMerchantAccount, /// PaymentMethodAuth Link token create @@ -362,6 +356,8 @@ pub enum Flow { ForgotPassword, /// Reset password using link ResetPassword, + /// Invite users + InviteUser, /// Invite multiple users InviteMultipleUser, /// Reinvite user @@ -378,6 +374,8 @@ pub enum Flow { SyncOnboardingStatus, /// Reset tracking id ResetTrackingId, + /// Verify email token without invite checks + VerifyEmailWithoutInviteChecks, /// Verify email Token VerifyEmail, /// Send verify email @@ -398,14 +396,6 @@ pub enum Flow { WebhookEventInitialDeliveryAttemptList, /// List delivery attempts for a webhook event WebhookEventDeliveryAttemptList, - /// Manually retry the delivery for a webhook event - WebhookEventDeliveryRetry, - /// Retrieve status of the Poll - RetrievePollStatus, - /// Toggles the extended card info feature in profile level - ToggleExtendedCardInfo, - /// Get the extended card info associated to a payment_id - GetExtendedCardInfo, } /// diff --git a/crates/router_env/src/metrics.rs b/crates/router_env/src/metrics.rs index e145caace00..961e0d36220 100644 --- a/crates/router_env/src/metrics.rs +++ b/crates/router_env/src/metrics.rs @@ -11,7 +11,7 @@ macro_rules! metrics_context { }; } -/// Create a global [`Meter`][Meter] with the specified name and an optional description. +/// Create a global [`Meter`][Meter] with the specified name and and an optional description. /// /// [Meter]: opentelemetry::metrics::Meter #[macro_export] diff --git a/crates/scheduler/Cargo.toml b/crates/scheduler/Cargo.toml index b98f212d674..4f2a423709f 100644 --- a/crates/scheduler/Cargo.toml +++ b/crates/scheduler/Cargo.toml @@ -1,9 +1,7 @@ [package] name = "scheduler" version = "0.1.0" -edition.workspace = true -rust-version.workspace = true -license.workspace = true +edition = "2021" [features] default = ["kv_store", "olap"] @@ -13,19 +11,19 @@ email = ["external_services/email"] [dependencies] # Third party crates -async-trait = "0.1.79" +async-trait = "0.1.68" error-stack = "0.4.1" -futures = "0.3.30" -num_cpus = "1.16.0" -once_cell = "1.19.0" +futures = "0.3.28" +num_cpus = "1.15.0" +once_cell = "1.18.0" rand = "0.8.5" -serde = "1.0.197" -serde_json = "1.0.115" -strum = { version = "0.26.2", features = ["derive"] } -thiserror = "1.0.58" -time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] } -tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } -uuid = { version = "1.8.0", features = ["v4"] } +serde = "1.0.193" +serde_json = "1.0.108" +strum = { version = "0.24.1", features = ["derive"] } +thiserror = "1.0.40" +time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] } +tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] } +uuid = { version = "1.7.0", features = ["v4"] } # First party crates common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals", "async_ext"] } diff --git a/crates/scheduler/src/consumer/types/process_data.rs b/crates/scheduler/src/consumer/types/process_data.rs index 98d0fe530e2..267305c37f9 100644 --- a/crates/scheduler/src/consumer/types/process_data.rs +++ b/crates/scheduler/src/consumer/types/process_data.rs @@ -6,7 +6,8 @@ use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct RetryMapping { pub start_after: i32, - pub frequencies: Vec<(i32, i32)>, // (frequency, count) + pub frequency: Vec, + pub count: Vec, } #[derive(Serialize, Deserialize)] @@ -22,7 +23,8 @@ impl Default for ConnectorPTMapping { custom_merchant_mapping: HashMap::new(), default_mapping: RetryMapping { start_after: 60, - frequencies: vec![(300, 5)], + frequency: vec![300], + count: vec![5], }, max_retries_count: 5, } @@ -42,7 +44,8 @@ impl Default for PaymentMethodsPTMapping { custom_pm_mapping: HashMap::new(), default_mapping: RetryMapping { start_after: 900, - frequencies: vec![(300, 5)], + frequency: vec![300], + count: vec![5], }, max_retries_count: 5, } @@ -67,15 +70,21 @@ impl Default for OutgoingWebhookRetryProcessTrackerMapping { // 1st attempt happens after 1 minute start_after: 60, - frequencies: vec![ + frequency: vec![ // 2nd and 3rd attempts happen at intervals of 5 minutes each - (60 * 5, 2), + 60 * 5, // 4th, 5th, 6th, 7th and 8th attempts happen at intervals of 10 minutes each - (60 * 10, 5), + 60 * 10, // 9th, 10th, 11th, 12th and 13th attempts happen at intervals of 1 hour each - (60 * 60, 5), + 60 * 60, // 14th, 15th and 16th attempts happen at intervals of 6 hours each - (60 * 60 * 6, 3), + 60 * 60 * 6, + ], + count: vec![ + 2, // 2nd and 3rd attempts + 5, // 4th, 5th, 6th, 7th and 8th attempts + 5, // 9th, 10th, 11th, 12th and 13th attempts + 3, // 14th, 15th and 16th attempts ], }, custom_merchant_mapping: HashMap::new(), diff --git a/crates/scheduler/src/utils.rs b/crates/scheduler/src/utils.rs index 11924dd1be2..48d02f7fced 100644 --- a/crates/scheduler/src/utils.rs +++ b/crates/scheduler/src/utils.rs @@ -315,7 +315,10 @@ pub fn get_schedule_time( if retry_count == 0 { Some(mapping.start_after) } else { - get_delay(retry_count, &mapping.frequencies) + get_delay( + retry_count, + mapping.count.iter().zip(mapping.frequency.iter()), + ) } } @@ -332,7 +335,10 @@ pub fn get_pm_schedule_time( if retry_count == 0 { Some(mapping.start_after) } else { - get_delay(retry_count, &mapping.frequencies) + get_delay( + retry_count, + mapping.count.iter().zip(mapping.frequency.iter()), + ) } } @@ -350,22 +356,25 @@ pub fn get_outgoing_webhook_retry_schedule_time( if retry_count == 0 { Some(retry_mapping.start_after) } else { - get_delay(retry_count, &retry_mapping.frequencies) + get_delay( + retry_count, + retry_mapping + .count + .iter() + .zip(retry_mapping.frequency.iter()), + ) } } /// Get the delay based on the retry count -fn get_delay<'a>( - retry_count: i32, - frequencies: impl IntoIterator, -) -> Option { +fn get_delay<'a>(retry_count: i32, array: impl Iterator) -> Option { // Preferably, fix this by using unsigned ints if retry_count <= 0 { return None; } let mut cumulative_count = 0; - for &(frequency, count) in frequencies.into_iter() { + for (&count, &frequency) in array { cumulative_count += count; if cumulative_count >= retry_count { return Some(frequency); @@ -414,7 +423,8 @@ mod tests { #[test] fn test_get_delay() { - let frequency_count = vec![(300, 10), (600, 5), (1800, 3), (3600, 2)]; + let count = [10, 5, 3, 2]; + let frequency = [300, 600, 1800, 3600]; let retry_counts_and_expected_delays = [ (-4, None), @@ -432,7 +442,7 @@ mod tests { ]; for (retry_count, expected_delay) in retry_counts_and_expected_delays { - let delay = get_delay(retry_count, &frequency_count); + let delay = get_delay(retry_count, count.iter().zip(frequency.iter())); assert_eq!( delay, expected_delay, diff --git a/crates/storage_impl/Cargo.toml b/crates/storage_impl/Cargo.toml index ab656c3f658..d7107cdccfa 100644 --- a/crates/storage_impl/Cargo.toml +++ b/crates/storage_impl/Cargo.toml @@ -11,14 +11,14 @@ license.workspace = true [features] default = ["olap", "oltp"] oltp = [] -olap = ["hyperswitch_domain_models/olap"] -payouts = ["hyperswitch_domain_models/payouts"] +olap = ["data_models/olap"] +payouts = ["data_models/payouts"] [dependencies] # First Party dependencies api_models = { version = "0.1.0", path = "../api_models" } common_utils = { version = "0.1.0", path = "../common_utils" } -hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false } +data_models = { version = "0.1.0", path = "../data_models", default-features = false } diesel_models = { version = "0.1.0", path = "../diesel_models" } masking = { version = "0.1.0", path = "../masking" } redis_interface = { version = "0.1.0", path = "../redis_interface" } @@ -26,22 +26,23 @@ router_derive = { version = "0.1.0", path = "../router_derive" } router_env = { version = "0.1.0", path = "../router_env" } # Third party crates -actix-web = "4.5.1" +actix-web = "4.3.1" async-bb8-diesel = { git = "https://github.com/jarnura/async-bb8-diesel", rev = "53b4ab901aab7635c8215fd1c2d542c8db443094" } -async-trait = "0.1.79" -bb8 = "0.8.3" -bytes = "1.6.0" -config = { version = "0.14.0", features = ["toml"] } -crc32fast = "1.4.0" -diesel = { version = "2.1.5", default-features = false, features = ["postgres"] } -dyn-clone = "1.0.17" +async-trait = "0.1.72" +bb8 = "0.8.1" +bytes = "1.4.0" +config = { version = "0.13.3", features = ["toml"] } +crc32fast = "1.3.2" +diesel = { version = "2.1.0", default-features = false, features = ["postgres"] } +dyn-clone = "1.0.12" error-stack = "0.4.1" -futures = "0.3.30" -http = "0.2.12" +futures = "0.3.28" +http = "0.2.9" mime = "0.3.17" moka = { version = "0.12", features = ["future"] } -once_cell = "1.19.0" -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" -thiserror = "1.0.58" -tokio = { version = "1.37.0", features = ["rt-multi-thread"] } +once_cell = "1.18.0" +ring = "0.16.20" +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" +thiserror = "1.0.40" +tokio = { version = "1.36.0", features = ["rt-multi-thread"] } diff --git a/crates/storage_impl/src/customers.rs b/crates/storage_impl/src/customers.rs deleted file mode 100644 index 0d89e1c454b..00000000000 --- a/crates/storage_impl/src/customers.rs +++ /dev/null @@ -1,5 +0,0 @@ -use diesel_models::customers::Customer; - -use crate::redis::kv_store::KvStorePartition; - -impl KvStorePartition for Customer {} diff --git a/crates/storage_impl/src/database/store.rs b/crates/storage_impl/src/database/store.rs index 17ae76b5bb0..92ba8910bfb 100644 --- a/crates/storage_impl/src/database/store.rs +++ b/crates/storage_impl/src/database/store.rs @@ -1,8 +1,8 @@ use async_bb8_diesel::{AsyncConnection, ConnectionError}; use bb8::CustomizeConnection; +use data_models::errors::{StorageError, StorageResult}; use diesel::PgConnection; use error_stack::ResultExt; -use hyperswitch_domain_models::errors::{StorageError, StorageResult}; use masking::PeekInterface; use crate::config::Database; diff --git a/crates/storage_impl/src/errors.rs b/crates/storage_impl/src/errors.rs index 41099bea75f..7002d0946f7 100644 --- a/crates/storage_impl/src/errors.rs +++ b/crates/storage_impl/src/errors.rs @@ -3,8 +3,8 @@ use std::fmt::Display; use actix_web::ResponseError; use common_utils::errors::ErrorSwitch; use config::ConfigError; +use data_models::errors::StorageError as DataStorageError; use http::StatusCode; -use hyperswitch_domain_models::errors::StorageError as DataStorageError; pub use redis_interface::errors::RedisError; use router_env::opentelemetry::metrics::MetricsError; @@ -12,6 +12,30 @@ use crate::{errors as storage_errors, store::errors::DatabaseError}; pub type ApplicationResult = Result; +macro_rules! impl_error_display { + ($st: ident, $arg: tt) => { + impl Display for $st { + fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + fmt, + "{{ error_type: {:?}, error_description: {} }}", + self, $arg + ) + } + } + }; +} +macro_rules! impl_error_type { + ($name: ident, $arg: tt) => { + #[derive(Debug)] + pub struct $name; + + impl_error_display!($name, $arg); + + impl std::error::Error for $name {} + }; +} + #[derive(Debug, thiserror::Error)] pub enum StorageError { #[error("DatabaseError: {0:?}")] @@ -152,6 +176,8 @@ impl RedisErrorExt for error_stack::Report { } } +impl_error_type!(EncryptionError, "Encryption error"); + #[derive(Debug, thiserror::Error)] pub enum ApplicationError { // Display's impl can be overridden by the attribute error marco. @@ -184,6 +210,12 @@ impl From for ApplicationError { } } +impl From for EncryptionError { + fn from(_: ring::error::Unspecified) -> Self { + Self + } +} + impl From for ApplicationError { fn from(err: ConfigError) -> Self { Self::ConfigurationError(err) @@ -369,8 +401,6 @@ pub enum HealthCheckDBError { SqlxAnalyticsError, #[error("Error while executing query in Clickhouse Analytics")] ClickhouseAnalyticsError, - #[error("Error while executing query in Opensearch")] - OpensearchError, } impl From for HealthCheckDBError { diff --git a/crates/storage_impl/src/lib.rs b/crates/storage_impl/src/lib.rs index e35d1f41511..c4bbf768338 100644 --- a/crates/storage_impl/src/lib.rs +++ b/crates/storage_impl/src/lib.rs @@ -1,21 +1,18 @@ use std::sync::Arc; +use data_models::errors::{StorageError, StorageResult}; use diesel_models as store; use error_stack::ResultExt; -use hyperswitch_domain_models::errors::{StorageError, StorageResult}; use masking::StrongSecret; use redis::{kv_store::RedisConnInterface, RedisStore}; mod address; pub mod config; pub mod connection; -pub mod customers; pub mod database; pub mod errors; mod lookup; -pub mod mandate; pub mod metrics; pub mod mock_db; -pub mod payment_method; pub mod payments; #[cfg(feature = "payouts")] pub mod payouts; @@ -25,9 +22,9 @@ mod reverse_lookup; mod utils; use common_utils::errors::CustomResult; -use database::store::PgPool; #[cfg(not(feature = "payouts"))] -use hyperswitch_domain_models::{PayoutAttemptInterface, PayoutsInterface}; +use data_models::{PayoutAttemptInterface, PayoutsInterface}; +use database::store::PgPool; pub use mock_db::MockDb; use redis_interface::{errors::RedisError, SaddReply}; @@ -364,36 +361,6 @@ impl UniqueConstraints for diesel_models::PayoutAttempt { } } -impl UniqueConstraints for diesel_models::PaymentMethod { - fn unique_constraints(&self) -> Vec { - vec![format!("paymentmethod_{}", self.payment_method_id)] - } - fn table_name(&self) -> &str { - "PaymentMethod" - } -} - -impl UniqueConstraints for diesel_models::Mandate { - fn unique_constraints(&self) -> Vec { - vec![format!("mand_{}_{}", self.merchant_id, self.mandate_id)] - } - fn table_name(&self) -> &str { - "Mandate" - } -} - -impl UniqueConstraints for diesel_models::Customer { - fn unique_constraints(&self) -> Vec { - vec![format!( - "customer_{}_{}", - self.customer_id, self.merchant_id - )] - } - fn table_name(&self) -> &str { - "Customer" - } -} - #[cfg(not(feature = "payouts"))] impl PayoutAttemptInterface for KVRouterStore {} #[cfg(not(feature = "payouts"))] diff --git a/crates/storage_impl/src/lookup.rs b/crates/storage_impl/src/lookup.rs index f8daabf2e9e..12d91ba5e95 100644 --- a/crates/storage_impl/src/lookup.rs +++ b/crates/storage_impl/src/lookup.rs @@ -1,4 +1,5 @@ use common_utils::errors::CustomResult; +use data_models::errors; use diesel_models::{ enums as storage_enums, kv, reverse_lookup::{ @@ -6,13 +7,12 @@ use diesel_models::{ }, }; use error_stack::ResultExt; -use hyperswitch_domain_models::errors; use redis_interface::SetnxReply; use crate::{ diesel_error_to_data_error, errors::RedisErrorExt, - redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}, + redis::kv_store::{kv_wrapper, KvOperation}, utils::{self, try_redis_get_else_try_database_get}, DatabaseStore, KVRouterStore, RouterStore, }; @@ -94,9 +94,7 @@ impl ReverseLookupInterface for KVRouterStore { match kv_wrapper::( self, KvOperation::SetNx(&created_rev_lookup, redis_entry), - PartitionKey::CombinationKey { - combination: &format!("reverse_lookup_{}", &created_rev_lookup.lookup_id), - }, + format!("reverse_lookup_{}", &created_rev_lookup.lookup_id), ) .await .map_err(|err| err.to_redis_failed_response(&created_rev_lookup.lookup_id))? @@ -131,9 +129,7 @@ impl ReverseLookupInterface for KVRouterStore { kv_wrapper( self, KvOperation::::Get, - PartitionKey::CombinationKey { - combination: &format!("reverse_lookup_{id}"), - }, + format!("reverse_lookup_{id}"), ) .await? .try_into_get() diff --git a/crates/storage_impl/src/mandate.rs b/crates/storage_impl/src/mandate.rs deleted file mode 100644 index 10e1b193ee7..00000000000 --- a/crates/storage_impl/src/mandate.rs +++ /dev/null @@ -1,5 +0,0 @@ -use diesel_models::Mandate; - -use crate::redis::kv_store::KvStorePartition; - -impl KvStorePartition for Mandate {} diff --git a/crates/storage_impl/src/mock_db.rs b/crates/storage_impl/src/mock_db.rs index 5cf0123eb7b..77cda9817a3 100644 --- a/crates/storage_impl/src/mock_db.rs +++ b/crates/storage_impl/src/mock_db.rs @@ -1,12 +1,12 @@ use std::sync::Arc; -use diesel_models::{self as store}; -use error_stack::ResultExt; -use futures::lock::Mutex; -use hyperswitch_domain_models::{ +use data_models::{ errors::StorageError, payments::{payment_attempt::PaymentAttempt, PaymentIntent}, }; +use diesel_models::{self as store}; +use error_stack::ResultExt; +use futures::lock::Mutex; use redis_interface::RedisSettings; use crate::redis::RedisStore; @@ -19,7 +19,7 @@ pub mod payout_attempt; pub mod payouts; pub mod redis_conn; #[cfg(not(feature = "payouts"))] -use hyperswitch_domain_models::{PayoutAttemptInterface, PayoutsInterface}; +use data_models::{PayoutAttemptInterface, PayoutsInterface}; #[derive(Clone)] pub struct MockDb { diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs index 33ef6d416f2..acec82e1721 100644 --- a/crates/storage_impl/src/mock_db/payment_attempt.rs +++ b/crates/storage_impl/src/mock_db/payment_attempt.rs @@ -1,12 +1,12 @@ use api_models::enums::{AuthenticationType, Connector, PaymentMethod, PaymentMethodType}; use common_utils::errors::CustomResult; -use diesel_models::enums as storage_enums; -use hyperswitch_domain_models::{ +use data_models::{ errors::StorageError, payments::payment_attempt::{ PaymentAttempt, PaymentAttemptInterface, PaymentAttemptNew, PaymentAttemptUpdate, }, }; +use diesel_models::enums as storage_enums; use super::MockDb; use crate::DataModelExt; @@ -26,13 +26,11 @@ impl PaymentAttemptInterface for MockDb { async fn get_filters_for_payments( &self, - _pi: &[hyperswitch_domain_models::payments::PaymentIntent], + _pi: &[data_models::payments::PaymentIntent], _merchant_id: &str, _storage_scheme: storage_enums::MerchantStorageScheme, - ) -> CustomResult< - hyperswitch_domain_models::payments::payment_attempt::PaymentListFilters, - StorageError, - > { + ) -> CustomResult + { Err(StorageError::MockDbError)? } @@ -44,7 +42,6 @@ impl PaymentAttemptInterface for MockDb { _payment_method: Option>, _payment_method_type: Option>, _authentication_type: Option>, - _merchanat_connector_id: Option>, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult { Err(StorageError::MockDbError)? diff --git a/crates/storage_impl/src/mock_db/payment_intent.rs b/crates/storage_impl/src/mock_db/payment_intent.rs index 1dfb7ac9d91..a693eb5e261 100644 --- a/crates/storage_impl/src/mock_db/payment_intent.rs +++ b/crates/storage_impl/src/mock_db/payment_intent.rs @@ -1,7 +1,5 @@ use common_utils::errors::CustomResult; -use diesel_models::enums as storage_enums; -use error_stack::ResultExt; -use hyperswitch_domain_models::{ +use data_models::{ errors::StorageError, payments::{ payment_attempt::PaymentAttempt, @@ -9,6 +7,8 @@ use hyperswitch_domain_models::{ PaymentIntent, }, }; +use diesel_models::enums as storage_enums; +use error_stack::ResultExt; use super::MockDb; use crate::DataModelExt; @@ -19,7 +19,7 @@ impl PaymentIntentInterface for MockDb { async fn filter_payment_intent_by_constraints( &self, _merchant_id: &str, - _filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints, + _filters: &data_models::payments::payment_intent::PaymentIntentFetchConstraints, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult, StorageError> { // [#172]: Implement function for `MockDb` @@ -39,7 +39,7 @@ impl PaymentIntentInterface for MockDb { async fn get_filtered_active_attempt_ids_for_total_count( &self, _merchant_id: &str, - _constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints, + _constraints: &data_models::payments::payment_intent::PaymentIntentFetchConstraints, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> error_stack::Result, StorageError> { // [#172]: Implement function for `MockDb` @@ -49,7 +49,7 @@ impl PaymentIntentInterface for MockDb { async fn get_filtered_payment_intents_attempt( &self, _merchant_id: &str, - _constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints, + _constraints: &data_models::payments::payment_intent::PaymentIntentFetchConstraints, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> error_stack::Result, StorageError> { // [#172]: Implement function for `MockDb` @@ -159,7 +159,7 @@ impl PaymentIntentInterface for MockDb { _storage_scheme: storage_enums::MerchantStorageScheme, ) -> error_stack::Result { match payment.active_attempt.clone() { - hyperswitch_domain_models::RemoteStorageObject::ForeignID(id) => { + data_models::RemoteStorageObject::ForeignID(id) => { let attempts = self.payment_attempts.lock().await; let attempt = attempts .iter() @@ -169,7 +169,7 @@ impl PaymentIntentInterface for MockDb { payment.active_attempt = attempt.clone().into(); Ok(attempt.clone()) } - hyperswitch_domain_models::RemoteStorageObject::Object(pa) => Ok(pa.clone()), + data_models::RemoteStorageObject::Object(pa) => Ok(pa.clone()), } } } diff --git a/crates/storage_impl/src/mock_db/payout_attempt.rs b/crates/storage_impl/src/mock_db/payout_attempt.rs index 8f26b8c5810..1590dea6e72 100644 --- a/crates/storage_impl/src/mock_db/payout_attempt.rs +++ b/crates/storage_impl/src/mock_db/payout_attempt.rs @@ -1,14 +1,11 @@ use common_utils::errors::CustomResult; -use diesel_models::enums as storage_enums; -use hyperswitch_domain_models::{ +use data_models::{ errors::StorageError, - payouts::{ - payout_attempt::{ - PayoutAttempt, PayoutAttemptInterface, PayoutAttemptNew, PayoutAttemptUpdate, - }, - payouts::Payouts, + payouts::payout_attempt::{ + PayoutAttempt, PayoutAttemptInterface, PayoutAttemptNew, PayoutAttemptUpdate, }, }; +use diesel_models::enums as storage_enums; use super::MockDb; @@ -18,7 +15,6 @@ impl PayoutAttemptInterface for MockDb { &self, _this: &PayoutAttempt, _payout_attempt_update: PayoutAttemptUpdate, - _payouts: &Payouts, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult { // TODO: Implement function for `MockDb` @@ -27,8 +23,7 @@ impl PayoutAttemptInterface for MockDb { async fn insert_payout_attempt( &self, - _payout_attempt: PayoutAttemptNew, - _payouts: &Payouts, + _payout: PayoutAttemptNew, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult { // TODO: Implement function for `MockDb` @@ -47,13 +42,10 @@ impl PayoutAttemptInterface for MockDb { async fn get_filters_for_payouts( &self, - _payouts: &[Payouts], + _payouts: &[data_models::payouts::payouts::Payouts], _merchant_id: &str, _storage_scheme: storage_enums::MerchantStorageScheme, - ) -> CustomResult< - hyperswitch_domain_models::payouts::payout_attempt::PayoutListFilters, - StorageError, - > { + ) -> CustomResult { Err(StorageError::MockDbError)? } } diff --git a/crates/storage_impl/src/mock_db/payouts.rs b/crates/storage_impl/src/mock_db/payouts.rs index 04e1321f1eb..1af05283696 100644 --- a/crates/storage_impl/src/mock_db/payouts.rs +++ b/crates/storage_impl/src/mock_db/payouts.rs @@ -1,12 +1,11 @@ use common_utils::errors::CustomResult; -use diesel_models::enums as storage_enums; -use hyperswitch_domain_models::{ +#[cfg(all(feature = "olap", feature = "payouts"))] +use data_models::payouts::payout_attempt::PayoutAttempt; +use data_models::{ errors::StorageError, - payouts::{ - payout_attempt::PayoutAttempt, - payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate}, - }, + payouts::payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate}, }; +use diesel_models::enums as storage_enums; use super::MockDb; @@ -26,7 +25,6 @@ impl PayoutsInterface for MockDb { &self, _this: &Payouts, _payout_update: PayoutsUpdate, - _payout_attempt: &PayoutAttempt, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult { // TODO: Implement function for `MockDb` @@ -56,7 +54,7 @@ impl PayoutsInterface for MockDb { async fn filter_payouts_by_constraints( &self, _merchant_id: &str, - _filters: &hyperswitch_domain_models::payouts::PayoutFetchConstraints, + _filters: &data_models::payouts::PayoutFetchConstraints, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult, StorageError> { // TODO: Implement function for `MockDb` @@ -67,9 +65,9 @@ impl PayoutsInterface for MockDb { async fn filter_payouts_and_attempts( &self, _merchant_id: &str, - _filters: &hyperswitch_domain_models::payouts::PayoutFetchConstraints, + _filters: &data_models::payouts::PayoutFetchConstraints, _storage_scheme: storage_enums::MerchantStorageScheme, - ) -> CustomResult, StorageError> { + ) -> CustomResult, StorageError> { // TODO: Implement function for `MockDb` Err(StorageError::MockDbError)? } diff --git a/crates/storage_impl/src/payment_method.rs b/crates/storage_impl/src/payment_method.rs deleted file mode 100644 index 254505eaae2..00000000000 --- a/crates/storage_impl/src/payment_method.rs +++ /dev/null @@ -1,5 +0,0 @@ -use diesel_models::PaymentMethod; - -use crate::redis::kv_store::KvStorePartition; - -impl KvStorePartition for PaymentMethod {} diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs index 4308e463b0c..b8b97628db7 100644 --- a/crates/storage_impl/src/payments/payment_attempt.rs +++ b/crates/storage_impl/src/payments/payment_attempt.rs @@ -1,5 +1,16 @@ use api_models::enums::{AuthenticationType, Connector, PaymentMethod, PaymentMethodType}; use common_utils::{errors::CustomResult, fallback_reverse_lookup_not_found}; +use data_models::{ + errors, + mandates::{MandateAmountData, MandateDataType, MandateDetails}, + payments::{ + payment_attempt::{ + PaymentAttempt, PaymentAttemptInterface, PaymentAttemptNew, PaymentAttemptUpdate, + PaymentListFilters, + }, + PaymentIntent, + }, +}; use diesel_models::{ enums::{ MandateAmountData as DieselMandateAmountData, MandateDataType as DieselMandateType, @@ -13,17 +24,6 @@ use diesel_models::{ reverse_lookup::{ReverseLookup, ReverseLookupNew}, }; use error_stack::ResultExt; -use hyperswitch_domain_models::{ - errors, - mandates::{MandateAmountData, MandateDataType, MandateDetails}, - payments::{ - payment_attempt::{ - PaymentAttempt, PaymentAttemptInterface, PaymentAttemptNew, PaymentAttemptUpdate, - PaymentListFilters, - }, - PaymentIntent, - }, -}; use redis_interface::HsetnxReply; use router_env::{instrument, tracing}; @@ -31,7 +31,7 @@ use crate::{ diesel_error_to_data_error, errors::RedisErrorExt, lookup::ReverseLookupInterface, - redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}, + redis::kv_store::{kv_wrapper, KvOperation}, utils::{pg_connection_read, pg_connection_write, try_redis_get_else_try_database_get}, DataModelExt, DatabaseStore, KVRouterStore, RouterStore, }; @@ -292,7 +292,6 @@ impl PaymentAttemptInterface for RouterStore { payment_method: Option>, payment_method_type: Option>, authentication_type: Option>, - merchant_connector_id: Option>, _storage_scheme: MerchantStorageScheme, ) -> CustomResult { let conn = self @@ -315,7 +314,6 @@ impl PaymentAttemptInterface for RouterStore { payment_method, payment_method_type, authentication_type, - merchant_connector_id, ) .await .map_err(|er| { @@ -341,13 +339,11 @@ impl PaymentAttemptInterface for KVRouterStore { } MerchantStorageScheme::RedisKv => { let payment_attempt = payment_attempt.populate_derived_fields(); - let merchant_id = payment_attempt.merchant_id.clone(); - let payment_id = payment_attempt.payment_id.clone(); - let key = PartitionKey::MerchantIdPaymentId { - merchant_id: &merchant_id, - payment_id: &payment_id, - }; - let key_str = key.to_string(); + let key = format!( + "mid_{}_pid_{}", + payment_attempt.merchant_id, payment_attempt.payment_id + ); + let created_attempt = PaymentAttempt { id: Default::default(), payment_id: payment_attempt.payment_id.clone(), @@ -428,7 +424,7 @@ impl PaymentAttemptInterface for KVRouterStore { "pa_{}_{}", &created_attempt.merchant_id, &created_attempt.attempt_id, ), - pk_id: key_str.clone(), + pk_id: key.clone(), sk_id: field.clone(), source: "payment_attempt".to_string(), updated_by: storage_scheme.to_string(), @@ -443,15 +439,15 @@ impl PaymentAttemptInterface for KVRouterStore { &created_attempt.clone().to_storage_model(), redis_entry, ), - key, + &key, ) .await - .map_err(|err| err.to_redis_failed_response(&key_str))? + .map_err(|err| err.to_redis_failed_response(&key))? .try_into_hsetnx() { Ok(HsetnxReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue { entity: "payment attempt", - key: Some(key_str), + key: Some(key), } .into()), Ok(HsetnxReply::KeySet) => Ok(created_attempt), @@ -475,11 +471,7 @@ impl PaymentAttemptInterface for KVRouterStore { .await } MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPaymentId { - merchant_id: &this.merchant_id, - payment_id: &this.payment_id, - }; - let key_str = key.to_string(); + let key = format!("mid_{}_pid_{}", this.merchant_id, this.payment_id); let old_connector_transaction_id = &this.connector_transaction_id; let old_preprocessing_id = &this.preprocessing_step_id; let updated_attempt = PaymentAttempt::from_storage_model( @@ -511,7 +503,7 @@ impl PaymentAttemptInterface for KVRouterStore { (None, Some(connector_transaction_id)) => { add_connector_txn_id_to_reverse_lookup( self, - key_str.as_str(), + key.as_str(), this.merchant_id.as_str(), updated_attempt.attempt_id.as_str(), connector_transaction_id.as_str(), @@ -523,7 +515,7 @@ impl PaymentAttemptInterface for KVRouterStore { if old_connector_transaction_id.ne(connector_transaction_id) { add_connector_txn_id_to_reverse_lookup( self, - key_str.as_str(), + key.as_str(), this.merchant_id.as_str(), updated_attempt.attempt_id.as_str(), connector_transaction_id.as_str(), @@ -539,7 +531,7 @@ impl PaymentAttemptInterface for KVRouterStore { (None, Some(preprocessing_id)) => { add_preprocessing_id_to_reverse_lookup( self, - key_str.as_str(), + key.as_str(), this.merchant_id.as_str(), updated_attempt.attempt_id.as_str(), preprocessing_id.as_str(), @@ -551,7 +543,7 @@ impl PaymentAttemptInterface for KVRouterStore { if old_preprocessing_id.ne(preprocessing_id) { add_preprocessing_id_to_reverse_lookup( self, - key_str.as_str(), + key.as_str(), this.merchant_id.as_str(), updated_attempt.attempt_id.as_str(), preprocessing_id.as_str(), @@ -566,7 +558,7 @@ impl PaymentAttemptInterface for KVRouterStore { kv_wrapper::<(), _, _>( self, KvOperation::Hset::((&field, redis_value), redis_entry), - key, + &key, ) .await .change_context(errors::StorageError::KVError)? @@ -613,9 +605,7 @@ impl PaymentAttemptInterface for KVRouterStore { .await ); - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; + let key = &lookup.pk_id; Box::pin(try_redis_get_else_try_database_get( async { @@ -646,10 +636,7 @@ impl PaymentAttemptInterface for KVRouterStore { match storage_scheme { MerchantStorageScheme::PostgresOnly => database_call().await, MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPaymentId { - merchant_id, - payment_id, - }; + let key = format!("mid_{merchant_id}_pid_{payment_id}"); let pattern = "pa_*"; let redis_fut = async { @@ -698,10 +685,7 @@ impl PaymentAttemptInterface for KVRouterStore { match storage_scheme { MerchantStorageScheme::PostgresOnly => database_call().await, MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPaymentId { - merchant_id, - payment_id, - }; + let key = format!("mid_{merchant_id}_pid_{payment_id}"); let pattern = "pa_*"; let redis_fut = async { @@ -766,9 +750,7 @@ impl PaymentAttemptInterface for KVRouterStore { .await ); - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; + let key = &lookup.pk_id; Box::pin(try_redis_get_else_try_database_get( async { kv_wrapper( @@ -814,10 +796,7 @@ impl PaymentAttemptInterface for KVRouterStore { .await } MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPaymentId { - merchant_id, - payment_id, - }; + let key = format!("mid_{merchant_id}_pid_{payment_id}"); let field = format!("pa_{attempt_id}"); Box::pin(try_redis_get_else_try_database_get( async { @@ -872,9 +851,7 @@ impl PaymentAttemptInterface for KVRouterStore { .await ); - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; + let key = &lookup.pk_id; Box::pin(try_redis_get_else_try_database_get( async { kv_wrapper( @@ -930,9 +907,7 @@ impl PaymentAttemptInterface for KVRouterStore { ) .await ); - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; + let key = &lookup.pk_id; Box::pin(try_redis_get_else_try_database_get( async { @@ -977,10 +952,7 @@ impl PaymentAttemptInterface for KVRouterStore { .await } MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPaymentId { - merchant_id, - payment_id, - }; + let key = format!("mid_{merchant_id}_pid_{payment_id}"); Box::pin(try_redis_get_else_try_database_get( async { kv_wrapper(self, KvOperation::::Scan("pa_*"), key) @@ -1023,7 +995,6 @@ impl PaymentAttemptInterface for KVRouterStore { payment_method: Option>, payment_method_type: Option>, authentication_type: Option>, - merchant_connector_id: Option>, storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.router_store @@ -1034,7 +1005,6 @@ impl PaymentAttemptInterface for KVRouterStore { payment_method, payment_method_type, authentication_type, - merchant_connector_id, storage_scheme, ) .await @@ -1433,19 +1403,11 @@ impl DataModelExt for PaymentAttemptUpdate { error_message, updated_by, }, - Self::PaymentMethodDetailsUpdate { - payment_method_id, - updated_by, - } => DieselPaymentAttemptUpdate::PaymentMethodDetailsUpdate { - payment_method_id, - updated_by, - }, Self::ConfirmUpdate { amount, currency, status, authentication_type, - capture_method, payment_method, browser_info, connector, @@ -1473,7 +1435,6 @@ impl DataModelExt for PaymentAttemptUpdate { currency, status, authentication_type, - capture_method, payment_method, browser_info, connector, @@ -1746,7 +1707,6 @@ impl DataModelExt for PaymentAttemptUpdate { currency, status, authentication_type, - capture_method, payment_method, browser_info, connector, @@ -1774,7 +1734,6 @@ impl DataModelExt for PaymentAttemptUpdate { currency, status, authentication_type, - capture_method, payment_method, browser_info, connector, @@ -1818,13 +1777,6 @@ impl DataModelExt for PaymentAttemptUpdate { error_message, updated_by, }, - DieselPaymentAttemptUpdate::PaymentMethodDetailsUpdate { - payment_method_id, - updated_by, - } => Self::PaymentMethodDetailsUpdate { - payment_method_id, - updated_by, - }, DieselPaymentAttemptUpdate::ResponseUpdate { status, connector, diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs index fcc4ec63ff2..6323c9a9850 100644 --- a/crates/storage_impl/src/payments/payment_intent.rs +++ b/crates/storage_impl/src/payments/payment_intent.rs @@ -1,11 +1,18 @@ #[cfg(feature = "olap")] -use api_models::payments::AmountFilter; -#[cfg(feature = "olap")] use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl}; -#[cfg(feature = "olap")] -use common_utils::errors::ReportSwitchExt; use common_utils::{date_time, ext_traits::Encode}; #[cfg(feature = "olap")] +use data_models::payments::payment_intent::PaymentIntentFetchConstraints; +use data_models::{ + errors::StorageError, + payments::{ + payment_attempt::PaymentAttempt, + payment_intent::{PaymentIntentInterface, PaymentIntentNew, PaymentIntentUpdate}, + PaymentIntent, + }, + RemoteStorageObject, +}; +#[cfg(feature = "olap")] use diesel::{associations::HasTable, ExpressionMethods, JoinOnDsl, QueryDsl}; use diesel_models::{ enums::MerchantStorageScheme, @@ -22,17 +29,6 @@ use diesel_models::{ schema::{payment_attempt::dsl as pa_dsl, payment_intent::dsl as pi_dsl}, }; use error_stack::ResultExt; -#[cfg(feature = "olap")] -use hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints; -use hyperswitch_domain_models::{ - errors::StorageError, - payments::{ - payment_attempt::PaymentAttempt, - payment_intent::{PaymentIntentInterface, PaymentIntentNew, PaymentIntentUpdate}, - PaymentIntent, - }, - RemoteStorageObject, -}; use redis_interface::HsetnxReply; #[cfg(feature = "olap")] use router_env::logger; @@ -43,7 +39,7 @@ use crate::connection; use crate::{ diesel_error_to_data_error, errors::RedisErrorExt, - redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}, + redis::kv_store::{kv_wrapper, KvOperation}, utils::{self, pg_connection_read, pg_connection_write}, DataModelExt, DatabaseStore, KVRouterStore, }; @@ -63,13 +59,7 @@ impl PaymentIntentInterface for KVRouterStore { } MerchantStorageScheme::RedisKv => { - let merchant_id = new.merchant_id.clone(); - let payment_id = new.payment_id.clone(); - let key = PartitionKey::MerchantIdPaymentId { - merchant_id: &merchant_id, - payment_id: &payment_id, - }; - let key_str = key.to_string(); + let key = format!("mid_{}_pid_{}", new.merchant_id, new.payment_id); let field = format!("pi_{}", new.payment_id); let created_intent = PaymentIntent { id: 0i32, @@ -129,15 +119,15 @@ impl PaymentIntentInterface for KVRouterStore { &created_intent.clone().to_storage_model(), redis_entry, ), - key, + &key, ) .await - .map_err(|err| err.to_redis_failed_response(&key_str))? + .map_err(|err| err.to_redis_failed_response(&key))? .try_into_hsetnx() { Ok(HsetnxReply::KeyNotSet) => Err(StorageError::DuplicateValue { entity: "payment_intent", - key: Some(key_str), + key: Some(key), } .into()), Ok(HsetnxReply::KeySet) => Ok(created_intent), @@ -161,13 +151,7 @@ impl PaymentIntentInterface for KVRouterStore { .await } MerchantStorageScheme::RedisKv => { - let merchant_id = this.merchant_id.clone(); - let payment_id = this.payment_id.clone(); - let key = PartitionKey::MerchantIdPaymentId { - merchant_id: &merchant_id, - payment_id: &payment_id, - }; - let key_str = key.to_string(); + let key = format!("mid_{}_pid_{}", this.merchant_id, this.payment_id); let field = format!("pi_{}", this.payment_id); let diesel_intent_update = payment_intent_update.to_storage_model(); @@ -196,10 +180,10 @@ impl PaymentIntentInterface for KVRouterStore { kv_wrapper::<(), _, _>( self, KvOperation::::Hset((&field, redis_value), redis_entry), - key, + &key, ) .await - .map_err(|err| err.to_redis_failed_response(&key_str))? + .map_err(|err| err.to_redis_failed_response(&key))? .try_into_hset() .change_context(StorageError::KVError)?; @@ -228,17 +212,14 @@ impl PaymentIntentInterface for KVRouterStore { MerchantStorageScheme::PostgresOnly => database_call().await, MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPaymentId { - merchant_id, - payment_id, - }; + let key = format!("mid_{merchant_id}_pid_{payment_id}"); let field = format!("pi_{payment_id}"); Box::pin(utils::try_redis_get_else_try_database_get( async { kv_wrapper::( self, KvOperation::::HGet(&field), - key, + &key, ) .await? .try_into_hget() @@ -257,7 +238,7 @@ impl PaymentIntentInterface for KVRouterStore { _storage_scheme: MerchantStorageScheme, ) -> error_stack::Result { match payment.active_attempt.clone() { - hyperswitch_domain_models::RemoteStorageObject::ForeignID(attempt_id) => { + data_models::RemoteStorageObject::ForeignID(attempt_id) => { let conn = pg_connection_read(self).await?; let pa = DieselPaymentAttempt::find_by_merchant_id_attempt_id( @@ -271,11 +252,10 @@ impl PaymentIntentInterface for KVRouterStore { er.change_context(new_err) }) .map(PaymentAttempt::from_storage_model)?; - payment.active_attempt = - hyperswitch_domain_models::RemoteStorageObject::Object(pa.clone()); + payment.active_attempt = data_models::RemoteStorageObject::Object(pa.clone()); Ok(pa) } - hyperswitch_domain_models::RemoteStorageObject::Object(pa) => Ok(pa.clone()), + data_models::RemoteStorageObject::Object(pa) => Ok(pa.clone()), } } @@ -397,7 +377,7 @@ impl PaymentIntentInterface for crate::RouterStore { _storage_scheme: MerchantStorageScheme, ) -> error_stack::Result { match &payment.active_attempt { - hyperswitch_domain_models::RemoteStorageObject::ForeignID(attempt_id) => { + data_models::RemoteStorageObject::ForeignID(attempt_id) => { let conn = pg_connection_read(self).await?; let pa = DieselPaymentAttempt::find_by_merchant_id_attempt_id( @@ -411,11 +391,10 @@ impl PaymentIntentInterface for crate::RouterStore { er.change_context(new_err) }) .map(PaymentAttempt::from_storage_model)?; - payment.active_attempt = - hyperswitch_domain_models::RemoteStorageObject::Object(pa.clone()); + payment.active_attempt = data_models::RemoteStorageObject::Object(pa.clone()); Ok(pa) } - hyperswitch_domain_models::RemoteStorageObject::Object(pa) => Ok(pa.clone()), + data_models::RemoteStorageObject::Object(pa) => Ok(pa.clone()), } } @@ -555,6 +534,8 @@ impl PaymentIntentInterface for crate::RouterStore { constraints: &PaymentIntentFetchConstraints, storage_scheme: MerchantStorageScheme, ) -> error_stack::Result, StorageError> { + use common_utils::errors::ReportSwitchExt; + let conn = connection::pg_connection_read(self).await.switch()?; let conn = async_bb8_diesel::Connection::as_async_conn(&conn); let mut query = DieselPaymentIntent::table() @@ -619,26 +600,9 @@ impl PaymentIntentInterface for crate::RouterStore { query = query.offset(params.offset.into()); - query = match params.amount_filter { - Some(AmountFilter { - start_amount: Some(start), - end_amount: Some(end), - }) => query.filter(pi_dsl::amount.between(start, end)), - Some(AmountFilter { - start_amount: Some(start), - end_amount: None, - }) => query.filter(pi_dsl::amount.ge(start)), - Some(AmountFilter { - start_amount: None, - end_amount: Some(end), - }) => query.filter(pi_dsl::amount.le(end)), - _ => query, - }; - - query = match ¶ms.currency { - Some(currency) => query.filter(pi_dsl::currency.eq_any(currency.clone())), - None => query, - }; + if let Some(currency) = ¶ms.currency { + query = query.filter(pi_dsl::currency.eq_any(currency.clone())); + } let connectors = params .connector @@ -674,13 +638,6 @@ impl PaymentIntentInterface for crate::RouterStore { None => query, }; - query = match ¶ms.merchant_connector_id { - Some(merchant_connector_id) => query.filter( - pa_dsl::merchant_connector_id.eq_any(merchant_connector_id.clone()), - ), - None => query, - }; - query } }; @@ -718,6 +675,8 @@ impl PaymentIntentInterface for crate::RouterStore { constraints: &PaymentIntentFetchConstraints, _storage_scheme: MerchantStorageScheme, ) -> error_stack::Result, StorageError> { + use common_utils::errors::ReportSwitchExt; + let conn = connection::pg_connection_read(self).await.switch()?; let conn = async_bb8_diesel::Connection::as_async_conn(&conn); let mut query = DieselPaymentIntent::table() @@ -748,22 +707,6 @@ impl PaymentIntentInterface for crate::RouterStore { None => query, }; - query = match params.amount_filter { - Some(AmountFilter { - start_amount: Some(start), - end_amount: Some(end), - }) => query.filter(pi_dsl::amount.between(start, end)), - Some(AmountFilter { - start_amount: Some(start), - end_amount: None, - }) => query.filter(pi_dsl::amount.ge(start)), - Some(AmountFilter { - start_amount: None, - end_amount: Some(end), - }) => query.filter(pi_dsl::amount.le(end)), - _ => query, - }; - query = match ¶ms.currency { Some(currency) => query.filter(pi_dsl::currency.eq_any(currency.clone())), None => query, @@ -1115,11 +1058,9 @@ impl DataModelExt for PaymentIntentUpdate { updated_by, }, Self::ApproveUpdate { - status, merchant_decision, updated_by, } => DieselPaymentIntentUpdate::ApproveUpdate { - status, merchant_decision, updated_by, }, diff --git a/crates/storage_impl/src/payouts/payout_attempt.rs b/crates/storage_impl/src/payouts/payout_attempt.rs index 6a62832e1bf..1f6c02c1fba 100644 --- a/crates/storage_impl/src/payouts/payout_attempt.rs +++ b/crates/storage_impl/src/payouts/payout_attempt.rs @@ -2,6 +2,16 @@ use std::str::FromStr; use api_models::enums::PayoutConnectors; use common_utils::{errors::CustomResult, ext_traits::Encode, fallback_reverse_lookup_not_found}; +use data_models::{ + errors, + payouts::{ + payout_attempt::{ + PayoutAttempt, PayoutAttemptInterface, PayoutAttemptNew, PayoutAttemptUpdate, + PayoutListFilters, + }, + payouts::Payouts, + }, +}; use diesel_models::{ enums::MerchantStorageScheme, kv, @@ -12,16 +22,6 @@ use diesel_models::{ ReverseLookupNew, }; use error_stack::ResultExt; -use hyperswitch_domain_models::{ - errors, - payouts::{ - payout_attempt::{ - PayoutAttempt, PayoutAttemptInterface, PayoutAttemptNew, PayoutAttemptUpdate, - PayoutListFilters, - }, - payouts::Payouts, - }, -}; use redis_interface::HsetnxReply; use router_env::{instrument, logger, tracing}; @@ -29,7 +29,7 @@ use crate::{ diesel_error_to_data_error, errors::RedisErrorExt, lookup::ReverseLookupInterface, - redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}, + redis::kv_store::{kv_wrapper, KvOperation}, utils::{self, pg_connection_read, pg_connection_write}, DataModelExt, DatabaseStore, KVRouterStore, }; @@ -40,23 +40,19 @@ impl PayoutAttemptInterface for KVRouterStore { async fn insert_payout_attempt( &self, new_payout_attempt: PayoutAttemptNew, - payouts: &Payouts, storage_scheme: MerchantStorageScheme, ) -> error_stack::Result { match storage_scheme { MerchantStorageScheme::PostgresOnly => { self.router_store - .insert_payout_attempt(new_payout_attempt, payouts, storage_scheme) + .insert_payout_attempt(new_payout_attempt, storage_scheme) .await } MerchantStorageScheme::RedisKv => { - let merchant_id = new_payout_attempt.merchant_id.clone(); - let payout_attempt_id = new_payout_attempt.payout_id.clone(); - let key = PartitionKey::MerchantIdPayoutAttemptId { - merchant_id: &merchant_id, - payout_attempt_id: &payout_attempt_id, - }; - let key_str = key.to_string(); + let key = format!( + "mid_{}_poa_{}", + new_payout_attempt.merchant_id, new_payout_attempt.payout_id + ); let now = common_utils::date_time::now(); let created_attempt = PayoutAttempt { payout_attempt_id: new_payout_attempt.payout_attempt_id.clone(), @@ -95,7 +91,7 @@ impl PayoutAttemptInterface for KVRouterStore { "poa_{}_{}", &created_attempt.merchant_id, &created_attempt.payout_attempt_id, ), - pk_id: key_str.clone(), + pk_id: key.clone(), sk_id: field.clone(), source: "payout_attempt".to_string(), updated_by: storage_scheme.to_string(), @@ -110,15 +106,15 @@ impl PayoutAttemptInterface for KVRouterStore { &created_attempt.clone().to_storage_model(), redis_entry, ), - key, + &key, ) .await - .map_err(|err| err.to_redis_failed_response(&key_str))? + .map_err(|err| err.to_redis_failed_response(&key))? .try_into_hsetnx() { Ok(HsetnxReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue { entity: "payout attempt", - key: Some(key_str), + key: Some(key), } .into()), Ok(HsetnxReply::KeySet) => Ok(created_attempt), @@ -133,21 +129,16 @@ impl PayoutAttemptInterface for KVRouterStore { &self, this: &PayoutAttempt, payout_update: PayoutAttemptUpdate, - payouts: &Payouts, storage_scheme: MerchantStorageScheme, ) -> error_stack::Result { match storage_scheme { MerchantStorageScheme::PostgresOnly => { self.router_store - .update_payout_attempt(this, payout_update, payouts, storage_scheme) + .update_payout_attempt(this, payout_update, storage_scheme) .await } MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPayoutAttemptId { - merchant_id: &this.merchant_id, - payout_attempt_id: &this.payout_id, - }; - let key_str = key.to_string(); + let key = format!("mid_{}_poa_{}", this.merchant_id, this.payout_id); let field = format!("poa_{}", this.payout_attempt_id); let diesel_payout_update = payout_update.to_storage_model(); @@ -176,10 +167,10 @@ impl PayoutAttemptInterface for KVRouterStore { kv_wrapper::<(), _, _>( self, KvOperation::::Hset((&field, redis_value), redis_entry), - key, + &key, ) .await - .map_err(|err| err.to_redis_failed_response(&key_str))? + .map_err(|err| err.to_redis_failed_response(&key))? .try_into_hset() .change_context(errors::StorageError::KVError)?; @@ -218,9 +209,7 @@ impl PayoutAttemptInterface for KVRouterStore { ) .await ); - let key = PartitionKey::CombinationKey { - combination: &lookup.pk_id, - }; + let key = &lookup.pk_id; Box::pin(utils::try_redis_get_else_try_database_get( async { kv_wrapper( @@ -265,7 +254,6 @@ impl PayoutAttemptInterface for crate::RouterStore { async fn insert_payout_attempt( &self, new: PayoutAttemptNew, - _payouts: &Payouts, _storage_scheme: MerchantStorageScheme, ) -> error_stack::Result { let conn = pg_connection_write(self).await?; @@ -284,7 +272,6 @@ impl PayoutAttemptInterface for crate::RouterStore { &self, this: &PayoutAttempt, payout: PayoutAttemptUpdate, - _payouts: &Payouts, _storage_scheme: MerchantStorageScheme, ) -> error_stack::Result { let conn = pg_connection_write(self).await?; diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rs index 19921121a94..c6ff6250d48 100644 --- a/crates/storage_impl/src/payouts/payouts.rs +++ b/crates/storage_impl/src/payouts/payouts.rs @@ -2,14 +2,13 @@ use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl}; use common_utils::ext_traits::Encode; #[cfg(feature = "olap")] -use diesel::{associations::HasTable, ExpressionMethods, JoinOnDsl, QueryDsl}; -#[cfg(feature = "olap")] -use diesel_models::{ - customers::Customer as DieselCustomer, - payout_attempt::PayoutAttempt as DieselPayoutAttempt, - query::generics::db_metrics, - schema::{customers::dsl as cust_dsl, payout_attempt::dsl as poa_dsl, payouts::dsl as po_dsl}, +use data_models::payouts::{payout_attempt::PayoutAttempt, PayoutFetchConstraints}; +use data_models::{ + errors::StorageError, + payouts::payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate}, }; +#[cfg(feature = "olap")] +use diesel::{associations::HasTable, ExpressionMethods, JoinOnDsl, QueryDsl}; use diesel_models::{ enums::MerchantStorageScheme, kv, @@ -18,16 +17,13 @@ use diesel_models::{ PayoutsUpdate as DieselPayoutsUpdate, }, }; -use error_stack::ResultExt; #[cfg(feature = "olap")] -use hyperswitch_domain_models::payouts::PayoutFetchConstraints; -use hyperswitch_domain_models::{ - errors::StorageError, - payouts::{ - payout_attempt::PayoutAttempt, - payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate}, - }, +use diesel_models::{ + payout_attempt::PayoutAttempt as DieselPayoutAttempt, + query::generics::db_metrics, + schema::{payout_attempt::dsl as poa_dsl, payouts::dsl as po_dsl}, }; +use error_stack::ResultExt; use redis_interface::HsetnxReply; #[cfg(feature = "olap")] use router_env::logger; @@ -38,7 +34,7 @@ use crate::connection; use crate::{ diesel_error_to_data_error, errors::RedisErrorExt, - redis::kv_store::{kv_wrapper, KvOperation, PartitionKey}, + redis::kv_store::{kv_wrapper, KvOperation}, utils::{self, pg_connection_read, pg_connection_write}, DataModelExt, DatabaseStore, KVRouterStore, }; @@ -56,13 +52,7 @@ impl PayoutsInterface for KVRouterStore { self.router_store.insert_payout(new, storage_scheme).await } MerchantStorageScheme::RedisKv => { - let merchant_id = new.merchant_id.clone(); - let payout_id = new.payout_id.clone(); - let key = PartitionKey::MerchantIdPayoutId { - merchant_id: &merchant_id, - payout_id: &payout_id, - }; - let key_str = key.to_string(); + let key = format!("mid_{}_po_{}", new.merchant_id, new.payout_id); let field = format!("po_{}", new.payout_id); let now = common_utils::date_time::now(); let created_payout = Payouts { @@ -86,7 +76,6 @@ impl PayoutsInterface for KVRouterStore { profile_id: new.profile_id.clone(), status: new.status, attempt_count: new.attempt_count, - confirm: new.confirm, }; let redis_entry = kv::TypedSql { @@ -102,15 +91,15 @@ impl PayoutsInterface for KVRouterStore { &created_payout.clone().to_storage_model(), redis_entry, ), - key, + &key, ) .await - .map_err(|err| err.to_redis_failed_response(&key_str))? + .map_err(|err| err.to_redis_failed_response(&key))? .try_into_hsetnx() { Ok(HsetnxReply::KeyNotSet) => Err(StorageError::DuplicateValue { entity: "payouts", - key: Some(key_str), + key: Some(key), } .into()), Ok(HsetnxReply::KeySet) => Ok(created_payout), @@ -125,21 +114,16 @@ impl PayoutsInterface for KVRouterStore { &self, this: &Payouts, payout_update: PayoutsUpdate, - payout_attempt: &PayoutAttempt, storage_scheme: MerchantStorageScheme, ) -> error_stack::Result { match storage_scheme { MerchantStorageScheme::PostgresOnly => { self.router_store - .update_payout(this, payout_update, payout_attempt, storage_scheme) + .update_payout(this, payout_update, storage_scheme) .await } MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPayoutId { - merchant_id: &this.merchant_id, - payout_id: &this.payout_id, - }; - let key_str = key.to_string(); + let key = format!("mid_{}_po_{}", this.merchant_id, this.payout_id); let field = format!("po_{}", this.payout_id); let diesel_payout_update = payout_update.to_storage_model(); @@ -166,10 +150,10 @@ impl PayoutsInterface for KVRouterStore { kv_wrapper::<(), _, _>( self, KvOperation::::Hset((&field, redis_value), redis_entry), - key, + &key, ) .await - .map_err(|err| err.to_redis_failed_response(&key_str))? + .map_err(|err| err.to_redis_failed_response(&key))? .try_into_hset() .change_context(StorageError::KVError)?; @@ -197,17 +181,14 @@ impl PayoutsInterface for KVRouterStore { match storage_scheme { MerchantStorageScheme::PostgresOnly => database_call().await, MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPayoutId { - merchant_id, - payout_id, - }; + let key = format!("mid_{merchant_id}_po_{payout_id}"); let field = format!("po_{payout_id}"); Box::pin(utils::try_redis_get_else_try_database_get( async { kv_wrapper::( self, KvOperation::::HGet(&field), - key, + &key, ) .await? .try_into_hget() @@ -248,17 +229,14 @@ impl PayoutsInterface for KVRouterStore { })) } MerchantStorageScheme::RedisKv => { - let key = PartitionKey::MerchantIdPayoutId { - merchant_id, - payout_id, - }; + let key = format!("mid_{merchant_id}_po_{payout_id}"); let field = format!("po_{payout_id}"); Box::pin(utils::try_redis_get_else_try_database_get( async { kv_wrapper::( self, KvOperation::::HGet(&field), - key, + &key, ) .await? .try_into_hget() @@ -292,8 +270,7 @@ impl PayoutsInterface for KVRouterStore { merchant_id: &str, filters: &PayoutFetchConstraints, storage_scheme: MerchantStorageScheme, - ) -> error_stack::Result, StorageError> - { + ) -> error_stack::Result, StorageError> { self.router_store .filter_payouts_and_attempts(merchant_id, filters, storage_scheme) .await @@ -337,7 +314,6 @@ impl PayoutsInterface for crate::RouterStore { &self, this: &Payouts, payout: PayoutsUpdate, - _payout_attempt: &PayoutAttempt, _storage_scheme: MerchantStorageScheme, ) -> error_stack::Result { let conn = pg_connection_write(self).await?; @@ -509,7 +485,7 @@ impl PayoutsInterface for crate::RouterStore { merchant_id: &str, filters: &PayoutFetchConstraints, storage_scheme: MerchantStorageScheme, - ) -> error_stack::Result, StorageError> { + ) -> error_stack::Result, StorageError> { use common_utils::errors::ReportSwitchExt; let conn = connection::pg_connection_read(self).await.switch()?; @@ -519,10 +495,6 @@ impl PayoutsInterface for crate::RouterStore { diesel_models::schema::payout_attempt::table .on(poa_dsl::payout_id.eq(po_dsl::payout_id)), ) - .inner_join( - diesel_models::schema::customers::table - .on(cust_dsl::customer_id.eq(po_dsl::customer_id)), - ) .filter(po_dsl::merchant_id.eq(merchant_id.to_owned())) .order(po_dsl::created_at.desc()) .into_boxed(); @@ -613,16 +585,15 @@ impl PayoutsInterface for crate::RouterStore { logger::debug!(filter = %diesel::debug_query::(&query).to_string()); query - .get_results_async::<(DieselPayouts, DieselPayoutAttempt, DieselCustomer)>(conn) + .get_results_async::<(DieselPayouts, DieselPayoutAttempt)>(conn) .await .map(|results| { results .into_iter() - .map(|(pi, pa, c)| { + .map(|(pi, pa)| { ( Payouts::from_storage_model(pi), PayoutAttempt::from_storage_model(pa), - c, ) }) .collect() @@ -675,7 +646,6 @@ impl DataModelExt for Payouts { profile_id: self.profile_id, status: self.status, attempt_count: self.attempt_count, - confirm: self.confirm, } } @@ -701,7 +671,6 @@ impl DataModelExt for Payouts { profile_id: storage_model.profile_id, status: storage_model.status, attempt_count: storage_model.attempt_count, - confirm: storage_model.confirm, } } } @@ -730,7 +699,6 @@ impl DataModelExt for PayoutsNew { profile_id: self.profile_id, status: self.status, attempt_count: self.attempt_count, - confirm: self.confirm, } } @@ -756,7 +724,6 @@ impl DataModelExt for PayoutsNew { profile_id: storage_model.profile_id, status: storage_model.status, attempt_count: storage_model.attempt_count, - confirm: storage_model.confirm, } } } @@ -776,7 +743,6 @@ impl DataModelExt for PayoutsUpdate { metadata, profile_id, status, - confirm, } => DieselPayoutsUpdate::Update { amount, destination_currency, @@ -789,7 +755,6 @@ impl DataModelExt for PayoutsUpdate { metadata, profile_id, status, - confirm, }, Self::PayoutMethodIdUpdate { payout_method_id } => { DieselPayoutsUpdate::PayoutMethodIdUpdate { payout_method_id } @@ -800,7 +765,6 @@ impl DataModelExt for PayoutsUpdate { Self::AttemptCountUpdate { attempt_count } => { DieselPayoutsUpdate::AttemptCountUpdate { attempt_count } } - Self::StatusUpdate { status } => DieselPayoutsUpdate::StatusUpdate { status }, } } diff --git a/crates/storage_impl/src/redis/cache.rs b/crates/storage_impl/src/redis/cache.rs index dc2a2225dc9..a960261f867 100644 --- a/crates/storage_impl/src/redis/cache.rs +++ b/crates/storage_impl/src/redis/cache.rs @@ -4,9 +4,9 @@ use common_utils::{ errors::{self, CustomResult}, ext_traits::AsyncExt, }; +use data_models::errors::StorageError; use dyn_clone::DynClone; use error_stack::{Report, ResultExt}; -use hyperswitch_domain_models::errors::StorageError; use moka::future::Cache as MokaCache; use once_cell::sync::Lazy; use redis_interface::{errors::RedisError, RedisValue}; diff --git a/crates/storage_impl/src/redis/kv_store.rs b/crates/storage_impl/src/redis/kv_store.rs index 7853763f32f..c7e6efc0b3b 100644 --- a/crates/storage_impl/src/redis/kv_store.rs +++ b/crates/storage_impl/src/redis/kv_store.rs @@ -25,27 +25,11 @@ pub enum PartitionKey<'a> { merchant_id: &'a str, payment_id: &'a str, }, - CombinationKey { + MerchantIdPaymentIdCombination { combination: &'a str, }, - MerchantIdCustomerId { - merchant_id: &'a str, - customer_id: &'a str, - }, - MerchantIdPayoutId { - merchant_id: &'a str, - payout_id: &'a str, - }, - MerchantIdPayoutAttemptId { - merchant_id: &'a str, - payout_attempt_id: &'a str, - }, - MerchantIdMandateId { - merchant_id: &'a str, - mandate_id: &'a str, - }, } -// PartitionKey::MerchantIdPaymentId {merchant_id, payment_id} + impl<'a> std::fmt::Display for PartitionKey<'a> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match *self { @@ -53,23 +37,9 @@ impl<'a> std::fmt::Display for PartitionKey<'a> { merchant_id, payment_id, } => f.write_str(&format!("mid_{merchant_id}_pid_{payment_id}")), - PartitionKey::CombinationKey { combination } => f.write_str(combination), - PartitionKey::MerchantIdCustomerId { - merchant_id, - customer_id, - } => f.write_str(&format!("mid_{merchant_id}_cust_{customer_id}")), - PartitionKey::MerchantIdPayoutId { - merchant_id, - payout_id, - } => f.write_str(&format!("mid_{merchant_id}_po_{payout_id}")), - PartitionKey::MerchantIdPayoutAttemptId { - merchant_id, - payout_attempt_id, - } => f.write_str(&format!("mid_{merchant_id}_poa_{payout_attempt_id}")), - PartitionKey::MerchantIdMandateId { - merchant_id, - mandate_id, - } => f.write_str(&format!("mid_{merchant_id}_mandate_{mandate_id}")), + PartitionKey::MerchantIdPaymentIdCombination { combination } => { + f.write_str(combination) + } } } } @@ -120,7 +90,7 @@ where pub async fn kv_wrapper<'a, T, D, S>( store: &KVRouterStore, op: KvOperation<'a, S>, - partition_key: PartitionKey<'a>, + key: impl AsRef, ) -> CustomResult, RedisError> where T: de::DeserializeOwned, @@ -129,20 +99,21 @@ where { let redis_conn = store.get_redis_conn()?; - let key = format!("{}", partition_key); - + let key = key.as_ref(); let type_name = std::any::type_name::(); let operation = op.to_string(); let ttl = store.ttl_for_kv; + let partition_key = PartitionKey::MerchantIdPaymentIdCombination { combination: key }; + let result = async { match op { KvOperation::Hset(value, sql) => { logger::debug!(kv_operation= %operation, value = ?value); redis_conn - .set_hash_fields(&key, value, Some(ttl.into())) + .set_hash_fields(key, value, Some(ttl.into())) .await?; store @@ -154,14 +125,14 @@ where KvOperation::HGet(field) => { let result = redis_conn - .get_hash_field_and_deserialize(&key, field, type_name) + .get_hash_field_and_deserialize(key, field, type_name) .await?; Ok(KvResult::HGet(result)) } KvOperation::Scan(pattern) => { let result: Vec = redis_conn - .hscan_and_deserialize(&key, pattern, None) + .hscan_and_deserialize(key, pattern, None) .await .and_then(|result| { if result.is_empty() { @@ -179,7 +150,7 @@ where value.check_for_constraints(&redis_conn).await?; let result = redis_conn - .serialize_and_set_hash_field_if_not_exist(&key, field, value, Some(ttl)) + .serialize_and_set_hash_field_if_not_exist(key, field, value, Some(ttl)) .await?; if matches!(result, redis_interface::HsetnxReply::KeySet) { @@ -196,7 +167,7 @@ where logger::debug!(kv_operation= %operation, value = ?value); let result = redis_conn - .serialize_and_set_key_if_not_exist(&key, value, Some(ttl.into())) + .serialize_and_set_key_if_not_exist(key, value, Some(ttl.into())) .await?; value.check_for_constraints(&redis_conn).await?; @@ -212,7 +183,7 @@ where } KvOperation::Get => { - let result = redis_conn.get_and_deserialize_key(&key, type_name).await?; + let result = redis_conn.get_and_deserialize_key(key, type_name).await?; Ok(KvResult::Get(result)) } } diff --git a/crates/storage_impl/src/utils.rs b/crates/storage_impl/src/utils.rs index b634f41a98f..78198e92753 100644 --- a/crates/storage_impl/src/utils.rs +++ b/crates/storage_impl/src/utils.rs @@ -1,7 +1,7 @@ use bb8::PooledConnection; +use data_models::errors::StorageError; use diesel::PgConnection; use error_stack::ResultExt; -use hyperswitch_domain_models::errors::StorageError; use crate::{errors::RedisErrorExt, metrics, DatabaseStore}; diff --git a/crates/test_utils/Cargo.toml b/crates/test_utils/Cargo.toml index 54c862c0061..60b6ed8a9d7 100644 --- a/crates/test_utils/Cargo.toml +++ b/crates/test_utils/Cargo.toml @@ -13,20 +13,20 @@ dummy_connector = [] payouts = [] [dependencies] -async-trait = "0.1.79" -base64 = "0.22.0" -clap = { version = "4.4.18", default-features = false, features = ["std", "derive", "help", "usage"] } +async-trait = "0.1.68" +base64 = "0.21.2" +clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] } rand = "0.8.5" -regex = "1.10.4" +regex = "1.10.3" reqwest = { version = "0.12.2", features = ["native-tls"] } -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.115" +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" serde_urlencoded = "0.7.1" -serial_test = "3.0.0" +serial_test = "2.0.0" thirtyfour = "0.31.0" -time = { version = "0.3.35", features = ["macros"] } -tokio = "1.37.0" -toml = "0.8.12" +time = { version = "0.3.21", features = ["macros"] } +tokio = "1.36.0" +toml = "0.7.4" # First party crates masking = { version = "0.1.0", path = "../masking" } diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs index b5c18cfa5d4..34a5e35928d 100644 --- a/crates/test_utils/src/connector_auth.rs +++ b/crates/test_utils/src/connector_auth.rs @@ -30,7 +30,6 @@ pub struct ConnectorAuthentication { pub dlocal: Option, #[cfg(feature = "dummy_connector")] pub dummyconnector: Option, - pub ebanx: Option, pub fiserv: Option, pub forte: Option, pub globalpay: Option, @@ -40,7 +39,6 @@ pub struct ConnectorAuthentication { pub iatapay: Option, pub mollie: Option, pub multisafepay: Option, - pub netcetera: Option, pub nexinets: Option, pub noon: Option, pub nmi: Option, @@ -69,7 +67,6 @@ pub struct ConnectorAuthentication { pub worldpay: Option, pub worldline: Option, pub zen: Option, - pub zsl: Option, pub automation_configs: Option, } diff --git a/crates/test_utils/tests/connectors/adyen_uk_wh_ui.rs b/crates/test_utils/tests/connectors/adyen_uk_wh_ui.rs index 4235d0ff17d..9da7f71324f 100644 --- a/crates/test_utils/tests/connectors/adyen_uk_wh_ui.rs +++ b/crates/test_utils/tests/connectors/adyen_uk_wh_ui.rs @@ -1,3 +1,4 @@ +use serial_test::serial; use thirtyfour::{prelude::*, WebDriver}; use crate::{selenium::*, tester}; @@ -27,6 +28,7 @@ async fn should_make_webhook(web_driver: WebDriver) -> Result<(), WebDriverError } #[test] +#[serial] fn should_make_webhook_test() { tester!(should_make_webhook); } diff --git a/crates/test_utils/tests/connectors/authorizedotnet_ui.rs b/crates/test_utils/tests/connectors/authorizedotnet_ui.rs index 66e241a98e7..b1bea20c1b0 100644 --- a/crates/test_utils/tests/connectors/authorizedotnet_ui.rs +++ b/crates/test_utils/tests/connectors/authorizedotnet_ui.rs @@ -14,7 +14,7 @@ impl SeleniumTest for AuthorizedotnetSeleniumTest { async fn should_make_gpay_payment(web_driver: WebDriver) -> Result<(), WebDriverError> { let conn = AuthorizedotnetSeleniumTest {}; - let amount = rand::thread_rng().gen_range(1..1000); //This connector detects it as fraudulent payment if the same amount is used for multiple payments so random amount is passed for testing + let amount = rand::thread_rng().gen_range(1..1000); //This connector detects it as fradulent payment if the same amount is used for multiple payments so random amount is passed for testing let pub_key = conn .get_configs() .automation_configs diff --git a/crates/test_utils/tests/connectors/authorizedotnet_wh_ui.rs b/crates/test_utils/tests/connectors/authorizedotnet_wh_ui.rs index e470691bd07..b0cf50702c9 100644 --- a/crates/test_utils/tests/connectors/authorizedotnet_wh_ui.rs +++ b/crates/test_utils/tests/connectors/authorizedotnet_wh_ui.rs @@ -1,4 +1,5 @@ use rand::Rng; +use serial_test::serial; use thirtyfour::{prelude::*, WebDriver}; use crate::{selenium::*, tester}; @@ -13,7 +14,7 @@ impl SeleniumTest for AuthorizedotnetSeleniumTest { async fn should_make_webhook(web_driver: WebDriver) -> Result<(), WebDriverError> { let conn = AuthorizedotnetSeleniumTest {}; - let amount = rand::thread_rng().gen_range(50..1000); //This connector detects it as fraudulent payment if the same amount is used for multiple payments so random amount is passed for testing( + let amount = rand::thread_rng().gen_range(50..1000); //This connector detects it as fradulent payment if the same amount is used for multiple payments so random amount is passed for testing( conn.make_webhook_test( web_driver, &format!("{CHEKOUT_BASE_URL}/saved/227?amount={amount}"), @@ -30,6 +31,7 @@ async fn should_make_webhook(web_driver: WebDriver) -> Result<(), WebDriverError } #[test] +#[serial] fn should_make_webhook_test() { tester!(should_make_webhook); } diff --git a/crates/test_utils/tests/connectors/bluesnap_wh_ui.rs b/crates/test_utils/tests/connectors/bluesnap_wh_ui.rs index abaf3d53f50..1d327123944 100644 --- a/crates/test_utils/tests/connectors/bluesnap_wh_ui.rs +++ b/crates/test_utils/tests/connectors/bluesnap_wh_ui.rs @@ -1,3 +1,4 @@ +use serial_test::serial; use thirtyfour::{prelude::*, WebDriver}; use crate::{selenium::*, tester}; @@ -27,6 +28,7 @@ async fn should_make_webhook(web_driver: WebDriver) -> Result<(), WebDriverError } #[test] +#[serial] fn should_make_webhook_test() { tester!(should_make_webhook); } diff --git a/crates/test_utils/tests/connectors/checkout_wh_ui.rs b/crates/test_utils/tests/connectors/checkout_wh_ui.rs index f9d459765c7..1692db06072 100644 --- a/crates/test_utils/tests/connectors/checkout_wh_ui.rs +++ b/crates/test_utils/tests/connectors/checkout_wh_ui.rs @@ -1,3 +1,4 @@ +use serial_test::serial; use thirtyfour::{prelude::*, WebDriver}; use crate::{selenium::*, tester}; @@ -32,6 +33,7 @@ async fn should_make_webhook(web_driver: WebDriver) -> Result<(), WebDriverError } #[test] +#[serial] fn should_make_webhook_test() { tester!(should_make_webhook); } diff --git a/crates/test_utils/tests/connectors/stripe_wh_ui.rs b/crates/test_utils/tests/connectors/stripe_wh_ui.rs index 31f8e794a46..d5f1e3717e2 100644 --- a/crates/test_utils/tests/connectors/stripe_wh_ui.rs +++ b/crates/test_utils/tests/connectors/stripe_wh_ui.rs @@ -1,3 +1,4 @@ +use serial_test::serial; use thirtyfour::{prelude::*, WebDriver}; use crate::{selenium::*, tester}; @@ -28,6 +29,8 @@ async fn should_make_webhook(web_driver: WebDriver) -> Result<(), WebDriverError } #[test] +#[serial] + fn should_make_webhook_test() { tester!(should_make_webhook); } diff --git a/cypress-tests/.gitignore b/cypress-tests/.gitignore deleted file mode 100644 index 85a05e1a6a8..00000000000 --- a/cypress-tests/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -creds.json -screenshots diff --git a/cypress-tests/cypress.config.js b/cypress-tests/cypress.config.js deleted file mode 100644 index 2ce0169cf84..00000000000 --- a/cypress-tests/cypress.config.js +++ /dev/null @@ -1,23 +0,0 @@ - -let globalState; -module.exports = { - e2e: { - setupNodeEvents(on, config) { - on('task', { - setGlobalState: (val) => { - return (globalState = (val || {})) - }, - getGlobalState: () => { - return (globalState || {}) - }, - cli_log: (message) => { - console.log("Logging console message from task"); - console.log(message); - return null; - } - }) - }, - experimentalRunAllSpecs: true - }, - chromeWebSecurity: false -}; \ No newline at end of file diff --git a/cypress-tests/cypress.env.json b/cypress-tests/cypress.env.json deleted file mode 100644 index 0967ef424bc..00000000000 --- a/cypress-tests/cypress.env.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js deleted file mode 100644 index 4c16fef8df4..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00000-AccountCreate.cy.js +++ /dev/null @@ -1,27 +0,0 @@ -import apiKeyCreateBody from "../../fixtures/create-api-key-body.json"; -import merchantCreateBody from "../../fixtures/merchant-create-body.json"; -import State from "../../utils/State"; - -let globalState; -describe("Account Create flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - it("merchant-create-call-test", () => { - cy.merchantCreateCallTest(merchantCreateBody, globalState); - }); - it("api-key-create-call-test", () => { - cy.apiKeyCreateTest(apiKeyCreateBody, globalState); - }); - -}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00001-CustomerCreate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00001-CustomerCreate.cy.js deleted file mode 100644 index c21152ca896..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00001-CustomerCreate.cy.js +++ /dev/null @@ -1,24 +0,0 @@ -import customerCreateBody from "../../fixtures/create-customer-body.json"; -import State from "../../utils/State"; - -let globalState; - -describe("Customer Create flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - it("customer-create-call-test", () => { - - cy.createCustomerCallTest(customerCreateBody, globalState); - - }); -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00002-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00002-ConnectorCreate.cy.js deleted file mode 100644 index 1241048f286..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00002-ConnectorCreate.cy.js +++ /dev/null @@ -1,23 +0,0 @@ -import createConnectorBody from "../../fixtures/create-connector-body.json"; -import State from "../../utils/State"; - -let globalState; -describe("Connector Account Create flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - it("connector-create-call-test", () => { - cy.createConnectorCallTest(createConnectorBody, globalState); - }); -}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js deleted file mode 100644 index 2f7e0ccaea2..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js +++ /dev/null @@ -1,60 +0,0 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - NoThreeDS payment flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - context("Card-NoThreeDS payment flow test Create and confirm", () => { - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("Confirm No 3DS", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - }); - - context("Card-NoThreeDS payment flow test Create+Confirm", () => { - - it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - - }); -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js deleted file mode 100644 index 43cab5e189f..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js +++ /dev/null @@ -1,48 +0,0 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - ThreeDS payment flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - cy.task('cli_log', "SEEDING GLOBAL STATE -> " + JSON.stringify(globalState)); - }) - - }) - - afterEach("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - cy.task('cli_log', " FLUSHING GLOBAL STATE -> " + JSON.stringify(globalState)); - }) - - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState); - }); - - it("payment_methods-call-test", () => { - cy.task('cli_log', "PM CALL "); - cy.paymentMethodsCallTest(globalState); - }); - - it("Confirm 3DS", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["3DS"]; - cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data)); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; - cy.handleRedirection(globalState, expected_redirection); - }) - -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js deleted file mode 100644 index 095ab5381d0..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js +++ /dev/null @@ -1,147 +0,0 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import confirmBody from "../../fixtures/confirm-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - NoThreeDS Manual payment flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - context("Card - NoThreeDS Manual Full Capture payment flow test", () => { - - context("payment Create and Confirm", () => { - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - }); - - context("Payment Create+Confirm", () => { - it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6540, det.paymentSuccessfulStatus, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - }); - - - }); - - context("Card - NoThreeDS Manual Partial Capture payment flow test - Create and Confirm", () => { - - context("payment Create and Payment Confirm", () => { - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.captureCallTest(captureBody, 100, det.paymentSuccessfulStatus, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - }); - - context("payment + Confirm", () => { - it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 5000, det.paymentSuccessfulStatus, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - }); - - - }); -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js deleted file mode 100644 index a3808b4db16..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js +++ /dev/null @@ -1,82 +0,0 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import voidBody from "../../fixtures/void-payment-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - NoThreeDS Manual payment flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - context("Card - void payment in Requires_capture state flow test", () => { - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("void-call-test", () => { - cy.voidCallTest(voidBody, globalState); - }); - }); - - context("Card - void payment in Requires_payment_method state flow test", () => { - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("void-call-test", () => { - cy.voidCallTest(voidBody, globalState); - }); - }); - - context("Card - void payment in Requires_payment_method state flow test", () => { - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, false, globalState); - }); - - it("void-call-test", () => { - cy.voidCallTest(voidBody, globalState); - }); - }); -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js deleted file mode 100644 index b0ee171ec25..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js +++ /dev/null @@ -1,42 +0,0 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - Sync payment flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js deleted file mode 100644 index 9449bf0d86f..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js +++ /dev/null @@ -1,344 +0,0 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import confirmBody from "../../fixtures/confirm-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import refundBody from "../../fixtures/refund-flow-body.json"; -import listRefundCall from "../../fixtures/list-refund-call-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - Refund flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - context("Card - Full Refund flow test for No-3DS", () => { - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 6500, det, globalState); - }); - }); - - context("Card - Partial Refund flow test for No-3DS", () => { - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 1200, det, globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 1200, det, globalState); - }); - }); - - context("Fully Refund Card-NoThreeDS payment flow test Create+Confirm", () => { - - it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 6540, det, globalState); - }); - - }); - - context("Partially Refund Card-NoThreeDS payment flow test Create+Confirm", () => { - - it("create+confirm-payment-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 3000, det, globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 3000, det, globalState); - }); - - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.syncRefundCallTest(det, globalState); - }); - - }); - - context("Card - Full Refund for fully captured No-3DS payment", () => { - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 6500, det, globalState); - }); - - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.syncRefundCallTest(det, globalState); - }); - }); - - context("Card - Partial Refund for fully captured No-3DS payment", () => { - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 5000, det, globalState); - }); - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 500, det, globalState); - }); - - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.syncRefundCallTest(det, globalState); - }); - it("list-refund-call-test", () => { - cy.listRefundCallTest(listRefundCall, globalState); - }); - }); - - context("Card - Full Refund for partially captured No-3DS payment", () => { - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 4000, det, globalState); - }); - - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.syncRefundCallTest(det, globalState); - }); - }); - - context("Card - partial Refund for partially captured No-3DS payment", () => { - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 3000, det, globalState); - }); - - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.syncRefundCallTest(det, globalState); - }); - }); - - context("Card - Full Refund for Create + Confirm Automatic CIT and MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 7000, det, globalState); - }); - - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.syncRefundCallTest(det, globalState); - }); - }); - -}); diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js deleted file mode 100644 index 35f473d8a6d..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js +++ /dev/null @@ -1,54 +0,0 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import refundBody from "../../fixtures/refund-flow-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - Sync Refund flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("confirm-call-test", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - console.log("det -> " + det.card); - cy.confirmCallTest(confirmBody, det, true, globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.refundCallTest(refundBody, 6500, det, globalState); - }); - - it("sync-refund-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.syncRefundCallTest(det, globalState); - }); - -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js deleted file mode 100644 index 04e17795036..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js +++ /dev/null @@ -1,91 +0,0 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - SingleUse Mandates flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - context("Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - }); - - context("Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "manual", "new_mandate", globalState); - }); - - it("cit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "manual", globalState); - }); - - it("mit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); - }); - - it("list-mandate-call-test", () => { - cy.listMandateCallTest(globalState); - }); - }); - - context.skip("Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUse3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 6500, det, true, "automatic", "new_mandate", globalState); - }); - - it("cit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUse3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - - it("list-mandate-call-test", () => { - cy.listMandateCallTest(globalState); - }); - }); -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js deleted file mode 100644 index 9990eeaadb5..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js +++ /dev/null @@ -1,97 +0,0 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - MultiUse Mandates flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - - context("Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - }); - - context("Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "manual", "new_mandate", globalState); - }); - - it("cit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); - }); - - it("Confirm No 3DS MIT 1", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "manual", globalState); - }); - - it("mit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); - }); - - it("Confirm No 3DS MIT 2", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "manual", globalState); - }); - - it("mit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 7000, det.paymentSuccessfulStatus, globalState); - }); - }); - - context.skip("Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUse3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 6500, det, true, "automatic", "new_mandate", globalState); - }); - - it("cit-capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUse3DS"]; - console.log("det -> " + det.card); - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - }); -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js deleted file mode 100644 index fea2a94cbcc..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js +++ /dev/null @@ -1,50 +0,0 @@ -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -import State from "../../utils/State"; - -let globalState; - -describe("Card - SingleUse Mandates flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - context("Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - console.log("confirm -> " + globalState.get("connectorId")); - let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"]; - console.log("det -> " + det.card); - cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - - it("list-mandate-call-test", () => { - cy.listMandateCallTest(globalState); - }); - - it("revoke-mandate-call-test", () => { - cy.revokeMandateCallTest(globalState); - }); - - it("revoke-revoked-mandate-call-test", () => { - cy.revokeMandateCallTest(globalState); - }); - }); - -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js deleted file mode 100644 index 1aeb5199e73..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js +++ /dev/null @@ -1,126 +0,0 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import confirmBody from "../../fixtures/confirm-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import customerCreateBody from "../../fixtures/create-customer-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; -let globalState; - -describe("Card - SaveCard payment flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - - context("Save card for NoThreeDS automatic capture payment- Create+Confirm", () => { - it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); - }); - - it("create+confirm-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"]; - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("retrieve-customerPM-call-test", () => { - cy.listCustomerPMCallTest(globalState); - }); - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("confirm-save-card-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"]; - cy.saveCardConfirmCallTest(confirmBody, det, globalState); - }); - - }); - - context("Save card for NoThreeDS manual full capture payment- Create+Confirm", () => { - it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); - }); - - it("create+confirm-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"]; - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("retrieve-customerPM-call-test", () => { - cy.listCustomerPMCallTest(globalState); - }); - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - - it("confirm-save-card-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"]; - cy.saveCardConfirmCallTest(confirmBody, det, globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); - }); - }); - - context("Save card for NoThreeDS manual partial capture payment- Create + Confirm", () => { - it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); - }); - - it("create+confirm-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"]; - cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("retrieve-customerPM-call-test", () => { - cy.listCustomerPMCallTest(globalState); - }); - - it("create-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); - }); - - - it("confirm-save-card-payment-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"]; - cy.saveCardConfirmCallTest(confirmBody, det, globalState); - }); - - it("capture-call-test", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"]; - cy.captureCallTest(captureBody, 5500, det.paymentSuccessfulStatus, globalState); - }); - }); - -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js deleted file mode 100644 index 0208ca595ce..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js +++ /dev/null @@ -1,49 +0,0 @@ -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../ConnectorUtils/utils"; - -let globalState; - -describe("Card - SingleUse Mandates flow test", () => { - - before("seed global state", () => { - - cy.task('getGlobalState').then((state) => { - globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - }) - }) - - after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); - cy.task('setGlobalState', globalState.data); - }) - - context("Card - NoThreeDS Create + Confirm Automatic CIT and Single use MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"]; - cy.citForMandatesCallTest(citConfirmBody, 0, det, true, "automatic", "setup_mandate", globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - }); - context("Card - NoThreeDS Create + Confirm Automatic CIT and Multi use MIT payment flow test", () => { - - it("Confirm No 3DS CIT", () => { - let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"]; - cy.citForMandatesCallTest(citConfirmBody, 0, det, true, "automatic", "setup_mandate", globalState); - }); - - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - it("Confirm No 3DS MIT", () => { - cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState); - }); - }); - -}); \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js deleted file mode 100644 index 56ef464984d..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js +++ /dev/null @@ -1,112 +0,0 @@ - -const successfulNo3DSCardDetails = { - "card_number": "371449635398431", - "card_exp_month": "03", - "card_exp_year": "30", - "card_holder_name": "John Doe", - "card_cvc": "7373" -}; - -const successfulThreeDSTestCardDetails = { - "card_number": "4917610000000000", - "card_exp_month": "03", - "card_exp_year": "30", - "card_holder_name": "Joseph Doe", - "card_cvc": "737" -}; - -export const connectorDetails = { - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, -}; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js deleted file mode 100644 index 996122faa7e..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js +++ /dev/null @@ -1,113 +0,0 @@ -const successfulNo3DSCardDetails = { - "card_number": "4242424242424242", - "card_exp_month": "01", - "card_exp_year": "25", - "card_holder_name": "joseph Doe", - "card_cvc": "123" - -}; - -const successfulThreeDSTestCardDetails = { - "card_number": "4000000000001091", - "card_exp_month": "01", - "card_exp_year": "25", - "card_holder_name": "joseph Doe", - "card_cvc": "123" -}; - -export const connectorDetails = { - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, - -}; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js deleted file mode 100644 index c42ef5ba5a8..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js +++ /dev/null @@ -1,111 +0,0 @@ -const successfulNo3DSCardDetails = { - "card_number": "4242424242424242", - "card_exp_month": "10", - "card_exp_year": "30", - "card_holder_name": "John", - "card_cvc": "737" -}; - -const successfulThreeDSTestCardDetails = { - "card_number": "4000000000001091", - "card_exp_month": "10", - "card_exp_year": "30", - "card_holder_name": "Joseph", - "card_cvc": "737" -}; - -export const connectorDetails = { - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, -}; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js deleted file mode 100644 index 8daef2ffecf..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js +++ /dev/null @@ -1,111 +0,0 @@ -const successfulNo3DSCardDetails = { - "card_number": "4242424242424242", - "card_exp_month": "01", - "card_exp_year": "25", - "card_holder_name": "joseph Doe", - "card_cvc": "123" -}; - -const successfulThreeDSTestCardDetails = { - "card_number": "4000000000001091", - "card_exp_month": "01", - "card_exp_year": "25", - "card_holder_name": "joseph Doe", - "card_cvc": "123" -}; - -export const connectorDetails = { - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "pending", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, -}; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js deleted file mode 100644 index e2e4d4e80f8..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js +++ /dev/null @@ -1,112 +0,0 @@ -const successfulNo3DSCardDetails = { - "card_number": "4000000000002503", - "card_exp_month": "08", - "card_exp_year": "25", - "card_holder_name": "joseph Doe", - "card_cvc": "999" -}; - -const successfulThreeDSTestCardDetails = { - "card_number": "4000000000002503", - "card_exp_month": "10", - "card_exp_year": "25", - "card_holder_name": "morino", - "card_cvc": "999" -}; - -export const connectorDetails = { - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "pending", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, -}; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js deleted file mode 100644 index 5337c3eac69..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js +++ /dev/null @@ -1,102 +0,0 @@ -const successfulNo3DSCardDetails = { - "card_number": "4012000033330026", - "card_exp_month": "01", - "card_exp_year": "25", - "card_holder_name": "joseph Doe", - "card_cvc": "123" - -}; - -const successfulThreeDSTestCardDetails = { - "card_number": "4868719460707704", - "card_exp_month": "01", - "card_exp_year": "25", - "card_holder_name": "joseph Doe", - "card_cvc": "123" -}; - -export const connectorDetails = { - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "customer_acceptance": null, - "setup_future_usage": "on_session", - - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "processing", - "customer_acceptance": null, - "setup_future_usage": "on_session", - - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "processing", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "processing", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, -}; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js deleted file mode 100644 index 2d8d5efa81b..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js +++ /dev/null @@ -1,114 +0,0 @@ -const successfulTestCard = "4242424242424242"; -const successful3DSCard = "4000002760003184"; - -const successfulTestCardDetails = { - "card_number": "4242424242424242", - "card_exp_month": "10", - "card_exp_year": "25", - "card_holder_name": "morino", - "card_cvc": "737" -}; - -const successfulThreeDSTestCardDetails = { - "card_number": "4000002760003184", - "card_exp_month": "10", - "card_exp_year": "25", - "card_holder_name": "morino", - "card_cvc": "737" -}; - -export const connectorDetails = { - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session" - }, - "No3DS": { - "card": successfulTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session" - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, -}; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js deleted file mode 100644 index f6d6a88ffbb..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js +++ /dev/null @@ -1,111 +0,0 @@ -const successfulNo3DSCardDetails = { - "card_number": "4200000000000000", - "card_exp_month": "10", - "card_exp_year": "25", - "card_holder_name": "joseph Doe", - "card_cvc": "123" -}; - -const successfulThreeDSTestCardDetails = { - "card_number": "4200000000000067", - "card_exp_month": "03", - "card_exp_year": "2030", - "card_holder_name": "John Doe", - "card_cvc": "737", -}; - -export const connectorDetails = { - "3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "No3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "customer_acceptance": null, - "setup_future_usage": "on_session", - }, - "MandateSingleUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateSingleUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "MandateMultiUse3DS": { - "card": successfulThreeDSTestCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "requires_customer_action", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "mandate_type": { - "multi_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "SaveCardUseNo3DS": { - "card": successfulNo3DSCardDetails, - "currency": "USD", - "paymentSuccessfulStatus": "succeeded", - "paymentSyncStatus": "succeeded", - "refundStatus": "succeeded", - "refundSyncStatus": "succeeded", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - }, -}; \ No newline at end of file diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/utils.js b/cypress-tests/cypress/e2e/ConnectorUtils/utils.js deleted file mode 100644 index c667c402c56..00000000000 --- a/cypress-tests/cypress/e2e/ConnectorUtils/utils.js +++ /dev/null @@ -1,37 +0,0 @@ -import { connectorDetails as adyenConnectorDetails } from "./Adyen.js"; -import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmerica.js"; -import { connectorDetails as bluesnapConnectorDetails } from "./Bluesnap.js"; -import { connectorDetails as cybersourceConnectorDetails } from "./Cybersource.js"; -import { connectorDetails as nmiConnectorDetails } from "./Nmi.js"; -import { connectorDetails as paypalConnectorDetails } from "./Paypal.js"; -import { connectorDetails as stripeConnectorDetails } from "./Stripe.js"; -import { connectorDetails as trustpayConnectorDetails } from "./Trustpay.js"; - -const connectorDetails = { - "adyen": adyenConnectorDetails, - "bankofamerica": bankOfAmericaConnectorDetails, - "bluesnap": bluesnapConnectorDetails, - "cybersource": cybersourceConnectorDetails, - "nmi": nmiConnectorDetails, - "paypal": paypalConnectorDetails, - "stripe": stripeConnectorDetails, - "trustpay": trustpayConnectorDetails - - -} - - -export default function getConnectorDetails(connectorId) { - let x = getValueByKey(connectorDetails, connectorId); - return x; -} - -function getValueByKey(jsonObject, key) { - const data = typeof jsonObject === 'string' ? JSON.parse(jsonObject) : jsonObject; - - if (data && typeof data === 'object' && key in data) { - return data[key]; - } else { - return null; - } -} \ No newline at end of file diff --git a/cypress-tests/cypress/fixtures/capture-flow-body.json b/cypress-tests/cypress/fixtures/capture-flow-body.json deleted file mode 100644 index a28e06c014a..00000000000 --- a/cypress-tests/cypress/fixtures/capture-flow-body.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "amount_to_capture": 100, - "statement_descriptor_name": "Joseph", - "statement_descriptor_suffix": "JS" -} diff --git a/cypress-tests/cypress/fixtures/confirm-body.json b/cypress-tests/cypress/fixtures/confirm-body.json deleted file mode 100644 index 526d55e3fa8..00000000000 --- a/cypress-tests/cypress/fixtures/confirm-body.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "client_secret": "", - "return_url": "https://hyperswitch.io", - "payment_method": "card", - "confirm": true, - "payment_method_data": { - "card": { - "_comment": "these details are fetched from utils", - "card_number": "YourCardNumberHere", - "card_exp_month": "04", - "card_exp_year": "24", - "card_holder_name": "xyz", - "card_cvc": "424", - "card_issuer": "", - "card_network": "Visa" - } - }, - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - "billing": { - "address": { - "state": "New York", - "city": "New York", - "country": "US", - "first_name": "john", - "last_name": "doe", - "zip": "10001", - "line1": "123 Main Street Apt 4B", - "line2": "123 Main Street Apt 4B", - "line3": "123 Main Street Apt 4B" - } - }, - - "email": "hyperswitch_sdk_demo_id@gmail.com", - "browser_info": { - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", - "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "language": "en-US", - "color_depth": 30, - "screen_height": 1117, - "screen_width": 1728, - "time_zone": -330, - "java_enabled": true, - "java_script_enabled": true - } -} diff --git a/cypress-tests/cypress/fixtures/create-api-key-body.json b/cypress-tests/cypress/fixtures/create-api-key-body.json deleted file mode 100644 index 1decb557802..00000000000 --- a/cypress-tests/cypress/fixtures/create-api-key-body.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "API Key 1", - "description": null, - "expiration": "2069-09-23T01:02:03.000Z" -} diff --git a/cypress-tests/cypress/fixtures/create-confirm-body.json b/cypress-tests/cypress/fixtures/create-confirm-body.json deleted file mode 100644 index 1f3307b61f5..00000000000 --- a/cypress-tests/cypress/fixtures/create-confirm-body.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "amount": 6540, - "currency": "USD", - "confirm": true, - "capture_method": "automatic", - "capture_on": "2022-09-10T10:11:12Z", - "amount_to_capture": 6540, - "customer_id": "john123", - "email": "guest@example.com", - "name": "John Doe", - "phone": "999999999", - "phone_country_code": "+65", - "description": "Its my first payment request", - "authentication_type": "no_three_ds", - "return_url": "https://duck.com", - "setup_future_usage": "on_session", - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - "payment_method": "card", - "payment_method_type": "debit", - "payment_method_data": { - "card": { - "card_number": "4242424242424242", - "card_exp_month": "01", - "card_exp_year": "24", - "card_holder_name": "joseph Doe", - "card_cvc": "123" - } - }, - - "billing": { - "address": { - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "city": "San Fransico", - "state": "California", - "zip": "94122", - "country": "US", - "first_name": "john", - "last_name": "doe" - } - }, - "shipping": { - "address": { - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "city": "San Fransico", - "state": "California", - "zip": "94122", - "country": "US", - "first_name": "john", - "last_name": "doe" - } - }, - "statement_descriptor_name": "joseph", - "statement_descriptor_suffix": "JS", - "metadata": { - "udf1": "value1", - "new_customer": "true", - "login_date": "2019-09-10T10:11:12Z" - }, - "browser_info": { - "ip_address": "129.0.0.1", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", - "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "language": "en-US", - "color_depth": 30, - "screen_height": 1117, - "screen_width": 1728, - "time_zone": -330, - "java_enabled": true, - "java_script_enabled": true - } -} diff --git a/cypress-tests/cypress/fixtures/create-connector-body.json b/cypress-tests/cypress/fixtures/create-connector-body.json deleted file mode 100644 index d3575c0b2cc..00000000000 --- a/cypress-tests/cypress/fixtures/create-connector-body.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "connector_type": "fiz_operations", - "connector_name": "stripe", - "business_country": "US", - "business_label": "default", - "connector_label": "first_stripe_connector", - "connector_account_details": { - "auth_type": "BodyKey", - "api_key": "api-key", - "key1": "value1" - }, - "test_mode": true, - "disabled": false, - "payment_methods_enabled": [ - { - "payment_method": "card", - "payment_method_types": [ - { - "payment_method_type": "credit", - "card_networks": [ - "AmericanExpress", - "Discover", - "Interac", - "JCB", - "Mastercard", - "Visa", - "DinersClub", - "UnionPay", - "RuPay" - ], - "minimum_amount": 0, - "maximum_amount": 68607706, - "recurring_enabled": false, - "installment_payment_enabled": true - }, - { - "payment_method_type": "debit", - "card_networks": [ - "AmericanExpress", - "Discover", - "Interac", - "JCB", - "Mastercard", - "Visa", - "DinersClub", - "UnionPay", - "RuPay" - ], - "minimum_amount": 0, - "maximum_amount": 68607706, - "recurring_enabled": false, - "installment_payment_enabled": true - } - ] - } - ], - "metadata": { - "city": "NY", - "unit": "245", - "endpoint_prefix": "AD" - } -} diff --git a/cypress-tests/cypress/fixtures/create-customer-body.json b/cypress-tests/cypress/fixtures/create-customer-body.json deleted file mode 100644 index 025e6bec35b..00000000000 --- a/cypress-tests/cypress/fixtures/create-customer-body.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "email": "guest@example.com", - "name": "John Doe", - "phone": "999999999", - "phone_country_code": "+65", - "description": "First customer", - "address": { - "city": "Bangalore", - "country": "IN", - "line1": "Juspay router", - "line2": "Koramangala", - "line3": "Stallion", - "state": "Karnataka", - "zip": "560095", - "first_name": "John", - "last_name": "Doe" - }, - "metadata": { - "udf1": "value1", - "new_customer": "true", - "login_date": "2019-09-10T10:11:12Z" - } -} diff --git a/cypress-tests/cypress/fixtures/create-mandate-cit.json b/cypress-tests/cypress/fixtures/create-mandate-cit.json deleted file mode 100644 index e75aab9d00f..00000000000 --- a/cypress-tests/cypress/fixtures/create-mandate-cit.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "amount": 7000, - "currency": "USD", - "confirm": true, - "capture_method": "automatic", - "capture_on": "2022-09-10T10:11:12Z", - "customer_id": "StripeCustomer", - "email": "guest@example.com", - "name": "John Doe", - "phone": "999999999", - "phone_country_code": "+65", - "description": "Its my first payment request", - "authentication_type": "no_three_ds", - "return_url": "https://duck.com", - "payment_method": "card", - "payment_method_type": "debit", - "payment_method_data": { - "card": { - "card_number": "4242424242424242", - "card_exp_month": "10", - "card_exp_year": "25", - "card_holder_name": "joseph Doe", - "card_cvc": "123" - } - }, - "setup_future_usage": "off_session", - "mandate_data": { - "customer_acceptance": { - "acceptance_type": "offline", - "accepted_at": "1963-05-03T04:07:52.723Z", - "online": { - "ip_address": "127.0.0.1", - "user_agent": "amet irure esse" - } - }, - "mandate_type": { - "single_use": { - "amount": 8000, - "currency": "USD" - } - } - }, - "payment_type": "setup_mandate", - "billing": { - "address": { - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "city": "San Fransico", - "state": "California", - "zip": "94122", - "country": "US", - "first_name": "john", - "last_name": "Doe" - } - }, - "shipping": { - "address": { - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "city": "San Fransico", - "state": "California", - "zip": "94122", - "country": "US", - "first_name": "john", - "last_name": "Doe" - } - }, - "statement_descriptor_name": "joseph", - "statement_descriptor_suffix": "JS", - "metadata": { - "udf1": "value1", - "new_customer": "true", - "login_date": "2019-09-10T10:11:12Z" - }, - - "browser_info": { - "ip_address": "129.0.0.1", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", - "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "language": "en-US", - "color_depth": 30, - "screen_height": 1117, - "screen_width": 1728, - "time_zone": -330, - "java_enabled": true, - "java_script_enabled": true - } -} diff --git a/cypress-tests/cypress/fixtures/create-mandate-mit.json b/cypress-tests/cypress/fixtures/create-mandate-mit.json deleted file mode 100644 index 9612eac3209..00000000000 --- a/cypress-tests/cypress/fixtures/create-mandate-mit.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "amount": 6540, - "currency": "USD", - "capture_method": "automatic", - "off_session": true, - "confirm": true, - "description": "Initiated by merchant", - "mandate_id": "mandate_id", - "customer_id": "StripeCustomer", - "billing": { - "address": { - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "city": "San Fransico", - "state": "California", - "zip": "94122", - "country": "US", - "first_name": "john", - "last_name": "Doe" - } - }, - - "browser_info": { - "ip_address": "129.0.0.1", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", - "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "language": "en-US", - "color_depth": 30, - "screen_height": 1117, - "screen_width": 1728, - "time_zone": -330, - "java_enabled": true, - "java_script_enabled": true - } -} diff --git a/cypress-tests/cypress/fixtures/create-payment-body.json b/cypress-tests/cypress/fixtures/create-payment-body.json deleted file mode 100644 index 8dd1ff9579d..00000000000 --- a/cypress-tests/cypress/fixtures/create-payment-body.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "currency": "USD", - "amount": 6500, - "authentication_type": "three_ds", - "description": "Joseph First Crypto", - "email": "hyperswitch_sdk_demo_id@gmail.com", - "setup_future_usage": "", - "connector_metadata": { - "noon": { - "order_category": "applepay" - } - }, - "metadata": { - "udf1": "value1", - "new_customer": "true", - "login_date": "2019-09-10T10:11:12Z" - }, - "business_country": "US", - "business_label": "default" -} diff --git a/cypress-tests/cypress/fixtures/list-refund-call-body.json b/cypress-tests/cypress/fixtures/list-refund-call-body.json deleted file mode 100644 index 9f6e3b6d9a3..00000000000 --- a/cypress-tests/cypress/fixtures/list-refund-call-body.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "offset": 0 -} diff --git a/cypress-tests/cypress/fixtures/merchant-create-body.json b/cypress-tests/cypress/fixtures/merchant-create-body.json deleted file mode 100644 index 08ed0987425..00000000000 --- a/cypress-tests/cypress/fixtures/merchant-create-body.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "merchant_id": "cypress_merchant_GHAction_6dcfed64-ec62-46a2-9961-cafa3c1faa01", - "locker_id": "m0010", - "merchant_name": "NewAge Retailers", - "merchant_details": { - "primary_contact_person": "John Test", - "primary_email": "JohnTest@test.com", - "primary_phone": "sunt laborum", - "secondary_contact_person": "John Test2", - "secondary_email": "JohnTest2@test.com", - "secondary_phone": "cillum do dolor id", - "website": "www.example.com", - "about_business": "Online Retail with a wide selection of organic products for North America", - "address": { - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "city": "San Francisco", - "state": "California", - "zip": "94122", - "country": "US" - } - }, - "return_url": "https://duck.com/success", - "webhook_details": { - "webhook_version": "1.0.1", - "webhook_username": "ekart_retail", - "webhook_password": "password_ekart@123", - "payment_created_enabled": true, - "payment_succeeded_enabled": true, - "payment_failed_enabled": true - }, - "sub_merchants_enabled": false, - "metadata": { - "city": "NY", - "unit": "245" - }, - "primary_business_details": [ - { - "country": "US", - "business": "default" - } - ] -} diff --git a/cypress-tests/cypress/fixtures/refund-flow-body.json b/cypress-tests/cypress/fixtures/refund-flow-body.json deleted file mode 100644 index f027042c5b8..00000000000 --- a/cypress-tests/cypress/fixtures/refund-flow-body.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "payment_id": "payment_id", - "amount": 100, - "reason": "FRAUD", - "refund_type": "instant", - "metadata": { - "udf1": "value1", - "new_customer": "true", - "login_date": "2019-09-10T10:11:12Z" - } -} diff --git a/cypress-tests/cypress/fixtures/save-card-confirm-body.json b/cypress-tests/cypress/fixtures/save-card-confirm-body.json deleted file mode 100644 index 676e91871ff..00000000000 --- a/cypress-tests/cypress/fixtures/save-card-confirm-body.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "client_secret": "{{client_secret}}", - "payment_method": "card", - "payment_token": "{{payment_token}}", - "card_cvc": "card_cvc" -} diff --git a/cypress-tests/cypress/fixtures/void-payment-body.json b/cypress-tests/cypress/fixtures/void-payment-body.json deleted file mode 100644 index 471d90d6c48..00000000000 --- a/cypress-tests/cypress/fixtures/void-payment-body.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "cancellation_reason": "requested_by_customer" -} diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js deleted file mode 100644 index 61ce6a0970d..00000000000 --- a/cypress-tests/cypress/support/commands.js +++ /dev/null @@ -1,733 +0,0 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) - -// commands.js or your custom support file -import * as RequestBodyUtils from "../utils/RequestBodyUtils"; - -function logRequestId(xRequestId) { - if (xRequestId) { - cy.task('cli_log', "x-request-id -> " + xRequestId); - } else { - cy.task('cli_log', "x-request-id is not available in the response headers"); - } -} - -Cypress.Commands.add("merchantCreateCallTest", (merchantCreateBody, globalState) => { - const randomMerchantId = RequestBodyUtils.generateRandomString(); - RequestBodyUtils.setMerchantId(merchantCreateBody, randomMerchantId); - globalState.set("merchantId", randomMerchantId); - - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/accounts`, - headers: { - "Content-Type": "application/json", - Accept: "application/json", - "api-key": globalState.get("adminApiKey"), - }, - body: merchantCreateBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - // Handle the response as needed - globalState.set("publishableKey", response.body.publishable_key); - }); -}); - -Cypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => { - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/api_keys/${globalState.get("merchantId")}`, - headers: { - "Content-Type": "application/json", - Accept: "application/json", - "api-key": globalState.get("adminApiKey"), - }, - body: apiKeyCreateBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - // Handle the response as needed - globalState.set("apiKey", response.body.api_key); - }); -}); - -Cypress.Commands.add("createConnectorCallTest", (createConnectorBody, globalState) => { - const merchantId = globalState.get("merchantId"); - createConnectorBody.connector_name = globalState.get("connectorId"); - // readFile is used to read the contents of the file and it always returns a promise ([Object Object]) due to its asynchronous nature - // it is best to use then() to handle the response within the same block of code - cy.readFile(globalState.get("connectorAuthFilePath")).then((jsonContent) => { - const authDetails = getValueByKey(JSON.stringify(jsonContent), globalState.get("connectorId")); - createConnectorBody.connector_account_details = authDetails; - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/account/${merchantId}/connectors`, - headers: { - "Content-Type": "application/json", - Accept: "application/json", - "api-key": globalState.get("adminApiKey"), - }, - body: createConnectorBody, - failOnStatusCode: false - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - if (response.status === 200) { - expect(globalState.get("connectorId")).to.equal(response.body.connector_name); - } else { - cy.task('cli_log', "response status -> " + JSON.stringify(response.status)); - } - }); - }); -}); - -function getValueByKey(jsonObject, key) { - const data = typeof jsonObject === 'string' ? JSON.parse(jsonObject) : jsonObject; - if (data && typeof data === 'object' && key in data) { - return data[key]; - } else { - return null; - } -} - -Cypress.Commands.add("createCustomerCallTest", (customerCreateBody, globalState) => { - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/customers`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - body: customerCreateBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - // Handle the response as needed - console.log(response); - - globalState.set("customerId", response.body.customer_id); - }); -}); - -Cypress.Commands.add("createPaymentIntentTest", (request, det, authentication_type, capture_method, globalState) => { - if (!request || typeof request !== "object" || !det.currency || !authentication_type) { - throw new Error("Invalid parameters provided to createPaymentIntentTest command"); - } - request.currency = det.currency; - request.authentication_type = authentication_type; - request.capture_method = capture_method; - request.setup_future_usage = det.setup_future_usage; - request.customer_id = globalState.get("customerId"); - globalState.set("paymentAmount", request.amount); - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payments`, - headers: { - "Content-Type": "application/json", - Accept: "application/json", - "api-key": globalState.get("apiKey"), - }, - body: request, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body).to.have.property("client_secret"); - const clientSecret = response.body.client_secret; - globalState.set("clientSecret", clientSecret); - globalState.set("paymentID", response.body.payment_id); - cy.log(clientSecret); - expect("requires_payment_method").to.equal(response.body.status); - expect(request.amount).to.equal(response.body.amount); - expect(null).to.equal(response.body.amount_received); - expect(request.amount).to.equal(response.body.amount_capturable); - }); -}); - -Cypress.Commands.add("paymentMethodsCallTest", (globalState) => { - const clientSecret = globalState.get("clientSecret"); - const paymentIntentID = clientSecret.split("_secret_")[0]; - - cy.request({ - method: "GET", - url: `${globalState.get("baseUrl")}/account/payment_methods?client_secret=${clientSecret}`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("publishableKey"), - }, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - console.log(response); - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body).to.have.property("redirect_url"); - expect(response.body).to.have.property("payment_methods"); - globalState.set("paymentID", paymentIntentID); - cy.log(response); - }); -}); - -Cypress.Commands.add("confirmCallTest", (confirmBody, details, confirm, globalState) => { - const paymentIntentID = globalState.get("paymentID"); - confirmBody.payment_method_data.card = details.card; - confirmBody.confirm = confirm; - confirmBody.client_secret = globalState.get("clientSecret"); - confirmBody.customer_acceptance = details.customer_acceptance; - - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payments/${paymentIntentID}/confirm`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("publishableKey"), - }, - body: confirmBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - globalState.set("paymentID", paymentIntentID); - if (response.body.capture_method === "automatic") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url"); - globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); - } else if (response.body.authentication_type === "no_three_ds") { - expect(details.paymentSuccessfulStatus).to.equal(response.body.status); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } else if (response.body.capture_method === "manual") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url") - globalState.set("nextActionUrl", response.body.next_action.redirect_to_url); - } - else if (response.body.authentication_type === "no_three_ds") { - expect("requires_capture").to.equal(response.body.status); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } - else { - throw new Error(`Unsupported capture method: ${capture_method}`); - } - }); -}); - -Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, details, authentication_type, capture_method, globalState) => { - createConfirmPaymentBody.payment_method_data.card = details.card; - createConfirmPaymentBody.authentication_type = authentication_type; - createConfirmPaymentBody.currency = details.currency; - createConfirmPaymentBody.capture_method = capture_method; - createConfirmPaymentBody.customer_acceptance = details.customer_acceptance; - createConfirmPaymentBody.setup_future_usage = details.setup_future_usage; - createConfirmPaymentBody.customer_id = globalState.get("customerId"); - - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payments`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - body: createConfirmPaymentBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body).to.have.property("status"); - globalState.set("paymentAmount", createConfirmPaymentBody.amount); - globalState.set("paymentID", response.body.payment_id); - if (response.body.capture_method === "automatic") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url") - } - else if (response.body.authentication_type === "no_three_ds") { - expect(details.paymentSuccessfulStatus).to.equal(response.body.status); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } - else if (response.body.capture_method === "manual") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url") - } - else if (response.body.authentication_type === "no_three_ds") { - expect("requires_capture").to.equal(response.body.status); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } - }); -}); - -// This is consequent saved card payment confirm call test(Using payment token) -Cypress.Commands.add("saveCardConfirmCallTest", (confirmBody, det, globalState) => { - const paymentIntentID = globalState.get("paymentID"); - confirmBody.card_cvc = det.card.card_cvc; - confirmBody.payment_token = globalState.get("paymentToken"); - confirmBody.client_secret = globalState.get("clientSecret"); - console.log("configured connector ->" + globalState.get("connectorId")); - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payments/${paymentIntentID}/confirm`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("publishableKey"), - }, - body: confirmBody, - }) - .then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - globalState.set("paymentID", paymentIntentID); - if (response.body.capture_method === "automatic") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url"); - const nextActionUrl = response.body.next_action.redirect_to_url; - } else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal(det.paymentSuccessfulStatus); - expect(response.body.customer_id).to.equal(globalState.get("customerId")); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } else if (response.body.capture_method === "manual") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url") - } - else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal("requires_capture"); - expect(response.body.customer_id).to.equal(globalState.get("customerId")); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } - else { - throw new Error(`Unsupported capture method: ${capture_method}`); - } - }); -}); - -Cypress.Commands.add("captureCallTest", (requestBody, amount_to_capture, paymentSuccessfulStatus, globalState) => { - const payment_id = globalState.get("paymentID"); - requestBody.amount_to_capture = amount_to_capture; - let amount = globalState.get("paymentAmount"); - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payments/${payment_id}/capture`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - body: requestBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body.payment_id).to.equal(payment_id); - if (amount_to_capture == amount && response.body.status == "succeeded") { - expect(response.body.amount).to.equal(amount_to_capture); - expect(response.body.amount_capturable).to.equal(0); - expect(response.body.amount_received).to.equal(amount); - expect(response.body.status).to.equal(paymentSuccessfulStatus); - } else if (response.body.status == "processing") { - expect(response.body.amount).to.equal(amount); - expect(response.body.amount_capturable).to.equal(amount); - expect(response.body.amount_received).to.equal(0); - expect(response.body.status).to.equal(paymentSuccessfulStatus); - } - else { - expect(response.body.amount).to.equal(amount); - expect(response.body.amount_capturable).to.equal(0); - expect(response.body.amount_received).to.equal(amount_to_capture); - expect(response.body.status).to.equal("partially_captured"); - } - }); -}); - -Cypress.Commands.add("voidCallTest", (requestBody, globalState) => { - const payment_id = globalState.get("paymentID"); - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payments/${payment_id}/cancel`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - body: requestBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body.payment_id).to.equal(payment_id); - expect(response.body.amount).to.equal(globalState.get("paymentAmount")); - // expect(response.body.amount_capturable).to.equal(0); - expect(response.body.amount_received).to.be.oneOf([0, null]); - expect(response.body.status).to.equal("cancelled"); - }); -}); - -Cypress.Commands.add("retrievePaymentCallTest", (globalState) => { - console.log("syncpaymentID ->" + globalState.get("paymentID")); - const payment_id = globalState.get("paymentID"); - cy.request({ - method: "GET", - url: `${globalState.get("baseUrl")}/payments/${payment_id}?force_sync=true`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body.payment_id).to.equal(payment_id); - expect(response.body.amount).to.equal(globalState.get("paymentAmount")); - globalState.set("paymentID", response.body.payment_id); - - }); -}); - -Cypress.Commands.add("refundCallTest", (requestBody, refund_amount, det, globalState) => { - const payment_id = globalState.get("paymentID"); - requestBody.payment_id = payment_id; - requestBody.amount = refund_amount; - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/refunds`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - body: requestBody - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - globalState.set("refundId", response.body.refund_id); - expect(response.body.status).to.equal(det.refundStatus); - expect(response.body.amount).to.equal(refund_amount); - expect(response.body.payment_id).to.equal(payment_id); - }); -}); - -Cypress.Commands.add("syncRefundCallTest", (det, globalState) => { - const refundId = globalState.get("refundId"); - cy.request({ - method: "GET", - url: `${globalState.get("baseUrl")}/refunds/${refundId}`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body.status).to.equal(det.refundSyncStatus); - }); -}); - -Cypress.Commands.add("citForMandatesCallTest", (requestBody, amount, details, confirm, capture_method, payment_type, globalState) => { - requestBody.payment_method_data.card = details.card; - requestBody.payment_type = payment_type; - requestBody.confirm = confirm; - requestBody.amount = amount; - requestBody.currency = details.currency; - requestBody.capture_method = capture_method; - requestBody.mandate_data.mandate_type = details.mandate_type; - requestBody.customer_id = globalState.get("customerId"); - globalState.set("paymentAmount", requestBody.amount); - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payments`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - body: requestBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body).to.have.property("mandate_id"); - globalState.set("mandateId", response.body.mandate_id); - globalState.set("paymentID", response.body.payment_id); - - if (response.body.capture_method === "automatic") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url"); - const nextActionUrl = response.body.next_action.redirect_to_url; - cy.log(response.body); - cy.log(nextActionUrl); - } else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal(details.paymentSuccessfulStatus); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } - else if (response.body.capture_method === "manual") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - } - else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal("requires_capture"); - } else { - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } - - }); -}); - -Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, capture_method, globalState) => { - requestBody.amount = amount; - requestBody.confirm = confirm; - requestBody.capture_method = capture_method; - requestBody.mandate_id = globalState.get("mandateId"); - requestBody.customer_id = globalState.get("customerId"); - globalState.set("paymentAmount", requestBody.amount); - console.log("mit body " + JSON.stringify(requestBody)); - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/payments`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - body: requestBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - globalState.set("paymentID", response.body.payment_id); - console.log("mit statusss-> " + response.body.status); - if (response.body.capture_method === "automatic") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url"); - const nextActionUrl = response.body.next_action.redirect_to_url; - cy.log(response.body); - cy.log(nextActionUrl); - } else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal("succeeded"); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } - else if (response.body.capture_method === "manual") { - if (response.body.authentication_type === "three_ds") { - expect(response.body).to.have.property("next_action") - .to.have.property("redirect_to_url"); - const nextActionUrl = response.body.next_action.redirect_to_url; - cy.log(response.body); - cy.log(nextActionUrl); - } else if (response.body.authentication_type === "no_three_ds") { - expect(response.body.status).to.equal("requires_capture"); - } else { - // Handle other authentication types as needed - throw new Error(`Unsupported authentication type: ${authentication_type}`); - } - } - }); -}); - - -Cypress.Commands.add("listMandateCallTest", (globalState) => { - const customerId = globalState.get("customerId"); - cy.request({ - method: "GET", - url: `${globalState.get("baseUrl")}/customers/${customerId}/mandates`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - - let i = 0; - for (i in response.body) { - if (response.body[i].mandate_id === globalState.get("mandateId")) { - expect(response.body[i].status).to.equal("active"); - } - }; - }); -}); - -Cypress.Commands.add("revokeMandateCallTest", (globalState) => { - const mandateId = globalState.get("mandateId"); - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/mandates/revoke/${mandateId}`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - failOnStatusCode: false - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - if (response.body.status === 200) { - expect(response.body.status).to.equal("revoked"); - } else if (response.body.status === 400) { - expect(response.body.reason).to.equal("Mandate has already been revoked"); - } - }); -}); - -Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) => { - let connectorId = globalState.get("connectorId"); - let expected_url = new URL(expected_redirection); - let redirection_url = new URL(globalState.get("nextActionUrl")); - cy.visit(redirection_url.href); - if (globalState.get("connectorId") == "adyen") { - cy.get('iframe') - .its('0.contentDocument.body') - .within((body) => { - cy.get('input[type="password"]').click(); - cy.get('input[type="password"]').type("password"); - cy.get('#buttonSubmit').click(); - }) - } - else if (globalState.get("connectorId") === "cybersource" || globalState.get("connectorId") === "bankofamerica") { - cy.get('iframe') - .its('0.contentDocument.body') - .within((body) => { - cy.get('input[type="text"]').click().type("1234"); - cy.get('input[value="SUBMIT"]').click(); - }) - } - else if (globalState.get("connectorId") === "nmi" || globalState.get("connectorId") === "noon") { - cy.get('iframe', { timeout: 100000 }) - .its('0.contentDocument.body') - .within((body) => { - cy.get('iframe', { timeout: 10000 }) - .its('0.contentDocument.body') - .within((body) => { - cy.get('form[name="cardholderInput"]', { timeout: 10000 }).should('exist').then(form => { - cy.get('input[name="challengeDataEntry"]').click().type("1234"); - cy.get('input[value="SUBMIT"]').click(); - }) - }) - }) - } - else if (globalState.get("connectorId") === "stripe") { - cy.get('iframe') - .its('0.contentDocument.body') - .within((body) => { - cy.get('iframe') - .its('0.contentDocument.body') - .within((body) => { - cy.get('#test-source-authorize-3ds').click(); - }) - }) - } - else if (globalState.get("connectorId") === "trustpay") { - cy.get('form[name="challengeForm"]', { timeout: 10000 }).should('exist').then(form => { - cy.get('#outcomeSelect').select('Approve').should('have.value', 'Y') - cy.get('button[type="submit"]').click(); - }) - } - - - else { - // If connectorId is neither of adyen, trustpay, nmi, stripe, bankofamerica or cybersource, wait for 10 seconds - cy.wait(10000); - } - - // Handling redirection - if (redirection_url.host.endsWith(expected_url.host)) { - // No CORS workaround needed - cy.window().its('location.origin').should('eq', expected_url.origin); - } else { - // Workaround for CORS to allow cross-origin iframe - cy.origin(expected_url.origin, { args: { expected_url: expected_url.origin } }, ({ expected_url }) => { - cy.window().its('location.origin').should('eq', expected_url); - }) - } - -}); - -Cypress.Commands.add("listCustomerPMCallTest", (globalState) => { - console.log("customerID ->" + globalState.get("customerId")); - const customerId = globalState.get("customerId"); - cy.request({ - method: "GET", - url: `${globalState.get("baseUrl")}/customers/${customerId}/payment_methods`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - if (response.body.customer_payment_methods[0]?.payment_token) { - const paymentToken = response.body.customer_payment_methods[0].payment_token; - globalState.set("paymentToken", paymentToken); // Set paymentToken in globalState - expect(paymentToken).to.equal(globalState.get("paymentToken")); // Verify paymentToken - } - else { - throw new Error(`Payment token not found`); - } - }); -}); - -Cypress.Commands.add("listRefundCallTest", (requestBody, globalState) => { - cy.request({ - method: "POST", - url: `${globalState.get("baseUrl")}/refunds/list`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - body: requestBody, - }).then((response) => { - logRequestId(response.headers['x-request-id']); - - expect(response.headers["content-type"]).to.include("application/json"); - expect(response.body.data).to.be.an('array').and.not.empty; - }); -}); diff --git a/cypress-tests/cypress/support/e2e.js b/cypress-tests/cypress/support/e2e.js deleted file mode 100644 index 9b1ef71ce0f..00000000000 --- a/cypress-tests/cypress/support/e2e.js +++ /dev/null @@ -1,20 +0,0 @@ -// *********************************************************** -// This example support/e2e.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands'; - -// Alternatively you can use CommonJS syntax: -// require('./commands') \ No newline at end of file diff --git a/cypress-tests/cypress/utils/RequestBodyUtils.js b/cypress-tests/cypress/utils/RequestBodyUtils.js deleted file mode 100644 index 69edff05ca7..00000000000 --- a/cypress-tests/cypress/utils/RequestBodyUtils.js +++ /dev/null @@ -1,27 +0,0 @@ -export const setClientSecret = (requestBody, clientSecret) => { - requestBody["client_secret"] = clientSecret; -}; -export const setCardNo = (requestBody, cardNo) => { - // pass confirm body here to set CardNo - requestBody["payment_method_data"]["card"]["card_number"] = cardNo; -}; - -export const setApiKey = (requestBody, apiKey) => { - requestBody["connector_account_details"]["api_key"] = apiKey; -}; - -export const generateRandomString = (prefix = "cypress_merchant_GHAction_") => { - const uuidPart = "xxxxxxxx"; - - const randomString = uuidPart.replace(/[xy]/g, function (c) { - const r = (Math.random() * 16) | 0; - const v = c === "x" ? r : (r & 0x3) | 0x8; - return v.toString(16); - }); - - return prefix + randomString; -}; - -export const setMerchantId = (merchantCreateBody, merchantId) => { - merchantCreateBody["merchant_id"] = merchantId; -}; diff --git a/cypress-tests/cypress/utils/State.js b/cypress-tests/cypress/utils/State.js deleted file mode 100644 index dae4963000f..00000000000 --- a/cypress-tests/cypress/utils/State.js +++ /dev/null @@ -1,20 +0,0 @@ -class State { - data = {}; - constructor(data) { - this.data = data; - this.data["connectorId"] = Cypress.env("CONNECTOR"); - this.data["baseUrl"] = Cypress.env("BASEURL"); - this.data["adminApiKey"] = Cypress.env("ADMINAPIKEY"); - this.data["connectorAuthFilePath"] = Cypress.env("CONNECTOR_AUTH_FILE_PATH"); - } - - set(key, val) { - this.data[key] = val; - } - - get(key) { - return this.data[key]; - } -} - -export default State; diff --git a/cypress-tests/package-lock.json b/cypress-tests/package-lock.json deleted file mode 100644 index 91a7cc32f35..00000000000 --- a/cypress-tests/package-lock.json +++ /dev/null @@ -1,1981 +0,0 @@ -{ - "name": "test", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "test", - "version": "1.0.0", - "license": "ISC", - "devDependencies": { - "cypress": "^13.7.3" - } - }, - "node_modules/@colors/colors": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", - "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/@cypress/request": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", - "integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==", - "dev": true, - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "http-signature": "~1.3.6", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "performance-now": "^2.1.0", - "qs": "6.10.4", - "safe-buffer": "^5.1.2", - "tough-cookie": "^4.1.3", - "tunnel-agent": "^0.6.0", - "uuid": "^8.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@cypress/xvfb": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.2.4.tgz", - "integrity": "sha512-skbBzPggOVYCbnGgV+0dmBdW/s77ZkAOXIC1knS8NagwDjBrNC1LuXtQJeiN6l+m7lzmHtaoUw/ctJKdqkG57Q==", - "dev": true, - "dependencies": { - "debug": "^3.1.0", - "lodash.once": "^4.1.1" - } - }, - "node_modules/@cypress/xvfb/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/@types/node": { - "version": "20.12.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz", - "integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==", - "dev": true, - "optional": true, - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@types/sinonjs__fake-timers": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.1.tgz", - "integrity": "sha512-0kSuKjAS0TrGLJ0M/+8MaFkGsQhZpB6pxOmvS3K8FYI72K//YmdfoW9X2qPsAKh1mkwxGD5zib9s1FIFed6E8g==", - "dev": true - }, - "node_modules/@types/sizzle": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.8.tgz", - "integrity": "sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg==", - "dev": true - }, - "node_modules/@types/yauzl": { - "version": "2.10.3", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", - "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", - "dev": true, - "optional": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/arch": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", - "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/asn1": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", - "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", - "dev": true, - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "dev": true, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/async": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", - "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==", - "dev": true - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true - }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", - "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", - "dev": true - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "dev": true, - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, - "node_modules/blob-util": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/blob-util/-/blob-util-2.0.2.tgz", - "integrity": "sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ==", - "dev": true - }, - "node_modules/bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true - }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/cachedir": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", - "integrity": "sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", - "dev": true, - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", - "dev": true - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/check-more-types": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", - "integrity": "sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/ci-info": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", - "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "engines": { - "node": ">=8" - } - }, - "node_modules/clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "dependencies": { - "restore-cursor": "^3.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cli-table3": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.4.tgz", - "integrity": "sha512-Lm3L0p+/npIQWNIiyF/nAn7T5dnOwR3xNTHXYEBFBFVPXzCVNZ5lqEC/1eo/EVfpDsQ1I+TX4ORPQgp+UI0CRw==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0" - }, - "engines": { - "node": "10.* || >= 12.*" - }, - "optionalDependencies": { - "@colors/colors": "1.5.0" - } - }, - "node_modules/cli-truncate": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", - "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", - "dev": true, - "dependencies": { - "slice-ansi": "^3.0.0", - "string-width": "^4.2.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/colorette": { - "version": "2.0.20", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", - "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/commander": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", - "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/common-tags": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", - "integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==", - "dev": true, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/cypress": { - "version": "13.7.3", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.7.3.tgz", - "integrity": "sha512-uoecY6FTCAuIEqLUYkTrxamDBjMHTYak/1O7jtgwboHiTnS1NaMOoR08KcTrbRZFCBvYOiS4tEkQRmsV+xcrag==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "@cypress/request": "^3.0.0", - "@cypress/xvfb": "^1.2.4", - "@types/sinonjs__fake-timers": "8.1.1", - "@types/sizzle": "^2.3.2", - "arch": "^2.2.0", - "blob-util": "^2.0.2", - "bluebird": "^3.7.2", - "buffer": "^5.7.1", - "cachedir": "^2.3.0", - "chalk": "^4.1.0", - "check-more-types": "^2.24.0", - "cli-cursor": "^3.1.0", - "cli-table3": "~0.6.1", - "commander": "^6.2.1", - "common-tags": "^1.8.0", - "dayjs": "^1.10.4", - "debug": "^4.3.4", - "enquirer": "^2.3.6", - "eventemitter2": "6.4.7", - "execa": "4.1.0", - "executable": "^4.1.1", - "extract-zip": "2.0.1", - "figures": "^3.2.0", - "fs-extra": "^9.1.0", - "getos": "^3.2.1", - "is-ci": "^3.0.1", - "is-installed-globally": "~0.4.0", - "lazy-ass": "^1.6.0", - "listr2": "^3.8.3", - "lodash": "^4.17.21", - "log-symbols": "^4.0.0", - "minimist": "^1.2.8", - "ospath": "^1.2.2", - "pretty-bytes": "^5.6.0", - "process": "^0.11.10", - "proxy-from-env": "1.0.0", - "request-progress": "^3.0.0", - "semver": "^7.5.3", - "supports-color": "^8.1.1", - "tmp": "~0.2.1", - "untildify": "^4.0.0", - "yauzl": "^2.10.0" - }, - "bin": { - "cypress": "bin/cypress" - }, - "engines": { - "node": "^16.0.0 || ^18.0.0 || >=20.0.0" - } - }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", - "dev": true, - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/dayjs": { - "version": "1.11.10", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", - "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==", - "dev": true - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dev": true, - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "dev": true, - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/enquirer": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", - "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", - "dev": true, - "dependencies": { - "ansi-colors": "^4.1.1", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.2.4" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/eventemitter2": { - "version": "6.4.7", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz", - "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==", - "dev": true - }, - "node_modules/execa": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", - "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/executable": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz", - "integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==", - "dev": true, - "dependencies": { - "pify": "^2.2.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "node_modules/extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "dev": true, - "dependencies": { - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - }, - "bin": { - "extract-zip": "cli.js" - }, - "engines": { - "node": ">= 10.17.0" - }, - "optionalDependencies": { - "@types/yauzl": "^2.9.1" - } - }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "dev": true, - "engines": [ - "node >=0.6.0" - ] - }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", - "dev": true, - "dependencies": { - "pend": "~1.2.0" - } - }, - "node_modules/figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", - "dev": true, - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/getos": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/getos/-/getos-3.2.1.tgz", - "integrity": "sha512-U56CfOK17OKgTVqozZjUKNdkfEv6jk5WISBJ8SHoagjE6L69zOwl3Z+O8myjY9MEW3i2HPWQBt/LTbCgcC973Q==", - "dev": true, - "dependencies": { - "async": "^3.2.0" - } - }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "dev": true, - "dependencies": { - "assert-plus": "^1.0.0" - } - }, - "node_modules/global-dirs": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.1.tgz", - "integrity": "sha512-NBcGGFbBA9s1VzD41QXDG+3++t9Mn5t1FpLdhESY6oKY4gYTFpX4wO3sqGUa0Srjtbfj3szX0RnemmrVRUdULA==", - "dev": true, - "dependencies": { - "ini": "2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dev": true, - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/http-signature": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", - "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", - "dev": true, - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^2.0.2", - "sshpk": "^1.14.1" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/human-signals": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", - "dev": true, - "engines": { - "node": ">=8.12.0" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/is-ci": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz", - "integrity": "sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==", - "dev": true, - "dependencies": { - "ci-info": "^3.2.0" - }, - "bin": { - "is-ci": "bin.js" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-installed-globally": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", - "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dev": true, - "dependencies": { - "global-dirs": "^3.0.0", - "is-path-inside": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "dev": true - }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", - "dev": true - }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "dev": true - }, - "node_modules/json-schema": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "dev": true - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true - }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/jsprim": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", - "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - } - }, - "node_modules/lazy-ass": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", - "integrity": "sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==", - "dev": true, - "engines": { - "node": "> 0.8" - } - }, - "node_modules/listr2": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz", - "integrity": "sha512-TyWI8G99GX9GjE54cJ+RrNMcIFBfwMPxc3XTFiAYGN4s10hWROGtOg7+O6u6LE3mNkyld7RSLE6nrKBvTfcs3g==", - "dev": true, - "dependencies": { - "cli-truncate": "^2.1.0", - "colorette": "^2.0.16", - "log-update": "^4.0.0", - "p-map": "^4.0.0", - "rfdc": "^1.3.0", - "rxjs": "^7.5.1", - "through": "^2.3.8", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "enquirer": ">= 2.3.0 < 3" - }, - "peerDependenciesMeta": { - "enquirer": { - "optional": true - } - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", - "dev": true - }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/log-update": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", - "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", - "dev": true, - "dependencies": { - "ansi-escapes": "^4.3.0", - "cli-cursor": "^3.1.0", - "slice-ansi": "^4.0.0", - "wrap-ansi": "^6.2.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/log-update/node_modules/slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" - } - }, - "node_modules/log-update/node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ospath": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ospath/-/ospath-1.2.2.tgz", - "integrity": "sha512-o6E5qJV5zkAbIDNhGSIlyOhScKXgQrSRMilfph0clDfM0nEnBOlKlH4sWDmG95BW/CvwNz0vmm7dJVtU2KlMiA==", - "dev": true - }, - "node_modules/p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dev": true, - "dependencies": { - "aggregate-error": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "dev": true - }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", - "dev": true - }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pretty-bytes": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", - "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "dev": true, - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/proxy-from-env": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", - "integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==", - "dev": true - }, - "node_modules/psl": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", - "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", - "dev": true - }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/qs": { - "version": "6.10.4", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.4.tgz", - "integrity": "sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g==", - "dev": true, - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true - }, - "node_modules/request-progress": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", - "integrity": "sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg==", - "dev": true, - "dependencies": { - "throttleit": "^1.0.0" - } - }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true - }, - "node_modules/restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/rfdc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.1.tgz", - "integrity": "sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==", - "dev": true - }, - "node_modules/rxjs": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", - "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "dev": true, - "dependencies": { - "tslib": "^2.1.0" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "dev": true, - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "node_modules/slice-ansi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", - "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/sshpk": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", - "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", - "dev": true, - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/throttleit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.1.tgz", - "integrity": "sha512-vDZpf9Chs9mAdfY046mcPt8fg5QSZr37hEH4TXYBnDF+izxgrbRGUAAaBvIk/fJm9aOFCGFd1EsNg5AZCbnQCQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true - }, - "node_modules/tmp": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", - "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", - "dev": true, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/tough-cookie": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", - "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", - "dev": true, - "dependencies": { - "psl": "^1.1.33", - "punycode": "^2.1.1", - "universalify": "^0.2.0", - "url-parse": "^1.5.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tough-cookie/node_modules/universalify": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", - "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true - }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "dev": true, - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "dev": true - }, - "node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true, - "optional": true - }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "dev": true, - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", - "dev": true, - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - } - } -} diff --git a/cypress-tests/package.json b/cypress-tests/package.json deleted file mode 100644 index fff8cd8b3f1..00000000000 --- a/cypress-tests/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "test", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "cypress": "npx cypress open", - "cypress-e2e": "npx cypress run --e2e", - "cypress:ci": "npx cypress run --headless" - }, - "author": "", - "license": "ISC" -} diff --git a/cypress-tests/readme.md b/cypress-tests/readme.md deleted file mode 100644 index 9285066bfe6..00000000000 --- a/cypress-tests/readme.md +++ /dev/null @@ -1,242 +0,0 @@ -# Cypress Tests - -## Overview - -This Tool is a solution designed to automate testing for the [Hyperswitch](https://github.com/juspay/hyperswitch/) using Cypress, an open-source tool capable of conducting API call tests and UI tests. This README provides guidance on installing Cypress and its dependencies. - -## Installation - -### Prerequisites - -Before installing Cypress, ensure you have the following prerequisites installed: - -- npm (Node Package Manager) -- Node.js (18.x and above) - -### Run Test Cases on your local - -To run test cases, follow these steps: - -1. Install Cypress - - ```shell - npm install cypress --save-dev - ``` - -2. Clone the repository and switch to the project directory: - - ```shell - git clone https://github.com/juspay/hyperswitch - cd cypress-tests - ``` - -3. Set environment variables for cypress - - ```shell - export CYPRESS_CONNECTOR="connector_id" - export CYPRESS_BASEURL="base_url" - export DEBUG=cypress:cli - export CYPRESS_ADMINAPIKEY="admin_api_key" - export CYPRESS_CONNECToR_AUtH_FILE_PATH="path/to/creds.json" - ``` - -4. Run Cypress test cases - - To run the tests in a browser in interactive mode run the following command - - ```shell - npm run cypress - ``` - - To run the tests in headless mode run the following command - - ```shell - npm run cypress:ci - ``` - -> [!NOTE] -> To learn about how creds file should be structured, refer to the [example.creds.json](#example-credsjson) section below. - -## Folder Structure - -The folder structure of this directory is as follows: - -```text -. # The root directory for the Cypress tests. -├── .gitignore -├── cypress # Contains Cypress-related files and folders. -│   ├── e2e # End-to-end test directory. -│   │   ├── ConnectorTest # Directory for test scenarios related to connectors. -│   │   │   ├── your_testcase1_files_here.cy.js -│   │   │   ├── your_testcase2_files_here.cy.js -│   │   │   └── ... -│   │   └── ConnectorUtils # Directory for utility functions related to connectors. -│   │   ├── connector_detail_files_here.js -│   │   └── utils.js -│   ├── fixtures # Directory for storing test data API request. -│   │   └── your_fixture_files_here.json -│   ├── support # Directory for Cypress support files. -│   │   ├── commands.js # File containing custom Cypress commands and utilities. -│   │   └── e2e.js -│   └── utils -│   └── utility_files_go_here.js -├── cypress.config.js # Cypress configuration file. -├── cypress.env.json # File is used to store environment-specific configuration values,such as base URLs, which can be accessed within your Cypress tests. -├── package.json # Node.js package file. -├── readme.md # This file -└── yarn.lock -``` - -## Writing Tests - -### Adding Connectors - -To add a new connector for testing with Hyperswitch, follow these steps: - -1.Include the connector details in the `creds.json` file: - -example: - -```json -{ - "stripe": { - "auth_type": "HeaderKey", - "api_key": "SK_134" - } -} -``` - -2.Add the new connector details to the ConnectorUtils folder (including CardNo and connector-specific information). - -Refer to Stripe.js file for guidance: - -```javascript -/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js -``` - -Similarly, create a new file named newconnectorname.js and include all the relevant information for that connector. - -3.In util.js, import the new connector details. - -### Adding Functions - -Similarly, add any helper functions or utilities in the `command.js` in support folder and import them into your tests as needed. - -Example: Adding List Mandate function to support `ListMandate` scenario - -```javascript -Cypress.Commands.add("listMandateCallTest", (globalState) => { - const customerId = globalState.get("customerId"); - cy.request({ - method: "GET", - url: `${globalState.get("baseUrl")}/customers/${customerId}/mandates`, - headers: { - "Content-Type": "application/json", - "api-key": globalState.get("apiKey"), - }, - }).then((response) => { - const xRequestId = response.headers["x-request-id"]; - if (xRequestId) { - cy.task("cli_log", "x-request-id ->> " + xRequestId); - } else { - cy.task( - "cli_log", - "x-request-id is not available in the response headers" - ); - } - expect(response.headers["content-type"]).to.include("application/json"); - console.log(response.body); - let i = 0; - for (i in response.body) { - if (response.body[i].mandate_id === globalState.get("mandateId")) { - expect(response.body[i].status).to.equal("active"); - } - } - }); -}); -``` - -### Adding Scenarios - -To add new test scenarios: - -1. Navigate to the ConnectorTest directory. -2. Create a new test file or modify existing ones to add your scenarios. -3. Write your test scenarios using Cypress commands. - -For example, to add a scenario for listing mandates in the `Mandateflows`: - -```javascript -// cypress/ConnectorTest/CreateSingleuseMandate.js -describe("Payment Scenarios", () => { - it("should complete a successful payment", () => { - // Your test logic here - }); -}); -``` - -In this scenario, you can call functions defined in `command.js`. For instance, to test the `listMandateCallTest` function: - -```javascript -describe("Payment Scenarios", () => { - it("list-mandate-call-test", () => { - cy.listMandateCallTest(globalState); - }); -}); -``` - -You can create similar scenarios by calling other functions defined in `command.js`. These functions interact with utility files like `connector.js` and include necessary assertions to support various connector scenarios. - -## Additional Resources - -For more information on using Cypress and writing effective tests, refer to the official Cypress documentation: [Cypress Documentation](https://docs.cypress.io/) - -## Example creds.json - -```json -{ - "adyen": { - "auth_type": "SignatureKey", - "api_key": "api_key", - "key1": "key1", - "api_secret": "api_secret" - }, - "bankofamerica": { - "auth_type": "SignatureKey", - "api_key": "api_key", - "key1": "key1", - "api_secret": "api_secret" - }, - "bluesnap": { - "auth_type": "BodyKey", - "api_key": "api_key", - "key1": "key1" - }, - "cybersource": { - "auth_type": "SignatureKey", - "api_key": "api_key", - "key1": "key1", - "api_secret": "api_secret" - }, - "nmi": { - "auth_type": "BodyKey", - "api_key": "api_key", - "key1": "key1" - }, - "paypal": { - "auth_type": "BodyKey", - "api_key": "api_key", - "key1": "key1" - }, - "stripe": { - "auth_type": "HeaderKey", - "api_key": "api_key" - }, - "trustpay": { - "auth_type": "SignatureKey", - "api_key": "api_key", - "key1": "key1", - "api_secret": "api_secret" - } -} -``` diff --git a/docker-compose.yml b/docker-compose.yml index 040832f8e27..e55008f1e34 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -332,35 +332,4 @@ services: ulimits: nofile: soft: 262144 - hard: 262144 - - fluentd: - build: ./docker/fluentd - volumes: - - ./docker/fluentd/conf:/fluentd/etc - networks: - - router_net - - opensearch: - image: public.ecr.aws/opensearchproject/opensearch:1.3.14 - container_name: opensearch - hostname: opensearch - environment: - - "discovery.type=single-node" - expose: - - "9200" - ports: - - "9200:9200" - networks: - - router_net - - opensearch-dashboards: - image: opensearchproject/opensearch-dashboards:1.3.14 - ports: - - 5601:5601 - expose: - - "5601" - environment: - OPENSEARCH_HOSTS: '["https://opensearch:9200"]' - networks: - - router_net \ No newline at end of file + hard: 262144 \ No newline at end of file diff --git a/docker/fluentd/Dockerfile b/docker/fluentd/Dockerfile deleted file mode 100644 index 5c85269e1a6..00000000000 --- a/docker/fluentd/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -# docker/fluentd/Dockerfile - -FROM fluent/fluentd:v1.16-debian-2 -USER root -RUN ["gem", "install", "fluent-plugin-kafka", "--no-document"] -RUN ["gem", "install", "fluent-plugin-opensearch", "--no-document"] -USER fluent diff --git a/docker/fluentd/conf/fluent.conf b/docker/fluentd/conf/fluent.conf deleted file mode 100644 index 7aec9dd7cd8..00000000000 --- a/docker/fluentd/conf/fluent.conf +++ /dev/null @@ -1,137 +0,0 @@ -# docker/fluentd/conf/fluent.conf - - - @type kafka_group - - brokers kafka0:29092 - consumer_group fluentd - topics hyperswitch-payment-intent-events,hyperswitch-payment-attempt-events,hyperswitch-refund-events,hyperswitch-dispute-events - add_headers false - add_prefix topic - retry_emit_limit 2 - - - - @type record_transformer - renew_time_key created_at - - - - @type record_transformer - renew_time_key created_at - - - - @type record_transformer - renew_time_key created_at - - - - - @type record_transformer - renew_time_key created_at - - - - @type copy - - - @type stdout - - - - @type opensearch - host opensearch - port 9200 - scheme https - index_name hyperswitch-payment-intent-events - id_key payment_id - user admin - password admin - ssl_verify false - prefer_oj_serializer true - reload_on_failure true - reload_connections false - request_timeout 120s - bulk_message_request_threshold 10MB - include_timestamp true - - - - - @type copy - - - @type stdout - - - - @type opensearch - host opensearch - port 9200 - scheme https - index_name hyperswitch-payment-attempt-events - id_key attempt_id - user admin - password admin - ssl_verify false - prefer_oj_serializer true - reload_on_failure true - reload_connections false - request_timeout 120s - bulk_message_request_threshold 10MB - include_timestamp true - - - - - @type copy - - - @type stdout - - - - @type opensearch - host opensearch - port 9200 - scheme https - index_name hyperswitch-refund-events - id_key refund_id - user admin - password admin - ssl_verify false - prefer_oj_serializer true - reload_on_failure true - reload_connections false - request_timeout 120s - bulk_message_request_threshold 10MB - include_timestamp true - - - - - @type copy - - - @type stdout - - - - @type opensearch - host opensearch - port 9200 - scheme https - index_name hyperswitch-dispute-events - id_key dispute_id - user admin - password admin - ssl_verify false - prefer_oj_serializer true - reload_on_failure true - reload_connections false - request_timeout 120s - bulk_message_request_threshold 10MB - include_timestamp true - - \ No newline at end of file diff --git a/docker/wasm-build.Dockerfile b/docker/wasm-build.Dockerfile index bddcacdfc64..2ebdcec217e 100644 --- a/docker/wasm-build.Dockerfile +++ b/docker/wasm-build.Dockerfile @@ -4,7 +4,7 @@ ARG RUN_ENV=sandbox ARG EXTRA_FEATURES="" RUN apt-get update \ - && apt-get install -y clang libssl-dev pkg-config + && apt-get install -y libssl-dev pkg-config ENV CARGO_INCREMENTAL=0 # Allow more retries for network requests in cargo (downloading crates) and diff --git a/docs/building_docker_images.md b/docs/building_docker_images.md deleted file mode 100644 index 0d98d03f553..00000000000 --- a/docs/building_docker_images.md +++ /dev/null @@ -1,155 +0,0 @@ -# Building Docker Images - -## Cargo Features - -The Hyperswitch application server makes extensive use of -[Cargo features][cargo-features] to selectively toggle certain features and -integrations. -The list of features can be found in the `[features]` section in the -[`crates/router/Cargo.toml`][router-manifest] file. - -Of these features, the noteworthy ones are the `default` and `release` features: - -- `default`: This feature set enables a basic set of necessary features for both - development and production environments, such as the transactional APIs, - APIs used by the control center, Stripe compatibility, automatic payment - retries, in-memory caching, etc. - -- `release`: This feature set enables some additional features that are suitable - for production environments, such as AWS KMS integration, AWS S3 integration, - AWS SES integration, etc. - -Refer to the [documentation on cargo features][cargo-features] to understand how -to select features with Cargo, when building the application server. - -## Building with the Dockerfile - -The Docker images for the application server and other components can be built -using the [`Dockerfile`][dockerfile] using the below commands, substituting the -Docker image tags with suitable values: - -- router: - - ```shell - docker build \ - --load \ - --file Dockerfile \ - --build-arg "BINARY=router" \ - --tag hyperswitch-router \ - . - ``` - -- consumer: - - ```shell - docker build \ - --load \ - --file Dockerfile \ - --build-arg "BINARY=scheduler" \ - --build-arg "SCHEDULER_FLOW=consumer" \ - --tag hyperswitch-consumer \ - . - ``` - -- producer: - - ```shell - docker build \ - --load \ - --file Dockerfile \ - --build-arg "BINARY=scheduler" \ - --build-arg "SCHEDULER_FLOW=producer" \ - --tag hyperswitch-producer \ - . - ``` - -- drainer: - - ```shell - docker build \ - --load \ - --file Dockerfile \ - --build-arg "BINARY=drainer" \ - --tag hyperswitch-drainer \ - . - ``` - -When our Docker images are built using the [`Dockerfile`][dockerfile], the -`cargo` command being run is: - -```shell -cargo build --release --features release ${EXTRA_FEATURES} -``` - -- The `--release` flag specifies that optimized release binaries must be built. - Refer to the [`cargo build` manual page][cargo-build-manual-page] for more - information. - -- The `--features release` flag specifies that the `release` feature set must be - enabled for the build. - Since we do not specify the `--no-default-features` flag to the `cargo build` - command, the build would have the `default` and `release` features enabled. - -- In case you create your own features sets and want to enable them, you can use - the `${EXTRA_FEATURES}` build argument to specify any additional features that - would have to be passed to the `cargo build` command. - The build argument could look as follows: - `EXTRA_FEATURES="--features feature1,feature2,feature3"`, with actual feature - names substituted in the command. - -## Image Variants on Docker Hub - -As of writing this document, we have two image variants available on our Docker -Hub repositories: - -- release: These images contain only the tag that was built, and no other - suffixes, like the `v1.105.1` and `v1.107.0` Docker images. - -- standalone: These images contain the tag that was built with a `standalone` - suffix, like the `v1.105.1-standalone` and `v1.107.0-standalone` Docker images. - -The primary difference is that our standalone Docker images do not have some -features enabled by default in order to support hosting of Hyperswitch outside -AWS. -As of writing this document, the standalone images exclude the `email` and -`recon` features from the `release` feature set, while the release images are -built from the Dockerfile without any changes to the codebase after the tag is -checked out. - -If you are building custom images and would like to mirror the behavior of our -standalone images, then you'd have to remove the `email` and `recon` features -from the `release` feature set. - -## Frequently Asked Questions - -### What machine specifications would I need to build release images? - -Building release (optimized) images needs significant amount of resources, and -we'd recommend using a machine with at least 8 cores and 16 GB of RAM for this -purpose. -Rust is known to have long compile times, and a codebase of this size will -require a significant time to build, around 45-60 minutes for the above -configuration. - -### Build seems to be stuck at "Compiling router/scheduler/analytics/..." - -The compilation process involves compiling all of our dependencies and then -compiling our workspace (first-party) crates, among which the biggest one -(in terms of lines of code) is the `router` crate. -Once all the dependencies of the `router` crate have been built, one of the last -ones being built is the `router` crate itself. - -As mentioned above, building release images takes a significant amount of time. -It is normal to see nothing else being printed after a line which says -`Compiling router / scheduler / analytics / ...`. We'd suggest waiting -for a while. -If you're still concerned that the compilation process has been stuck for far -too long, you can check if at least one CPU is being utilized by -`cargo` / `docker` using a tool like `htop` (if you can access the machine which -is building the code). Worst case, you can proceed to kill the compilation -process and try again. - -[cargo-features]: https://doc.rust-lang.org/cargo/reference/features.html -[router-manifest]: https://github.com/juspay/hyperswitch/blob/main/crates/router/Cargo.toml -[dockerfile]: https://github.com/juspay/hyperswitch/blob/main/Dockerfile -[cargo-build-manual-page]: https://doc.rust-lang.org/cargo/commands/cargo-build.html diff --git a/docs/try_local_system.md b/docs/try_local_system.md index a13d04ade83..a9cd080f26d 100644 --- a/docs/try_local_system.md +++ b/docs/try_local_system.md @@ -222,7 +222,6 @@ Once you're done with setting up the dependencies, proceed with [postgresql-install]: https://www.postgresql.org/download/ [redis-install]: https://redis.io/docs/getting-started/installation/ -[wsl-config]: https://learn.microsoft.com/en-us/windows/wsl/wsl-config/ ### Set up dependencies on Windows (Ubuntu on WSL2) @@ -242,8 +241,6 @@ packages for your distribution and follow along. The following steps assume that you are running the commands within the WSL shell environment. - > Note that a `SIGKILL` error may occur when compiling certain crates if WSL is unable to use sufficient memory. It may be necessary to allow up to 24GB of memory, but your mileage may vary. You may increase the amount of memory WSL can use via a `.wslconfig` file in your Windows user folder, or by creating a swap file in WSL itself. Refer to the [WSL configuration documentation][wsl-config] for more information. - 2. Install the stable Rust toolchain using `rustup`: ```shell diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml index 799582c733f..9a9a7606ca1 100644 --- a/loadtest/config/development.toml +++ b/loadtest/config/development.toml @@ -72,7 +72,6 @@ authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api" bambora.base_url = "https://api.na.bambora.com" bankofamerica.base_url = "https://apitest.merchant-services.bankofamerica.com/" billwerk.base_url = "https://api.reepay.com/" -billwerk.secondary_base_url = "https://card.reepay.com/" bitpay.base_url = "https://test.bitpay.com" bluesnap.base_url = "https://sandbox.bluesnap.com/" bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" @@ -86,7 +85,6 @@ cryptopay.base_url = "https://business-sandbox.cryptopay.me" cybersource.base_url = "https://apitest.cybersource.com/" dlocal.base_url = "https://sandbox.dlocal.com/" dummyconnector.base_url = "http://localhost:8080/dummy-connector" -ebanx.base_url = "https://sandbox.ebanxpay.com/" fiserv.base_url = "https://cert.api.fiservapps.com/" forte.base_url = "https://sandbox.forte.net/api/v3" globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/" @@ -98,7 +96,6 @@ klarna.base_url = "https://api-na.playground.klarna.com/" mollie.base_url = "https://api.mollie.com/v2/" mollie.secondary_base_url = "https://api.cc.mollie.com/v1/" multisafepay.base_url = "https://testapi.multisafepay.com/" -netcetera.base_url = "https://{{merchant_endpoint_prefix}}.3ds-server.prev.netcetera-cloud-payment.ch" nexinets.base_url = "https://apitest.payengine.de/v1" nmi.base_url = "https://secure.nmi.com/" noon.base_url = "https://api-test.noonpayments.com/" @@ -132,7 +129,6 @@ worldpay.base_url = "https://try.access.worldpay.com/" wise.base_url = "https://api.sandbox.transferwise.tech/" zen.base_url = "https://api.zen-test.com/" zen.secondary_base_url = "https://secure.zen-test.com/" -zsl.base_url = "https://api.sitoffalb.net/" [pm_filters.default] apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US,KR,VN,MA,ZA,VA,CL,SV,GT,HN,PA", currency = "AED,AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" } @@ -158,7 +154,6 @@ cards = [ "cybersource", "dlocal", "dummyconnector", - "ebanx", "fiserv", "forte", "globalpay", @@ -168,7 +163,6 @@ cards = [ "iatapay", "mollie", "multisafepay", - "netcetera", "nexinets", "nmi", "noon", @@ -194,7 +188,6 @@ cards = [ "worldline", "worldpay", "zen", - "zsl", ] [pm_filters.volt] @@ -226,7 +219,6 @@ checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_ mollie = {long_lived_token = false, payment_method = "card"} braintree = { long_lived_token = false, payment_method = "card" } gocardless = {long_lived_token = true, payment_method = "bank_debit"} -billwerk = {long_lived_token = false, payment_method = "card"} [connector_customer] connector_list = "gocardless,stax,stripe" @@ -260,11 +252,11 @@ supported_connectors = "braintree" [mandates.supported_payment_methods] pay_later.klarna = {connector_list = "adyen"} -wallet.google_pay = {connector_list = "stripe,adyen,bankofamerica"} -wallet.apple_pay = {connector_list = "stripe,adyen,bankofamerica"} +wallet.google_pay = {connector_list = "stripe,adyen"} +wallet.apple_pay = {connector_list = "stripe,adyen"} wallet.paypal = {connector_list = "adyen"} -card.credit = {connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica"} -card.debit = {connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica"} +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"} @@ -283,9 +275,6 @@ wildcard_origin = false card.credit ={connector_list ="cybersource"} card.debit = {connector_list ="cybersource"} -[network_transaction_id_supported_connectors] -connector_list = "stripe,adyen,cybersource" - [analytics] source = "sqlx" diff --git a/loadtest/config/tempo.yaml b/loadtest/config/tempo.yaml index 135c4bac8de..f3e573a2bb3 100644 --- a/loadtest/config/tempo.yaml +++ b/loadtest/config/tempo.yaml @@ -27,7 +27,7 @@ storage: index_downsample_bytes: 1000 # number of bytes per index record encoding: zstd # block encoding/compression. options: none, gzip, lz4-64k, lz4-256k, lz4-1M, lz4, snappy, zstd, s2 wal: - path: /tmp/tempo/wal # where to store the wal locally + path: /tmp/tempo/wal # where to store the the wal locally encoding: snappy # wal encoding/compression. options: none, gzip, lz4-64k, lz4-256k, lz4-1M, lz4, snappy, zstd, s2 local: path: /tmp/tempo/blocks diff --git a/loadtest/k6/helper/k6-summary.js b/loadtest/k6/helper/k6-summary.js index f8135cb5a10..83935caa8b9 100644 --- a/loadtest/k6/helper/k6-summary.js +++ b/loadtest/k6/helper/k6-summary.js @@ -160,26 +160,26 @@ function toFixedNoTrailingZerosTrunc(val, prec) { return toFixedNoTrailingZeros(Math.trunc(mult * val) / mult, prec) } -function humanizeGenericDuration(duration) { - if (duration === 0) { +function humanizeGenericDuration(dur) { + if (dur === 0) { return '0s' } - if (duration < 0.001) { + if (dur < 0.001) { // smaller than a microsecond, print nanoseconds - return Math.trunc(duration * 1000000) + 'ns' + return Math.trunc(dur * 1000000) + 'ns' } - if (duration < 1) { + if (dur < 1) { // smaller than a millisecond, print microseconds - return toFixedNoTrailingZerosTrunc(duration * 1000, 2) + 'µs' + return toFixedNoTrailingZerosTrunc(dur * 1000, 2) + 'µs' } - if (duration < 1000) { + if (dur < 1000) { // duration is smaller than a second - return toFixedNoTrailingZerosTrunc(duration, 2) + 'ms' + return toFixedNoTrailingZerosTrunc(dur, 2) + 'ms' } - var result = toFixedNoTrailingZerosTrunc((duration % 60000) / 1000, duration > 60000 ? 0 : 2) + 's' - var rem = Math.trunc(duration / 60000) + var result = toFixedNoTrailingZerosTrunc((dur % 60000) / 1000, dur > 60000 ? 0 : 2) + 's' + var rem = Math.trunc(dur / 60000) if (rem < 1) { // less than a minute return result @@ -193,12 +193,12 @@ function humanizeGenericDuration(duration) { return rem + 'h' + result } -function humanizeDuration(duration, timeUnit) { +function humanizeDuration(dur, timeUnit) { if (timeUnit !== '' && unitMap.hasOwnProperty(timeUnit)) { - return (duration * unitMap[timeUnit].coef).toFixed(2) + unitMap[timeUnit].unit + return (dur * unitMap[timeUnit].coef).toFixed(2) + unitMap[timeUnit].unit } - return humanizeGenericDuration(duration) + return humanizeGenericDuration(dur) } function humanizeValue(val, metric, timeUnit) { diff --git a/migrations/2024-03-07-102620_add-network-transaction-id/down.sql b/migrations/2024-03-07-102620_add-network-transaction-id/down.sql deleted file mode 100644 index 4cf99815a9b..00000000000 --- a/migrations/2024-03-07-102620_add-network-transaction-id/down.sql +++ /dev/null @@ -1,3 +0,0 @@ --- This file should undo anything in `up.sql` - -ALTER TABLE payment_methods DROP COLUMN network_transaction_id; \ No newline at end of file diff --git a/migrations/2024-03-07-102620_add-network-transaction-id/up.sql b/migrations/2024-03-07-102620_add-network-transaction-id/up.sql deleted file mode 100644 index 06b199e6390..00000000000 --- a/migrations/2024-03-07-102620_add-network-transaction-id/up.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Your SQL goes here - -ALTER TABLE payment_methods ADD COLUMN network_transaction_id VARCHAR(255) DEFAULT NULL; \ No newline at end of file diff --git a/migrations/2024-03-15-133951_pm-client-secret/down.sql b/migrations/2024-03-15-133951_pm-client-secret/down.sql deleted file mode 100644 index 90b2d0dba14..00000000000 --- a/migrations/2024-03-15-133951_pm-client-secret/down.sql +++ /dev/null @@ -1,3 +0,0 @@ --- This file should undo anything in `up.sql` -ALTER TABLE payment_methods DROP COLUMN IF EXISTS client_secret; -ALTER TABLE payment_methods ALTER COLUMN payment_method SET NOT NULL; \ No newline at end of file diff --git a/migrations/2024-03-15-133951_pm-client-secret/up.sql b/migrations/2024-03-15-133951_pm-client-secret/up.sql deleted file mode 100644 index e933d3ff382..00000000000 --- a/migrations/2024-03-15-133951_pm-client-secret/up.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Your SQL goes here -ALTER TABLE payment_methods ADD COLUMN IF NOT EXISTS client_secret VARCHAR(128) DEFAULT NULL; -ALTER TABLE payment_methods ALTER COLUMN payment_method DROP NOT NULL; \ No newline at end of file diff --git a/migrations/2024-04-03-090257_add_profile_id_in_authentication_table/down.sql b/migrations/2024-04-03-090257_add_profile_id_in_authentication_table/down.sql deleted file mode 100644 index c4318fdafd4..00000000000 --- a/migrations/2024-04-03-090257_add_profile_id_in_authentication_table/down.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE authentication DROP COLUMN IF EXISTS profile_id; \ No newline at end of file diff --git a/migrations/2024-04-03-090257_add_profile_id_in_authentication_table/up.sql b/migrations/2024-04-03-090257_add_profile_id_in_authentication_table/up.sql deleted file mode 100644 index e843f4777ac..00000000000 --- a/migrations/2024-04-03-090257_add_profile_id_in_authentication_table/up.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Your SQL goes here -ALTER TABLE authentication ADD COLUMN profile_id VARCHAR(64) NOT NULL; diff --git a/migrations/2024-04-04-080427_add_payment_id_in_authentication_table/down.sql b/migrations/2024-04-04-080427_add_payment_id_in_authentication_table/down.sql deleted file mode 100644 index 3282167351b..00000000000 --- a/migrations/2024-04-04-080427_add_payment_id_in_authentication_table/down.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE authentication DROP COLUMN IF EXISTS payment_id; \ No newline at end of file diff --git a/migrations/2024-04-04-080427_add_payment_id_in_authentication_table/up.sql b/migrations/2024-04-04-080427_add_payment_id_in_authentication_table/up.sql deleted file mode 100644 index 4b7291a41e1..00000000000 --- a/migrations/2024-04-04-080427_add_payment_id_in_authentication_table/up.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Your SQL goes here -ALTER TABLE authentication ADD COLUMN payment_id VARCHAR(255); \ No newline at end of file diff --git a/migrations/2024-04-09-202926_add_confirm_to_payouts/down.sql b/migrations/2024-04-09-202926_add_confirm_to_payouts/down.sql deleted file mode 100644 index ae191c474f0..00000000000 --- a/migrations/2024-04-09-202926_add_confirm_to_payouts/down.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE payouts DROP COLUMN IF EXISTS confirm; \ No newline at end of file diff --git a/migrations/2024-04-09-202926_add_confirm_to_payouts/up.sql b/migrations/2024-04-09-202926_add_confirm_to_payouts/up.sql deleted file mode 100644 index 0eccb099525..00000000000 --- a/migrations/2024-04-09-202926_add_confirm_to_payouts/up.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE payouts ADD COLUMN IF NOT EXISTS confirm bool; \ No newline at end of file diff --git a/migrations/2024-04-10-034442_alter_payout_status/down.sql b/migrations/2024-04-10-034442_alter_payout_status/down.sql deleted file mode 100644 index 027b7d63fdb..00000000000 --- a/migrations/2024-04-10-034442_alter_payout_status/down.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT 1; \ No newline at end of file diff --git a/migrations/2024-04-10-034442_alter_payout_status/up.sql b/migrations/2024-04-10-034442_alter_payout_status/up.sql deleted file mode 100644 index 80177f5324b..00000000000 --- a/migrations/2024-04-10-034442_alter_payout_status/up.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TYPE "PayoutStatus" ADD VALUE IF NOT EXISTS 'requires_vendor_account_creation'; \ No newline at end of file diff --git a/migrations/2024-04-12-100908_add_dashboard_metadata_key_onboarding_survey/down.sql b/migrations/2024-04-12-100908_add_dashboard_metadata_key_onboarding_survey/down.sql deleted file mode 100644 index c7c9cbeb401..00000000000 --- a/migrations/2024-04-12-100908_add_dashboard_metadata_key_onboarding_survey/down.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This file should undo anything in `up.sql` -SELECT 1; \ No newline at end of file diff --git a/migrations/2024-04-12-100908_add_dashboard_metadata_key_onboarding_survey/up.sql b/migrations/2024-04-12-100908_add_dashboard_metadata_key_onboarding_survey/up.sql deleted file mode 100644 index 6c69d264814..00000000000 --- a/migrations/2024-04-12-100908_add_dashboard_metadata_key_onboarding_survey/up.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Your SQL goes here -ALTER TYPE "DashboardMetadata" -ADD VALUE IF NOT EXISTS 'onboarding_survey'; \ No newline at end of file diff --git a/migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/down.sql b/migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/down.sql deleted file mode 100644 index bbc6169b497..00000000000 --- a/migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/down.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE authentication DROP COLUMN IF EXISTS merchant_connector_id; \ No newline at end of file diff --git a/migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/up.sql b/migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/up.sql deleted file mode 100644 index ae083060bf8..00000000000 --- a/migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/up.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Your SQL goes here -ALTER TABLE authentication ADD COLUMN merchant_connector_id VARCHAR(128) NOT NULL; diff --git a/migrations/2024-04-23-132120_add-extended-card-info-to-business-profile/down.sql b/migrations/2024-04-23-132120_add-extended-card-info-to-business-profile/down.sql deleted file mode 100644 index e503c2dfbea..00000000000 --- a/migrations/2024-04-23-132120_add-extended-card-info-to-business-profile/down.sql +++ /dev/null @@ -1,3 +0,0 @@ --- This file should undo anything in `up.sql` - -ALTER TABLE business_profile DROP COLUMN IF EXISTS is_extended_card_info_enabled; \ No newline at end of file diff --git a/migrations/2024-04-23-132120_add-extended-card-info-to-business-profile/up.sql b/migrations/2024-04-23-132120_add-extended-card-info-to-business-profile/up.sql deleted file mode 100644 index cd5e8851adf..00000000000 --- a/migrations/2024-04-23-132120_add-extended-card-info-to-business-profile/up.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Your SQL goes here - -ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS is_extended_card_info_enabled BOOLEAN DEFAULT FALSE; \ No newline at end of file diff --git a/migrations/2024-04-24-075735_add-merchant-pkey-ttl-to-business-profile/down.sql b/migrations/2024-04-24-075735_add-merchant-pkey-ttl-to-business-profile/down.sql deleted file mode 100644 index 63a07052cbe..00000000000 --- a/migrations/2024-04-24-075735_add-merchant-pkey-ttl-to-business-profile/down.sql +++ /dev/null @@ -1,3 +0,0 @@ --- This file should undo anything in `up.sql` - -ALTER TABLE business_profile DROP COLUMN IF EXISTS extended_card_info_config; \ No newline at end of file diff --git a/migrations/2024-04-24-075735_add-merchant-pkey-ttl-to-business-profile/up.sql b/migrations/2024-04-24-075735_add-merchant-pkey-ttl-to-business-profile/up.sql deleted file mode 100644 index f1b9ca58f84..00000000000 --- a/migrations/2024-04-24-075735_add-merchant-pkey-ttl-to-business-profile/up.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Your SQL goes here - -ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS extended_card_info_config JSONB DEFAULT NULL; \ No newline at end of file diff --git a/migrations/2024-04-24-104042_add_capture_method_in_fraud_check_table/down.sql b/migrations/2024-04-24-104042_add_capture_method_in_fraud_check_table/down.sql deleted file mode 100644 index 596fb1022fd..00000000000 --- a/migrations/2024-04-24-104042_add_capture_method_in_fraud_check_table/down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE fraud_check -DROP COLUMN IF EXISTS payment_capture_method; \ No newline at end of file diff --git a/migrations/2024-04-24-104042_add_capture_method_in_fraud_check_table/up.sql b/migrations/2024-04-24-104042_add_capture_method_in_fraud_check_table/up.sql deleted file mode 100644 index 08e89a49c11..00000000000 --- a/migrations/2024-04-24-104042_add_capture_method_in_fraud_check_table/up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE fraud_check -ADD COLUMN IF NOT EXISTS payment_capture_method "CaptureMethod" NULL; \ No newline at end of file diff --git a/migrations/2024-04-28-095920_make_error_message_field_text/down.sql b/migrations/2024-04-28-095920_make_error_message_field_text/down.sql deleted file mode 100644 index 89f4120d005..00000000000 --- a/migrations/2024-04-28-095920_make_error_message_field_text/down.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This file should undo anything in `up.sql` -ALTER TABLE authentication ALTER COLUMN error_message TYPE VARCHAR(64); \ No newline at end of file diff --git a/migrations/2024-04-28-095920_make_error_message_field_text/up.sql b/migrations/2024-04-28-095920_make_error_message_field_text/up.sql deleted file mode 100644 index 55dfea3fb4f..00000000000 --- a/migrations/2024-04-28-095920_make_error_message_field_text/up.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Your SQL goes here -ALTER TABLE authentication ALTER COLUMN error_message TYPE TEXT; \ No newline at end of file diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index d278c50a388..fa9c7435632 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -4469,94 +4469,6 @@ } ] } - }, - "/events/{merchant_id_or_profile_id}/{event_id}/retry": { - "post": { - "tags": [ - "Event" - ], - "summary": "Events - Manual Retry", - "description": "Events - Manual Retry\n\nManually retry the delivery of the specified Event.", - "operationId": "Manually retry the delivery of an Event", - "parameters": [ - { - "name": "merchant_id_or_profile_id", - "in": "path", - "description": "The unique identifier for the Merchant Account or Business Profile", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "event_id", - "in": "path", - "description": "The unique identifier for the Event", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "The delivery of the Event was attempted. Check the `response` field in the response payload to identify the status of the delivery attempt.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EventRetrieveResponse" - } - } - } - } - }, - "security": [ - { - "admin_api_key": [] - } - ] - } - }, - "/poll/status/{poll_id}": { - "get": { - "tags": [ - "Poll" - ], - "summary": "Poll - Retrieve Poll Status", - "description": "Poll - Retrieve Poll Status", - "operationId": "Retrieve Poll Status", - "parameters": [ - { - "name": "poll_id", - "in": "path", - "description": "The identifier for poll", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "The poll status was retrieved successfully", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PollResponse" - } - } - } - }, - "404": { - "description": "Poll not found" - } - }, - "security": [ - { - "publishable_key": [] - } - ] - } } }, "components": { @@ -4797,8 +4709,7 @@ "type": "string", "nullable": true } - }, - "additionalProperties": false + } }, "AddressDetails": { "type": "object", @@ -4867,8 +4778,7 @@ "nullable": true, "maxLength": 255 } - }, - "additionalProperties": false + } }, "AirwallexData": { "type": "object", @@ -4882,24 +4792,26 @@ }, "AlfamartVoucherData": { "type": "object", + "required": [ + "first_name", + "last_name", + "email" + ], "properties": { "first_name": { "type": "string", "description": "The billing first name for Alfamart", - "example": "Jane", - "nullable": true + "example": "Jane" }, "last_name": { "type": "string", "description": "The billing second name for Alfamart", - "example": "Doe", - "nullable": true + "example": "Doe" }, "email": { "type": "string", "description": "The Email ID for Alfamart", - "example": "example@me.com", - "nullable": true + "example": "example@me.com" } } }, @@ -5164,8 +5076,7 @@ "AuthenticationConnectors": { "type": "string", "enum": [ - "threedsecureio", - "netcetera" + "threedsecureio" ] }, "AuthenticationStatus": { @@ -5264,9 +5175,6 @@ }, { "$ref": "#/components/schemas/SepaBankTransfer" - }, - { - "$ref": "#/components/schemas/PixBankTransfer" } ] }, @@ -6285,23 +6193,6 @@ "type": "object" } } - }, - { - "type": "object", - "required": [ - "local_bank_transfer" - ], - "properties": { - "local_bank_transfer": { - "type": "object", - "properties": { - "bank_code": { - "type": "string", - "nullable": true - } - } - } - } } ] }, @@ -6669,8 +6560,7 @@ ], "nullable": true } - }, - "additionalProperties": false + } }, "BusinessProfileResponse": { "type": "object", @@ -6966,8 +6856,7 @@ "description": "Card Type", "nullable": true } - }, - "additionalProperties": false + } }, "CardDetailFromLocker": { "type": "object", @@ -7036,38 +6925,6 @@ } } }, - "CardDetailUpdate": { - "type": "object", - "required": [ - "card_exp_month", - "card_exp_year", - "card_holder_name" - ], - "properties": { - "card_exp_month": { - "type": "string", - "description": "Card Expiry Month", - "example": "10" - }, - "card_exp_year": { - "type": "string", - "description": "Card Expiry Year", - "example": "25" - }, - "card_holder_name": { - "type": "string", - "description": "Card Holder Name", - "example": "John Doe" - }, - "nick_name": { - "type": "string", - "description": "Card Holder's Nick Name", - "example": "John Doe", - "nullable": true - } - }, - "additionalProperties": false - }, "CardNetwork": { "type": "string", "description": "Indicates the card network.", @@ -7210,7 +7067,6 @@ "authorizedotnet", "bambora", "bankofamerica", - "billwerk", "bitpay", "bluesnap", "boku", @@ -7221,7 +7077,6 @@ "cryptopay", "cybersource", "dlocal", - "ebanx", "fiserv", "forte", "globalpay", @@ -7232,7 +7087,6 @@ "klarna", "mollie", "multisafepay", - "netcetera", "nexinets", "nmi", "noon", @@ -7256,11 +7110,10 @@ "wise", "worldline", "worldpay", + "zen", "signifyd", "plaid", - "riskified", - "zen", - "zsl" + "riskified" ] }, "ConnectorMetadata": { @@ -7659,8 +7512,7 @@ "expiration": { "$ref": "#/components/schemas/ApiKeyExpiration" } - }, - "additionalProperties": false + } }, "CreateApiKeyResponse": { "type": "object", @@ -7899,8 +7751,7 @@ ], "nullable": true } - }, - "additionalProperties": false + } }, "CustomerDefaultPaymentMethodResponse": { "type": "object", @@ -7912,7 +7763,7 @@ "default_payment_method_id": { "type": "string", "description": "The unique identifier of the Payment method", - "example": "card_rGK4Vi5iSW70MY7J2mIg", + "example": "card_rGK4Vi5iSW70MY7J2mIy", "nullable": true }, "customer_id": { @@ -8711,97 +8562,6 @@ "mandate_revoked" ] }, - "ExtendedCardInfo": { - "type": "object", - "required": [ - "card_number", - "card_exp_month", - "card_exp_year", - "card_holder_name" - ], - "properties": { - "card_number": { - "type": "string", - "description": "The card number", - "example": "4242424242424242" - }, - "card_exp_month": { - "type": "string", - "description": "The card's expiry month", - "example": "24" - }, - "card_exp_year": { - "type": "string", - "description": "The card's expiry year", - "example": "24" - }, - "card_holder_name": { - "type": "string", - "description": "The card holder's name", - "example": "John Test" - }, - "card_issuer": { - "type": "string", - "description": "The name of the issuer of card", - "example": "chase", - "nullable": true - }, - "card_network": { - "allOf": [ - { - "$ref": "#/components/schemas/CardNetwork" - } - ], - "nullable": true - }, - "card_type": { - "type": "string", - "example": "CREDIT", - "nullable": true - }, - "card_issuing_country": { - "type": "string", - "example": "INDIA", - "nullable": true - }, - "bank_code": { - "type": "string", - "example": "JP_AMEX", - "nullable": true - } - } - }, - "ExtendedCardInfoConfig": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "description": "Merchant public key" - }, - "ttl_in_secs": { - "type": "integer", - "format": "int32", - "description": "TTL for extended card info", - "default": 900, - "maximum": 3600, - "minimum": 0 - } - } - }, - "ExtendedCardInfoResponse": { - "type": "object", - "required": [ - "payload" - ], - "properties": { - "payload": { - "type": "string" - } - } - }, "ExternalAuthenticationDetailsResponse": { "type": "object", "required": [ @@ -9080,8 +8840,7 @@ }, "description": "payment methods that can be used in the payment" } - }, - "additionalProperties": false + } }, "FrmMessage": { "type": "object", @@ -9137,8 +8896,7 @@ }, "description": "payment method types(credit, debit) that can be used in the payment" } - }, - "additionalProperties": false + } }, "FrmPaymentMethodType": { "type": "object", @@ -9162,8 +8920,7 @@ "action": { "$ref": "#/components/schemas/FrmAction" } - }, - "additionalProperties": false + } }, "FrmPreferredFlowTypes": { "type": "string", @@ -9846,24 +9603,26 @@ }, "IndomaretVoucherData": { "type": "object", + "required": [ + "first_name", + "last_name", + "email" + ], "properties": { "first_name": { "type": "string", "description": "The billing first name for Alfamart", - "example": "Jane", - "nullable": true + "example": "Jane" }, "last_name": { "type": "string", "description": "The billing second name for Alfamart", - "example": "Doe", - "nullable": true + "example": "Doe" }, "email": { "type": "string", "description": "The Email ID for Alfamart", - "example": "example@me.com", - "nullable": true + "example": "example@me.com" } } }, @@ -9885,30 +9644,32 @@ }, "JCSVoucherData": { "type": "object", + "required": [ + "first_name", + "last_name", + "email", + "phone_number" + ], "properties": { "first_name": { "type": "string", "description": "The billing first name for Japanese convenience stores", - "example": "Jane", - "nullable": true + "example": "Jane" }, "last_name": { "type": "string", "description": "The billing second name Japanese convenience stores", - "example": "Doe", - "nullable": true + "example": "Doe" }, "email": { "type": "string", "description": "The Email ID for Japanese convenience stores", - "example": "example@me.com", - "nullable": true + "example": "example@me.com" }, "phone_number": { "type": "string", "description": "The telephone number for Japanese convenience stores", - "example": "9999999999", - "nullable": true + "example": "9999999999" } } }, @@ -10100,8 +9861,7 @@ ], "nullable": true } - }, - "additionalProperties": false + } }, "MandateResponse": { "type": "object", @@ -10359,8 +10119,7 @@ "description": "The id of the organization to which the merchant belongs to", "nullable": true } - }, - "additionalProperties": false + } }, "MerchantAccountDeleteResponse": { "type": "object", @@ -10645,8 +10404,7 @@ "nullable": true, "maxLength": 64 } - }, - "additionalProperties": false + } }, "MerchantConnectorCreate": { "type": "object", @@ -10797,8 +10555,7 @@ ], "nullable": true } - }, - "additionalProperties": false + } }, "MerchantConnectorDeleteResponse": { "type": "object", @@ -11031,8 +10788,7 @@ "status": { "$ref": "#/components/schemas/ConnectorStatus" } - }, - "additionalProperties": false + } }, "MerchantConnectorUpdate": { "type": "object", @@ -11145,8 +10901,7 @@ "status": { "$ref": "#/components/schemas/ConnectorStatus" } - }, - "additionalProperties": false + } }, "MerchantConnectorWebhookDetails": { "type": "object", @@ -11163,8 +10918,7 @@ "type": "string", "example": "12345678900987654321" } - }, - "additionalProperties": false + } }, "MerchantDetails": { "type": "object", @@ -11233,8 +10987,7 @@ ], "nullable": true } - }, - "additionalProperties": false + } }, "MerchantRoutingAlgorithm": { "type": "object", @@ -11616,8 +11369,7 @@ "type": "string", "description": "The user-agent of the customer's browser" } - }, - "additionalProperties": false + } }, "OrderDetails": { "type": "object", @@ -11890,11 +11642,15 @@ "OutgoingWebhookResponseContent": { "type": "object", "description": "The response information (headers, body and status code) received for the webhook sent.", + "required": [ + "body", + "headers", + "status_code" + ], "properties": { "body": { "type": "string", - "description": "The response body received for the webhook sent.", - "nullable": true + "description": "The response body received for the webhook sent." }, "headers": { "type": "array", @@ -11921,22 +11677,14 @@ "content-length", "1024" ] - ], - "nullable": true + ] }, "status_code": { "type": "integer", "format": "int32", "description": "The HTTP status code for the webhook sent.", "example": 200, - "nullable": true, "minimum": 0 - }, - "error_message": { - "type": "string", - "description": "Error message in case any error occurred when trying to deliver the webhook.", - "example": 200, - "nullable": true } } }, @@ -12299,9 +12047,7 @@ "theme", "logo", "seller_name", - "sdk_layout", - "display_sdk_only", - "enabled_saved_payment_method" + "sdk_layout" ], "properties": { "theme": { @@ -12319,14 +12065,6 @@ "sdk_layout": { "type": "string", "description": "Custom layout for sdk" - }, - "display_sdk_only": { - "type": "boolean", - "description": "Display only the sdk for payment link" - }, - "enabled_saved_payment_method": { - "type": "boolean", - "description": "Enable saved payment method option for payment link" } } }, @@ -12360,20 +12098,6 @@ "example": "accordion", "nullable": true, "maxLength": 255 - }, - "display_sdk_only": { - "type": "boolean", - "description": "Display only the sdk for payment link", - "default": false, - "example": true, - "nullable": true - }, - "enabled_saved_payment_method": { - "type": "boolean", - "description": "Enable saved payment method option for payment link", - "default": false, - "example": true, - "nullable": true } } }, @@ -12478,8 +12202,7 @@ "example": "2022-09-10T10:11:12Z", "nullable": true } - }, - "additionalProperties": false + } }, "PaymentListResponse": { "type": "object", @@ -12590,37 +12313,8 @@ } ], "nullable": true - }, - "client_secret": { - "type": "string", - "description": "For Client based calls, SDK will use the client_secret\nin order to call /payment_methods\nClient secret will be generated whenever a new\npayment method is created", - "nullable": true - }, - "payment_method_data": { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentMethodCreateData" - } - ], - "nullable": true - } - }, - "additionalProperties": false - }, - "PaymentMethodCreateData": { - "oneOf": [ - { - "type": "object", - "required": [ - "card" - ], - "properties": { - "card": { - "$ref": "#/components/schemas/CardDetail" - } - } } - ] + } }, "PaymentMethodData": { "oneOf": [ @@ -12787,12 +12481,7 @@ "PaymentMethodDataRequest": { "allOf": [ { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentMethodData" - } - ], - "nullable": true + "$ref": "#/components/schemas/PaymentMethodData" }, { "type": "object", @@ -12819,7 +12508,7 @@ "payment_method_id": { "type": "string", "description": "The unique identifier of the Payment method", - "example": "card_rGK4Vi5iSW70MY7J2mIg" + "example": "card_rGK4Vi5iSW70MY7J2mIy" }, "deleted": { "type": "boolean", @@ -12945,7 +12634,7 @@ "payment_method_id": { "type": "string", "description": "The unique identifier of the Payment method", - "example": "card_rGK4Vi5iSW70MY7J2mIg" + "example": "card_rGK4Vi5iSW70MY7J2mIy" }, "payment_method": { "$ref": "#/components/schemas/PaymentMethod" @@ -13012,11 +12701,6 @@ "format": "date-time", "example": "2024-02-24T11:04:09.922Z", "nullable": true - }, - "client_secret": { - "type": "string", - "description": "For Client based calls", - "nullable": true } } }, @@ -13025,8 +12709,7 @@ "enum": [ "active", "inactive", - "processing", - "awaiting_data" + "processing" ] }, "PaymentMethodType": { @@ -13108,7 +12791,6 @@ "twint", "upi_collect", "vipps", - "venmo", "walley", "we_chat_pay", "seven_eleven", @@ -13116,8 +12798,7 @@ "mini_stop", "family_mart", "seicomart", - "pay_easy", - "local_bank_transfer" + "pay_easy" ] }, "PaymentMethodUpdate": { @@ -13126,7 +12807,7 @@ "card": { "allOf": [ { - "$ref": "#/components/schemas/CardDetailUpdate" + "$ref": "#/components/schemas/CardDetail" } ], "nullable": true @@ -13159,17 +12840,8 @@ "type": "object", "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", "nullable": true - }, - "client_secret": { - "type": "string", - "description": "This is a 15 minute expiry token which shall be used from the client to authenticate and perform sessions from the SDK", - "example": "secret_k2uj3he2893eiu2d", - "nullable": true, - "maxLength": 30, - "minLength": 30 } - }, - "additionalProperties": false + } }, "PaymentMethodsEnabled": { "type": "object", @@ -13192,8 +12864,7 @@ ], "nullable": true } - }, - "additionalProperties": false + } }, "PaymentRetrieveBody": { "type": "object", @@ -14574,8 +14245,7 @@ ], "nullable": true } - }, - "additionalProperties": false + } }, "PaymentsResponse": { "type": "object", @@ -14668,14 +14338,6 @@ "nullable": true, "maxLength": 255 }, - "customer": { - "allOf": [ - { - "$ref": "#/components/schemas/CustomerDetails" - } - ], - "nullable": true - }, "description": { "type": "string", "description": "A description of the payment", @@ -15067,14 +14729,6 @@ "description": "Payment Fingerprint", "nullable": true }, - "browser_info": { - "allOf": [ - { - "$ref": "#/components/schemas/BrowserInformation" - } - ], - "nullable": true - }, "payment_method_id": { "type": "string", "description": "Payment Method Id", @@ -15087,13 +14741,6 @@ } ], "nullable": true - }, - "updated": { - "type": "string", - "format": "date-time", - "description": "Date time at which payment was updated", - "example": "2022-09-10T10:11:12Z", - "nullable": true } } }, @@ -15692,6 +15339,11 @@ "description": "If the payout was cancelled the reason provided here", "nullable": true }, + "payout_token": { + "type": "string", + "description": "Provide a reference to a stored payout method", + "nullable": true + }, "unified_code": { "type": "string", "description": "error code unified across the connectors is received here if there was an error while calling connector", @@ -15708,10 +15360,7 @@ "type": "string", "enum": [ "adyen", - "stripe", - "wise", - "paypal", - "ebanx" + "wise" ] }, "PayoutCreateRequest": { @@ -15884,8 +15533,7 @@ "description": "The business profile to use for this payment, if not passed the default business profile\nassociated with the merchant account will be used.", "nullable": true } - }, - "additionalProperties": false + } }, "PayoutCreateResponse": { "type": "object", @@ -16054,8 +15702,7 @@ "description": "List of attempts", "nullable": true } - }, - "additionalProperties": false + } }, "PayoutEntityType": { "type": "string", @@ -16314,10 +15961,6 @@ "force_sync": { "type": "boolean", "nullable": true - }, - "merchant_id": { - "type": "string", - "nullable": true } } }, @@ -16340,11 +15983,6 @@ "default": false, "example": true, "nullable": true - }, - "merchant_id": { - "type": "string", - "description": "The identifier for the Merchant Account.", - "nullable": true } } }, @@ -16358,8 +15996,7 @@ "ineligible", "requires_creation", "requires_payout_method_data", - "requires_fulfillment", - "requires_vendor_account_creation" + "requires_fulfillment" ] }, "PayoutType": { @@ -16373,25 +16010,13 @@ "Paypal": { "type": "object", "required": [ - "email", - "telephone_number", - "paypal_id" + "email" ], "properties": { "email": { "type": "string", "description": "Email linked with paypal account", "example": "john.doe@example.com" - }, - "telephone_number": { - "type": "string", - "description": "mobile number linked to paypal account", - "example": "16608213349" - }, - "paypal_id": { - "type": "string", - "description": "id of the paypal account", - "example": "G83KXTJ5EHCQ2" } } }, @@ -16436,91 +16061,6 @@ } } }, - "PixBankTransfer": { - "type": "object", - "required": [ - "bank_account_number", - "pix_key" - ], - "properties": { - "bank_name": { - "type": "string", - "description": "Bank name", - "example": "Deutsche Bank", - "nullable": true - }, - "bank_branch": { - "type": "string", - "description": "Bank branch", - "example": "3707", - "nullable": true - }, - "bank_account_number": { - "type": "string", - "description": "Bank account number is an unique identifier assigned by a bank to a customer.", - "example": "000123456" - }, - "pix_key": { - "type": "string", - "description": "Unique key for pix customer", - "example": "000123456" - }, - "tax_id": { - "type": "string", - "description": "Individual taxpayer identification number", - "example": "000123456", - "nullable": true - } - } - }, - "PollConfigResponse": { - "type": "object", - "required": [ - "poll_id", - "delay_in_secs", - "frequency" - ], - "properties": { - "poll_id": { - "type": "string", - "description": "Poll Id" - }, - "delay_in_secs": { - "type": "integer", - "format": "int32", - "description": "Interval of the poll" - }, - "frequency": { - "type": "integer", - "format": "int32", - "description": "Frequency of the poll" - } - } - }, - "PollResponse": { - "type": "object", - "required": [ - "poll_id", - "status" - ], - "properties": { - "poll_id": { - "type": "string", - "description": "The poll id" - }, - "status": { - "$ref": "#/components/schemas/PollStatus" - } - } - }, - "PollStatus": { - "type": "string", - "enum": [ - "pending", - "completed", - "not_found" - ] - }, "PrimaryBusinessDetails": { "type": "object", "required": [ @@ -16535,8 +16075,7 @@ "type": "string", "example": "food" } - }, - "additionalProperties": false + } }, "ProductType": { "type": "string", @@ -16781,7 +16320,7 @@ "properties": { "payment_id": { "type": "string", - "description": "The payment id against which refund is to be initiated", + "description": "The payment id against which refund is to be intiated", "example": "pay_mbabizu24mvu3mela5njyhpit4", "maxLength": 30, "minLength": 30 @@ -16838,8 +16377,7 @@ ], "nullable": true } - }, - "additionalProperties": false + } }, "RefundResponse": { "type": "object", @@ -16858,7 +16396,7 @@ }, "payment_id": { "type": "string", - "description": "The payment id against which refund is initiated" + "description": "The payment id against which refund is intiated" }, "amount": { "type": "integer", @@ -16954,8 +16492,7 @@ "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", "nullable": true } - }, - "additionalProperties": false + } }, "RequestPaymentMethodTypes": { "type": "object", @@ -17268,7 +16805,6 @@ "airwallex", "authorizedotnet", "bankofamerica", - "billwerk", "bitpay", "bambora", "bluesnap", @@ -17280,7 +16816,6 @@ "cryptopay", "cybersource", "dlocal", - "ebanx", "fiserv", "forte", "globalpay", @@ -17315,8 +16850,7 @@ "wise", "worldline", "worldpay", - "zen", - "zsl" + "zen" ] }, "RoutingAlgorithm": { @@ -17853,14 +17387,6 @@ }, "initiative_context": { "type": "string" - }, - "merchant_business_country": { - "allOf": [ - { - "$ref": "#/components/schemas/CountryAlpha2" - } - ], - "nullable": true } } }, @@ -18061,8 +17587,7 @@ "required": [ "three_ds_authentication_url", "three_ds_authorize_url", - "three_ds_method_details", - "poll_config" + "three_ds_method_details" ], "properties": { "three_ds_authentication_url": { @@ -18075,9 +17600,6 @@ }, "three_ds_method_details": { "$ref": "#/components/schemas/ThreeDsMethodData" - }, - "poll_config": { - "$ref": "#/components/schemas/PollConfigResponse" } } }, @@ -18228,8 +17750,7 @@ ], "nullable": true } - }, - "additionalProperties": false + } }, "UpiData": { "type": "object", @@ -18392,19 +17913,6 @@ "propertyName": "type" } }, - "Venmo": { - "type": "object", - "required": [ - "telephone_number" - ], - "properties": { - "telephone_number": { - "type": "string", - "description": "mobile number linked to venmo account", - "example": "16608213349" - } - } - }, "VoucherData": { "oneOf": [ { @@ -18550,17 +18058,6 @@ "$ref": "#/components/schemas/Paypal" } } - }, - { - "type": "object", - "required": [ - "venmo" - ], - "properties": { - "venmo": { - "$ref": "#/components/schemas/Venmo" - } - } } ] }, @@ -18922,8 +18419,7 @@ "example": true, "nullable": true } - }, - "additionalProperties": false + } } }, "securitySchemes": { diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/.meta.json index 6e38554431e..773ed0638cb 100644 --- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/.meta.json @@ -6,7 +6,7 @@ "Scenario4-Create payment with Manual capture", "Scenario5-Void the payment", "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false", + "Scenario7-Create 3DS payment with confrm false", "Scenario9-Refund full payment", "Scenario10-Create a mandate and recurring payment", "Scenario11-Partial refund", @@ -21,4 +21,4 @@ "Scenario20-Pass Invalid CVV for save card flow and verify failed payment", "Scenario21-Don't Pass CVV for save card flow and verify failed payment Copy" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/request.json index dc5f34024bb..a515beb2661 100644 --- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/request.json +++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario14-Refund recurring payment/Payments - Create/request.json @@ -77,21 +77,7 @@ "state": "California", "zip": "94122", "country": "US", - "first_name": "Joseph", - "last_name":"Doe" - } - }, - "billing": { - "address": { - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "city": "San Fransico", - "state": "California", - "zip": "94122", - "country": "US", - "first_name": "Joseph", - "last_name":"Doe" + "first_name": "PiX" } }, "statement_descriptor_name": "joseph", diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js index 6ae8a3fc0fd..fa72b8541ff 100644 --- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js +++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js @@ -83,12 +83,12 @@ if (jsonData?.amount) { ); } -// Response body should have value "0" for "amount_received" +// Response body should have value "6000" for "amount_received" if (jsonData?.amount_received) { pm.test( - "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '0'", + "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'", function () { - pm.expect(jsonData.amount_received).to.eql(0); + pm.expect(jsonData.amount_received).to.eql(6000); }, ); } diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/.meta.json index 5c8008c1882..944c90c84cc 100644 --- a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/.meta.json @@ -6,8 +6,8 @@ "Scenario4-Create payment with Manual capture", "Scenario5-Void the payment", "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false", + "Scenario7-Create 3DS payment with confrm false", "Scenario9-Refund full payment", "Scenario10-Partial refund" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.prerequest.js b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.prerequest.js similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.prerequest.js rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.prerequest.js diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/airwallex/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/.meta.json index 317d5a30c98..0a95a9d8fc5 100644 --- a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/.meta.json @@ -1,6 +1,6 @@ { "childrenOrder": [ "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false" + "Scenario7-Create 3DS payment with confrm false" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/bambora_3ds/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/.meta.json index 5c8008c1882..944c90c84cc 100644 --- a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/.meta.json @@ -6,8 +6,8 @@ "Scenario4-Create payment with Manual capture", "Scenario5-Void the payment", "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false", + "Scenario7-Create 3DS payment with confrm false", "Scenario9-Refund full payment", "Scenario10-Partial refund" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json index c5e687f68c9..9339372cc71 100644 --- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json @@ -22,8 +22,9 @@ "Scenario15-Incremental auth with partial capture", "Scenario16-Verify PML for mandate", "Scenario17-Revoke mandates", - "Scenario18-Create 3ds payment", - "Scenario19-Create 3ds mandate", - "Scenario20-Create a mandate without customer acceptance" + "Scenario18-Update mandate card details", + "Scenario19-Create 3ds payment", + "Scenario20-Create 3ds mandate", + "Scenario21-Create a mandate without customer acceptance" ] } diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/.meta.json new file mode 100644 index 00000000000..20ac234bf99 --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/.meta.json @@ -0,0 +1,11 @@ +{ + "childrenOrder": [ + "Payments - Create", + "Payments - Retrieve", + "List - Mandates", + "Mandate - Update", + "List - Mandates-copy", + "Recurring Payments - Create", + "Payments - Retrieve-copy" + ] +} diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/.event.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/event.test.js new file mode 100644 index 00000000000..0d07a384aed --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/event.test.js @@ -0,0 +1,46 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + + +// Response body should have value "active" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'active'", + function () { + pm.expect(jsonData.status).to.eql("active"); + }, + ); +} + +pm.test("[POST]::/payments - Verify last 4 digits of the card", function () { + var jsonData = pm.response.json(); + pm.expect(jsonData.card.last4_digits).to.eql("1111"); +}); + +pm.test("[POST]::/payments - Verify card expiration month", function () { + var jsonData = pm.response.json(); + pm.expect(jsonData.card.card_exp_month).to.eql("12"); +}); + +pm.test("[POST]::/payments - Verify card expiration year", function () { + var jsonData = pm.response.json(); + pm.expect(jsonData.card.card_exp_year).to.eql("30"); +}); + + + diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/request.json new file mode 100644 index 00000000000..349b5117443 --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/request.json @@ -0,0 +1,27 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/mandates/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "mandates", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{mandate_id}}", + "description": "(Required) Unique mandate id" + } + ] + }, + "description": "To list the details of a mandate" +} diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/response.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/.event.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/event.test.js new file mode 100644 index 00000000000..3a7c6c4468b --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/event.test.js @@ -0,0 +1,46 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + + +// Response body should have value "active" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'active'", + function () { + pm.expect(jsonData.status).to.eql("active"); + }, + ); +} + +pm.test("[POST]::/payments - Verify last 4 digits of the card", function () { + var jsonData = pm.response.json(); + pm.expect(jsonData.card.last4_digits).to.eql("4242"); +}); + +pm.test("[POST]::/payments - Verify card expiration month", function () { + var jsonData = pm.response.json(); + pm.expect(jsonData.card.card_exp_month).to.eql("10"); +}); + +pm.test("[POST]::/payments - Verify card expiration year", function () { + var jsonData = pm.response.json(); + pm.expect(jsonData.card.card_exp_year).to.eql("25"); +}); + + + diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/request.json new file mode 100644 index 00000000000..349b5117443 --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/request.json @@ -0,0 +1,27 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/mandates/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "mandates", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{mandate_id}}", + "description": "(Required) Unique mandate id" + } + ] + }, + "description": "To list the details of a mandate" +} diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/response.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/.event.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/event.test.js new file mode 100644 index 00000000000..13d57327d21 --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/event.test.js @@ -0,0 +1,80 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/request.json similarity index 60% rename from postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/request.json index 6609ff9bb9c..b8a76d3412a 100644 --- a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/request.json @@ -18,60 +18,74 @@ } }, "raw_json_formatted": { - "amount": 6540, - "amount_to_capture": 6540, - "authentication_type": "three_ds", - "billing": { - "address": { - "city": "San Fransico", - "country": "CN", - "first_name": "PiX", - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "state": "California", - "zip": "94122" - } - }, + "amount": 0, + "currency": "USD", + "confirm": true, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", - "confirm": true, - "currency": "CNY", - "customer_id": "StripeCustomer", - "description": "Its my first payment request", + "customer_id": "{{customer_id}}", "email": "guest@example.com", - "metadata": { - "login_date": "2019-09-10T10:11:12Z", - "new_customer": "true", - "udf1": "value1" - }, "name": "John Doe", - "payment_method": "bank_transfer", - "payment_method_type": "local_bank_transfer", + "phone": "999999999", + "phone_country_code": "+65", + "description": "Its my first payment request", + "authentication_type": "no_three_ds", + "return_url": "https://duck.com", + "payment_method": "card", + "payment_method_type": "debit", "payment_method_data": { - "bank_transfer": { - "local_bank_transfer": {} + "card": { + "card_number": "4111111111111111", + "card_exp_month": "12", + "card_exp_year": "30", + "card_holder_name": "joseph Doe", + "card_cvc": "123" + } + }, + "payment_type": "setup_mandate", + "setup_future_usage": "off_session", + "mandate_data": { + "update_mandate_id": "{{mandate_id}}", + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } } }, - "phone": "999999999", - "phone_country_code": "+1", - "return_url": "https://duck.com", "shipping": { "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", "city": "San Fransico", + "state": "California", + "zip": "94122", "country": "US", - "first_name": "PiX", + "first_name": "likhin", + "last_name": "bopanna" + } + }, + "billing": { + "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", + "city": "San Fransico", "state": "California", - "zip": "94122" + "zip": "94122", + "country": "US", + "first_name": "likhin", + "last_name": "bopanna" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", - "browser_info": { - "language": "en-EN" + "metadata": { + "count_tickets": 1, + "transaction_number": "5590045" } } }, diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/response.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/event.test.js new file mode 100644 index 00000000000..29cba989186 --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/event.test.js @@ -0,0 +1,109 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); + +if (jsonData?.customer_id) { + pm.collectionVariables.set("customer_id", jsonData.customer_id); + console.log( + "- use {{customer_id}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.", + ); +} diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/request.json new file mode 100644 index 00000000000..4a698997169 --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/request.json @@ -0,0 +1,106 @@ +{ + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw_json_formatted": { + "amount": 0, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "capture_on": "2022-09-10T10:11:12Z", + "customer_id": "customer_{{$randomAbbreviation}}", + "email": "guest@example.com", + "name": "John Doe", + "phone": "999999999", + "phone_country_code": "+65", + "description": "Its my first payment request", + "authentication_type": "no_three_ds", + "return_url": "https://duck.com", + "payment_method": "card", + "payment_method_data": { + "card": { + "card_number": "4242424242424242", + "card_exp_month": "10", + "card_exp_year": "25", + "card_holder_name": "joseph Doe", + "card_cvc": "123" + } + }, + "payment_type": "setup_mandate", + "setup_future_usage": "off_session", + "mandate_data": { + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "127.0.0.1", + "user_agent": "amet irure esse" + } + }, + "mandate_type": { + "single_use": { + "amount": 7000, + "currency": "USD" + } + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "likhin", + "last_name": "bopanna" + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "likhin", + "last_name": "bopanna" + } + }, + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "metadata": { + "count_tickets": 1, + "transaction_number": "5590045" + } + } + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" +} diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/.event.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/event.test.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/event.test.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/request.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/request.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/response.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/event.test.js new file mode 100644 index 00000000000..4d0a9b9ca2c --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/event.test.js @@ -0,0 +1,87 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// Response body should have value "Succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/request.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/event.test.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/request.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/request.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/response.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/event.test.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/event.test.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Create/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/request.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/response.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Create 3ds payment/Payments - Retrieve/event.test.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/request.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/.meta.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/event.test.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/event.test.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Create/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/request.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/response.json diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds mandate/Payments - Retrieve/event.test.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/request.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.test.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/request.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/response.json diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/event.test.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/event.test.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/request.json diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/response.json diff --git a/postman/collection-dir/zsl/Health check/New Request/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json similarity index 100% rename from postman/collection-dir/zsl/Health check/New Request/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js new file mode 100644 index 00000000000..fe8fa706b96 --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js @@ -0,0 +1,75 @@ +// Validate status 2xx +pm.test("[GET]::/payments/:id - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[GET]::/payments/:id - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[GET]::/payments/:id - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "Succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json new file mode 100644 index 00000000000..b9ebc1be4aa --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json diff --git a/postman/collection-dir/zsl/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json similarity index 63% rename from postman/collection-dir/zsl/.event.meta.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json index 2df9d47d936..688c85746ef 100644 --- a/postman/collection-dir/zsl/.event.meta.json +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json @@ -1,6 +1,5 @@ { "eventOrder": [ - "event.prerequest.js", "event.test.js" ] } diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json new file mode 100644 index 00000000000..b9ebc1be4aa --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json @@ -0,0 +1,33 @@ +{ + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" +} diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/response.json diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json new file mode 100644 index 00000000000..688c85746ef --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js new file mode 100644 index 00000000000..e2ddde7136f --- /dev/null +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js @@ -0,0 +1,95 @@ +// Validate status 2xx +pm.test("[POST]::/payments - Status code is 2xx", function () { + pm.response.to.be.success; +}); + +// Validate if response header has matching content-type +pm.test("[POST]::/payments - Content-Type is application/json", function () { + pm.expect(pm.response.headers.get("Content-Type")).to.include( + "application/json", + ); +}); + +// Validate if response has JSON Body +pm.test("[POST]::/payments - Response has JSON Body", function () { + pm.response.to.have.jsonBody(); +}); + +// Set response object as internal variable +let jsonData = {}; +try { + jsonData = pm.response.json(); +} catch (e) {} + +// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id +if (jsonData?.payment_id) { + pm.collectionVariables.set("payment_id", jsonData.payment_id); + console.log( + "- use {{payment_id}} as collection variable for value", + jsonData.payment_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", + ); +} + +// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id +if (jsonData?.mandate_id) { + pm.collectionVariables.set("mandate_id", jsonData.mandate_id); + console.log( + "- use {{mandate_id}} as collection variable for value", + jsonData.mandate_id, + ); +} else { + console.log( + "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.", + ); +} + +// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret +if (jsonData?.client_secret) { + pm.collectionVariables.set("client_secret", jsonData.client_secret); + console.log( + "- use {{client_secret}} as collection variable for value", + jsonData.client_secret, + ); +} else { + console.log( + "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.", + ); +} + +// Response body should have value "succeeded" for "status" +if (jsonData?.status) { + pm.test( + "[POST]::/payments - Content check if value for 'status' matches 'succeeded'", + function () { + pm.expect(jsonData.status).to.eql("succeeded"); + }, + ); +} + +// Response body should have "mandate_id" +pm.test( + "[POST]::/payments - Content check if 'mandate_id' exists", + function () { + pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true; + }, +); + +// Response body should have "mandate_data" +pm.test( + "[POST]::/payments - Content check if 'mandate_data' exists", + function () { + pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true; + }, +); + +// Response body should have "payment_method_data" +pm.test( + "[POST]::/payments - Content check if 'payment_method_data' exists", + function () { + pm.expect(typeof jsonData.payment_method_data !== "undefined").to.be.true; + }, +); diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/request.json similarity index 69% rename from postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/request.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/request.json index 6609ff9bb9c..0ae243421f6 100644 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/request.json +++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/request.json @@ -19,60 +19,49 @@ }, "raw_json_formatted": { "amount": 6540, - "amount_to_capture": 6540, - "authentication_type": "three_ds", - "billing": { - "address": { - "city": "San Fransico", - "country": "CN", - "first_name": "PiX", - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "state": "California", - "zip": "94122" - } - }, + "currency": "USD", + "confirm": true, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", - "confirm": true, - "currency": "CNY", - "customer_id": "StripeCustomer", - "description": "Its my first payment request", + "amount_to_capture": 6540, + "customer_id": "{{customer_id}}", "email": "guest@example.com", - "metadata": { - "login_date": "2019-09-10T10:11:12Z", - "new_customer": "true", - "udf1": "value1" - }, "name": "John Doe", - "payment_method": "bank_transfer", - "payment_method_type": "local_bank_transfer", - "payment_method_data": { - "bank_transfer": { - "local_bank_transfer": {} - } - }, "phone": "999999999", - "phone_country_code": "+1", + "phone_country_code": "+65", + "description": "Its my first payment request", + "authentication_type": "no_three_ds", "return_url": "https://duck.com", + "mandate_id": "{{mandate_id}}", + "off_session": true, "shipping": { "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", "city": "San Fransico", + "state": "California", + "zip": "94122", "country": "US", - "first_name": "PiX", + "first_name": "likhin", + "last_name": "bopanna" + } + }, + "billing": { + "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", + "city": "San Fransico", "state": "California", - "zip": "94122" + "zip": "94122", + "country": "US", + "first_name": "likhin", + "last_name": "bopanna" } }, "statement_descriptor_name": "joseph", - "statement_descriptor_suffix": "JS", - "browser_info": { - "language": "en-EN" - } + "statement_descriptor_suffix": "JS" } }, "url": { diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/response.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/response.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/.meta.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/.meta.json index d8253c73fe0..82f7a33dc5c 100644 --- a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/.meta.json +++ b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/.meta.json @@ -6,7 +6,7 @@ "Scenario4-Create payment with Manual capture", "Scenario5-Void the payment", "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false", + "Scenario7-Create 3DS payment with confrm false", "Scenario9-Refund full payment", "Scenario10-Partial refund", "Scenario11-Create a mandate and recurring payment", @@ -21,4 +21,4 @@ "Scenario19-Bank Transfer-ach", "Scenario19-Bank Transfer-ach Copy 2" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/.meta.json index 48b665ffbac..53747092aa6 100644 --- a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/.meta.json @@ -4,11 +4,11 @@ "Scenario2-Create payment with confirm false", "Scenario3-Create payment without PMD", "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false", + "Scenario7-Create 3DS payment with confrm false", "Scenario15-Bank Redirect-Ideal", "Scenario15- Wallets Paypal", "Scenario16-Bank Redirect-sofort", "Scenario17-Bank Redirect-eps", "Scenario18-Bank Redirect-giropay" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Confirm/response.json b/postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/mollie/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/.meta.json index a9c93cb346e..9d030385b7f 100644 --- a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/.meta.json @@ -2,6 +2,6 @@ "childrenOrder": [ "Scenario1-Create payment without PMD", "Scenario2-Create 3DS payment", - "Scenario3-Create 3DS payment with confirm false" + "Scenario3-Create 3DS payment with confrm false" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Create/response.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Create/response.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/multisafepay/Flow Testcases/Happy Cases/Scenario3-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/.meta.json index 93c072ae52d..6be6a600776 100644 --- a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/.meta.json @@ -6,11 +6,11 @@ "Scenario4-Create payment with Manual capture", "Scenario5-Void the payment", "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false", + "Scenario7-Create 3DS payment with confrm false", "Scenario9-Refund full payment", "Scenario10-Partial refund", "Scenario15-Bank Redirect-Ideal", "Scenario16-Bank Redirect-sofort", "Scenario18-Wallet paypal" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/nexinets/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/.meta.json index ef2524b40ff..30c6364c0e4 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/.meta.json @@ -8,6 +8,6 @@ "Scenario11-Create Partial Capture payment", "Scenario5-Void the payment", "Scenario6-Create Wallet - Paypal", - "Scenario7-Create Wallet - Paypal with confirm false" + "Scenario7-Create Wallet - Paypal with confrm false" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario11-Create Partial Capture payment/Payments - Capture/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario11-Create Partial Capture payment/Payments - Capture/event.test.js index 1fbef271836..d08e91cd6e8 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario11-Create Partial Capture payment/Payments - Capture/event.test.js +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario11-Create Partial Capture payment/Payments - Capture/event.test.js @@ -101,9 +101,9 @@ if (jsonData?.amount_received) { // Response body should have value "6540" for "amount_capturable" if (jsonData?.amount_capturable) { pm.test( - "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 6540", + "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'", function () { - pm.expect(jsonData.amount_capturable).to.eql(6540); + pm.expect(jsonData.amount_capturable).to.eql(540); }, ); } diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario11-Create Partial Capture payment/Payments - Retrieve/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario11-Create Partial Capture payment/Payments - Retrieve/event.test.js index 06abc1d37a5..8e84e4b3846 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario11-Create Partial Capture payment/Payments - Retrieve/event.test.js +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario11-Create Partial Capture payment/Payments - Retrieve/event.test.js @@ -98,9 +98,9 @@ if (jsonData?.amount_received) { // Response body should have value "6540" for "amount_capturable" if (jsonData?.amount_capturable) { pm.test( - "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6540'", + "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'", function () { - pm.expect(jsonData.amount_capturable).to.eql(6540); + pm.expect(jsonData.amount_capturable).to.eql(540); }, ); } diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Capture/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Capture/event.test.js index 6b58fbb86f0..d08e91cd6e8 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Capture/event.test.js +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Capture/event.test.js @@ -101,9 +101,9 @@ if (jsonData?.amount_received) { // Response body should have value "6540" for "amount_capturable" if (jsonData?.amount_capturable) { pm.test( - "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6540'", + "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'", function () { - pm.expect(jsonData.amount_capturable).to.eql(6540); + pm.expect(jsonData.amount_capturable).to.eql(540); }, ); } diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Retrieve/event.test.js index 06abc1d37a5..8e84e4b3846 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Retrieve/event.test.js +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Retrieve/event.test.js @@ -98,9 +98,9 @@ if (jsonData?.amount_received) { // Response body should have value "6540" for "amount_capturable" if (jsonData?.amount_capturable) { pm.test( - "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6540'", + "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'", function () { - pm.expect(jsonData.amount_capturable).to.eql(6540); + pm.expect(jsonData.amount_capturable).to.eql(540); }, ); } diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js index 572f74e6d57..d2574b4816b 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js @@ -101,19 +101,9 @@ if (jsonData?.amount_received) { // Response body should have value "6540" for "amount_capturable" if (jsonData?.amount_capturable) { pm.test( - "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 6540", + "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'", function () { - pm.expect(jsonData.amount_capturable).to.eql(6540); - }, - ); -} - -// Response body should have value "0" for "amount_received" -if (jsonData?.amount_received) { - pm.test( - "[post]:://payments/:id/capture - Content check if value for 'amount_received' matches 0", - function () { - pm.expect(jsonData.amount_received).to.eql(0); + pm.expect(jsonData.amount_capturable).to.eql(0); }, ); } diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js index 021d1f1475c..c5396fe43da 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Retrieve/event.test.js @@ -98,9 +98,9 @@ if (jsonData?.amount_received) { // Response body should have value "6540" for "amount_capturable" if (jsonData?.amount_capturable) { pm.test( - "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6540'", + "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'", function () { - pm.expect(jsonData.amount_capturable).to.eql(6540); + pm.expect(jsonData.amount_capturable).to.eql(0); }, ); } diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/.meta.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/.meta.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Confirm/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Create/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Create/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Create/request.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario7-Create Wallet - Paypal with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/event.test.js index b09744cff12..432edf05d37 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/event.test.js +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/event.test.js @@ -101,9 +101,9 @@ if (jsonData?.amount_received) { // Response body should have value "6540" for "amount_capturable" if (jsonData?.amount_capturable) { pm.test( - "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 6550", + "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 0", function () { - pm.expect(jsonData.amount_capturable).to.eql(6550); + pm.expect(jsonData.amount_capturable).to.eql(0); }, ); } diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/event.test.js index 69fd5563460..5097d1cf94a 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/event.test.js +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/event.test.js @@ -98,9 +98,9 @@ if (jsonData?.amount_received) { // Response body should have value "6540" for "amount_capturable" if (jsonData?.amount_capturable) { pm.test( - "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6550'", + "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'", function () { - pm.expect(jsonData.amount_capturable).to.eql(6550); + pm.expect(jsonData.amount_capturable).to.eql(540); }, ); } diff --git a/postman/collection-dir/paypal/event.prerequest.js b/postman/collection-dir/paypal/event.prerequest.js index 944aebeb6ee..f4c9a764864 100644 --- a/postman/collection-dir/paypal/event.prerequest.js +++ b/postman/collection-dir/paypal/event.prerequest.js @@ -3,28 +3,25 @@ const isPostRequest = pm.request.method.toString() === "POST"; const isPaymentCreation = path.match(/\/payments$/) && isPostRequest; if (isPaymentCreation) { - try { - const request = JSON.parse(pm.request.body.toJSON().raw); - const merchantConnectorId = pm.collectionVariables.get("merchant_connector_id"); + try { + const request = JSON.parse(pm.request.body.toJSON().raw); - // Attach routing - const routing = { - type: "single", data: { connector: "paypal", merchant_connector_id: merchantConnectorId } - }; - request["routing"] = routing; + // Attach routing + const routing = { type: "single", data: "paypal" }; + request["routing"] = routing; - let updatedRequest = { - mode: "raw", - raw: JSON.stringify(request), - options: { - raw: { - language: "json", - }, - }, - }; - pm.request.body.update(updatedRequest); - } catch (error) { - console.error("Failed to inject routing in the request"); - console.error(error); - } -} + let updatedRequest = { + mode: "raw", + raw: JSON.stringify(request), + options: { + raw: { + language: "json", + }, + }, + }; + pm.request.body.update(updatedRequest); + } catch (error) { + console.error("Failed to inject routing in the request"); + console.error(error); + } +} \ No newline at end of file diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/.meta.json index 94f863e0a83..43cff6e349e 100644 --- a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/.meta.json @@ -6,8 +6,8 @@ "Scenario3-Create payment without PMD", "Scenario4-Create payment with Manual capture", "Scenario5-Void the payment", - "Scenario6-Create 3DS payment with confirm false", + "Scenario6-Create 3DS payment with confrm false", "Scenario9-Refund full payment", "Scenario10-Partial refund" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/.meta.json index c713a8fb042..99baecd05c7 100644 --- a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/.meta.json @@ -5,6 +5,6 @@ "Scenario3-Create payment without PMD", "Scenario5-Void the payment", "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false" + "Scenario7-Create 3DS payment with confrm false" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/rapyd/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/.meta.json index 166ded6ddce..a5e77b7275f 100644 --- a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/.meta.json @@ -5,7 +5,7 @@ "Scenario3-Create payment without PMD", "Scenario4-Create payment with Manual capture", "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false", + "Scenario7-Create 3DS payment with confrm false", "Scenario9-Refund full payment", "Scenario10-Partial refund", "Scenario15-Bank Redirect-Ideal", @@ -13,4 +13,4 @@ "Scenario17-Bank Redirect-eps", "Scenario18-Bank Redirect-giropay" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/response.json b/postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/response.json rename to postman/collection-dir/shift4/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json index edb8e67436a..3a414a0e13c 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json @@ -9,7 +9,7 @@ "Scenario4a-Create payment with manual_multiple capture", "Scenario5-Void the payment", "Scenario6-Create 3DS payment", - "Scenario7-Create 3DS payment with confirm false", + "Scenario7-Create 3DS payment with confrm false", "Scenario8-Create a failure card payment with confirm true", "Scenario9-Refund full payment", "Scenario9a-Partial refund", @@ -37,4 +37,4 @@ "Scenario31-Pass payment method billing in Confirm", "Scenario32-Ensure API Contract for Payment Method Data" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js index cd38d5ab9d5..ffcdd527d07 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js @@ -19,7 +19,7 @@ pm.test("[POST]::/payments - Response has JSON Body", function () { let jsonData = {}; try { jsonData = pm.response.json(); -} catch (e) { } +} catch (e) {} // pm.collectionVariables - Set payment_id as variable for jsonData.payment_id if (jsonData?.payment_id) { @@ -78,12 +78,3 @@ pm.test( .true; }, ); - -// Response body should have "browser_info" -pm.test( - "[POST]::/payments - Content check if 'browser_info' exists", - function () { - pm.expect(typeof jsonData.browser_info !== "undefined").to.be - .true; - }, -); diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json index 950ec531ae7..9d0fac32c1f 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json @@ -54,18 +54,6 @@ "card_cvc": "123" } }, - "browser_info": { - "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", - "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "language": "nl-NL", - "color_depth": 24, - "screen_height": 723, - "screen_width": 1536, - "time_zone": 0, - "java_enabled": true, - "java_script_enabled": true, - "ip_address": "127.0.0.1" - }, "billing": { "address": { "line1": "1467", diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.prerequest.js similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.prerequest.js rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.prerequest.js diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/response.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/response.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/response.json rename to postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/.meta.json index 9ef23e53ba6..949d82095ec 100644 --- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/.meta.json @@ -6,9 +6,9 @@ "Scenario3-Create payment with confirm false card holder name empty", "Scenario4-Create payment without PMD", "Scenario5-Create 3DS payment", - "Scenario6-Create 3DS payment with confirm false", + "Scenario6-Create 3DS payment with confrm false", "Scenario7-Refund full payment", "Scenario8-Bank Redirect-Ideal", "Scenario9-Bank Redirect-giropay" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/event.prerequest.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.prerequest.js similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/event.prerequest.js rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.prerequest.js diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/response.json rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json new file mode 100644 index 00000000000..688c85746ef --- /dev/null +++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/response.json rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json new file mode 100644 index 00000000000..688c85746ef --- /dev/null +++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json @@ -0,0 +1,5 @@ +{ + "eventOrder": [ + "event.test.js" + ] +} diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/response.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/response.json similarity index 100% rename from postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/response.json rename to postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/response.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/.meta.json index bce12673620..4ecb9c1124f 100644 --- a/postman/collection-dir/zen/Flow Testcases/Happy Cases/.meta.json +++ b/postman/collection-dir/zen/Flow Testcases/Happy Cases/.meta.json @@ -4,6 +4,6 @@ "Scenario2-Create payment with confirm false", "Scenario3-Create payment without PMD", "Scenario4-Create 3DS payment", - "Scenario5-Create 3DS payment with confirm false" + "Scenario5-Create 3DS payment with confrm false" ] -} \ No newline at end of file +} diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/.meta.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/.meta.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/.meta.json rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/.meta.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/.event.meta.json rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/.event.meta.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/event.test.js b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.test.js similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/event.test.js rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/event.test.js diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/request.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Confirm/request.json rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/response.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/response.json similarity index 100% rename from postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/response.json rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/response.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/.event.meta.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/.event.meta.json rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/.event.meta.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/event.test.js b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/event.test.js similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/event.test.js rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/event.test.js diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/request.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Create/request.json rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/request.json diff --git a/postman/collection-dir/zsl/Health check/New Request/response.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/response.json similarity index 100% rename from postman/collection-dir/zsl/Health check/New Request/response.json rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Create/response.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/.event.meta.json rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/.event.meta.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/event.test.js rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/event.test.js diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/request.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json similarity index 100% rename from postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confirm false/Payments - Retrieve/request.json rename to postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/request.json diff --git a/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/response.json b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/response.json new file mode 100644 index 00000000000..fe51488c706 --- /dev/null +++ b/postman/collection-dir/zen/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Retrieve/response.json @@ -0,0 +1 @@ +[] diff --git a/postman/collection-dir/zsl/.auth.json b/postman/collection-dir/zsl/.auth.json deleted file mode 100644 index 915a2835790..00000000000 --- a/postman/collection-dir/zsl/.auth.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{api_key}}", - "type": "string" - }, - { - "key": "key", - "value": "api-key", - "type": "string" - }, - { - "key": "in", - "value": "header", - "type": "string" - } - ] - } -} diff --git a/postman/collection-dir/zsl/.info.json b/postman/collection-dir/zsl/.info.json deleted file mode 100644 index 4104ea8926c..00000000000 --- a/postman/collection-dir/zsl/.info.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "info": { - "_postman_id": "3a6c03f2-c084-4e35-a559-4dc0f2808fe9", - "name": "zsl", - "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [support@juspay.in](mailto:support@juspay.in)", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "27028646" - } -} diff --git a/postman/collection-dir/zsl/.meta.json b/postman/collection-dir/zsl/.meta.json deleted file mode 100644 index 91b6a65c5bc..00000000000 --- a/postman/collection-dir/zsl/.meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "childrenOrder": [ - "Health check", - "Flow Testcases" - ] -} diff --git a/postman/collection-dir/zsl/.variable.json b/postman/collection-dir/zsl/.variable.json deleted file mode 100644 index 7341fd0b82e..00000000000 --- a/postman/collection-dir/zsl/.variable.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "variable": [ - { - "key": "baseUrl", - "value": "", - "type": "string" - }, - { - "key": "admin_api_key", - "value": "", - "type": "string" - }, - { - "key": "api_key", - "value": "", - "type": "string" - }, - { - "key": "merchant_id", - "value": "" - }, - { - "key": "payment_id", - "value": "" - }, - { - "key": "customer_id", - "value": "" - }, - { - "key": "mandate_id", - "value": "" - }, - { - "key": "payment_method_id", - "value": "" - }, - { - "key": "refund_id", - "value": "" - }, - { - "key": "merchant_connector_id", - "value": "" - }, - { - "key": "client_secret", - "value": "", - "type": "string" - }, - { - "key": "connector_api_key", - "value": "", - "type": "string" - }, - { - "key": "publishable_key", - "value": "", - "type": "string" - }, - { - "key": "api_key_id", - "value": "", - "type": "string" - }, - { - "key": "payment_token", - "value": "" - }, - { - "key": "gateway_merchant_id", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "certificate", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "certificate_keys", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "connector_key1", - "value": "", - "type": "string" - } - ] -} diff --git a/postman/collection-dir/zsl/Flow Testcases/.meta.json b/postman/collection-dir/zsl/Flow Testcases/.meta.json deleted file mode 100644 index bd972090b19..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/.meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "childrenOrder": [ - "QuickStart", - "Happy Cases" - ] -} diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json deleted file mode 100644 index baaff734b05..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/.meta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "childrenOrder": [ - "Scenario1-Create payment with confirm true" - ] -} diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json deleted file mode 100644 index abc159198ae..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/.meta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "childrenOrder": [ - "Payments - Create" - ] -} diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json deleted file mode 100644 index 4ac527d834a..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/.event.meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "eventOrder": [ - "event.test.js", - "event.prerequest.js" - ] -} diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.prerequest.js b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.prerequest.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js deleted file mode 100644 index 30cad8de4e9..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js +++ /dev/null @@ -1,58 +0,0 @@ -// Validate status 2xx -pm.test("[POST]::/payments - Status code is 2xx", function () { - pm.response.to.be.success; -}); - -// Validate if response header has matching content-type -pm.test("[POST]::/payments - Content-Type is application/json", function () { - pm.expect(pm.response.headers.get("Content-Type")).to.include( - "application/json", - ); -}); - -// Validate if response has JSON Body -pm.test("[POST]::/payments - Response has JSON Body", function () { - pm.response.to.have.jsonBody(); -}); - -// Set response object as internal variable -let jsonData = {}; -try { - jsonData = pm.response.json(); -} catch (e) {} - - -// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id -if (jsonData?.payment_id) { - pm.collectionVariables.set("payment_id", jsonData.payment_id); - console.log( - "- use {{payment_id}} as collection variable for value", - jsonData.payment_id, - ); -} else { - console.log( - "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", - ); -} - -// Response body should have redirect_to_url as next action type -if (jsonData?.next_action.type) { - pm.test( - "[POST]::/payments:id/confirm - Next Action Check", - function () { - pm.expect(jsonData.next_action.type).to.eql("redirect_to_url"); - }, - ); -} - -// Response body should have status = requires_customer_action -if (jsonData?.status) { - pm.test( - "[POST]::/payments:id/confirm - Next Action Check", - function () { - pm.expect(jsonData.status).to.eql("requires_customer_action"); - }, - ); -} - - diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json deleted file mode 100644 index 7d3e10f6db8..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/.meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "childrenOrder": [ - "Merchant Account - Create", - "API Key - Create", - "Payment Connector - Create", - "Payments - Create" - ] -} diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js deleted file mode 100644 index 4e27c5a5025..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/event.test.js +++ /dev/null @@ -1,46 +0,0 @@ -// Validate status 2xx -pm.test("[POST]::/api_keys/:merchant_id - Status code is 2xx", function () { - pm.response.to.be.success; -}); - -// Validate if response header has matching content-type -pm.test( - "[POST]::/api_keys/:merchant_id - Content-Type is application/json", - function () { - pm.expect(pm.response.headers.get("Content-Type")).to.include( - "application/json", - ); - }, -); - -// Set response object as internal variable -let jsonData = {}; -try { - jsonData = pm.response.json(); -} catch (e) {} - -// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id -if (jsonData?.key_id) { - pm.collectionVariables.set("api_key_id", jsonData.key_id); - console.log( - "- use {{api_key_id}} as collection variable for value", - jsonData.key_id, - ); -} else { - console.log( - "INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.", - ); -} - -// pm.collectionVariables - Set api_key as variable for jsonData.api_key -if (jsonData?.api_key) { - pm.collectionVariables.set("api_key", jsonData.api_key); - console.log( - "- use {{api_key}} as collection variable for value", - jsonData.api_key, - ); -} else { - console.log( - "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.", - ); -} diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json deleted file mode 100644 index 4e4c6628497..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/API Key - Create/request.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{admin_api_key}}", - "type": "string" - }, - { - "key": "key", - "value": "api-key", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw_json_formatted": { - "name": "API Key 1", - "description": null, - "expiration": "2069-09-23T01:02:03.000Z" - } - }, - "url": { - "raw": "{{baseUrl}}/api_keys/:merchant_id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api_keys", - ":merchant_id" - ], - "variable": [ - { - "key": "merchant_id", - "value": "{{merchant_id}}" - } - ] - } -} diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json deleted file mode 100644 index 4ac527d834a..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/.event.meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "eventOrder": [ - "event.test.js", - "event.prerequest.js" - ] -} diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.prerequest.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.prerequest.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js deleted file mode 100644 index d3d62bd40e0..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/event.test.js +++ /dev/null @@ -1,55 +0,0 @@ -// Validate status 2xx -pm.test("[POST]::/accounts - Status code is 2xx", function () { - pm.response.to.be.success; -}); - -// Validate if response header has matching content-type -pm.test("[POST]::/accounts - Content-Type is application/json", function () { - pm.expect(pm.response.headers.get("Content-Type")).to.include( - "application/json", - ); -}); - -// Set response object as internal variable -let jsonData = {}; -try { - jsonData = pm.response.json(); -} catch (e) {} -// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id -if (jsonData?.merchant_id) { - pm.collectionVariables.set("merchant_id", jsonData.merchant_id); - console.log( - "- use {{merchant_id}} as collection variable for value", - jsonData.merchant_id, - ); -} else { - console.log( - "INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.", - ); -} - -// pm.collectionVariables - Set api_key as variable for jsonData.api_key -if (jsonData?.api_key) { - pm.collectionVariables.set("api_key", jsonData.api_key); - console.log( - "- use {{api_key}} as collection variable for value", - jsonData.api_key, - ); -} else { - console.log( - "INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.", - ); -} - -// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key -if (jsonData?.publishable_key) { - pm.collectionVariables.set("publishable_key", jsonData.publishable_key); - console.log( - "- use {{publishable_key}} as collection variable for value", - jsonData.publishable_key, - ); -} else { - console.log( - "INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.", - ); -} diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json deleted file mode 100644 index ffeea3410a4..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Merchant Account - Create/request.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{admin_api_key}}", - "type": "string" - }, - { - "key": "key", - "value": "api-key", - "type": "string" - }, - { - "key": "in", - "value": "header", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - }, - "raw_json_formatted": { - "merchant_id": "postman_merchant_GHAction_{{$guid}}", - "locker_id": "m0010", - "merchant_name": "NewAge Retailer", - "primary_business_details": [ - { - "country": "US", - "business": "default" - } - ], - "merchant_details": { - "primary_contact_person": "John Test", - "primary_email": "JohnTest@test.com", - "primary_phone": "sunt laborum", - "secondary_contact_person": "John Test2", - "secondary_email": "JohnTest2@test.com", - "secondary_phone": "cillum do dolor id", - "website": "www.example.com", - "about_business": "Online Retail with a wide selection of organic products for North America", - "address": { - "line1": "1467", - "line2": "Harrison Street", - "line3": "Harrison Street", - "city": "San Fransico", - "state": "California", - "zip": "94122", - "country": "US" - } - }, - "return_url": "https://duck.com", - "webhook_details": { - "webhook_version": "1.0.1", - "webhook_username": "ekart_retail", - "webhook_password": "password_ekart@123", - "payment_created_enabled": true, - "payment_succeeded_enabled": true, - "payment_failed_enabled": true - }, - "sub_merchants_enabled": false, - "metadata": { - "city": "NY", - "unit": "245" - } - } - }, - "url": { - "raw": "{{baseUrl}}/accounts", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "accounts" - ] - }, - "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments." -} diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js deleted file mode 100644 index 88e92d8d84a..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/event.test.js +++ /dev/null @@ -1,39 +0,0 @@ -// Validate status 2xx -pm.test( - "[POST]::/account/:account_id/connectors - Status code is 2xx", - function () { - pm.response.to.be.success; - }, -); - -// Validate if response header has matching content-type -pm.test( - "[POST]::/account/:account_id/connectors - Content-Type is application/json", - function () { - pm.expect(pm.response.headers.get("Content-Type")).to.include( - "application/json", - ); - }, -); - -// Set response object as internal variable -let jsonData = {}; -try { - jsonData = pm.response.json(); -} catch (e) {} - -// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id -if (jsonData?.merchant_connector_id) { - pm.collectionVariables.set( - "merchant_connector_id", - jsonData.merchant_connector_id, - ); - console.log( - "- use {{merchant_connector_id}} as collection variable for value", - jsonData.merchant_connector_id, - ); -} else { - console.log( - "INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.", - ); -} diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json deleted file mode 100644 index bda34190e77..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payment Connector - Create/request.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{admin_api_key}}", - "type": "string" - }, - { - "key": "key", - "value": "api-key", - "type": "string" - }, - { - "key": "in", - "value": "header", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - }, - "raw_json_formatted": { - "connector_type": "fiz_operations", - "connector_name": "zsl", - "connector_account_details": { - "auth_type": "BodyKey", - "api_key": "{{connector_api_key}}", - "key1": "{{connector_key1}}" - }, - "test_mode": false, - "disabled": false, - "business_country": "US", - "business_label": "default", - "payment_methods_enabled": [ - { - "payment_method": "bank_transfer", - "payment_method_types": [ - { - "payment_method_type": "local_bank_transfer", - "payment_experience": "redirect_to_url", - "card_networks": null, - "accepted_currencies": null, - "accepted_countries": null, - "minimum_amount": -1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - } - ] - } - ], - "metadata": { - "city": "NY", - "unit": "245" - } - } - }, - "url": { - "raw": "{{baseUrl}}/account/:account_id/connectors", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "account", - ":account_id", - "connectors" - ], - "variable": [ - { - "key": "account_id", - "value": "{{merchant_id}}", - "description": "(Required) The unique identifier for the merchant account" - } - ] - }, - "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." -} diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json deleted file mode 100644 index 4ac527d834a..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/.event.meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "eventOrder": [ - "event.test.js", - "event.prerequest.js" - ] -} diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.prerequest.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js b/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js deleted file mode 100644 index 30cad8de4e9..00000000000 --- a/postman/collection-dir/zsl/Flow Testcases/QuickStart/Payments - Create/event.test.js +++ /dev/null @@ -1,58 +0,0 @@ -// Validate status 2xx -pm.test("[POST]::/payments - Status code is 2xx", function () { - pm.response.to.be.success; -}); - -// Validate if response header has matching content-type -pm.test("[POST]::/payments - Content-Type is application/json", function () { - pm.expect(pm.response.headers.get("Content-Type")).to.include( - "application/json", - ); -}); - -// Validate if response has JSON Body -pm.test("[POST]::/payments - Response has JSON Body", function () { - pm.response.to.have.jsonBody(); -}); - -// Set response object as internal variable -let jsonData = {}; -try { - jsonData = pm.response.json(); -} catch (e) {} - - -// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id -if (jsonData?.payment_id) { - pm.collectionVariables.set("payment_id", jsonData.payment_id); - console.log( - "- use {{payment_id}} as collection variable for value", - jsonData.payment_id, - ); -} else { - console.log( - "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.", - ); -} - -// Response body should have redirect_to_url as next action type -if (jsonData?.next_action.type) { - pm.test( - "[POST]::/payments:id/confirm - Next Action Check", - function () { - pm.expect(jsonData.next_action.type).to.eql("redirect_to_url"); - }, - ); -} - -// Response body should have status = requires_customer_action -if (jsonData?.status) { - pm.test( - "[POST]::/payments:id/confirm - Next Action Check", - function () { - pm.expect(jsonData.status).to.eql("requires_customer_action"); - }, - ); -} - - diff --git a/postman/collection-dir/zsl/Health check/.meta.json b/postman/collection-dir/zsl/Health check/.meta.json deleted file mode 100644 index 66ee7e50cab..00000000000 --- a/postman/collection-dir/zsl/Health check/.meta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "childrenOrder": [ - "New Request" - ] -} diff --git a/postman/collection-dir/zsl/Health check/New Request/event.test.js b/postman/collection-dir/zsl/Health check/New Request/event.test.js deleted file mode 100644 index b490b8be090..00000000000 --- a/postman/collection-dir/zsl/Health check/New Request/event.test.js +++ /dev/null @@ -1,4 +0,0 @@ -// Validate status 2xx -pm.test("[POST]::/accounts - Status code is 2xx", function () { - pm.response.to.be.success; -}); diff --git a/postman/collection-dir/zsl/Health check/New Request/request.json b/postman/collection-dir/zsl/Health check/New Request/request.json deleted file mode 100644 index 4e1e0a0d9e6..00000000000 --- a/postman/collection-dir/zsl/Health check/New Request/request.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/health", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "health" - ] - } -} diff --git a/postman/collection-dir/zsl/event.prerequest.js b/postman/collection-dir/zsl/event.prerequest.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/postman/collection-dir/zsl/event.test.js b/postman/collection-dir/zsl/event.test.js deleted file mode 100644 index fb52caec30f..00000000000 --- a/postman/collection-dir/zsl/event.test.js +++ /dev/null @@ -1,13 +0,0 @@ -// Set response object as internal variable -let jsonData = {}; -try { - jsonData = pm.response.json(); -} catch (e) {} - -// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id -if (jsonData?.payment_id) { - pm.collectionVariables.set("payment_id", jsonData.payment_id); - console.log("[LOG]::payment_id - " + jsonData.payment_id); -} - -console.log("[LOG]::x-request-id - " + pm.response.headers.get("x-request-id")); diff --git a/postman/collection-json/adyen_uk.postman_collection.json b/postman/collection-json/adyen_uk.postman_collection.json index dc34efad9e3..a5447103184 100644 --- a/postman/collection-json/adyen_uk.postman_collection.json +++ b/postman/collection-json/adyen_uk.postman_collection.json @@ -2688,12 +2688,12 @@ " );", "}", "", - "// Response body should have value \"0\" for \"amount_received\"", + "// Response body should have value \"6000\" for \"amount_received\"", "if (jsonData?.amount_received) {", " pm.test(", - " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '0'\",", + " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",", " function () {", - " pm.expect(jsonData.amount_received).to.eql(0);", + " pm.expect(jsonData.amount_received).to.eql(6000);", " },", " );", "}", @@ -3472,7 +3472,7 @@ ] }, { - "name": "Scenario7-Create 3DS payment with confirm false", + "name": "Scenario7-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", @@ -6582,7 +6582,7 @@ "language": "json" } }, - "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"guest@example.com\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Joseph\",\"last_name\":\"Doe\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Joseph\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" + "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"guest@example.com\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" }, "url": { "raw": "{{baseUrl}}/payments", diff --git a/postman/collection-json/airwallex.postman_collection.json b/postman/collection-json/airwallex.postman_collection.json index 3e6b467f9bd..f2e804f2b3e 100644 --- a/postman/collection-json/airwallex.postman_collection.json +++ b/postman/collection-json/airwallex.postman_collection.json @@ -2844,7 +2844,7 @@ ] }, { - "name": "Scenario7-Create 3DS payment with confirm false", + "name": "Scenario7-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/bambora_3ds.postman_collection.json b/postman/collection-json/bambora_3ds.postman_collection.json index f8f34a9ece4..0d908b26bf8 100644 --- a/postman/collection-json/bambora_3ds.postman_collection.json +++ b/postman/collection-json/bambora_3ds.postman_collection.json @@ -698,7 +698,7 @@ ] }, { - "name": "Scenario7-Create 3DS payment with confirm false", + "name": "Scenario7-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/bluesnap.postman_collection.json b/postman/collection-json/bluesnap.postman_collection.json index d1188336c11..137ccbe1a23 100644 --- a/postman/collection-json/bluesnap.postman_collection.json +++ b/postman/collection-json/bluesnap.postman_collection.json @@ -8346,7 +8346,7 @@ ] }, { - "name": "Scenario7-Create 3DS payment with confirm false", + "name": "Scenario7-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/cybersource.postman_collection.json b/postman/collection-json/cybersource.postman_collection.json index 128789666aa..630020dab93 100644 --- a/postman/collection-json/cybersource.postman_collection.json +++ b/postman/collection-json/cybersource.postman_collection.json @@ -11927,7 +11927,871 @@ ] }, { - "name": "Scenario18-Create 3ds payment", + "name": "Scenario18-Update mandate card details", + "item": [ + { + "name": "Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "", + "if (jsonData?.customer_id) {", + " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);", + " console.log(", + " \"- use {{customer_id}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.\",", + " );", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":0,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"customer_{{$randomAbbreviation}}\",\"email\":\"guest@example.com\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"payment_type\":\"setup_mandate\",\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"likhin\",\"last_name\":\"bopanna\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"likhin\",\"last_name\":\"bopanna\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"count_tickets\":1,\"transaction_number\":\"5590045\"}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Retrieve", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + }, + { + "name": "List - Mandates", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "", + "// Response body should have value \"active\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'active'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"active\");", + " },", + " );", + "}", + "", + "pm.test(\"[POST]::/payments - Verify last 4 digits of the card\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.card.last4_digits).to.eql(\"4242\");", + "});", + "", + "pm.test(\"[POST]::/payments - Verify card expiration month\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.card.card_exp_month).to.eql(\"10\");", + "});", + "", + "pm.test(\"[POST]::/payments - Verify card expiration year\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.card.card_exp_year).to.eql(\"25\");", + "});", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/mandates/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "mandates", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{mandate_id}}", + "description": "(Required) Unique mandate id" + } + ] + }, + "description": "To list the details of a mandate" + }, + "response": [] + }, + { + "name": "Mandate - Update", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":0,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"{{customer_id}}\",\"email\":\"guest@example.com\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"12\",\"card_exp_year\":\"30\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"payment_type\":\"setup_mandate\",\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"update_mandate_id\":\"{{mandate_id}}\",\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"likhin\",\"last_name\":\"bopanna\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"likhin\",\"last_name\":\"bopanna\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"count_tickets\":1,\"transaction_number\":\"5590045\"}}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "List - Mandates-copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "", + "// Response body should have value \"active\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'active'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"active\");", + " },", + " );", + "}", + "", + "pm.test(\"[POST]::/payments - Verify last 4 digits of the card\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.card.last4_digits).to.eql(\"1111\");", + "});", + "", + "pm.test(\"[POST]::/payments - Verify card expiration month\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.card.card_exp_month).to.eql(\"12\");", + "});", + "", + "pm.test(\"[POST]::/payments - Verify card expiration year\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.card.card_exp_year).to.eql(\"30\");", + "});", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/mandates/:id", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "mandates", + ":id" + ], + "variable": [ + { + "key": "id", + "value": "{{mandate_id}}", + "description": "(Required) Unique mandate id" + } + ] + }, + "description": "To list the details of a mandate" + }, + "response": [] + }, + { + "name": "Recurring Payments - Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", + "if (jsonData?.mandate_id) {", + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", + " console.log(", + " \"- use {{mandate_id}} as collection variable for value\",", + " jsonData.mandate_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", + " );", + "}", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"payment_method_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'payment_method_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.payment_method_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "options": { + "raw": { + "language": "json" + } + }, + "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"{{customer_id}}\",\"email\":\"guest@example.com\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"likhin\",\"last_name\":\"bopanna\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"likhin\",\"last_name\":\"bopanna\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\"}" + }, + "url": { + "raw": "{{baseUrl}}/payments", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments" + ] + }, + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" + }, + "response": [] + }, + { + "name": "Payments - Retrieve-copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Validate status 2xx", + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", + " pm.response.to.be.success;", + "});", + "", + "// Validate if response header has matching content-type", + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", + " \"application/json\",", + " );", + "});", + "", + "// Validate if response has JSON Body", + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", + " pm.response.to.have.jsonBody();", + "});", + "", + "// Set response object as internal variable", + "let jsonData = {};", + "try {", + " jsonData = pm.response.json();", + "} catch (e) {}", + "", + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", + "if (jsonData?.payment_id) {", + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", + " console.log(", + " \"- use {{payment_id}} as collection variable for value\",", + " jsonData.payment_id,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", + " );", + "}", + "", + "", + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", + "if (jsonData?.client_secret) {", + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", + " console.log(", + " \"- use {{client_secret}} as collection variable for value\",", + " jsonData.client_secret,", + " );", + "} else {", + " console.log(", + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", + " );", + "}", + "", + "// Response body should have value \"Succeeded\" for \"status\"", + "if (jsonData?.status) {", + " pm.test(", + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", + " function () {", + " pm.expect(jsonData.status).to.eql(\"succeeded\");", + " },", + " );", + "}", + "", + "// Response body should have \"mandate_id\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_id' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;", + " },", + ");", + "", + "// Response body should have \"mandate_data\"", + "pm.test(", + " \"[POST]::/payments - Content check if 'mandate_data' exists\",", + " function () {", + " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;", + " },", + ");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/payments/:id?force_sync=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "payments", + ":id" + ], + "query": [ + { + "key": "force_sync", + "value": "true" + } + ], + "variable": [ + { + "key": "id", + "value": "{{payment_id}}", + "description": "(Required) unique payment id" + } + ] + }, + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" + }, + "response": [] + } + ] + }, + { + "name": "Scenario19-Create 3ds payment", "item": [ { "name": "Payments - Create", @@ -12161,7 +13025,7 @@ ] }, { - "name": "Scenario19-Create 3ds mandate", + "name": "Scenario20-Create 3ds mandate", "item": [ { "name": "Payments - Create", @@ -12395,7 +13259,7 @@ ] }, { - "name": "Scenario20-Create a mandate without customer acceptance", + "name": "Scenario21-Create a mandate without customer acceptance", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/hyperswitch.postman_collection.json b/postman/collection-json/hyperswitch.postman_collection.json index 0390b917db5..4da2a81acbb 100644 --- a/postman/collection-json/hyperswitch.postman_collection.json +++ b/postman/collection-json/hyperswitch.postman_collection.json @@ -7209,7 +7209,7 @@ ] }, { - "name": "Scenario7-Create 3DS payment with confirm false", + "name": "Scenario7-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/mollie.postman_collection.json b/postman/collection-json/mollie.postman_collection.json index 687fd75542c..e2649a261fa 100644 --- a/postman/collection-json/mollie.postman_collection.json +++ b/postman/collection-json/mollie.postman_collection.json @@ -1330,7 +1330,7 @@ ] }, { - "name": "Scenario5-Create 3DS payment with confirm false", + "name": "Scenario5-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/multisafepay.postman_collection.json b/postman/collection-json/multisafepay.postman_collection.json index fe8efb5ad0f..56fc6723452 100644 --- a/postman/collection-json/multisafepay.postman_collection.json +++ b/postman/collection-json/multisafepay.postman_collection.json @@ -1463,7 +1463,7 @@ ] }, { - "name": "Scenario3-Create 3DS payment with confirm false", + "name": "Scenario3-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/nexinets.postman_collection.json b/postman/collection-json/nexinets.postman_collection.json index 5bbdf1a0df3..aa0c435f498 100644 --- a/postman/collection-json/nexinets.postman_collection.json +++ b/postman/collection-json/nexinets.postman_collection.json @@ -2832,7 +2832,7 @@ ] }, { - "name": "Scenario7-Create 3DS payment with confirm false", + "name": "Scenario7-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/paypal.postman_collection.json b/postman/collection-json/paypal.postman_collection.json index 58368b3b856..bcb508da4c0 100644 --- a/postman/collection-json/paypal.postman_collection.json +++ b/postman/collection-json/paypal.postman_collection.json @@ -9,32 +9,28 @@ "const isPaymentCreation = path.match(/\\/payments$/) && isPostRequest;", "", "if (isPaymentCreation) {", - " try {", - " const request = JSON.parse(pm.request.body.toJSON().raw);", - " const merchantConnectorId = pm.collectionVariables.get(\"merchant_connector_id\");", + " try {", + " const request = JSON.parse(pm.request.body.toJSON().raw);", "", - " // Attach routing", - " const routing = {", - " type: \"single\", data: { connector: \"paypal\", merchant_connector_id: merchantConnectorId }", - " };", - " request[\"routing\"] = routing;", + " // Attach routing", + " const routing = { type: \"single\", data: \"paypal\" };", + " request[\"routing\"] = routing;", "", - " let updatedRequest = {", - " mode: \"raw\",", - " raw: JSON.stringify(request),", - " options: {", - " raw: {", - " language: \"json\",", - " },", - " },", - " };", - " pm.request.body.update(updatedRequest);", - " } catch (error) {", - " console.error(\"Failed to inject routing in the request\");", - " console.error(error);", - " }", - "}", - "" + " let updatedRequest = {", + " mode: \"raw\",", + " raw: JSON.stringify(request),", + " options: {", + " raw: {", + " language: \"json\",", + " },", + " },", + " };", + " pm.request.body.update(updatedRequest);", + " } catch (error) {", + " console.error(\"Failed to inject routing in the request\");", + " console.error(error);", + " }", + "}" ], "type": "text/javascript" } @@ -1120,9 +1116,9 @@ "// Response body should have value \"6540\" for \"amount_capturable\"", "if (jsonData?.amount_capturable) {", " pm.test(", - " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 6550\",", + " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 0\",", " function () {", - " pm.expect(jsonData.amount_capturable).to.eql(6550);", + " pm.expect(jsonData.amount_capturable).to.eql(0);", " },", " );", "}", @@ -1289,9 +1285,9 @@ "// Response body should have value \"6540\" for \"amount_capturable\"", "if (jsonData?.amount_capturable) {", " pm.test(", - " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6550'\",", + " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",", " function () {", - " pm.expect(jsonData.amount_capturable).to.eql(6550);", + " pm.expect(jsonData.amount_capturable).to.eql(540);", " },", " );", "}", @@ -3027,9 +3023,9 @@ "// Response body should have value \"6540\" for \"amount_capturable\"", "if (jsonData?.amount_capturable) {", " pm.test(", - " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6540'\",", + " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",", " function () {", - " pm.expect(jsonData.amount_capturable).to.eql(6540);", + " pm.expect(jsonData.amount_capturable).to.eql(540);", " },", " );", "}", @@ -3189,9 +3185,9 @@ "// Response body should have value \"6540\" for \"amount_capturable\"", "if (jsonData?.amount_capturable) {", " pm.test(", - " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6540'\",", + " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",", " function () {", - " pm.expect(jsonData.amount_capturable).to.eql(6540);", + " pm.expect(jsonData.amount_capturable).to.eql(540);", " },", " );", "}", @@ -3504,19 +3500,9 @@ "// Response body should have value \"6540\" for \"amount_capturable\"", "if (jsonData?.amount_capturable) {", " pm.test(", - " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 6540\",", - " function () {", - " pm.expect(jsonData.amount_capturable).to.eql(6540);", - " },", - " );", - "}", - "", - "// Response body should have value \"0\" for \"amount_received\"", - "if (jsonData?.amount_received) {", - " pm.test(", - " \"[post]:://payments/:id/capture - Content check if value for 'amount_received' matches 0\",", + " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",", " function () {", - " pm.expect(jsonData.amount_received).to.eql(0);", + " pm.expect(jsonData.amount_capturable).to.eql(0);", " },", " );", "}", @@ -3676,9 +3662,9 @@ "// Response body should have value \"6540\" for \"amount_capturable\"", "if (jsonData?.amount_capturable) {", " pm.test(", - " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6540'\",", + " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",", " function () {", - " pm.expect(jsonData.amount_capturable).to.eql(6540);", + " pm.expect(jsonData.amount_capturable).to.eql(0);", " },", " );", "}", @@ -3991,9 +3977,9 @@ "// Response body should have value \"6540\" for \"amount_capturable\"", "if (jsonData?.amount_capturable) {", " pm.test(", - " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 6540\",", + " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",", " function () {", - " pm.expect(jsonData.amount_capturable).to.eql(6540);", + " pm.expect(jsonData.amount_capturable).to.eql(540);", " },", " );", "}", @@ -4153,9 +4139,9 @@ "// Response body should have value \"6540\" for \"amount_capturable\"", "if (jsonData?.amount_capturable) {", " pm.test(", - " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6540'\",", + " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",", " function () {", - " pm.expect(jsonData.amount_capturable).to.eql(6540);", + " pm.expect(jsonData.amount_capturable).to.eql(540);", " },", " );", "}", @@ -4901,7 +4887,7 @@ ] }, { - "name": "Scenario7-Create Wallet - Paypal with confirm false", + "name": "Scenario7-Create Wallet - Paypal with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/powertranz.postman_collection.json b/postman/collection-json/powertranz.postman_collection.json index ecd68d45de0..b158827bbb7 100644 --- a/postman/collection-json/powertranz.postman_collection.json +++ b/postman/collection-json/powertranz.postman_collection.json @@ -3061,7 +3061,7 @@ ] }, { - "name": "Scenario6-Create 3DS payment with confirm false", + "name": "Scenario6-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/rapyd.postman_collection.json b/postman/collection-json/rapyd.postman_collection.json index a5af6de62e8..39ea3aab24c 100644 --- a/postman/collection-json/rapyd.postman_collection.json +++ b/postman/collection-json/rapyd.postman_collection.json @@ -2285,7 +2285,7 @@ ] }, { - "name": "Scenario7-Create 3DS payment with confirm false", + "name": "Scenario7-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/shift4.postman_collection.json b/postman/collection-json/shift4.postman_collection.json index 7432bbf32ac..67a2305a4b2 100644 --- a/postman/collection-json/shift4.postman_collection.json +++ b/postman/collection-json/shift4.postman_collection.json @@ -2458,7 +2458,7 @@ ] }, { - "name": "Scenario7-Create 3DS payment with confirm false", + "name": "Scenario7-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.json index 2a18984e3f1..c7437e8b1f1 100644 --- a/postman/collection-json/stripe.postman_collection.json +++ b/postman/collection-json/stripe.postman_collection.json @@ -7085,7 +7085,7 @@ "let jsonData = {};", "try {", " jsonData = pm.response.json();", - "} catch (e) { }", + "} catch (e) {}", "", "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", "if (jsonData?.payment_id) {", @@ -7144,15 +7144,6 @@ " .true;", " },", ");", - "", - "// Response body should have \"browser_info\"", - "pm.test(", - " \"[POST]::/payments - Content check if 'browser_info' exists\",", - " function () {", - " pm.expect(typeof jsonData.browser_info !== \"undefined\").to.be", - " .true;", - " },", - ");", "" ], "type": "text/javascript" @@ -7178,7 +7169,7 @@ "language": "json" } }, - "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"guest@example.com\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"127.0.0.1\"},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}" + "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"guest@example.com\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}" }, "url": { "raw": "{{baseUrl}}/payments", @@ -9936,7 +9927,7 @@ ] }, { - "name": "Scenario7-Create 3DS payment with confirm false", + "name": "Scenario7-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/trustpay.postman_collection.json b/postman/collection-json/trustpay.postman_collection.json index a9051b994ca..1203cd1793e 100644 --- a/postman/collection-json/trustpay.postman_collection.json +++ b/postman/collection-json/trustpay.postman_collection.json @@ -2230,7 +2230,7 @@ ] }, { - "name": "Scenario5-Create 3DS payment with confirm false", + "name": "Scenario5-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/zen.postman_collection.json b/postman/collection-json/zen.postman_collection.json index 9830265508b..7ada350cccf 100644 --- a/postman/collection-json/zen.postman_collection.json +++ b/postman/collection-json/zen.postman_collection.json @@ -1938,7 +1938,7 @@ ] }, { - "name": "Scenario5-Create 3DS payment with confirm false", + "name": "Scenario5-Create 3DS payment with confrm false", "item": [ { "name": "Payments - Create", diff --git a/postman/collection-json/zsl.postman_collection.json b/postman/collection-json/zsl.postman_collection.json deleted file mode 100644 index ff69c558ec9..00000000000 --- a/postman/collection-json/zsl.postman_collection.json +++ /dev/null @@ -1,796 +0,0 @@ -{ - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "// Set response object as internal variable", - "let jsonData = {};", - "try {", - " jsonData = pm.response.json();", - "} catch (e) {}", - "", - "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", - "if (jsonData?.payment_id) {", - " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", - " console.log(\"[LOG]::payment_id - \" + jsonData.payment_id);", - "}", - "", - "console.log(\"[LOG]::x-request-id - \" + pm.response.headers.get(\"x-request-id\"));", - "" - ], - "type": "text/javascript" - } - } - ], - "item": [ - { - "name": "Health check", - "item": [ - { - "name": "New Request", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate status 2xx", - "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {", - " pm.response.to.be.success;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/health", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "health" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Flow Testcases", - "item": [ - { - "name": "QuickStart", - "item": [ - { - "name": "Merchant Account - Create", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate status 2xx", - "pm.test(\"[POST]::/accounts - Status code is 2xx\", function () {", - " pm.response.to.be.success;", - "});", - "", - "// Validate if response header has matching content-type", - "pm.test(\"[POST]::/accounts - Content-Type is application/json\", function () {", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", - " \"application/json\",", - " );", - "});", - "", - "// Set response object as internal variable", - "let jsonData = {};", - "try {", - " jsonData = pm.response.json();", - "} catch (e) {}", - "// pm.collectionVariables - Set merchant_id as variable for jsonData.merchant_id", - "if (jsonData?.merchant_id) {", - " pm.collectionVariables.set(\"merchant_id\", jsonData.merchant_id);", - " console.log(", - " \"- use {{merchant_id}} as collection variable for value\",", - " jsonData.merchant_id,", - " );", - "} else {", - " console.log(", - " \"INFO - Unable to assign variable {{merchant_id}}, as jsonData.merchant_id is undefined.\",", - " );", - "}", - "", - "// pm.collectionVariables - Set api_key as variable for jsonData.api_key", - "if (jsonData?.api_key) {", - " pm.collectionVariables.set(\"api_key\", jsonData.api_key);", - " console.log(", - " \"- use {{api_key}} as collection variable for value\",", - " jsonData.api_key,", - " );", - "} else {", - " console.log(", - " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",", - " );", - "}", - "", - "// pm.collectionVariables - Set publishable_key as variable for jsonData.publishable_key", - "if (jsonData?.publishable_key) {", - " pm.collectionVariables.set(\"publishable_key\", jsonData.publishable_key);", - " console.log(", - " \"- use {{publishable_key}} as collection variable for value\",", - " jsonData.publishable_key,", - " );", - "} else {", - " console.log(", - " \"INFO - Unable to assign variable {{publishable_key}}, as jsonData.publishable_key is undefined.\",", - " );", - "}", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{admin_api_key}}", - "type": "string" - }, - { - "key": "key", - "value": "api-key", - "type": "string" - }, - { - "key": "in", - "value": "header", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - }, - "raw": "{\"merchant_id\":\"postman_merchant_GHAction_{{$guid}}\",\"locker_id\":\"m0010\",\"merchant_name\":\"NewAge Retailer\",\"primary_business_details\":[{\"country\":\"US\",\"business\":\"default\"}],\"merchant_details\":{\"primary_contact_person\":\"John Test\",\"primary_email\":\"JohnTest@test.com\",\"primary_phone\":\"sunt laborum\",\"secondary_contact_person\":\"John Test2\",\"secondary_email\":\"JohnTest2@test.com\",\"secondary_phone\":\"cillum do dolor id\",\"website\":\"www.example.com\",\"about_business\":\"Online Retail with a wide selection of organic products for North America\",\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"return_url\":\"https://duck.com\",\"webhook_details\":{\"webhook_version\":\"1.0.1\",\"webhook_username\":\"ekart_retail\",\"webhook_password\":\"password_ekart@123\",\"payment_created_enabled\":true,\"payment_succeeded_enabled\":true,\"payment_failed_enabled\":true},\"sub_merchants_enabled\":false,\"metadata\":{\"city\":\"NY\",\"unit\":\"245\"}}" - }, - "url": { - "raw": "{{baseUrl}}/accounts", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "accounts" - ] - }, - "description": "Create a new account for a merchant. The merchant could be a seller or retailer or client who likes to receive and send payments." - }, - "response": [] - }, - { - "name": "API Key - Create", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate status 2xx", - "pm.test(\"[POST]::/api_keys/:merchant_id - Status code is 2xx\", function () {", - " pm.response.to.be.success;", - "});", - "", - "// Validate if response header has matching content-type", - "pm.test(", - " \"[POST]::/api_keys/:merchant_id - Content-Type is application/json\",", - " function () {", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", - " \"application/json\",", - " );", - " },", - ");", - "", - "// Set response object as internal variable", - "let jsonData = {};", - "try {", - " jsonData = pm.response.json();", - "} catch (e) {}", - "", - "// pm.collectionVariables - Set api_key_id as variable for jsonData.key_id", - "if (jsonData?.key_id) {", - " pm.collectionVariables.set(\"api_key_id\", jsonData.key_id);", - " console.log(", - " \"- use {{api_key_id}} as collection variable for value\",", - " jsonData.key_id,", - " );", - "} else {", - " console.log(", - " \"INFO - Unable to assign variable {{api_key_id}}, as jsonData.key_id is undefined.\",", - " );", - "}", - "", - "// pm.collectionVariables - Set api_key as variable for jsonData.api_key", - "if (jsonData?.api_key) {", - " pm.collectionVariables.set(\"api_key\", jsonData.api_key);", - " console.log(", - " \"- use {{api_key}} as collection variable for value\",", - " jsonData.api_key,", - " );", - "} else {", - " console.log(", - " \"INFO - Unable to assign variable {{api_key}}, as jsonData.api_key is undefined.\",", - " );", - "}", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{admin_api_key}}", - "type": "string" - }, - { - "key": "key", - "value": "api-key", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\"name\":\"API Key 1\",\"description\":null,\"expiration\":\"2069-09-23T01:02:03.000Z\"}" - }, - "url": { - "raw": "{{baseUrl}}/api_keys/:merchant_id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api_keys", - ":merchant_id" - ], - "variable": [ - { - "key": "merchant_id", - "value": "{{merchant_id}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Payment Connector - Create", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate status 2xx", - "pm.test(", - " \"[POST]::/account/:account_id/connectors - Status code is 2xx\",", - " function () {", - " pm.response.to.be.success;", - " },", - ");", - "", - "// Validate if response header has matching content-type", - "pm.test(", - " \"[POST]::/account/:account_id/connectors - Content-Type is application/json\",", - " function () {", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", - " \"application/json\",", - " );", - " },", - ");", - "", - "// Set response object as internal variable", - "let jsonData = {};", - "try {", - " jsonData = pm.response.json();", - "} catch (e) {}", - "", - "// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id", - "if (jsonData?.merchant_connector_id) {", - " pm.collectionVariables.set(", - " \"merchant_connector_id\",", - " jsonData.merchant_connector_id,", - " );", - " console.log(", - " \"- use {{merchant_connector_id}} as collection variable for value\",", - " jsonData.merchant_connector_id,", - " );", - "} else {", - " console.log(", - " \"INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.\",", - " );", - "}", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{admin_api_key}}", - "type": "string" - }, - { - "key": "key", - "value": "api-key", - "type": "string" - }, - { - "key": "in", - "value": "header", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - }, - "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"zsl\",\"connector_account_details\":{\"auth_type\":\"BodyKey\",\"api_key\":\"{{connector_api_key}}\",\"key1\":\"{{connector_key1}}\"},\"test_mode\":false,\"disabled\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"payment_methods_enabled\":[{\"payment_method\":\"bank_transfer\",\"payment_method_types\":[{\"payment_method_type\":\"local_bank_transfer\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":-1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}],\"metadata\":{\"city\":\"NY\",\"unit\":\"245\"}}" - }, - "url": { - "raw": "{{baseUrl}}/account/:account_id/connectors", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "account", - ":account_id", - "connectors" - ], - "variable": [ - { - "key": "account_id", - "value": "{{merchant_id}}", - "description": "(Required) The unique identifier for the merchant account" - } - ] - }, - "description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." - }, - "response": [] - }, - { - "name": "Payments - Create", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate status 2xx", - "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", - " pm.response.to.be.success;", - "});", - "", - "// Validate if response header has matching content-type", - "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", - " \"application/json\",", - " );", - "});", - "", - "// Validate if response has JSON Body", - "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", - " pm.response.to.have.jsonBody();", - "});", - "", - "// Set response object as internal variable", - "let jsonData = {};", - "try {", - " jsonData = pm.response.json();", - "} catch (e) {}", - "", - "", - "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", - "if (jsonData?.payment_id) {", - " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", - " console.log(", - " \"- use {{payment_id}} as collection variable for value\",", - " jsonData.payment_id,", - " );", - "} else {", - " console.log(", - " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", - " );", - "}", - "", - "// Response body should have redirect_to_url as next action type", - "if (jsonData?.next_action.type) {", - " pm.test(", - " \"[POST]::/payments:id/confirm - Next Action Check\",", - " function () {", - " pm.expect(jsonData.next_action.type).to.eql(\"redirect_to_url\");", - " },", - " );", - "}", - "", - "// Response body should have status = requires_customer_action", - "if (jsonData?.status) {", - " pm.test(", - " \"[POST]::/payments:id/confirm - Next Action Check\",", - " function () {", - " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");", - " },", - " );", - "}", - "", - "", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - }, - "raw": "{\"amount\":6540,\"amount_to_capture\":6540,\"authentication_type\":\"three_ds\",\"billing\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"CN\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"confirm\":true,\"currency\":\"CNY\",\"customer_id\":\"StripeCustomer\",\"description\":\"Its my first payment request\",\"email\":\"guest@example.com\",\"metadata\":{\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\",\"udf1\":\"value1\"},\"name\":\"John Doe\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"local_bank_transfer\",\"payment_method_data\":{\"bank_transfer\":{\"local_bank_transfer\":{}}},\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"return_url\":\"https://duck.com\",\"shipping\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"browser_info\":{\"language\":\"en-EN\"}}" - }, - "url": { - "raw": "{{baseUrl}}/payments", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "payments" - ] - }, - "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" - }, - "response": [] - } - ] - }, - { - "name": "Happy Cases", - "item": [ - { - "name": "Scenario1-Create payment with confirm true", - "item": [ - { - "name": "Payments - Create", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "// Validate status 2xx", - "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", - " pm.response.to.be.success;", - "});", - "", - "// Validate if response header has matching content-type", - "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", - " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", - " \"application/json\",", - " );", - "});", - "", - "// Validate if response has JSON Body", - "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", - " pm.response.to.have.jsonBody();", - "});", - "", - "// Set response object as internal variable", - "let jsonData = {};", - "try {", - " jsonData = pm.response.json();", - "} catch (e) {}", - "", - "", - "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", - "if (jsonData?.payment_id) {", - " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", - " console.log(", - " \"- use {{payment_id}} as collection variable for value\",", - " jsonData.payment_id,", - " );", - "} else {", - " console.log(", - " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", - " );", - "}", - "", - "// Response body should have redirect_to_url as next action type", - "if (jsonData?.next_action.type) {", - " pm.test(", - " \"[POST]::/payments:id/confirm - Next Action Check\",", - " function () {", - " pm.expect(jsonData.next_action.type).to.eql(\"redirect_to_url\");", - " },", - " );", - "}", - "", - "// Response body should have status = requires_customer_action", - "if (jsonData?.status) {", - " pm.test(", - " \"[POST]::/payments:id/confirm - Next Action Check\",", - " function () {", - " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");", - " },", - " );", - "}", - "", - "", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - }, - "raw": "{\"amount\":6540,\"amount_to_capture\":6540,\"authentication_type\":\"three_ds\",\"billing\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"CN\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"confirm\":true,\"currency\":\"CNY\",\"customer_id\":\"StripeCustomer\",\"description\":\"Its my first payment request\",\"email\":\"guest@example.com\",\"metadata\":{\"login_date\":\"2019-09-10T10:11:12Z\",\"new_customer\":\"true\",\"udf1\":\"value1\"},\"name\":\"John Doe\",\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"local_bank_transfer\",\"payment_method_data\":{\"bank_transfer\":{\"local_bank_transfer\":{}}},\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"return_url\":\"https://duck.com\",\"shipping\":{\"address\":{\"city\":\"San Fransico\",\"country\":\"US\",\"first_name\":\"PiX\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"state\":\"California\",\"zip\":\"94122\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"browser_info\":{\"language\":\"en-EN\"}}" - }, - "url": { - "raw": "{{baseUrl}}/payments", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "payments" - ] - }, - "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" - }, - "response": [] - } - ] - } - ] - } - ] - } - ], - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{api_key}}", - "type": "string" - }, - { - "key": "key", - "value": "api-key", - "type": "string" - }, - { - "key": "in", - "value": "header", - "type": "string" - } - ] - }, - "info": { - "_postman_id": "3a6c03f2-c084-4e35-a559-4dc0f2808fe9", - "name": "zsl", - "description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [support@juspay.in](mailto:support@juspay.in)", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "27028646" - }, - "variable": [ - { - "key": "baseUrl", - "value": "", - "type": "string" - }, - { - "key": "admin_api_key", - "value": "", - "type": "string" - }, - { - "key": "api_key", - "value": "", - "type": "string" - }, - { - "key": "merchant_id", - "value": "" - }, - { - "key": "payment_id", - "value": "" - }, - { - "key": "customer_id", - "value": "" - }, - { - "key": "mandate_id", - "value": "" - }, - { - "key": "payment_method_id", - "value": "" - }, - { - "key": "refund_id", - "value": "" - }, - { - "key": "merchant_connector_id", - "value": "" - }, - { - "key": "client_secret", - "value": "", - "type": "string" - }, - { - "key": "connector_api_key", - "value": "", - "type": "string" - }, - { - "key": "publishable_key", - "value": "", - "type": "string" - }, - { - "key": "api_key_id", - "value": "", - "type": "string" - }, - { - "key": "payment_token", - "value": "" - }, - { - "key": "gateway_merchant_id", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "certificate", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "certificate_keys", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "connector_key1", - "value": "", - "type": "string" - } - ] -} diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh index d8e789408bb..9098be40e21 100755 --- a/scripts/add_connector.sh +++ b/scripts/add_connector.sh @@ -6,7 +6,7 @@ function find_prev_connector() { git checkout $self cp $self $self.tmp # Add new connector to existing list and sort it - connectors=(aci adyen airwallex applepay authorizedotnet bambora bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource dlocal dummyconnector ebanx fiserv forte globalpay globepay gocardless helcim iatapay klarna mollie multisafepay netcetera nexinets noon nuvei opayo opennode payeezy payme paypal payu placetopay powertranz prophetpay rapyd shift4 square stax stripe threedsecureio trustpay tsys volt wise worldline worldpay zsl "$1") + connectors=(aci adyen airwallex applepay authorizedotnet bambora bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource dlocal dummyconnector fiserv forte globalpay globepay gocardless helcim iatapay klarna mollie multisafepay nexinets noon nuvei opayo opennode payeezy payme paypal payu placetopay powertranz prophetpay rapyd shift4 square stax stripe threedsecureio trustpay tsys volt wise worldline worldpay "$1") IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS res=`echo ${sorted[@]}` sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp