Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat: change async-bb8 fork and tokio spawn for concurrent database calls (#2774)

Arun Raj Md634fdeac349
diff --git a/Cargo.lock b/Cargo.lock
index 1574933810..a03340093c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -9,12 +9,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8"
dependencies = [
"bitflags 1.3.2",
- "bytes",
+ "bytes 1.5.0",
"futures-core",
"futures-sink",
"memchr",
"pin-project-lite",
- "tokio",
+ "tokio 1.32.0",
"tokio-util",
"tracing",
]
@@ -31,7 +31,7 @@ dependencies = [
"futures-util",
"log",
"once_cell",
- "smallvec",
+ "smallvec 1.11.1",
]
[[package]]
@@ -48,7 +48,7 @@ dependencies = [
"base64 0.21.4",
"bitflags 1.3.2",
"brotli",
- "bytes",
+ "bytes 1.5.0",
"bytestring",
"derive_more",
"encoding_rs",
@@ -66,8 +66,8 @@ dependencies = [
"pin-project-lite",
"rand 0.8.5",
"sha1",
- "smallvec",
- "tokio",
+ "smallvec 1.11.1",
+ "tokio 1.32.0",
"tokio-util",
"tracing",
"zstd",
@@ -92,7 +92,7 @@ dependencies = [
"actix-multipart-derive",
"actix-utils",
"actix-web",
- "bytes",
+ "bytes 1.5.0",
"derive_more",
"futures-core",
"futures-util",
@@ -105,7 +105,7 @@ dependencies = [
"serde_json",
"serde_plain",
"tempfile",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -142,7 +142,7 @@ checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d"
dependencies = [
"actix-macros",
"futures-core",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -156,9 +156,9 @@ dependencies = [
"actix-utils",
"futures-core",
"futures-util",
- "mio",
+ "mio 0.8.8",
"socket2 0.5.4",
- "tokio",
+ "tokio 1.32.0",
"tracing",
]
@@ -188,7 +188,7 @@ dependencies = [
"pin-project-lite",
"rustls 0.21.7",
"rustls-webpki",
- "tokio",
+ "tokio 1.32.0",
"tokio-rustls",
"tokio-util",
"tracing",
@@ -221,9 +221,9 @@ dependencies = [
"actix-utils",
"actix-web-codegen",
"ahash 0.7.6",
- "bytes",
+ "bytes 1.5.0",
"bytestring",
- "cfg-if",
+ "cfg-if 1.0.0",
"cookie",
"derive_more",
"encoding_rs",
@@ -240,7 +240,7 @@ dependencies = [
"serde",
"serde_json",
"serde_urlencoded",
- "smallvec",
+ "smallvec 1.11.1",
"socket2 0.4.9",
"time",
"url",
@@ -296,7 +296,7 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"getrandom 0.2.10",
"once_cell",
"version_check",
@@ -475,14 +475,14 @@ dependencies = [
[[package]]
name = "async-bb8-diesel"
version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "779f1fa3defe66bf147fe5c811b23a02cfcaa528a25293e0b20d1911eac1fb05"
+source = "git+https://github.com/jarnura/async-bb8-diesel?rev=53b4ab901aab7635c8215fd1c2d542c8db443094#53b4ab901aab7635c8215fd1c2d542c8db443094"
dependencies = [
"async-trait",
"bb8",
"diesel",
"thiserror",
- "tokio",
+ "tokio 1.32.0",
+ "tracing",
]
[[package]]
@@ -506,7 +506,7 @@ dependencies = [
"futures-core",
"memchr",
"pin-project-lite",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -517,7 +517,7 @@ checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
dependencies = [
"async-lock",
"autocfg",
- "cfg-if",
+ "cfg-if 1.0.0",
"concurrent-queue",
"futures-lite",
"log",
@@ -606,8 +606,8 @@ dependencies = [
"actix-utils",
"ahash 0.7.6",
"base64 0.21.4",
- "bytes",
- "cfg-if",
+ "bytes 1.5.0",
+ "cfg-if 1.0.0",
"cookie",
"derive_more",
"futures-core",
@@ -624,7 +624,7 @@ dependencies = [
"serde",
"serde_json",
"serde_urlencoded",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -644,14 +644,14 @@ dependencies = [
"aws-smithy-json",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.5.0",
"fastrand 1.9.0",
"hex",
"http",
"hyper",
"ring",
"time",
- "tokio",
+ "tokio 1.32.0",
"tower",
"tracing",
"zeroize",
@@ -666,7 +666,7 @@ dependencies = [
"aws-smithy-async",
"aws-smithy-types",
"fastrand 1.9.0",
- "tokio",
+ "tokio 1.32.0",
"tracing",
"zeroize",
]
@@ -695,7 +695,7 @@ dependencies = [
"aws-smithy-http",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.5.0",
"http",
"http-body",
"lazy_static",
@@ -721,7 +721,7 @@ dependencies = [
"aws-smithy-json",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.5.0",
"http",
"regex",
"tokio-stream",
@@ -750,7 +750,7 @@ dependencies = [
"aws-smithy-types",
"aws-smithy-xml",
"aws-types",
- "bytes",
+ "bytes 1.5.0",
"http",
"http-body",
"once_cell",
@@ -779,7 +779,7 @@ dependencies = [
"aws-smithy-json",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.5.0",
"http",
"regex",
"tokio-stream",
@@ -804,7 +804,7 @@ dependencies = [
"aws-smithy-json",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.5.0",
"http",
"regex",
"tokio-stream",
@@ -831,7 +831,7 @@ dependencies = [
"aws-smithy-types",
"aws-smithy-xml",
"aws-types",
- "bytes",
+ "bytes 1.5.0",
"http",
"regex",
"tower",
@@ -861,7 +861,7 @@ checksum = "9d2ce6f507be68e968a33485ced670111d1cbad161ddbbab1e313c03d37d8f4c"
dependencies = [
"aws-smithy-eventstream",
"aws-smithy-http",
- "bytes",
+ "bytes 1.5.0",
"form_urlencoded",
"hex",
"hmac",
@@ -882,7 +882,7 @@ checksum = "13bda3996044c202d75b91afeb11a9afae9db9a721c6a7a427410018e286b880"
dependencies = [
"futures-util",
"pin-project-lite",
- "tokio",
+ "tokio 1.32.0",
"tokio-stream",
]
@@ -894,7 +894,7 @@ checksum = "07ed8b96d95402f3f6b8b57eb4e0e45ee365f78b1a924faf20ff6e97abf1eae6"
dependencies = [
"aws-smithy-http",
"aws-smithy-types",
- "bytes",
+ "bytes 1.5.0",
"crc32c",
"crc32fast",
"hex",
@@ -917,7 +917,7 @@ dependencies = [
"aws-smithy-http",
"aws-smithy-http-tower",
"aws-smithy-types",
- "bytes",
+ "bytes 1.5.0",
"fastrand 1.9.0",
"http",
"http-body",
@@ -926,7 +926,7 @@ dependencies = [
"lazy_static",
"pin-project-lite",
"rustls 0.20.9",
- "tokio",
+ "tokio 1.32.0",
"tower",
"tracing",
]
@@ -938,7 +938,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "460c8da5110835e3d9a717c61f5556b20d03c32a1dec57f8fc559b360f733bb8"
dependencies = [
"aws-smithy-types",
- "bytes",
+ "bytes 1.5.0",
"crc32fast",
]
@@ -950,7 +950,7 @@ checksum = "2b3b693869133551f135e1f2c77cb0b8277d9e3e17feaf2213f735857c4f0d28"
dependencies = [
"aws-smithy-eventstream",
"aws-smithy-types",
- "bytes",
+ "bytes 1.5.0",
"bytes-utils",
"futures-core",
"http",
@@ -960,7 +960,7 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"pin-utils",
- "tokio",
+ "tokio 1.32.0",
"tokio-util",
"tracing",
]
@@ -973,7 +973,7 @@ checksum = "3ae4f6c5798a247fac98a867698197d9ac22643596dc3777f0c76b91917616b9"
dependencies = [
"aws-smithy-http",
"aws-smithy-types",
- "bytes",
+ "bytes 1.5.0",
"http",
"http-body",
"pin-project-lite",
@@ -1034,7 +1034,7 @@ dependencies = [
"aws-smithy-http",
"aws-smithy-types",
"http",
- "rustc_version",
+ "rustc_version 0.4.0",
"tracing",
]
@@ -1047,7 +1047,7 @@ dependencies = [
"async-trait",
"axum-core",
"bitflags 1.3.2",
- "bytes",
+ "bytes 1.5.0",
"futures-util",
"http",
"http-body",
@@ -1073,7 +1073,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
dependencies = [
"async-trait",
- "bytes",
+ "bytes 1.5.0",
"futures-util",
"http",
"http-body",
@@ -1091,7 +1091,7 @@ checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
dependencies = [
"addr2line",
"cc",
- "cfg-if",
+ "cfg-if 1.0.0",
"libc",
"miniz_oxide 0.7.1",
"object",
@@ -1136,7 +1136,7 @@ dependencies = [
"futures-channel",
"futures-util",
"parking_lot 0.12.1",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -1204,7 +1204,7 @@ dependencies = [
"arrayref",
"arrayvec",
"cc",
- "cfg-if",
+ "cfg-if 1.0.0",
"constant_time_eq",
"digest 0.10.7",
]
@@ -1282,6 +1282,16 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+[[package]]
+name = "bytes"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
+dependencies = [
+ "byteorder",
+ "iovec",
+]
+
[[package]]
name = "bytes"
version = "1.5.0"
@@ -1294,7 +1304,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e47d3a8076e283f3acd27400535992edb3ba4b5bb72f8891ad8fbe7932a7d4b9"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"either",
]
@@ -1304,7 +1314,7 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "238e4886760d98c4f899360c834fa93e62cf7f721ac3c2da375cbdf4b8679aae"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
]
[[package]]
@@ -1347,7 +1357,7 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa"
dependencies = [
"camino",
"cargo-platform",
- "semver",
+ "semver 1.0.19",
"serde",
"serde_json",
]
@@ -1360,7 +1370,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a"
dependencies = [
"camino",
"cargo-platform",
- "semver",
+ "semver 1.0.19",
"serde",
"serde_json",
"thiserror",
@@ -1393,6 +1403,12 @@ dependencies = [
"uuid",
]
+[[package]]
+name = "cfg-if"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
+
[[package]]
name = "cfg-if"
version = "1.0.0"
@@ -1509,6 +1525,15 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
+[[package]]
+name = "cloudabi"
+version = "0.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
+dependencies = [
+ "bitflags 1.3.2",
+]
+
[[package]]
name = "color_quant"
version = "1.1.0"
@@ -1532,12 +1557,12 @@ name = "common_utils"
version = "0.1.0"
dependencies = [
"async-trait",
- "bytes",
+ "bytes 1.5.0",
"common_enums",
"diesel",
"error-stack",
"fake",
- "futures",
+ "futures 0.3.28",
"hex",
"http",
"masking",
@@ -1562,7 +1587,7 @@ dependencies = [
"test-case",
"thiserror",
"time",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -1571,7 +1596,7 @@ version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400"
dependencies = [
- "crossbeam-utils",
+ "crossbeam-utils 0.8.16",
]
[[package]]
@@ -1674,7 +1699,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8f48d60e5b4d2c53d5c2b1d8a58c849a70ae5e5509b08a48d047e3b65714a74"
dependencies = [
- "rustc_version",
+ "rustc_version 0.4.0",
]
[[package]]
@@ -1683,7 +1708,7 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
@@ -1728,8 +1753,19 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
dependencies = [
- "cfg-if",
- "crossbeam-utils",
+ "cfg-if 1.0.0",
+ "crossbeam-utils 0.8.16",
+]
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed"
+dependencies = [
+ "crossbeam-epoch 0.8.2",
+ "crossbeam-utils 0.7.2",
+ "maybe-uninit",
]
[[package]]
@@ -1738,9 +1774,24 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
dependencies = [
- "cfg-if",
- "crossbeam-epoch",
- "crossbeam-utils",
+ "cfg-if 1.0.0",
+ "crossbeam-epoch 0.9.15",
+ "crossbeam-utils 0.8.16",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
+dependencies = [
+ "autocfg",
+ "cfg-if 0.1.10",
+ "crossbeam-utils 0.7.2",
+ "lazy_static",
+ "maybe-uninit",
+ "memoffset 0.5.6",
+ "scopeguard",
]
[[package]]
@@ -1750,20 +1801,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
dependencies = [
"autocfg",
- "cfg-if",
- "crossbeam-utils",
- "memoffset",
+ "cfg-if 1.0.0",
+ "crossbeam-utils 0.8.16",
+ "memoffset 0.9.0",
"scopeguard",
]
+[[package]]
+name = "crossbeam-queue"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
+dependencies = [
+ "cfg-if 0.1.10",
+ "crossbeam-utils 0.7.2",
+ "maybe-uninit",
+]
+
[[package]]
name = "crossbeam-queue"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add"
dependencies = [
- "cfg-if",
- "crossbeam-utils",
+ "cfg-if 1.0.0",
+ "crossbeam-utils 0.8.16",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
+dependencies = [
+ "autocfg",
+ "cfg-if 0.1.10",
+ "lazy_static",
]
[[package]]
@@ -1772,7 +1845,7 @@ version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
@@ -1861,9 +1934,9 @@ version = "5.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"hashbrown 0.14.1",
- "lock_api",
+ "lock_api 0.4.10",
"once_cell",
"parking_lot_core 0.9.8",
]
@@ -1900,7 +1973,7 @@ dependencies = [
"deadpool-runtime",
"num_cpus",
"retain_mut",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -1953,7 +2026,7 @@ dependencies = [
"convert_case",
"proc-macro2",
"quote",
- "rustc_version",
+ "rustc_version 0.4.0",
"syn 1.0.109",
]
@@ -2064,7 +2137,7 @@ checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
dependencies = [
"libc",
"redox_users",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -2111,7 +2184,7 @@ dependencies = [
"serde_json",
"serde_path_to_error",
"thiserror",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -2132,7 +2205,7 @@ version = "0.8.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
@@ -2187,7 +2260,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f00447f331c7f726db5b8532ebc9163519eed03c6d7c8b73c90b3ff5646ac85"
dependencies = [
"anyhow",
- "rustc_version",
+ "rustc_version 0.4.0",
"serde",
]
@@ -2261,7 +2334,7 @@ dependencies = [
"router_env",
"serde",
"thiserror",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -2291,7 +2364,7 @@ dependencies = [
"serde",
"serde_json",
"time",
- "tokio",
+ "tokio 1.32.0",
"url",
"webdriver",
]
@@ -2375,19 +2448,19 @@ dependencies = [
"arc-swap",
"arcstr",
"async-trait",
- "bytes",
+ "bytes 1.5.0",
"bytes-utils",
- "cfg-if",
+ "cfg-if 1.0.0",
"float-cmp",
- "futures",
+ "futures 0.3.28",
"lazy_static",
"log",
"parking_lot 0.12.1",
"rand 0.8.5",
"redis-protocol",
- "semver",
+ "semver 1.0.19",
"sha-1 0.10.1",
- "tokio",
+ "tokio 1.32.0",
"tokio-stream",
"tokio-util",
"tracing",
@@ -2447,6 +2520,28 @@ dependencies = [
"syn 2.0.38",
]
+[[package]]
+name = "fuchsia-zircon"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
+dependencies = [
+ "bitflags 1.3.2",
+ "fuchsia-zircon-sys",
+]
+
+[[package]]
+name = "fuchsia-zircon-sys"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
+
+[[package]]
+name = "futures"
+version = "0.1.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678"
+
[[package]]
name = "futures"
version = "0.3.28"
@@ -2496,7 +2591,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5"
dependencies = [
"futures-core",
- "lock_api",
+ "lock_api 0.4.10",
"parking_lot 0.11.2",
]
@@ -2594,7 +2689,7 @@ version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
@@ -2605,7 +2700,7 @@ version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"js-sys",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
@@ -2677,7 +2772,7 @@ version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"fnv",
"futures-core",
"futures-sink",
@@ -2685,7 +2780,7 @@ dependencies = [
"http",
"indexmap 1.9.3",
"slab",
- "tokio",
+ "tokio 1.32.0",
"tokio-util",
"tracing",
]
@@ -2769,7 +2864,7 @@ version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"fnv",
"itoa",
]
@@ -2780,7 +2875,7 @@ version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"http",
"pin-project-lite",
]
@@ -2833,7 +2928,7 @@ version = "0.14.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"futures-channel",
"futures-core",
"futures-util",
@@ -2845,7 +2940,7 @@ dependencies = [
"itoa",
"pin-project-lite",
"socket2 0.4.9",
- "tokio",
+ "tokio 1.32.0",
"tower-service",
"tracing",
"want",
@@ -2862,7 +2957,7 @@ dependencies = [
"log",
"rustls 0.20.9",
"rustls-native-certs",
- "tokio",
+ "tokio 1.32.0",
"tokio-rustls",
]
@@ -2874,7 +2969,7 @@ checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
dependencies = [
"hyper",
"pin-project-lite",
- "tokio",
+ "tokio 1.32.0",
"tokio-io-timeout",
]
@@ -2884,10 +2979,10 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"hyper",
"native-tls",
- "tokio",
+ "tokio 1.32.0",
"tokio-native-tls",
]
@@ -3015,7 +3110,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
@@ -3029,6 +3124,15 @@ dependencies = [
"windows-sys",
]
+[[package]]
+name = "iovec"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "ipnet"
version = "2.8.0"
@@ -3140,6 +3244,16 @@ dependencies = [
"simple_asn1",
]
+[[package]]
+name = "kernel32-sys"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
+dependencies = [
+ "winapi 0.2.8",
+ "winapi-build",
+]
+
[[package]]
name = "kgraph_utils"
version = "0.1.0"
@@ -3246,6 +3360,15 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1"
+[[package]]
+name = "lock_api"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
+dependencies = [
+ "scopeguard",
+]
+
[[package]]
name = "lock_api"
version = "0.4.10"
@@ -3293,7 +3416,7 @@ dependencies = [
name = "masking"
version = "0.1.0"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"diesel",
"serde",
"serde_json",
@@ -3340,13 +3463,19 @@ dependencies = [
"syn 1.0.109",
]
+[[package]]
+name = "maybe-uninit"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
+
[[package]]
name = "md-5"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"digest 0.10.7",
]
@@ -3362,6 +3491,15 @@ version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
+[[package]]
+name = "memoffset"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
+dependencies = [
+ "autocfg",
+]
+
[[package]]
name = "memoffset"
version = "0.9.0"
@@ -3430,6 +3568,25 @@ dependencies = [
"adler",
]
+[[package]]
+name = "mio"
+version = "0.6.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
+dependencies = [
+ "cfg-if 0.1.10",
+ "fuchsia-zircon",
+ "fuchsia-zircon-sys",
+ "iovec",
+ "kernel32-sys",
+ "libc",
+ "log",
+ "miow",
+ "net2",
+ "slab",
+ "winapi 0.2.8",
+]
+
[[package]]
name = "mio"
version = "0.8.8"
@@ -3442,6 +3599,29 @@ dependencies = [
"windows-sys",
]
+[[package]]
+name = "mio-uds"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
+dependencies = [
+ "iovec",
+ "libc",
+ "mio 0.6.23",
+]
+
+[[package]]
+name = "miow"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
+dependencies = [
+ "kernel32-sys",
+ "net2",
+ "winapi 0.2.8",
+ "ws2_32-sys",
+]
+
[[package]]
name = "moka"
version = "0.11.3"
@@ -3451,16 +3631,16 @@ dependencies = [
"async-io",
"async-lock",
"crossbeam-channel",
- "crossbeam-epoch",
- "crossbeam-utils",
+ "crossbeam-epoch 0.9.15",
+ "crossbeam-utils 0.8.16",
"futures-util",
"once_cell",
"parking_lot 0.12.1",
"quanta",
- "rustc_version",
+ "rustc_version 0.4.0",
"scheduled-thread-pool",
"skeptic",
- "smallvec",
+ "smallvec 1.11.1",
"tagptr",
"thiserror",
"triomphe",
@@ -3494,6 +3674,17 @@ dependencies = [
"tempfile",
]
+[[package]]
+name = "net2"
+version = "0.2.39"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac"
+dependencies = [
+ "cfg-if 0.1.10",
+ "libc",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "nom"
version = "7.1.3"
@@ -3511,7 +3702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
"overload",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -3626,7 +3817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c"
dependencies = [
"bitflags 2.4.0",
- "cfg-if",
+ "cfg-if 1.0.0",
"foreign-types",
"libc",
"once_cell",
@@ -3680,14 +3871,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8af72d59a4484654ea8eb183fea5ae4eb6a41d7ac3e3bae5f4d2a282a3a7d3ca"
dependencies = [
"async-trait",
- "futures",
+ "futures 0.3.28",
"futures-util",
"http",
"opentelemetry",
"opentelemetry-proto",
"prost",
"thiserror",
- "tokio",
+ "tokio 1.32.0",
"tonic",
]
@@ -3697,7 +3888,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "045f8eea8c0fa19f7d48e7bc3128a39c2e5c533d5c61298c548dfefc1064474c"
dependencies = [
- "futures",
+ "futures 0.3.28",
"futures-util",
"opentelemetry",
"prost",
@@ -3738,7 +3929,7 @@ dependencies = [
"percent-encoding",
"rand 0.8.5",
"thiserror",
- "tokio",
+ "tokio 1.32.0",
"tokio-stream",
]
@@ -3770,6 +3961,17 @@ version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067"
+[[package]]
+name = "parking_lot"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
+dependencies = [
+ "lock_api 0.3.4",
+ "parking_lot_core 0.6.3",
+ "rustc_version 0.2.3",
+]
+
[[package]]
name = "parking_lot"
version = "0.11.2"
@@ -3777,7 +3979,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
- "lock_api",
+ "lock_api 0.4.10",
"parking_lot_core 0.8.6",
]
@@ -3787,22 +3989,37 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
- "lock_api",
+ "lock_api 0.4.10",
"parking_lot_core 0.9.8",
]
+[[package]]
+name = "parking_lot_core"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a"
+dependencies = [
+ "cfg-if 0.1.10",
+ "cloudabi",
+ "libc",
+ "redox_syscall 0.1.57",
+ "rustc_version 0.2.3",
+ "smallvec 0.6.14",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "parking_lot_core"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"instant",
"libc",
"redox_syscall 0.2.16",
- "smallvec",
- "winapi",
+ "smallvec 1.11.1",
+ "winapi 0.3.9",
]
[[package]]
@@ -3811,10 +4028,10 @@ version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"libc",
"redox_syscall 0.3.5",
- "smallvec",
+ "smallvec 1.11.1",
"windows-targets",
]
@@ -4061,7 +4278,7 @@ checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
dependencies = [
"autocfg",
"bitflags 1.3.2",
- "cfg-if",
+ "cfg-if 1.0.0",
"concurrent-queue",
"libc",
"log",
@@ -4143,7 +4360,7 @@ version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"prost-derive",
]
@@ -4187,14 +4404,14 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab"
dependencies = [
- "crossbeam-utils",
+ "crossbeam-utils 0.8.16",
"libc",
"mach2",
"once_cell",
"raw-cpuid",
"wasi 0.11.0+wasi-snapshot-preview1",
"web-sys",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -4338,8 +4555,8 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed"
dependencies = [
- "crossbeam-deque",
- "crossbeam-utils",
+ "crossbeam-deque 0.8.3",
+ "crossbeam-utils 0.8.16",
]
[[package]]
@@ -4348,7 +4565,7 @@ version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c31deddf734dc0a39d3112e73490e88b61a05e83e074d211f348404cee4d2c6"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"bytes-utils",
"cookie-factory",
"crc16",
@@ -4363,13 +4580,19 @@ dependencies = [
"common_utils",
"error-stack",
"fred",
- "futures",
+ "futures 0.3.28",
"router_env",
"serde",
"thiserror",
- "tokio",
+ "tokio 1.32.0",
]
+[[package]]
+name = "redox_syscall"
+version = "0.1.57"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
+
[[package]]
name = "redox_syscall"
version = "0.2.16"
@@ -4463,7 +4686,7 @@ checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b"
dependencies = [
"async-compression",
"base64 0.21.4",
- "bytes",
+ "bytes 1.5.0",
"encoding_rs",
"futures-core",
"futures-util",
@@ -4485,7 +4708,7 @@ dependencies = [
"serde_json",
"serde_urlencoded",
"system-configuration",
- "tokio",
+ "tokio 1.32.0",
"tokio-native-tls",
"tokio-util",
"tower-service",
@@ -4514,7 +4737,7 @@ dependencies = [
"spin",
"untrusted",
"web-sys",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -4561,7 +4784,7 @@ dependencies = [
"bb8",
"bigdecimal",
"blake3",
- "bytes",
+ "bytes 1.5.0",
"cards",
"clap",
"common_enums",
@@ -4577,7 +4800,7 @@ dependencies = [
"error-stack",
"euclid",
"external_services",
- "futures",
+ "futures 0.3.28",
"hex",
"http",
"hyper",
@@ -4621,7 +4844,8 @@ dependencies = [
"test_utils",
"thiserror",
"time",
- "tokio",
+ "tokio 1.32.0",
+ "tracing-futures",
"unicode-segmentation",
"url",
"utoipa",
@@ -4664,7 +4888,7 @@ dependencies = [
"serde_path_to_error",
"strum 0.24.1",
"time",
- "tokio",
+ "tokio 1.32.0",
"tracing",
"tracing-actix-web",
"tracing-appender",
@@ -4724,7 +4948,7 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"ordered-multimap",
]
@@ -4740,13 +4964,22 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+[[package]]
+name = "rustc_version"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
+dependencies = [
+ "semver 0.9.0",
+]
+
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
- "semver",
+ "semver 1.0.19",
]
[[package]]
@@ -4900,7 +5133,7 @@ dependencies = [
"diesel_models",
"error-stack",
"external_services",
- "futures",
+ "futures 0.3.28",
"masking",
"once_cell",
"rand 0.8.5",
@@ -4912,7 +5145,7 @@ dependencies = [
"strum 0.24.1",
"thiserror",
"time",
- "tokio",
+ "tokio 1.32.0",
"uuid",
]
@@ -4961,6 +5194,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "semver"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
+dependencies = [
+ "semver-parser",
+]
+
[[package]]
name = "semver"
version = "1.0.19"
@@ -4970,6 +5212,12 @@ dependencies = [
"serde",
]
+[[package]]
+name = "semver-parser"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
+
[[package]]
name = "serde"
version = "1.0.188"
@@ -5122,7 +5370,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d"
dependencies = [
"dashmap",
- "futures",
+ "futures 0.3.28",
"lazy_static",
"log",
"parking_lot 0.12.1",
@@ -5147,7 +5395,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"
dependencies = [
"block-buffer 0.9.0",
- "cfg-if",
+ "cfg-if 1.0.0",
"cpufeatures",
"digest 0.9.0",
"opaque-debug",
@@ -5159,7 +5407,7 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"cpufeatures",
"digest 0.10.7",
]
@@ -5170,7 +5418,7 @@ version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"cpufeatures",
"digest 0.10.7",
]
@@ -5181,7 +5429,7 @@ version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"cpufeatures",
"digest 0.10.7",
]
@@ -5232,7 +5480,7 @@ dependencies = [
"futures-core",
"libc",
"signal-hook",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -5286,6 +5534,15 @@ dependencies = [
"deunicode",
]
+[[package]]
+name = "smallvec"
+version = "0.6.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0"
+dependencies = [
+ "maybe-uninit",
+]
+
[[package]]
name = "smallvec"
version = "1.11.1"
@@ -5299,7 +5556,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
dependencies = [
"libc",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -5351,9 +5608,9 @@ dependencies = [
"bigdecimal",
"bitflags 1.3.2",
"byteorder",
- "bytes",
+ "bytes 1.5.0",
"crc",
- "crossbeam-queue",
+ "crossbeam-queue 0.3.8",
"dirs",
"dotenvy",
"either",
@@ -5381,7 +5638,7 @@ dependencies = [
"serde_json",
"sha1",
"sha2",
- "smallvec",
+ "smallvec 1.11.1",
"sqlformat",
"sqlx-rt",
"stringprep",
@@ -5419,7 +5676,7 @@ checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024"
dependencies = [
"native-tls",
"once_cell",
- "tokio",
+ "tokio 1.32.0",
"tokio-native-tls",
]
@@ -5432,7 +5689,7 @@ dependencies = [
"async-bb8-diesel",
"async-trait",
"bb8",
- "bytes",
+ "bytes 1.5.0",
"common_utils",
"config",
"crc32fast",
@@ -5441,7 +5698,7 @@ dependencies = [
"diesel_models",
"dyn-clone",
"error-stack",
- "futures",
+ "futures 0.3.28",
"http",
"masking",
"mime",
@@ -5454,7 +5711,7 @@ dependencies = [
"serde",
"serde_json",
"thiserror",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -5606,7 +5863,7 @@ version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"fastrand 2.0.1",
"redox_syscall 0.3.5",
"rustix 0.38.17",
@@ -5650,7 +5907,7 @@ version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54c25e2cb8f5fcd7318157634e8838aa6f7e4715c96637f969fabaccd1ef5462"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"proc-macro-error",
"proc-macro2",
"quote",
@@ -5686,7 +5943,7 @@ dependencies = [
"serial_test",
"thirtyfour",
"time",
- "tokio",
+ "tokio 1.32.0",
"toml 0.7.4",
]
@@ -5701,7 +5958,7 @@ dependencies = [
"chrono",
"cookie",
"fantoccini",
- "futures",
+ "futures 0.3.28",
"http",
"log",
"parking_lot 0.12.1",
@@ -5711,7 +5968,7 @@ dependencies = [
"stringmatch",
"thirtyfour-macros",
"thiserror",
- "tokio",
+ "tokio 1.32.0",
"url",
"urlparse",
]
@@ -5754,7 +6011,7 @@ version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"once_cell",
]
@@ -5821,6 +6078,30 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+[[package]]
+name = "tokio"
+version = "0.1.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6"
+dependencies = [
+ "bytes 0.4.12",
+ "futures 0.1.31",
+ "mio 0.6.23",
+ "num_cpus",
+ "tokio-codec",
+ "tokio-current-thread",
+ "tokio-executor",
+ "tokio-fs",
+ "tokio-io",
+ "tokio-reactor",
+ "tokio-sync",
+ "tokio-tcp",
+ "tokio-threadpool",
+ "tokio-timer",
+ "tokio-udp",
+ "tokio-uds",
+]
+
[[package]]
name = "tokio"
version = "1.32.0"
@@ -5828,9 +6109,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9"
dependencies = [
"backtrace",
- "bytes",
+ "bytes 1.5.0",
"libc",
- "mio",
+ "mio 0.8.8",
"num_cpus",
"parking_lot 0.12.1",
"pin-project-lite",
@@ -5840,6 +6121,59 @@ dependencies = [
"windows-sys",
]
+[[package]]
+name = "tokio-codec"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b"
+dependencies = [
+ "bytes 0.4.12",
+ "futures 0.1.31",
+ "tokio-io",
+]
+
+[[package]]
+name = "tokio-current-thread"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e"
+dependencies = [
+ "futures 0.1.31",
+ "tokio-executor",
+]
+
+[[package]]
+name = "tokio-executor"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671"
+dependencies = [
+ "crossbeam-utils 0.7.2",
+ "futures 0.1.31",
+]
+
+[[package]]
+name = "tokio-fs"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4"
+dependencies = [
+ "futures 0.1.31",
+ "tokio-io",
+ "tokio-threadpool",
+]
+
+[[package]]
+name = "tokio-io"
+version = "0.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674"
+dependencies = [
+ "bytes 0.4.12",
+ "futures 0.1.31",
+ "log",
+]
+
[[package]]
name = "tokio-io-timeout"
version = "1.2.0"
@@ -5847,7 +6181,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf"
dependencies = [
"pin-project-lite",
- "tokio",
+ "tokio 1.32.0",
]
[[package]]
@@ -5868,7 +6202,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
dependencies = [
"native-tls",
- "tokio",
+ "tokio 1.32.0",
+]
+
+[[package]]
+name = "tokio-reactor"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351"
+dependencies = [
+ "crossbeam-utils 0.7.2",
+ "futures 0.1.31",
+ "lazy_static",
+ "log",
+ "mio 0.6.23",
+ "num_cpus",
+ "parking_lot 0.9.0",
+ "slab",
+ "tokio-executor",
+ "tokio-io",
+ "tokio-sync",
]
[[package]]
@@ -5878,7 +6231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
dependencies = [
"rustls 0.20.9",
- "tokio",
+ "tokio 1.32.0",
"webpki",
]
@@ -5890,7 +6243,93 @@ checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
dependencies = [
"futures-core",
"pin-project-lite",
- "tokio",
+ "tokio 1.32.0",
+]
+
+[[package]]
+name = "tokio-sync"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee"
+dependencies = [
+ "fnv",
+ "futures 0.1.31",
+]
+
+[[package]]
+name = "tokio-tcp"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72"
+dependencies = [
+ "bytes 0.4.12",
+ "futures 0.1.31",
+ "iovec",
+ "mio 0.6.23",
+ "tokio-io",
+ "tokio-reactor",
+]
+
+[[package]]
+name = "tokio-threadpool"
+version = "0.1.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89"
+dependencies = [
+ "crossbeam-deque 0.7.4",
+ "crossbeam-queue 0.2.3",
+ "crossbeam-utils 0.7.2",
+ "futures 0.1.31",
+ "lazy_static",
+ "log",
+ "num_cpus",
+ "slab",
+ "tokio-executor",
+]
+
+[[package]]
+name = "tokio-timer"
+version = "0.2.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296"
+dependencies = [
+ "crossbeam-utils 0.7.2",
+ "futures 0.1.31",
+ "slab",
+ "tokio-executor",
+]
+
+[[package]]
+name = "tokio-udp"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82"
+dependencies = [
+ "bytes 0.4.12",
+ "futures 0.1.31",
+ "log",
+ "mio 0.6.23",
+ "tokio-codec",
+ "tokio-io",
+ "tokio-reactor",
+]
+
+[[package]]
+name = "tokio-uds"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0"
+dependencies = [
+ "bytes 0.4.12",
+ "futures 0.1.31",
+ "iovec",
+ "libc",
+ "log",
+ "mio 0.6.23",
+ "mio-uds",
+ "tokio-codec",
+ "tokio-io",
+ "tokio-reactor",
]
[[package]]
@@ -5899,11 +6338,11 @@ version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d"
dependencies = [
- "bytes",
+ "bytes 1.5.0",
"futures-core",
"futures-sink",
"pin-project-lite",
- "tokio",
+ "tokio 1.32.0",
"tracing",
]
@@ -5960,7 +6399,7 @@ dependencies = [
"async-trait",
"axum",
"base64 0.13.1",
- "bytes",
+ "bytes 1.5.0",
"futures-core",
"futures-util",
"h2",
@@ -5972,7 +6411,7 @@ dependencies = [
"pin-project",
"prost",
"prost-derive",
- "tokio",
+ "tokio 1.32.0",
"tokio-stream",
"tokio-util",
"tower",
@@ -5995,7 +6434,7 @@ dependencies = [
"pin-project-lite",
"rand 0.8.5",
"slab",
- "tokio",
+ "tokio 1.32.0",
"tokio-util",
"tower-layer",
"tower-service",
@@ -6020,7 +6459,7 @@ version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"log",
"pin-project-lite",
"tracing-attributes",
@@ -6080,6 +6519,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
dependencies = [
"pin-project",
+ "tokio 0.1.22",
"tracing",
]
@@ -6131,7 +6571,7 @@ dependencies = [
"serde",
"serde_json",
"sharded-slab",
- "smallvec",
+ "smallvec 1.11.1",
"thread_local",
"tracing",
"tracing-core",
@@ -6389,7 +6829,7 @@ checksum = "8b3c89c2c7e50f33e4d35527e5bf9c11d6d132226dbbd1753f0fbe9f19ef88c6"
dependencies = [
"anyhow",
"git2",
- "rustc_version",
+ "rustc_version 0.4.0",
"rustversion",
"time",
]
@@ -6458,7 +6898,7 @@ version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"wasm-bindgen-macro",
]
@@ -6483,7 +6923,7 @@ version = "0.4.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"js-sys",
"wasm-bindgen",
"web-sys",
@@ -6535,7 +6975,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9973cb72c8587d5ad5efdb91e663d36177dc37725e6c90ca86c626b0cc45c93f"
dependencies = [
"base64 0.13.1",
- "bytes",
+ "bytes 1.5.0",
"cookie",
"http",
"log",
@@ -6582,6 +7022,12 @@ dependencies = [
"web-sys",
]
+[[package]]
+name = "winapi"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
+
[[package]]
name = "winapi"
version = "0.3.9"
@@ -6592,6 +7038,12 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
+[[package]]
+name = "winapi-build"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
+
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
@@ -6604,7 +7056,7 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
dependencies = [
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -6703,7 +7155,7 @@ version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"windows-sys",
]
@@ -6717,7 +7169,7 @@ dependencies = [
"async-trait",
"base64 0.21.4",
"deadpool",
- "futures",
+ "futures 0.3.28",
"futures-timer",
"http-types",
"hyper",
@@ -6726,7 +7178,17 @@ dependencies = [
"regex",
"serde",
"serde_json",
- "tokio",
+ "tokio 1.32.0",
+]
+
+[[package]]
+name = "ws2_32-sys"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
+dependencies = [
+ "winapi 0.2.8",
+ "winapi-build",
]
[[package]]
@@ -6775,7 +7237,7 @@ checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
dependencies = [
"byteorder",
"crc32fast",
- "crossbeam-utils",
+ "crossbeam-utils 0.8.16",
"flate2",
]
diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs
index b28bffe0dc..111f0f43c0 100644
--- a/crates/common_utils/src/types.rs
+++ b/crates/common_utils/src/types.rs
@@ -77,7 +77,9 @@ impl<const PRECISION: u8> Percentage<PRECISION> {
if value.contains('.') {
// if string has '.' then take the decimal part and verify precision length
match value.split('.').last() {
- Some(decimal_part) => decimal_part.trim_end_matches('0').len() <= PRECISION.into(),
+ Some(decimal_part) => {
+ decimal_part.trim_end_matches('0').len() <= <u8 as Into<usize>>::into(PRECISION)
+ }
// will never be None
None => false,
}
diff --git a/crates/diesel_models/Cargo.toml b/crates/diesel_models/Cargo.toml
index 9521c69036..ccef0bf4e7 100644
--- a/crates/diesel_models/Cargo.toml
+++ b/crates/diesel_models/Cargo.toml
@@ -12,7 +12,7 @@ default = ["kv_store"]
kv_store = []
[dependencies]
-async-bb8-diesel = "0.1.0"
+async-bb8-diesel = { git = "https://github.com/jarnura/async-bb8-diesel", rev = "53b4ab901aab7635c8215fd1c2d542c8db443094" }
diesel = { version = "2.1.0", features = ["postgres", "serde_json", "time", "64-column-tables"] }
error-stack = "0.3.1"
frunk = "0.4.1"
diff --git a/crates/drainer/Cargo.toml b/crates/drainer/Cargo.toml
index 56bebdce6b..668e8b0574 100644
--- a/crates/drainer/Cargo.toml
+++ b/crates/drainer/Cargo.toml
@@ -13,7 +13,7 @@ kms = ["external_services/kms"]
vergen = ["router_env/vergen"]
[dependencies]
-async-bb8-diesel = "0.1.0"
+async-bb8-diesel = { git = "https://github.com/jarnura/async-bb8-diesel", rev = "53b4ab901aab7635c8215fd1c2d542c8db443094" }
bb8 = "0.8"
clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] }
config = { version = "0.13.3", features = ["toml"] }
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 4d9c315a10..01595dc18c 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -37,8 +37,8 @@ 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.0", features = ["std"] }
-async-bb8-diesel = "0.1.0"
async-trait = "0.1.68"
aws-config = { version = "0.55.3", optional = true }
aws-sdk-s3 = { version = "0.28.0", optional = true }
@@ -97,6 +97,7 @@ utoipa-swagger-ui = { version = "3.1.3", features = ["actix-web"] }
uuid = { version = "1.3.3", features = ["serde", "v4"] }
validator = "0.16.0"
x509-parser = "0.15.0"
+tracing-futures = { version = "0.2.5", features = ["tokio"] }
# First party crates
api_models = { version = "0.1.0", path = "../api_models", features = ["errors"] }
diff --git a/crates/router/src/bin/router.rs b/crates/router/src/bin/router.rs
index cb3a8d83b0..beb2869f99 100644
--- a/crates/router/src/bin/router.rs
+++ b/crates/router/src/bin/router.rs
@@ -4,7 +4,7 @@ use router::{
logger,
};
-#[actix_web::main]
+#[tokio::main]
async fn main() -> ApplicationResult<()> {
// get commandline config before initializing config
let cmd_line = <CmdLineConf as clap::Parser>::parse();
@@ -43,7 +43,7 @@ async fn main() -> ApplicationResult<()> {
logger::info!("Application started [{:?}] [{:?}]", conf.server, conf.log);
#[allow(clippy::expect_used)]
- let server = router::start_server(conf)
+ let server = Box::pin(router::start_server(conf))
.await
.expect("Failed to create the server");
let _ = server.await;
diff --git a/crates/router/src/bin/scheduler.rs b/crates/router/src/bin/scheduler.rs
index 09f23bc3b2..4c19408582 100644
--- a/crates/router/src/bin/scheduler.rs
+++ b/crates/router/src/bin/scheduler.rs
@@ -40,7 +40,12 @@ async fn main() -> CustomResult<(), ProcessTrackerError> {
);
// channel for listening to redis disconnect events
let (redis_shutdown_signal_tx, redis_shutdown_signal_rx) = oneshot::channel();
- let state = routes::AppState::new(conf, redis_shutdown_signal_tx, api_client).await;
+ let state = Box::pin(routes::AppState::new(
+ conf,
+ redis_shutdown_signal_tx,
+ api_client,
+ ))
+ .await;
// channel to shutdown scheduler gracefully
let (tx, rx) = mpsc::channel(1);
tokio::spawn(router::receiver_for_error(
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 6b3cf11f58..38ab03ddcb 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1944,7 +1944,14 @@ pub async fn do_list_customer_pm_fetch_customer_if_not_passed(
) -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> {
let db = state.store.as_ref();
if let Some(customer_id) = customer_id {
- list_customer_payment_method(&state, merchant_account, key_store, None, customer_id).await
+ Box::pin(list_customer_payment_method(
+ &state,
+ merchant_account,
+ key_store,
+ None,
+ customer_id,
+ ))
+ .await
} else {
let cloned_secret = req.and_then(|r| r.client_secret.as_ref().cloned());
let payment_intent = helpers::verify_payment_intent_time_and_client_secret(
@@ -1957,13 +1964,13 @@ pub async fn do_list_customer_pm_fetch_customer_if_not_passed(
.as_ref()
.and_then(|intent| intent.customer_id.to_owned())
.ok_or(errors::ApiErrorResponse::CustomerNotFound)?;
- list_customer_payment_method(
+ Box::pin(list_customer_payment_method(
&state,
merchant_account,
key_store,
payment_intent,
&customer_id,
- )
+ ))
.await
}
}
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index e7408cecf1..7e19b0b605 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -193,7 +193,7 @@ where
)
.await?;
let operation = Box::new(PaymentResponse);
- let db = &*state.store;
+
connector_http_status_code = router_data.connector_http_status_code;
external_latency = router_data.external_latency;
//add connector http status code metrics
@@ -201,7 +201,7 @@ where
operation
.to_post_update_tracker()?
.update_tracker(
- db,
+ state,
&validate_result.payment_id,
payment_data,
router_data,
@@ -272,7 +272,6 @@ where
}
let operation = Box::new(PaymentResponse);
- let db = &*state.store;
connector_http_status_code = router_data.connector_http_status_code;
external_latency = router_data.external_latency;
//add connector http status code metrics
@@ -280,7 +279,7 @@ where
operation
.to_post_update_tracker()?
.update_tracker(
- db,
+ state,
&validate_result.payment_id,
payment_data,
router_data,
@@ -323,7 +322,7 @@ where
(_, payment_data) = operation
.to_update_tracker()?
.update_trackers(
- &*state.store,
+ state,
payment_data.clone(),
customer.clone(),
validate_result.storage_scheme,
@@ -582,7 +581,14 @@ impl<Ctx: PaymentMethodRetrieve> PaymentRedirectFlow<Ctx> for PaymentRedirectCom
}),
..Default::default()
};
- payments_core::<api::CompleteAuthorize, api::PaymentsResponse, _, _, _, Ctx>(
+ Box::pin(payments_core::<
+ api::CompleteAuthorize,
+ api::PaymentsResponse,
+ _,
+ _,
+ _,
+ Ctx,
+ >(
state.clone(),
merchant_account,
merchant_key_store,
@@ -592,7 +598,7 @@ impl<Ctx: PaymentMethodRetrieve> PaymentRedirectFlow<Ctx> for PaymentRedirectCom
connector_action,
None,
HeaderPayload::default(),
- )
+ ))
.await
}
@@ -678,7 +684,14 @@ impl<Ctx: PaymentMethodRetrieve> PaymentRedirectFlow<Ctx> for PaymentRedirectSyn
expand_attempts: None,
expand_captures: None,
};
- payments_core::<api::PSync, api::PaymentsResponse, _, _, _, Ctx>(
+ Box::pin(payments_core::<
+ api::PSync,
+ api::PaymentsResponse,
+ _,
+ _,
+ _,
+ Ctx,
+ >(
state.clone(),
merchant_account,
merchant_key_store,
@@ -688,7 +701,7 @@ impl<Ctx: PaymentMethodRetrieve> PaymentRedirectFlow<Ctx> for PaymentRedirectSyn
connector_action,
None,
HeaderPayload::default(),
- )
+ ))
.await
}
fn generate_response(
@@ -889,7 +902,7 @@ where
(_, *payment_data) = operation
.to_update_tracker()?
.update_trackers(
- &*state.store,
+ state,
payment_data.clone(),
customer.clone(),
merchant_account.storage_scheme,
diff --git a/crates/router/src/core/payments/flows/approve_flow.rs b/crates/router/src/core/payments/flows/approve_flow.rs
index 24f7e05e7b..14b710de91 100644
--- a/crates/router/src/core/payments/flows/approve_flow.rs
+++ b/crates/router/src/core/payments/flows/approve_flow.rs
@@ -25,7 +25,10 @@ impl
customer: &Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
) -> RouterResult<types::PaymentsApproveRouterData> {
- transformers::construct_payment_router_data::<api::Approve, types::PaymentsApproveData>(
+ Box::pin(transformers::construct_payment_router_data::<
+ api::Approve,
+ types::PaymentsApproveData,
+ >(
state,
self.clone(),
connector_id,
@@ -33,7 +36,7 @@ impl
key_store,
customer,
merchant_connector_account,
- )
+ ))
.await
}
}
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index e27fe54c0e..04bd7f0b43 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -39,7 +39,10 @@ impl
types::PaymentsResponseData,
>,
> {
- transformers::construct_payment_router_data::<api::Authorize, types::PaymentsAuthorizeData>(
+ Box::pin(transformers::construct_payment_router_data::<
+ api::Authorize,
+ types::PaymentsAuthorizeData,
+ >(
state,
self.clone(),
connector_id,
@@ -47,7 +50,7 @@ impl
key_store,
customer,
merchant_connector_account,
- )
+ ))
.await
}
}
@@ -96,7 +99,7 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
metrics::PAYMENT_COUNT.add(&metrics::CONTEXT, 1, &[]); // Metrics
if resp.request.setup_mandate_details.clone().is_some() {
- let payment_method_id = tokenization::save_payment_method(
+ let payment_method_id = Box::pin(tokenization::save_payment_method(
state,
connector,
resp.to_owned(),
@@ -104,7 +107,7 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
merchant_account,
self.request.payment_method_type,
key_store,
- )
+ ))
.await?;
Ok(mandate::mandate_procedure(
state,
@@ -127,7 +130,7 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
tokio::spawn(async move {
logger::info!("Starting async call to save_payment_method in locker");
- let result = tokenization::save_payment_method(
+ let result = Box::pin(tokenization::save_payment_method(
&state,
&connector,
response,
@@ -135,7 +138,7 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
&merchant_account,
self.request.payment_method_type,
&key_store,
- )
+ ))
.await;
if let Err(err) = result {
diff --git a/crates/router/src/core/payments/flows/cancel_flow.rs b/crates/router/src/core/payments/flows/cancel_flow.rs
index 3a3ac1b5b0..5918380ee0 100644
--- a/crates/router/src/core/payments/flows/cancel_flow.rs
+++ b/crates/router/src/core/payments/flows/cancel_flow.rs
@@ -24,7 +24,10 @@ impl ConstructFlowSpecificData<api::Void, types::PaymentsCancelData, types::Paym
customer: &Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
) -> RouterResult<types::PaymentsCancelRouterData> {
- transformers::construct_payment_router_data::<api::Void, types::PaymentsCancelData>(
+ Box::pin(transformers::construct_payment_router_data::<
+ api::Void,
+ types::PaymentsCancelData,
+ >(
state,
self.clone(),
connector_id,
@@ -32,7 +35,7 @@ impl ConstructFlowSpecificData<api::Void, types::PaymentsCancelData, types::Paym
key_store,
customer,
merchant_connector_account,
- )
+ ))
.await
}
}
diff --git a/crates/router/src/core/payments/flows/capture_flow.rs b/crates/router/src/core/payments/flows/capture_flow.rs
index d6077e708a..d2b7c8e91b 100644
--- a/crates/router/src/core/payments/flows/capture_flow.rs
+++ b/crates/router/src/core/payments/flows/capture_flow.rs
@@ -25,7 +25,10 @@ impl
customer: &Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
) -> RouterResult<types::PaymentsCaptureRouterData> {
- transformers::construct_payment_router_data::<api::Capture, types::PaymentsCaptureData>(
+ Box::pin(transformers::construct_payment_router_data::<
+ api::Capture,
+ types::PaymentsCaptureData,
+ >(
state,
self.clone(),
connector_id,
@@ -33,7 +36,7 @@ impl
key_store,
customer,
merchant_connector_account,
- )
+ ))
.await
}
}
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 6fbbb01e1a..44d8728fd4 100644
--- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
@@ -35,7 +35,7 @@ impl
types::PaymentsResponseData,
>,
> {
- transformers::construct_payment_router_data::<
+ Box::pin(transformers::construct_payment_router_data::<
api::CompleteAuthorize,
types::CompleteAuthorizeData,
>(
@@ -46,7 +46,7 @@ impl
key_store,
customer,
merchant_connector_account,
- )
+ ))
.await
}
}
diff --git a/crates/router/src/core/payments/flows/psync_flow.rs b/crates/router/src/core/payments/flows/psync_flow.rs
index 36d418a3ae..cb7a764985 100644
--- a/crates/router/src/core/payments/flows/psync_flow.rs
+++ b/crates/router/src/core/payments/flows/psync_flow.rs
@@ -28,7 +28,10 @@ impl ConstructFlowSpecificData<api::PSync, types::PaymentsSyncData, types::Payme
) -> RouterResult<
types::RouterData<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>,
> {
- transformers::construct_payment_router_data::<api::PSync, types::PaymentsSyncData>(
+ Box::pin(transformers::construct_payment_router_data::<
+ api::PSync,
+ types::PaymentsSyncData,
+ >(
state,
self.clone(),
connector_id,
@@ -36,7 +39,7 @@ impl ConstructFlowSpecificData<api::PSync, types::PaymentsSyncData, types::Payme
key_store,
customer,
merchant_connector_account,
- )
+ ))
.await
}
}
diff --git a/crates/router/src/core/payments/flows/reject_flow.rs b/crates/router/src/core/payments/flows/reject_flow.rs
index 396d98fb97..910cc955e6 100644
--- a/crates/router/src/core/payments/flows/reject_flow.rs
+++ b/crates/router/src/core/payments/flows/reject_flow.rs
@@ -24,7 +24,10 @@ impl ConstructFlowSpecificData<api::Reject, types::PaymentsRejectData, types::Pa
customer: &Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
) -> RouterResult<types::PaymentsRejectRouterData> {
- transformers::construct_payment_router_data::<api::Reject, types::PaymentsRejectData>(
+ Box::pin(transformers::construct_payment_router_data::<
+ api::Reject,
+ types::PaymentsRejectData,
+ >(
state,
self.clone(),
connector_id,
@@ -32,7 +35,7 @@ impl ConstructFlowSpecificData<api::Reject, types::PaymentsRejectData, types::Pa
key_store,
customer,
merchant_connector_account,
- )
+ ))
.await
}
}
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index a6ae83ac15..595a6f5e95 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -32,7 +32,10 @@ impl
customer: &Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
) -> RouterResult<types::PaymentsSessionRouterData> {
- transformers::construct_payment_router_data::<api::Session, types::PaymentsSessionData>(
+ Box::pin(transformers::construct_payment_router_data::<
+ api::Session,
+ types::PaymentsSessionData,
+ >(
state,
self.clone(),
connector_id,
@@ -40,7 +43,7 @@ impl
key_store,
customer,
merchant_connector_account,
- )
+ ))
.await
}
}
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 dae9ed0bf8..0c03c8ce12 100644
--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs
+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
@@ -31,7 +31,7 @@ impl
customer: &Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
) -> RouterResult<types::SetupMandateRouterData> {
- transformers::construct_payment_router_data::<
+ Box::pin(transformers::construct_payment_router_data::<
api::SetupMandate,
types::SetupMandateRequestData,
>(
@@ -42,7 +42,7 @@ impl
key_store,
customer,
merchant_connector_account,
- )
+ ))
.await
}
}
@@ -75,7 +75,7 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
.await
.to_setup_mandate_failed_response()?;
- let pm_id = tokenization::save_payment_method(
+ let pm_id = Box::pin(tokenization::save_payment_method(
state,
connector,
resp.to_owned(),
@@ -83,7 +83,7 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
merchant_account,
self.request.payment_method_type,
key_store,
- )
+ ))
.await?;
mandate::mandate_procedure(
@@ -208,7 +208,7 @@ impl types::SetupMandateRouterData {
.to_setup_mandate_failed_response()?;
let payment_method_type = self.request.payment_method_type;
- let pm_id = tokenization::save_payment_method(
+ let pm_id = Box::pin(tokenization::save_payment_method(
state,
connector,
resp.to_owned(),
@@ -216,7 +216,7 @@ impl types::SetupMandateRouterData {
merchant_account,
payment_method_type,
key_store,
- )
+ ))
.await?;
Ok(mandate::mandate_procedure(
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index ad747ac279..f65e65459e 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -154,7 +154,7 @@ pub trait Domain<F: Clone, R, Ctx: PaymentMethodRetrieve>: Send + Sync {
pub trait UpdateTracker<F, D, Req, Ctx: PaymentMethodRetrieve>: Send {
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_data: D,
customer: Option<domain::Customer>,
storage_scheme: enums::MerchantStorageScheme,
@@ -171,7 +171,7 @@ pub trait UpdateTracker<F, D, Req, Ctx: PaymentMethodRetrieve>: Send {
pub trait PostUpdateTracker<F, D, R>: Send {
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
payment_data: D,
response: types::RouterData<F, R, PaymentsResponseData>,
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index d5d0d2d017..538e65e4b2 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -336,7 +336,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
storage_scheme: storage_enums::MerchantStorageScheme,
@@ -356,6 +356,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
updated_by: storage_scheme.to_string(),
};
payment_data.payment_intent = db
+ .store
.update_payment_intent(
payment_data.payment_intent,
intent_status_update,
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index f734afef78..535edf736c 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -14,7 +14,6 @@ use crate::{
payment_methods::PaymentMethodRetrieve,
payments::{helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
},
- db::StorageInterface,
routes::AppState,
services,
types::{
@@ -178,7 +177,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
storage_scheme: enums::MerchantStorageScheme,
@@ -207,6 +206,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
if let Some(payment_intent_update) = intent_status_update {
payment_data.payment_intent = db
+ .store
.update_payment_intent(
payment_data.payment_intent,
payment_intent_update,
@@ -216,17 +216,18 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
}
- db.update_payment_attempt_with_attempt_id(
- payment_data.payment_attempt.clone(),
- storage::PaymentAttemptUpdate::VoidUpdate {
- status: attempt_status_update,
- cancellation_reason,
- updated_by: storage_scheme.to_string(),
- },
- storage_scheme,
- )
- .await
- .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ db.store
+ .update_payment_attempt_with_attempt_id(
+ payment_data.payment_attempt.clone(),
+ storage::PaymentAttemptUpdate::VoidUpdate {
+ status: attempt_status_update,
+ cancellation_reason,
+ updated_by: storage_scheme.to_string(),
+ },
+ storage_scheme,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
Ok((Box::new(self), payment_data))
}
}
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index 6e794b1ba6..ff51a2c49d 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -13,7 +13,6 @@ use crate::{
payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, types::MultipleCaptureData},
},
- db::StorageInterface,
routes::AppState,
services,
types::{
@@ -222,7 +221,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
mut payment_data: payments::PaymentData<F>,
_customer: Option<domain::Customer>,
storage_scheme: enums::MerchantStorageScheme,
@@ -239,6 +238,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
{
payment_data.payment_attempt = match &payment_data.multiple_capture_data {
Some(multiple_capture_data) => db
+ .store
.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt,
storage::PaymentAttemptUpdate::MultipleCaptureCountUpdate {
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 038d34ea29..c648d95a49 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -326,7 +326,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- _db: &dyn StorageInterface,
+ _state: &'b AppState,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
_storage_scheme: storage_enums::MerchantStorageScheme,
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 96cd4f5c62..88462e7f85 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -11,6 +11,7 @@ use futures::FutureExt;
use redis_interface::errors::RedisError;
use router_derive::PaymentOperation;
use router_env::{instrument, tracing};
+use tracing_futures::Instrument;
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
@@ -65,20 +66,46 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
// Stage 1
- let payment_intent_fut = db
- .find_payment_intent_by_payment_id_merchant_id(&payment_id, merchant_id, storage_scheme)
- .map(|x| x.change_context(errors::ApiErrorResponse::PaymentNotFound));
+ 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 mandate_details_fut = helpers::get_token_pm_type_mandate_details(
- state,
- request,
- mandate_type.clone(),
- merchant_account,
- key_store,
+ 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(),
);
- let (mut payment_intent, mandate_details) =
- futures::try_join!(payment_intent_fut, mandate_details_fut)?;
+ let (mut payment_intent, mandate_details) = tokio::try_join!(
+ utils::flatten_join_error(payment_intent_fut),
+ utils::flatten_join_error(mandate_details_fut)
+ )?;
helpers::validate_customer_access(&payment_intent, auth_flow, request)?;
@@ -112,76 +139,122 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
// Stage 2
let attempt_id = payment_intent.active_attempt.get_id();
- let payment_attempt_fut = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
- payment_intent.payment_id.as_str(),
- merchant_id,
- attempt_id.as_str(),
- storage_scheme,
- )
- .map(|x| x.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound));
-
- let shipping_address_fut = helpers::create_or_find_address_for_payment_by_request(
- db,
- request.shipping.as_ref(),
- payment_intent.shipping_address_id.as_deref(),
- merchant_id,
- payment_intent
- .customer_id
- .as_ref()
- .or(customer_details.customer_id.as_ref()),
- key_store,
- &payment_intent.payment_id,
- merchant_account.storage_scheme,
+ let store = state.clone().store;
+ let m_payment_id = payment_intent.payment_id.clone();
+ let m_merchant_id = merchant_id.clone();
+
+ let payment_attempt_fut = tokio::spawn(
+ async move {
+ store
+ .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ m_payment_id.as_str(),
+ m_merchant_id.as_str(),
+ attempt_id.as_str(),
+ storage_scheme,
+ )
+ .map(|x| x.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound))
+ .await
+ }
+ .in_current_span(),
);
- let billing_address_fut = helpers::create_or_find_address_for_payment_by_request(
- db,
- request.billing.as_ref(),
- payment_intent.billing_address_id.as_deref(),
- merchant_id,
- payment_intent
- .customer_id
- .as_ref()
- .or(customer_details.customer_id.as_ref()),
- key_store,
- &payment_intent.payment_id,
- merchant_account.storage_scheme,
+ let m_merchant_id = merchant_id.clone();
+ let m_request_shipping = request.shipping.clone();
+ let m_payment_intent_shipping_address_id = payment_intent.shipping_address_id.clone();
+ let m_payment_intent_payment_id = payment_intent.payment_id.clone();
+ let m_customer_details_customer_id = customer_details.customer_id.clone();
+ let m_payment_intent_customer_id = payment_intent.customer_id.clone();
+ let store = state.clone().store;
+ let m_key_store = key_store.clone();
+
+ let shipping_address_fut = tokio::spawn(
+ async move {
+ helpers::create_or_find_address_for_payment_by_request(
+ store.as_ref(),
+ m_request_shipping.as_ref(),
+ m_payment_intent_shipping_address_id.as_deref(),
+ m_merchant_id.as_str(),
+ m_payment_intent_customer_id
+ .as_ref()
+ .or(m_customer_details_customer_id.as_ref()),
+ &m_key_store,
+ m_payment_intent_payment_id.as_ref(),
+ storage_scheme,
+ )
+ .await
+ }
+ .in_current_span(),
);
- let config_update_fut = request
- .merchant_connector_details
- .to_owned()
- .async_map(|mcd| async {
- helpers::insert_merchant_connector_creds_to_config(
- db,
- merchant_account.merchant_id.as_str(),
- mcd,
+ let m_merchant_id = merchant_id.clone();
+ let m_request_billing = request.billing.clone();
+ let m_customer_details_customer_id = customer_details.customer_id.clone();
+ let m_payment_intent_customer_id = payment_intent.customer_id.clone();
+ let m_payment_intent_billing_address_id = payment_intent.billing_address_id.clone();
+ let m_payment_intent_payment_id = payment_intent.payment_id.clone();
+ let store = state.clone().store;
+ let m_key_store = key_store.clone();
+
+ let billing_address_fut = tokio::spawn(
+ async move {
+ helpers::create_or_find_address_for_payment_by_request(
+ store.as_ref(),
+ m_request_billing.as_ref(),
+ m_payment_intent_billing_address_id.as_deref(),
+ m_merchant_id.as_ref(),
+ m_payment_intent_customer_id
+ .as_ref()
+ .or(m_customer_details_customer_id.as_ref()),
+ &m_key_store,
+ m_payment_intent_payment_id.as_ref(),
+ storage_scheme,
)
.await
- })
- .map(|x| x.transpose());
+ }
+ .in_current_span(),
+ );
+
+ let m_merchant_id = merchant_id.clone();
+ let store = state.clone().store;
+ let m_request_merchant_connector_details = request.merchant_connector_details.clone();
+
+ let config_update_fut = tokio::spawn(
+ async move {
+ m_request_merchant_connector_details
+ .async_map(|mcd| async {
+ helpers::insert_merchant_connector_creds_to_config(
+ store.as_ref(),
+ m_merchant_id.as_str(),
+ mcd,
+ )
+ .await
+ })
+ .map(|x| x.transpose())
+ .await
+ }
+ .in_current_span(),
+ );
let (mut payment_attempt, shipping_address, billing_address) = match payment_intent.status {
api_models::enums::IntentStatus::RequiresCustomerAction
| api_models::enums::IntentStatus::RequiresMerchantAction
| api_models::enums::IntentStatus::RequiresPaymentMethod
| api_models::enums::IntentStatus::RequiresConfirmation => {
- let (payment_attempt, shipping_address, billing_address, _) = futures::try_join!(
- payment_attempt_fut,
- shipping_address_fut,
- billing_address_fut,
- config_update_fut
+ let (payment_attempt, shipping_address, billing_address, _) = tokio::try_join!(
+ utils::flatten_join_error(payment_attempt_fut),
+ utils::flatten_join_error(shipping_address_fut),
+ utils::flatten_join_error(billing_address_fut),
+ utils::flatten_join_error(config_update_fut)
)?;
(payment_attempt, shipping_address, billing_address)
}
_ => {
- let (mut payment_attempt, shipping_address, billing_address, _) = futures::try_join!(
- payment_attempt_fut,
- shipping_address_fut,
- billing_address_fut,
- config_update_fut
+ let (mut payment_attempt, shipping_address, billing_address, _) = tokio::try_join!(
+ utils::flatten_join_error(payment_attempt_fut),
+ utils::flatten_join_error(shipping_address_fut),
+ utils::flatten_join_error(billing_address_fut),
+ utils::flatten_join_error(config_update_fut)
)?;
let attempt_type = helpers::get_attempt_type(
@@ -193,11 +266,10 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
(payment_intent, payment_attempt) = attempt_type
.modify_payment_intent_and_payment_attempt(
- // 3
request,
payment_intent,
payment_attempt,
- db,
+ &*state.store,
storage_scheme,
)
.await?;
@@ -445,7 +517,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ state: &'b AppState,
mut payment_data: PaymentData<F>,
customer: Option<domain::Customer>,
storage_scheme: storage_enums::MerchantStorageScheme,
@@ -501,7 +573,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
.payment_method_data
.as_ref()
.async_map(|payment_method_data| async {
- helpers::get_additional_payment_data(payment_method_data, db).await
+ helpers::get_additional_payment_data(payment_method_data, &*state.store).await
})
.await
.as_ref()
@@ -537,76 +609,131 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
.as_ref()
.map(|surcharge_details| surcharge_details.final_amount)
.unwrap_or(payment_data.payment_attempt.amount);
- let payment_attempt_fut = db
- .update_payment_attempt_with_attempt_id(
- payment_data.payment_attempt,
- storage::PaymentAttemptUpdate::ConfirmUpdate {
- amount: payment_data.amount.into(),
- currency: payment_data.currency,
- status: attempt_status,
- payment_method,
- authentication_type,
- browser_info,
- connector,
- payment_token,
- payment_method_data: additional_pm_data,
- payment_method_type,
- payment_experience,
- business_sub_label,
- straight_through_algorithm,
- error_code,
- error_message,
- amount_capturable: Some(authorized_amount),
- updated_by: storage_scheme.to_string(),
- merchant_connector_id,
- },
- storage_scheme,
- )
- .map(|x| x.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound));
-
- let payment_intent_fut = db
- .update_payment_intent(
- payment_data.payment_intent,
- storage::PaymentIntentUpdate::Update {
- amount: payment_data.amount.into(),
- currency: payment_data.currency,
- setup_future_usage,
- status: intent_status,
- customer_id,
- shipping_address_id: shipping_address,
- billing_address_id: billing_address,
- return_url,
- business_country,
- business_label,
- description,
- statement_descriptor_name,
- statement_descriptor_suffix,
- order_details,
- metadata,
- payment_confirm_source: header_payload.payment_confirm_source,
- updated_by: storage_scheme.to_string(),
- },
- storage_scheme,
- )
- .map(|x| x.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound));
- let customer_fut = Box::pin(async {
- if let Some((updated_customer, customer)) = updated_customer.zip(customer) {
- db.update_customer_by_customer_id_merchant_id(
- customer.customer_id.to_owned(),
- customer.merchant_id.to_owned(),
- updated_customer,
- key_store,
+ let m_payment_data_payment_attempt = payment_data.payment_attempt.clone();
+ let m_browser_info = browser_info.clone();
+ let m_connector = connector.clone();
+ 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();
+ let m_straight_through_algorithm = straight_through_algorithm.clone();
+ let m_error_code = error_code.clone();
+ let m_error_message = error_message.clone();
+ let m_db = state.clone().store;
+
+ let payment_attempt_fut = tokio::spawn(
+ async move {
+ m_db.update_payment_attempt_with_attempt_id(
+ m_payment_data_payment_attempt,
+ storage::PaymentAttemptUpdate::ConfirmUpdate {
+ amount: payment_data.amount.into(),
+ currency: payment_data.currency,
+ status: attempt_status,
+ payment_method,
+ authentication_type,
+ browser_info: m_browser_info,
+ connector: m_connector,
+ payment_token: m_payment_token,
+ payment_method_data: m_additional_pm_data,
+ payment_method_type,
+ payment_experience,
+ business_sub_label: m_business_sub_label,
+ straight_through_algorithm: m_straight_through_algorithm,
+ error_code: m_error_code,
+ error_message: m_error_message,
+ amount_capturable: Some(authorized_amount),
+ updated_by: storage_scheme.to_string(),
+ merchant_connector_id,
+ },
+ storage_scheme,
+ )
+ .map(|x| x.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound))
+ .await
+ }
+ .in_current_span(),
+ );
+
+ let m_payment_data_payment_intent = payment_data.payment_intent.clone();
+ let m_customer_id = customer_id.clone();
+ let m_shipping_address_id = shipping_address.clone();
+ let m_billing_address_id = billing_address.clone();
+ let m_return_url = return_url.clone();
+ let m_business_label = business_label.clone();
+ let m_description = description.clone();
+ let m_statement_descriptor_name = statement_descriptor_name.clone();
+ let m_statement_descriptor_suffix = statement_descriptor_suffix.clone();
+ let m_order_details = order_details.clone();
+ let m_metadata = metadata.clone();
+ let m_db = state.clone().store;
+ let m_storage_scheme = storage_scheme.to_string();
+
+ let payment_intent_fut = tokio::spawn(
+ async move {
+ m_db.update_payment_intent(
+ m_payment_data_payment_intent,
+ storage::PaymentIntentUpdate::Update {
+ amount: payment_data.amount.into(),
+ currency: payment_data.currency,
+ setup_future_usage,
+ status: intent_status,
+ customer_id: m_customer_id,
+ shipping_address_id: m_shipping_address_id,
+ billing_address_id: m_billing_address_id,
+ return_url: m_return_url,
+ business_country,
+ business_label: m_business_label,
+ description: m_description,
+ statement_descriptor_name: m_statement_descriptor_name,
+ statement_descriptor_suffix: m_statement_descriptor_suffix,
+ order_details: m_order_details,
+ metadata: m_metadata,
+ payment_confirm_source: header_payload.payment_confirm_source,
+ updated_by: m_storage_scheme,
+ },
+ storage_scheme,
)
+ .map(|x| x.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound))
.await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to update CustomerConnector in customer")?;
+ }
+ .in_current_span(),
+ );
+
+ let customer_fut =
+ if let Some((updated_customer, customer)) = updated_customer.zip(customer) {
+ let m_customer_customer_id = customer.customer_id.to_owned();
+ let m_customer_merchant_id = customer.merchant_id.to_owned();
+ let m_key_store = key_store.clone();
+ let m_updated_customer = updated_customer.clone();
+ let m_db = state.clone().store;
+ tokio::spawn(
+ async move {
+ m_db.update_customer_by_customer_id_merchant_id(
+ m_customer_customer_id,
+ m_customer_merchant_id,
+ m_updated_customer,
+ &m_key_store,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to update CustomerConnector in customer")?;
+
+ Ok::<_, error_stack::Report<errors::ApiErrorResponse>>(())
+ }
+ .in_current_span(),
+ )
+ } else {
+ tokio::spawn(
+ async move { Ok::<_, error_stack::Report<errors::ApiErrorResponse>>(()) }
+ .in_current_span(),
+ )
};
- Ok::<_, error_stack::Report<errors::ApiErrorResponse>>(())
- });
- let (payment_intent, payment_attempt, _) =
- futures::try_join!(payment_intent_fut, payment_attempt_fut, customer_fut)?;
+ let (payment_intent, payment_attempt, _) = tokio::try_join!(
+ utils::flatten_join_error(payment_intent_fut),
+ utils::flatten_join_error(payment_attempt_fut),
+ utils::flatten_join_error(customer_fut)
+ )?;
+
payment_data.payment_intent = payment_intent;
payment_data.payment_attempt = payment_attempt;
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index fad7212c61..974f5e6ab5 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -16,7 +16,7 @@ use crate::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payment_methods::PaymentMethodRetrieve,
payments::{self, helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
- utils::{self as core_utils},
+ utils as core_utils,
},
db::StorageInterface,
routes::AppState,
@@ -394,7 +394,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ state: &'b AppState,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
storage_scheme: enums::MerchantStorageScheme,
@@ -443,7 +443,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
.as_ref()
.map(|surcharge_details| surcharge_details.tax_on_surcharge_amount);
- payment_data.payment_attempt = db
+ payment_data.payment_attempt = state
+ .store
.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt,
storage::PaymentAttemptUpdate::UpdateTrackers {
@@ -466,7 +467,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
let customer_id = payment_data.payment_intent.customer_id.clone();
- payment_data.payment_intent = db
+ payment_data.payment_intent = state
+ .store
.update_payment_intent(
payment_data.payment_intent,
storage::PaymentIntentUpdate::ReturnUrlUpdate {
diff --git a/crates/router/src/core/payments/operations/payment_method_validate.rs b/crates/router/src/core/payments/operations/payment_method_validate.rs
index 7e4fe0951b..62f12cfbc9 100644
--- a/crates/router/src/core/payments/operations/payment_method_validate.rs
+++ b/crates/router/src/core/payments/operations/payment_method_validate.rs
@@ -205,7 +205,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve> UpdateTracker<F, PaymentData<F>, api:
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ state: &'b AppState,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
storage_scheme: storage_enums::MerchantStorageScheme,
@@ -225,7 +225,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve> UpdateTracker<F, PaymentData<F>, api:
let customer_id = payment_data.payment_intent.customer_id.clone();
- payment_data.payment_intent = db
+ payment_data.payment_intent = state
+ .store
.update_payment_intent(
payment_data.payment_intent,
storage::PaymentIntentUpdate::ReturnUrlUpdate {
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index a6c2561aae..16d264c001 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -13,7 +13,6 @@ use crate::{
payment_methods::PaymentMethodRetrieve,
payments::{helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
},
- db::StorageInterface,
routes::AppState,
services,
types::{
@@ -164,7 +163,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ state: &'b AppState,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
storage_scheme: enums::MerchantStorageScheme,
@@ -201,7 +200,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
updated_by: storage_scheme.to_string(),
};
- payment_data.payment_intent = db
+ payment_data.payment_intent = state
+ .store
.update_payment_intent(
payment_data.payment_intent,
intent_status_update,
@@ -210,7 +210,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
- payment_data.payment_attempt = db
+ payment_data.payment_attempt = state
+ .store
.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt.clone(),
attempt_status_update,
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index d6346a512e..b55b0c46f6 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -1,10 +1,13 @@
use std::collections::HashMap;
use async_trait::async_trait;
+use data_models::payments::payment_attempt::PaymentAttempt;
use error_stack::ResultExt;
use futures::FutureExt;
use router_derive;
use router_env::{instrument, tracing};
+use storage_impl::DataModelExt;
+use tracing_futures::Instrument;
use super::{Operation, PostUpdateTracker};
use crate::{
@@ -15,8 +18,7 @@ use crate::{
payments::{types::MultipleCaptureData, PaymentData},
utils as core_utils,
},
- db::StorageInterface,
- routes::metrics,
+ routes::{metrics, AppState},
services::RedirectForm,
types::{
self, api,
@@ -43,7 +45,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthorizeData
{
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
mut payment_data: PaymentData<F>,
router_data: types::RouterData<
@@ -60,13 +62,13 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthorizeData
.mandate_id
.or_else(|| router_data.request.mandate_id.clone());
- payment_data = payment_response_update_tracker(
+ payment_data = Box::pin(payment_response_update_tracker(
db,
payment_id,
payment_data,
router_data,
storage_scheme,
- )
+ ))
.await?;
Ok(payment_data)
@@ -77,7 +79,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthorizeData
impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSyncData> for PaymentResponse {
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
payment_data: PaymentData<F>,
router_data: types::RouterData<F, types::PaymentsSyncData, types::PaymentsResponseData>,
@@ -86,8 +88,14 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSyncData> for
where
F: 'b + Send,
{
- payment_response_update_tracker(db, payment_id, payment_data, router_data, storage_scheme)
- .await
+ Box::pin(payment_response_update_tracker(
+ db,
+ payment_id,
+ payment_data,
+ router_data,
+ storage_scheme,
+ ))
+ .await
}
}
@@ -97,7 +105,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSessionData>
{
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
mut payment_data: PaymentData<F>,
router_data: types::RouterData<F, types::PaymentsSessionData, types::PaymentsResponseData>,
@@ -106,13 +114,13 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSessionData>
where
F: 'b + Send,
{
- payment_data = payment_response_update_tracker(
+ payment_data = Box::pin(payment_response_update_tracker(
db,
payment_id,
payment_data,
router_data,
storage_scheme,
- )
+ ))
.await?;
Ok(payment_data)
@@ -125,7 +133,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsCaptureData>
{
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
mut payment_data: PaymentData<F>,
router_data: types::RouterData<F, types::PaymentsCaptureData, types::PaymentsResponseData>,
@@ -134,13 +142,13 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsCaptureData>
where
F: 'b + Send,
{
- payment_data = payment_response_update_tracker(
+ payment_data = Box::pin(payment_response_update_tracker(
db,
payment_id,
payment_data,
router_data,
storage_scheme,
- )
+ ))
.await?;
Ok(payment_data)
@@ -151,7 +159,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsCaptureData>
impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsCancelData> for PaymentResponse {
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
mut payment_data: PaymentData<F>,
router_data: types::RouterData<F, types::PaymentsCancelData, types::PaymentsResponseData>,
@@ -161,13 +169,13 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsCancelData> f
where
F: 'b + Send,
{
- payment_data = payment_response_update_tracker(
+ payment_data = Box::pin(payment_response_update_tracker(
db,
payment_id,
payment_data,
router_data,
storage_scheme,
- )
+ ))
.await?;
Ok(payment_data)
@@ -180,7 +188,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsApproveData>
{
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
mut payment_data: PaymentData<F>,
router_data: types::RouterData<F, types::PaymentsApproveData, types::PaymentsResponseData>,
@@ -190,13 +198,13 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsApproveData>
where
F: 'b + Send,
{
- payment_data = payment_response_update_tracker(
+ payment_data = Box::pin(payment_response_update_tracker(
db,
payment_id,
payment_data,
router_data,
storage_scheme,
- )
+ ))
.await?;
Ok(payment_data)
@@ -207,7 +215,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsApproveData>
impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsRejectData> for PaymentResponse {
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
mut payment_data: PaymentData<F>,
router_data: types::RouterData<F, types::PaymentsRejectData, types::PaymentsResponseData>,
@@ -217,13 +225,13 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsRejectData> f
where
F: 'b + Send,
{
- payment_data = payment_response_update_tracker(
+ payment_data = Box::pin(payment_response_update_tracker(
db,
payment_id,
payment_data,
router_data,
storage_scheme,
- )
+ ))
.await?;
Ok(payment_data)
@@ -236,7 +244,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestDa
{
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
mut payment_data: PaymentData<F>,
router_data: types::RouterData<
@@ -255,13 +263,13 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestDa
// .map(api_models::payments::MandateIds::new)
});
- payment_data = payment_response_update_tracker(
+ payment_data = Box::pin(payment_response_update_tracker(
db,
payment_id,
payment_data,
router_data,
storage_scheme,
- )
+ ))
.await?;
Ok(payment_data)
@@ -274,7 +282,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::CompleteAuthorizeData
{
async fn update_tracker<'b>(
&'b self,
- db: &dyn StorageInterface,
+ db: &'b AppState,
payment_id: &api::PaymentIdType,
payment_data: PaymentData<F>,
response: types::RouterData<F, types::CompleteAuthorizeData, types::PaymentsResponseData>,
@@ -283,14 +291,20 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::CompleteAuthorizeData
where
F: 'b + Send,
{
- payment_response_update_tracker(db, payment_id, payment_data, response, storage_scheme)
- .await
+ Box::pin(payment_response_update_tracker(
+ db,
+ payment_id,
+ payment_data,
+ response,
+ storage_scheme,
+ ))
+ .await
}
}
#[instrument(skip_all)]
async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
- db: &dyn StorageInterface,
+ state: &AppState,
_payment_id: &api::PaymentIdType,
mut payment_data: PaymentData<F>,
router_data: types::RouterData<F, T, types::PaymentsResponseData>,
@@ -524,7 +538,8 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
payment_data.multiple_capture_data = match capture_update {
Some((mut multiple_capture_data, capture_updates)) => {
for (capture, capture_update) in capture_updates {
- let updated_capture = db
+ let updated_capture = state
+ .store
.update_capture_with_capture_id(capture, capture_update, storage_scheme)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -548,17 +563,43 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
let payment_attempt = payment_data.payment_attempt.clone();
- payment_data.payment_attempt = match payment_attempt_update {
- Some(payment_attempt_update) => db
- .update_payment_attempt_with_attempt_id(
- payment_attempt,
- payment_attempt_update,
- storage_scheme,
+ let m_db = state.clone().store;
+ let m_payment_attempt_update = payment_attempt_update.clone();
+ let m_payment_attempt = payment_attempt.clone();
+
+ let payment_attempt = payment_attempt_update
+ .map(|payment_attempt_update| {
+ PaymentAttempt::from_storage_model(
+ payment_attempt_update
+ .to_storage_model()
+ .apply_changeset(payment_attempt.clone().to_storage_model()),
)
+ })
+ .unwrap_or_else(|| payment_attempt);
+
+ let payment_attempt_fut = tokio::spawn(
+ async move {
+ Box::pin(async move {
+ Ok::<_, error_stack::Report<errors::ApiErrorResponse>>(
+ match m_payment_attempt_update {
+ Some(payment_attempt_update) => m_db
+ .update_payment_attempt_with_attempt_id(
+ m_payment_attempt,
+ payment_attempt_update,
+ storage_scheme,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?,
+ None => m_payment_attempt,
+ },
+ )
+ })
.await
- .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?,
- None => payment_attempt,
- };
+ }
+ .in_current_span(),
+ );
+
+ payment_data.payment_attempt = payment_attempt;
let amount_captured = get_total_amount_captured(
router_data.request,
@@ -566,6 +607,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
router_data.status,
&payment_data,
);
+
let payment_intent_update = match &router_data.response {
Err(_) => storage::PaymentIntentUpdate::PGStatusUpdate {
status: payment_data
@@ -583,25 +625,47 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
},
};
- let payment_intent_fut = db
- .update_payment_intent(
- payment_data.payment_intent.clone(),
- payment_intent_update,
- storage_scheme,
- )
- .map(|x| x.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound));
+ 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();
+ let payment_intent_fut = tokio::spawn(
+ async move {
+ m_db.update_payment_intent(
+ m_payment_data_payment_intent,
+ m_payment_intent_update,
+ storage_scheme,
+ )
+ .map(|x| x.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound))
+ .await
+ }
+ .in_current_span(),
+ );
// When connector requires redirection for mandate creation it can update the connector mandate_id during Psync
- let mandate_update_fut = mandate::update_connector_mandate_id(
- db,
- router_data.merchant_id,
- payment_data.mandate_id.clone(),
- router_data.response.clone(),
+ let m_db = state.clone().store;
+ let m_router_data_merchant_id = router_data.merchant_id.clone();
+ let m_payment_data_mandate_id = payment_data.mandate_id.clone();
+ let m_router_data_response = router_data.response.clone();
+ let mandate_update_fut = tokio::spawn(
+ async move {
+ mandate::update_connector_mandate_id(
+ m_db.as_ref(),
+ m_router_data_merchant_id,
+ m_payment_data_mandate_id,
+ m_router_data_response,
+ )
+ .await
+ }
+ .in_current_span(),
);
- let (payment_intent, _) = futures::try_join!(payment_intent_fut, mandate_update_fut)?;
- payment_data.payment_intent = payment_intent;
+ let (payment_intent, _, _) = futures::try_join!(
+ utils::flatten_join_error(payment_intent_fut),
+ utils::flatten_join_error(mandate_update_fut),
+ utils::flatten_join_error(payment_attempt_fut)
+ )?;
+ payment_data.payment_intent = payment_intent;
Ok(payment_data)
}
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 52677ab3cc..3abde60c2e 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -200,7 +200,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ state: &'b AppState,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
storage_scheme: storage_enums::MerchantStorageScheme,
@@ -217,7 +217,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
{
let metadata = payment_data.payment_intent.metadata.clone();
payment_data.payment_intent = match metadata {
- Some(metadata) => db
+ Some(metadata) => state
+ .store
.update_payment_intent(
payment_data.payment_intent,
storage::PaymentIntentUpdate::MetadataUpdate {
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 5578f6b3dc..17f39d5150 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -174,7 +174,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- _db: &dyn StorageInterface,
+ _state: &'b AppState,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
_storage_scheme: storage_enums::MerchantStorageScheme,
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 83e7131b26..fb58aeb34e 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -132,7 +132,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
{
async fn update_trackers<'b>(
&'b self,
- _db: &dyn StorageInterface,
+ _state: &'b AppState,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
_storage_scheme: enums::MerchantStorageScheme,
@@ -157,7 +157,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
{
async fn update_trackers<'b>(
&'b self,
- _db: &dyn StorageInterface,
+ _state: &'b AppState,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
_storage_scheme: enums::MerchantStorageScheme,
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 26bda6d6be..53a768f268 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -422,7 +422,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
#[instrument(skip_all)]
async fn update_trackers<'b>(
&'b self,
- db: &dyn StorageInterface,
+ state: &'b AppState,
mut payment_data: PaymentData<F>,
customer: Option<domain::Customer>,
storage_scheme: storage_enums::MerchantStorageScheme,
@@ -456,7 +456,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
.payment_method_data
.as_ref()
.async_map(|payment_method_data| async {
- helpers::get_additional_payment_data(payment_method_data, db).await
+ helpers::get_additional_payment_data(payment_method_data, &*state.store).await
})
.await
.as_ref()
@@ -471,6 +471,7 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
let payment_experience = payment_data.payment_attempt.payment_experience;
let amount_to_capture = payment_data.payment_attempt.amount_to_capture;
let capture_method = payment_data.payment_attempt.capture_method;
+
let surcharge_amount = payment_data
.surcharge_details
.as_ref()
@@ -479,7 +480,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
.surcharge_details
.as_ref()
.map(|surcharge_details| surcharge_details.tax_on_surcharge_amount);
- payment_data.payment_attempt = db
+ payment_data.payment_attempt = state
+ .store
.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt,
storage::PaymentAttemptUpdate::Update {
@@ -540,7 +542,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
let order_details = payment_data.payment_intent.order_details.clone();
let metadata = payment_data.payment_intent.metadata.clone();
- payment_data.payment_intent = db
+ payment_data.payment_intent = state
+ .store
.update_payment_intent(
payment_data.payment_intent,
storage::PaymentIntentUpdate::Update {
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index ba4d7f6549..db53a3b56a 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -79,29 +79,35 @@ pub async fn payments_incoming_webhook_flow<
.perform_locking_action(&state, merchant_account.merchant_id.to_string())
.await?;
- let response =
- payments::payments_core::<api::PSync, api::PaymentsResponse, _, _, _, Ctx>(
- state.clone(),
- merchant_account.clone(),
- key_store,
- payments::operations::PaymentStatus,
- api::PaymentsRetrieveRequest {
- resource_id: id,
- merchant_id: Some(merchant_account.merchant_id.clone()),
- force_sync: true,
- connector: None,
- param: None,
- merchant_connector_details: None,
- client_secret: None,
- expand_attempts: None,
- expand_captures: None,
- },
- services::AuthFlow::Merchant,
- consume_or_trigger_flow,
- None,
- HeaderPayload::default(),
- )
- .await;
+ let response = Box::pin(payments::payments_core::<
+ api::PSync,
+ api::PaymentsResponse,
+ _,
+ _,
+ _,
+ Ctx,
+ >(
+ state.clone(),
+ merchant_account.clone(),
+ key_store,
+ payments::operations::PaymentStatus,
+ api::PaymentsRetrieveRequest {
+ resource_id: id,
+ merchant_id: Some(merchant_account.merchant_id.clone()),
+ force_sync: true,
+ connector: None,
+ param: None,
+ merchant_connector_details: None,
+ client_secret: None,
+ expand_attempts: None,
+ expand_captures: None,
+ },
+ services::AuthFlow::Merchant,
+ consume_or_trigger_flow,
+ None,
+ HeaderPayload::default(),
+ ))
+ .await;
lock_action
.free_lock_action(&state, merchant_account.merchant_id.to_owned())
@@ -572,7 +578,14 @@ async fn bank_transfer_webhook_flow<W: types::OutgoingWebhookType, Ctx: PaymentM
payment_token: payment_attempt.payment_token,
..Default::default()
};
- payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _, Ctx>(
+ Box::pin(payments::payments_core::<
+ api::Authorize,
+ api::PaymentsResponse,
+ _,
+ _,
+ _,
+ Ctx,
+ >(
state.clone(),
merchant_account.to_owned(),
key_store,
@@ -582,7 +595,7 @@ async fn bank_transfer_webhook_flow<W: types::OutgoingWebhookType, Ctx: PaymentM
payments::CallConnectorAction::Trigger,
None,
HeaderPayload::default(),
- )
+ ))
.await
} else {
Err(report!(
@@ -854,14 +867,14 @@ pub async fn webhooks_wrapper<W: types::OutgoingWebhookType, Ctx: PaymentMethodR
connector_name_or_mca_id: &str,
body: actix_web::web::Bytes,
) -> RouterResponse<serde_json::Value> {
- let (application_response, _webhooks_response_tracker) = webhooks_core::<W, Ctx>(
+ let (application_response, _webhooks_response_tracker) = Box::pin(webhooks_core::<W, Ctx>(
state,
req,
merchant_account,
key_store,
connector_name_or_mca_id,
body,
- )
+ ))
.await?;
Ok(application_response)
@@ -1089,18 +1102,18 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType, Ctx: PaymentMethodRetr
})?;
match flow_type {
- api::WebhookFlow::Payment => payments_incoming_webhook_flow::<W, Ctx>(
+ api::WebhookFlow::Payment => Box::pin(payments_incoming_webhook_flow::<W, Ctx>(
state.clone(),
merchant_account,
business_profile,
key_store,
webhook_details,
source_verified,
- )
+ ))
.await
.attach_printable("Incoming webhook flow for payments failed")?,
- api::WebhookFlow::Refund => refunds_incoming_webhook_flow::<W>(
+ api::WebhookFlow::Refund => Box::pin(refunds_incoming_webhook_flow::<W>(
state.clone(),
merchant_account,
business_profile,
@@ -1109,7 +1122,7 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType, Ctx: PaymentMethodRetr
connector_name.as_str(),
source_verified,
event_type,
- )
+ ))
.await
.attach_printable("Incoming webhook flow for refunds failed")?,
@@ -1126,14 +1139,14 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType, Ctx: PaymentMethodRetr
.await
.attach_printable("Incoming webhook flow for disputes failed")?,
- api::WebhookFlow::BankTransfer => bank_transfer_webhook_flow::<W, Ctx>(
+ api::WebhookFlow::BankTransfer => Box::pin(bank_transfer_webhook_flow::<W, Ctx>(
state.clone(),
merchant_account,
business_profile,
key_store,
webhook_details,
source_verified,
- )
+ ))
.await
.attach_printable("Incoming bank-transfer webhook flow failed")?,
diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs
index 9244fc022d..689d1f9c78 100644
--- a/crates/router/src/db/address.rs
+++ b/crates/router/src/db/address.rs
@@ -339,7 +339,7 @@ mod storage {
MerchantStorageScheme::RedisKv => {
let key = format!("mid_{}_pid_{}", merchant_id, payment_id);
let field = format!("add_{}", address_id);
- db_utils::try_redis_get_else_try_database_get(
+ Box::pin(db_utils::try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
@@ -350,7 +350,7 @@ mod storage {
.try_into_hget()
},
database_call,
- )
+ ))
.await
}
}?;
diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs
index c9b9f8ac55..8ac8bd106e 100644
--- a/crates/router/src/db/refund.rs
+++ b/crates/router/src/db/refund.rs
@@ -310,7 +310,7 @@ mod storage {
.await?;
let key = &lookup.pk_id;
- db_utils::try_redis_get_else_try_database_get(
+ Box::pin(db_utils::try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
@@ -321,7 +321,7 @@ mod storage {
.try_into_hget()
},
database_call,
- )
+ ))
.await
}
}
@@ -490,7 +490,7 @@ mod storage {
let pattern = db_utils::generate_hscan_pattern_for_refund(&lookup.sk_id);
- db_utils::try_redis_get_else_try_database_get(
+ Box::pin(db_utils::try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
@@ -501,7 +501,7 @@ mod storage {
.try_into_scan()
},
database_call,
- )
+ ))
.await
}
}
@@ -581,7 +581,7 @@ mod storage {
.await?;
let key = &lookup.pk_id;
- db_utils::try_redis_get_else_try_database_get(
+ Box::pin(db_utils::try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
@@ -592,7 +592,7 @@ mod storage {
.try_into_hget()
},
database_call,
- )
+ ))
.await
}
}
@@ -626,7 +626,7 @@ mod storage {
.await?;
let key = &lookup.pk_id;
- db_utils::try_redis_get_else_try_database_get(
+ Box::pin(db_utils::try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
@@ -637,7 +637,7 @@ mod storage {
.try_into_hget()
},
database_call,
- )
+ ))
.await
}
}
@@ -664,7 +664,7 @@ mod storage {
enums::MerchantStorageScheme::PostgresOnly => database_call().await,
enums::MerchantStorageScheme::RedisKv => {
let key = format!("mid_{merchant_id}_pid_{payment_id}");
- db_utils::try_redis_get_else_try_database_get(
+ Box::pin(db_utils::try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
@@ -675,7 +675,7 @@ mod storage {
.try_into_scan()
},
database_call,
- )
+ ))
.await
}
}
diff --git a/crates/router/src/db/reverse_lookup.rs b/crates/router/src/db/reverse_lookup.rs
index 4a4056032b..445e171fa2 100644
--- a/crates/router/src/db/reverse_lookup.rs
+++ b/crates/router/src/db/reverse_lookup.rs
@@ -150,7 +150,11 @@ mod storage {
.try_into_get()
};
- db_utils::try_redis_get_else_try_database_get(redis_fut, database_call).await
+ Box::pin(db_utils::try_redis_get_else_try_database_get(
+ redis_fut,
+ database_call,
+ ))
+ .await
}
}
}
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index e106eb06a7..a3ed0b35c7 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -189,7 +189,7 @@ pub async fn start_server(conf: settings::Settings) -> ApplicationResult<Server>
errors::ApplicationError::ApiClientError(error.current_context().clone())
})?,
);
- let state = routes::AppState::new(conf, tx, api_client).await;
+ let state = Box::pin(routes::AppState::new(conf, tx, api_client)).await;
let request_body_limit = server.request_body_limit;
let server = actix_web::HttpServer::new(move || mk_app(state.clone(), request_body_limit))
.bind((server.host.as_str(), server.port))?
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index a8eda22402..eef8cacc5f 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -30,7 +30,7 @@ pub async fn merchant_account_create(
json_payload: web::Json<admin::MerchantAccountCreate>,
) -> HttpResponse {
let flow = Flow::MerchantsAccountCreate;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -38,7 +38,7 @@ pub async fn merchant_account_create(
|state, _, req| create_merchant_account(state, req),
&auth::AdminApiAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Merchant Account - Retrieve
@@ -131,7 +131,7 @@ pub async fn update_merchant_account(
) -> HttpResponse {
let flow = Flow::MerchantsAccountUpdate;
let merchant_id = mid.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -145,7 +145,7 @@ pub async fn update_merchant_account(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
@@ -210,7 +210,7 @@ pub async fn payment_connector_create(
) -> HttpResponse {
let flow = Flow::MerchantConnectorsCreate;
let merchant_id = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -224,7 +224,7 @@ pub async fn payment_connector_create(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Merchant Connector - Retrieve
@@ -450,7 +450,7 @@ pub async fn business_profile_create(
let payload = json_payload.into_inner();
let merchant_id = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -464,7 +464,7 @@ pub async fn business_profile_create(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileRetrieve))]
diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs
index 1f71f1dc28..7299aa6963 100644
--- a/crates/router/src/routes/api_keys.rs
+++ b/crates/router/src/routes/api_keys.rs
@@ -36,7 +36,7 @@ pub async fn api_key_create(
let payload = json_payload.into_inner();
let merchant_id = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -61,7 +61,7 @@ pub async fn api_key_create(
req.headers(),
),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// API Key - Retrieve
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 7f5c720be6..15b6df7334 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -112,56 +112,59 @@ impl AppState {
shut_down_signal: oneshot::Sender<()>,
api_client: Box<dyn crate::services::ApiClient>,
) -> Self {
- #[cfg(feature = "kms")]
- let kms_client = kms::get_kms_client(&conf.kms).await;
- let testable = storage_impl == StorageImpl::PostgresqlTest;
- let store: Box<dyn StorageInterface> = match storage_impl {
- StorageImpl::Postgresql | StorageImpl::PostgresqlTest => Box::new(
+ Box::pin(async move {
+ #[cfg(feature = "kms")]
+ let kms_client = kms::get_kms_client(&conf.kms).await;
+ let testable = storage_impl == StorageImpl::PostgresqlTest;
+ let store: Box<dyn StorageInterface> = match storage_impl {
+ StorageImpl::Postgresql | StorageImpl::PostgresqlTest => Box::new(
+ #[allow(clippy::expect_used)]
+ get_store(&conf, shut_down_signal, testable)
+ .await
+ .expect("Failed to create store"),
+ ),
#[allow(clippy::expect_used)]
- get_store(&conf, shut_down_signal, testable)
- .await
- .expect("Failed to create store"),
- ),
- #[allow(clippy::expect_used)]
- StorageImpl::Mock => Box::new(
- MockDb::new(&conf.redis)
- .await
- .expect("Failed to create mock store"),
- ),
- };
+ StorageImpl::Mock => Box::new(
+ MockDb::new(&conf.redis)
+ .await
+ .expect("Failed to create mock store"),
+ ),
+ };
+
+ #[cfg(feature = "olap")]
+ let pool = crate::analytics::AnalyticsProvider::from_conf(
+ &conf.analytics,
+ #[cfg(feature = "kms")]
+ kms_client,
+ )
+ .await;
- #[cfg(feature = "olap")]
- let pool = crate::analytics::AnalyticsProvider::from_conf(
- &conf.analytics,
#[cfg(feature = "kms")]
- kms_client,
- )
- .await;
-
- #[cfg(feature = "kms")]
- #[allow(clippy::expect_used)]
- let kms_secrets = settings::ActiveKmsSecrets {
- jwekey: conf.jwekey.clone().into(),
- }
- .decrypt_inner(kms_client)
- .await
- .expect("Failed while performing KMS decryption");
-
- #[cfg(feature = "email")]
- let email_client = Arc::new(AwsSes::new(&conf.email).await);
- Self {
- flow_name: String::from("default"),
- store,
- conf: Arc::new(conf),
+ #[allow(clippy::expect_used)]
+ let kms_secrets = settings::ActiveKmsSecrets {
+ jwekey: conf.jwekey.clone().into(),
+ }
+ .decrypt_inner(kms_client)
+ .await
+ .expect("Failed while performing KMS decryption");
+
#[cfg(feature = "email")]
- email_client,
- #[cfg(feature = "kms")]
- kms_secrets: Arc::new(kms_secrets),
- api_client,
- event_handler: Box::<EventLogger>::default(),
- #[cfg(feature = "olap")]
- pool,
- }
+ let email_client = Arc::new(AwsSes::new(&conf.email).await);
+ Self {
+ flow_name: String::from("default"),
+ store,
+ conf: Arc::new(conf),
+ #[cfg(feature = "email")]
+ email_client,
+ #[cfg(feature = "kms")]
+ kms_secrets: Arc::new(kms_secrets),
+ api_client,
+ event_handler: Box::<EventLogger>::default(),
+ #[cfg(feature = "olap")]
+ pool,
+ }
+ })
+ .await
}
pub async fn new(
@@ -169,7 +172,13 @@ impl AppState {
shut_down_signal: oneshot::Sender<()>,
api_client: Box<dyn crate::services::ApiClient>,
) -> Self {
- Self::with_storage(conf, StorageImpl::Postgresql, shut_down_signal, api_client).await
+ Box::pin(Self::with_storage(
+ conf,
+ StorageImpl::Postgresql,
+ shut_down_signal,
+ api_client,
+ ))
+ .await
}
}
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index ff2ffc2a3f..cfc37cbdbb 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -30,7 +30,7 @@ pub async fn customers_create(
json_payload: web::Json<customers::CustomerRequest>,
) -> HttpResponse {
let flow = Flow::CustomersCreate;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -38,7 +38,7 @@ pub async fn customers_create(
|state, auth, req| create_customer(state, auth.merchant_account, auth.key_store, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Retrieve Customer
@@ -142,7 +142,7 @@ pub async fn customers_update(
let flow = Flow::CustomersUpdate;
let customer_id = path.into_inner();
json_payload.customer_id = customer_id;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -150,7 +150,7 @@ pub async fn customers_update(
|state, auth, req| update_customer(state, auth.merchant_account, req, auth.key_store),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Delete Customer
@@ -179,7 +179,7 @@ pub async fn customers_delete(
customer_id: path.into_inner(),
})
.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -187,7 +187,7 @@ pub async fn customers_delete(
|state, auth, req| delete_customer(state, auth.merchant_account, req, auth.key_store),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::CustomersGetMandates))]
diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rs
index d570a53196..aaeb118645 100644
--- a/crates/router/src/routes/disputes.rs
+++ b/crates/router/src/routes/disputes.rs
@@ -117,7 +117,7 @@ pub async fn accept_dispute(
let dispute_id = dispute_types::DisputeId {
dispute_id: path.into_inner(),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -127,7 +127,7 @@ pub async fn accept_dispute(
},
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Disputes - Submit Dispute Evidence
@@ -150,7 +150,7 @@ pub async fn submit_dispute_evidence(
json_payload: web::Json<dispute_models::SubmitEvidenceRequest>,
) -> HttpResponse {
let flow = Flow::DisputesEvidenceSubmit;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -160,7 +160,7 @@ pub async fn submit_dispute_evidence(
},
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Disputes - Attach Evidence to Dispute
@@ -191,7 +191,7 @@ pub async fn attach_dispute_evidence(
Ok(valid_request) => valid_request,
Err(err) => return api::log_and_return_error_response(err),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -201,7 +201,7 @@ pub async fn attach_dispute_evidence(
},
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Diputes - Retrieve Dispute
@@ -229,7 +229,7 @@ pub async fn retrieve_dispute_evidence(
let dispute_id = dispute_types::DisputeId {
dispute_id: path.into_inner(),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -237,6 +237,6 @@ pub async fn retrieve_dispute_evidence(
|state, auth, req| disputes::retrieve_dispute_evidence(state, auth.merchant_account, req),
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/files.rs b/crates/router/src/routes/files.rs
index 4a327ba080..bde221ebc1 100644
--- a/crates/router/src/routes/files.rs
+++ b/crates/router/src/routes/files.rs
@@ -39,7 +39,7 @@ pub async fn files_create(
Ok(valid_request) => valid_request,
Err(err) => return api::log_and_return_error_response(err),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -47,7 +47,7 @@ pub async fn files_create(
|state, auth, req| files_create_core(state, auth.merchant_account, auth.key_store, req),
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Files - Delete
@@ -77,7 +77,7 @@ pub async fn files_delete(
let file_id = files::FileId {
file_id: path.into_inner(),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -85,7 +85,7 @@ pub async fn files_delete(
|state, auth, req| files_delete_core(state, auth.merchant_account, req),
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Files - Retrieve
@@ -115,7 +115,7 @@ pub async fn files_retrieve(
let file_id = files::FileId {
file_id: path.into_inner(),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -123,6 +123,6 @@ pub async fn files_retrieve(
|state, auth, req| files_retrieve_core(state, auth.merchant_account, auth.key_store, req),
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/payment_link.rs b/crates/router/src/routes/payment_link.rs
index b664ee4429..7d6bf1a05f 100644
--- a/crates/router/src/routes/payment_link.rs
+++ b/crates/router/src/routes/payment_link.rs
@@ -62,7 +62,7 @@ pub async fn initiate_payment_link(
payment_id,
merchant_id: merchant_id.clone(),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -77,6 +77,6 @@ pub async fn initiate_payment_link(
},
&crate::services::authentication::MerchantIdAuth(merchant_id),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index faaf757fd7..83d4c7f966 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -34,7 +34,7 @@ pub async fn create_payment_method_api(
json_payload: web::Json<payment_methods::PaymentMethodCreate>,
) -> HttpResponse {
let flow = Flow::PaymentMethodsCreate;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -44,7 +44,7 @@ pub async fn create_payment_method_api(
},
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// List payment methods for a Merchant
@@ -84,7 +84,7 @@ pub async fn list_payment_method_api(
Err(e) => return api::log_and_return_error_response(e),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -94,7 +94,7 @@ pub async fn list_payment_method_api(
},
&*auth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// List payment methods for a Customer
@@ -135,7 +135,7 @@ pub async fn list_customer_payment_method_api(
Err(e) => return api::log_and_return_error_response(e),
};
let customer_id = customer_id.into_inner().0;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -151,7 +151,7 @@ pub async fn list_customer_payment_method_api(
},
&*auth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// List payment methods for a Customer
@@ -191,7 +191,7 @@ pub async fn list_customer_payment_method_api_client(
Ok((auth, _auth_flow)) => (auth, _auth_flow),
Err(e) => return api::log_and_return_error_response(e),
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -207,7 +207,7 @@ pub async fn list_customer_payment_method_api_client(
},
&*auth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Payment Method - Retrieve
@@ -239,7 +239,7 @@ pub async fn payment_method_retrieve_api(
})
.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -247,7 +247,7 @@ pub async fn payment_method_retrieve_api(
|state, _auth, pm| cards::retrieve_payment_method(state, pm),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Payment Method - Update
@@ -278,7 +278,7 @@ pub async fn payment_method_update_api(
let flow = Flow::PaymentMethodsUpdate;
let payment_method_id = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -294,7 +294,7 @@ pub async fn payment_method_update_api(
},
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Payment Method - Delete
@@ -324,7 +324,7 @@ pub async fn payment_method_delete_api(
let pm = PaymentMethodId {
payment_method_id: payment_method_id.into_inner().0,
};
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -332,7 +332,7 @@ pub async fn payment_method_delete_api(
|state, auth, req| cards::delete_payment_method(state, auth.merchant_account, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
#[cfg(test)]
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index ed36721da4..b05fae6533 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -102,7 +102,7 @@ pub async fn payments_create(
let locking_action = payload.get_locking_input(flow.clone());
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -123,7 +123,7 @@ pub async fn payments_create(
_ => auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
},
locking_action,
- )
+ ))
.await
}
// /// Payments - Redirect
@@ -160,7 +160,7 @@ pub async fn payments_start(
let locking_action = payload.get_locking_input(flow.clone());
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -187,7 +187,7 @@ pub async fn payments_start(
},
&auth::MerchantIdAuth(merchant_id),
locking_action,
- )
+ ))
.await
}
/// Payments - Retrieve
@@ -234,7 +234,7 @@ pub async fn payments_retrieve(
let locking_action = payload.get_locking_input(flow.clone());
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -258,7 +258,7 @@ pub async fn payments_retrieve(
req.headers(),
),
locking_action,
- )
+ ))
.await
}
/// Payments - Retrieve with gateway credentials
@@ -300,7 +300,7 @@ pub async fn payments_retrieve_with_gateway_creds(
let locking_action = payload.get_locking_input(flow.clone());
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -320,7 +320,7 @@ pub async fn payments_retrieve_with_gateway_creds(
},
&*auth_type,
locking_action,
- )
+ ))
.await
}
/// Payments - Update
@@ -367,7 +367,7 @@ pub async fn payments_update(
let locking_action = payload.get_locking_input(flow.clone());
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -385,7 +385,7 @@ pub async fn payments_update(
},
&*auth_type,
locking_action,
- )
+ ))
.await
}
/// Payments - Confirm
@@ -443,7 +443,7 @@ pub async fn payments_confirm(
let locking_action = payload.get_locking_input(flow.clone());
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -461,7 +461,7 @@ pub async fn payments_confirm(
},
&*auth_type,
locking_action,
- )
+ ))
.await
}
/// Payments - Capture
@@ -498,7 +498,7 @@ pub async fn payments_capture(
let locking_action = payload.get_locking_input(flow.clone());
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -525,7 +525,7 @@ pub async fn payments_capture(
},
&auth::ApiKeyAuth,
locking_action,
- )
+ ))
.await
}
/// Payments - Session token
@@ -554,7 +554,7 @@ pub async fn payments_connector_session(
let locking_action = payload.get_locking_input(flow.clone());
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -581,7 +581,7 @@ pub async fn payments_connector_session(
},
&auth::PublishableKeyAuth,
locking_action,
- )
+ ))
.await
}
// /// Payments - Redirect response
@@ -772,7 +772,7 @@ pub async fn payments_cancel(
let payment_id = path.into_inner();
payload.payment_id = payment_id;
let locking_action = payload.get_locking_input(flow.clone());
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -792,7 +792,7 @@ pub async fn payments_cancel(
},
&auth::ApiKeyAuth,
locking_action,
- )
+ ))
.await
}
/// Payments - List
diff --git a/crates/router/src/routes/payouts.rs b/crates/router/src/routes/payouts.rs
index 15cf59aaf3..cc47263a0c 100644
--- a/crates/router/src/routes/payouts.rs
+++ b/crates/router/src/routes/payouts.rs
@@ -33,7 +33,7 @@ pub async fn payouts_create(
json_payload: web::Json<payout_types::PayoutCreateRequest>,
) -> HttpResponse {
let flow = Flow::PayoutsCreate;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -41,7 +41,7 @@ pub async fn payouts_create(
|state, auth, req| payouts_create_core(state, auth.merchant_account, auth.key_store, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Payouts - Retrieve
@@ -72,7 +72,7 @@ pub async fn payouts_retrieve(
force_sync: query_params.force_sync,
};
let flow = Flow::PayoutsRetrieve;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -80,7 +80,7 @@ pub async fn payouts_retrieve(
|state, auth, req| payouts_retrieve_core(state, auth.merchant_account, auth.key_store, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Payouts - Update
@@ -111,7 +111,7 @@ pub async fn payouts_update(
let payout_id = path.into_inner();
let mut payout_update_payload = json_payload.into_inner();
payout_update_payload.payout_id = Some(payout_id);
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -119,7 +119,7 @@ pub async fn payouts_update(
|state, auth, req| payouts_update_core(state, auth.merchant_account, auth.key_store, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Payouts - Cancel
@@ -150,7 +150,7 @@ pub async fn payouts_cancel(
let mut payload = json_payload.into_inner();
payload.payout_id = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -158,7 +158,7 @@ pub async fn payouts_cancel(
|state, auth, req| payouts_cancel_core(state, auth.merchant_account, auth.key_store, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Payouts - Fulfill
@@ -189,7 +189,7 @@ pub async fn payouts_fulfill(
let mut payload = json_payload.into_inner();
payload.payout_id = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -197,7 +197,7 @@ pub async fn payouts_fulfill(
|state, auth, req| payouts_fulfill_core(state, auth.merchant_account, auth.key_store, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::PayoutsAccounts))]
diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs
index d1f5cb56fe..d370af6b8d 100644
--- a/crates/router/src/routes/refunds.rs
+++ b/crates/router/src/routes/refunds.rs
@@ -31,7 +31,7 @@ pub async fn refunds_create(
json_payload: web::Json<refunds::RefundRequest>,
) -> HttpResponse {
let flow = Flow::RefundsCreate;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -39,7 +39,7 @@ pub async fn refunds_create(
|state, auth, req| refund_create_core(state, auth.merchant_account, auth.key_store, req),
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Refunds - Retrieve (GET)
@@ -74,7 +74,7 @@ pub async fn refunds_retrieve(
};
let flow = Flow::RefundsRetrieve;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -90,7 +90,7 @@ pub async fn refunds_retrieve(
},
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Refunds - Retrieve (POST)
@@ -115,7 +115,7 @@ pub async fn refunds_retrieve_with_body(
json_payload: web::Json<refunds::RefundsRetrieveRequest>,
) -> HttpResponse {
let flow = Flow::RefundsRetrieve;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -131,7 +131,7 @@ pub async fn refunds_retrieve_with_body(
},
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
/// Refunds - Update
diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs
index 2ad061848c..d0525bb272 100644
--- a/crates/router/src/routes/verification.rs
+++ b/crates/router/src/routes/verification.rs
@@ -18,7 +18,7 @@ pub async fn apple_pay_merchant_registration(
let flow = Flow::Verification;
let merchant_id = path.into_inner();
let kms_conf = &state.clone().conf.kms;
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -34,7 +34,7 @@ pub async fn apple_pay_merchant_registration(
},
auth::auth_type(&auth::ApiKeyAuth, &auth::JWTAuth, req.headers()),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/routes/webhooks.rs b/crates/router/src/routes/webhooks.rs
index 5c90e46bb9..63f2328ec6 100644
--- a/crates/router/src/routes/webhooks.rs
+++ b/crates/router/src/routes/webhooks.rs
@@ -21,7 +21,7 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
let flow = Flow::IncomingWebhookReceive;
let (merchant_id, connector_id_or_name) = path.into_inner();
- api::server_wrap(
+ Box::pin(api::server_wrap(
flow,
state,
&req,
@@ -38,6 +38,6 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
},
&auth::MerchantIdAuth(merchant_id),
api_locking::LockAction::NotApplicable,
- )
+ ))
.await
}
diff --git a/crates/router/src/types/domain/customer.rs b/crates/router/src/types/domain/customer.rs
index 3810523b41..fe575851dc 100644
--- a/crates/router/src/types/domain/customer.rs
+++ b/crates/router/src/types/domain/customer.rs
@@ -99,7 +99,7 @@ impl super::behaviour::Conversion for Customer {
}
}
-#[derive(Debug)]
+#[derive(Clone, Debug)]
pub enum CustomerUpdate {
Update {
name: crypto::OptionalEncryptableName,
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index aadb714e8c..4933b4d700 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -753,9 +753,11 @@ where
if let services::ApplicationResponse::JsonWithHeaders((payments_response_json, _)) =
payments_response
{
+ let m_state = state.clone();
+
Box::pin(
webhooks_core::create_event_and_trigger_appropriate_outgoing_webhook(
- state.clone(),
+ m_state,
merchant_account,
business_profile,
event_type,
@@ -772,3 +774,16 @@ where
Ok(())
}
+
+type Handle<T> = tokio::task::JoinHandle<RouterResult<T>>;
+
+pub async fn flatten_join_error<T>(handle: Handle<T>) -> RouterResult<T> {
+ match handle.await {
+ Ok(Ok(t)) => Ok(t),
+ Ok(Err(err)) => Err(err),
+ Err(err) => Err(err)
+ .into_report()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Join Error"),
+ }
+}
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index f41b300c51..00e7357d89 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -61,7 +61,13 @@ impl ProcessTrackerWorkflow<AppState> for PaymentsSyncWorkflow {
.await?;
let (mut payment_data, _, customer, _, _) =
- payment_flows::payments_operation_core::<api::PSync, _, _, _, Oss>(
+ Box::pin(payment_flows::payments_operation_core::<
+ api::PSync,
+ _,
+ _,
+ _,
+ Oss,
+ >(
state,
merchant_account.clone(),
key_store,
@@ -71,7 +77,7 @@ impl ProcessTrackerWorkflow<AppState> for PaymentsSyncWorkflow {
services::AuthFlow::Client,
None,
api::HeaderPayload::default(),
- )
+ ))
.await?;
let terminal_status = [
@@ -169,7 +175,11 @@ impl ProcessTrackerWorkflow<AppState> for PaymentsSyncWorkflow {
// Trigger the outgoing webhook to notify the merchant about failed payment
let operation = operations::PaymentStatus;
- utils::trigger_payments_webhook::<_, api_models::payments::PaymentsRequest, _>(
+ Box::pin(utils::trigger_payments_webhook::<
+ _,
+ api_models::payments::PaymentsRequest,
+ _,
+ >(
merchant_account,
business_profile,
payment_data,
@@ -177,7 +187,7 @@ impl ProcessTrackerWorkflow<AppState> for PaymentsSyncWorkflow {
customer,
state,
operation,
- )
+ ))
.await
.map_err(|error| logger::warn!(payments_outgoing_webhook_error=?error))
.ok();
diff --git a/crates/router/src/workflows/refund_router.rs b/crates/router/src/workflows/refund_router.rs
index 8ca3551cfc..934c208f91 100644
--- a/crates/router/src/workflows/refund_router.rs
+++ b/crates/router/src/workflows/refund_router.rs
@@ -13,7 +13,7 @@ impl ProcessTrackerWorkflow<AppState> for RefundWorkflowRouter {
state: &'a AppState,
process: storage::ProcessTracker,
) -> Result<(), errors::ProcessTrackerError> {
- Ok(refund_flow::start_refund_workflow(state, &process).await?)
+ Ok(Box::pin(refund_flow::start_refund_workflow(state, &process)).await?)
}
async fn error_handler<'a>(
diff --git a/crates/router/tests/cache.rs b/crates/router/tests/cache.rs
index e1fd3a0f02..4de45c7132 100644
--- a/crates/router/tests/cache.rs
+++ b/crates/router/tests/cache.rs
@@ -7,10 +7,14 @@ mod utils;
#[actix_web::test]
async fn invalidate_existing_cache_success() {
// Arrange
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let (tx, _) = tokio::sync::oneshot::channel();
- let state =
- routes::AppState::new(Settings::default(), tx, Box::new(services::MockApiClient)).await;
+ let state = Box::pin(routes::AppState::new(
+ Settings::default(),
+ tx,
+ Box::new(services::MockApiClient),
+ ))
+ .await;
let cache_key = "cacheKey".to_string();
let cache_key_value = "val".to_string();
@@ -53,7 +57,7 @@ async fn invalidate_existing_cache_success() {
#[actix_web::test]
async fn invalidate_non_existing_cache_success() {
// Arrange
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let cache_key = "cacheKey".to_string();
let api_key = ("api-key", "test_admin");
let client = awc::Client::default();
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 1f450a19e7..67a0625968 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -80,7 +80,7 @@ pub trait ConnectorActions: Connector {
)
.await;
integration.execute_pretasks(&mut request, &state).await?;
- call_connector(request, integration).await
+ Box::pin(call_connector(request, integration)).await
}
async fn create_connector_customer(
@@ -104,7 +104,7 @@ pub trait ConnectorActions: Connector {
)
.await;
integration.execute_pretasks(&mut request, &state).await?;
- call_connector(request, integration).await
+ Box::pin(call_connector(request, integration)).await
}
async fn create_connector_pm_token(
@@ -128,7 +128,7 @@ pub trait ConnectorActions: Connector {
)
.await;
integration.execute_pretasks(&mut request, &state).await?;
- call_connector(request, integration).await
+ Box::pin(call_connector(request, integration)).await
}
/// For initiating payments when `CaptureMethod` is set to `Automatic`
@@ -156,7 +156,7 @@ pub trait ConnectorActions: Connector {
)
.await;
integration.execute_pretasks(&mut request, &state).await?;
- call_connector(request, integration).await
+ Box::pin(call_connector(request, integration)).await
}
async fn sync_payment(
@@ -169,7 +169,7 @@ pub trait ConnectorActions: Connector {
payment_data.unwrap_or_else(|| PaymentSyncType::default().0),
payment_info,
);
- call_connector(request, integration).await
+ Box::pin(call_connector(request, integration)).await
}
/// will retry the psync till the given status matches or retry max 3 times
@@ -207,7 +207,7 @@ pub trait ConnectorActions: Connector {
},
payment_info,
);
- call_connector(request, integration).await
+ Box::pin(call_connector(request, integration)).await
}
async fn authorize_and_capture_payment(
@@ -243,7 +243,7 @@ pub trait ConnectorActions: Connector {
},
payment_info,
);
- call_connector(request, integration).await
+ Box::pin(call_connector(request, integration)).await
}
async fn authorize_and_void_payment(
@@ -280,7 +280,7 @@ pub trait ConnectorActions: Connector {
},
payment_info,
);
- call_connector(request, integration).await
+ Box::pin(call_connector(request, integration)).await
}
async fn capture_payment_and_refund(
@@ -400,7 +400,7 @@ pub trait ConnectorActions: Connector {
}),
payment_info,
);
- call_connector(request, integration).await
+ Box::pin(call_connector(request, integration)).await
}
/// will retry the rsync till the given status matches or retry max 3 times
diff --git a/crates/router/tests/customers.rs b/crates/router/tests/customers.rs
index aa17635388..065f98fe66 100644
--- a/crates/router/tests/customers.rs
+++ b/crates/router/tests/customers.rs
@@ -10,7 +10,7 @@ mod utils;
#[ignore]
// verify the API-KEY/merchant id has stripe as first choice
async fn customer_success() {
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let customer_id = format!("customer_{}", uuid::Uuid::new_v4());
let api_key = ("API-KEY", "MySecretApiKey");
@@ -79,7 +79,7 @@ async fn customer_success() {
#[ignore]
// verify the API-KEY/merchant id has stripe as first choice
async fn customer_failure() {
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let customer_id = format!("customer_{}", uuid::Uuid::new_v4());
let api_key = ("api-key", "MySecretApiKey");
diff --git a/crates/router/tests/integration_demo.rs b/crates/router/tests/integration_demo.rs
index 16e7ead0a3..5bdf9a5f52 100644
--- a/crates/router/tests/integration_demo.rs
+++ b/crates/router/tests/integration_demo.rs
@@ -10,7 +10,7 @@ use utils::{mk_service, ApiKey, AppClient, MerchantId, PaymentId, Status};
/// 1) Create Merchant account
#[actix_web::test]
async fn create_merchant_account() {
- let server = mk_service().await;
+ let server = Box::pin(mk_service()).await;
let client = AppClient::guest();
let admin_client = client.admin("test_admin");
@@ -59,7 +59,7 @@ async fn create_merchant_account() {
#[actix_web::test]
async fn partial_refund() {
let authentication = ConnectorAuthentication::new();
- let server = mk_service().await;
+ let server = Box::pin(mk_service()).await;
let client = AppClient::guest();
let admin_client = client.admin("test_admin");
@@ -125,7 +125,7 @@ async fn partial_refund() {
#[actix_web::test]
async fn exceed_refund() {
let authentication = ConnectorAuthentication::new();
- let server = mk_service().await;
+ let server = Box::pin(mk_service()).await;
let client = AppClient::guest();
let admin_client = client.admin("test_admin");
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index d2d6c48507..9d48aaddd4 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -24,7 +24,7 @@ use uuid::Uuid;
#[ignore]
// verify the API-KEY/merchant id has stripe as first choice
async fn payments_create_stripe() {
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let payment_id = format!("test_{}", uuid::Uuid::new_v4());
let api_key = ("API-KEY", "MySecretApiKey");
@@ -93,7 +93,7 @@ async fn payments_create_stripe() {
#[ignore]
// verify the API-KEY/merchant id has adyen as first choice
async fn payments_create_adyen() {
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let payment_id = format!("test_{}", uuid::Uuid::new_v4());
let api_key = ("API-KEY", "321");
@@ -162,7 +162,7 @@ async fn payments_create_adyen() {
// verify the API-KEY/merchant id has stripe as first choice
#[ignore]
async fn payments_create_fail() {
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let payment_id = format!("test_{}", uuid::Uuid::new_v4());
let api_key = ("API-KEY", "MySecretApiKey");
@@ -221,7 +221,7 @@ async fn payments_create_fail() {
#[actix_web::test]
#[ignore]
async fn payments_todo() {
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let client = awc::Client::default();
let mut response;
@@ -360,20 +360,26 @@ async fn payments_create_core() {
};
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
- let actual_response =
- payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _, Oss>(
- state,
- merchant_account,
- key_store,
- payments::PaymentCreate,
- req,
- services::AuthFlow::Merchant,
- payments::CallConnectorAction::Trigger,
- None,
- api::HeaderPayload::default(),
- )
- .await
- .unwrap();
+ let actual_response = Box::pin(payments::payments_core::<
+ api::Authorize,
+ api::PaymentsResponse,
+ _,
+ _,
+ _,
+ Oss,
+ >(
+ state,
+ merchant_account,
+ key_store,
+ payments::PaymentCreate,
+ req,
+ services::AuthFlow::Merchant,
+ payments::CallConnectorAction::Trigger,
+ None,
+ api::HeaderPayload::default(),
+ ))
+ .await
+ .unwrap();
assert_eq!(expected_response, actual_response);
}
@@ -531,19 +537,25 @@ async fn payments_create_core_adyen_no_redirect() {
},
vec![],
));
- let actual_response =
- payments::payments_core::<api::Authorize, api::PaymentsResponse, _, _, _, Oss>(
- state,
- merchant_account,
- key_store,
- payments::PaymentCreate,
- req,
- services::AuthFlow::Merchant,
- payments::CallConnectorAction::Trigger,
- None,
- api::HeaderPayload::default(),
- )
- .await
- .unwrap();
+ let actual_response = Box::pin(payments::payments_core::<
+ api::Authorize,
+ api::PaymentsResponse,
+ _,
+ _,
+ _,
+ Oss,
+ >(
+ state,
+ merchant_account,
+ key_store,
+ payments::PaymentCreate,
+ req,
+ services::AuthFlow::Merchant,
+ payments::CallConnectorAction::Trigger,
+ None,
+ api::HeaderPayload::default(),
+ ))
+ .await
+ .unwrap();
assert_eq!(expected_response, actual_response);
}
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index ed8827a910..5d4ca84406 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -120,7 +120,7 @@ async fn payments_create_core() {
};
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
- let actual_response = router::core::payments::payments_core::<
+ let actual_response = Box::pin(router::core::payments::payments_core::<
api::Authorize,
api::PaymentsResponse,
_,
@@ -137,7 +137,7 @@ async fn payments_create_core() {
payments::CallConnectorAction::Trigger,
None,
api::HeaderPayload::default(),
- )
+ ))
.await
.unwrap();
assert_eq!(expected_response, actual_response);
@@ -299,7 +299,7 @@ async fn payments_create_core_adyen_no_redirect() {
},
vec![],
));
- let actual_response = router::core::payments::payments_core::<
+ let actual_response = Box::pin(router::core::payments::payments_core::<
api::Authorize,
api::PaymentsResponse,
_,
@@ -316,7 +316,7 @@ async fn payments_create_core_adyen_no_redirect() {
payments::CallConnectorAction::Trigger,
None,
api::HeaderPayload::default(),
- )
+ ))
.await
.unwrap();
assert_eq!(expected_response, actual_response);
diff --git a/crates/router/tests/payouts.rs b/crates/router/tests/payouts.rs
index 566930cd4e..ab0bc891a7 100644
--- a/crates/router/tests/payouts.rs
+++ b/crates/router/tests/payouts.rs
@@ -4,7 +4,7 @@ mod utils;
#[actix_web::test]
async fn payouts_todo() {
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let client = awc::Client::default();
let mut response;
diff --git a/crates/router/tests/refunds.rs b/crates/router/tests/refunds.rs
index c9e08d2235..6b9dfd5ed4 100644
--- a/crates/router/tests/refunds.rs
+++ b/crates/router/tests/refunds.rs
@@ -11,7 +11,7 @@ mod utils;
#[actix_web::test]
// verify the API-KEY/merchant id has stripe as first choice
async fn refund_create_fail_stripe() {
- let app = mk_service().await;
+ let app = Box::pin(mk_service()).await;
let client = AppClient::guest();
let user_client = client.user("321");
@@ -25,7 +25,7 @@ async fn refund_create_fail_stripe() {
#[actix_web::test]
// verify the API-KEY/merchant id has adyen as first choice
async fn refund_create_fail_adyen() {
- let app = mk_service().await;
+ let app = Box::pin(mk_service()).await;
let client = AppClient::guest();
let user_client = client.user("321");
@@ -39,7 +39,7 @@ async fn refund_create_fail_adyen() {
#[actix_web::test]
#[ignore]
async fn refunds_todo() {
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let client = awc::Client::default();
let mut response;
diff --git a/crates/router/tests/services.rs b/crates/router/tests/services.rs
index 64f1c3d8ee..eff7fe7f87 100644
--- a/crates/router/tests/services.rs
+++ b/crates/router/tests/services.rs
@@ -10,8 +10,12 @@ async fn get_redis_conn_failure() {
// Arrange
utils::setup().await;
let (tx, _) = tokio::sync::oneshot::channel();
- let state =
- routes::AppState::new(Settings::default(), tx, Box::new(services::MockApiClient)).await;
+ let state = Box::pin(routes::AppState::new(
+ Settings::default(),
+ tx,
+ Box::new(services::MockApiClient),
+ ))
+ .await;
let _ = state.store.get_redis_conn().map(|conn| {
conn.is_redis_available
@@ -28,10 +32,14 @@ async fn get_redis_conn_failure() {
#[tokio::test]
async fn get_redis_conn_success() {
// Arrange
- utils::setup().await;
+ Box::pin(utils::setup()).await;
let (tx, _) = tokio::sync::oneshot::channel();
- let state =
- routes::AppState::new(Settings::default(), tx, Box::new(services::MockApiClient)).await;
+ let state = Box::pin(routes::AppState::new(
+ Settings::default(),
+ tx,
+ Box::new(services::MockApiClient),
+ ))
+ .await;
// Act
let result = state.store.get_redis_conn();
diff --git a/crates/router/tests/utils.rs b/crates/router/tests/utils.rs
index 274c011df7..6cddbc0436 100644
--- a/crates/router/tests/utils.rs
+++ b/crates/router/tests/utils.rs
@@ -20,7 +20,7 @@ static SERVER: OnceCell<bool> = OnceCell::const_new();
async fn spawn_server() -> bool {
let conf = Settings::new().expect("invalid settings");
- let server = router::start_server(conf)
+ let server = Box::pin(router::start_server(conf))
.await
.expect("failed to create server");
@@ -29,7 +29,7 @@ async fn spawn_server() -> bool {
}
pub async fn setup() {
- SERVER.get_or_init(spawn_server).await;
+ Box::pin(SERVER.get_or_init(spawn_server)).await;
}
const STRIPE_MOCK: &str = "http://localhost:12111/";
diff --git a/crates/storage_impl/Cargo.toml b/crates/storage_impl/Cargo.toml
index 31115e9158..77589cc7d7 100644
--- a/crates/storage_impl/Cargo.toml
+++ b/crates/storage_impl/Cargo.toml
@@ -26,7 +26,7 @@ router_env = { version = "0.1.0", path = "../router_env" }
# Third party crates
actix-web = "4.3.1"
-async-bb8-diesel = "0.1.0"
+async-bb8-diesel = { git = "https://github.com/jarnura/async-bb8-diesel", rev = "53b4ab901aab7635c8215fd1c2d542c8db443094" }
async-trait = "0.1.72"
bb8 = "0.8.1"
bytes = "1.4.0"
diff --git a/crates/storage_impl/src/lib.rs b/crates/storage_impl/src/lib.rs
index 00d8703940..dc0dea4bb5 100644
--- a/crates/storage_impl/src/lib.rs
+++ b/crates/storage_impl/src/lib.rs
@@ -1,7 +1,7 @@
use std::sync::Arc;
use data_models::errors::{StorageError, StorageResult};
-use diesel_models::{self as store};
+use diesel_models as store;
use error_stack::ResultExt;
use masking::StrongSecret;
use redis::{kv_store::RedisConnInterface, RedisStore};
diff --git a/crates/storage_impl/src/lookup.rs b/crates/storage_impl/src/lookup.rs
index dbfd77a8d6..bd045fedd3 100644
--- a/crates/storage_impl/src/lookup.rs
+++ b/crates/storage_impl/src/lookup.rs
@@ -135,7 +135,11 @@ impl<T: DatabaseStore> ReverseLookupInterface for KVRouterStore<T> {
.try_into_get()
};
- try_redis_get_else_try_database_get(redis_fut, database_call).await
+ Box::pin(try_redis_get_else_try_database_get(
+ redis_fut,
+ database_call,
+ ))
+ .await
}
}
}
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index d34230e2cb..3d00e2f2bf 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -557,12 +557,12 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
.await?;
let key = &lookup.pk_id;
- try_redis_get_else_try_database_get(
+ Box::pin(try_redis_get_else_try_database_get(
async {
kv_wrapper(self, KvOperation::<DieselPaymentAttempt>::HGet(&lookup.sk_id), key).await?.try_into_hget()
},
|| async {self.router_store.find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(connector_transaction_id, payment_id, merchant_id, storage_scheme).await},
- )
+ ))
.await
}
}
@@ -607,7 +607,11 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
))
})
};
- try_redis_get_else_try_database_get(redis_fut, database_call).await
+ Box::pin(try_redis_get_else_try_database_get(
+ redis_fut,
+ database_call,
+ ))
+ .await
}
}
}
@@ -635,7 +639,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
.await?;
let key = &lookup.pk_id;
- try_redis_get_else_try_database_get(
+ Box::pin(try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
@@ -654,7 +658,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
)
.await
},
- )
+ ))
.await
}
}
@@ -682,7 +686,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
MerchantStorageScheme::RedisKv => {
let key = format!("mid_{merchant_id}_pid_{payment_id}");
let field = format!("pa_{attempt_id}");
- try_redis_get_else_try_database_get(
+ Box::pin(try_redis_get_else_try_database_get(
async {
kv_wrapper(self, KvOperation::<DieselPaymentAttempt>::HGet(&field), key)
.await?
@@ -698,7 +702,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
)
.await
},
- )
+ ))
.await
}
}
@@ -726,7 +730,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
.await?;
let key = &lookup.pk_id;
- try_redis_get_else_try_database_get(
+ Box::pin(try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
@@ -745,7 +749,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
)
.await
},
- )
+ ))
.await
}
}
@@ -774,7 +778,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
.await?;
let key = &lookup.pk_id;
- try_redis_get_else_try_database_get(
+ Box::pin(try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
@@ -793,7 +797,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
)
.await
},
- )
+ ))
.await
}
}
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index 2dc5cdd1c0..c3b3d22ffe 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -39,7 +39,7 @@ use crate::connection;
use crate::{
diesel_error_to_data_error,
redis::kv_store::{kv_wrapper, KvOperation},
- utils::{pg_connection_read, pg_connection_write},
+ utils::{self, pg_connection_read, pg_connection_write},
DataModelExt, DatabaseStore, KVRouterStore,
};
@@ -206,7 +206,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
MerchantStorageScheme::RedisKv => {
let key = format!("mid_{merchant_id}_pid_{payment_id}");
let field = format!("pi_{payment_id}");
- crate::utils::try_redis_get_else_try_database_get(
+ Box::pin(utils::try_redis_get_else_try_database_get(
async {
kv_wrapper::<DieselPaymentIntent, _, _>(
self,
@@ -217,7 +217,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
.try_into_hget()
},
database_call,
- )
+ ))
.await
}
}