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
build(deps): use `async-bb8-diesel` from `crates.io` instead of git repository (#2619)
Chethan Rao14c0821b8085
diff --git a/Cargo.lock b/Cargo.lockindex ddccb6b279..66bace95e7 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -487,7 +487,8 @@ dependencies = [[[package]]name = "async-bb8-diesel"version = "0.1.0"-source = "git+https://github.com/oxidecomputer/async-bb8-diesel?rev=be3d9bce50051d8c0e0c06078e8066cc27db3001#be3d9bce50051d8c0e0c06078e8066cc27db3001"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "779f1fa3defe66bf147fe5c811b23a02cfcaa528a25293e0b20d1911eac1fb05"dependencies = ["async-trait","bb8",diff --git a/crates/diesel_models/Cargo.toml b/crates/diesel_models/Cargo.tomlindex 3e8efe3002..1a0bdfe567 100644--- a/crates/diesel_models/Cargo.toml+++ b/crates/diesel_models/Cargo.toml@@ -15,7 +15,7 @@ kv_store = []s3 = ["dep:aws-sdk-s3", "dep:aws-config"][dependencies]-async-bb8-diesel = { git = "https://github.com/oxidecomputer/async-bb8-diesel", rev = "be3d9bce50051d8c0e0c06078e8066cc27db3001" }+async-bb8-diesel = "0.1.0"aws-config = { version = "0.55.3", optional = true }aws-sdk-s3 = { version = "0.28.0", optional = true }diesel = { version = "2.1.0", features = ["postgres", "serde_json", "time", "64-column-tables"] }diff --git a/crates/diesel_models/src/query/generics.rs b/crates/diesel_models/src/query/generics.rsindex 33956ab457..667b2516bd 100644--- a/crates/diesel_models/src/query/generics.rs+++ b/crates/diesel_models/src/query/generics.rs@@ -1,6 +1,6 @@use std::fmt::Debug;-use async_bb8_diesel::{AsyncRunQueryDsl, ConnectionError};+use async_bb8_diesel::AsyncRunQueryDsl;use diesel::{associations::HasTable,debug_query,@@ -93,10 +93,9 @@ where{Ok(value) => Ok(value),Err(err) => match err.current_context() {- ConnectionError::Query(DieselError::DatabaseError(- diesel::result::DatabaseErrorKind::UniqueViolation,- _,- )) => Err(err).change_context(errors::DatabaseError::UniqueViolation),+ DieselError::DatabaseError(diesel::result::DatabaseErrorKind::UniqueViolation, _) => {+ Err(err).change_context(errors::DatabaseError::UniqueViolation)+ }_ => Err(err).change_context(errors::DatabaseError::Others),},}@@ -168,14 +167,12 @@ wherelogger::debug!(query = %debug_query::<Pg, _>(&query).to_string());Ok(result)}- Err(ConnectionError::Query(DieselError::QueryBuilderError(_))) => {+ Err(DieselError::QueryBuilderError(_)) => {Err(report!(errors::DatabaseError::NoFieldsToUpdate)).attach_printable_lazy(|| format!("Error while updating {debug_values}"))}- Err(ConnectionError::Query(DieselError::NotFound)) => {- Err(report!(errors::DatabaseError::NotFound))- .attach_printable_lazy(|| format!("Error while updating {debug_values}"))- }+ Err(DieselError::NotFound) => Err(report!(errors::DatabaseError::NotFound))+ .attach_printable_lazy(|| format!("Error while updating {debug_values}")),_ => Err(report!(errors::DatabaseError::Others)).attach_printable_lazy(|| format!("Error while updating {debug_values}")),}@@ -259,14 +256,12 @@ wherelogger::debug!(query = %debug_query::<Pg, _>(&query).to_string());Ok(result)}- Err(ConnectionError::Query(DieselError::QueryBuilderError(_))) => {+ Err(DieselError::QueryBuilderError(_)) => {Err(report!(errors::DatabaseError::NoFieldsToUpdate)).attach_printable_lazy(|| format!("Error while updating by ID {debug_values}"))}- Err(ConnectionError::Query(DieselError::NotFound)) => {- Err(report!(errors::DatabaseError::NotFound))- .attach_printable_lazy(|| format!("Error while updating by ID {debug_values}"))- }+ Err(DieselError::NotFound) => Err(report!(errors::DatabaseError::NotFound))+ .attach_printable_lazy(|| format!("Error while updating by ID {debug_values}")),_ => Err(report!(errors::DatabaseError::Others)).attach_printable_lazy(|| format!("Error while updating by ID {debug_values}")),}@@ -353,9 +348,7 @@ where{Ok(value) => Ok(value),Err(err) => match err.current_context() {- ConnectionError::Query(DieselError::NotFound) => {- Err(err).change_context(errors::DatabaseError::NotFound)- }+ DieselError::NotFound => Err(err).change_context(errors::DatabaseError::NotFound),_ => Err(err).change_context(errors::DatabaseError::Others),},}@@ -404,9 +397,7 @@ where.await.into_report().map_err(|err| match err.current_context() {- ConnectionError::Query(DieselError::NotFound) => {- err.change_context(errors::DatabaseError::NotFound)- }+ DieselError::NotFound => err.change_context(errors::DatabaseError::NotFound),_ => err.change_context(errors::DatabaseError::Others),}).attach_printable_lazy(|| "Error finding record by predicate")diff --git a/crates/drainer/Cargo.toml b/crates/drainer/Cargo.tomlindex 2b0ade0293..3bf056a69b 100644--- a/crates/drainer/Cargo.toml+++ b/crates/drainer/Cargo.toml@@ -13,7 +13,7 @@ kms = ["external_services/kms"]vergen = ["router_env/vergen"][dependencies]-async-bb8-diesel = { git = "https://github.com/oxidecomputer/async-bb8-diesel", rev = "be3d9bce50051d8c0e0c06078e8066cc27db3001" }+async-bb8-diesel = "0.1.0"bb8 = "0.8"clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] }config = { version = "0.13.3", features = ["toml"] }diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.tomlindex da207e9149..fd8b21520b 100644--- a/crates/router/Cargo.toml+++ b/crates/router/Cargo.toml@@ -35,7 +35,7 @@ actix-cors = "0.6.4"actix-multipart = "0.6.0"actix-rt = "2.8.0"actix-web = "4.3.1"-async-bb8-diesel = { git = "https://github.com/oxidecomputer/async-bb8-diesel", rev = "be3d9bce50051d8c0e0c06078e8066cc27db3001" }+async-bb8-diesel = "0.1.0"async-trait = "0.1.68"aws-config = { version = "0.55.3", optional = true }aws-sdk-s3 = { version = "0.28.0", optional = true }diff --git a/crates/storage_impl/Cargo.toml b/crates/storage_impl/Cargo.tomlindex e4c41c41b6..8fb59d2133 100644--- a/crates/storage_impl/Cargo.toml+++ b/crates/storage_impl/Cargo.toml@@ -28,7 +28,7 @@ router_derive = { version = "0.1.0", path = "../router_derive" }# Third party cratesactix-web = "4.3.1"-async-bb8-diesel = { git = "https://github.com/oxidecomputer/async-bb8-diesel", rev = "be3d9bce50051d8c0e0c06078e8066cc27db3001" }+async-bb8-diesel = "0.1.0"async-trait = "0.1.72"bb8 = "0.8.1"bytes = "1.4.0"diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rsindex d0f56a40d0..e1149098ec 100644--- a/crates/storage_impl/src/payments/payment_intent.rs+++ b/crates/storage_impl/src/payments/payment_intent.rs@@ -1,5 +1,5 @@#[cfg(feature = "olap")]-use async_bb8_diesel::AsyncRunQueryDsl;+use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl};use common_utils::{date_time, ext_traits::Encode};#[cfg(feature = "olap")]use data_models::payments::payment_intent::PaymentIntentFetchConstraints;@@ -34,6 +34,8 @@ use redis_interface::HsetnxReply;use router_env::logger;use router_env::{instrument, tracing};+#[cfg(feature = "olap")]+use crate::connection;use crate::{diesel_error_to_data_error,redis::kv_store::{kv_wrapper, KvOperation},@@ -387,7 +389,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {filters: &PaymentIntentFetchConstraints,storage_scheme: MerchantStorageScheme,) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {- let conn = self.get_replica_pool();+ use common_utils::errors::ReportSwitchExt;++ let conn = connection::pg_connection_read(self).await.switch()?;+ let conn = async_bb8_diesel::Connection::as_async_conn(&conn);//[#350]: Replace this with Boxable Expression and pass it into generic filter// when https://github.com/rust-lang/rust/issues/52662 becomes stable@@ -509,8 +514,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {constraints: &PaymentIntentFetchConstraints,storage_scheme: MerchantStorageScheme,) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, StorageError> {- let conn = self.get_replica_pool();+ use common_utils::errors::ReportSwitchExt;+ let conn = connection::pg_connection_read(self).await.switch()?;+ let conn = async_bb8_diesel::Connection::as_async_conn(&conn);let mut query = DieselPaymentIntent::table().inner_join(diesel_models::schema::payment_attempt::table@@ -646,8 +653,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {constraints: &PaymentIntentFetchConstraints,_storage_scheme: MerchantStorageScheme,) -> error_stack::Result<Vec<String>, StorageError> {- let conn = self.get_replica_pool();+ use common_utils::errors::ReportSwitchExt;+ let conn = connection::pg_connection_read(self).await.switch()?;+ let conn = async_bb8_diesel::Connection::as_async_conn(&conn);let mut query = DieselPaymentIntent::table().select(pi_dsl::active_attempt_id).filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))