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(ucs): Bump UCS client dependency to bring latest changes (#11484)

Saptak Duttaad01ad1b5067
diff --git a/Cargo.lock b/Cargo.lock
index dc1bd994b1..07919880ac 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -29,7 +29,7 @@ dependencies = [
"actix-web",
"derive_more 0.99.19",
"futures-util",
- "log",
+ "log 0.4.27",
"once_cell",
"smallvec 1.15.0",
]
@@ -60,10 +60,10 @@ dependencies = [
"httparse",
"httpdate",
"itoa",
- "language-tags",
+ "language-tags 0.3.2",
"local-channel",
- "mime",
- "percent-encoding",
+ "mime 0.3.17",
+ "percent-encoding 2.3.1",
"pin-project-lite",
"rand 0.9.2",
"sha1",
@@ -99,9 +99,9 @@ dependencies = [
"futures-util",
"httparse",
"local-waker",
- "log",
+ "log 0.4.27",
"memchr",
- "mime",
+ "mime 0.3.17",
"rand 0.8.5",
"serde",
"serde_json",
@@ -236,9 +236,9 @@ dependencies = [
"futures-util",
"impl-more",
"itoa",
- "language-tags",
- "log",
- "mime",
+ "language-tags 0.3.2",
+ "log 0.4.27",
+ "mime 0.3.17",
"once_cell",
"pin-project-lite",
"regex",
@@ -248,9 +248,9 @@ dependencies = [
"serde_urlencoded",
"smallvec 1.15.0",
"socket2 0.5.10",
- "time",
+ "time 0.3.41",
"tracing",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -285,7 +285,7 @@ checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
dependencies = [
"getrandom 0.2.16",
"once_cell",
- "version_check",
+ "version_check 0.9.5",
]
[[package]]
@@ -298,7 +298,7 @@ dependencies = [
"getrandom 0.2.16",
"once_cell",
"serde",
- "version_check",
+ "version_check 0.9.5",
"zerocopy 0.7.35",
]
@@ -342,7 +342,7 @@ dependencies = [
"maplit",
"once_cell",
"tendril",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -374,7 +374,7 @@ dependencies = [
"storage_impl",
"strum 0.26.3",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
]
@@ -470,7 +470,7 @@ dependencies = [
"error-stack 0.4.1",
"euclid",
"hyperswitch_masking",
- "mime",
+ "mime 0.3.17",
"nutype",
"reqwest 0.11.27",
"router_derive",
@@ -481,8 +481,8 @@ dependencies = [
"strum 0.26.3",
"superposition_types",
"tempfile",
- "time",
- "url",
+ "time 0.3.41",
+ "url 2.5.4",
"utoipa",
]
@@ -522,6 +522,12 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+[[package]]
+name = "ascii"
+version = "0.8.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97be891acc47ca214468e09425d02cef3af2c94d0d82081cd02061f996802f14"
+
[[package]]
name = "askama"
version = "0.13.1"
@@ -530,7 +536,7 @@ checksum = "5d4744ed2eef2645831b441d8f5459689ade2ab27c854488fbab1fbe94fce1a7"
dependencies = [
"askama_derive",
"itoa",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"serde",
"serde_json",
]
@@ -577,7 +583,7 @@ dependencies = [
"num-traits",
"rusticata-macros",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
]
[[package]]
@@ -710,6 +716,15 @@ dependencies = [
"winapi 0.3.9",
]
+[[package]]
+name = "autocfg"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78"
+dependencies = [
+ "autocfg 1.4.0",
+]
+
[[package]]
name = "autocfg"
version = "1.4.0"
@@ -738,9 +753,9 @@ dependencies = [
"h2 0.3.26",
"http 0.2.12",
"itoa",
- "log",
- "mime",
- "percent-encoding",
+ "log 0.4.27",
+ "mime 0.3.17",
+ "percent-encoding 2.3.1",
"pin-project-lite",
"rand 0.9.2",
"rustls 0.20.9",
@@ -773,10 +788,10 @@ dependencies = [
"hex",
"http 0.2.12",
"ring 0.17.14",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
"tracing",
- "url",
+ "url 2.5.4",
"zeroize",
]
@@ -835,7 +850,7 @@ dependencies = [
"fastrand",
"http 0.2.12",
"http-body 0.4.6",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"pin-project-lite",
"tracing",
"uuid",
@@ -913,11 +928,11 @@ dependencies = [
"http-body 0.4.6",
"lru",
"once_cell",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"regex-lite",
"sha2",
"tracing",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -1028,11 +1043,11 @@ dependencies = [
"http 0.2.12",
"http 1.3.1",
"p256 0.11.1",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"ring 0.17.14",
"sha2",
"subtle",
- "time",
+ "time 0.3.41",
"tracing",
"zeroize",
]
@@ -1095,7 +1110,7 @@ dependencies = [
"http 0.2.12",
"http-body 0.4.6",
"once_cell",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"pin-project-lite",
"pin-utils",
"tracing",
@@ -1115,7 +1130,7 @@ dependencies = [
"http 0.2.12",
"http 1.3.1",
"http-body 0.4.6",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"pin-project-lite",
"pin-utils",
"tracing",
@@ -1248,7 +1263,7 @@ dependencies = [
"pin-utils",
"ryu",
"serde",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
"tokio-util",
]
@@ -1292,8 +1307,8 @@ dependencies = [
"itoa",
"matchit 0.7.3",
"memchr",
- "mime",
- "percent-encoding",
+ "mime 0.3.17",
+ "percent-encoding 2.3.1",
"pin-project-lite",
"rustversion",
"serde",
@@ -1321,8 +1336,8 @@ dependencies = [
"itoa",
"matchit 0.8.4",
"memchr",
- "mime",
- "percent-encoding",
+ "mime 0.3.17",
+ "percent-encoding 2.3.1",
"pin-project-lite",
"rustversion",
"serde",
@@ -1349,7 +1364,7 @@ dependencies = [
"http 1.3.1",
"http-body 1.0.1",
"http-body-util",
- "mime",
+ "mime 0.3.17",
"pin-project-lite",
"rustversion",
"sync_wrapper 0.1.2",
@@ -1368,7 +1383,7 @@ dependencies = [
"http 1.3.1",
"http-body 1.0.1",
"http-body-util",
- "mime",
+ "mime 0.3.17",
"pin-project-lite",
"rustversion",
"sync_wrapper 1.0.2",
@@ -1401,6 +1416,16 @@ version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f879ef8fc74665ed7f0e6127cb106315888fc2744f68e14b74f83edbb2a08992"
+[[package]]
+name = "base64"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
+dependencies = [
+ "byteorder",
+ "safemem",
+]
+
[[package]]
name = "base64"
version = "0.13.1"
@@ -1480,7 +1505,7 @@ version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a22f228ab7a1b23027ccc6c350b72868017af7ea8356fbdf19f8d991c690013"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
"libm",
"num-bigint",
"num-integer",
@@ -1507,7 +1532,7 @@ dependencies = [
"cexpr",
"clang-sys",
"itertools 0.13.0",
- "log",
+ "log 0.4.27",
"prettyplease",
"proc-macro2",
"quote",
@@ -1661,6 +1686,16 @@ dependencies = [
"serde",
]
+[[package]]
+name = "buf_redux"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f"
+dependencies = [
+ "memchr",
+ "safemem",
+]
+
[[package]]
name = "bumpalo"
version = "3.17.0"
@@ -1769,7 +1804,7 @@ dependencies = [
"serde",
"serde_json",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
]
[[package]]
@@ -1837,7 +1872,7 @@ dependencies = [
"clap 3.2.25",
"heck 0.4.1",
"indexmap 1.9.3",
- "log",
+ "log 0.4.27",
"proc-macro2",
"quote",
"serde",
@@ -1944,6 +1979,12 @@ dependencies = [
"stacker",
]
+[[package]]
+name = "chunked_transfer"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "498d20a7aaf62625b9bf26e637cf7736417cde1d0c99f1d04d1170229a85cf87"
+
[[package]]
name = "ciborium"
version = "0.2.2"
@@ -2102,7 +2143,7 @@ dependencies = [
"serde_json",
"smithy",
"smithy-core",
- "time",
+ "time 0.3.41",
"utoipa",
]
@@ -2151,9 +2192,9 @@ dependencies = [
"strum 0.26.3",
"test-case",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
- "url",
+ "url 2.5.4",
"urlencoding",
"utoipa",
"uuid",
@@ -2202,7 +2243,7 @@ dependencies = [
[[package]]
name = "config_patch_derive"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.03.04.0-hotfix2#48fb46ed0f60fae824751a6569fc9024c20dc3fc"
+source = "git+https://github.com/juspay/connector-service?rev=0de0cb9aeb0db7b01401ffae04c270ba2e3a1137#0de0cb9aeb0db7b01401ffae04c270ba2e3a1137"
dependencies = [
"proc-macro2",
"quote",
@@ -2275,9 +2316,9 @@ version = "0.16.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb"
dependencies = [
- "percent-encoding",
- "time",
- "version_check",
+ "percent-encoding 2.3.1",
+ "time 0.3.41",
+ "version_check 0.9.5",
]
[[package]]
@@ -2286,8 +2327,8 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"
dependencies = [
- "time",
- "version_check",
+ "time 0.3.41",
+ "version_check 0.9.5",
]
[[package]]
@@ -2454,7 +2495,7 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
"cfg-if 0.1.10",
"crossbeam-utils 0.7.2",
"lazy_static",
@@ -2498,7 +2539,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
"cfg-if 0.1.10",
"lazy_static",
]
@@ -2870,7 +2911,7 @@ dependencies = [
"pq-sys",
"r2d2",
"serde_json",
- "time",
+ "time 0.3.41",
]
[[package]]
@@ -2914,7 +2955,7 @@ dependencies = [
"serde_json",
"strum 0.26.3",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
]
[[package]]
@@ -3002,7 +3043,7 @@ dependencies = [
"external_services",
"hyperswitch_interfaces",
"hyperswitch_masking",
- "mime",
+ "mime 0.3.17",
"redis_interface",
"reqwest 0.11.27",
"router_env",
@@ -3205,7 +3246,7 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc"
dependencies = [
- "version_check",
+ "version_check 0.9.5",
]
[[package]]
@@ -3321,7 +3362,7 @@ dependencies = [
"serde",
"serde_json",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
]
[[package]]
@@ -3364,7 +3405,7 @@ dependencies = [
"superposition_provider",
"superposition_types",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
"tonic 0.14.5",
"tonic-prost",
@@ -3372,7 +3413,7 @@ dependencies = [
"tonic-reflection",
"tonic-types",
"typed-builder 0.21.2",
- "url",
+ "url 2.5.4",
"vaultrs",
]
@@ -3409,12 +3450,12 @@ dependencies = [
"http 0.2.12",
"hyper 0.14.32",
"hyper-rustls 0.23.2",
- "mime",
+ "mime 0.3.17",
"serde",
"serde_json",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
- "url",
+ "url 2.5.4",
"webdriver",
]
@@ -3534,7 +3575,7 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
- "percent-encoding",
+ "percent-encoding 2.3.1",
]
[[package]]
@@ -3566,7 +3607,7 @@ dependencies = [
"crossbeam-queue 0.3.12",
"float-cmp",
"futures 0.3.31",
- "log",
+ "log 0.4.27",
"parking_lot 0.12.3",
"rand 0.8.5",
"redis-protocol",
@@ -3577,7 +3618,7 @@ dependencies = [
"tokio-util",
"tracing",
"tracing-futures",
- "url",
+ "url 2.5.4",
"urlencoding",
]
@@ -3587,7 +3628,7 @@ version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
]
[[package]]
@@ -3596,6 +3637,12 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
+[[package]]
+name = "fuchsia-cprng"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
+
[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
@@ -3757,7 +3804,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
- "version_check",
+ "version_check 0.9.5",
"zeroize",
]
@@ -3820,8 +3867,8 @@ dependencies = [
"bitflags 2.9.0",
"libc",
"libgit2-sys",
- "log",
- "url",
+ "log 0.4.27",
+ "url 2.5.4",
]
[[package]]
@@ -3838,7 +3885,7 @@ checksum = "54a1028dfc5f5df5da8a56a73e6c153c9a9708ec57232470703592a3f18e49f5"
dependencies = [
"aho-corasick",
"bstr",
- "log",
+ "log 0.4.27",
"regex-automata 0.4.9",
"regex-syntax 0.8.5",
]
@@ -3871,7 +3918,7 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47"
dependencies = [
- "log",
+ "log 0.4.27",
"plain",
"scroll",
]
@@ -3914,10 +3961,16 @@ dependencies = [
"subtle",
]
+[[package]]
+name = "groupable"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32619942b8be646939eaf3db0602b39f5229b74575b67efc897811ded1db4e57"
+
[[package]]
name = "grpc-api-types"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.03.04.0-hotfix2#48fb46ed0f60fae824751a6569fc9024c20dc3fc"
+source = "git+https://github.com/juspay/connector-service?rev=0de0cb9aeb0db7b01401ffae04c270ba2e3a1137#0de0cb9aeb0db7b01401ffae04c270ba2e3a1137"
dependencies = [
"axum 0.8.4",
"error-stack 0.5.0",
@@ -3927,7 +3980,7 @@ dependencies = [
"hyperswitch_masking",
"prost 0.14.3",
"prost-build",
- "prost-types 0.14.3",
+ "prost-types 0.13.5",
"serde",
"tonic 0.14.5",
"tonic-build",
@@ -4042,7 +4095,7 @@ dependencies = [
"headers-core",
"http 0.2.12",
"httpdate",
- "mime",
+ "mime 0.3.17",
"sha1",
]
@@ -4158,7 +4211,7 @@ version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7"
dependencies = [
- "log",
+ "log 0.4.27",
"mac",
"markup5ever",
"proc-macro2",
@@ -4243,6 +4296,25 @@ dependencies = [
"libm",
]
+[[package]]
+name = "hyper"
+version = "0.10.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273"
+dependencies = [
+ "base64 0.9.3",
+ "httparse",
+ "language-tags 0.2.2",
+ "log 0.3.9",
+ "mime 0.2.6",
+ "num_cpus",
+ "time 0.1.45",
+ "traitobject",
+ "typeable",
+ "unicase 1.4.2",
+ "url 1.7.2",
+]
+
[[package]]
name = "hyper"
version = "0.14.32"
@@ -4314,7 +4386,7 @@ checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c"
dependencies = [
"http 0.2.12",
"hyper 0.14.32",
- "log",
+ "log 0.4.27",
"rustls 0.20.9",
"rustls-native-certs 0.6.3",
"tokio 1.48.0",
@@ -4330,7 +4402,7 @@ dependencies = [
"futures-util",
"http 0.2.12",
"hyper 0.14.32",
- "log",
+ "log 0.4.27",
"rustls 0.21.12",
"rustls-native-certs 0.6.3",
"tokio 1.48.0",
@@ -4446,7 +4518,7 @@ dependencies = [
"isocountry",
"josekit",
"lazy_static",
- "mime",
+ "mime 0.3.17",
"nanoid",
"num-traits",
"openssl",
@@ -4468,10 +4540,10 @@ dependencies = [
"sha1",
"sha2",
"strum 0.26.3",
- "time",
+ "time 0.3.41",
"unicode-normalization",
"unidecode",
- "url",
+ "url 2.5.4",
"urlencoding",
"utoipa",
"uuid",
@@ -4506,7 +4578,7 @@ dependencies = [
"futures 0.3.31",
"http 0.2.12",
"hyperswitch_masking",
- "mime",
+ "mime 0.3.17",
"payment_link",
"router_derive",
"router_env",
@@ -4514,8 +4586,8 @@ dependencies = [
"serde",
"serde_json",
"serde_with",
- "time",
- "url",
+ "time 0.3.41",
+ "url 2.5.4",
"utoipa",
]
@@ -4535,7 +4607,7 @@ dependencies = [
"http 0.2.12",
"hyperswitch_domain_models",
"hyperswitch_masking",
- "mime",
+ "mime 0.3.17",
"reqwest 0.11.27",
"router_env",
"rust-grpc-client",
@@ -4543,9 +4615,9 @@ dependencies = [
"serde_json",
"strum 0.26.3",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -4561,8 +4633,8 @@ dependencies = [
"serde",
"serde_json",
"subtle",
- "time",
- "url",
+ "time 0.3.41",
+ "url 2.5.4",
"zeroize",
]
@@ -4719,6 +4791,17 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
+[[package]]
+name = "idna"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
+dependencies = [
+ "matches",
+ "unicode-bidi",
+ "unicode-normalization",
+]
+
[[package]]
name = "idna"
version = "0.5.0"
@@ -4758,7 +4841,7 @@ checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1"
dependencies = [
"crossbeam-deque 0.8.5",
"globset",
- "log",
+ "log 0.4.27",
"memchr",
"regex-automata 0.4.9",
"same-file",
@@ -4790,7 +4873,7 @@ version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
"hashbrown 0.12.3",
"serde",
]
@@ -4832,7 +4915,7 @@ dependencies = [
"thiserror 1.0.69",
"tokio 1.48.0",
"tracing",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -4872,6 +4955,22 @@ version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
+[[package]]
+name = "iron"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6d308ca2d884650a8bf9ed2ff4cb13fbb2207b71f64cda11dc9b892067295e8"
+dependencies = [
+ "hyper 0.10.16",
+ "log 0.3.9",
+ "mime_guess 1.8.8",
+ "modifier",
+ "num_cpus",
+ "plugin",
+ "typemap",
+ "url 1.7.2",
+]
+
[[package]]
name = "is-terminal"
version = "0.4.13"
@@ -4984,7 +5083,7 @@ dependencies = [
"serde",
"serde_json",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
]
[[package]]
@@ -5028,13 +5127,13 @@ dependencies = [
"num-cmp",
"once_cell",
"parking_lot 0.12.3",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"regex",
"reqwest 0.11.27",
"serde",
"serde_json",
- "time",
- "url",
+ "time 0.3.41",
+ "url 2.5.4",
"uuid",
]
@@ -5113,6 +5212,12 @@ dependencies = [
"syn 2.0.101",
]
+[[package]]
+name = "language-tags"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
+
[[package]]
name = "language-tags"
version = "0.3.2"
@@ -5149,14 +5254,14 @@ dependencies = [
"hostname",
"httpdate",
"idna 1.0.3",
- "mime",
+ "mime 0.3.17",
"native-tls",
"nom 8.0.0",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"quoted_printable",
"socket2 0.5.10",
"tokio 1.48.0",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -5281,10 +5386,19 @@ version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
"scopeguard",
]
+[[package]]
+name = "log"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
+dependencies = [
+ "log 0.4.27",
+]
+
[[package]]
name = "log"
version = "0.4.27"
@@ -5337,7 +5451,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016"
dependencies = [
- "log",
+ "log 0.4.27",
"phf 0.10.1",
"phf_codegen 0.10.0",
"string_cache",
@@ -5354,6 +5468,12 @@ dependencies = [
"regex-automata 0.1.10",
]
+[[package]]
+name = "matches"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
+
[[package]]
name = "matchit"
version = "0.7.3"
@@ -5424,7 +5544,7 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
]
[[package]]
@@ -5457,20 +5577,41 @@ dependencies = [
"libmimalloc-sys",
]
+[[package]]
+name = "mime"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0"
+dependencies = [
+ "log 0.3.9",
+]
+
[[package]]
name = "mime"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
+[[package]]
+name = "mime_guess"
+version = "1.8.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "216929a5ee4dd316b1702eedf5e74548c123d370f47841ceaac38ca154690ca3"
+dependencies = [
+ "mime 0.2.6",
+ "phf 0.7.24",
+ "phf_codegen 0.7.24",
+ "unicase 1.4.2",
+]
+
[[package]]
name = "mime_guess"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
dependencies = [
- "mime",
- "unicase",
+ "mime 0.3.17",
+ "unicase 2.7.0",
]
[[package]]
@@ -5525,7 +5666,7 @@ dependencies = [
"iovec",
"kernel32-sys",
"libc",
- "log",
+ "log 0.4.27",
"miow",
"net2",
"slab",
@@ -5539,7 +5680,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
dependencies = [
"libc",
- "log",
+ "log 0.4.27",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.52.0",
]
@@ -5593,6 +5734,12 @@ dependencies = [
"syn 2.0.101",
]
+[[package]]
+name = "modifier"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58"
+
[[package]]
name = "moka"
version = "0.12.7"
@@ -5623,6 +5770,38 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03"
+[[package]]
+name = "multipart"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182"
+dependencies = [
+ "buf_redux",
+ "httparse",
+ "hyper 0.10.16",
+ "iron",
+ "log 0.4.27",
+ "mime 0.3.17",
+ "mime_guess 2.0.5",
+ "nickel",
+ "quick-error",
+ "rand 0.8.5",
+ "safemem",
+ "tempfile",
+ "tiny_http",
+ "twoway",
+]
+
+[[package]]
+name = "mustache"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51956ef1c5d20a1384524d91e616fb44dfc7d8f249bf696d49c97dd3289ecab5"
+dependencies = [
+ "log 0.3.9",
+ "serde",
+]
+
[[package]]
name = "mutually_exclusive_features"
version = "0.1.0"
@@ -5645,7 +5824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e"
dependencies = [
"libc",
- "log",
+ "log 0.4.27",
"openssl",
"openssl-probe",
"openssl-sys",
@@ -5672,6 +5851,27 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
+[[package]]
+name = "nickel"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5061a832728db2dacb61cefe0ce303b58f85764ec680e71d9138229640a46d9"
+dependencies = [
+ "groupable",
+ "hyper 0.10.16",
+ "lazy_static",
+ "log 0.3.9",
+ "modifier",
+ "mustache",
+ "plugin",
+ "regex",
+ "serde",
+ "serde_json",
+ "time 0.1.45",
+ "typemap",
+ "url 1.7.2",
+]
+
[[package]]
name = "nom"
version = "7.1.3"
@@ -5787,7 +5987,7 @@ version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
"num-integer",
"num-traits",
]
@@ -5809,7 +6009,7 @@ version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
"libm",
]
@@ -5893,7 +6093,7 @@ dependencies = [
"serde_path_to_error",
"sha2",
"thiserror 1.0.69",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -5931,9 +6131,9 @@ checksum = "9f1ef07989b00b697d9e597e66509e2b0e7a1c889d8925fffe5408703215d72b"
dependencies = [
"async-trait",
"lazy_static",
- "log",
+ "log 0.4.27",
"mockall",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
"typed-builder 0.22.0",
]
@@ -5964,7 +6164,7 @@ dependencies = [
"hmac",
"http 0.2.12",
"itertools 0.10.5",
- "log",
+ "log 0.4.27",
"oauth2",
"p256 0.13.2",
"p384",
@@ -5980,7 +6180,7 @@ dependencies = [
"sha2",
"subtle",
"thiserror 1.0.69",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -5997,13 +6197,13 @@ dependencies = [
"bytes 1.10.1",
"dyn-clone",
"lazy_static",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"reqwest 0.12.7",
"rustc_version 0.4.1",
"serde",
"serde_json",
"serde_with",
- "url",
+ "url 2.5.4",
"void",
]
@@ -6129,7 +6329,7 @@ dependencies = [
"futures-util",
"glob",
"opentelemetry",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"rand 0.8.5",
"thiserror 1.0.69",
"tokio 1.48.0",
@@ -6315,7 +6515,7 @@ dependencies = [
"tera",
"thiserror 1.0.69",
"toml 0.8.22",
- "url",
+ "url 2.5.4",
"urlencoding",
"wasm-bindgen",
]
@@ -6346,8 +6546,8 @@ dependencies = [
"serde_json",
"storage_impl",
"thiserror 1.0.69",
- "time",
- "url",
+ "time 0.3.41",
+ "url 2.5.4",
]
[[package]]
@@ -6379,6 +6579,12 @@ dependencies = [
"base64ct",
]
+[[package]]
+name = "percent-encoding"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
+
[[package]]
name = "percent-encoding"
version = "2.3.1"
@@ -6441,6 +6647,15 @@ dependencies = [
"indexmap 2.9.0",
]
+[[package]]
+name = "phf"
+version = "0.7.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18"
+dependencies = [
+ "phf_shared 0.7.24",
+]
+
[[package]]
name = "phf"
version = "0.10.1"
@@ -6459,6 +6674,16 @@ dependencies = [
"phf_shared 0.11.2",
]
+[[package]]
+name = "phf_codegen"
+version = "0.7.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e"
+dependencies = [
+ "phf_generator 0.7.24",
+ "phf_shared 0.7.24",
+]
+
[[package]]
name = "phf_codegen"
version = "0.10.0"
@@ -6479,6 +6704,16 @@ dependencies = [
"phf_shared 0.11.2",
]
+[[package]]
+name = "phf_generator"
+version = "0.7.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662"
+dependencies = [
+ "phf_shared 0.7.24",
+ "rand 0.6.5",
+]
+
[[package]]
name = "phf_generator"
version = "0.10.0"
@@ -6499,6 +6734,16 @@ dependencies = [
"rand 0.8.5",
]
+[[package]]
+name = "phf_shared"
+version = "0.7.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0"
+dependencies = [
+ "siphasher 0.2.3",
+ "unicase 1.4.2",
+]
+
[[package]]
name = "phf_shared"
version = "0.10.0"
@@ -6640,6 +6885,15 @@ dependencies = [
"plotters-backend",
]
+[[package]]
+name = "plugin"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0"
+dependencies = [
+ "typemap",
+]
+
[[package]]
name = "pm_auth"
version = "0.1.0"
@@ -6652,7 +6906,7 @@ dependencies = [
"error-stack 0.4.1",
"http 0.2.12",
"hyperswitch_masking",
- "mime",
+ "mime 0.3.17",
"serde",
"serde_json",
"strum 0.26.3",
@@ -6776,7 +7030,7 @@ dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
- "version_check",
+ "version_check 0.9.5",
]
[[package]]
@@ -6787,7 +7041,7 @@ checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
- "version_check",
+ "version_check 0.9.5",
]
[[package]]
@@ -6812,7 +7066,7 @@ dependencies = [
"num-traits",
"rand 0.8.5",
"rand_chacha 0.3.1",
- "rand_xorshift",
+ "rand_xorshift 0.3.0",
"regex-syntax 0.8.5",
"rusty-fork",
"tempfile",
@@ -6847,7 +7101,7 @@ checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7"
dependencies = [
"heck 0.5.0",
"itertools 0.13.0",
- "log",
+ "log 0.4.27",
"multimap",
"petgraph",
"prettyplease",
@@ -6941,7 +7195,7 @@ checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b"
dependencies = [
"bitflags 2.9.0",
"memchr",
- "unicase",
+ "unicase 2.7.0",
]
[[package]]
@@ -6952,7 +7206,7 @@ checksum = "7c3a14896dfa883796f1cb410461aef38810ea05f2b2c33c5aded3649095fdad"
dependencies = [
"bitflags 2.9.0",
"memchr",
- "unicase",
+ "unicase 2.7.0",
]
[[package]]
@@ -7086,7 +7340,7 @@ version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93"
dependencies = [
- "log",
+ "log 0.4.27",
"parking_lot 0.12.3",
"scheduled-thread-pool",
]
@@ -7097,6 +7351,25 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
+[[package]]
+name = "rand"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
+dependencies = [
+ "autocfg 0.1.8",
+ "libc",
+ "rand_chacha 0.1.1",
+ "rand_core 0.4.2",
+ "rand_hc",
+ "rand_isaac",
+ "rand_jitter",
+ "rand_os",
+ "rand_pcg",
+ "rand_xorshift 0.1.1",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "rand"
version = "0.8.5"
@@ -7118,6 +7391,16 @@ dependencies = [
"rand_core 0.9.3",
]
+[[package]]
+name = "rand_chacha"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
+dependencies = [
+ "autocfg 0.1.8",
+ "rand_core 0.3.1",
+]
+
[[package]]
name = "rand_chacha"
version = "0.3.1"
@@ -7138,6 +7421,21 @@ dependencies = [
"rand_core 0.9.3",
]
+[[package]]
+name = "rand_core"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
+dependencies = [
+ "rand_core 0.4.2",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
+
[[package]]
name = "rand_core"
version = "0.6.4"
@@ -7156,6 +7454,68 @@ dependencies = [
"getrandom 0.3.3",
]
+[[package]]
+name = "rand_hc"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
+dependencies = [
+ "rand_core 0.3.1",
+]
+
+[[package]]
+name = "rand_isaac"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
+dependencies = [
+ "rand_core 0.3.1",
+]
+
+[[package]]
+name = "rand_jitter"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
+dependencies = [
+ "libc",
+ "rand_core 0.4.2",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "rand_os"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
+dependencies = [
+ "cloudabi",
+ "fuchsia-cprng",
+ "libc",
+ "rand_core 0.4.2",
+ "rdrand",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "rand_pcg"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
+dependencies = [
+ "autocfg 0.1.8",
+ "rand_core 0.4.2",
+]
+
+[[package]]
+name = "rand_xorshift"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
+dependencies = [
+ "rand_core 0.3.1",
+]
+
[[package]]
name = "rand_xorshift"
version = "0.3.0"
@@ -7203,7 +7563,7 @@ dependencies = [
"futures-channel",
"futures-util",
"libc",
- "log",
+ "log 0.4.27",
"rdkafka-sys",
"serde",
"serde_derive",
@@ -7224,6 +7584,15 @@ dependencies = [
"pkg-config",
]
+[[package]]
+name = "rdrand"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
+dependencies = [
+ "rand_core 0.3.1",
+]
+
[[package]]
name = "redis-protocol"
version = "4.1.0"
@@ -7234,7 +7603,7 @@ dependencies = [
"bytes-utils",
"cookie-factory",
"crc16",
- "log",
+ "log 0.4.27",
"nom 7.1.3",
]
@@ -7359,12 +7728,12 @@ dependencies = [
"hyper-tls 0.5.0",
"ipnet",
"js-sys",
- "log",
- "mime",
- "mime_guess",
+ "log 0.4.27",
+ "mime 0.3.17",
+ "mime_guess 2.0.5",
"native-tls",
"once_cell",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"pin-project-lite",
"rustls 0.21.12",
"rustls-pemfile 1.0.4",
@@ -7378,7 +7747,7 @@ dependencies = [
"tokio-rustls 0.24.1",
"tokio-util",
"tower-service",
- "url",
+ "url 2.5.4",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
@@ -7408,11 +7777,11 @@ dependencies = [
"hyper-util",
"ipnet",
"js-sys",
- "log",
- "mime",
+ "log 0.4.27",
+ "mime 0.3.17",
"native-tls",
"once_cell",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"pin-project-lite",
"quinn",
"rustls 0.23.27",
@@ -7428,7 +7797,7 @@ dependencies = [
"tokio-rustls 0.26.2",
"tokio-util",
"tower-service",
- "url",
+ "url 2.5.4",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams",
@@ -7593,7 +7962,7 @@ dependencies = [
"kgraph_utils",
"maud",
"mimalloc",
- "mime",
+ "mime 0.3.17",
"nanoid",
"num-traits",
"num_cpus",
@@ -7635,13 +8004,13 @@ dependencies = [
"tera",
"test_utils",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
"totp-rs",
"tracing-futures",
"ucs_cards",
"unicode-segmentation",
- "url",
+ "url 2.5.4",
"urlencoding",
"utoipa",
"uuid",
@@ -7664,7 +8033,7 @@ dependencies = [
"serde_json",
"strum 0.26.3",
"syn 2.0.101",
- "url",
+ "url 2.5.4",
"utoipa",
]
@@ -7686,7 +8055,7 @@ dependencies = [
"serde_json",
"serde_path_to_error",
"strum 0.26.3",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
"tracing",
"tracing-actix-web",
@@ -7728,7 +8097,7 @@ dependencies = [
[[package]]
name = "rust-grpc-client"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.03.04.0-hotfix2#48fb46ed0f60fae824751a6569fc9024c20dc3fc"
+source = "git+https://github.com/juspay/connector-service?rev=0de0cb9aeb0db7b01401ffae04c270ba2e3a1137#0de0cb9aeb0db7b01401ffae04c270ba2e3a1137"
dependencies = [
"grpc-api-types",
]
@@ -7866,7 +8235,7 @@ dependencies = [
"serde_urlencoded",
"thiserror 1.0.69",
"tracing",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -7902,7 +8271,7 @@ version = "0.20.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99"
dependencies = [
- "log",
+ "log 0.4.27",
"ring 0.16.20",
"sct",
"webpki",
@@ -7914,7 +8283,7 @@ version = "0.21.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [
- "log",
+ "log 0.4.27",
"ring 0.17.14",
"rustls-webpki 0.101.7",
"sct",
@@ -7926,7 +8295,7 @@ version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432"
dependencies = [
- "log",
+ "log 0.4.27",
"ring 0.17.14",
"rustls-pki-types",
"rustls-webpki 0.102.8",
@@ -8066,6 +8435,12 @@ version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
+[[package]]
+name = "safemem"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
+
[[package]]
name = "same-file"
version = "1.0.6"
@@ -8123,7 +8498,7 @@ dependencies = [
"storage_impl",
"strum 0.26.3",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
"uuid",
]
@@ -8373,7 +8748,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0431a35568651e363364210c91983c1da5eb29404d9f0928b67d4ebcfa7d330c"
dependencies = [
- "percent-encoding",
+ "percent-encoding 2.3.1",
"serde",
"thiserror 1.0.69",
]
@@ -8425,7 +8800,7 @@ dependencies = [
"serde_derive",
"serde_json",
"serde_with_macros",
- "time",
+ "time 0.3.41",
]
[[package]]
@@ -8449,7 +8824,7 @@ dependencies = [
"indexmap 2.9.0",
"itoa",
"libyml",
- "log",
+ "log 0.4.27",
"memchr",
"ryu",
"serde",
@@ -8464,7 +8839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9"
dependencies = [
"futures 0.3.31",
- "log",
+ "log 0.4.27",
"once_cell",
"parking_lot 0.12.3",
"scc",
@@ -8591,9 +8966,15 @@ dependencies = [
"num-bigint",
"num-traits",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
]
+[[package]]
+name = "siphasher"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
+
[[package]]
name = "siphasher"
version = "0.3.11"
@@ -8627,7 +9008,7 @@ version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
- "autocfg",
+ "autocfg 1.4.0",
]
[[package]]
@@ -8785,21 +9166,21 @@ dependencies = [
"hashbrown 0.15.2",
"hashlink 0.10.0",
"indexmap 2.9.0",
- "log",
+ "log 0.4.27",
"memchr",
"native-tls",
"once_cell",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"serde",
"serde_json",
"sha2",
"smallvec 1.15.0",
"thiserror 2.0.12",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
"tokio-stream",
"tracing",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -8837,7 +9218,7 @@ dependencies = [
"sqlx-sqlite",
"syn 2.0.101",
"tokio 1.48.0",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -8865,11 +9246,11 @@ dependencies = [
"hkdf",
"hmac",
"itoa",
- "log",
+ "log 0.4.27",
"md-5",
"memchr",
"once_cell",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"rand 0.8.5",
"rsa",
"serde",
@@ -8879,7 +9260,7 @@ dependencies = [
"sqlx-core",
"stringprep",
"thiserror 2.0.12",
- "time",
+ "time 0.3.41",
"tracing",
"whoami",
]
@@ -8906,7 +9287,7 @@ dependencies = [
"hmac",
"home",
"itoa",
- "log",
+ "log 0.4.27",
"md-5",
"memchr",
"num-bigint",
@@ -8919,7 +9300,7 @@ dependencies = [
"sqlx-core",
"stringprep",
"thiserror 2.0.12",
- "time",
+ "time 0.3.41",
"tracing",
"whoami",
]
@@ -8938,15 +9319,15 @@ dependencies = [
"futures-intrusive",
"futures-util",
"libsqlite3-sys",
- "log",
- "percent-encoding",
+ "log 0.4.27",
+ "percent-encoding 2.3.1",
"serde",
"serde_urlencoded",
"sqlx-core",
"thiserror 2.0.12",
- "time",
+ "time 0.3.41",
"tracing",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -9124,7 +9505,7 @@ dependencies = [
"serde",
"serde_json",
"storage_impl",
- "time",
+ "time 0.3.41",
]
[[package]]
@@ -9149,11 +9530,11 @@ dependencies = [
"derive_more 0.99.19",
"itertools 0.10.5",
"jsonschema",
- "log",
+ "log 0.4.27",
"mini-moka",
"num-bigint",
"once_cell",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"rand 0.9.2",
"reqwest 0.11.27",
"serde",
@@ -9187,7 +9568,7 @@ dependencies = [
"async-trait",
"aws-smithy-types",
"chrono",
- "log",
+ "log 0.4.27",
"open-feature",
"reqwest 0.11.27",
"serde",
@@ -9229,7 +9610,7 @@ dependencies = [
"chrono",
"derive_more 0.99.19",
"juspay_jsonlogic",
- "log",
+ "log 0.4.27",
"regex",
"serde",
"serde_json",
@@ -9480,7 +9861,7 @@ dependencies = [
"globwalk 0.9.1",
"humansize",
"lazy_static",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"pest",
"pest_derive",
"rand 0.8.5",
@@ -9557,7 +9938,7 @@ dependencies = [
"serde_urlencoded",
"serial_test",
"thirtyfour",
- "time",
+ "time 0.3.41",
"tokio 1.48.0",
"toml 0.8.22",
]
@@ -9584,7 +9965,7 @@ dependencies = [
"fantoccini",
"futures 0.3.31",
"http 0.2.12",
- "log",
+ "log 0.4.27",
"parking_lot 0.12.3",
"serde",
"serde_json",
@@ -9593,7 +9974,7 @@ dependencies = [
"thirtyfour-macros",
"thiserror 1.0.69",
"tokio 1.48.0",
- "url",
+ "url 2.5.4",
"urlparse",
]
@@ -9658,6 +10039,17 @@ dependencies = [
"once_cell",
]
+[[package]]
+name = "time"
+version = "0.1.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
+dependencies = [
+ "libc",
+ "wasi 0.10.0+wasi-snapshot-preview1",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "time"
version = "0.3.41"
@@ -9700,6 +10092,19 @@ dependencies = [
"crunchy",
]
+[[package]]
+name = "tiny_http"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e22cb179b63e5fc2d0b5be237dc107da072e2407809ac70a8ce85b93fe8f562"
+dependencies = [
+ "ascii",
+ "chrono",
+ "chunked_transfer",
+ "log 0.4.27",
+ "url 1.7.2",
+]
+
[[package]]
name = "tinystr"
version = "0.7.6"
@@ -9826,7 +10231,7 @@ checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674"
dependencies = [
"bytes 0.4.12",
"futures 0.1.31",
- "log",
+ "log 0.4.27",
]
[[package]]
@@ -9859,7 +10264,7 @@ dependencies = [
"crossbeam-utils 0.7.2",
"futures 0.1.31",
"lazy_static",
- "log",
+ "log 0.4.27",
"mio 0.6.23",
"num_cpus",
"parking_lot 0.9.0",
@@ -9958,7 +10363,7 @@ dependencies = [
"crossbeam-utils 0.7.2",
"futures 0.1.31",
"lazy_static",
- "log",
+ "log 0.4.27",
"num_cpus",
"slab",
"tokio-executor",
@@ -9984,7 +10389,7 @@ checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82"
dependencies = [
"bytes 0.4.12",
"futures 0.1.31",
- "log",
+ "log 0.4.27",
"mio 0.6.23",
"tokio-codec",
"tokio-io",
@@ -10001,7 +10406,7 @@ dependencies = [
"futures 0.1.31",
"iovec",
"libc",
- "log",
+ "log 0.4.27",
"mio 0.6.23",
"mio-uds",
"tokio-codec",
@@ -10116,7 +10521,7 @@ dependencies = [
"hyper 1.6.0",
"hyper-timeout",
"hyper-util",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"pin-project",
"prost 0.13.5",
"socket2 0.5.10",
@@ -10139,7 +10544,7 @@ dependencies = [
"http 1.3.1",
"http-body 1.0.1",
"http-body-util",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"pin-project",
"tokio-stream",
"tower-layer",
@@ -10164,7 +10569,7 @@ dependencies = [
"hyper 1.6.0",
"hyper-timeout",
"hyper-util",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"pin-project",
"socket2 0.6.1",
"sync_wrapper 1.0.2",
@@ -10252,7 +10657,7 @@ dependencies = [
"rand 0.9.2",
"sha1",
"sha2",
- "url",
+ "url 2.5.4",
"urlencoding",
]
@@ -10313,7 +10718,7 @@ version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
- "log",
+ "log 0.4.27",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
@@ -10342,7 +10747,7 @@ checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf"
dependencies = [
"crossbeam-channel",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
"tracing-subscriber",
]
@@ -10384,7 +10789,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
- "log",
+ "log 0.4.27",
"once_cell",
"tracing-core",
]
@@ -10438,6 +10843,12 @@ dependencies = [
"tracing-serde",
]
+[[package]]
+name = "traitobject"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "04a79e25382e2e852e8da874249358d382ebaf259d0d34e75d8db16a7efabbc7"
+
[[package]]
name = "triomphe"
version = "0.1.13"
@@ -10455,6 +10866,21 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+[[package]]
+name = "twoway"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "typeable"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
+
[[package]]
name = "typed-builder"
version = "0.21.2"
@@ -10501,6 +10927,15 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e"
+[[package]]
+name = "typemap"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6"
+dependencies = [
+ "unsafe-any",
+]
+
[[package]]
name = "typenum"
version = "1.18.0"
@@ -10516,7 +10951,7 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "ucs_cards"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.03.04.0-hotfix2#48fb46ed0f60fae824751a6569fc9024c20dc3fc"
+source = "git+https://github.com/juspay/connector-service?rev=0de0cb9aeb0db7b01401ffae04c270ba2e3a1137#0de0cb9aeb0db7b01401ffae04c270ba2e3a1137"
dependencies = [
"bytes 1.10.1",
"error-stack 0.4.1",
@@ -10525,14 +10960,14 @@ dependencies = [
"regex",
"serde",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
"ucs_common_utils",
]
[[package]]
name = "ucs_common_enums"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.03.04.0-hotfix2#48fb46ed0f60fae824751a6569fc9024c20dc3fc"
+source = "git+https://github.com/juspay/connector-service?rev=0de0cb9aeb0db7b01401ffae04c270ba2e3a1137#0de0cb9aeb0db7b01401ffae04c270ba2e3a1137"
dependencies = [
"serde",
"strum 0.26.3",
@@ -10543,7 +10978,7 @@ dependencies = [
[[package]]
name = "ucs_common_utils"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?tag=2026.03.04.0-hotfix2#48fb46ed0f60fae824751a6569fc9024c20dc3fc"
+source = "git+https://github.com/juspay/connector-service?rev=0de0cb9aeb0db7b01401ffae04c270ba2e3a1137#0de0cb9aeb0db7b01401ffae04c270ba2e3a1137"
dependencies = [
"anyhow",
"base64 0.21.7",
@@ -10556,6 +10991,7 @@ dependencies = [
"http 1.3.1",
"hyperswitch_masking",
"md5",
+ "multipart",
"nanoid",
"once_cell",
"openssl",
@@ -10571,11 +11007,11 @@ dependencies = [
"serde_urlencoded",
"strum 0.26.3",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
"tonic 0.14.5",
"tracing",
"ucs_common_enums",
- "url",
+ "url 2.5.4",
"utoipa",
"uuid",
]
@@ -10636,13 +11072,22 @@ dependencies = [
"unic-common",
]
+[[package]]
+name = "unicase"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
+dependencies = [
+ "version_check 0.1.5",
+]
+
[[package]]
name = "unicase"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89"
dependencies = [
- "version_check",
+ "version_check 0.9.5",
]
[[package]]
@@ -10811,6 +11256,15 @@ dependencies = [
"weedle2",
]
+[[package]]
+name = "unsafe-any"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f"
+dependencies = [
+ "traitobject",
+]
+
[[package]]
name = "untrusted"
version = "0.7.1"
@@ -10823,6 +11277,17 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+[[package]]
+name = "url"
+version = "1.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
+dependencies = [
+ "idna 0.1.5",
+ "matches",
+ "percent-encoding 1.0.1",
+]
+
[[package]]
name = "url"
version = "2.5.4"
@@ -10831,7 +11296,7 @@ checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
dependencies = [
"form_urlencoded",
"idna 1.0.3",
- "percent-encoding",
+ "percent-encoding 2.3.1",
"serde",
]
@@ -10925,7 +11390,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -10987,7 +11452,7 @@ dependencies = [
"serde_json",
"thiserror 1.0.69",
"tracing",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -11009,9 +11474,15 @@ dependencies = [
"regex",
"rustc_version 0.4.1",
"rustversion",
- "time",
+ "time 0.3.41",
]
+[[package]]
+name = "version_check"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
+
[[package]]
name = "version_check"
version = "0.9.5"
@@ -11058,6 +11529,12 @@ dependencies = [
"try-lock",
]
+[[package]]
+name = "wasi"
+version = "0.10.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
+
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@@ -11116,7 +11593,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
- "log",
+ "log 0.4.27",
"proc-macro2",
"quote",
"syn 2.0.101",
@@ -11244,13 +11721,13 @@ dependencies = [
"bytes 1.10.1",
"cookie 0.16.2",
"http 0.2.12",
- "log",
+ "log 0.4.27",
"serde",
"serde_derive",
"serde_json",
- "time",
+ "time 0.3.41",
"unicode-segmentation",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -11687,13 +12164,13 @@ dependencies = [
"http-body-util",
"hyper 1.6.0",
"hyper-util",
- "log",
+ "log 0.4.27",
"once_cell",
"regex",
"serde",
"serde_json",
"tokio 1.48.0",
- "url",
+ "url 2.5.4",
]
[[package]]
@@ -11765,7 +12242,7 @@ dependencies = [
"anyhow",
"bitflags 2.9.0",
"indexmap 2.9.0",
- "log",
+ "log 0.4.27",
"serde",
"serde_derive",
"serde_json",
@@ -11784,7 +12261,7 @@ dependencies = [
"anyhow",
"id-arena",
"indexmap 2.9.0",
- "log",
+ "log 0.4.27",
"semver 1.0.26",
"serde",
"serde_derive",
@@ -11838,7 +12315,7 @@ dependencies = [
"oid-registry",
"rusticata-macros",
"thiserror 1.0.69",
- "time",
+ "time 0.3.41",
]
[[package]]
diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml
index 2eeded837b..8fd80c9e02 100644
--- a/crates/external_services/Cargo.toml
+++ b/crates/external_services/Cargo.toml
@@ -72,7 +72,7 @@ reqwest = { version = "0.11.27", features = ["rustls-tls"] }
http = "0.2.12"
url = { version = "2.5.4", features = ["serde"] }
quick-xml = { version = "0.31.0", features = ["serialize"] }
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", tag = "2026.03.04.0-hotfix2" , package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0de0cb9aeb0db7b01401ffae04c270ba2e3a1137", package = "rust-grpc-client" }
open-feature = { version = "0.2.5", optional = true }
superposition_provider = { version = "0.99.1", optional = true}
superposition_types = "0.99.1"
diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs
index 536eabd93c..0a3177ee5d 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -11,12 +11,7 @@ use tonic::{
metadata::{MetadataMap, MetadataValue},
transport::Uri,
};
-use unified_connector_service_client::payments::{
- self as payments_grpc, payment_service_client::PaymentServiceClient,
- refund_service_client::RefundServiceClient, PaymentServiceAuthorizeResponse,
- PaymentServiceRefundRequest, PaymentServiceTransformRequest, PaymentServiceTransformResponse,
- RefundResponse, RefundServiceGetRequest,
-};
+use unified_connector_service_client::payments as payments_grpc;
use crate::{
consts,
@@ -29,10 +24,26 @@ pub type UnifiedConnectorServiceResult<T> = CustomResult<T, UnifiedConnectorServ
/// Contains the Unified Connector Service client
#[derive(Debug, Clone)]
pub struct UnifiedConnectorServiceClient {
- /// The Unified Connector Service Client
- pub client: PaymentServiceClient<tonic::transport::Channel>,
+ /// The Payment Service Client
+ pub payment_service_client: payments_grpc::payment_service_client::PaymentServiceClient<tonic::transport::Channel>,
/// The Refund Service Client
- pub refund_client: RefundServiceClient<tonic::transport::Channel>,
+ pub refund_service_client: payments_grpc::refund_service_client::RefundServiceClient<tonic::transport::Channel>,
+ /// The Event Service Client
+ pub event_service_client: payments_grpc::event_service_client::EventServiceClient<tonic::transport::Channel>,
+ /// The Recurring Payment Service Client
+ pub recurring_payment_service_client: payments_grpc::recurring_payment_service_client::RecurringPaymentServiceClient<tonic::transport::Channel>,
+ /// The Dispute Service Client
+ pub dispute_service_client: payments_grpc::dispute_service_client::DisputeServiceClient<tonic::transport::Channel>,
+ /// The Payment Method Service Client
+ pub payment_method_service_client: payments_grpc::payment_method_service_client::PaymentMethodServiceClient<tonic::transport::Channel>,
+ /// The Customer Service Client
+ pub customer_service_client: payments_grpc::customer_service_client::CustomerServiceClient<tonic::transport::Channel>,
+ /// The Merchant Authentication Service Client
+ pub merchant_authentication_service_client:
+ payments_grpc::merchant_authentication_service_client::MerchantAuthenticationServiceClient<tonic::transport::Channel>,
+ /// The Payment Method Authentication Service Client
+ pub payment_method_authentication_service_client:
+ payments_grpc::payment_method_authentication_service_client::PaymentMethodAuthenticationServiceClient<tonic::transport::Channel>,
}
/// Contains the Unified Connector Service Client config
@@ -80,6 +91,9 @@ pub struct ConnectorAuthMetadata {
/// Id of the merchant.
pub merchant_id: Secret<String>,
+
+ /// Connector-specific configuration (JSON serialized) for UCS.
+ pub connector_config: Option<Secret<String>>,
}
/// External Vault Proxy Related Metadata
@@ -90,6 +104,37 @@ pub enum ExternalVaultProxyMetadata {
VgsMetadata(VgsMetadata),
}
+/// Builds a gRPC client with timeout handling
+#[macro_export]
+macro_rules! build_grpc_client {
+ ($client:ty, $name:expr, $uri:expr, $timeout:expr) => {{
+ match timeout(
+ Duration::from_secs($timeout),
+ <$client>::connect($uri.clone()),
+ )
+ .await
+ {
+ Ok(Ok(client)) => client,
+ Ok(Err(err)) => {
+ router_env::logger::error!(
+ "Failed to connect to Unified Connector Service for {}: {:?}",
+ $name,
+ err
+ );
+ return None;
+ }
+ Err(err) => {
+ router_env::logger::error!(
+ "Connection to Unified Connector Service timed out for {}: {:?}",
+ $name,
+ err
+ );
+ return None;
+ }
+ }
+ }};
+}
+
/// VGS proxy data
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct VgsMetadata {
@@ -116,35 +161,98 @@ impl UnifiedConnectorServiceClient {
}
};
- let payment_client_result = timeout(
- Duration::from_secs(unified_connector_service_client_config.connection_timeout),
- PaymentServiceClient::connect(uri.clone()),
- )
- .await;
-
- let refund_client_result = timeout(
- Duration::from_secs(unified_connector_service_client_config.connection_timeout),
- RefundServiceClient::connect(uri),
- )
- .await;
-
- match (payment_client_result, refund_client_result) {
- (Ok(Ok(client)), Ok(Ok(refund_client))) => {
- logger::info!("Successfully connected to Unified Connector Service");
- Some(Self {
- client,
- refund_client,
- })
- }
- (Ok(Err(err)), _) | (_, Ok(Err(err))) => {
- logger::error!(error = ?err, "Failed to connect to Unified Connector Service");
- None
- }
- (Err(err), _) | (_, Err(err)) => {
- logger::error!(error = ?err, "Connection to Unified Connector Service timed out");
- None
- }
- }
+ let timeout = unified_connector_service_client_config.connection_timeout;
+
+ let payment_service_client = build_grpc_client!(
+ payments_grpc::payment_service_client::PaymentServiceClient<
+ tonic::transport::Channel,
+ >,
+ "payment_service_client",
+ uri,
+ timeout
+ );
+
+ let refund_service_client = build_grpc_client!(
+ payments_grpc::refund_service_client::RefundServiceClient<
+ tonic::transport::Channel,
+ >,
+ "refund_service_client",
+ uri,
+ timeout
+ );
+
+ let event_service_client = build_grpc_client!(
+ payments_grpc::event_service_client::EventServiceClient<
+ tonic::transport::Channel,
+ >,
+ "event_service_client",
+ uri,
+ timeout
+ );
+
+ let recurring_payment_service_client = build_grpc_client!(
+ payments_grpc::recurring_payment_service_client::RecurringPaymentServiceClient<
+ tonic::transport::Channel,
+ >,
+ "recurring_payment_service_client",
+ uri,
+ timeout
+ );
+
+ let dispute_service_client = build_grpc_client!(
+ payments_grpc::dispute_service_client::DisputeServiceClient<
+ tonic::transport::Channel,
+ >,
+ "dispute_service_client",
+ uri,
+ timeout
+ );
+
+ let payment_method_service_client = build_grpc_client!(
+ payments_grpc::payment_method_service_client::PaymentMethodServiceClient<
+ tonic::transport::Channel,
+ >,
+ "payment_method_service_client",
+ uri,
+ timeout
+ );
+
+ let customer_service_client = build_grpc_client!(
+ payments_grpc::customer_service_client::CustomerServiceClient<
+ tonic::transport::Channel,
+ >,
+ "customer_service_client",
+ uri,
+ timeout
+ );
+
+ let merchant_authentication_service_client = build_grpc_client!(
+ payments_grpc::merchant_authentication_service_client::MerchantAuthenticationServiceClient<tonic::transport::Channel>,
+ "merchant_authentication_service_client",
+ uri,
+ timeout
+ );
+
+ let payment_method_authentication_service_client = build_grpc_client!(
+ payments_grpc::payment_method_authentication_service_client::PaymentMethodAuthenticationServiceClient<tonic::transport::Channel>,
+ "payment_method_authentication_service_client",
+ uri,
+ timeout
+ );
+
+ logger::info!("Successfully connected to Unified Connector Service");
+
+ Some(Self {
+ payment_service_client,
+ refund_service_client,
+ event_service_client,
+ recurring_payment_service_client,
+ dispute_service_client,
+ payment_method_service_client,
+ customer_service_client,
+ merchant_authentication_service_client,
+ payment_method_authentication_service_client,
+ })
}
None => {
router_env::logger::error!(?config.unified_connector_service, "Unified Connector Service config is missing");
@@ -153,155 +261,125 @@ impl UnifiedConnectorServiceClient {
}
}
- /// Performs Payment Method Token Create
- pub async fn payment_method_token_create(
+ /// Performs Payment Method Tokenize
+ pub async fn payment_method_tokenize(
&self,
- pm_token_create_request: payments_grpc::PaymentServiceCreatePaymentMethodTokenRequest,
+ payment_method_tokenize_request: payments_grpc::PaymentMethodServiceTokenizeRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
) -> UnifiedConnectorServiceResult<
- tonic::Response<payments_grpc::PaymentServiceCreatePaymentMethodTokenResponse>,
+ tonic::Response<payments_grpc::PaymentMethodServiceTokenizeResponse>,
> {
- let mut request = tonic::Request::new(pm_token_create_request);
+ let mut request = tonic::Request::new(payment_method_tokenize_request);
let connector_name = connector_auth_metadata.connector_name.clone();
let metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.payment_method_service_client
.clone()
- .create_payment_method_token(request)
+ .tokenize(request)
.await
- .change_context(UnifiedConnectorServiceError::PaymentMethodTokenCreateFailure)
+ .change_context(UnifiedConnectorServiceError::PaymentMethodTokenizeFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="create_payment_method_token",
+ method="payment_method_tokenize",
connector_name=?connector_name,
- "UCS create_payment_method_token gRPC call failed"
+ "UCS payment_method_tokenize gRPC call failed"
)
})
}
/// Performs SDK Session Token Create
- pub async fn sdk_session_token(
+ pub async fn create_sdk_session_token(
&self,
- sdk_session_token_request: payments_grpc::PaymentServiceSdkSessionTokenRequest,
+ create_sdk_session_token_request: payments_grpc::MerchantAuthenticationServiceCreateSdkSessionTokenRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
) -> UnifiedConnectorServiceResult<
- tonic::Response<payments_grpc::PaymentServiceSdkSessionTokenResponse>,
+ tonic::Response<payments_grpc::MerchantAuthenticationServiceCreateSdkSessionTokenResponse>,
> {
- let mut request = tonic::Request::new(sdk_session_token_request);
+ let mut request = tonic::Request::new(create_sdk_session_token_request);
let connector_name = connector_auth_metadata.connector_name.clone();
let metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.merchant_authentication_service_client
.clone()
- .sdk_session_token(request)
+ .create_sdk_session_token(request)
.await
- .change_context(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .change_context(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="sdk_session_token",
+ method="create_sdk_session_token",
connector_name=?connector_name,
- "UCS sdk_session_token gRPC call failed"
+ "UCS create_sdk_session_token gRPC call failed"
)
})
}
- /// Performs Incremental Authorization
- pub async fn incremental_authorization(
+ /// Performs Payment Incremental Authorization
+ pub async fn payment_incremental_authorization(
&self,
- sdk_session_token_request: payments_grpc::PaymentServiceIncrementalAuthorizationRequest,
+ payment_incremental_authorization_request: payments_grpc::PaymentServiceIncrementalAuthorizationRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
) -> UnifiedConnectorServiceResult<
tonic::Response<payments_grpc::PaymentServiceIncrementalAuthorizationResponse>,
> {
- let mut request = tonic::Request::new(sdk_session_token_request);
+ let mut request = tonic::Request::new(payment_incremental_authorization_request);
let connector_name = connector_auth_metadata.connector_name.clone();
let metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.payment_service_client
.clone()
.incremental_authorization(request)
.await
- .change_context(UnifiedConnectorServiceError::IncrementalAuthorizationFailure)
- .inspect_err(|error| {
- logger::error!(
- grpc_error=?error,
- method="incremental_authorization",
- connector_name=?connector_name,
- "UCS incremental_authorization gRPC call failed"
- )
- })
- }
-
- /// Performs Payment Granular Authorize
- pub async fn payment_authorize_granular(
- &self,
- payment_authorize_only_request: payments_grpc::PaymentServiceAuthorizeOnlyRequest,
- connector_auth_metadata: ConnectorAuthMetadata,
- grpc_headers: GrpcHeadersUcs,
- ) -> UnifiedConnectorServiceResult<tonic::Response<PaymentServiceAuthorizeResponse>> {
- let mut request = tonic::Request::new(payment_authorize_only_request);
-
- let connector_name = connector_auth_metadata.connector_name.clone();
- let metadata =
- build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
- *request.metadata_mut() = metadata;
-
- self.client
- .clone()
- .authorize_only(request)
- .await
- .change_context(UnifiedConnectorServiceError::PaymentAuthorizeGranularFailure)
+ .change_context(UnifiedConnectorServiceError::PaymentIncrementalAuthorizationFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="authorize_only",
+ method="payment_incremental_authorization",
connector_name=?connector_name,
- "UCS authorize_only gRPC call failed"
+ "UCS payment_incremental_authorization gRPC call failed"
)
})
}
- /// Performs Create Connector Customer Granular
+ /// Performs Create Connector Customer
pub async fn create_connector_customer(
&self,
- create_customer_request: payments_grpc::PaymentServiceCreateConnectorCustomerRequest,
+ create_connector_customer_request: payments_grpc::CustomerServiceCreateRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
- ) -> UnifiedConnectorServiceResult<
- tonic::Response<payments_grpc::PaymentServiceCreateConnectorCustomerResponse>,
- > {
- let mut request = tonic::Request::new(create_customer_request);
+ ) -> UnifiedConnectorServiceResult<tonic::Response<payments_grpc::CustomerServiceCreateResponse>>
+ {
+ let mut request = tonic::Request::new(create_connector_customer_request);
let connector_name = connector_auth_metadata.connector_name.clone();
let metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.customer_service_client
.clone()
- .create_connector_customer(request)
+ .create(request)
.await
- .change_context(UnifiedConnectorServiceError::PaymentConnectorCustomerCreateFailure)
+ .change_context(UnifiedConnectorServiceError::CreateConnectorCustomerFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="create_connector_customer_granular",
+ method="create_connector_customer",
connector_name=?connector_name,
- "UCS create connector customer granular gRPC call failed"
+ "UCS create connector customer gRPC call failed"
)
})
}
@@ -322,7 +400,7 @@ impl UnifiedConnectorServiceClient {
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.payment_service_client
.clone()
.create_order(request)
.await
@@ -330,9 +408,9 @@ impl UnifiedConnectorServiceClient {
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="create_order",
+ method="payment_create_order",
connector_name=?connector_name,
- "UCS create_order gRPC call failed"
+ "UCS payment_create_order gRPC call failed"
)
})
}
@@ -340,11 +418,11 @@ impl UnifiedConnectorServiceClient {
/// Performs Payment Pre Authenticate
pub async fn payment_pre_authenticate(
&self,
- payment_pre_authenticate_request: payments_grpc::PaymentServicePreAuthenticateRequest,
+ payment_pre_authenticate_request: payments_grpc::PaymentMethodAuthenticationServicePreAuthenticateRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
) -> UnifiedConnectorServiceResult<
- tonic::Response<payments_grpc::PaymentServicePreAuthenticateResponse>,
+ tonic::Response<payments_grpc::PaymentMethodAuthenticationServicePreAuthenticateResponse>,
> {
let mut request = tonic::Request::new(payment_pre_authenticate_request);
@@ -354,7 +432,7 @@ impl UnifiedConnectorServiceClient {
*request.metadata_mut() = metadata;
- self.client
+ self.payment_method_authentication_service_client
.clone()
.pre_authenticate(request)
.await
@@ -372,11 +450,11 @@ impl UnifiedConnectorServiceClient {
/// Performs Payment Authenticate
pub async fn payment_authenticate(
&self,
- payment_authenticate_request: payments_grpc::PaymentServiceAuthenticateRequest,
+ payment_authenticate_request: payments_grpc::PaymentMethodAuthenticationServiceAuthenticateRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
) -> UnifiedConnectorServiceResult<
- tonic::Response<payments_grpc::PaymentServiceAuthenticateResponse>,
+ tonic::Response<payments_grpc::PaymentMethodAuthenticationServiceAuthenticateResponse>,
> {
let mut request = tonic::Request::new(payment_authenticate_request);
@@ -386,7 +464,7 @@ impl UnifiedConnectorServiceClient {
*request.metadata_mut() = metadata;
- self.client
+ self.payment_method_authentication_service_client
.clone()
.authenticate(request)
.await
@@ -394,40 +472,40 @@ impl UnifiedConnectorServiceClient {
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="payment_pre_authenticate",
+ method="payment_authenticate",
connector_name=?connector_name,
- "UCS payment pre authenticate gRPC call failed"
+ "UCS payment authenticate gRPC call failed"
)
})
}
- /// Performs Payment Session token create
- pub async fn payment_session_token_create(
+ /// Performs Session token create
+ pub async fn create_session_token(
&self,
- payment_create_session_token_request: payments_grpc::PaymentServiceCreateSessionTokenRequest,
+ create_session_token_request: payments_grpc::MerchantAuthenticationServiceCreateSessionTokenRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
) -> UnifiedConnectorServiceResult<
- tonic::Response<payments_grpc::PaymentServiceCreateSessionTokenResponse>,
+ tonic::Response<payments_grpc::MerchantAuthenticationServiceCreateSessionTokenResponse>,
> {
- let mut request = tonic::Request::new(payment_create_session_token_request);
+ let mut request = tonic::Request::new(create_session_token_request);
let connector_name = connector_auth_metadata.connector_name.clone();
let metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.merchant_authentication_service_client
.clone()
.create_session_token(request)
.await
- .change_context(UnifiedConnectorServiceError::PaymentCreateSessionTokenFailure)
+ .change_context(UnifiedConnectorServiceError::CreateSessionTokenFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
method="create_session_token",
connector_name=?connector_name,
- "UCS payment create_session_token gRPC call failed"
+ "UCS create_session_token gRPC call failed"
)
})
}
@@ -435,11 +513,11 @@ impl UnifiedConnectorServiceClient {
/// Performs Payment Post Authenticate
pub async fn payment_post_authenticate(
&self,
- payment_post_authenticate_request: payments_grpc::PaymentServicePostAuthenticateRequest,
+ payment_post_authenticate_request: payments_grpc::PaymentMethodAuthenticationServicePostAuthenticateRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
) -> UnifiedConnectorServiceResult<
- tonic::Response<payments_grpc::PaymentServicePostAuthenticateResponse>,
+ tonic::Response<payments_grpc::PaymentMethodAuthenticationServicePostAuthenticateResponse>,
> {
let mut request = tonic::Request::new(payment_post_authenticate_request);
@@ -449,7 +527,7 @@ impl UnifiedConnectorServiceClient {
*request.metadata_mut() = metadata;
- self.client
+ self.payment_method_authentication_service_client
.clone()
.post_authenticate(request)
.await
@@ -470,7 +548,9 @@ impl UnifiedConnectorServiceClient {
payment_authorize_request: payments_grpc::PaymentServiceAuthorizeRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
- ) -> UnifiedConnectorServiceResult<tonic::Response<PaymentServiceAuthorizeResponse>> {
+ ) -> UnifiedConnectorServiceResult<
+ tonic::Response<payments_grpc::PaymentServiceAuthorizeResponse>,
+ > {
let mut request = tonic::Request::new(payment_authorize_request);
let connector_name = connector_auth_metadata.connector_name.clone();
@@ -479,7 +559,7 @@ impl UnifiedConnectorServiceClient {
*request.metadata_mut() = metadata;
- self.client
+ self.payment_service_client
.clone()
.authorize(request)
.await
@@ -509,7 +589,7 @@ impl UnifiedConnectorServiceClient {
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.payment_service_client
.clone()
.get(request)
.await
@@ -539,7 +619,7 @@ impl UnifiedConnectorServiceClient {
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.payment_service_client
.clone()
.capture(request)
.await
@@ -554,99 +634,70 @@ impl UnifiedConnectorServiceClient {
})
}
- /// Performs Payment Setup Mandate
- pub async fn payment_setup_mandate(
+ /// Performs Payment Setup Recurring/Mandate
+ pub async fn payment_setup_recurring(
&self,
- payment_register_request: payments_grpc::PaymentServiceRegisterRequest,
+ payment_setup_recurring_request: payments_grpc::PaymentServiceSetupRecurringRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
- ) -> UnifiedConnectorServiceResult<tonic::Response<payments_grpc::PaymentServiceRegisterResponse>>
- {
- let mut request = tonic::Request::new(payment_register_request);
-
- let connector_name = connector_auth_metadata.connector_name.clone();
- let metadata =
- build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
- *request.metadata_mut() = metadata;
-
- self.client
- .clone()
- .register(request)
- .await
- .change_context(UnifiedConnectorServiceError::PaymentRegisterFailure)
- .inspect_err(|error| {
- logger::error!(
- grpc_error=?error,
- method="payment_setup_mandate",
- connector_name=?connector_name,
- "UCS payment setup mandate gRPC call failed"
- )
- })
- }
-
- /// Performs Payment Setup Mandate
- pub async fn payment_setup_mandate_granular(
- &self,
- payment_register_request: payments_grpc::PaymentServiceRegisterRequest,
- connector_auth_metadata: ConnectorAuthMetadata,
- grpc_headers: GrpcHeadersUcs,
- ) -> UnifiedConnectorServiceResult<tonic::Response<payments_grpc::PaymentServiceRegisterResponse>>
- {
- let mut request = tonic::Request::new(payment_register_request);
+ ) -> UnifiedConnectorServiceResult<
+ tonic::Response<payments_grpc::PaymentServiceSetupRecurringResponse>,
+ > {
+ let mut request = tonic::Request::new(payment_setup_recurring_request);
let connector_name = connector_auth_metadata.connector_name.clone();
let metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.payment_service_client
.clone()
- .register_only(request)
+ .setup_recurring(request)
.await
- .change_context(UnifiedConnectorServiceError::PaymentRegisterFailure)
+ .change_context(UnifiedConnectorServiceError::PaymentSetupRecurringFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="payment_setup_mandate_granular",
+ method="payment_setup_recurring",
connector_name=?connector_name,
- "UCS payment granular setup mandate gRPC call failed"
+ "UCS payment setup recurring gRPC call failed"
)
})
}
- /// Performs Payment repeat (MIT - Merchant Initiated Transaction).
- pub async fn payment_repeat(
+ /// Performs recurring payment (MIT - Merchant Initiated Transaction).
+ pub async fn recurring_payment_charge(
&self,
- payment_repeat_request: payments_grpc::PaymentServiceRepeatEverythingRequest,
+ recurring_payment_charge_request: payments_grpc::RecurringPaymentServiceChargeRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
) -> UnifiedConnectorServiceResult<
- tonic::Response<payments_grpc::PaymentServiceRepeatEverythingResponse>,
+ tonic::Response<payments_grpc::RecurringPaymentServiceChargeResponse>,
> {
- let mut request = tonic::Request::new(payment_repeat_request);
+ let mut request = tonic::Request::new(recurring_payment_charge_request);
let connector_name = connector_auth_metadata.connector_name.clone();
let metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.recurring_payment_service_client
.clone()
- .repeat_everything(request)
+ .charge(request)
.await
- .change_context(UnifiedConnectorServiceError::PaymentRepeatEverythingFailure)
+ .change_context(UnifiedConnectorServiceError::RecurringPaymentChargeFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="payment_repeat",
+ method="recurring_payment_charge",
connector_name=?connector_name,
- "UCS payment repeat gRPC call failed"
+ "UCS recurring payment charge gRPC call failed"
)
})
}
/// Performs Payment Cancel/Void
- pub async fn payment_cancel(
+ pub async fn payment_void(
&self,
payment_void_request: payments_grpc::PaymentServiceVoidRequest,
connector_auth_metadata: ConnectorAuthMetadata,
@@ -660,57 +711,58 @@ impl UnifiedConnectorServiceClient {
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.payment_service_client
.clone()
.void(request)
.await
- .change_context(UnifiedConnectorServiceError::PaymentCancelFailure)
+ .change_context(UnifiedConnectorServiceError::PaymentVoidFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="payment_cancel",
+ method="payment_void",
connector_name=?connector_name,
- "UCS payment cancel gRPC call failed"
+ "UCS payment void gRPC call failed"
)
})
}
- /// Transforms incoming webhook through UCS
- pub async fn transform_incoming_webhook(
+ /// Incoming webhook handle
+ pub async fn incoming_webhook_handle_event(
&self,
- webhook_transform_request: PaymentServiceTransformRequest,
+ incoming_webhook_handle_event_request: payments_grpc::EventServiceHandleRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
- ) -> UnifiedConnectorServiceResult<tonic::Response<PaymentServiceTransformResponse>> {
- let mut request = tonic::Request::new(webhook_transform_request);
+ ) -> UnifiedConnectorServiceResult<tonic::Response<payments_grpc::EventServiceHandleResponse>>
+ {
+ let mut request = tonic::Request::new(incoming_webhook_handle_event_request);
let connector_name = connector_auth_metadata.connector_name.clone();
let metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.event_service_client
.clone()
- .transform(request)
+ .handle_event(request)
.await
- .change_context(UnifiedConnectorServiceError::WebhookTransformFailure)
+ .change_context(UnifiedConnectorServiceError::IncomingWebhookHandleEventFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="transform_incoming_webhook",
+ method="incoming_webhook_handle_event",
connector_name=?connector_name,
- "UCS webhook transform gRPC call failed"
+ "UCS incoming webhook handle event gRPC call failed"
)
})
}
- /// Performs Payment Refund through PaymentService.Refund
+ /// Performs Payment Refund
pub async fn payment_refund(
&self,
- payment_refund_request: PaymentServiceRefundRequest,
+ payment_refund_request: payments_grpc::PaymentServiceRefundRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
- ) -> UnifiedConnectorServiceResult<tonic::Response<RefundResponse>> {
+ ) -> UnifiedConnectorServiceResult<tonic::Response<payments_grpc::RefundResponse>> {
let mut request = tonic::Request::new(payment_refund_request);
let connector_name = connector_auth_metadata.connector_name.clone();
@@ -718,7 +770,7 @@ impl UnifiedConnectorServiceClient {
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.payment_service_client
.clone()
.refund(request)
.await
@@ -733,21 +785,21 @@ impl UnifiedConnectorServiceClient {
})
}
- /// Performs Refund Sync through RefundService.Get
- pub async fn refund_sync(
+ /// Performs Refund Sync/Get
+ pub async fn refund_get(
&self,
- refund_sync_request: RefundServiceGetRequest,
+ refund_get_request: payments_grpc::RefundServiceGetRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
- ) -> UnifiedConnectorServiceResult<tonic::Response<RefundResponse>> {
- let mut request = tonic::Request::new(refund_sync_request);
+ ) -> UnifiedConnectorServiceResult<tonic::Response<payments_grpc::RefundResponse>> {
+ let mut request = tonic::Request::new(refund_get_request);
let connector_name = connector_auth_metadata.connector_name.clone();
let metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.refund_client
+ self.refund_service_client
.clone()
.get(request)
.await
@@ -755,9 +807,9 @@ impl UnifiedConnectorServiceClient {
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
- method="refund_sync",
+ method="refund_get",
connector_name=?connector_name,
- "UCS refund sync gRPC call failed"
+ "UCS refund get gRPC call failed"
)
})
}
@@ -765,11 +817,11 @@ impl UnifiedConnectorServiceClient {
/// Performs Create Access Token Granular
pub async fn create_access_token(
&self,
- create_access_token_request: payments_grpc::PaymentServiceCreateAccessTokenRequest,
+ create_access_token_request: payments_grpc::MerchantAuthenticationServiceCreateAccessTokenRequest,
connector_auth_metadata: ConnectorAuthMetadata,
grpc_headers: GrpcHeadersUcs,
) -> UnifiedConnectorServiceResult<
- tonic::Response<payments_grpc::PaymentServiceCreateAccessTokenResponse>,
+ tonic::Response<payments_grpc::MerchantAuthenticationServiceCreateAccessTokenResponse>,
> {
let mut request = tonic::Request::new(create_access_token_request);
let connector_name = connector_auth_metadata.connector_name.clone();
@@ -777,17 +829,17 @@ impl UnifiedConnectorServiceClient {
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
*request.metadata_mut() = metadata;
- self.client
+ self.merchant_authentication_service_client
.clone()
.create_access_token(request)
.await
- .change_context(UnifiedConnectorServiceError::PaymentCreateAccessTokenFailure)
+ .change_context(UnifiedConnectorServiceError::CreateAccessTokenFailure)
.inspect_err(|error| {
logger::error!(
grpc_error=?error,
method="create_access_token",
connector_name=?connector_name,
- "UCS create access token granular gRPC call failed"
+ "UCS create access token gRPC call failed"
)
})
}
@@ -857,6 +909,14 @@ pub fn build_unified_connector_service_grpc_headers(
);
}
+ // Add connector-specific config header if available
+ if let Some(connector_config) = meta.connector_config {
+ metadata.append(
+ consts::UCS_HEADER_CONNECTOR_CONFIG,
+ parse("connector_config", connector_config.peek())?,
+ );
+ }
+
metadata.append(
common_utils_consts::X_MERCHANT_ID,
parse(common_utils_consts::X_MERCHANT_ID, meta.merchant_id.peek())?,
diff --git a/crates/external_services/src/lib.rs b/crates/external_services/src/lib.rs
index 6d64794ab4..4d2cc17d02 100644
--- a/crates/external_services/src/lib.rs
+++ b/crates/external_services/src/lib.rs
@@ -99,6 +99,9 @@ pub mod consts {
/// Header key for sending the resource id to UCS
pub(crate) const UCS_HEADER_RESOURCE_ID: &str = "x-resource-id";
+
+ /// Header key for sending connector-specific configuration to UCS
+ pub(crate) const UCS_HEADER_CONNECTOR_CONFIG: &str = "x-connector-config";
}
/// Metrics for interactions with external systems.
diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.toml
index 45a773446b..f319313337 100644
--- a/crates/hyperswitch_interfaces/Cargo.toml
+++ b/crates/hyperswitch_interfaces/Cargo.toml
@@ -30,7 +30,7 @@ strum = { version = "0.26", features = ["derive"] }
thiserror = "1.0.69"
time = "0.3.41"
url = { version = "2.5.4", features = ["serde"] }
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", tag = "2026.03.04.0-hotfix2", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0de0cb9aeb0db7b01401ffae04c270ba2e3a1137", package = "rust-grpc-client" }
tokio = { version = "1.45.1", features = ["macros", "rt-multi-thread"] }
# First party crates
diff --git a/crates/hyperswitch_interfaces/src/unified_connector_service.rs b/crates/hyperswitch_interfaces/src/unified_connector_service.rs
index fe241bf433..4235180a3a 100644
--- a/crates/hyperswitch_interfaces/src/unified_connector_service.rs
+++ b/crates/hyperswitch_interfaces/src/unified_connector_service.rs
@@ -42,21 +42,21 @@ pub fn handle_unified_connector_service_response_for_payment_get(
/// Extracts the payments response from UCS webhook content
pub fn get_payments_response_from_ucs_webhook_content(
- webhook_content: payments_grpc::WebhookResponseContent,
+ event_content: payments_grpc::EventContent,
) -> CustomResult<payments_grpc::PaymentServiceGetResponse, UnifiedConnectorServiceError> {
- match webhook_content.content {
- Some(unified_connector_service_client::payments::webhook_response_content::Content::PaymentsResponse(payments_response)) => {
+ match event_content.content {
+ Some(unified_connector_service_client::payments::event_content::Content::PaymentsResponse(payments_response)) => {
Ok(payments_response)
},
- Some(unified_connector_service_client::payments::webhook_response_content::Content::RefundsResponse(_)) => {
+ Some(unified_connector_service_client::payments::event_content::Content::RefundsResponse(_)) => {
Err(UnifiedConnectorServiceError::WebhookProcessingFailure)
.attach_printable("UCS webhook contains refunds response but payments response was expected")?
},
- Some(unified_connector_service_client::payments::webhook_response_content::Content::DisputesResponse(_)) => {
+ Some(unified_connector_service_client::payments::event_content::Content::DisputesResponse(_)) => {
Err(UnifiedConnectorServiceError::WebhookProcessingFailure)
.attach_printable("UCS webhook contains disputes response but payments response was expected")?
},
- Some(unified_connector_service_client::payments::webhook_response_content::Content::IncompleteTransformation(_)) => {
+ Some(unified_connector_service_client::payments::event_content::Content::IncompleteTransformation(_)) => {
Err(UnifiedConnectorServiceError::WebhookProcessingFailure)
.attach_printable("UCS webhook contains incomplete transformation but payments response was expected")?
},
diff --git a/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs b/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs
index 75401e4941..5b0fd266f7 100644
--- a/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs
+++ b/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs
@@ -86,29 +86,29 @@ pub enum UnifiedConnectorServiceError {
#[error("Failed to inject metadata into request headers: {0}")]
HeaderInjectionFailed(String),
- /// Failed to perform Create Order from gRPC Server
- #[error("Failed to perform Create Order from gRPC Server")]
+ /// Failed to perform Payment Create Order from gRPC Server
+ #[error("Failed to perform Payment Create Order from gRPC Server")]
PaymentCreateOrderFailure,
/// Failed to perform Payment Authorize from gRPC Server
#[error("Failed to perform. Granular Payment Authorize from gRPC Server")]
PaymentAuthorizeGranularFailure,
- /// Failed to perform Payment Authorize from gRPC Server
- #[error("Failed to perform Payment Session Token Create from gRPC Server")]
- PaymentCreateSessionTokenFailure,
+ /// Failed to perform Create Session Token from gRPC Server
+ #[error("Failed to perform Create Session Token from gRPC Server")]
+ CreateSessionTokenFailure,
- /// Failed to perform Payment Authorize from gRPC Server
- #[error("Failed to perform Payment Access Token Create from gRPC Server")]
- PaymentCreateAccessTokenFailure,
+ /// Failed to perform Create Access Token from gRPC Server
+ #[error("Failed to perform Create Access Token from gRPC Server")]
+ CreateAccessTokenFailure,
- /// Failed to perform Payment Authorize from gRPC Server
- #[error("Failed to perform Payment Method Token Create from gRPC Server")]
- PaymentMethodTokenCreateFailure,
+ /// Failed to perform Payment Method Tokenize from gRPC Server
+ #[error("Failed to perform Payment Method Tokenize from gRPC Server")]
+ PaymentMethodTokenizeFailure,
- /// Failed to perform Payment Authorize from gRPC Server
- #[error("Failed to perform Connector Customer Create from gRPC Server")]
- PaymentConnectorCustomerCreateFailure,
+ /// Failed to perform Create Connector Customer from gRPC Server
+ #[error("Failed to perform Create Connector Customer from gRPC Server")]
+ CreateConnectorCustomerFailure,
/// Failed to perform Payment Authorize from gRPC Server
#[error("Failed to perform Payment Authorize from gRPC Server")]
@@ -134,13 +134,13 @@ pub enum UnifiedConnectorServiceError {
#[error("Failed to perform Payment Capture from gRPC Server")]
PaymentCaptureFailure,
- /// Failed to perform Payment Setup Mandate from gRPC Server
- #[error("Failed to perform Setup Mandate from gRPC Server")]
- PaymentRegisterFailure,
+ /// Failed to perform Payment Setup Recurring from gRPC Server
+ #[error("Failed to perform Setup Recurring from gRPC Server")]
+ PaymentSetupRecurringFailure,
- /// Failed to perform Payment Repeat Payment from gRPC Server
- #[error("Failed to perform Repeat Payment from gRPC Server")]
- PaymentRepeatEverythingFailure,
+ /// Failed to perform Recurring Payment Charge from gRPC Server
+ #[error("Failed to perform Recurring Payment Charge from gRPC Server")]
+ RecurringPaymentChargeFailure,
/// Failed to perform Payment Refund from gRPC Server
#[error("Failed to perform Payment Refund from gRPC Server")]
@@ -150,21 +150,21 @@ pub enum UnifiedConnectorServiceError {
#[error("Failed to perform Refund Sync from gRPC Server")]
RefundSyncFailure,
- /// Failed to transform incoming webhook from gRPC Server
- #[error("Failed to transform incoming webhook from gRPC Server")]
- WebhookTransformFailure,
+ /// Failed to handle incoming webhook event from gRPC Server
+ #[error("Failed to handle incoming webhook event from gRPC Server")]
+ IncomingWebhookHandleEventFailure,
- /// Failed to perform Payment Cancel from gRPC Server
- #[error("Failed to perform Cancel from gRPC Server")]
- PaymentCancelFailure,
+ /// Failed to perform Payment Void from gRPC Server
+ #[error("Failed to perform Void from gRPC Server")]
+ PaymentVoidFailure,
- /// Failed to perform Sdk Session Token from gRPC Server
- #[error("Failed to perform Sdk Session Token from gRPC Server")]
- SdkSessionTokenFailure,
+ /// Failed to perform Create Sdk Session Token from gRPC Server
+ #[error("Failed to perform Create Sdk Session Token from gRPC Server")]
+ CreateSdkSessionTokenFailure,
- /// Failed to perform Incremental Authorization from gRPC Server
- #[error("Failed to perform Incremental Authorization from gRPC Server")]
- IncrementalAuthorizationFailure,
+ /// Failed to perform Payment Incremental Authorization from gRPC Server
+ #[error("Failed to perform Payment Incremental Authorization from gRPC Server")]
+ PaymentIncrementalAuthorizationFailure,
}
/// UCS Webhook transformation status
@@ -182,7 +182,7 @@ pub enum WebhookTransformationStatus {
pub struct WebhookTransformData {
pub event_type: api_models::webhooks::IncomingWebhookEvent,
pub source_verified: bool,
- pub webhook_content: Option<payments_grpc::WebhookResponseContent>,
+ pub webhook_content: Option<payments_grpc::EventContent>,
pub response_ref_id: Option<String>,
pub webhook_transformation_status: WebhookTransformationStatus,
}
@@ -195,31 +195,23 @@ impl ForeignTryFrom<(payments_grpc::PaymentServiceGetResponse, AttemptStatus)>
fn foreign_try_from(
(response, prev_status): (payments_grpc::PaymentServiceGetResponse, AttemptStatus),
) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
-
let status_code = convert_connector_service_status_code(response.status_code)?;
- let resource_id: hyperswitch_domain_models::router_request_types::ResponseId = match response.transaction_id.as_ref().and_then(|id| id.id_type.clone()) {
- Some(payments_grpc::identifier::IdType::Id(id)) => hyperswitch_domain_models::router_request_types::ResponseId::ConnectorTransactionId(id),
- Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => hyperswitch_domain_models::router_request_types::ResponseId::EncodedData(encoded_data),
- Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => hyperswitch_domain_models::router_request_types::ResponseId::NoResponseId,
- };
+ let connector_transaction_id =
+ hyperswitch_domain_models::router_request_types::ResponseId::ConnectorTransactionId(
+ response.connector_transaction_id.clone(),
+ );
+
+ let connector_details = response
+ .error
+ .as_ref()
+ .and_then(|e| e.connector_details.as_ref());
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_code) =
+ connector_details.and_then(|details| details.code.clone())
+ {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
@@ -227,16 +219,42 @@ impl ForeignTryFrom<(payments_grpc::PaymentServiceGetResponse, AttemptStatus)>
};
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_code,
+ message: connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: connector_details.as_ref().and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
- connector_transaction_id: resource_id.get_optional_response_id(),
- connector_response_reference_id,
- network_decline_code: response.network_decline_code.clone(),
- network_advice_code: response.network_advice_code.clone(),
- network_error_message: response.network_error_message.clone(),
+ connector_transaction_id: connector_transaction_id.get_optional_response_id(),
+ connector_response_reference_id: response.merchant_transaction_id,
+ network_decline_code: response.error.as_ref().and_then(|error| {
+ error.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ })
+ }),
+ network_advice_code: response.error.as_ref().and_then(|error| {
+ error.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ })
+ }),
+ network_error_message: response.error.as_ref().and_then(|error| {
+ error.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ })
+ }),
connector_metadata: None,
})
} else {
@@ -244,7 +262,7 @@ impl ForeignTryFrom<(payments_grpc::PaymentServiceGetResponse, AttemptStatus)>
Ok((
PaymentsResponseData::TransactionResponse {
- resource_id,
+ resource_id: connector_transaction_id,
redirection_data: Box::new(
response
.redirection_data
@@ -252,18 +270,11 @@ impl ForeignTryFrom<(payments_grpc::PaymentServiceGetResponse, AttemptStatus)>
.map(ForeignTryFrom::foreign_try_from)
.transpose()?,
),
- mandate_reference: Box::new(response.mandate_reference.map(|grpc_mandate| {
- hyperswitch_domain_models::router_response_types::MandateReference {
- connector_mandate_id: grpc_mandate.mandate_id,
- payment_method_id: grpc_mandate.payment_method_id,
- mandate_metadata: None,
- connector_mandate_request_reference_id: None,
- }
- })),
+ mandate_reference: Box::new(response.mandate_reference.map(hyperswitch_domain_models::router_response_types::MandateReference::foreign_try_from).transpose()?),
connector_metadata: None,
- network_txn_id: response.network_txn_id.clone(),
- connector_response_reference_id,
- incremental_authorization_allowed: None,
+ network_txn_id: response.network_transaction_id.clone(),
+ connector_response_reference_id: response.merchant_transaction_id,
+ incremental_authorization_allowed: response.incremental_authorization_allowed,
authentication_data: None,
charges: None,
},
@@ -275,6 +286,28 @@ impl ForeignTryFrom<(payments_grpc::PaymentServiceGetResponse, AttemptStatus)>
}
}
+impl ForeignTryFrom<payments_grpc::MandateReference>
+ for hyperswitch_domain_models::router_response_types::MandateReference
+{
+ type Error = error_stack::Report<UnifiedConnectorServiceError>;
+
+ fn foreign_try_from(value: payments_grpc::MandateReference) -> Result<Self, Self::Error> {
+ match value.mandate_id_type {
+ Some(payments_grpc::mandate_reference::MandateIdType::ConnectorMandateId(
+ connector_mandate_id,
+ )) => Ok(Self {
+ connector_mandate_id: connector_mandate_id.connector_mandate_id,
+ payment_method_id: connector_mandate_id.payment_method_id,
+ mandate_metadata: None,
+ connector_mandate_request_reference_id: connector_mandate_id
+ .connector_mandate_request_reference_id,
+ }),
+ _ => Err(UnifiedConnectorServiceError::ResponseDeserializationFailed)
+ .attach_printable("Recieved Invalid MandateReference from UCS"),
+ }
+ }
+}
+
impl ForeignTryFrom<(payments_grpc::PaymentStatus, Self)> for AttemptStatus {
type Error = error_stack::Report<UnifiedConnectorServiceError>;
@@ -313,7 +346,7 @@ impl ForeignTryFrom<(payments_grpc::PaymentStatus, Self)> for AttemptStatus {
Ok(Self::DeviceDataCollectionPending)
}
payments_grpc::PaymentStatus::VoidedPostCapture => Ok(Self::Voided),
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => Ok(prev_status),
+ payments_grpc::PaymentStatus::Unspecified => Ok(prev_status),
payments_grpc::PaymentStatus::PartiallyAuthorized => Ok(Self::PartiallyAuthorized),
payments_grpc::PaymentStatus::Expired => Ok(Self::Expired),
}
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index fdab7daed0..3a9eba984b 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -90,8 +90,8 @@ reqwest = { version = "0.11.27", features = ["json", "rustls-tls", "gzip", "mult
ring = "0.17.14"
rust_decimal = { version = "1.37.1", features = ["serde-with-float", "serde-with-str"] }
rust-i18n = { git = "https://github.com/kashif-m/rust-i18n", rev = "f2d8096aaaff7a87a847c35a5394c269f75e077a" }
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", tag = "2026.03.04.0-hotfix2", package = "rust-grpc-client" }
-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", tag = "2026.03.04.0-hotfix2", package = "ucs_cards" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0de0cb9aeb0db7b01401ffae04c270ba2e3a1137", package = "rust-grpc-client" }
+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "0de0cb9aeb0db7b01401ffae04c270ba2e3a1137", package = "ucs_cards" }
rustc-hash = "1.1.0"
rustls = "0.22"
rustls-pemfile = "2"
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index 782657133c..52718ee387 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -31,8 +31,8 @@ use super::{ConstructFlowSpecificData, Feature};
use crate::core::unified_connector_service::{
get_access_token_from_ucs_response,
handle_unified_connector_service_response_for_payment_authorize,
- handle_unified_connector_service_response_for_payment_repeat, set_access_token_for_ucs,
- ucs_logging_wrapper,
+ handle_unified_connector_service_response_for_recurring_payment_charge,
+ set_access_token_for_ucs, ucs_logging_wrapper,
};
use crate::{
core::{
@@ -1445,9 +1445,11 @@ pub async fn call_unified_connector_service_pre_authenticate(
.attach_printable("Failed to fetch Unified Connector Service client")?;
let payment_pre_authenticate_request =
- payments_grpc::PaymentServicePreAuthenticateRequest::foreign_try_from(router_data)
- .change_context(interface_errors::ConnectorError::RequestEncodingFailed)
- .attach_printable("Failed to construct Payment Authorize Request")?;
+ payments_grpc::PaymentMethodAuthenticationServicePreAuthenticateRequest::foreign_try_from(
+ router_data,
+ )
+ .change_context(interface_errors::ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to construct Payment Pre Authenticate Request")?;
let connector_auth_metadata =
unified_connector_service::build_unified_connector_service_auth_metadata(
@@ -1490,7 +1492,7 @@ pub async fn call_unified_connector_service_pre_authenticate(
grpc_headers,
)
.await
- .attach_printable("Failed to authorize payment")?;
+ .attach_printable("Failed to pre authenticate payment")?;
let payment_pre_authenticate_response = response.into_inner();
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 22f8cc2360..9c8b190c82 100644
--- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
@@ -640,9 +640,11 @@ pub async fn call_unified_connector_service_authenticate(
.attach_printable("Failed to fetch Unified Connector Service client")?;
let payment_authenticate_request =
- payments_grpc::PaymentServiceAuthenticateRequest::foreign_try_from(router_data)
- .change_context(interface_errors::ConnectorError::RequestEncodingFailed)
- .attach_printable("Failed to construct Payment Authorize Request")?;
+ payments_grpc::PaymentMethodAuthenticationServiceAuthenticateRequest::foreign_try_from(
+ router_data,
+ )
+ .change_context(interface_errors::ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to construct Payment Authenticate Request")?;
let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(
merchant_connector_account,
@@ -677,14 +679,13 @@ pub async fn call_unified_connector_service_authenticate(
headers_builder,
unified_connector_service_execution_mode,
|mut router_data, payment_authenticate_request, grpc_headers| async move {
- let response = client
- .payment_authenticate(
- payment_authenticate_request,
- connector_auth_metadata,
- grpc_headers,
- )
- .await
- .attach_printable("Failed to authorize payment")?;
+ let response = Box::pin(client.payment_authenticate(
+ payment_authenticate_request,
+ connector_auth_metadata,
+ grpc_headers,
+ ))
+ .await
+ .attach_printable("Failed to authenticate payment")?;
let payment_authenticate_response = response.into_inner();
@@ -752,9 +753,11 @@ pub async fn call_unified_connector_service_post_authenticate(
.attach_printable("Failed to fetch Unified Connector Service client")?;
let payment_post_authenticate_request =
- payments_grpc::PaymentServicePostAuthenticateRequest::foreign_try_from(router_data)
- .change_context(interface_errors::ConnectorError::RequestEncodingFailed)
- .attach_printable("Failed to construct Payment Authorize Request")?;
+ payments_grpc::PaymentMethodAuthenticationServicePostAuthenticateRequest::foreign_try_from(
+ router_data,
+ )
+ .change_context(interface_errors::ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to construct Payment Post Authenticate Request")?;
let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(
merchant_connector_account,
@@ -789,14 +792,13 @@ pub async fn call_unified_connector_service_post_authenticate(
headers_builder,
unified_connector_service_execution_mode,
|mut router_data, payment_post_authenticate_request, grpc_headers| async move {
- let response = client
- .payment_post_authenticate(
- payment_post_authenticate_request,
- connector_auth_metadata,
- grpc_headers,
- )
- .await
- .attach_printable("Failed to authorize payment")?;
+ let response = Box::pin(client.payment_post_authenticate(
+ payment_post_authenticate_request,
+ connector_auth_metadata,
+ grpc_headers,
+ ))
+ .await
+ .attach_printable("Failed to post authenticate payment")?;
let payment_post_authenticate_response = response.into_inner();
diff --git a/crates/router/src/core/payments/gateway/access_token_gateway.rs b/crates/router/src/core/payments/gateway/access_token_gateway.rs
index 7c3b8d787b..141c93b4d9 100644
--- a/crates/router/src/core/payments/gateway/access_token_gateway.rs
+++ b/crates/router/src/core/payments/gateway/access_token_gateway.rs
@@ -88,10 +88,9 @@ where
.attach_printable("Failed to fetch Unified Connector Service client")?;
let create_access_token_request =
- payments_grpc::PaymentServiceCreateAccessTokenRequest::foreign_try_from((
- router_data,
- call_connector_action,
- ))
+ payments_grpc::MerchantAuthenticationServiceCreateAccessTokenRequest::foreign_try_from(
+ (router_data, call_connector_action),
+ )
.change_context(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to construct Create Access Token Request")?;
diff --git a/crates/router/src/core/payments/gateway/authorize_gateway.rs b/crates/router/src/core/payments/gateway/authorize_gateway.rs
index 331f463669..dc9b137e10 100644
--- a/crates/router/src/core/payments/gateway/authorize_gateway.rs
+++ b/crates/router/src/core/payments/gateway/authorize_gateway.rs
@@ -18,7 +18,7 @@ use crate::{
payments::gateway::context::RouterGatewayContext,
unified_connector_service::{
self, handle_unified_connector_service_response_for_payment_authorize,
- handle_unified_connector_service_response_for_payment_repeat,
+ handle_unified_connector_service_response_for_recurring_payment_charge,
},
},
routes::SessionState,
@@ -78,8 +78,8 @@ where
.ok_or(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to fetch Unified Connector Service client")?;
- // Check if this is a repeat payment (MIT with mandate_id or MandatePayment)
- let is_repeat_payment = router_data.request.mandate_id.is_some()
+ // Check if this is a MIT payment (MIT with mandate_id or MandatePayment)
+ let is_mit_payment = router_data.request.mandate_id.is_some()
|| matches!(
router_data.request.payment_method_data,
hyperswitch_domain_models::payment_method_data::PaymentMethodData::MandatePayment
@@ -115,39 +115,39 @@ where
.resource_id(resource_id)
.lineage_ids(lineage_ids);
- let updated_router_data = if is_repeat_payment {
+ let updated_router_data = if is_mit_payment {
logger::info!(
- "Granular Gateway: Detected repeat payment, calling UCS RepeatPayment endpoint"
+ "Granular Gateway: Detected MIT payment, calling UCS recurring_payment_charge endpoint"
);
- let payment_repeat_request =
- payments_grpc::PaymentServiceRepeatEverythingRequest::foreign_try_from(router_data)
+ let recurring_payment_charge_request =
+ payments_grpc::RecurringPaymentServiceChargeRequest::foreign_try_from(router_data)
.change_context(ConnectorError::RequestEncodingFailed)
- .attach_printable("Failed to construct Payment Repeat Request")?;
+ .attach_printable("Failed to construct Recurring Payment Charge Request")?;
Box::pin(unified_connector_service::ucs_logging_wrapper_granular(
router_data.clone(),
state,
- payment_repeat_request,
+ recurring_payment_charge_request,
grpc_headers,
unified_connector_service_execution_mode,
- |mut router_data, payment_repeat_request, grpc_headers| async move {
- logger::debug!("Calling UCS payment_repeat gRPC method");
- let response = Box::pin(client.payment_repeat(
- payment_repeat_request,
+ |mut router_data, recurring_payment_charge_request, grpc_headers| async move {
+ let response = Box::pin(client.recurring_payment_charge(
+ recurring_payment_charge_request,
connector_auth_metadata,
grpc_headers,
))
.await
- .attach_printable("Failed to repeat payment")?;
+ .attach_printable("Failed to charge recurring payment")?;
- let payment_repeat_response = response.into_inner();
+ let recurring_payment_charge_response = response.into_inner();
- let ucs_data = handle_unified_connector_service_response_for_payment_repeat(
- payment_repeat_response.clone(),
- router_data.status,
- )
- .attach_printable("Failed to deserialize UCS response")?;
+ let ucs_data =
+ handle_unified_connector_service_response_for_recurring_payment_charge(
+ recurring_payment_charge_response.clone(),
+ router_data.status,
+ )
+ .attach_printable("Failed to deserialize UCS response")?;
let router_data_response = match ucs_data.router_data_response {
Ok((response, status)) => {
@@ -164,11 +164,11 @@ where
};
router_data.response = router_data_response;
- router_data.amount_captured = payment_repeat_response.captured_amount;
- router_data.minor_amount_captured = payment_repeat_response
- .minor_captured_amount
+ router_data.amount_captured = recurring_payment_charge_response.captured_amount;
+ router_data.minor_amount_captured = recurring_payment_charge_response
+ .captured_amount
.map(MinorUnit::new);
- router_data.raw_connector_response = payment_repeat_response
+ router_data.raw_connector_response = recurring_payment_charge_response
.raw_connector_response
.clone()
.map(|raw_connector_response| raw_connector_response.expose().into());
@@ -182,7 +182,7 @@ where
router_data.connector_response = Some(connector_response);
});
- Ok((router_data, (), payment_repeat_response))
+ Ok((router_data, (), recurring_payment_charge_response))
},
))
.await
@@ -191,12 +191,12 @@ where
} else {
logger::debug!("Granular Gateway: Regular authorize flow");
let granular_authorize_request =
- payments_grpc::PaymentServiceAuthorizeOnlyRequest::foreign_try_from((
+ payments_grpc::PaymentServiceAuthorizeRequest::foreign_try_from((
router_data,
call_connector_action,
))
.change_context(ConnectorError::RequestEncodingFailed)
- .attach_printable("Failed to construct Payment Get Request")?;
+ .attach_printable("Failed to construct Payment Authorize Request")?;
Box::pin(unified_connector_service::ucs_logging_wrapper_granular(
router_data.clone(),
@@ -205,13 +205,13 @@ where
grpc_headers,
unified_connector_service_execution_mode,
|mut router_data, granular_authorize_request, grpc_headers| async move {
- let response = Box::pin(client.payment_authorize_granular(
+ let response = Box::pin(client.payment_authorize(
granular_authorize_request,
connector_auth_metadata,
grpc_headers,
))
.await
- .attach_printable("Failed to get payment")?;
+ .attach_printable("Failed to authorize payment")?;
let payment_authorize_response = response.into_inner();
@@ -238,10 +238,10 @@ where
router_data.amount_captured = payment_authorize_response.captured_amount;
router_data.minor_amount_captured = payment_authorize_response
- .minor_captured_amount
+ .captured_amount
.map(MinorUnit::new);
router_data.minor_amount_capturable = payment_authorize_response
- .minor_capturable_amount
+ .capturable_amount
.map(MinorUnit::new);
router_data.raw_connector_response = payment_authorize_response
.raw_connector_response
diff --git a/crates/router/src/core/payments/gateway/cancel_gateway.rs b/crates/router/src/core/payments/gateway/cancel_gateway.rs
index 706ac8951d..bd3cfa6674 100644
--- a/crates/router/src/core/payments/gateway/cancel_gateway.rs
+++ b/crates/router/src/core/payments/gateway/cancel_gateway.rs
@@ -115,9 +115,9 @@ where
unified_connector_service_execution_mode,
|mut router_data, payment_void_request, grpc_headers| async move {
let response = client
- .payment_cancel(payment_void_request, connector_auth_metadata, grpc_headers)
+ .payment_void(payment_void_request, connector_auth_metadata, grpc_headers)
.await
- .attach_printable("Failed to Cancel payment")?;
+ .attach_printable("Failed to Void payment")?;
let payment_void_response = response.into_inner();
diff --git a/crates/router/src/core/payments/gateway/capture_gateway.rs b/crates/router/src/core/payments/gateway/capture_gateway.rs
index c828c5f446..fa65ca4cb8 100644
--- a/crates/router/src/core/payments/gateway/capture_gateway.rs
+++ b/crates/router/src/core/payments/gateway/capture_gateway.rs
@@ -146,7 +146,7 @@ where
router_data.response = router_data_response;
router_data.amount_captured = payment_capture_response.captured_amount;
router_data.minor_amount_captured = payment_capture_response
- .minor_captured_amount
+ .captured_amount
.map(MinorUnit::new);
router_data.connector_http_status_code = Some(status_code);
diff --git a/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs b/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs
index 233dc8043c..ec9abb084d 100644
--- a/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs
+++ b/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs
@@ -76,12 +76,12 @@ where
.attach_printable("Failed to fetch Unified Connector Service client")?;
let granular_authorize_request =
- payments_grpc::PaymentServiceAuthorizeOnlyRequest::foreign_try_from((
+ payments_grpc::PaymentServiceAuthorizeRequest::foreign_try_from((
router_data,
call_connector_action,
))
.change_context(ConnectorError::RequestEncodingFailed)
- .attach_printable("Failed to construct Payment Get Request")?;
+ .attach_printable("Failed to construct Payment Authorize Request")?;
let connector_auth_metadata =
unified_connector_service::build_unified_connector_service_auth_metadata(
@@ -117,7 +117,7 @@ where
header_payload,
unified_connector_service_execution_mode,
|mut router_data, granular_authorize_request, grpc_headers| async move {
- let response = Box::pin(client.payment_authorize_granular(
+ let response = Box::pin(client.payment_authorize(
granular_authorize_request,
connector_auth_metadata,
grpc_headers,
@@ -150,7 +150,7 @@ where
router_data.amount_captured = payment_authorize_response.captured_amount;
router_data.minor_amount_captured = payment_authorize_response
- .minor_captured_amount
+ .captured_amount
.map(MinorUnit::new);
router_data.raw_connector_response = payment_authorize_response
.raw_connector_response
diff --git a/crates/router/src/core/payments/gateway/create_customer_gateway.rs b/crates/router/src/core/payments/gateway/create_customer_gateway.rs
index 1d3a6b21f1..d3d84c3e02 100644
--- a/crates/router/src/core/payments/gateway/create_customer_gateway.rs
+++ b/crates/router/src/core/payments/gateway/create_customer_gateway.rs
@@ -82,7 +82,7 @@ where
.attach_printable("Failed to fetch Unified Connector Service client")?;
let create_connector_customer_request =
- payments_grpc::PaymentServiceCreateConnectorCustomerRequest::foreign_try_from((
+ payments_grpc::CustomerServiceCreateRequest::foreign_try_from((
router_data,
call_connector_action,
))
diff --git a/crates/router/src/core/payments/gateway/create_order_gateway.rs b/crates/router/src/core/payments/gateway/create_order_gateway.rs
index 64d878de1a..4b9e2e4d97 100644
--- a/crates/router/src/core/payments/gateway/create_order_gateway.rs
+++ b/crates/router/src/core/payments/gateway/create_order_gateway.rs
@@ -16,7 +16,7 @@ use crate::{
core::{
payments::gateway::context::RouterGatewayContext,
unified_connector_service::{
- self, handle_unified_connector_service_response_for_create_order,
+ self, handle_unified_connector_service_response_for_payment_create_order,
},
},
routes::SessionState,
@@ -128,7 +128,7 @@ where
let create_order_response = response.into_inner();
let (router_data_response, status_code) =
- handle_unified_connector_service_response_for_create_order(
+ handle_unified_connector_service_response_for_payment_create_order(
create_order_response.clone(),
router_data.status,
)
diff --git a/crates/router/src/core/payments/gateway/incremental_authorization_gateway.rs b/crates/router/src/core/payments/gateway/incremental_authorization_gateway.rs
index 2bffb2e267..69ebd3fb40 100644
--- a/crates/router/src/core/payments/gateway/incremental_authorization_gateway.rs
+++ b/crates/router/src/core/payments/gateway/incremental_authorization_gateway.rs
@@ -16,7 +16,7 @@ use crate::{
core::{
payments::gateway::context::RouterGatewayContext,
unified_connector_service::{
- self, handle_unified_connector_service_response_for_incremental_authorization,
+ self, handle_unified_connector_service_response_for_payment_incremental_authorization,
},
},
routes::SessionState,
@@ -128,7 +128,7 @@ where
header_payload,
unified_connector_service_execution_mode,
|mut router_data, incremental_authorization_request, grpc_headers| async move {
- let response = Box::pin(client.incremental_authorization(
+ let response = Box::pin(client.payment_incremental_authorization(
incremental_authorization_request,
connector_auth_metadata,
grpc_headers,
@@ -139,7 +139,7 @@ where
let incremental_authorization_response = response.into_inner();
let (router_data_response, status_code) =
- handle_unified_connector_service_response_for_incremental_authorization(
+ handle_unified_connector_service_response_for_payment_incremental_authorization(
incremental_authorization_response.clone(),
)
.attach_printable("Failed to deserialize UCS response")?;
diff --git a/crates/router/src/core/payments/gateway/payment_method_token_create_gateway.rs b/crates/router/src/core/payments/gateway/payment_method_token_create_gateway.rs
index 8602c6dce7..860104fc99 100644
--- a/crates/router/src/core/payments/gateway/payment_method_token_create_gateway.rs
+++ b/crates/router/src/core/payments/gateway/payment_method_token_create_gateway.rs
@@ -15,7 +15,7 @@ use unified_connector_service_client::payments as payments_grpc;
use crate::{
core::{
payments::gateway::context::RouterGatewayContext, unified_connector_service,
- unified_connector_service::handle_unified_connector_service_response_for_payment_method_token_create,
+ unified_connector_service::handle_unified_connector_service_response_for_payment_method_tokenize,
},
routes::SessionState,
services::logger,
@@ -82,12 +82,10 @@ where
.ok_or(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to fetch Unified Connector Service client")?;
- let pm_token_create_request =
- payments_grpc::PaymentServiceCreatePaymentMethodTokenRequest::foreign_try_from(
- router_data,
- )
- .change_context(ConnectorError::RequestEncodingFailed)
- .attach_printable("Failed to construct Payment Get Request")?;
+ let payment_method_tokenize_request =
+ payments_grpc::PaymentMethodServiceTokenizeRequest::foreign_try_from(router_data)
+ .change_context(ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to construct Payment Method Tokenize Request")?;
let connector_auth_metadata =
unified_connector_service::build_unified_connector_service_auth_metadata(
@@ -120,23 +118,23 @@ where
Box::pin(unified_connector_service::ucs_logging_wrapper_granular(
router_data.clone(),
state,
- pm_token_create_request,
+ payment_method_tokenize_request,
header_payload,
unified_connector_service_execution_mode,
- |mut router_data, pm_token_create_request, grpc_headers| async move {
- let response = Box::pin(client.payment_method_token_create(
- pm_token_create_request,
+ |mut router_data, payment_method_tokenize_request, grpc_headers| async move {
+ let response = Box::pin(client.payment_method_tokenize(
+ payment_method_tokenize_request,
connector_auth_metadata,
grpc_headers,
))
.await
- .attach_printable("Failed to get payment")?;
+ .attach_printable("Failed to Tokenize payment method")?;
- let pm_token_create_response = response.into_inner();
+ let payment_method_tokenize_response = response.into_inner();
let (router_data_response, status_code) =
- handle_unified_connector_service_response_for_payment_method_token_create(
- pm_token_create_response.clone(),
+ handle_unified_connector_service_response_for_payment_method_tokenize(
+ payment_method_tokenize_response.clone(),
)
.attach_printable("Failed to deserialize UCS response")?;
@@ -154,7 +152,7 @@ where
router_data.response = router_data_response;
router_data.connector_http_status_code = Some(status_code);
- Ok((router_data, (), pm_token_create_response))
+ Ok((router_data, (), payment_method_tokenize_response))
},
))
.await
diff --git a/crates/router/src/core/payments/gateway/psync_gateway.rs b/crates/router/src/core/payments/gateway/psync_gateway.rs
index b042186194..8ab806f24e 100644
--- a/crates/router/src/core/payments/gateway/psync_gateway.rs
+++ b/crates/router/src/core/payments/gateway/psync_gateway.rs
@@ -69,7 +69,7 @@ where
> {
match call_connector_action {
CallConnectorAction::UCSConsumeResponse(transform_data_bytes) => {
- let webhook_content: payments_grpc::WebhookResponseContent =
+ let webhook_content: payments_grpc::EventContent =
serde_json::from_slice(&transform_data_bytes)
.change_context(ConnectorError::ResponseHandlingFailed)
.attach_printable("Failed to deserialize UCS webhook transform data")?;
@@ -105,9 +105,8 @@ where
router_data.response = router_data_response;
router_data.amount_captured = payment_get_response.captured_amount;
- router_data.minor_amount_captured = payment_get_response
- .minor_captured_amount
- .map(MinorUnit::new);
+ router_data.minor_amount_captured =
+ payment_get_response.captured_amount.map(MinorUnit::new);
router_data.raw_connector_response = payment_get_response
.raw_connector_response
.clone()
@@ -232,9 +231,8 @@ where
router_data.response = router_data_response;
router_data.amount_captured = payment_get_response.captured_amount;
- router_data.minor_amount_captured = payment_get_response
- .minor_captured_amount
- .map(MinorUnit::new);
+ router_data.minor_amount_captured =
+ payment_get_response.captured_amount.map(MinorUnit::new);
router_data.raw_connector_response = payment_get_response
.raw_connector_response
.clone()
diff --git a/crates/router/src/core/payments/gateway/session_gateway.rs b/crates/router/src/core/payments/gateway/session_gateway.rs
index e40fe69221..6eb4962943 100644
--- a/crates/router/src/core/payments/gateway/session_gateway.rs
+++ b/crates/router/src/core/payments/gateway/session_gateway.rs
@@ -16,7 +16,7 @@ use crate::{
core::{
payments::gateway::context::RouterGatewayContext,
unified_connector_service::{
- self, handle_unified_connector_service_response_for_sdk_session_token,
+ self, handle_unified_connector_service_response_for_create_sdk_session_token,
},
},
routes::SessionState,
@@ -76,8 +76,8 @@ where
.ok_or(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to fetch Unified Connector Service client")?;
- let sdk_session_token_request =
- payments_grpc::PaymentServiceSdkSessionTokenRequest::foreign_try_from(router_data)
+ let create_sdk_session_token_request =
+ payments_grpc::MerchantAuthenticationServiceCreateSdkSessionTokenRequest::foreign_try_from(router_data)
.change_context(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to construct Payment SdkSessionToken Request")?;
@@ -114,22 +114,22 @@ where
Box::pin(unified_connector_service::ucs_logging_wrapper_granular(
router_data.clone(),
state,
- sdk_session_token_request,
+ create_sdk_session_token_request,
header_payload,
unified_connector_service_execution_mode,
- |mut router_data, sdk_session_token_request, grpc_headers| async move {
- let response = Box::pin(client.sdk_session_token(
- sdk_session_token_request,
+ |mut router_data, create_sdk_session_token_request, grpc_headers| async move {
+ let response = Box::pin(client.create_sdk_session_token(
+ create_sdk_session_token_request,
connector_auth_metadata,
grpc_headers,
))
.await
- .attach_printable("Failed to get payment")?;
+ .attach_printable("Failed to create SDK session token")?;
let sdk_session_token_response = response.into_inner();
let (router_data_response, status_code) =
- handle_unified_connector_service_response_for_sdk_session_token(
+ handle_unified_connector_service_response_for_create_sdk_session_token(
sdk_session_token_response.clone(),
)
.attach_printable("Failed to deserialize UCS response")?;
diff --git a/crates/router/src/core/payments/gateway/session_token_gateway.rs b/crates/router/src/core/payments/gateway/session_token_gateway.rs
index b1befea969..20a959f731 100644
--- a/crates/router/src/core/payments/gateway/session_token_gateway.rs
+++ b/crates/router/src/core/payments/gateway/session_token_gateway.rs
@@ -15,7 +15,7 @@ use unified_connector_service_client::payments as payments_grpc;
use crate::{
core::{
payments::gateway::context::RouterGatewayContext, unified_connector_service,
- unified_connector_service::handle_unified_connector_service_response_for_session_token_create,
+ unified_connector_service::handle_unified_connector_service_response_for_create_session_token,
},
routes::SessionState,
services::logger,
@@ -79,8 +79,8 @@ where
.ok_or(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to fetch Unified Connector Service client")?;
- let authorize_session_token_request =
- payments_grpc::PaymentServiceCreateSessionTokenRequest::foreign_try_from(router_data)
+ let create_session_token_request =
+ payments_grpc::MerchantAuthenticationServiceCreateSessionTokenRequest::foreign_try_from(router_data)
.change_context(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to construct Payment Session Create Request")?;
@@ -116,23 +116,23 @@ where
Box::pin(unified_connector_service::ucs_logging_wrapper_granular(
router_data.clone(),
state,
- authorize_session_token_request,
+ create_session_token_request,
header_payload,
unified_connector_service_execution_mode,
- |mut router_data, authorize_session_token_request, grpc_headers| async move {
+ |mut router_data, create_session_token_request, grpc_headers| async move {
let response = client
- .payment_session_token_create(
- authorize_session_token_request,
+ .create_session_token(
+ create_session_token_request,
connector_auth_metadata,
grpc_headers,
)
.await
- .attach_printable("Failed to get payment")?;
+ .attach_printable("Failed to create session token")?;
let payment_session_token_response = response.into_inner();
let (router_data_response, status_code) =
- handle_unified_connector_service_response_for_session_token_create(
+ handle_unified_connector_service_response_for_create_session_token(
payment_session_token_response.clone(),
)
.attach_printable("Failed to deserialize UCS response")?;
diff --git a/crates/router/src/core/payments/gateway/setup_mandate.rs b/crates/router/src/core/payments/gateway/setup_mandate.rs
index dcff2978bf..7553080108 100644
--- a/crates/router/src/core/payments/gateway/setup_mandate.rs
+++ b/crates/router/src/core/payments/gateway/setup_mandate.rs
@@ -15,7 +15,7 @@ use unified_connector_service_client::payments as payments_grpc;
use crate::{
core::{
payments::gateway::context::RouterGatewayContext, unified_connector_service,
- unified_connector_service::handle_unified_connector_service_response_for_payment_register,
+ unified_connector_service::handle_unified_connector_service_response_for_payment_setup_recurring,
},
routes::SessionState,
services::logger,
@@ -74,8 +74,8 @@ where
.ok_or(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to fetch Unified Connector Service client")?;
- let setup_mandate_request =
- payments_grpc::PaymentServiceRegisterRequest::foreign_try_from(router_data)
+ let payment_setup_recurring_request =
+ payments_grpc::PaymentServiceSetupRecurringRequest::foreign_try_from(router_data)
.change_context(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to construct Payment Get Request")?;
@@ -111,25 +111,26 @@ where
Box::pin(unified_connector_service::ucs_logging_wrapper_granular(
router_data.clone(),
state,
- setup_mandate_request,
+ payment_setup_recurring_request,
header_payload,
unified_connector_service_execution_mode,
- |mut router_data, setup_mandate_request, grpc_headers| async move {
- let response = Box::pin(client.payment_setup_mandate_granular(
- setup_mandate_request,
+ |mut router_data, payment_setup_recurring_request, grpc_headers| async move {
+ let response = Box::pin(client.payment_setup_recurring(
+ payment_setup_recurring_request,
connector_auth_metadata,
grpc_headers,
))
.await
- .attach_printable("Failed to get payment")?;
+ .attach_printable("Failed to setup recurring payment")?;
- let setup_mandate_response = response.into_inner();
+ let setup_recurring_response = response.into_inner();
- let ucs_data = handle_unified_connector_service_response_for_payment_register(
- setup_mandate_response.clone(),
- router_data.status,
- )
- .attach_printable("Failed to deserialize UCS response")?;
+ let ucs_data =
+ handle_unified_connector_service_response_for_payment_setup_recurring(
+ setup_recurring_response.clone(),
+ router_data.status,
+ )
+ .attach_printable("Failed to deserialize UCS response")?;
let router_data_response = match ucs_data.router_data_response {
Ok((response, status)) => {
@@ -159,7 +160,7 @@ where
router_data.amount_captured = ucs_data.amount_captured;
router_data.minor_amount_captured = ucs_data.minor_amount_captured;
- Ok((router_data, (), setup_mandate_response))
+ Ok((router_data, (), setup_recurring_response))
},
))
.await
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index b7c0733542..3c94308716 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -66,10 +66,12 @@ use crate::{
routes::SessionState,
types::{
transformers::{ForeignFrom, ForeignTryFrom},
- UcsAuthorizeResponseData, UcsRepeatPaymentResponseData, UcsSetupMandateResponseData,
+ UcsPaymentAuthorizeResponseData, UcsPaymentSetupRecurringResponseData,
+ UcsRecurringPaymentChargeResponseData,
},
};
+pub mod connector_config;
pub mod transformers;
/// Returns Apple Pay data from payment method token when it has decrypt data,
/// otherwise returns the original payment data.
@@ -1675,6 +1677,21 @@ pub fn build_unified_connector_service_auth_metadata(
let merchant_id = processor.get_account().get_id().get_string_repr();
+ // Extract connector metadata from MCA for connector-specific config
+ let merchant_account_metadata = merchant_connector_account.get_metadata();
+ let merchant_account_metadata_value = merchant_account_metadata
+ .as_ref()
+ .and_then(|m| serde_json::to_value(m.clone().expose()).ok());
+ // Build connector-specific config for supported connectors
+ let connector_config = connector_config::build_connector_config_header(
+ &connector_name,
+ &auth_type,
+ merchant_account_metadata_value.as_ref(),
+ )
+ .change_context(UnifiedConnectorServiceError::FailedToObtainAuthType)
+ .attach_printable("Failed to build connector config header")?
+ .map(Secret::new);
+
match &auth_type {
ConnectorAuthType::SignatureKey {
api_key,
@@ -1689,6 +1706,7 @@ pub fn build_unified_connector_service_auth_metadata(
api_secret: Some(api_secret.clone()),
auth_key_map: None,
merchant_id: Secret::new(merchant_id.to_string()),
+ connector_config,
}),
ConnectorAuthType::BodyKey { api_key, key1 } => Ok(ConnectorAuthMetadata {
connector_name,
@@ -1699,6 +1717,7 @@ pub fn build_unified_connector_service_auth_metadata(
api_secret: None,
auth_key_map: None,
merchant_id: Secret::new(merchant_id.to_string()),
+ connector_config,
}),
ConnectorAuthType::HeaderKey { api_key } => Ok(ConnectorAuthMetadata {
connector_name,
@@ -1709,6 +1728,7 @@ pub fn build_unified_connector_service_auth_metadata(
api_secret: None,
auth_key_map: None,
merchant_id: Secret::new(merchant_id.to_string()),
+ connector_config,
}),
ConnectorAuthType::CurrencyAuthKey { auth_key_map } => Ok(ConnectorAuthMetadata {
connector_name,
@@ -1719,6 +1739,7 @@ pub fn build_unified_connector_service_auth_metadata(
api_secret: None,
auth_key_map: Some(auth_key_map.clone()),
merchant_id: Secret::new(merchant_id.to_string()),
+ connector_config,
}),
ConnectorAuthType::MultiAuthKey {
api_key,
@@ -1734,6 +1755,7 @@ pub fn build_unified_connector_service_auth_metadata(
api_secret: Some(api_secret.clone()),
auth_key_map: None,
merchant_id: Secret::new(merchant_id.to_string()),
+ connector_config,
}),
_ => Err(UnifiedConnectorServiceError::FailedToObtainAuthType)
.attach_printable("Unsupported ConnectorAuthType for header injection"),
@@ -1804,7 +1826,7 @@ pub fn build_unified_connector_service_external_vault_proxy_metadata(
pub fn handle_unified_connector_service_response_for_payment_authorize(
response: PaymentServiceAuthorizeResponse,
prev_status: AttemptStatus,
-) -> CustomResult<UcsAuthorizeResponseData, UnifiedConnectorServiceError> {
+) -> CustomResult<UcsPaymentAuthorizeResponseData, UnifiedConnectorServiceError> {
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
let router_data_response =
@@ -1818,7 +1840,7 @@ pub fn handle_unified_connector_service_response_for_payment_authorize(
let connector_response =
extract_connector_response_from_ucs(response.connector_response.as_ref());
- Ok(UcsAuthorizeResponseData {
+ Ok(UcsPaymentAuthorizeResponseData {
router_data_response,
status_code,
connector_customer_id,
@@ -1827,7 +1849,7 @@ pub fn handle_unified_connector_service_response_for_payment_authorize(
}
pub fn handle_unified_connector_service_response_for_create_connector_customer(
- response: payments_grpc::PaymentServiceCreateConnectorCustomerResponse,
+ response: payments_grpc::CustomerServiceCreateResponse,
) -> CustomResult<(Result<PaymentsResponseData, ErrorResponse>, u16), UnifiedConnectorServiceError>
{
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -1838,7 +1860,7 @@ pub fn handle_unified_connector_service_response_for_create_connector_customer(
Ok((connector_customer_result, status_code))
}
-pub fn handle_unified_connector_service_response_for_create_order(
+pub fn handle_unified_connector_service_response_for_payment_create_order(
response: payments_grpc::PaymentServiceCreateOrderResponse,
prev_status: AttemptStatus,
) -> UnifiedConnectorServiceCreateOrderResult {
@@ -1854,7 +1876,7 @@ pub fn handle_unified_connector_service_response_for_create_order(
}
pub fn handle_unified_connector_service_response_for_payment_post_authenticate(
- response: payments_grpc::PaymentServicePostAuthenticateResponse,
+ response: payments_grpc::PaymentMethodAuthenticationServicePostAuthenticateResponse,
prev_status: AttemptStatus,
) -> UnifiedConnectorServiceResult {
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -1868,8 +1890,8 @@ pub fn handle_unified_connector_service_response_for_payment_post_authenticate(
Ok((router_data_response, status_code))
}
-pub fn handle_unified_connector_service_response_for_payment_method_token_create(
- response: payments_grpc::PaymentServiceCreatePaymentMethodTokenResponse,
+pub fn handle_unified_connector_service_response_for_payment_method_tokenize(
+ response: payments_grpc::PaymentMethodServiceTokenizeResponse,
) -> CustomResult<(Result<PaymentsResponseData, ErrorResponse>, u16), UnifiedConnectorServiceError>
{
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -1880,8 +1902,8 @@ pub fn handle_unified_connector_service_response_for_payment_method_token_create
Ok((router_data_response, status_code))
}
-pub fn handle_unified_connector_service_response_for_sdk_session_token(
- response: payments_grpc::PaymentServiceSdkSessionTokenResponse,
+pub fn handle_unified_connector_service_response_for_create_sdk_session_token(
+ response: payments_grpc::MerchantAuthenticationServiceCreateSdkSessionTokenResponse,
) -> CustomResult<(Result<PaymentsResponseData, ErrorResponse>, u16), UnifiedConnectorServiceError>
{
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -1892,7 +1914,7 @@ pub fn handle_unified_connector_service_response_for_sdk_session_token(
Ok((router_data_response, status_code))
}
-pub fn handle_unified_connector_service_response_for_incremental_authorization(
+pub fn handle_unified_connector_service_response_for_payment_incremental_authorization(
response: payments_grpc::PaymentServiceIncrementalAuthorizationResponse,
) -> CustomResult<(Result<PaymentsResponseData, ErrorResponse>, u16), UnifiedConnectorServiceError>
{
@@ -1905,7 +1927,7 @@ pub fn handle_unified_connector_service_response_for_incremental_authorization(
}
pub fn handle_unified_connector_service_response_for_payment_authenticate(
- response: payments_grpc::PaymentServiceAuthenticateResponse,
+ response: payments_grpc::PaymentMethodAuthenticationServiceAuthenticateResponse,
prev_status: AttemptStatus,
) -> UnifiedConnectorServiceResult {
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -1920,7 +1942,7 @@ pub fn handle_unified_connector_service_response_for_payment_authenticate(
}
pub fn handle_unified_connector_service_response_for_payment_pre_authenticate(
- response: payments_grpc::PaymentServicePreAuthenticateResponse,
+ response: payments_grpc::PaymentMethodAuthenticationServicePreAuthenticateResponse,
prev_status: AttemptStatus,
) -> UnifiedConnectorServiceResult {
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -1949,10 +1971,10 @@ pub fn handle_unified_connector_service_response_for_payment_capture(
Ok((router_data_response, status_code))
}
-pub fn handle_unified_connector_service_response_for_payment_register(
- response: payments_grpc::PaymentServiceRegisterResponse,
+pub fn handle_unified_connector_service_response_for_payment_setup_recurring(
+ response: payments_grpc::PaymentServiceSetupRecurringResponse,
prev_status: AttemptStatus,
-) -> CustomResult<UcsSetupMandateResponseData, UnifiedConnectorServiceError> {
+) -> CustomResult<UcsPaymentSetupRecurringResponseData, UnifiedConnectorServiceError> {
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
let router_data_response =
@@ -1966,20 +1988,20 @@ pub fn handle_unified_connector_service_response_for_payment_register(
let connector_response =
extract_connector_response_from_ucs(response.connector_response.as_ref());
- Ok(UcsSetupMandateResponseData {
+ Ok(UcsPaymentSetupRecurringResponseData {
router_data_response,
status_code,
connector_customer_id,
connector_response,
amount_captured: response.captured_amount,
minor_amount_captured: response
- .minor_captured_amount
+ .captured_amount
.map(common_utils::types::MinorUnit::new),
})
}
-pub fn handle_unified_connector_service_response_for_session_token_create(
- response: payments_grpc::PaymentServiceCreateSessionTokenResponse,
+pub fn handle_unified_connector_service_response_for_create_session_token(
+ response: payments_grpc::MerchantAuthenticationServiceCreateSessionTokenResponse,
) -> CustomResult<(Result<PaymentsResponseData, ErrorResponse>, u16), UnifiedConnectorServiceError>
{
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -1990,10 +2012,10 @@ pub fn handle_unified_connector_service_response_for_session_token_create(
Ok((router_data_response, status_code))
}
-pub fn handle_unified_connector_service_response_for_payment_repeat(
- response: payments_grpc::PaymentServiceRepeatEverythingResponse,
+pub fn handle_unified_connector_service_response_for_recurring_payment_charge(
+ response: payments_grpc::RecurringPaymentServiceChargeResponse,
prev_status: AttemptStatus,
-) -> CustomResult<UcsRepeatPaymentResponseData, UnifiedConnectorServiceError> {
+) -> CustomResult<UcsRecurringPaymentChargeResponseData, UnifiedConnectorServiceError> {
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
let router_data_response =
@@ -2007,7 +2029,7 @@ pub fn handle_unified_connector_service_response_for_payment_repeat(
let connector_response =
extract_connector_response_from_ucs(response.connector_response.as_ref());
- Ok(UcsRepeatPaymentResponseData {
+ Ok(UcsRecurringPaymentChargeResponseData {
router_data_response,
status_code,
connector_customer_id,
@@ -2044,7 +2066,7 @@ pub fn extract_connector_response_from_ucs(
})
}
-pub fn handle_unified_connector_service_response_for_refund_execute(
+pub fn handle_unified_connector_service_response_for_payment_refund(
response: payments_grpc::RefundResponse,
) -> UnifiedConnectorServiceRefundResult {
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -2055,7 +2077,7 @@ pub fn handle_unified_connector_service_response_for_refund_execute(
Ok((router_data_response, status_code))
}
-pub fn handle_unified_connector_service_response_for_refund_sync(
+pub fn handle_unified_connector_service_response_for_refund_get(
response: payments_grpc::RefundResponse,
) -> UnifiedConnectorServiceRefundResult {
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -2083,7 +2105,7 @@ pub fn handle_unified_connector_service_response_for_payment_cancel(
/// Handles the unified connector service response for create access token
pub fn handle_unified_connector_service_response_for_create_access_token(
- response: payments_grpc::PaymentServiceCreateAccessTokenResponse,
+ response: payments_grpc::MerchantAuthenticationServiceCreateAccessTokenResponse,
) -> CustomResult<(Result<AccessToken, ErrorResponse>, u16), UnifiedConnectorServiceError> {
let status_code = transformers::convert_connector_service_status_code(response.status_code)?;
@@ -2230,7 +2252,7 @@ pub async fn call_unified_connector_service_for_webhook(
// Make UCS call - client availability already verified
match ucs_client
- .transform_incoming_webhook(transform_request, connector_auth_metadata, grpc_headers)
+ .incoming_webhook_handle_event(transform_request, connector_auth_metadata, grpc_headers)
.await
{
Ok(response) => {
@@ -2256,7 +2278,7 @@ pub async fn call_unified_connector_service_for_webhook(
/// This provides a helper function to extract specific data from UCS responses
pub fn extract_webhook_content_from_ucs_response(
transform_data: &WebhookTransformData,
-) -> Option<&unified_connector_service_client::payments::WebhookResponseContent> {
+) -> Option<&unified_connector_service_client::payments::EventContent> {
transform_data.webhook_content.as_ref()
}
@@ -2730,7 +2752,7 @@ pub async fn call_unified_connector_service_for_refund_execute(
// Transform UCS response back to RouterData
let (refund_response_data, status_code) =
- handle_unified_connector_service_response_for_refund_execute(grpc_response.clone())
+ handle_unified_connector_service_response_for_payment_refund(grpc_response.clone())
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to transform UCS refund response")?;
@@ -2814,7 +2836,7 @@ pub async fn call_unified_connector_service_for_refund_sync(
|router_data, grpc_request, grpc_headers| async move {
// Call UCS refund_sync method
let response = ucs_client
- .refund_sync(grpc_request, connector_auth_metadata, grpc_headers)
+ .refund_get(grpc_request, connector_auth_metadata, grpc_headers)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("UCS refund sync execution failed")?;
@@ -2823,9 +2845,9 @@ pub async fn call_unified_connector_service_for_refund_sync(
// Transform UCS response back to RouterData
let (refund_response_data, status_code) =
- handle_unified_connector_service_response_for_refund_sync(grpc_response.clone())
+ handle_unified_connector_service_response_for_refund_get(grpc_response.clone())
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to transform UCS refund sync response")?;
+ .attach_printable("Failed to transform UCS refund get response")?;
let mut updated_router_data = router_data;
updated_router_data.response = refund_response_data;
diff --git a/crates/router/src/core/unified_connector_service/connector_config.rs b/crates/router/src/core/unified_connector_service/connector_config.rs
new file mode 100644
index 0000000000..0c64120e84
--- /dev/null
+++ b/crates/router/src/core/unified_connector_service/connector_config.rs
@@ -0,0 +1,1325 @@
+//! Connector-specific configuration transformer for UCS
+//!
+//! This module provides functionality to transform connector authentication data
+//! into connector-specific configuration structures expected by the Unified Connector Service (UCS).
+
+use std::{collections::HashMap, str::FromStr};
+
+use common_enums::{connector_enums::Connector, enums::Currency};
+use error_stack::ResultExt;
+use hyperswitch_domain_models::router_data::ConnectorAuthType;
+use hyperswitch_masking::Secret;
+use serde::Serialize;
+
+use crate::{
+ core::errors::{self, RouterResult},
+ types::transformers::ForeignTryFrom,
+};
+
+/// Connector-specific configuration wrapper for UCS.
+/// Serializes as: `{"config": {"ConnectorName": {...}}}`
+#[derive(Debug, Serialize)]
+pub struct UcsConnectorConfig {
+ pub config: serde_json::Map<String, serde_json::Value>,
+}
+
+impl UcsConnectorConfig {
+ /// Creates a new UCS connector config with the connector name as the key in PascalCase
+ pub fn new<T: Serialize>(connector: Connector, inner: T) -> RouterResult<Self> {
+ let connector_name = format!("{:?}", connector); // PascalCase: Braintree, Cybersource
+ let inner_json = serde_json::to_value(&inner)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to serialize connector config inner value")?;
+ let mut config = serde_json::Map::new();
+ config.insert(connector_name, inner_json);
+ Ok(Self { config })
+ }
+}
+
+/// Metadata structures for parsing connector metadata
+#[derive(Debug, serde::Deserialize)]
+pub struct CybersourceMetadata {
+ disable_avs: Option<bool>,
+ disable_cvn: Option<bool>,
+}
+
+#[derive(Debug, serde::Deserialize)]
+pub struct BraintreeMetadata {
+ merchant_account_id: Secret<String>,
+ merchant_config_currency: String,
+}
+
+#[derive(Debug, serde::Deserialize)]
+pub struct AdyenMetadata {
+ endpoint_prefix: Option<Secret<String>>,
+}
+
+#[derive(Debug, serde::Deserialize)]
+pub struct TruelayerMetadata {
+ merchant_account_id: Option<Secret<String>>,
+ account_holder_name: Option<Secret<String>>,
+ private_key: Option<Secret<String>>,
+ kid: Option<Secret<String>>,
+}
+
+/// Connector-specific configuration enum for all supported connectors
+#[derive(Debug, Clone, serde::Serialize)]
+pub enum ConnectorSpecificConfig {
+ /// Adyen connector configuration
+ Adyen {
+ api_key: Secret<String>,
+ merchant_account: Secret<String>,
+ review_key: Option<Secret<String>>,
+ endpoint_prefix: Option<Secret<String>>,
+ },
+ /// Braintree connector configuration
+ Braintree {
+ public_key: Secret<String>,
+ private_key: Secret<String>,
+ merchant_account_id: Secret<String>,
+ merchant_config_currency: Option<String>,
+ },
+ /// Cybersource connector configuration
+ Cybersource {
+ api_key: Secret<String>,
+ merchant_account: Secret<String>,
+ api_secret: Secret<String>,
+ disable_avs: Option<bool>,
+ disable_cvn: Option<bool>,
+ },
+ /// Stripe connector configuration
+ Stripe { api_key: Secret<String> },
+ /// PayPal connector configuration
+ Paypal {
+ client_id: Secret<String>,
+ client_secret: Secret<String>,
+ payer_id: Option<Secret<String>>,
+ },
+ /// Truelayer connector configuration
+ Truelayer {
+ client_id: Secret<String>,
+ client_secret: Secret<String>,
+ merchant_account_id: Option<Secret<String>>,
+ account_holder_name: Option<Secret<String>>,
+ private_key: Option<Secret<String>>,
+ kid: Option<Secret<String>>,
+ },
+ /// Revolv3 connector configuration
+ Revolv3 { api_key: Secret<String> },
+ /// Fiservcommercehub connector configuration
+ Fiservcommercehub {
+ api_key: Secret<String>,
+ secret: Secret<String>,
+ merchant_id: Secret<String>,
+ terminal_id: Secret<String>,
+ },
+ /// Checkout connector configuration
+ Checkout {
+ api_key: Secret<String>,
+ api_secret: Secret<String>,
+ processing_channel_id: Secret<String>,
+ },
+ /// Authorize.net connector configuration
+ Authorizedotnet {
+ name: Secret<String>,
+ transaction_key: Secret<String>,
+ },
+ /// Bank of America connector configuration
+ BankOfAmerica {
+ api_key: Secret<String>,
+ merchant_account: Secret<String>,
+ api_secret: Secret<String>,
+ },
+ /// Bluesnap connector configuration
+ Bluesnap {
+ username: Secret<String>,
+ password: Secret<String>,
+ },
+ /// Worldpay connector configuration
+ Worldpay {
+ username: Secret<String>,
+ password: Secret<String>,
+ entity_id: Secret<String>,
+ merchant_name: Option<Secret<String>>,
+ },
+ /// Paysafe connector configuration
+ Paysafe {
+ username: Secret<String>,
+ password: Secret<String>,
+ account_id: Option<String>,
+ },
+ /// Trustpay connector configuration
+ Trustpay {
+ api_key: Secret<String>,
+ project_id: Secret<String>,
+ secret_key: Secret<String>,
+ },
+ /// Nexinets connector configuration
+ Nexinets {
+ merchant_id: Secret<String>,
+ api_key: Secret<String>,
+ },
+ /// Bambora connector configuration
+ Bambora {
+ merchant_id: Secret<String>,
+ api_key: Secret<String>,
+ },
+ /// Cashfree connector configuration
+ Cashfree {
+ app_id: Secret<String>,
+ secret_key: Secret<String>,
+ },
+ /// Razorpay connector configuration
+ Razorpay {
+ api_key: Secret<String>,
+ api_secret: Option<Secret<String>>,
+ },
+ /// Shift4 connector configuration
+ Shift4 { api_key: Secret<String> },
+ /// Globalpay connector configuration
+ Globalpay {
+ app_id: Secret<String>,
+ app_key: Secret<String>,
+ },
+ /// Fiserv connector configuration
+ Fiserv {
+ api_key: Secret<String>,
+ merchant_account: Secret<String>,
+ api_secret: Secret<String>,
+ terminal_id: Option<Secret<String>>,
+ },
+ /// Fiservemea connector configuration
+ Fiservemea {
+ api_key: Secret<String>,
+ api_secret: Secret<String>,
+ },
+ /// Noon connector configuration
+ Noon {
+ api_key: Secret<String>,
+ business_identifier: Secret<String>,
+ application_identifier: Secret<String>,
+ },
+ /// Dlocal connector configuration
+ Dlocal {
+ x_login: Secret<String>,
+ x_trans_key: Secret<String>,
+ secret: Secret<String>,
+ },
+ /// Nuvei connector configuration
+ Nuvei {
+ merchant_id: Secret<String>,
+ merchant_site_id: Secret<String>,
+ merchant_secret: Secret<String>,
+ },
+ /// Mollie connector configuration
+ Mollie {
+ api_key: Secret<String>,
+ profile_token: Option<Secret<String>>,
+ },
+ /// Multisafepay connector configuration
+ Multisafepay { api_key: Secret<String> },
+ /// Rapyd connector configuration
+ Rapyd {
+ access_key: Secret<String>,
+ secret_key: Secret<String>,
+ },
+ /// Payu connector configuration
+ Payu {
+ api_key: Secret<String>,
+ api_secret: Secret<String>,
+ },
+ /// Cryptopay connector configuration
+ Cryptopay {
+ api_key: Secret<String>,
+ api_secret: Secret<String>,
+ },
+ /// Iatapay connector configuration
+ Iatapay {
+ client_id: Secret<String>,
+ merchant_id: Secret<String>,
+ client_secret: Secret<String>,
+ },
+ /// Cashtocode connector configuration
+ Cashtocode {
+ auth_key_map: HashMap<Currency, common_utils::pii::SecretSerdeValue>,
+ },
+ /// Payload connector configuration
+ Payload {
+ auth_key_map: HashMap<Currency, common_utils::pii::SecretSerdeValue>,
+ },
+ /// Xendit connector configuration
+ Xendit { api_key: Secret<String> },
+ /// Helcim connector configuration
+ Helcim { api_key: Secret<String> },
+ /// Airwallex connector configuration
+ Airwallex {
+ api_key: Secret<String>,
+ client_id: Secret<String>,
+ },
+ /// Forte connector configuration
+ Forte {
+ api_access_id: Secret<String>,
+ organization_id: Secret<String>,
+ location_id: Secret<String>,
+ api_secret_key: Secret<String>,
+ },
+ /// Paytm connector configuration
+ Paytm {
+ merchant_id: Secret<String>,
+ merchant_key: Secret<String>,
+ website: Secret<String>,
+ client_id: Option<Secret<String>>,
+ },
+ /// Payme connector configuration
+ Payme {
+ seller_payme_id: Secret<String>,
+ payme_client_key: Option<Secret<String>>,
+ },
+ /// Nmi connector configuration
+ Nmi {
+ api_key: Secret<String>,
+ public_key: Option<Secret<String>>,
+ },
+ /// Volt connector configuration
+ Volt {
+ username: Secret<String>,
+ password: Secret<String>,
+ client_id: Secret<String>,
+ client_secret: Secret<String>,
+ },
+ /// Phonepe connector configuration
+ Phonepe {
+ merchant_id: Secret<String>,
+ salt_key: Secret<String>,
+ salt_index: Secret<String>,
+ },
+ /// Elavon connector configuration
+ Elavon {
+ ssl_merchant_id: Secret<String>,
+ ssl_user_id: Secret<String>,
+ ssl_pin: Secret<String>,
+ },
+ /// Redsys connector configuration
+ Redsys {
+ merchant_id: Secret<String>,
+ terminal_id: Secret<String>,
+ sha256_pwd: Secret<String>,
+ },
+ /// Trustpayments connector configuration
+ Trustpayments {
+ username: Secret<String>,
+ password: Secret<String>,
+ site_reference: Secret<String>,
+ },
+ /// Novalnet connector configuration
+ Novalnet {
+ product_activation_key: Secret<String>,
+ payment_access_key: Secret<String>,
+ tariff_id: Secret<String>,
+ },
+ /// Gigadat connector configuration
+ Gigadat {
+ security_token: Secret<String>,
+ access_token: Secret<String>,
+ campaign_id: Secret<String>,
+ },
+ /// Zift connector configuration
+ Zift {
+ user_name: Secret<String>,
+ password: Secret<String>,
+ account_id: Secret<String>,
+ },
+ /// Getnet connector configuration
+ Getnet {
+ api_key: Secret<String>,
+ api_secret: Secret<String>,
+ seller_id: Secret<String>,
+ },
+ /// Hyperpg connector configuration
+ Hyperpg {
+ username: Secret<String>,
+ password: Secret<String>,
+ merchant_id: Secret<String>,
+ },
+ /// Fiuu connector configuration
+ Fiuu {
+ merchant_id: Secret<String>,
+ verify_key: Secret<String>,
+ secret_key: Secret<String>,
+ },
+ /// Tsys connector configuration
+ Tsys {
+ device_id: Secret<String>,
+ transaction_key: Secret<String>,
+ developer_id: Secret<String>,
+ },
+ /// Bamboraapac connector configuration
+ Bamboraapac {
+ username: Secret<String>,
+ password: Secret<String>,
+ account_number: Secret<String>,
+ },
+ /// Worldpayxml connector configuration
+ Worldpayxml {
+ api_username: Secret<String>,
+ api_password: Secret<String>,
+ merchant_code: Secret<String>,
+ },
+ /// Datatrans connector configuration
+ Datatrans {
+ merchant_id: Secret<String>,
+ password: Secret<String>,
+ },
+ /// Placetopay connector configuration
+ Placetopay {
+ login: Secret<String>,
+ tran_key: Secret<String>,
+ },
+ /// Loonio connector configuration
+ Loonio {
+ merchant_id: Secret<String>,
+ merchant_token: Secret<String>,
+ },
+ /// Powertranz connector configuration
+ Powertranz {
+ power_tranz_id: Secret<String>,
+ power_tranz_password: Secret<String>,
+ },
+ /// Hipay connector configuration
+ Hipay {
+ api_key: Secret<String>,
+ api_secret: Secret<String>,
+ },
+ /// Jpmorgan connector configuration
+ Jpmorgan {
+ client_id: Secret<String>,
+ client_secret: Secret<String>,
+ },
+ /// Peachpayments connector configuration
+ Peachpayments {
+ api_key: Secret<String>,
+ tenant_id: Secret<String>,
+ },
+ /// Billwerk connector configuration
+ Billwerk {
+ api_key: Secret<String>,
+ public_api_key: Secret<String>,
+ },
+ /// Authipay connector configuration
+ Authipay {
+ api_key: Secret<String>,
+ api_secret: Secret<String>,
+ },
+ /// Nexixpay connector configuration
+ Nexixpay { api_key: Secret<String> },
+ /// Calida connector configuration
+ Calida { api_key: Secret<String> },
+ /// Celero connector configuration
+ Celero { api_key: Secret<String> },
+ /// Stax connector configuration
+ Stax { api_key: Secret<String> },
+ /// Silverflow connector configuration
+ Silverflow {
+ api_key: Secret<String>,
+ api_secret: Secret<String>,
+ merchant_acceptor_key: Secret<String>,
+ },
+ /// Wellsfargo connector configuration
+ Wellsfargo {
+ api_key: Secret<String>,
+ merchant_account: Secret<String>,
+ api_secret: Secret<String>,
+ },
+ /// Paybox connector configuration
+ Paybox {
+ site: Secret<String>,
+ rank: Secret<String>,
+ key: Secret<String>,
+ merchant_id: Secret<String>,
+ },
+ /// Barclaycard connector configuration
+ Barclaycard {
+ api_key: Secret<String>,
+ merchant_account: Secret<String>,
+ api_secret: Secret<String>,
+ },
+ /// Finix connector configuration
+ Finix {
+ finix_user_name: Secret<String>,
+ finix_password: Secret<String>,
+ merchant_identity_id: Secret<String>,
+ merchant_id: Secret<String>,
+ },
+ /// Worldpayvantiv connector configuration
+ Worldpayvantiv {
+ user: Secret<String>,
+ password: Secret<String>,
+ merchant_id: Secret<String>,
+ },
+}
+
+impl ForeignTryFrom<(Connector, &ConnectorAuthType, Option<&serde_json::Value>)>
+ for ConnectorSpecificConfig
+{
+ type Error = error_stack::Report<errors::ApiErrorResponse>;
+
+ fn foreign_try_from(
+ (connector, auth, metadata): (Connector, &ConnectorAuthType, Option<&serde_json::Value>),
+ ) -> Result<Self, Self::Error> {
+ let err = |msg: &str| {
+ error_stack::report!(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(msg.to_string())
+ };
+
+ match connector {
+ Connector::Adyen => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => {
+ let endpoint_prefix = metadata
+ .and_then(|m| serde_json::from_value::<AdyenMetadata>(m.clone()).ok())
+ .and_then(|m| m.endpoint_prefix);
+
+ Ok(Self::Adyen {
+ api_key: api_key.clone(),
+ merchant_account: key1.clone(),
+ review_key: Some(api_secret.clone()),
+ endpoint_prefix,
+ })
+ }
+ ConnectorAuthType::BodyKey { api_key, key1 } => {
+ let endpoint_prefix = metadata
+ .and_then(|m| serde_json::from_value::<AdyenMetadata>(m.clone()).ok())
+ .and_then(|m| m.endpoint_prefix);
+
+ Ok(Self::Adyen {
+ api_key: api_key.clone(),
+ merchant_account: key1.clone(),
+ review_key: None,
+ endpoint_prefix,
+ })
+ }
+ _ => Err(err("Adyen requires SignatureKey or BodyKey auth type")),
+ },
+ Connector::Cybersource => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => {
+ let (disable_avs, disable_cvn) = metadata
+ .and_then(|m| serde_json::from_value::<CybersourceMetadata>(m.clone()).ok())
+ .map(|m| (m.disable_avs, m.disable_cvn))
+ .unwrap_or((None, None));
+
+ Ok(Self::Cybersource {
+ api_key: api_key.clone(),
+ merchant_account: key1.clone(),
+ api_secret: api_secret.clone(),
+ disable_avs,
+ disable_cvn,
+ })
+ }
+ _ => Err(err("Cybersource requires SignatureKey auth type")),
+ },
+ Connector::Braintree => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1: _,
+ api_secret,
+ } => {
+ let metadata_parsed = metadata
+ .map(|m| serde_json::from_value::<BraintreeMetadata>(m.clone()))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse Braintree metadata")?
+ .ok_or_else(|| err("Braintree requires metadata with merchant_account_id and merchant_config_currency"))?;
+
+ Ok(Self::Braintree {
+ public_key: api_key.clone(),
+ private_key: api_secret.clone(),
+ merchant_account_id: metadata_parsed.merchant_account_id,
+ merchant_config_currency: Some(metadata_parsed.merchant_config_currency),
+ })
+ }
+ _ => Err(err("Braintree requires SignatureKey auth type")),
+ },
+ Connector::Stripe => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Stripe {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Stripe requires HeaderKey auth type")),
+ },
+ Connector::Truelayer => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => {
+ let metadata_parsed = metadata
+ .and_then(|m| serde_json::from_value::<TruelayerMetadata>(m.clone()).ok());
+
+ Ok(Self::Truelayer {
+ client_id: api_key.clone(),
+ client_secret: key1.clone(),
+ merchant_account_id: metadata_parsed
+ .as_ref()
+ .and_then(|m| m.merchant_account_id.clone()),
+ account_holder_name: metadata_parsed
+ .as_ref()
+ .and_then(|m| m.account_holder_name.clone()),
+ private_key: metadata_parsed.as_ref().and_then(|m| m.private_key.clone()),
+ kid: metadata_parsed.as_ref().and_then(|m| m.kid.clone()),
+ })
+ }
+ _ => Err(err("Truelayer requires BodyKey auth type")),
+ },
+ Connector::Paypal => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Paypal {
+ client_id: key1.clone(),
+ client_secret: api_key.clone(),
+ payer_id: None,
+ }),
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Paypal {
+ client_id: key1.clone(),
+ client_secret: api_key.clone(),
+ payer_id: Some(api_secret.clone()),
+ }),
+ _ => Err(err("Paypal requires BodyKey or SignatureKey auth type")),
+ },
+ Connector::Revolv3 => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Revolv3 {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Revolv3 requires HeaderKey auth type")),
+ },
+ Connector::Fiservcommercehub => match auth {
+ ConnectorAuthType::MultiAuthKey {
+ api_key,
+ key1,
+ api_secret,
+ key2,
+ } => Ok(Self::Fiservcommercehub {
+ api_key: api_key.clone(),
+ secret: api_secret.clone(),
+ merchant_id: key1.clone(),
+ terminal_id: key2.clone(),
+ }),
+ _ => Err(err("Fiservcommercehub requires MultiAuthKey auth type")),
+ },
+ Connector::Calida => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Calida {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Calida requires HeaderKey auth type")),
+ },
+ Connector::Celero => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Celero {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Celero requires HeaderKey auth type")),
+ },
+ Connector::Helcim => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Helcim {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Helcim requires HeaderKey auth type")),
+ },
+ Connector::Multisafepay => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Multisafepay {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Multisafepay requires HeaderKey auth type")),
+ },
+ Connector::Nexixpay => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Nexixpay {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Nexixpay requires HeaderKey auth type")),
+ },
+ Connector::Shift4 => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Shift4 {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Shift4 requires HeaderKey auth type")),
+ },
+ Connector::Stax => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Stax {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Stax requires HeaderKey auth type")),
+ },
+ Connector::Xendit => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Xendit {
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Xendit requires HeaderKey auth type")),
+ },
+ Connector::Airwallex => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Airwallex {
+ api_key: api_key.clone(),
+ client_id: key1.clone(),
+ }),
+ _ => Err(err("Airwallex requires BodyKey auth type")),
+ },
+ Connector::Authorizedotnet => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Authorizedotnet {
+ name: api_key.clone(),
+ transaction_key: key1.clone(),
+ }),
+ _ => Err(err("Authorizedotnet requires BodyKey auth type")),
+ },
+ Connector::Bambora => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Bambora {
+ merchant_id: key1.clone(),
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Bambora requires BodyKey auth type")),
+ },
+ Connector::Billwerk => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Billwerk {
+ api_key: api_key.clone(),
+ public_api_key: key1.clone(),
+ }),
+ _ => Err(err("Billwerk requires BodyKey auth type")),
+ },
+ Connector::Bluesnap => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Bluesnap {
+ username: key1.clone(),
+ password: api_key.clone(),
+ }),
+ _ => Err(err("Bluesnap requires BodyKey auth type")),
+ },
+ Connector::Cryptopay => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Cryptopay {
+ api_key: api_key.clone(),
+ api_secret: key1.clone(),
+ }),
+ _ => Err(err("Cryptopay requires BodyKey auth type")),
+ },
+ Connector::Datatrans => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Datatrans {
+ merchant_id: key1.clone(),
+ password: api_key.clone(),
+ }),
+ _ => Err(err("Datatrans requires BodyKey auth type")),
+ },
+ Connector::Globalpay => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Globalpay {
+ app_id: key1.clone(),
+ app_key: api_key.clone(),
+ }),
+ _ => Err(err("Globalpay requires BodyKey auth type")),
+ },
+ Connector::Hipay => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Hipay {
+ api_key: api_key.clone(),
+ api_secret: key1.clone(),
+ }),
+ _ => Err(err("Hipay requires BodyKey auth type")),
+ },
+ Connector::Jpmorgan => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Jpmorgan {
+ client_id: api_key.clone(),
+ client_secret: key1.clone(),
+ }),
+ _ => Err(err("Jpmorgan requires BodyKey auth type")),
+ },
+ Connector::Loonio => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Loonio {
+ merchant_id: api_key.clone(),
+ merchant_token: key1.clone(),
+ }),
+ _ => Err(err("Loonio requires BodyKey auth type")),
+ },
+ Connector::Paysafe => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Paysafe {
+ username: api_key.clone(),
+ password: key1.clone(),
+ account_id: None,
+ }),
+ _ => Err(err("Paysafe requires BodyKey auth type")),
+ },
+ Connector::Payu => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Payu {
+ api_key: api_key.clone(),
+ api_secret: key1.clone(),
+ }),
+ _ => Err(err("Payu requires BodyKey auth type")),
+ },
+ Connector::Placetopay => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Placetopay {
+ login: api_key.clone(),
+ tran_key: key1.clone(),
+ }),
+ _ => Err(err("Placetopay requires BodyKey auth type")),
+ },
+ Connector::Powertranz => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Powertranz {
+ power_tranz_id: key1.clone(),
+ power_tranz_password: api_key.clone(),
+ }),
+ _ => Err(err("Powertranz requires BodyKey auth type")),
+ },
+ Connector::Rapyd => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Rapyd {
+ access_key: api_key.clone(),
+ secret_key: key1.clone(),
+ }),
+ _ => Err(err("Rapyd requires BodyKey auth type")),
+ },
+ Connector::Peachpayments => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Peachpayments {
+ api_key: api_key.clone(),
+ tenant_id: key1.clone(),
+ }),
+ _ => Err(err("Peachpayments requires BodyKey auth type")),
+ },
+ Connector::Nexinets => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Nexinets {
+ merchant_id: key1.clone(),
+ api_key: api_key.clone(),
+ }),
+ _ => Err(err("Nexinets requires BodyKey auth type")),
+ },
+ Connector::Razorpay => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Razorpay {
+ api_key: api_key.clone(),
+ api_secret: None,
+ }),
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Razorpay {
+ api_key: api_key.clone(),
+ api_secret: Some(key1.clone()),
+ }),
+ _ => Err(err("Razorpay requires HeaderKey or BodyKey auth type")),
+ },
+ Connector::Mollie => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Mollie {
+ api_key: api_key.clone(),
+ profile_token: None,
+ }),
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Mollie {
+ api_key: api_key.clone(),
+ profile_token: Some(key1.clone()),
+ }),
+ _ => Err(err("Mollie requires HeaderKey or BodyKey auth type")),
+ },
+ Connector::Nmi => match auth {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Nmi {
+ api_key: api_key.clone(),
+ public_key: None,
+ }),
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Nmi {
+ api_key: api_key.clone(),
+ public_key: Some(key1.clone()),
+ }),
+ _ => Err(err("Nmi requires HeaderKey or BodyKey auth type")),
+ },
+ Connector::Authipay => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1: _,
+ api_secret,
+ } => Ok(Self::Authipay {
+ api_key: api_key.clone(),
+ api_secret: api_secret.clone(),
+ }),
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Authipay {
+ api_key: api_key.clone(),
+ api_secret: key1.clone(),
+ }),
+ _ => Err(err("Authipay requires SignatureKey or BodyKey auth type")),
+ },
+ Connector::Bankofamerica => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::BankOfAmerica {
+ api_key: api_key.clone(),
+ merchant_account: key1.clone(),
+ api_secret: api_secret.clone(),
+ }),
+ _ => Err(err("Bankofamerica requires SignatureKey auth type")),
+ },
+ Connector::Bamboraapac => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Bamboraapac {
+ username: api_key.clone(),
+ password: api_secret.clone(),
+ account_number: key1.clone(),
+ }),
+ _ => Err(err("Bamboraapac requires SignatureKey auth type")),
+ },
+ Connector::Barclaycard => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Barclaycard {
+ api_key: api_key.clone(),
+ merchant_account: key1.clone(),
+ api_secret: api_secret.clone(),
+ }),
+ _ => Err(err("Barclaycard requires SignatureKey auth type")),
+ },
+ Connector::Checkout => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Checkout {
+ api_key: api_key.clone(),
+ api_secret: api_secret.clone(),
+ processing_channel_id: key1.clone(),
+ }),
+ _ => Err(err("Checkout requires SignatureKey auth type")),
+ },
+ Connector::Dlocal => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Dlocal {
+ x_login: api_key.clone(),
+ x_trans_key: key1.clone(),
+ secret: api_secret.clone(),
+ }),
+ _ => Err(err("Dlocal requires SignatureKey auth type")),
+ },
+ Connector::Elavon => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Elavon {
+ ssl_merchant_id: api_key.clone(),
+ ssl_user_id: key1.clone(),
+ ssl_pin: api_secret.clone(),
+ }),
+ _ => Err(err("Elavon requires SignatureKey auth type")),
+ },
+ Connector::Fiserv => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Fiserv {
+ api_key: api_key.clone(),
+ merchant_account: key1.clone(),
+ api_secret: api_secret.clone(),
+ terminal_id: None,
+ }),
+ _ => Err(err("Fiserv requires SignatureKey auth type")),
+ },
+ Connector::Fiservemea => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1: _,
+ api_secret,
+ } => Ok(Self::Fiservemea {
+ api_key: api_key.clone(),
+ api_secret: api_secret.clone(),
+ }),
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Fiservemea {
+ api_key: api_key.clone(),
+ api_secret: key1.clone(),
+ }),
+ _ => Err(err("Fiservemea requires SignatureKey or BodyKey auth type")),
+ },
+ Connector::Fiuu => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Fiuu {
+ merchant_id: key1.clone(),
+ verify_key: api_key.clone(),
+ secret_key: api_secret.clone(),
+ }),
+ _ => Err(err("Fiuu requires SignatureKey auth type")),
+ },
+ Connector::Getnet => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Getnet {
+ api_key: api_key.clone(),
+ api_secret: api_secret.clone(),
+ seller_id: key1.clone(),
+ }),
+ _ => Err(err("Getnet requires SignatureKey auth type")),
+ },
+ Connector::Gigadat => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Gigadat {
+ security_token: api_secret.clone(),
+ access_token: api_key.clone(),
+ campaign_id: key1.clone(),
+ }),
+ _ => Err(err("Gigadat requires SignatureKey auth type")),
+ },
+ Connector::Hyperpg => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Hyperpg {
+ username: api_key.clone(),
+ password: key1.clone(),
+ merchant_id: api_secret.clone(),
+ }),
+ _ => Err(err("Hyperpg requires SignatureKey auth type")),
+ },
+ Connector::Iatapay => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Iatapay {
+ client_id: api_key.clone(),
+ merchant_id: key1.clone(),
+ client_secret: api_secret.clone(),
+ }),
+ _ => Err(err("Iatapay requires SignatureKey auth type")),
+ },
+ Connector::Noon => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Noon {
+ api_key: api_key.clone(),
+ business_identifier: key1.clone(),
+ application_identifier: api_secret.clone(),
+ }),
+ _ => Err(err("Noon requires SignatureKey auth type")),
+ },
+ Connector::Novalnet => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Novalnet {
+ product_activation_key: api_key.clone(),
+ payment_access_key: key1.clone(),
+ tariff_id: api_secret.clone(),
+ }),
+ _ => Err(err("Novalnet requires SignatureKey auth type")),
+ },
+ Connector::Nuvei => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Nuvei {
+ merchant_id: api_key.clone(),
+ merchant_site_id: key1.clone(),
+ merchant_secret: api_secret.clone(),
+ }),
+ _ => Err(err("Nuvei requires SignatureKey auth type")),
+ },
+ Connector::Phonepe => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Phonepe {
+ merchant_id: api_key.clone(),
+ salt_key: key1.clone(),
+ salt_index: api_secret.clone(),
+ }),
+ _ => Err(err("Phonepe requires SignatureKey auth type")),
+ },
+ Connector::Redsys => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Redsys {
+ merchant_id: api_key.clone(),
+ terminal_id: key1.clone(),
+ sha256_pwd: api_secret.clone(),
+ }),
+ _ => Err(err("Redsys requires SignatureKey auth type")),
+ },
+ Connector::Silverflow => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Silverflow {
+ api_key: api_key.clone(),
+ api_secret: api_secret.clone(),
+ merchant_acceptor_key: key1.clone(),
+ }),
+ _ => Err(err("Silverflow requires SignatureKey auth type")),
+ },
+ Connector::Trustpay => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Trustpay {
+ api_key: api_key.clone(),
+ project_id: key1.clone(),
+ secret_key: api_secret.clone(),
+ }),
+ _ => Err(err("Trustpay requires SignatureKey auth type")),
+ },
+ Connector::Trustpayments => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Trustpayments {
+ username: api_key.clone(),
+ password: key1.clone(),
+ site_reference: api_secret.clone(),
+ }),
+ _ => Err(err("Trustpayments requires SignatureKey auth type")),
+ },
+ Connector::Tsys => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Tsys {
+ device_id: api_key.clone(),
+ transaction_key: key1.clone(),
+ developer_id: api_secret.clone(),
+ }),
+ _ => Err(err("Tsys requires SignatureKey auth type")),
+ },
+ Connector::Wellsfargo => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Wellsfargo {
+ api_key: api_key.clone(),
+ merchant_account: key1.clone(),
+ api_secret: api_secret.clone(),
+ }),
+ _ => Err(err("Wellsfargo requires SignatureKey auth type")),
+ },
+ Connector::Worldpay => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Worldpay {
+ username: key1.clone(),
+ password: api_key.clone(),
+ entity_id: api_secret.clone(),
+ merchant_name: None,
+ }),
+ _ => Err(err("Worldpay requires SignatureKey auth type")),
+ },
+ Connector::Worldpayxml => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Worldpayxml {
+ api_username: api_key.clone(),
+ api_password: key1.clone(),
+ merchant_code: api_secret.clone(),
+ }),
+ _ => Err(err("Worldpayxml requires SignatureKey auth type")),
+ },
+ Connector::Zift => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Zift {
+ user_name: api_key.clone(),
+ password: api_secret.clone(),
+ account_id: key1.clone(),
+ }),
+ _ => Err(err("Zift requires SignatureKey auth type")),
+ },
+ Connector::Forte => match auth {
+ ConnectorAuthType::MultiAuthKey {
+ api_key,
+ key1,
+ api_secret,
+ key2,
+ } => Ok(Self::Forte {
+ api_access_id: api_key.clone(),
+ organization_id: key1.clone(),
+ location_id: key2.clone(),
+ api_secret_key: api_secret.clone(),
+ }),
+ _ => Err(err("Forte requires MultiAuthKey auth type")),
+ },
+ Connector::Paybox => match auth {
+ ConnectorAuthType::MultiAuthKey {
+ api_key,
+ key1,
+ api_secret,
+ key2,
+ } => Ok(Self::Paybox {
+ site: api_key.clone(),
+ rank: key1.clone(),
+ key: api_secret.clone(),
+ merchant_id: key2.clone(),
+ }),
+ _ => Err(err("Paybox requires MultiAuthKey auth type")),
+ },
+ Connector::Paytm => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Paytm {
+ merchant_id: api_key.clone(),
+ merchant_key: key1.clone(),
+ website: api_secret.clone(),
+ client_id: None,
+ }),
+ ConnectorAuthType::MultiAuthKey {
+ api_key,
+ key1,
+ api_secret,
+ key2,
+ } => Ok(Self::Paytm {
+ merchant_id: api_key.clone(),
+ merchant_key: key1.clone(),
+ website: api_secret.clone(),
+ client_id: Some(key2.clone()),
+ }),
+ _ => Err(err("Paytm requires SignatureKey or MultiAuthKey auth type")),
+ },
+ Connector::Volt => match auth {
+ ConnectorAuthType::MultiAuthKey {
+ api_key,
+ key1,
+ api_secret,
+ key2,
+ } => Ok(Self::Volt {
+ username: api_key.clone(),
+ password: api_secret.clone(),
+ client_id: key1.clone(),
+ client_secret: key2.clone(),
+ }),
+ _ => Err(err("Volt requires MultiAuthKey auth type")),
+ },
+ Connector::Finix => match auth {
+ ConnectorAuthType::MultiAuthKey {
+ api_key,
+ key1,
+ api_secret,
+ key2,
+ } => Ok(Self::Finix {
+ finix_user_name: api_key.clone(),
+ finix_password: api_secret.clone(),
+ merchant_identity_id: key1.clone(),
+ merchant_id: key2.clone(),
+ }),
+ _ => Err(err("Finix requires MultiAuthKey auth type")),
+ },
+ Connector::Cashtocode => match auth {
+ ConnectorAuthType::CurrencyAuthKey { auth_key_map } => Ok(Self::Cashtocode {
+ auth_key_map: auth_key_map.clone(),
+ }),
+ _ => Err(err("Cashtocode requires CurrencyAuthKey auth type")),
+ },
+ Connector::Payload => match auth {
+ ConnectorAuthType::CurrencyAuthKey { auth_key_map } => Ok(Self::Payload {
+ auth_key_map: auth_key_map.clone(),
+ }),
+ _ => Err(err("Payload requires CurrencyAuthKey auth type")),
+ },
+
+ Connector::Worldpayvantiv => match auth {
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret,
+ } => Ok(Self::Worldpayvantiv {
+ user: api_key.clone(),
+ password: api_secret.clone(),
+ merchant_id: key1.clone(),
+ }),
+ ConnectorAuthType::MultiAuthKey {
+ api_key,
+ key1,
+ api_secret,
+ key2: _,
+ } => Ok(Self::Worldpayvantiv {
+ user: api_key.clone(),
+ password: api_secret.clone(),
+ merchant_id: key1.clone(),
+ }),
+ _ => Err(err(
+ "Worldpayvantiv requires SignatureKey or MultiAuthKey auth type",
+ )),
+ },
+
+ Connector::Payme => match auth {
+ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Payme {
+ seller_payme_id: api_key.clone(),
+ payme_client_key: Some(key1.clone()),
+ }),
+ ConnectorAuthType::SignatureKey {
+ api_key,
+ key1,
+ api_secret: _,
+ } => Ok(Self::Payme {
+ seller_payme_id: api_key.clone(),
+ payme_client_key: Some(key1.clone()),
+ }),
+ _ => Err(err("Payme requires BodyKey or SignatureKey auth type")),
+ },
+ // --- Unsupported connectors ---
+ _ => Err(
+ error_stack::report!(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(format!(
+ "Connector {} not yet supported for ConnectorSpecificConfig",
+ connector
+ )),
+ ),
+ }
+ }
+}
+
+/// Build the X_CONNECTOR_CONFIG header value for any connector
+pub fn build_connector_config_header(
+ connector_name: &str,
+ auth_type: &ConnectorAuthType,
+ merchant_account_metadata: Option<&serde_json::Value>,
+) -> RouterResult<Option<String>> {
+ let connector = Connector::from_str(connector_name)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable_lazy(|| format!("Invalid connector name: {}", connector_name))?;
+
+ let config = ConnectorSpecificConfig::foreign_try_from((
+ connector,
+ auth_type,
+ merchant_account_metadata,
+ ))?;
+
+ let config_json = serde_json::to_value(&config)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to serialize connector config to JSON value")?;
+
+ let mut outer_map = serde_json::Map::new();
+ outer_map.insert("config".to_string(), config_json);
+
+ let config_string = serde_json::to_string(&outer_map)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to serialize ConnectorSpecificConfig")?;
+
+ Ok(Some(config_string))
+}
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index bd51b94d1f..8ac9c1228e 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -46,8 +46,8 @@ use router_env::tracing;
use time::{Duration, OffsetDateTime};
use unified_connector_service_cards::{CardNumber, NetworkToken};
use unified_connector_service_client::payments::{
- self as payments_grpc, session_token, ConnectorState, Identifier,
- PaymentServiceTransformRequest, PaymentServiceTransformResponse,
+ self as payments_grpc, session_token, ConnectorState, EventServiceHandleRequest,
+ EventServiceHandleResponse,
};
use crate::{
@@ -122,7 +122,7 @@ impl
router_request_types::PaymentMethodTokenizationData,
PaymentsResponseData,
>,
- > for payments_grpc::PaymentServiceCreatePaymentMethodTokenRequest
+ > for payments_grpc::PaymentMethodServiceTokenizeRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
@@ -132,20 +132,6 @@ impl
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- let connector_ref_id = Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- };
-
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
-
let currency = payments_grpc::Currency::foreign_try_from(router_data.request.currency)?;
// Always build payment_method using payment_method_data (which is non-optional).
@@ -160,28 +146,32 @@ impl
let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;
- let amount = router_data.request.amount.ok_or(report!(
- UnifiedConnectorServiceError::MissingRequiredField {
- field_name: "amount"
- }
- ))?;
-
Ok(Self {
- request_ref_id: Some(connector_ref_id),
- merchant_account_metadata,
- amount,
- currency: currency.into(),
- minor_amount: amount,
+ merchant_payment_method_id: Some(router_data.connector_request_reference_id.clone()),
+ amount: router_data
+ .request
+ .amount
+ .map(|amount| payments_grpc::Money {
+ minor_amount: amount,
+ currency: currency.into(),
+ }),
payment_method: Some(payment_method),
- customer_name: None,
- email: None,
- customer_id: None,
address: Some(address),
metadata: None,
- connector_metadata: None,
+ connector_feature_data: None,
return_url: router_data.request.router_return_url.clone(),
test_mode: router_data.test_mode,
- connector_customer_id: router_data.connector_customer.clone(),
+ customer: Some(payments_grpc::Customer {
+ name: None,
+ email: None,
+ id: router_data
+ .customer_id
+ .as_ref()
+ .map(|id| id.get_string_repr().to_string()),
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
})
}
}
@@ -190,7 +180,7 @@ impl
transformers::ForeignTryFrom<(
&RouterData<Authorize, PaymentsAuthorizeData, PaymentsResponseData>,
common_enums::CallConnectorAction,
- )> for payments_grpc::PaymentServiceAuthorizeOnlyRequest
+ )> for payments_grpc::PaymentServiceAuthorizeRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
@@ -232,13 +222,6 @@ impl
.clone()
.map(payments_grpc::AuthenticationData::foreign_try_from)
.transpose()?;
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
let metadata = router_data
.request
.metadata
@@ -266,9 +249,10 @@ impl
.map(ConnectorState::foreign_from);
Ok(Self {
- connector_order_reference_id: router_data.request.order_id.clone(),
- amount: router_data.request.amount,
- currency: currency.into(),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
payment_method: Some(payment_method),
return_url: router_data.request.router_return_url.clone(),
address: Some(address),
@@ -277,24 +261,32 @@ impl
request_incremental_authorization: Some(
router_data.request.request_incremental_authorization,
),
- minor_amount: router_data.request.amount,
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
+ customer: Some(payments_grpc::Customer {
+ name: router_data
+ .request
+ .customer_name
+ .clone()
+ .map(|customer_name| customer_name.peek().to_owned()),
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: router_data
+ .request
+ .customer_id
+ .as_ref()
+ .map(|id| id.get_string_repr().to_string()),
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
browser_info,
-
session_token: router_data.session_token.clone(),
order_tax_amount: router_data
.request
.order_tax_amount
.map(|order_tax_amount| order_tax_amount.get_amount_as_i64()),
- customer_name: router_data
- .request
- .customer_name
- .clone()
- .map(|customer_name| customer_name.peek().to_owned()),
capture_method: capture_method.map(|capture_method| capture_method.into()),
webhook_url: router_data.request.webhook_url.clone(),
complete_authorize_url: router_data.request.complete_authorize_url.clone(),
@@ -308,38 +300,20 @@ impl
.request
.request_extended_authorization
.map(|request_extended_authorization| request_extended_authorization.is_true()),
- merchant_order_reference_id: router_data.request.merchant_order_reference_id.clone(),
+ merchant_order_id: router_data.request.merchant_order_reference_id.clone(),
shipping_cost: router_data
.request
.shipping_cost
.map(|shipping_cost| shipping_cost.get_amount_as_i64()),
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- }),
- customer_id: router_data
- .request
- .guest_customer
- .as_ref()
- .map(|guest| guest.customer_id.clone())
- .or_else(|| {
- router_data
- .request
- .customer_id
- .as_ref()
- .map(|id| id.get_string_repr().to_string())
- }),
+ merchant_transaction_id: Some(router_data.connector_request_reference_id.clone()),
metadata,
test_mode: router_data.test_mode,
- connector_customer_id: router_data.connector_customer.clone(),
state,
payment_method_token: router_data
.payment_method_token
.as_ref()
.and_then(|payment_method_token| payment_method_token.get_payment_method_token())
.map(|payment_method_token| Secret::new(payment_method_token.expose())),
- merchant_account_metadata,
description: router_data.description.clone(),
setup_mandate_details: router_data
.request
@@ -374,7 +348,7 @@ impl
.map(payments_grpc::PaymentChannel::foreign_try_from)
.transpose()?
.map(|payment_channel| payment_channel.into()),
- connector_metadata: None,
+ connector_feature_data: None,
locale: router_data.request.locale.clone(),
continue_redirection_url: router_data.request.complete_authorize_url.clone(),
redirection_response: None,
@@ -384,6 +358,7 @@ impl
.tokenization
.map(payments_grpc::Tokenization::foreign_from)
.map(Into::into),
+ l2_l3_data: None,
})
}
}
@@ -396,7 +371,7 @@ impl
PaymentsResponseData,
>,
common_enums::CallConnectorAction,
- )> for payments_grpc::PaymentServiceAuthorizeOnlyRequest
+ )> for payments_grpc::PaymentServiceAuthorizeRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
@@ -469,13 +444,6 @@ impl
authentication_data
};
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
let metadata = router_data
.request
.metadata
@@ -503,9 +471,10 @@ impl
.map(ConnectorState::foreign_from);
Ok(Self {
- connector_order_reference_id: None,
- amount: router_data.request.amount,
- currency: currency.into(),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
payment_method,
return_url: router_data.request.router_return_url.clone(),
address: Some(address),
@@ -514,16 +483,21 @@ impl
request_incremental_authorization: Some(
router_data.request.request_incremental_authorization,
),
- minor_amount: router_data.request.amount,
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
+ customer: Some(payments_grpc::Customer {
+ name: None,
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: None,
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
browser_info,
session_token: router_data.session_token.clone(),
order_tax_amount: None,
- customer_name: None,
capture_method: capture_method.map(|capture_method| capture_method.into()),
webhook_url: None,
complete_authorize_url: router_data.request.complete_authorize_url.clone(),
@@ -534,24 +508,17 @@ impl
payment_experience: None,
authentication_data,
request_extended_authorization: None,
- merchant_order_reference_id: None,
+ merchant_order_id: None,
shipping_cost: None,
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- }),
- customer_id: None,
+ merchant_transaction_id: Some(router_data.connector_request_reference_id.clone()),
metadata,
test_mode: router_data.test_mode,
- connector_customer_id: router_data.connector_customer.clone(),
state,
payment_method_token: router_data
.payment_method_token
.as_ref()
.and_then(|payment_method_token| payment_method_token.get_payment_method_token())
.map(|payment_method_token| Secret::new(payment_method_token.expose())),
- merchant_account_metadata,
description: router_data.description.clone(),
setup_mandate_details: router_data
.request
@@ -562,7 +529,7 @@ impl
statement_descriptor_name: None,
statement_descriptor_suffix: None,
order_details: vec![],
- connector_metadata: None,
+ connector_feature_data: None,
enable_partial_authorization: None,
payment_channel: None,
billing_descriptor: None,
@@ -586,6 +553,7 @@ impl
.tokenization
.map(payments_grpc::Tokenization::foreign_from)
.map(Into::into),
+ l2_l3_data: None,
})
}
}
@@ -615,26 +583,15 @@ impl
.as_ref()
.map(ConnectorState::foreign_from);
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
-
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
+ merchant_order_id: Some(router_data.connector_request_reference_id.clone()),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
}),
- amount: router_data.request.minor_amount.get_amount_as_i64(),
- currency: currency.into(),
metadata: None,
webhook_url: None,
- connector_metadata: None,
- merchant_account_metadata,
+ connector_feature_data: None,
state,
test_mode: router_data.test_mode,
payment_method_type: router_data
@@ -654,7 +611,7 @@ impl
PaymentsResponseData,
>,
common_enums::CallConnectorAction,
- )> for payments_grpc::PaymentServiceCreateConnectorCustomerRequest
+ )> for payments_grpc::CustomerServiceCreateRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
@@ -668,22 +625,13 @@ impl
common_enums::CallConnectorAction,
),
) -> Result<Self, Self::Error> {
- let request_ref_id = router_data.connector_request_reference_id.clone();
let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
-
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(request_ref_id)),
- }),
- merchant_account_metadata,
+ merchant_customer_id: router_data
+ .customer_id
+ .as_ref()
+ .map(|id| id.get_string_repr().to_string()),
customer_name: router_data
.request
.name
@@ -694,10 +642,6 @@ impl
.email
.clone()
.map(|e| e.expose().expose().into()),
- customer_id: router_data
- .customer_id
- .clone()
- .map(|id| id.get_string_repr().to_string()),
phone_number: router_data
.request
.phone
@@ -705,7 +649,7 @@ impl
.map(|phone| phone.peek().to_string()),
address: Some(address),
metadata: None,
- connector_metadata: None,
+ connector_feature_data: None,
test_mode: router_data.test_mode,
})
}
@@ -729,9 +673,6 @@ impl
.request
.connector_transaction_id
.get_connector_transaction_id()
- .map(|id| Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(id)),
- })
.map_err(|e| {
tracing::debug!(
transaction_id_error=?e,
@@ -739,14 +680,11 @@ impl
);
e
})
- .ok();
+ .unwrap_or_default();
+
let connector_order_reference_id = router_data.request.connector_reference_id.clone();
- let request_ref_id = Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- });
+ let merchant_transaction_id = Some(router_data.connector_request_reference_id.clone());
let currency = payments_grpc::Currency::foreign_try_from(router_data.request.currency)?;
@@ -781,26 +719,20 @@ impl
.map(payments_grpc::FutureUsage::foreign_try_from)
.transpose()?;
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
-
Ok(Self {
- transaction_id: connector_transaction_id,
+ connector_transaction_id,
+ merchant_transaction_id,
encoded_data: router_data.request.encoded_data.clone(),
- request_ref_id,
capture_method: capture_method.map(|capture_method| capture_method.into()),
handle_response,
setup_future_usage: setup_future_usage.map(|s| s.into()),
connector_order_reference_id,
- amount: router_data.request.amount.get_amount_as_i64(),
- currency: currency.into(),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
state,
- connector_metadata: router_data
+ connector_feature_data: router_data
.request
.connector_meta
.as_ref()
@@ -811,7 +743,6 @@ impl
sync_type: Some(
payments_grpc::SyncRequestType::foreign_from(&router_data.request.sync_type).into(),
),
- merchant_account_metadata,
metadata: None,
test_mode: router_data.test_mode,
payment_experience: router_data
@@ -845,7 +776,7 @@ impl
router_request_types::AuthorizeSessionTokenData,
PaymentsResponseData,
>,
- > for payments_grpc::PaymentServiceCreateSessionTokenRequest
+ > for payments_grpc::MerchantAuthenticationServiceCreateSessionTokenRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
@@ -857,34 +788,22 @@ impl
) -> Result<Self, Self::Error> {
let currency = payments_grpc::Currency::foreign_try_from(router_data.request.currency)?;
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
+ let amount = router_data.request.amount.ok_or(report!(
+ UnifiedConnectorServiceError::MissingRequiredField {
+ field_name: "amount"
+ }
+ ))?;
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
+ merchant_session_id: Some(router_data.connector_request_reference_id.clone()),
+ amount: Some(payments_grpc::Money {
+ minor_amount: amount,
+ currency: currency.into(),
}),
- amount: router_data
- .request
- .amount
- .ok_or(report!(UnifiedConnectorServiceError::RequestEncodingFailed))?,
- currency: currency.into(),
- minor_amount: router_data
- .request
- .amount
- .ok_or(report!(UnifiedConnectorServiceError::RequestEncodingFailed))?,
metadata: None,
state: None,
browser_info: None,
- connector_metadata: None,
- merchant_account_metadata,
+ connector_feature_data: None,
test_mode: router_data.test_mode,
})
}
@@ -897,7 +816,7 @@ impl
router_request_types::PaymentsAuthenticateData,
PaymentsResponseData,
>,
- > for payments_grpc::PaymentServiceAuthenticateRequest
+ > for payments_grpc::PaymentMethodAuthenticationServiceAuthenticateRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
@@ -930,13 +849,6 @@ impl
.map(payments_grpc::CaptureMethod::foreign_try_from)
.transpose()?;
let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
// Convert ucs_authentication_data from PreAuthenticate response to gRPC format
let authentication_data = router_data
@@ -947,25 +859,27 @@ impl
.transpose()?;
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- }),
- amount: router_data.request.amount.unwrap_or(0),
- currency: currency.into(),
- minor_amount: router_data
+ merchant_order_id: Some(router_data.connector_request_reference_id.clone()),
+ amount: router_data
.request
.minor_amount
- .map(|amount| amount.get_amount_as_i64())
- .unwrap_or(0),
+ .map(|minor_amount| payments_grpc::Money {
+ minor_amount: minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
payment_method,
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
- customer_name: None,
+ customer: Some(payments_grpc::Customer {
+ name: None,
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: None,
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
address: Some(address),
authentication_data,
metadata: None,
@@ -980,14 +894,13 @@ impl
payments_grpc::RedirectionResponse::foreign_try_from(redirection_response)
})
.transpose()?,
- merchant_account_metadata,
browser_info: router_data
.request
.browser_info
.clone()
.map(payments_grpc::BrowserInformation::foreign_try_from)
.transpose()?,
- connector_metadata: None,
+ connector_feature_data: None,
capture_method: capture_method.map(|capture_method| capture_method.into()),
})
}
@@ -1000,7 +913,7 @@ impl
router_request_types::PaymentsPostAuthenticateData,
PaymentsResponseData,
>,
- > for payments_grpc::PaymentServicePostAuthenticateRequest
+ > for payments_grpc::PaymentMethodAuthenticationServicePostAuthenticateRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
@@ -1028,40 +941,35 @@ impl
)
})
.transpose()?;
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
+
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- }),
- amount: router_data.request.amount.unwrap_or(0),
- currency: currency.into(),
- minor_amount: router_data
+ merchant_order_id: Some(router_data.connector_request_reference_id.clone()),
+ amount: router_data
.request
.minor_amount
- .map(|amount| amount.get_amount_as_i64())
- .unwrap_or(0),
+ .map(|minor_amount| payments_grpc::Money {
+ minor_amount: minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
payment_method,
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
- customer_name: None,
+ customer: Some(payments_grpc::Customer {
+ name: None,
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: None,
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
address: Some(address),
authentication_data: None,
metadata: None,
return_url: None,
continue_redirection_url: None,
state: None,
- merchant_account_metadata,
redirection_response: router_data
.request
.redirect_response
@@ -1076,7 +984,7 @@ impl
.clone()
.map(payments_grpc::BrowserInformation::foreign_try_from)
.transpose()?,
- connector_metadata: None,
+ connector_feature_data: None,
connector_order_reference_id: None,
})
}
@@ -1089,7 +997,7 @@ impl
router_request_types::PaymentsPreAuthenticateData,
PaymentsResponseData,
>,
- > for payments_grpc::PaymentServicePreAuthenticateRequest
+ > for payments_grpc::PaymentMethodAuthenticationServicePreAuthenticateRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
@@ -1117,13 +1025,6 @@ impl
.transpose()?;
let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
let metadata = router_data
.request
.metadata
@@ -1132,43 +1033,43 @@ impl
.transpose()
.change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
.map(|s| s.into());
- let amount = router_data.request.amount;
- let minor_amount = router_data.request.minor_amount;
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
+ merchant_order_id: Some(router_data.connector_request_reference_id.clone()),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
}),
- amount,
- currency: currency.into(),
- minor_amount: minor_amount.get_amount_as_i64(),
payment_method: Some(payment_method),
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
- customer_name: router_data
- .request
- .customer_name
- .clone()
- .map(|customer_name| customer_name.peek().to_owned()),
+ customer: Some(payments_grpc::Customer {
+ name: router_data
+ .request
+ .customer_name
+ .clone()
+ .map(|customer_name| customer_name.peek().to_owned()),
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: None,
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
address: Some(address),
enrolled_for_3ds: router_data.request.enrolled_for_3ds,
metadata,
return_url: router_data.request.router_return_url.clone(),
continue_redirection_url: router_data.request.complete_authorize_url.clone(),
state: None,
- merchant_account_metadata,
browser_info: router_data
.request
.browser_info
.clone()
.map(payments_grpc::BrowserInformation::foreign_try_from)
.transpose()?,
- connector_metadata: None,
+ connector_feature_data: None,
capture_method: capture_method.map(|capture_method| capture_method.into()),
description: router_data.description.clone(),
})
@@ -1205,30 +1106,16 @@ impl transformers::ForeignTryFrom<&RouterData<Capture, PaymentsCaptureData, Paym
.as_ref()
.map(ConnectorState::foreign_from);
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
-
Ok(Self {
- transaction_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- connector_transaction_id,
- )),
- }),
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
+ connector_transaction_id,
+ merchant_capture_id: Some(router_data.connector_request_reference_id.clone()),
+ amount_to_capture: Some(payments_grpc::Money {
+ minor_amount: router_data
+ .request
+ .minor_amount_to_capture
+ .get_amount_as_i64(),
+ currency: currency.into(),
}),
- amount_to_capture: router_data
- .request
- .minor_amount_to_capture
- .get_amount_as_i64(),
- currency: currency.into(),
capture_method: capture_method.map(|capture_method| capture_method.into()),
metadata: router_data
.request
@@ -1246,7 +1133,7 @@ impl transformers::ForeignTryFrom<&RouterData<Capture, PaymentsCaptureData, Paym
},
),
state,
- connector_metadata: router_data
+ connector_feature_data: router_data
.request
.connector_meta
.as_ref()
@@ -1254,9 +1141,8 @@ impl transformers::ForeignTryFrom<&RouterData<Capture, PaymentsCaptureData, Paym
.transpose()
.change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
.map(|s| s.into()),
- merchant_account_metadata,
test_mode: router_data.test_mode,
- merchant_order_reference_id: router_data.request.merchant_order_reference_id.clone(),
+ merchant_order_id: router_data.request.merchant_order_reference_id.clone(),
})
}
}
@@ -1312,13 +1198,6 @@ impl
.map(payments_grpc::CaptureMethod::foreign_try_from)
.transpose()?;
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
let metadata = router_data
.request
.metadata
@@ -1335,8 +1214,10 @@ impl
.transpose()?;
Ok(Self {
- amount: router_data.request.amount,
- currency: currency.into(),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
billing_descriptor: None,
payment_method,
return_url: router_data.request.complete_authorize_url.clone(),
@@ -1344,17 +1225,22 @@ impl
auth_type: auth_type.into(),
enrolled_for_3ds: Some(false),
request_incremental_authorization: Some(false),
- minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
+ customer: Some(payments_grpc::Customer {
+ name: None,
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: None,
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
browser_info,
locale: None,
session_token: None,
order_tax_amount: None,
- customer_name: None,
capture_method: capture_method.map(|capture_method| capture_method.into()),
webhook_url: None, // CompleteAuthorize doesn't have webhook_url
complete_authorize_url: router_data.request.complete_authorize_url.clone(),
@@ -1375,26 +1261,18 @@ impl
payment_experience: None,
authentication_data,
request_extended_authorization: None,
- merchant_order_reference_id: None,
+ merchant_order_id: router_data.request.merchant_order_reference_id.clone(),
shipping_cost: None,
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- }),
- customer_id: None,
+ merchant_transaction_id: Some(router_data.connector_request_reference_id.clone()),
metadata,
test_mode: router_data.test_mode,
- connector_customer_id: router_data.connector_customer.clone(),
- merchant_account_metadata,
state: None,
description: None,
setup_mandate_details: None,
statement_descriptor_name: None,
statement_descriptor_suffix: None,
order_details: vec![],
- connector_metadata: None,
- connector_order_reference_id: Some(router_data.connector_request_reference_id.clone()),
+ connector_feature_data: None,
enable_partial_authorization: None,
payment_channel: None,
tokenization_strategy: router_data
@@ -1402,6 +1280,11 @@ impl
.tokenization
.map(payments_grpc::Tokenization::foreign_from)
.map(Into::into),
+ threeds_completion_indicator: None,
+ redirection_response: None,
+ continue_redirection_url: None,
+ payment_method_token: None,
+ l2_l3_data: None,
})
}
}
@@ -1448,13 +1331,6 @@ impl
.clone()
.map(payments_grpc::AuthenticationData::foreign_try_from)
.transpose()?;
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
let metadata = router_data
.request
.metadata
@@ -1482,8 +1358,10 @@ impl
.map(ConnectorState::foreign_from);
Ok(Self {
- amount: router_data.request.amount,
- currency: currency.into(),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
payment_method: Some(payment_method),
return_url: router_data.request.router_return_url.clone(),
address: Some(address),
@@ -1492,23 +1370,32 @@ impl
request_incremental_authorization: Some(
router_data.request.request_incremental_authorization,
),
- minor_amount: router_data.request.amount,
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
browser_info,
session_token: None,
order_tax_amount: router_data
.request
.order_tax_amount
.map(|order_tax_amount| order_tax_amount.get_amount_as_i64()),
- customer_name: router_data
- .request
- .customer_name
- .clone()
- .map(|customer_name| customer_name.peek().to_owned()),
+ customer: Some(payments_grpc::Customer {
+ name: router_data
+ .request
+ .customer_name
+ .clone()
+ .map(|customer_name| customer_name.peek().to_owned()),
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: router_data
+ .request
+ .customer_id
+ .as_ref()
+ .map(|id| id.get_string_repr().to_string()),
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
capture_method: capture_method.map(|capture_method| capture_method.into()),
webhook_url: router_data.request.webhook_url.clone(),
complete_authorize_url: router_data.request.complete_authorize_url.clone(),
@@ -1522,33 +1409,15 @@ impl
.request
.request_extended_authorization
.map(|request_extended_authorization| request_extended_authorization.is_true()),
- merchant_order_reference_id: router_data.request.merchant_order_reference_id.clone(),
+ merchant_order_id: router_data.request.merchant_order_reference_id.clone(),
shipping_cost: router_data
.request
.shipping_cost
.map(|shipping_cost| shipping_cost.get_amount_as_i64()),
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- }),
- customer_id: router_data
- .request
- .guest_customer
- .as_ref()
- .map(|guest| guest.customer_id.clone())
- .or_else(|| {
- router_data
- .request
- .customer_id
- .as_ref()
- .map(|id| id.get_string_repr().to_string())
- }),
+ merchant_transaction_id: Some(router_data.connector_request_reference_id.clone()),
metadata,
test_mode: router_data.test_mode,
- connector_customer_id: router_data.connector_customer.clone(),
state,
- merchant_account_metadata,
description: router_data.description.clone(),
setup_mandate_details: router_data
.request
@@ -1567,8 +1436,7 @@ impl
.as_ref()
.and_then(|descriptor| descriptor.statement_descriptor_suffix.clone()),
order_details: vec![],
- connector_metadata: None,
- connector_order_reference_id: router_data.request.order_id.clone(),
+ connector_feature_data: None,
enable_partial_authorization: router_data
.request
.enable_partial_authorization
@@ -1591,6 +1459,11 @@ impl
.tokenization
.map(payments_grpc::Tokenization::foreign_from)
.map(Into::into),
+ threeds_completion_indicator: None,
+ redirection_response: None,
+ continue_redirection_url: None,
+ payment_method_token: None,
+ l2_l3_data: None,
})
}
}
@@ -1656,8 +1529,10 @@ impl
.transpose()?;
Ok(Self {
- amount: router_data.request.amount,
- currency: currency.into(),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
billing_descriptor: None,
payment_method,
return_url: router_data.request.router_return_url.clone(),
@@ -1667,12 +1542,26 @@ impl
request_incremental_authorization: Some(
router_data.request.request_incremental_authorization,
),
- minor_amount: router_data.request.amount,
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
+ customer: Some(payments_grpc::Customer {
+ name: router_data
+ .request
+ .customer_name
+ .clone()
+ .map(|customer_name| customer_name.peek().to_owned()),
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: router_data
+ .request
+ .customer_id
+ .as_ref()
+ .map(|id| id.get_string_repr().to_string()),
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
browser_info,
locale: None,
session_token: None,
@@ -1680,11 +1569,6 @@ impl
.request
.order_tax_amount
.map(|order_tax_amount| order_tax_amount.get_amount_as_i64()),
- customer_name: router_data
- .request
- .customer_name
- .clone()
- .map(|customer_name| customer_name.peek().to_owned()),
capture_method: capture_method.map(|capture_method| capture_method.into()),
webhook_url: router_data.request.webhook_url.clone(),
complete_authorize_url: router_data.request.complete_authorize_url.clone(),
@@ -1698,7 +1582,7 @@ impl
.request
.request_extended_authorization
.map(|request_extended_authorization| request_extended_authorization.is_true()),
- merchant_order_reference_id: router_data
+ merchant_order_id: router_data
.request
.merchant_order_reference_id
.as_ref()
@@ -1709,16 +1593,7 @@ impl
.request
.shipping_cost
.map(|shipping_cost| shipping_cost.get_amount_as_i64()),
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- }),
- customer_id: router_data
- .request
- .customer_id
- .as_ref()
- .map(|id| id.get_string_repr().to_string()),
+ merchant_transaction_id: Some(router_data.connector_request_reference_id.clone()),
metadata: router_data
.request
.metadata
@@ -1727,15 +1602,7 @@ impl
.transpose()
.change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
.map(|s| s.into()),
- merchant_account_metadata: router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into()),
test_mode: router_data.test_mode,
- connector_customer_id: router_data.connector_customer.clone(),
state: None,
description: router_data.description.clone(),
setup_mandate_details: router_data
@@ -1747,11 +1614,15 @@ impl
statement_descriptor_name: router_data.request.statement_descriptor.clone(),
statement_descriptor_suffix: router_data.request.statement_descriptor_suffix.clone(),
order_details: vec![],
- connector_metadata: None,
- connector_order_reference_id: router_data.request.order_id.clone(),
+ connector_feature_data: None,
enable_partial_authorization: None,
payment_channel: None,
tokenization_strategy: None,
+ threeds_completion_indicator: None,
+ redirection_response: None,
+ continue_redirection_url: None,
+ payment_method_token: None,
+ l2_l3_data: None,
})
}
}
@@ -1759,7 +1630,7 @@ impl
impl
transformers::ForeignTryFrom<
&RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
- > for payments_grpc::PaymentServiceRegisterRequest
+ > for payments_grpc::PaymentServiceSetupRecurringRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
@@ -1814,29 +1685,32 @@ impl
.as_ref()
.and_then(|payment_method_token| payment_method_token.get_payment_method_token())
.map(|payment_method_token| Secret::new(payment_method_token.expose())),
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
+ merchant_recurring_payment_id: router_data.connector_request_reference_id.clone(),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
}),
- currency: currency.into(),
payment_method: Some(payment_method),
- minor_amount: Some(router_data.request.amount),
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
- customer_name: router_data
- .request
- .customer_name
- .clone()
- .map(|customer_name| customer_name.peek().to_owned()),
- customer_id: router_data
- .request
- .customer_id
- .as_ref()
- .map(|id| id.get_string_repr().to_string()),
+ customer: Some(payments_grpc::Customer {
+ name: router_data
+ .request
+ .customer_name
+ .clone()
+ .map(|customer_name| customer_name.peek().to_owned()),
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: router_data
+ .request
+ .customer_id
+ .as_ref()
+ .map(|id| id.get_string_repr().to_string()),
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
address: Some(address),
auth_type: auth_type.into(),
enrolled_for_3ds: false,
@@ -1852,11 +1726,10 @@ impl
return_url: router_data.request.router_return_url.clone(),
webhook_url: router_data.request.webhook_url.clone(),
complete_authorize_url: router_data.request.complete_authorize_url.clone(),
-
session_token: None,
order_tax_amount: None,
order_category: None,
- merchant_order_reference_id: None,
+ merchant_order_id: None,
shipping_cost: router_data
.request
.shipping_cost
@@ -1870,17 +1743,9 @@ impl
customer_acceptance,
browser_info,
payment_experience: None,
- merchant_account_metadata: router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into()),
- connector_customer_id: router_data.connector_customer.clone(),
state,
order_id: None,
- connector_metadata: None,
+ connector_feature_data: None,
enable_partial_authorization: router_data
.request
.enable_partial_authorization
@@ -1903,6 +1768,8 @@ impl
.connector_testing_data
.as_ref()
.map(|data| Secret::new(data.peek().to_string())),
+ l2_l3_data: None,
+ setup_mandate_details: None,
})
}
}
@@ -1910,7 +1777,7 @@ impl
impl
transformers::ForeignTryFrom<
&RouterData<Authorize, PaymentsAuthorizeData, PaymentsResponseData>,
- > for payments_grpc::PaymentServiceRepeatEverythingRequest
+ > for payments_grpc::RecurringPaymentServiceChargeRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
@@ -1938,13 +1805,13 @@ impl
.map(|pm_type| pm_type.into());
let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;
- let mandate_reference_id = match &router_data.request.mandate_id {
+ let connector_recurring_payment_id = match &router_data.request.mandate_id {
Some(mandate) => match &mandate.mandate_reference_id {
Some(api_models::payments::MandateReferenceId::ConnectorMandateId(
connector_mandate_id,
- )) => Some(payments_grpc::MandateReferenceId {
+ )) => Some(payments_grpc::MandateReference {
mandate_id_type: Some(
- payments_grpc::mandate_reference_id::MandateIdType::ConnectorMandateId(
+ payments_grpc::mandate_reference::MandateIdType::ConnectorMandateId(
payments_grpc::ConnectorMandateReferenceId {
connector_mandate_id: connector_mandate_id
.get_connector_mandate_id(),
@@ -1957,18 +1824,18 @@ impl
}),
Some(api_models::payments::MandateReferenceId::NetworkMandateId(
network_mandate_id,
- )) => Some(payments_grpc::MandateReferenceId {
+ )) => Some(payments_grpc::MandateReference {
mandate_id_type: Some(
- payments_grpc::mandate_reference_id::MandateIdType::NetworkMandateId(
+ payments_grpc::mandate_reference::MandateIdType::NetworkMandateId(
network_mandate_id.clone(),
),
),
}),
Some(api_models::payments::MandateReferenceId::NetworkTokenWithNTI(
network_token_with_nti,
- )) => Some(payments_grpc::MandateReferenceId {
+ )) => Some(payments_grpc::MandateReference {
mandate_id_type: Some(
- payments_grpc::mandate_reference_id::MandateIdType::NetworkTokenWithNti(
+ payments_grpc::mandate_reference::MandateIdType::NetworkTokenWithNti(
payments_grpc::NetworkTokenWithNti {
network_transaction_id: network_token_with_nti
.network_transaction_id
@@ -2028,24 +1895,16 @@ impl
.map(payments_grpc::AuthenticationData::foreign_try_from)
.transpose()?;
- let recurring_mandate_payment_data = router_data
- .recurring_mandate_payment_data
- .as_ref()
- .map(payments_grpc::RecurringMandatePaymentData::foreign_try_from)
- .transpose()?;
-
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- }),
+ merchant_charge_id: Some(router_data.connector_request_reference_id.clone()),
payment_method,
- mandate_reference_id,
- amount: router_data.request.amount,
- currency: currency.into(),
- minor_amount: router_data.request.amount,
- merchant_order_reference_id: router_data.request.merchant_order_reference_id.clone(),
+ connector_recurring_payment_id,
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
+ original_payment_authorized_amount: None,
+ merchant_order_id: router_data.request.merchant_order_reference_id.clone(),
metadata: router_data
.request
.metadata
@@ -2054,13 +1913,6 @@ impl
.transpose()
.change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
.map(|s| s.into()),
- merchant_account_metadata: router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into()),
webhook_url: router_data.request.webhook_url.clone(),
capture_method: capture_method.map(|capture_method| capture_method.into()),
email: router_data
@@ -2077,7 +1929,6 @@ impl
connector_customer_id: router_data.connector_customer.clone(),
address: Some(address),
off_session: router_data.request.off_session,
- recurring_mandate_payment_data,
enable_partial_authorization: router_data
.request
.enable_partial_authorization
@@ -2097,7 +1948,7 @@ impl
.shipping_cost
.map(|shipping_cost| shipping_cost.get_amount_as_i64()),
authentication_data,
- connector_metadata: None,
+ connector_feature_data: None,
locale: router_data.request.locale.clone(),
connector_testing_data: router_data
.request
@@ -2115,33 +1966,32 @@ impl
.map(payments_grpc::Currency::foreign_try_from)
.transpose()?
.map(|currency| currency.into()),
- })
- }
-}
-
-impl
- transformers::ForeignTryFrom<
- &hyperswitch_domain_models::router_data::RecurringMandatePaymentData,
- > for payments_grpc::RecurringMandatePaymentData
-{
- type Error = error_stack::Report<UnifiedConnectorServiceError>;
-
- fn foreign_try_from(
- data: &hyperswitch_domain_models::router_data::RecurringMandatePaymentData,
- ) -> Result<Self, Self::Error> {
- Ok(Self {
- original_payment_authorized_amount: data.original_payment_authorized_amount,
- original_payment_authorized_currency: data
- .original_payment_authorized_currency
- .map(payments_grpc::Currency::foreign_try_from)
- .transpose()?
- .map(|currency| currency.into()),
+ l2_l3_data: None,
+ customer: Some(payments_grpc::Customer {
+ name: router_data
+ .request
+ .customer_name
+ .clone()
+ .map(|customer_name| customer_name.peek().to_owned()),
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: router_data
+ .customer_id
+ .as_ref()
+ .map(|id| id.get_string_repr().to_string()),
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
+ }),
})
}
}
impl transformers::ForeignTryFrom<&RouterData<Session, PaymentsSessionData, PaymentsResponseData>>
- for payments_grpc::PaymentServiceSdkSessionTokenRequest
+ for payments_grpc::MerchantAuthenticationServiceCreateSdkSessionTokenRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
@@ -2157,33 +2007,35 @@ impl transformers::ForeignTryFrom<&RouterData<Session, PaymentsSessionData, Paym
.and_then(|c| payments_grpc::CountryAlpha2::from_str_name(&c.to_string()))
.map(|country| country.into());
- let merchant_account_metadata = serde_json::to_string(&router_data.connector_meta_data)
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?;
-
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
+ merchant_sdk_session_id: router_data.connector_request_reference_id.clone(),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
+ customer: Some(payments_grpc::Customer {
+ name: router_data
+ .request
+ .customer_name
+ .clone()
+ .map(|customer_name| customer_name.peek().to_owned()),
+ email: router_data
+ .request
+ .email
+ .clone()
+ .map(|e| e.expose().expose().into()),
+ id: router_data
+ .customer_id
+ .as_ref()
+ .map(|id| id.get_string_repr().to_string()),
+ connector_customer_id: router_data.connector_customer.clone(),
+ phone_number: None,
+ phone_country_code: None,
}),
- amount: router_data.request.amount,
- currency: currency.into(),
- minor_amount: router_data.request.minor_amount.get_amount_as_i64(),
- email: router_data
- .request
- .email
- .clone()
- .map(|e| e.expose().expose().into()),
- merchant_account_metadata: Some(merchant_account_metadata.into()),
order_tax_amount: router_data
.request
.order_tax_amount
.map(|order_tax_amount| order_tax_amount.get_amount_as_i64()),
- customer_name: router_data
- .request
- .customer_name
- .clone()
- .map(|customer_name| customer_name.expose().into()),
shipping_cost: router_data
.request
.shipping_cost
@@ -2195,7 +2047,7 @@ impl transformers::ForeignTryFrom<&RouterData<Session, PaymentsSessionData, Paym
.transpose()?
.map(|payment_method_type| payment_method_type.into()),
metadata: None,
- connector_metadata: None,
+ connector_feature_data: None,
})
}
}
@@ -2226,20 +2078,14 @@ impl
.map(ConnectorState::foreign_from);
Ok(Self {
- minor_amount: router_data.request.total_amount,
- transaction_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.request.connector_transaction_id.clone(),
- )),
- }),
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.total_amount,
+ currency: currency.into(),
}),
- currency: currency.into(),
+ connector_transaction_id: router_data.request.connector_transaction_id.clone(),
+ merchant_authorization_id: Some(router_data.connector_request_reference_id.clone()),
reason: router_data.request.reason.clone(),
- connector_metadata: router_data
+ connector_feature_data: router_data
.request
.connector_meta
.as_ref()
@@ -2254,46 +2100,22 @@ impl
impl
transformers::ForeignTryFrom<(
- payments_grpc::PaymentServicePreAuthenticateResponse,
+ payments_grpc::PaymentMethodAuthenticationServicePreAuthenticateResponse,
AttemptStatus,
)> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
(response, prev_status): (
- payments_grpc::PaymentServicePreAuthenticateResponse,
+ payments_grpc::PaymentMethodAuthenticationServicePreAuthenticateResponse,
AttemptStatus,
),
) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
-
- let resource_id: router_request_types::ResponseId = match response
- .transaction_id
+ let connector_transaction_id = response
+ .connector_transaction_id
.as_ref()
- .and_then(|id| id.id_type.clone())
- {
- Some(payments_grpc::identifier::IdType::Id(id)) => {
- router_request_types::ResponseId::ConnectorTransactionId(id)
- }
- Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => {
- router_request_types::ResponseId::EncodedData(encoded_data)
- }
- Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => {
- router_request_types::ResponseId::NoResponseId
- }
- };
+ .map(|id| router_request_types::ResponseId::ConnectorTransactionId(id.clone()))
+ .unwrap_or(router_request_types::ResponseId::NoResponseId);
let redirection_data = response
.redirection_data
@@ -2303,9 +2125,9 @@ impl
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
@@ -2313,16 +2135,49 @@ impl
};
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
- connector_transaction_id: resource_id.get_optional_response_id(),
- connector_response_reference_id,
- network_decline_code: response.network_decline_code.clone(),
- network_advice_code: response.network_advice_code.clone(),
- network_error_message: response.network_error_message.clone(),
+ connector_transaction_id: connector_transaction_id.get_optional_response_id(),
+ connector_response_reference_id: response.merchant_order_id.clone(),
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -2336,12 +2191,12 @@ impl
Ok((
PaymentsResponseData::TransactionResponse {
- resource_id,
+ resource_id: connector_transaction_id,
redirection_data: Box::new(redirection_data),
mandate_reference: Box::new(None),
connector_metadata: None,
- network_txn_id: response.network_txn_id.clone(),
- connector_response_reference_id,
+ network_txn_id: response.network_transaction_id.clone(),
+ connector_response_reference_id: response.merchant_order_id.clone(),
incremental_authorization_allowed: None,
authentication_data,
charges: None,
@@ -2368,35 +2223,11 @@ impl
AttemptStatus,
),
) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
-
- let resource_id: router_request_types::ResponseId = match response
- .transaction_id
+ let connector_transaction_id = response
+ .connector_transaction_id
.as_ref()
- .and_then(|id| id.id_type.clone())
- {
- Some(payments_grpc::identifier::IdType::Id(id)) => {
- router_request_types::ResponseId::ConnectorTransactionId(id)
- }
- Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => {
- router_request_types::ResponseId::EncodedData(encoded_data)
- }
- Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => {
- router_request_types::ResponseId::NoResponseId
- }
- };
+ .map(|id| router_request_types::ResponseId::ConnectorTransactionId(id.clone()))
+ .unwrap_or(router_request_types::ResponseId::NoResponseId);
let (mut connector_metadata, redirection_data) = match response.redirection_data.clone() {
Some(redirection_data) => match redirection_data.form_type {
@@ -2429,13 +2260,13 @@ impl
// Parse connector_metadata from Secret<String> to serde_json::Value
let parsed_connector_metadata: Option<serde_json::Value> =
- response.connector_metadata.clone().and_then(|secret| {
+ response.connector_feature_data.clone().and_then(|secret| {
let exposed = secret.expose();
serde_json::from_str(&exposed)
.map_err(|e| {
tracing::warn!(
serialization_error = ?e,
- metadata = ?response.connector_metadata,
+ metadata = ?response.connector_feature_data,
"Failed to parse connector_metadata as JSON"
);
e
@@ -2484,16 +2315,16 @@ impl
};
// Extract connector_metadata from response if present and not already set
- connector_metadata = match (connector_metadata, response.connector_metadata.clone()) {
+ connector_metadata = match (connector_metadata, response.connector_feature_data.clone()) {
(None, Some(_secret)) => parsed_connector_metadata,
(existing, _) => existing, // keep the existing value if already Some or response is None
};
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
@@ -2501,16 +2332,49 @@ impl
};
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
- connector_transaction_id: resource_id.get_optional_response_id(),
- connector_response_reference_id,
- network_decline_code: response.network_decline_code.clone(),
- network_advice_code: response.network_advice_code.clone(),
- network_error_message: response.network_error_message.clone(),
+ connector_transaction_id: connector_transaction_id.get_optional_response_id(),
+ connector_response_reference_id: response.merchant_transaction_id.clone(),
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -2518,20 +2382,12 @@ impl
Ok((
PaymentsResponseData::TransactionResponse {
- resource_id,
+ resource_id: connector_transaction_id,
redirection_data: Box::new(redirection_data),
- mandate_reference: Box::new(response.mandate_reference.map(|grpc_mandate| {
- hyperswitch_domain_models::router_response_types::MandateReference {
- connector_mandate_id: grpc_mandate.mandate_id,
- payment_method_id: grpc_mandate.payment_method_id,
- mandate_metadata: None,
- connector_mandate_request_reference_id: grpc_mandate
- .connector_mandate_request_reference_id,
- }
- })),
+ mandate_reference: Box::new(response.mandate_reference.map(hyperswitch_domain_models::router_response_types::MandateReference::foreign_try_from).transpose()?),
connector_metadata,
- network_txn_id: response.network_txn_id.clone(),
- connector_response_reference_id,
+ network_txn_id: response.network_transaction_id.clone(),
+ connector_response_reference_id: response.merchant_transaction_id.clone(),
incremental_authorization_allowed: response.incremental_authorization_allowed,
authentication_data: None,
charges: None,
@@ -2552,46 +2408,20 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceCaptureResponse,
fn foreign_try_from(
(response, prev_status): (payments_grpc::PaymentServiceCaptureResponse, AttemptStatus),
) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
-
let status_code = convert_connector_service_status_code(response.status_code)?;
- let resource_id: router_request_types::ResponseId = match response
- .transaction_id
- .as_ref()
- .and_then(|id| id.id_type.clone())
- {
- Some(payments_grpc::identifier::IdType::Id(id)) => {
- router_request_types::ResponseId::ConnectorTransactionId(id)
- }
- Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => {
- router_request_types::ResponseId::EncodedData(encoded_data)
- }
- Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => {
- router_request_types::ResponseId::NoResponseId
- }
- };
+ let connector_transaction_id = router_request_types::ResponseId::ConnectorTransactionId(
+ response.connector_transaction_id.clone(),
+ );
// Extract connector_metadata from response if present
- let connector_metadata = response.connector_metadata.clone().and_then(|secret| {
+ let connector_metadata = response.connector_feature_data.clone().and_then(|secret| {
let connector_metadata = secret.expose();
serde_json::from_str(&connector_metadata)
.map_err(|e| {
tracing::warn!(
serialization_error = ?e,
- metadata = ?response.connector_metadata,
+ metadata = ?response.connector_feature_data,
"Failed to serialize connector_metadata from UCS capture response"
);
e
@@ -2599,45 +2429,71 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceCaptureResponse,
.ok()
});
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
))?),
};
+
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
- connector_transaction_id: resource_id.get_optional_response_id(),
- connector_response_reference_id,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ connector_transaction_id: connector_transaction_id.get_optional_response_id(),
+ connector_response_reference_id: response.merchant_capture_id.clone(),
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;
Ok((
PaymentsResponseData::TransactionResponse {
- resource_id,
+ resource_id: connector_transaction_id,
redirection_data: Box::new(None),
- mandate_reference: Box::new(response.mandate_reference.map(|grpc_mandate| {
- hyperswitch_domain_models::router_response_types::MandateReference {
- connector_mandate_id: grpc_mandate.mandate_id,
- payment_method_id: grpc_mandate.payment_method_id,
- mandate_metadata: None,
- connector_mandate_request_reference_id: grpc_mandate
- .connector_mandate_request_reference_id,
- }
- })),
+ mandate_reference: Box::new(response.mandate_reference.map(hyperswitch_domain_models::router_response_types::MandateReference::foreign_try_from).transpose()?),
connector_metadata,
network_txn_id: None,
- connector_response_reference_id,
+ connector_response_reference_id: response.merchant_capture_id.clone(),
incremental_authorization_allowed: response.incremental_authorization_allowed,
authentication_data: None,
charges: None,
@@ -2649,35 +2505,63 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceCaptureResponse,
}
}
-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCreateConnectorCustomerResponse>
+impl transformers::ForeignTryFrom<payments_grpc::CustomerServiceCreateResponse>
for Result<PaymentsResponseData, ErrorResponse>
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
- response: payments_grpc::PaymentServiceCreateConnectorCustomerResponse,
+ response: payments_grpc::CustomerServiceCreateResponse,
) -> Result<Self, Self::Error> {
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
- router_env::logger::error!(
- error_message = ?response.error_message,
- error_code = ?response.error_code,
- status_code,
- "UCS create connector customer failed"
- );
+ let response = if let Some(error_info) = response.error.as_ref() {
+ router_env::logger::error!("UCS create connector customer failed");
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status: None,
connector_transaction_id: None,
connector_response_reference_id: None,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -2691,78 +2575,94 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCreateConnectorCu
}
}
-impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceRegisterResponse, AttemptStatus)>
- for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>
+impl
+ transformers::ForeignTryFrom<(
+ payments_grpc::PaymentServiceSetupRecurringResponse,
+ AttemptStatus,
+ )> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
- (response, prev_status): (payments_grpc::PaymentServiceRegisterResponse, AttemptStatus),
+ (response, prev_status): (
+ payments_grpc::PaymentServiceSetupRecurringResponse,
+ AttemptStatus,
+ ),
) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
-
- let resource_id: router_request_types::ResponseId = match response
- .registration_id
+ let connector_transaction_id = response
+ .connector_recurring_payment_id
.as_ref()
- .and_then(|id| id.id_type.clone())
- {
- Some(payments_grpc::identifier::IdType::Id(id)) => {
- router_request_types::ResponseId::ConnectorTransactionId(id)
- }
- Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => {
- router_request_types::ResponseId::EncodedData(encoded_data)
- }
- Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => {
- router_request_types::ResponseId::NoResponseId
- }
- };
+ .map(|id| router_request_types::ResponseId::ConnectorTransactionId(id.clone()))
+ .unwrap_or(router_request_types::ResponseId::NoResponseId);
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
))?),
};
+
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
- connector_transaction_id: resource_id.get_optional_response_id(),
- connector_response_reference_id,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ connector_transaction_id: connector_transaction_id.get_optional_response_id(),
+ connector_response_reference_id: None,
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;
// Extract connector_metadata from response if present
- let connector_metadata = response.connector_metadata.clone().and_then(|secret| {
+ let connector_metadata = response.connector_feature_data.clone().and_then(|secret| {
let connector_metadata = secret.expose();
serde_json::from_str(&connector_metadata)
.map_err(|e| {
tracing::warn!(
serialization_error=?e,
- metadata=?response.connector_metadata,
+ metadata=?response.connector_feature_data,
"Failed to serialize connector_metadata from UCS register response"
);
e
@@ -2772,7 +2672,7 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceRegisterResponse
Ok((
PaymentsResponseData::TransactionResponse {
- resource_id,
+ resource_id: connector_transaction_id,
redirection_data: Box::new(
response
.redirection_data
@@ -2780,18 +2680,10 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceRegisterResponse
.map(RedirectForm::foreign_try_from)
.transpose()?,
),
- mandate_reference: Box::new(response.mandate_reference.map(|grpc_mandate| {
- hyperswitch_domain_models::router_response_types::MandateReference {
- connector_mandate_id: grpc_mandate.mandate_id,
- payment_method_id: grpc_mandate.payment_method_id,
- mandate_metadata: None,
- connector_mandate_request_reference_id: grpc_mandate
- .connector_mandate_request_reference_id,
- }
- })),
+ mandate_reference: Box::new(response.mandate_reference.map(hyperswitch_domain_models::router_response_types::MandateReference::foreign_try_from).transpose()?),
connector_metadata,
- network_txn_id: response.network_txn_id,
- connector_response_reference_id,
+ network_txn_id: response.network_transaction_id,
+ connector_response_reference_id: None,
incremental_authorization_allowed: response.incremental_authorization_allowed,
authentication_data: None,
charges: None,
@@ -2806,7 +2698,7 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceRegisterResponse
impl
transformers::ForeignTryFrom<(
- payments_grpc::PaymentServiceRepeatEverythingResponse,
+ payments_grpc::RecurringPaymentServiceChargeResponse,
AttemptStatus,
)> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>
{
@@ -2814,50 +2706,26 @@ impl
fn foreign_try_from(
(response, prev_status): (
- payments_grpc::PaymentServiceRepeatEverythingResponse,
+ payments_grpc::RecurringPaymentServiceChargeResponse,
AttemptStatus,
),
) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
-
- let resource_id: router_request_types::ResponseId = match response
- .transaction_id
+ let connector_transaction_id = response
+ .connector_transaction_id
.as_ref()
- .and_then(|id| id.id_type.clone())
- {
- Some(payments_grpc::identifier::IdType::Id(id)) => {
- router_request_types::ResponseId::ConnectorTransactionId(id)
- }
- Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => {
- router_request_types::ResponseId::EncodedData(encoded_data)
- }
- Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => {
- router_request_types::ResponseId::NoResponseId
- }
- };
+ .map(|id| router_request_types::ResponseId::ConnectorTransactionId(id.clone()))
+ .unwrap_or(router_request_types::ResponseId::NoResponseId);
let status_code = convert_connector_service_status_code(response.status_code)?;
// Extract connector_metadata from response if present
- let connector_metadata = response.connector_metadata.clone().and_then(|secret| {
+ let connector_metadata = response.connector_feature_data.clone().and_then(|secret| {
let connector_metadata = secret.expose();
serde_json::from_str(&connector_metadata)
.map_err(|e| {
tracing::warn!(
serialization_error=?e,
- metadata=?response.connector_metadata,
+ metadata=?response.connector_feature_data,
"Failed to serialize connector_metadata from UCS repeat payment response"
);
e
@@ -2865,25 +2733,59 @@ impl
.ok()
});
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
))?),
};
+
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
- connector_transaction_id: resource_id.get_optional_response_id(),
- connector_response_reference_id,
- network_decline_code: response.network_decline_code.clone(),
- network_advice_code: response.network_advice_code.clone(),
- network_error_message: response.network_error_message.clone(),
+ connector_transaction_id: connector_transaction_id.get_optional_response_id(),
+ connector_response_reference_id: response.merchant_charge_id.clone(),
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -2891,20 +2793,12 @@ impl
Ok((
PaymentsResponseData::TransactionResponse {
- resource_id,
+ resource_id: connector_transaction_id,
redirection_data: Box::new(None),
- mandate_reference: Box::new(response.mandate_reference.map(|grpc_mandate| {
- hyperswitch_domain_models::router_response_types::MandateReference {
- connector_mandate_id: grpc_mandate.mandate_id,
- payment_method_id: grpc_mandate.payment_method_id,
- mandate_metadata: None,
- connector_mandate_request_reference_id: grpc_mandate
- .connector_mandate_request_reference_id,
- }
- })),
+ mandate_reference: Box::new(response.mandate_reference.map(hyperswitch_domain_models::router_response_types::MandateReference::foreign_try_from).transpose()?),
connector_metadata,
- network_txn_id: response.network_txn_id.clone(),
- connector_response_reference_id,
+ network_txn_id: response.network_transaction_id.clone(),
+ connector_response_reference_id: response.merchant_charge_id.clone(),
incremental_authorization_allowed: response.incremental_authorization_allowed,
authentication_data: None,
charges: None,
@@ -2917,35 +2811,65 @@ impl
}
}
-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCreateAccessTokenResponse>
- for Result<AccessToken, ErrorResponse>
+impl
+ transformers::ForeignTryFrom<
+ payments_grpc::MerchantAuthenticationServiceCreateAccessTokenResponse,
+ > for Result<AccessToken, ErrorResponse>
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
- response: payments_grpc::PaymentServiceCreateAccessTokenResponse,
+ response: payments_grpc::MerchantAuthenticationServiceCreateAccessTokenResponse,
) -> Result<Self, Self::Error> {
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
- router_env::logger::error!(
- error_message = ?response.error_message,
- error_code = ?response.error_code,
- status_code,
- "UCS create access token failed"
- );
+ let response = if let Some(error_info) = response.error.as_ref() {
+ router_env::logger::error!("UCS create access token failed");
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status: None,
connector_transaction_id: None,
- connector_response_reference_id: None,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ connector_response_reference_id: response.merchant_access_token_id.clone(),
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -3984,18 +3908,14 @@ impl transformers::ForeignTryFrom<AuthenticationData> for payments_grpc::Authent
Ok(Self {
eci: authentication_data.eci,
cavv: Some(authentication_data.cavv.expose()),
- threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(
- |id| Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(id)),
- },
- ),
+ threeds_server_transaction_id: authentication_data.threeds_server_transaction_id,
message_version: authentication_data
.message_version
.map(|message_version| message_version.to_string()),
ds_transaction_id: authentication_data.ds_trans_id,
trans_status: None,
acs_transaction_id: authentication_data.acs_trans_id,
- transaction_id: None,
+ connector_transaction_id: None,
ucaf_collection_indicator: None,
exemption_indicator: authentication_data
.exemption_indicator
@@ -4020,11 +3940,7 @@ impl transformers::ForeignTryFrom<router_request_types::UcsAuthenticationData>
Ok(Self {
eci: authentication_data.eci,
cavv: authentication_data.cavv.map(ExposeInterface::expose),
- threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(
- |id| Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(id)),
- },
- ),
+ threeds_server_transaction_id: authentication_data.threeds_server_transaction_id,
message_version: authentication_data
.message_version
.map(|message_version| message_version.to_string()),
@@ -4034,7 +3950,7 @@ impl transformers::ForeignTryFrom<router_request_types::UcsAuthenticationData>
.map(payments_grpc::TransactionStatus::foreign_from)
.map(i32::from),
acs_transaction_id: authentication_data.acs_trans_id,
- transaction_id: authentication_data.transaction_id,
+ connector_transaction_id: authentication_data.transaction_id,
ucaf_collection_indicator: authentication_data.ucaf_collection_indicator,
exemption_indicator: None,
network_params: None,
@@ -4055,46 +3971,22 @@ impl transformers::ForeignTryFrom<storage_enums::FutureUsage> for payments_grpc:
impl
transformers::ForeignTryFrom<(
- payments_grpc::PaymentServicePostAuthenticateResponse,
+ payments_grpc::PaymentMethodAuthenticationServicePostAuthenticateResponse,
AttemptStatus,
)> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
(response, prev_status): (
- payments_grpc::PaymentServicePostAuthenticateResponse,
+ payments_grpc::PaymentMethodAuthenticationServicePostAuthenticateResponse,
AttemptStatus,
),
) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
-
- let resource_id: router_request_types::ResponseId = match response
- .transaction_id
+ let connector_transaction_id = response
+ .connector_transaction_id
.as_ref()
- .and_then(|id| id.id_type.clone())
- {
- Some(payments_grpc::identifier::IdType::Id(id)) => {
- router_request_types::ResponseId::ConnectorTransactionId(id)
- }
- Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => {
- router_request_types::ResponseId::EncodedData(encoded_data)
- }
- Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => {
- router_request_types::ResponseId::NoResponseId
- }
- };
+ .map(|id| router_request_types::ResponseId::ConnectorTransactionId(id.clone()))
+ .unwrap_or(router_request_types::ResponseId::NoResponseId);
let (connector_metadata, redirection_data) = match response.redirection_data.clone() {
Some(redirection_data) => match redirection_data.form_type {
@@ -4134,9 +4026,9 @@ impl
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
@@ -4144,16 +4036,49 @@ impl
};
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
- connector_transaction_id: resource_id.get_optional_response_id(),
- connector_response_reference_id,
- network_decline_code: response.network_decline_code.clone(),
- network_advice_code: response.network_advice_code.clone(),
- network_error_message: response.network_error_message.clone(),
+ connector_transaction_id: connector_transaction_id.get_optional_response_id(),
+ connector_response_reference_id: response.merchant_order_id.clone(),
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -4161,12 +4086,12 @@ impl
Ok((
PaymentsResponseData::TransactionResponse {
- resource_id,
+ resource_id: connector_transaction_id,
redirection_data: Box::new(redirection_data),
mandate_reference: Box::new(None),
connector_metadata,
- network_txn_id: response.network_txn_id.clone(),
- connector_response_reference_id,
+ network_txn_id: response.network_transaction_id.clone(),
+ connector_response_reference_id: response.merchant_order_id.clone(),
incremental_authorization_allowed: None,
authentication_data,
charges: None,
@@ -4192,7 +4117,7 @@ impl transformers::ForeignTryFrom<payments_grpc::AuthenticationData>
ds_transaction_id,
trans_status,
acs_transaction_id,
- transaction_id,
+ connector_transaction_id,
ucaf_collection_indicator,
exemption_indicator: _,
network_params: _,
@@ -4202,20 +4127,13 @@ impl transformers::ForeignTryFrom<payments_grpc::AuthenticationData>
.transpose()
.change_context(UnifiedConnectorServiceError::ResponseDeserializationFailed)
.attach_printable("Failed to convert TransactionStatus from grpc to domain")?
- .map(ForeignFrom::foreign_from);
+ .map(common_enums::TransactionStatus::foreign_try_from)
+ .transpose()?;
Ok(Self {
trans_status,
eci,
cavv: cavv.map(Secret::new),
- threeds_server_transaction_id: threeds_server_transaction_id
- .and_then(|id| id.id_type)
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- }),
+ threeds_server_transaction_id: threeds_server_transaction_id.clone(),
message_version: message_version
.map(|message_version_str| {
types::SemanticVersion::from_str(message_version_str.as_ref())
@@ -4225,27 +4143,33 @@ impl transformers::ForeignTryFrom<payments_grpc::AuthenticationData>
.transpose()?,
ds_trans_id: ds_transaction_id,
acs_trans_id: acs_transaction_id,
- transaction_id,
+ transaction_id: connector_transaction_id,
ucaf_collection_indicator,
})
}
}
-impl ForeignFrom<payments_grpc::TransactionStatus> for common_enums::TransactionStatus {
- fn foreign_from(value: payments_grpc::TransactionStatus) -> Self {
+impl transformers::ForeignTryFrom<payments_grpc::TransactionStatus>
+ for common_enums::TransactionStatus
+{
+ type Error = error_stack::Report<UnifiedConnectorServiceError>;
+ fn foreign_try_from(value: payments_grpc::TransactionStatus) -> Result<Self, Self::Error> {
match value {
- payments_grpc::TransactionStatus::Success => Self::Success,
- payments_grpc::TransactionStatus::Failure => Self::Failure,
+ payments_grpc::TransactionStatus::Success => Ok(Self::Success),
+ payments_grpc::TransactionStatus::Failure => Ok(Self::Failure),
payments_grpc::TransactionStatus::VerificationNotPerformed => {
- Self::VerificationNotPerformed
+ Ok(Self::VerificationNotPerformed)
}
- payments_grpc::TransactionStatus::NotVerified => Self::NotVerified,
- payments_grpc::TransactionStatus::Rejected => Self::Rejected,
- payments_grpc::TransactionStatus::ChallengeRequired => Self::ChallengeRequired,
+ payments_grpc::TransactionStatus::NotVerified => Ok(Self::NotVerified),
+ payments_grpc::TransactionStatus::Rejected => Ok(Self::Rejected),
+ payments_grpc::TransactionStatus::ChallengeRequired => Ok(Self::ChallengeRequired),
payments_grpc::TransactionStatus::ChallengeRequiredDecoupledAuthentication => {
- Self::ChallengeRequiredDecoupledAuthentication
+ Ok(Self::ChallengeRequiredDecoupledAuthentication)
+ }
+ payments_grpc::TransactionStatus::InformationOnly => Ok(Self::InformationOnly),
+ payments_grpc::TransactionStatus::Unspecified => {
+ Err(UnifiedConnectorServiceError::ResponseDeserializationFailed.into())
}
- payments_grpc::TransactionStatus::InformationOnly => Self::InformationOnly,
}
}
}
@@ -4474,9 +4398,9 @@ impl
) -> Result<Self, Self::Error> {
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
@@ -4484,31 +4408,61 @@ impl
};
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
connector_transaction_id: None,
connector_response_reference_id: None,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
let order_id = response
- .order_id
+ .connector_order_id
.clone()
- .and_then(|id| id.id_type)
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
+ .ok_or(UnifiedConnectorServiceError::MissingRequiredField {
+ field_name: "connector_order_id",
})
- .ok_or(UnifiedConnectorServiceError::ResponseDeserializationFailed)?;
+ .attach_printable(
+ "Missing connector_order_id in PaymentServiceCreateOrderResponse response",
+ )?;
let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;
@@ -4532,28 +4486,61 @@ impl
}
}
-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCreatePaymentMethodTokenResponse>
+impl transformers::ForeignTryFrom<payments_grpc::PaymentMethodServiceTokenizeResponse>
for Result<PaymentsResponseData, ErrorResponse>
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
- response: payments_grpc::PaymentServiceCreatePaymentMethodTokenResponse,
+ response: payments_grpc::PaymentMethodServiceTokenizeResponse,
) -> Result<Self, Self::Error> {
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status: None,
connector_transaction_id: None,
connector_response_reference_id: None,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -4576,26 +4563,69 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceIncrementalAuthor
) -> Result<Self, Self::Error> {
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: response.error_reason,
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status: None,
- connector_transaction_id: None,
+ connector_transaction_id: response.connector_authorization_id.clone(),
connector_response_reference_id: None,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
Ok(PaymentsResponseData::IncrementalAuthorizationResponse {
status: AuthorizationStatus::foreign_from(response.status()),
connector_authorization_id: response.connector_authorization_id,
- error_code: response.error_code,
- error_message: response.error_message,
+ error_code: response.error.as_ref().and_then(|error_info| {
+ error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ }),
+ error_message: response.error.as_ref().and_then(|error_info| {
+ error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ }),
})
};
@@ -4603,28 +4633,63 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceIncrementalAuthor
}
}
-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceSdkSessionTokenResponse>
- for Result<PaymentsResponseData, ErrorResponse>
+impl
+ transformers::ForeignTryFrom<
+ payments_grpc::MerchantAuthenticationServiceCreateSdkSessionTokenResponse,
+ > for Result<PaymentsResponseData, ErrorResponse>
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
- response: payments_grpc::PaymentServiceSdkSessionTokenResponse,
+ response: payments_grpc::MerchantAuthenticationServiceCreateSdkSessionTokenResponse,
) -> Result<Self, Self::Error> {
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: response.error_reason,
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status: None,
connector_transaction_id: None,
connector_response_reference_id: None,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -4649,8 +4714,9 @@ impl transformers::ForeignTryFrom<payments_grpc::SdkNextAction> for SdkNextActio
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(value: payments_grpc::SdkNextAction) -> Result<Self, Self::Error> {
let next_action = match value {
- payments_grpc::SdkNextAction::Confirm
- | payments_grpc::SdkNextAction::NextActionUnspecified => NextActionCall::Confirm,
+ payments_grpc::SdkNextAction::Confirm | payments_grpc::SdkNextAction::Unspecified => {
+ NextActionCall::Confirm
+ }
payments_grpc::SdkNextAction::PostSessionTokens => NextActionCall::PostSessionTokens,
};
@@ -4672,7 +4738,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaypalTransactionInfo> for Payp
let total_price = required_amount_type
.convert(minor_total_price, currency_code)
- .change_context(UnifiedConnectorServiceError::SdkSessionTokenFailure)?;
+ .change_context(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)?;
Ok(Self {
total_price,
@@ -4690,7 +4756,7 @@ impl transformers::ForeignTryFrom<payments_grpc::SessionToken> for SessionToken
Some(session_token::WalletName::GooglePay(gpay_session_token_response)) => {
let gpay_session = gpay_session_token_response
.google_pay_session
- .ok_or(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .ok_or(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable(
"Missing Google Pay Session Token Response in UCS SdkSessionToken Response",
)?;
@@ -4741,7 +4807,7 @@ impl transformers::ForeignTryFrom<payments_grpc::SessionToken> for SessionToken
Ok(Self::Paypal(Box::new(paypal_session_token_response)))
}
- _ => Err(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ _ => Err(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Missing session_token in UCS Sdk Session Token Response")?,
}
}
@@ -4759,7 +4825,7 @@ impl transformers::ForeignTryFrom<payments_grpc::ApplePayAddressParameters>
payments_grpc::ApplePayAddressParameters::Phone => Ok(Self::Phone),
payments_grpc::ApplePayAddressParameters::Email => Ok(Self::Email),
payments_grpc::ApplePayAddressParameters::Unspecified => {
- Err(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ Err(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Unspecified ApplePayAddressParameters")?
}
}
@@ -4778,7 +4844,7 @@ impl transformers::ForeignTryFrom<(&payments_grpc::AmountInfo, common_enums::Cur
let amount = required_amount_type
.convert(minor_amount, currency_code)
- .change_context(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .change_context(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Response amount conversion failed")?;
Ok(Self {
@@ -4877,7 +4943,7 @@ impl transformers::ForeignTryFrom<payments_grpc::GooglePaySessionResponse>
.clone()
.map(GpayMerchantInfo::foreign_try_from)
.transpose()?
- .ok_or(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .ok_or(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Missing merchant_info in GooglePaySessionResponse")?,
shipping_address_required: value.shipping_address_required,
email_required: value.email_required,
@@ -4885,7 +4951,7 @@ impl transformers::ForeignTryFrom<payments_grpc::GooglePaySessionResponse>
.shipping_address_parameters
.map(GpayShippingAddressParameters::foreign_try_from)
.transpose()?
- .ok_or(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .ok_or(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable(
"Missing shipping_address_parameters in GooglePaySessionResponse",
)?,
@@ -4900,7 +4966,7 @@ impl transformers::ForeignTryFrom<payments_grpc::GooglePaySessionResponse>
.clone()
.map(GpayTransactionInfo::foreign_try_from)
.transpose()?
- .ok_or(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .ok_or(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Missing transaction_info in GooglePaySessionResponse")?,
delayed_session_token: value.delayed_session_token,
connector: value.connector.clone(),
@@ -4925,7 +4991,7 @@ impl transformers::ForeignTryFrom<&payments_grpc::SecretInfoToInitiateSdk>
.display
.clone()
.map(|display| display.expose().into())
- .ok_or(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .ok_or(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Missing display in SecretInfoToInitiateSdk")?;
let payment = value.payment.clone().map(|payment| payment.expose().into());
@@ -4941,10 +5007,10 @@ impl transformers::ForeignTryFrom<payments_grpc::GpayBillingAddressFormat>
value: payments_grpc::GpayBillingAddressFormat,
) -> Result<Self, Self::Error> {
match value {
- payments_grpc::GpayBillingAddressFormat::Min => Ok(Self::MIN),
- payments_grpc::GpayBillingAddressFormat::Full => Ok(Self::FULL),
+ payments_grpc::GpayBillingAddressFormat::BillingAddressFormatMin => Ok(Self::MIN),
+ payments_grpc::GpayBillingAddressFormat::BillingAddressFormatFull => Ok(Self::FULL),
payments_grpc::GpayBillingAddressFormat::BillingAddressFormatUnspecified => {
- Err(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ Err(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Unspecified GpayBillingAddressFormat")?
}
}
@@ -4987,13 +5053,13 @@ impl transformers::ForeignTryFrom<payments_grpc::GpayAllowedPaymentMethods>
.parameters
.map(GpayAllowedMethodsParameters::foreign_try_from)
.transpose()?
- .ok_or(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .ok_or(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Missing GpayAllowedPaymentMethods parameters")?,
tokenization_specification: value
.tokenization_specification
.map(GpayTokenizationSpecification::foreign_try_from)
.transpose()?
- .ok_or(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .ok_or(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Missing GpayAllowedPaymentMethods tokenization_specification")?,
})
}
@@ -5009,12 +5075,12 @@ impl transformers::ForeignTryFrom<payments_grpc::GpayAllowedMethodsParameters>
Ok(Self {
allowed_auth_methods: value.allowed_auth_methods,
allowed_card_networks: value.allowed_card_networks,
- billing_address_required: value.billing_address_required,
+ billing_address_required: value.billing_address,
billing_address_parameters: value
.billing_address_parameters
.map(GpayBillingAddressParameters::foreign_try_from)
.transpose()?,
- assurance_details_required: value.assurance_details_required,
+ assurance_details_required: value.assurance_details,
})
}
}
@@ -5028,7 +5094,7 @@ impl transformers::ForeignTryFrom<payments_grpc::GpayBillingAddressParameters>
) -> Result<Self, Self::Error> {
let format = GpayBillingAddressFormat::foreign_try_from(value.format())?;
Ok(Self {
- phone_number_required: value.phone_number_required,
+ phone_number_required: value.phone_number,
format,
})
}
@@ -5047,7 +5113,7 @@ impl transformers::ForeignTryFrom<payments_grpc::GpayTokenizationSpecification>
.parameters
.map(GpayTokenParameters::foreign_try_from)
.transpose()?
- .ok_or(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .ok_or(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Missing GpayTokenizationSpecification parameters")?,
})
}
@@ -5077,7 +5143,7 @@ impl transformers::ForeignTryFrom<payments_grpc::GpayTransactionInfo> for GpayTr
let total_price = required_amount_type
.convert(minor_total_price, currency_code)
- .change_context(UnifiedConnectorServiceError::SdkSessionTokenFailure)
+ .change_context(UnifiedConnectorServiceError::CreateSdkSessionTokenFailure)
.attach_printable("Response amount conversion failed")?;
Ok(Self {
@@ -5091,30 +5157,17 @@ impl transformers::ForeignTryFrom<payments_grpc::GpayTransactionInfo> for GpayTr
impl
transformers::ForeignTryFrom<(
- payments_grpc::PaymentServiceAuthenticateResponse,
+ payments_grpc::PaymentMethodAuthenticationServiceAuthenticateResponse,
AttemptStatus,
)> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
(response, prev_status): (
- payments_grpc::PaymentServiceAuthenticateResponse,
+ payments_grpc::PaymentMethodAuthenticationServiceAuthenticateResponse,
AttemptStatus,
),
) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
let authentication_data = response
.authentication_data
.clone()
@@ -5122,21 +5175,11 @@ impl
.transpose()?
.map(Box::new);
- let resource_id: router_request_types::ResponseId = match response
- .transaction_id
+ let connector_transaction_id = response
+ .connector_transaction_id
.as_ref()
- .and_then(|id| id.id_type.clone())
- {
- Some(payments_grpc::identifier::IdType::Id(id)) => {
- router_request_types::ResponseId::ConnectorTransactionId(id)
- }
- Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => {
- router_request_types::ResponseId::EncodedData(encoded_data)
- }
- Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => {
- router_request_types::ResponseId::NoResponseId
- }
- };
+ .map(|id| router_request_types::ResponseId::ConnectorTransactionId(id.clone()))
+ .unwrap_or(router_request_types::ResponseId::NoResponseId);
let (connector_metadata, redirection_data) = match response.redirection_data.clone() {
Some(redirection_data) => match redirection_data.form_type {
@@ -5169,9 +5212,9 @@ impl
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
@@ -5179,16 +5222,49 @@ impl
};
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
- connector_transaction_id: resource_id.get_optional_response_id(),
- connector_response_reference_id,
- network_decline_code: response.network_decline_code.clone(),
- network_advice_code: response.network_advice_code.clone(),
- network_error_message: response.network_error_message.clone(),
+ connector_transaction_id: connector_transaction_id.get_optional_response_id(),
+ connector_response_reference_id: response.merchant_order_id.clone(),
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -5196,12 +5272,12 @@ impl
Ok((
PaymentsResponseData::TransactionResponse {
- resource_id,
+ resource_id: connector_transaction_id,
redirection_data: Box::new(redirection_data),
mandate_reference: Box::new(None),
connector_metadata,
- network_txn_id: response.network_txn_id.clone(),
- connector_response_reference_id,
+ network_txn_id: response.network_transaction_id.clone(),
+ connector_response_reference_id: response.merchant_order_id.clone(),
incremental_authorization_allowed: None,
authentication_data,
charges: None,
@@ -5267,6 +5343,8 @@ impl transformers::ForeignTryFrom<&MandateData> for payments_grpc::SetupMandateD
mandate_type: Some(payments_grpc::mandate_type::MandateType::SingleUse(
payments_grpc::MandateAmountData {
amount: amount_data.amount.get_amount_as_i64(),
+ amount_type: None,
+ frequency: None,
currency: payments_grpc::Currency::foreign_try_from(
amount_data.currency,
)
@@ -5286,6 +5364,8 @@ impl transformers::ForeignTryFrom<&MandateData> for payments_grpc::SetupMandateD
payments_grpc::mandate_type::MandateType::MultiUse(
payments_grpc::MandateAmountData {
amount: amount_data.amount.get_amount_as_i64(),
+ amount_type: None,
+ frequency: None,
currency: payments_grpc::Currency::foreign_try_from(
amount_data.currency,
)
@@ -5393,28 +5473,63 @@ impl transformers::ForeignTryFrom<&common_enums::PaymentChannel> for payments_gr
}
}
-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCreateSessionTokenResponse>
- for Result<PaymentsResponseData, ErrorResponse>
+impl
+ transformers::ForeignTryFrom<
+ payments_grpc::MerchantAuthenticationServiceCreateSessionTokenResponse,
+ > for Result<PaymentsResponseData, ErrorResponse>
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(
- response: payments_grpc::PaymentServiceCreateSessionTokenResponse,
+ response: payments_grpc::MerchantAuthenticationServiceCreateSessionTokenResponse,
) -> Result<Self, Self::Error> {
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status: None,
connector_transaction_id: None,
connector_response_reference_id: None,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -5458,14 +5573,14 @@ impl
/// Transform UCS webhook response into webhook event data
pub fn transform_ucs_webhook_response(
- response: PaymentServiceTransformResponse,
+ response: EventServiceHandleResponse,
) -> Result<WebhookTransformData, error_stack::Report<errors::ApiErrorResponse>> {
let event_type =
api_models::webhooks::IncomingWebhookEvent::from_ucs_event_type(response.event_type);
let webhook_transformation_status = if matches!(
- response.transformation_status(),
- payments_grpc::WebhookTransformationStatus::Incomplete
+ response.event_status(),
+ payments_grpc::EventStatus::Incomplete
) {
WebhookTransformationStatus::Incomplete
} else {
@@ -5475,14 +5590,8 @@ pub fn transform_ucs_webhook_response(
Ok(WebhookTransformData {
event_type,
source_verified: response.source_verified,
- webhook_content: response.content,
- response_ref_id: response.response_ref_id.and_then(|identifier| {
- identifier.id_type.and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => Some(encoded_data),
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- }),
+ webhook_content: response.event_content,
+ response_ref_id: response.merchant_event_id,
webhook_transformation_status,
})
}
@@ -5494,7 +5603,7 @@ pub fn build_webhook_transform_request(
webhook_secrets: Option<payments_grpc::WebhookSecrets>,
merchant_id: &str,
connector_id: &str,
-) -> Result<PaymentServiceTransformRequest, error_stack::Report<errors::ApiErrorResponse>> {
+) -> Result<EventServiceHandleRequest, error_stack::Report<errors::ApiErrorResponse>> {
let request_details_grpc =
<payments_grpc::RequestDetails as transformers::ForeignTryFrom<_>>::foreign_try_from(
request_details,
@@ -5502,15 +5611,13 @@ pub fn build_webhook_transform_request(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to transform webhook request details to gRPC format")?;
- Ok(PaymentServiceTransformRequest {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(format!(
- "{}_{}_{}",
- merchant_id,
- connector_id,
- OffsetDateTime::now_utc().unix_timestamp()
- ))),
- }),
+ Ok(EventServiceHandleRequest {
+ merchant_event_id: Some(format!(
+ "{}_{}_{}",
+ merchant_id,
+ connector_id,
+ OffsetDateTime::now_utc().unix_timestamp()
+ )),
request_details: Some(request_details_grpc),
webhook_secrets,
state: None,
@@ -5532,18 +5639,6 @@ impl transformers::ForeignTryFrom<&RouterData<Execute, RefundsData, RefundsRespo
) -> Result<Self, Self::Error> {
let currency = payments_grpc::Currency::foreign_try_from(router_data.request.currency)?;
- let transaction_id = Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.request.connector_transaction_id.clone(),
- )),
- };
-
- let request_ref_id = Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- });
-
// Convert connector_metadata to gRPC format
let connector_metadata = router_data
.request
@@ -5569,14 +5664,6 @@ impl transformers::ForeignTryFrom<&RouterData<Execute, RefundsData, RefundsRespo
.as_ref()
.map(ConnectorState::foreign_from);
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
-
let payment_method_type = router_data
.payment_method_type
.map(payments_grpc::PaymentMethodType::foreign_try_from)
@@ -5584,14 +5671,13 @@ impl transformers::ForeignTryFrom<&RouterData<Execute, RefundsData, RefundsRespo
.map(|payment_method_type| payment_method_type.into());
Ok(Self {
- request_ref_id,
- refund_id: router_data.request.refund_id.clone(),
- transaction_id: Some(transaction_id),
+ merchant_refund_id: Some(router_data.request.refund_id.clone()),
+ connector_transaction_id: router_data.request.connector_transaction_id.clone(),
payment_amount: router_data.request.payment_amount,
- currency: currency.into(),
- minor_payment_amount: router_data.request.minor_payment_amount.get_amount_as_i64(),
- refund_amount: router_data.request.refund_amount,
- minor_refund_amount: router_data.request.minor_refund_amount.get_amount_as_i64(),
+ refund_amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.minor_refund_amount.get_amount_as_i64(),
+ currency: currency.into(),
+ }),
reason: router_data.request.reason.clone(),
webhook_url: router_data.request.webhook_url.clone(),
merchant_account_id: router_data
@@ -5610,7 +5696,7 @@ impl transformers::ForeignTryFrom<&RouterData<Execute, RefundsData, RefundsRespo
)
})?
.map(i32::from),
- connector_metadata,
+ connector_feature_data: connector_metadata,
refund_metadata,
browser_info: router_data
.request
@@ -5624,7 +5710,6 @@ impl transformers::ForeignTryFrom<&RouterData<Execute, RefundsData, RefundsRespo
)
})?,
state,
- merchant_account_metadata,
metadata: None,
test_mode: router_data.test_mode,
payment_method_type,
@@ -5645,31 +5730,11 @@ impl transformers::ForeignTryFrom<&RouterData<RSync, RefundsData, RefundsRespons
fn foreign_try_from(
router_data: &RouterData<RSync, RefundsData, RefundsResponseData>,
) -> Result<Self, Self::Error> {
- let transaction_id = Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.request.connector_transaction_id.clone(),
- )),
- };
-
- let request_ref_id = Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- });
-
let state = router_data
.access_token
.as_ref()
.map(ConnectorState::foreign_from);
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
-
let payment_method_type = router_data
.payment_method_type
.map(payments_grpc::PaymentMethodType::foreign_try_from)
@@ -5677,8 +5742,8 @@ impl transformers::ForeignTryFrom<&RouterData<RSync, RefundsData, RefundsRespons
.map(|payment_method_type| payment_method_type.into());
Ok(Self {
- request_ref_id,
- transaction_id: Some(transaction_id),
+ merchant_refund_id: Some(router_data.connector_request_reference_id.clone()),
+ connector_transaction_id: router_data.request.connector_transaction_id.clone(),
refund_id: router_data.request.connector_refund_id.clone().ok_or(
UnifiedConnectorServiceError::RequestEncodingFailedWithReason(
"Missing connector_refund_id for refund sync operation".to_string(),
@@ -5697,7 +5762,6 @@ impl transformers::ForeignTryFrom<&RouterData<RSync, RefundsData, RefundsRespons
)
})?,
state,
- merchant_account_metadata,
refund_metadata: router_data
.request
.refund_connector_metadata
@@ -5708,6 +5772,7 @@ impl transformers::ForeignTryFrom<&RouterData<RSync, RefundsData, RefundsRespons
.map(|s| s.into()),
test_mode: router_data.test_mode,
payment_method_type,
+ connector_feature_data: None,
})
}
}
@@ -5719,41 +5784,60 @@ impl transformers::ForeignTryFrom<payments_grpc::RefundResponse>
type Error = error_stack::Report<UnifiedConnectorServiceError>;
fn foreign_try_from(response: payments_grpc::RefundResponse) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
-
let status_code = convert_connector_service_status_code(response.status_code)?;
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status: None,
connector_transaction_id: None,
- connector_response_reference_id,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ connector_response_reference_id: None,
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
let refund_status = RefundStatus::foreign_try_from(response.status())?;
Ok(RefundsResponseData {
- connector_refund_id: response.refund_id,
+ connector_refund_id: response.connector_refund_id,
refund_status,
})
};
@@ -5777,44 +5861,24 @@ impl transformers::ForeignTryFrom<&RouterData<api::Void, PaymentsCancelData, Pay
.map(payments_grpc::BrowserInformation::foreign_try_from)
.transpose()?;
- let currency = router_data
- .request
- .currency
- .map(payments_grpc::Currency::foreign_try_from)
- .transpose()?;
+ let currency = payments_grpc::Currency::foreign_try_from(
+ router_data.request.currency.unwrap_or_default(),
+ )?;
let state = router_data
.access_token
.as_ref()
.map(ConnectorState::foreign_from);
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
-
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.connector_request_reference_id.clone(),
- )),
- }),
- transaction_id: if router_data.request.connector_transaction_id.is_empty() {
- None
- } else {
- Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(
- router_data.request.connector_transaction_id.clone(),
- )),
- })
- },
+ merchant_void_id: Some(router_data.connector_request_reference_id.clone()),
+ connector_transaction_id: router_data.request.connector_transaction_id.clone(),
cancellation_reason: router_data.request.cancellation_reason.clone(),
all_keys_required: None,
browser_info,
- amount: router_data.request.amount,
- currency: currency.map(|c| c.into()),
+ amount: Some(payments_grpc::Money {
+ minor_amount: router_data.request.amount.unwrap_or_default(),
+ currency: currency.into(),
+ }),
metadata: router_data
.request
.metadata
@@ -5824,7 +5888,7 @@ impl transformers::ForeignTryFrom<&RouterData<api::Void, PaymentsCancelData, Pay
.change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
.map(|s| s.into()),
state,
- connector_metadata: router_data
+ connector_feature_data: router_data
.request
.connector_meta
.as_ref()
@@ -5832,9 +5896,8 @@ impl transformers::ForeignTryFrom<&RouterData<api::Void, PaymentsCancelData, Pay
.transpose()
.change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
.map(|s| s.into()),
- merchant_account_metadata,
test_mode: router_data.test_mode,
- merchant_order_reference_id: router_data.request.merchant_order_reference_id.clone(),
+ merchant_order_id: router_data.request.merchant_order_reference_id.clone(),
})
}
}
@@ -5862,46 +5925,20 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceVoidResponse, At
fn foreign_try_from(
(response, prev_status): (payments_grpc::PaymentServiceVoidResponse, AttemptStatus),
) -> Result<Self, Self::Error> {
- let connector_response_reference_id =
- response.response_ref_id.as_ref().and_then(|identifier| {
- identifier
- .id_type
- .clone()
- .and_then(|id_type| match id_type {
- payments_grpc::identifier::IdType::Id(id) => Some(id),
- payments_grpc::identifier::IdType::EncodedData(encoded_data) => {
- Some(encoded_data)
- }
- payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,
- })
- });
-
- let resource_id: router_request_types::ResponseId = match response
- .transaction_id
- .as_ref()
- .and_then(|id| id.id_type.clone())
- {
- Some(payments_grpc::identifier::IdType::Id(id)) => {
- router_request_types::ResponseId::ConnectorTransactionId(id)
- }
- Some(payments_grpc::identifier::IdType::EncodedData(encoded_data)) => {
- router_request_types::ResponseId::EncodedData(encoded_data)
- }
- Some(payments_grpc::identifier::IdType::NoResponseIdMarker(_)) | None => {
- router_request_types::ResponseId::NoResponseId
- }
- };
+ let connector_transaction_id = router_request_types::ResponseId::ConnectorTransactionId(
+ response.connector_transaction_id.clone(),
+ );
let status_code = convert_connector_service_status_code(response.status_code)?;
// Extract connector_metadata from response if present
- let connector_metadata = response.connector_metadata.clone().and_then(|secret| {
+ let connector_metadata = response.connector_feature_data.clone().and_then(|secret| {
let connector_metadata = secret.expose();
serde_json::from_str(&connector_metadata)
.map_err(|e| {
tracing::warn!(
serialization_error=?e,
- metadata=?response.connector_metadata,
+ metadata=?response.connector_feature_data,
"Failed to serialize connector_metadata from UCS void response"
);
e
@@ -5909,9 +5946,9 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceVoidResponse, At
.ok()
});
- let response = if response.error_code.is_some() {
+ let response = if let Some(error_info) = response.error.as_ref() {
let attempt_status = match response.status() {
- payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,
+ payments_grpc::PaymentStatus::Unspecified => None,
_ => Some(AttemptStatus::foreign_try_from((
response.status(),
prev_status,
@@ -5919,16 +5956,49 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceVoidResponse, At
};
Err(ErrorResponse {
- code: response.error_code().to_owned(),
- message: response.error_message().to_owned(),
- reason: Some(response.error_reason().to_owned()),
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
status_code,
attempt_status,
- connector_transaction_id: resource_id.get_optional_response_id(),
- connector_response_reference_id,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ connector_transaction_id: connector_transaction_id.get_optional_response_id(),
+ connector_response_reference_id: response.merchant_void_id.clone(),
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
connector_metadata: None,
})
} else {
@@ -5936,20 +6006,12 @@ impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceVoidResponse, At
Ok((
PaymentsResponseData::TransactionResponse {
- resource_id,
+ resource_id: connector_transaction_id,
redirection_data: Box::new(None),
- mandate_reference: Box::new(response.mandate_reference.map(|grpc_mandate| {
- hyperswitch_domain_models::router_response_types::MandateReference {
- connector_mandate_id: grpc_mandate.mandate_id,
- payment_method_id: grpc_mandate.payment_method_id,
- mandate_metadata: None,
- connector_mandate_request_reference_id: grpc_mandate
- .connector_mandate_request_reference_id,
- }
- })),
+ mandate_reference: Box::new(response.mandate_reference.map(hyperswitch_domain_models::router_response_types::MandateReference::foreign_try_from).transpose()?),
connector_metadata,
network_txn_id: None,
- connector_response_reference_id,
+ connector_response_reference_id: response.merchant_void_id.clone(),
incremental_authorization_allowed: response.incremental_authorization_allowed,
authentication_data: None,
charges: None,
@@ -5970,7 +6032,7 @@ impl
AccessToken,
>,
common_enums::CallConnectorAction,
- )> for payments_grpc::PaymentServiceCreateAccessTokenRequest
+ )> for payments_grpc::MerchantAuthenticationServiceCreateAccessTokenRequest
{
type Error = error_stack::Report<UnifiedConnectorServiceError>;
@@ -5984,25 +6046,12 @@ impl
common_enums::CallConnectorAction,
),
) -> Result<Self, Self::Error> {
- let request_ref_id = router_data.connector_request_reference_id.clone();
-
- let merchant_account_metadata = router_data
- .connector_meta_data
- .as_ref()
- .map(serde_json::to_string)
- .transpose()
- .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
- .map(|s| s.into());
-
Ok(Self {
- request_ref_id: Some(Identifier {
- id_type: Some(payments_grpc::identifier::IdType::Id(request_ref_id)),
- }),
- merchant_account_metadata,
+ merchant_access_token_id: Some(router_data.connector_request_reference_id.clone()),
// depricated field we have to remove this/ Default to unspecified connector
connector: 0_i32,
metadata: None,
- connector_metadata: None,
+ connector_feature_data: None,
test_mode: router_data.test_mode,
})
}
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index e0351bb750..3e5275d5ce 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -787,10 +787,10 @@ async fn process_non_ucs_webhook<'a>(
/// Extract resource object from UCS WebhookResponseContent
fn get_ucs_webhook_resource_object(
- webhook_response_content: &payments_grpc::WebhookResponseContent,
+ event_content: &payments_grpc::EventContent,
) -> errors::RouterResult<Box<dyn hyperswitch_masking::ErasedMaskSerialize>> {
- let resource_object = match &webhook_response_content.content {
- Some(payments_grpc::webhook_response_content::Content::IncompleteTransformation(
+ let resource_object = match &event_content.content {
+ Some(payments_grpc::event_content::Content::IncompleteTransformation(
incomplete_transformation_response,
)) => {
// Deserialize resource object
@@ -802,7 +802,7 @@ fn get_ucs_webhook_resource_object(
}
_ => {
// Convert UCS webhook content to appropriate format
- serde_json::to_value(webhook_response_content)
+ serde_json::to_value(event_content)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to serialize UCS webhook content")?
}
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index a1d3ba0b09..8b5378f0a2 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -727,7 +727,7 @@ pub struct PspTokenResult {
}
/// Data extracted from UCS response
-pub struct UcsAuthorizeResponseData {
+pub struct UcsPaymentAuthorizeResponseData {
pub router_data_response:
Result<(PaymentsResponseData, common_enums::AttemptStatus), ErrorResponse>,
pub status_code: u16,
@@ -735,7 +735,7 @@ pub struct UcsAuthorizeResponseData {
pub connector_response: Option<ConnectorResponseData>,
}
-pub struct UcsRepeatPaymentResponseData {
+pub struct UcsRecurringPaymentChargeResponseData {
pub router_data_response:
Result<(PaymentsResponseData, common_enums::AttemptStatus), ErrorResponse>,
pub status_code: u16,
@@ -743,7 +743,7 @@ pub struct UcsRepeatPaymentResponseData {
pub connector_response: Option<ConnectorResponseData>,
}
-pub struct UcsSetupMandateResponseData {
+pub struct UcsPaymentSetupRecurringResponseData {
pub router_data_response:
Result<(PaymentsResponseData, common_enums::AttemptStatus), ErrorResponse>,
pub status_code: u16,