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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
refactor(connector): [trustpay] refactor trustpay and handled variants errors (#2484)
Sunil3f1e7c2152a8
diff --git a/Cargo.lock b/Cargo.lockindex cca3b6f58d..9e026101d1 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -393,6 +393,7 @@ dependencies = ["serde","serde_json","strum 0.24.1",+ "thiserror","time 0.3.22","url","utoipa",@@ -471,18 +472,6 @@ dependencies = ["serde_json",]-[[package]]-name = "async-bb8-diesel"-version = "0.1.0"-source = "git+https://github.com/juspay/async-bb8-diesel?rev=9a71d142726dbc33f41c1fd935ddaa79841c7be5#9a71d142726dbc33f41c1fd935ddaa79841c7be5"-dependencies = [- "async-trait",- "bb8",- "diesel",- "thiserror",- "tokio",-]-[[package]]name = "async-bb8-diesel"version = "0.1.0"@@ -735,39 +724,6 @@ dependencies = ["tracing",]-[[package]]-name = "aws-sdk-s3"-version = "0.25.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "392b9811ca489747ac84349790e49deaa1f16631949e7dd4156000251c260eae"-dependencies = [- "aws-credential-types",- "aws-endpoint",- "aws-http",- "aws-sig-auth",- "aws-sigv4",- "aws-smithy-async",- "aws-smithy-checksums",- "aws-smithy-client",- "aws-smithy-eventstream",- "aws-smithy-http",- "aws-smithy-http-tower",- "aws-smithy-json",- "aws-smithy-types",- "aws-smithy-xml",- "aws-types",- "bytes",- "http",- "http-body",- "once_cell",- "percent-encoding",- "regex",- "tokio-stream",- "tower",- "tracing",- "url",-]-[[package]]name = "aws-sdk-s3"version = "0.28.0"@@ -1204,7 +1160,16 @@ dependencies = ["cc","cfg-if","constant_time_eq",- "digest",+ "digest 0.10.7",+]++[[package]]+name = "block-buffer"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"+dependencies = [+ "generic-array",][[package]]@@ -1853,9 +1818,9 @@ dependencies = [name = "diesel_models"version = "0.1.0"dependencies = [- "async-bb8-diesel 0.1.0 (git+https://github.com/oxidecomputer/async-bb8-diesel?rev=be3d9bce50051d8c0e0c06078e8066cc27db3001)",+ "async-bb8-diesel","aws-config",- "aws-sdk-s3 0.28.0",+ "aws-sdk-s3","common_enums","common_utils","diesel",@@ -1882,13 +1847,22 @@ dependencies = ["syn 2.0.29",]+[[package]]+name = "digest"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"+dependencies = [+ "generic-array",+]+[[package]]name = "digest"version = "0.10.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"dependencies = [- "block-buffer",+ "block-buffer 0.10.4","crypto-common","subtle",]@@ -1940,7 +1914,7 @@ checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"name = "drainer"version = "0.1.0"dependencies = [- "async-bb8-diesel 0.1.0 (git+https://github.com/oxidecomputer/async-bb8-diesel?rev=be3d9bce50051d8c0e0c06078e8066cc27db3001)",+ "async-bb8-diesel","bb8","clap","common_utils",@@ -1988,20 +1962,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"dependencies = ["atty",- "humantime 1.3.0",- "log",- "regex",- "termcolor",-]--[[package]]-name = "env_logger"-version = "0.10.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"-dependencies = [- "humantime 2.1.0",- "is-terminal",+ "humantime","log","regex","termcolor",@@ -2192,7 +2153,7 @@ dependencies = ["rand 0.8.5","redis-protocol","semver",- "sha-1",+ "sha-1 0.10.1","tokio","tokio-stream","tokio-util",@@ -2522,7 +2483,7 @@ version = "0.12.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"dependencies = [- "digest",+ "digest 0.10.7",][[package]]@@ -2589,12 +2550,6 @@ dependencies = ["quick-error",]-[[package]]-name = "humantime"-version = "2.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"-[[package]]name = "hyper"version = "0.14.27"@@ -2779,18 +2734,6 @@ version = "2.7.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f"-[[package]]-name = "is-terminal"-version = "0.4.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"-dependencies = [- "hermit-abi 0.3.1",- "io-lifetimes",- "rustix",- "windows-sys 0.48.0",-]-[[package]]name = "itertools"version = "0.10.5"@@ -3070,7 +3013,7 @@ version = "0.10.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca"dependencies = [- "digest",+ "digest 0.10.7",][[package]]@@ -3321,6 +3264,12 @@ version = "0.1.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "44d11de466f4a3006fe8a5e7ec84e93b79c70cb992ae0aa0eb631ad2df8abfe2"+[[package]]+name = "opaque-debug"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"+[[package]]name = "openssl"version = "0.10.55"@@ -3680,7 +3629,7 @@ version = "0.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d"dependencies = [- "env_logger 0.7.1",+ "env_logger","log",]@@ -4134,11 +4083,11 @@ dependencies = ["actix-rt","actix-web","api_models",- "async-bb8-diesel 0.1.0 (git+https://github.com/oxidecomputer/async-bb8-diesel?rev=be3d9bce50051d8c0e0c06078e8066cc27db3001)",+ "async-bb8-diesel","async-trait","awc","aws-config",- "aws-sdk-s3 0.28.0",+ "aws-sdk-s3","base64 0.21.2","bb8","blake3",@@ -4151,6 +4100,7 @@ dependencies = ["derive_deref","diesel","diesel_models",+ "digest 0.9.0","dyn-clone","encoding_rs","error-stack",@@ -4189,6 +4139,7 @@ dependencies = ["serde_urlencoded","serde_with","serial_test",+ "sha-1 0.9.8","signal-hook","signal-hook-tokio","storage_impl",@@ -4428,36 +4379,19 @@ dependencies = [name = "scheduler"version = "0.1.0"dependencies = [- "actix-multipart",- "actix-rt",- "actix-web",- "api_models",- "async-bb8-diesel 0.1.0 (git+https://github.com/juspay/async-bb8-diesel?rev=9a71d142726dbc33f41c1fd935ddaa79841c7be5)","async-trait",- "aws-config",- "aws-sdk-s3 0.25.1",- "cards",- "clap","common_utils",- "diesel","diesel_models",- "dyn-clone",- "env_logger 0.10.0","error-stack","external_services",- "frunk",- "frunk_core","futures",- "infer 0.13.0","masking","once_cell","rand 0.8.5","redis_interface",- "router_derive","router_env","serde","serde_json",- "signal-hook","signal-hook-tokio","storage_impl","strum 0.24.1",@@ -4678,6 +4612,19 @@ dependencies = ["syn 2.0.29",]+[[package]]+name = "sha-1"+version = "0.9.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"+dependencies = [+ "block-buffer 0.9.0",+ "cfg-if",+ "cpufeatures",+ "digest 0.9.0",+ "opaque-debug",+]+[[package]]name = "sha-1"version = "0.10.1"@@ -4686,7 +4633,7 @@ checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c"dependencies = ["cfg-if","cpufeatures",- "digest",+ "digest 0.10.7",][[package]]@@ -4697,7 +4644,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"dependencies = ["cfg-if","cpufeatures",- "digest",+ "digest 0.10.7",][[package]]@@ -4708,7 +4655,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"dependencies = ["cfg-if","cpufeatures",- "digest",+ "digest 0.10.7",][[package]]@@ -4824,7 +4771,7 @@ version = "0.1.0"dependencies = ["actix-web","api_models",- "async-bb8-diesel 0.1.0 (git+https://github.com/oxidecomputer/async-bb8-diesel?rev=be3d9bce50051d8c0e0c06078e8066cc27db3001)",+ "async-bb8-diesel","async-trait","bb8","bytes",diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rsindex e9ef7f4c28..5ca4bd1ac3 100644--- a/crates/router/src/connector/trustpay/transformers.rs+++ b/crates/router/src/connector/trustpay/transformers.rs@@ -238,7 +238,23 @@ impl TryFrom<&BankRedirectData> for TrustpayPaymentMethod {api_models::payments::BankRedirectData::Ideal { .. } => Ok(Self::IDeal),api_models::payments::BankRedirectData::Sofort { .. } => Ok(Self::Sofort),api_models::payments::BankRedirectData::Blik { .. } => Ok(Self::Blik),- _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),+ api_models::payments::BankRedirectData::BancontactCard { .. }+ | api_models::payments::BankRedirectData::Bizum {}+ | api_models::payments::BankRedirectData::Interac { .. }+ | api_models::payments::BankRedirectData::OnlineBankingCzechRepublic { .. }+ | api_models::payments::BankRedirectData::OnlineBankingFinland { .. }+ | api_models::payments::BankRedirectData::OnlineBankingPoland { .. }+ | api_models::payments::BankRedirectData::OnlineBankingSlovakia { .. }+ | api_models::payments::BankRedirectData::OpenBankingUk { .. }+ | api_models::payments::BankRedirectData::Przelewy24 { .. }+ | api_models::payments::BankRedirectData::Trustly { .. }+ | api_models::payments::BankRedirectData::OnlineBankingFpx { .. }+ | api_models::payments::BankRedirectData::OnlineBankingThailand { .. } => {+ Err(errors::ConnectorError::NotImplemented(+ utils::get_unimplemented_payment_method_error_message("trustpay"),+ )+ .into())+ }}}}@@ -419,7 +435,20 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsAuthorizeRouterData>> for Trustauth,)}- _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),+ api::PaymentMethodData::CardRedirect(_)+ | api::PaymentMethodData::Wallet(_)+ | api::PaymentMethodData::PayLater(_)+ | api::PaymentMethodData::BankDebit(_)+ | api::PaymentMethodData::BankTransfer(_)+ | api::PaymentMethodData::Crypto(_)+ | api::PaymentMethodData::MandatePayment+ | api::PaymentMethodData::Reward+ | api::PaymentMethodData::Upi(_)+ | api::PaymentMethodData::Voucher(_)+ | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotImplemented(+ utils::get_unimplemented_payment_method_error_message("trustpay"),+ )+ .into()),}}}