mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
feat: add updated_by to tracker tables (#2604)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -225,24 +225,6 @@ pub trait DataModelExt {
|
||||
fn from_storage_model(storage_model: Self::StorageModel) -> Self;
|
||||
}
|
||||
|
||||
impl DataModelExt for data_models::MerchantStorageScheme {
|
||||
type StorageModel = diesel_models::enums::MerchantStorageScheme;
|
||||
|
||||
fn to_storage_model(self) -> Self::StorageModel {
|
||||
match self {
|
||||
Self::PostgresOnly => diesel_models::enums::MerchantStorageScheme::PostgresOnly,
|
||||
Self::RedisKv => diesel_models::enums::MerchantStorageScheme::RedisKv,
|
||||
}
|
||||
}
|
||||
|
||||
fn from_storage_model(storage_model: Self::StorageModel) -> Self {
|
||||
match storage_model {
|
||||
diesel_models::enums::MerchantStorageScheme::PostgresOnly => Self::PostgresOnly,
|
||||
diesel_models::enums::MerchantStorageScheme::RedisKv => Self::RedisKv,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn diesel_error_to_data_error(
|
||||
diesel_error: &diesel_models::errors::DatabaseError,
|
||||
) -> StorageError {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use common_utils::errors::CustomResult;
|
||||
use data_models::errors;
|
||||
use diesel_models::{
|
||||
kv,
|
||||
enums as storage_enums, kv,
|
||||
reverse_lookup::{
|
||||
ReverseLookup as DieselReverseLookup, ReverseLookupNew as DieselReverseLookupNew,
|
||||
},
|
||||
@ -21,12 +21,12 @@ pub trait ReverseLookupInterface {
|
||||
async fn insert_reverse_lookup(
|
||||
&self,
|
||||
_new: DieselReverseLookupNew,
|
||||
storage_scheme: data_models::MerchantStorageScheme,
|
||||
storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<DieselReverseLookup, errors::StorageError>;
|
||||
async fn get_lookup_by_lookup_id(
|
||||
&self,
|
||||
_id: &str,
|
||||
storage_scheme: data_models::MerchantStorageScheme,
|
||||
storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<DieselReverseLookup, errors::StorageError>;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ impl<T: DatabaseStore> ReverseLookupInterface for RouterStore<T> {
|
||||
async fn insert_reverse_lookup(
|
||||
&self,
|
||||
new: DieselReverseLookupNew,
|
||||
_storage_scheme: data_models::MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<DieselReverseLookup, errors::StorageError> {
|
||||
let conn = self
|
||||
.get_master_pool()
|
||||
@ -52,7 +52,7 @@ impl<T: DatabaseStore> ReverseLookupInterface for RouterStore<T> {
|
||||
async fn get_lookup_by_lookup_id(
|
||||
&self,
|
||||
id: &str,
|
||||
_storage_scheme: data_models::MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<DieselReverseLookup, errors::StorageError> {
|
||||
let conn = utils::pg_connection_read(self).await?;
|
||||
DieselReverseLookup::find_by_lookup_id(id, &conn)
|
||||
@ -69,20 +69,21 @@ impl<T: DatabaseStore> ReverseLookupInterface for KVRouterStore<T> {
|
||||
async fn insert_reverse_lookup(
|
||||
&self,
|
||||
new: DieselReverseLookupNew,
|
||||
storage_scheme: data_models::MerchantStorageScheme,
|
||||
storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<DieselReverseLookup, errors::StorageError> {
|
||||
match storage_scheme {
|
||||
data_models::MerchantStorageScheme::PostgresOnly => {
|
||||
storage_enums::MerchantStorageScheme::PostgresOnly => {
|
||||
self.router_store
|
||||
.insert_reverse_lookup(new, storage_scheme)
|
||||
.await
|
||||
}
|
||||
data_models::MerchantStorageScheme::RedisKv => {
|
||||
storage_enums::MerchantStorageScheme::RedisKv => {
|
||||
let created_rev_lookup = DieselReverseLookup {
|
||||
lookup_id: new.lookup_id.clone(),
|
||||
sk_id: new.sk_id.clone(),
|
||||
pk_id: new.pk_id.clone(),
|
||||
source: new.source.clone(),
|
||||
updated_by: storage_scheme.to_string(),
|
||||
};
|
||||
let redis_entry = kv::TypedSql {
|
||||
op: kv::DBOperation::Insert {
|
||||
@ -114,7 +115,7 @@ impl<T: DatabaseStore> ReverseLookupInterface for KVRouterStore<T> {
|
||||
async fn get_lookup_by_lookup_id(
|
||||
&self,
|
||||
id: &str,
|
||||
storage_scheme: data_models::MerchantStorageScheme,
|
||||
storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<DieselReverseLookup, errors::StorageError> {
|
||||
let database_call = || async {
|
||||
self.router_store
|
||||
@ -122,8 +123,8 @@ impl<T: DatabaseStore> ReverseLookupInterface for KVRouterStore<T> {
|
||||
.await
|
||||
};
|
||||
match storage_scheme {
|
||||
data_models::MerchantStorageScheme::PostgresOnly => database_call().await,
|
||||
data_models::MerchantStorageScheme::RedisKv => {
|
||||
storage_enums::MerchantStorageScheme::PostgresOnly => database_call().await,
|
||||
storage_enums::MerchantStorageScheme::RedisKv => {
|
||||
let redis_fut = async {
|
||||
kv_wrapper(
|
||||
self,
|
||||
|
||||
@ -5,8 +5,8 @@ use data_models::{
|
||||
payments::payment_attempt::{
|
||||
PaymentAttempt, PaymentAttemptInterface, PaymentAttemptNew, PaymentAttemptUpdate,
|
||||
},
|
||||
MerchantStorageScheme,
|
||||
};
|
||||
use diesel_models::enums as storage_enums;
|
||||
|
||||
use super::MockDb;
|
||||
use crate::DataModelExt;
|
||||
@ -18,7 +18,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
_payment_id: &str,
|
||||
_merchant_id: &str,
|
||||
_attempt_id: &str,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentAttempt, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -28,7 +28,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
&self,
|
||||
_pi: &[data_models::payments::PaymentIntent],
|
||||
_merchant_id: &str,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<data_models::payments::payment_attempt::PaymentListFilters, StorageError>
|
||||
{
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -42,7 +42,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
_payment_method: Option<Vec<PaymentMethod>>,
|
||||
_payment_method_type: Option<Vec<PaymentMethodType>>,
|
||||
_authentication_type: Option<Vec<AuthenticationType>>,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<i64, StorageError> {
|
||||
Err(StorageError::MockDbError)?
|
||||
}
|
||||
@ -51,7 +51,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
&self,
|
||||
_attempt_id: &str,
|
||||
_merchant_id: &str,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentAttempt, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -61,7 +61,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
&self,
|
||||
_preprocessing_id: &str,
|
||||
_merchant_id: &str,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentAttempt, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -71,7 +71,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
&self,
|
||||
_merchant_id: &str,
|
||||
_connector_txn_id: &str,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentAttempt, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -81,7 +81,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
&self,
|
||||
_merchant_id: &str,
|
||||
_payment_id: &str,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<Vec<PaymentAttempt>, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -91,7 +91,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
async fn insert_payment_attempt(
|
||||
&self,
|
||||
payment_attempt: PaymentAttemptNew,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentAttempt, StorageError> {
|
||||
let mut payment_attempts = self.payment_attempts.lock().await;
|
||||
#[allow(clippy::as_conversions)]
|
||||
@ -141,6 +141,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
connector_response_reference_id: None,
|
||||
amount_capturable: payment_attempt.amount_capturable,
|
||||
surcharge_metadata: payment_attempt.surcharge_metadata,
|
||||
updated_by: storage_scheme.to_string(),
|
||||
};
|
||||
payment_attempts.push(payment_attempt.clone());
|
||||
Ok(payment_attempt)
|
||||
@ -152,7 +153,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
&self,
|
||||
this: PaymentAttempt,
|
||||
payment_attempt: PaymentAttemptUpdate,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentAttempt, StorageError> {
|
||||
let mut payment_attempts = self.payment_attempts.lock().await;
|
||||
|
||||
@ -175,7 +176,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
_connector_transaction_id: &str,
|
||||
_payment_id: &str,
|
||||
_merchant_id: &str,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentAttempt, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -187,7 +188,7 @@ impl PaymentAttemptInterface for MockDb {
|
||||
&self,
|
||||
payment_id: &str,
|
||||
merchant_id: &str,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentAttempt, StorageError> {
|
||||
let payment_attempts = self.payment_attempts.lock().await;
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@ use data_models::{
|
||||
payment_intent::{PaymentIntentInterface, PaymentIntentNew, PaymentIntentUpdate},
|
||||
PaymentIntent,
|
||||
},
|
||||
MerchantStorageScheme,
|
||||
};
|
||||
use diesel_models::enums as storage_enums;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
|
||||
use super::MockDb;
|
||||
@ -19,7 +19,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
&self,
|
||||
_merchant_id: &str,
|
||||
_filters: &data_models::payments::payment_intent::PaymentIntentFetchConstraints,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<Vec<PaymentIntent>, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -29,7 +29,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
&self,
|
||||
_merchant_id: &str,
|
||||
_time_range: &api_models::payments::TimeRange,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<Vec<PaymentIntent>, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -39,7 +39,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
&self,
|
||||
_merchant_id: &str,
|
||||
_constraints: &data_models::payments::payment_intent::PaymentIntentFetchConstraints,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> error_stack::Result<Vec<String>, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -49,7 +49,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
&self,
|
||||
_merchant_id: &str,
|
||||
_constraints: &data_models::payments::payment_intent::PaymentIntentFetchConstraints,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, StorageError> {
|
||||
// [#172]: Implement function for `MockDb`
|
||||
Err(StorageError::MockDbError)?
|
||||
@ -59,7 +59,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
async fn insert_payment_intent(
|
||||
&self,
|
||||
new: PaymentIntentNew,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentIntent, StorageError> {
|
||||
let mut payment_intents = self.payment_intents.lock().await;
|
||||
let time = common_utils::date_time::now();
|
||||
@ -103,6 +103,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
merchant_decision: new.merchant_decision,
|
||||
payment_link_id: new.payment_link_id,
|
||||
payment_confirm_source: new.payment_confirm_source,
|
||||
updated_by: storage_scheme.to_string(),
|
||||
};
|
||||
payment_intents.push(payment_intent.clone());
|
||||
Ok(payment_intent)
|
||||
@ -114,7 +115,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
&self,
|
||||
this: PaymentIntent,
|
||||
update: PaymentIntentUpdate,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentIntent, StorageError> {
|
||||
let mut payment_intents = self.payment_intents.lock().await;
|
||||
let payment_intent = payment_intents
|
||||
@ -131,7 +132,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
&self,
|
||||
payment_id: &str,
|
||||
merchant_id: &str,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> CustomResult<PaymentIntent, StorageError> {
|
||||
let payment_intents = self.payment_intents.lock().await;
|
||||
|
||||
@ -147,7 +148,7 @@ impl PaymentIntentInterface for MockDb {
|
||||
async fn get_active_payment_attempt(
|
||||
&self,
|
||||
payment: &mut PaymentIntent,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
_storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
) -> error_stack::Result<PaymentAttempt, StorageError> {
|
||||
match payment.active_attempt.clone() {
|
||||
data_models::RemoteStorageObject::ForeignID(id) => {
|
||||
|
||||
@ -10,10 +10,12 @@ use data_models::{
|
||||
},
|
||||
PaymentIntent,
|
||||
},
|
||||
MerchantStorageScheme,
|
||||
};
|
||||
use diesel_models::{
|
||||
enums::{MandateAmountData as DieselMandateAmountData, MandateDataType as DieselMandateType},
|
||||
enums::{
|
||||
MandateAmountData as DieselMandateAmountData, MandateDataType as DieselMandateType,
|
||||
MerchantStorageScheme,
|
||||
},
|
||||
kv,
|
||||
payment_attempt::{
|
||||
PaymentAttempt as DieselPaymentAttempt, PaymentAttemptNew as DieselPaymentAttemptNew,
|
||||
@ -359,6 +361,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
|
||||
connector_response_reference_id: None,
|
||||
amount_capturable: payment_attempt.amount_capturable,
|
||||
surcharge_metadata: payment_attempt.surcharge_metadata.clone(),
|
||||
updated_by: storage_scheme.to_string(),
|
||||
};
|
||||
|
||||
let field = format!("pa_{}", created_attempt.attempt_id);
|
||||
@ -399,6 +402,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
|
||||
pk_id: key,
|
||||
sk_id: field,
|
||||
source: "payment_attempt".to_string(),
|
||||
updated_by: storage_scheme.to_string(),
|
||||
};
|
||||
self.insert_reverse_lookup(reverse_lookup, storage_scheme)
|
||||
.await?;
|
||||
@ -953,6 +957,7 @@ impl DataModelExt for PaymentAttempt {
|
||||
connector_response_reference_id: self.connector_response_reference_id,
|
||||
amount_capturable: self.amount_capturable,
|
||||
surcharge_metadata: self.surcharge_metadata,
|
||||
updated_by: self.updated_by,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1002,6 +1007,7 @@ impl DataModelExt for PaymentAttempt {
|
||||
connector_response_reference_id: storage_model.connector_response_reference_id,
|
||||
amount_capturable: storage_model.amount_capturable,
|
||||
surcharge_metadata: storage_model.surcharge_metadata,
|
||||
updated_by: storage_model.updated_by,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1051,6 +1057,7 @@ impl DataModelExt for PaymentAttemptNew {
|
||||
multiple_capture_count: self.multiple_capture_count,
|
||||
amount_capturable: self.amount_capturable,
|
||||
surcharge_metadata: self.surcharge_metadata,
|
||||
updated_by: self.updated_by,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1098,6 +1105,7 @@ impl DataModelExt for PaymentAttemptNew {
|
||||
multiple_capture_count: storage_model.multiple_capture_count,
|
||||
amount_capturable: storage_model.amount_capturable,
|
||||
surcharge_metadata: storage_model.surcharge_metadata,
|
||||
updated_by: storage_model.updated_by,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1120,6 +1128,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
business_sub_label,
|
||||
amount_to_capture,
|
||||
capture_method,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::Update {
|
||||
amount,
|
||||
currency,
|
||||
@ -1133,22 +1142,27 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
business_sub_label,
|
||||
amount_to_capture,
|
||||
capture_method,
|
||||
updated_by,
|
||||
},
|
||||
Self::UpdateTrackers {
|
||||
payment_token,
|
||||
connector,
|
||||
straight_through_algorithm,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::UpdateTrackers {
|
||||
payment_token,
|
||||
connector,
|
||||
straight_through_algorithm,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
Self::AuthenticationTypeUpdate {
|
||||
authentication_type,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::AuthenticationTypeUpdate {
|
||||
authentication_type,
|
||||
updated_by,
|
||||
},
|
||||
Self::ConfirmUpdate {
|
||||
amount,
|
||||
@ -1167,6 +1181,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_code,
|
||||
error_message,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::ConfirmUpdate {
|
||||
amount,
|
||||
currency,
|
||||
@ -1184,13 +1199,16 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_code,
|
||||
error_message,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
Self::VoidUpdate {
|
||||
status,
|
||||
cancellation_reason,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::VoidUpdate {
|
||||
status,
|
||||
cancellation_reason,
|
||||
updated_by,
|
||||
},
|
||||
Self::ResponseUpdate {
|
||||
status,
|
||||
@ -1206,6 +1224,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_reason,
|
||||
connector_response_reference_id,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::ResponseUpdate {
|
||||
status,
|
||||
connector,
|
||||
@ -1220,6 +1239,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_reason,
|
||||
connector_response_reference_id,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
Self::UnresolvedResponseUpdate {
|
||||
status,
|
||||
@ -1230,6 +1250,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_message,
|
||||
error_reason,
|
||||
connector_response_reference_id,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::UnresolvedResponseUpdate {
|
||||
status,
|
||||
connector,
|
||||
@ -1239,8 +1260,11 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_message,
|
||||
error_reason,
|
||||
connector_response_reference_id,
|
||||
updated_by,
|
||||
},
|
||||
Self::StatusUpdate { status } => DieselPaymentAttemptUpdate::StatusUpdate { status },
|
||||
Self::StatusUpdate { status, updated_by } => {
|
||||
DieselPaymentAttemptUpdate::StatusUpdate { status, updated_by }
|
||||
}
|
||||
Self::ErrorUpdate {
|
||||
connector,
|
||||
status,
|
||||
@ -1248,6 +1272,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_message,
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::ErrorUpdate {
|
||||
connector,
|
||||
status,
|
||||
@ -1255,11 +1280,14 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_message,
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
Self::MultipleCaptureCountUpdate {
|
||||
multiple_capture_count,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::MultipleCaptureCountUpdate {
|
||||
multiple_capture_count,
|
||||
updated_by,
|
||||
},
|
||||
Self::PreprocessingUpdate {
|
||||
status,
|
||||
@ -1268,6 +1296,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
preprocessing_step_id,
|
||||
connector_transaction_id,
|
||||
connector_response_reference_id,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::PreprocessingUpdate {
|
||||
status,
|
||||
payment_method_id,
|
||||
@ -1275,32 +1304,43 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
preprocessing_step_id,
|
||||
connector_transaction_id,
|
||||
connector_response_reference_id,
|
||||
updated_by,
|
||||
},
|
||||
Self::RejectUpdate {
|
||||
status,
|
||||
error_code,
|
||||
error_message,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::RejectUpdate {
|
||||
status,
|
||||
error_code,
|
||||
error_message,
|
||||
updated_by,
|
||||
},
|
||||
Self::AmountToCaptureUpdate {
|
||||
status,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::AmountToCaptureUpdate {
|
||||
status,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
Self::SurchargeMetadataUpdate {
|
||||
surcharge_metadata,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::SurchargeMetadataUpdate {
|
||||
surcharge_metadata,
|
||||
updated_by,
|
||||
},
|
||||
Self::SurchargeMetadataUpdate { surcharge_metadata } => {
|
||||
DieselPaymentAttemptUpdate::SurchargeMetadataUpdate { surcharge_metadata }
|
||||
}
|
||||
Self::SurchargeAmountUpdate {
|
||||
surcharge_amount,
|
||||
tax_amount,
|
||||
updated_by,
|
||||
} => DieselPaymentAttemptUpdate::SurchargeAmountUpdate {
|
||||
surcharge_amount,
|
||||
tax_amount,
|
||||
updated_by,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -1320,6 +1360,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
business_sub_label,
|
||||
amount_to_capture,
|
||||
capture_method,
|
||||
updated_by,
|
||||
} => Self::Update {
|
||||
amount,
|
||||
currency,
|
||||
@ -1333,22 +1374,27 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
business_sub_label,
|
||||
amount_to_capture,
|
||||
capture_method,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::UpdateTrackers {
|
||||
payment_token,
|
||||
connector,
|
||||
straight_through_algorithm,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => Self::UpdateTrackers {
|
||||
payment_token,
|
||||
connector,
|
||||
straight_through_algorithm,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::AuthenticationTypeUpdate {
|
||||
authentication_type,
|
||||
updated_by,
|
||||
} => Self::AuthenticationTypeUpdate {
|
||||
authentication_type,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::ConfirmUpdate {
|
||||
amount,
|
||||
@ -1367,6 +1413,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_code,
|
||||
error_message,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => Self::ConfirmUpdate {
|
||||
amount,
|
||||
currency,
|
||||
@ -1384,13 +1431,16 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_code,
|
||||
error_message,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::VoidUpdate {
|
||||
status,
|
||||
cancellation_reason,
|
||||
updated_by,
|
||||
} => Self::VoidUpdate {
|
||||
status,
|
||||
cancellation_reason,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::ResponseUpdate {
|
||||
status,
|
||||
@ -1406,6 +1456,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_reason,
|
||||
connector_response_reference_id,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => Self::ResponseUpdate {
|
||||
status,
|
||||
connector,
|
||||
@ -1420,6 +1471,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_reason,
|
||||
connector_response_reference_id,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::UnresolvedResponseUpdate {
|
||||
status,
|
||||
@ -1430,6 +1482,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_message,
|
||||
error_reason,
|
||||
connector_response_reference_id,
|
||||
updated_by,
|
||||
} => Self::UnresolvedResponseUpdate {
|
||||
status,
|
||||
connector,
|
||||
@ -1439,8 +1492,11 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_message,
|
||||
error_reason,
|
||||
connector_response_reference_id,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::StatusUpdate { status } => Self::StatusUpdate { status },
|
||||
DieselPaymentAttemptUpdate::StatusUpdate { status, updated_by } => {
|
||||
Self::StatusUpdate { status, updated_by }
|
||||
}
|
||||
DieselPaymentAttemptUpdate::ErrorUpdate {
|
||||
connector,
|
||||
status,
|
||||
@ -1448,6 +1504,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_message,
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => Self::ErrorUpdate {
|
||||
connector,
|
||||
status,
|
||||
@ -1455,11 +1512,14 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
error_message,
|
||||
error_reason,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::MultipleCaptureCountUpdate {
|
||||
multiple_capture_count,
|
||||
updated_by,
|
||||
} => Self::MultipleCaptureCountUpdate {
|
||||
multiple_capture_count,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::PreprocessingUpdate {
|
||||
status,
|
||||
@ -1468,6 +1528,7 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
preprocessing_step_id,
|
||||
connector_transaction_id,
|
||||
connector_response_reference_id,
|
||||
updated_by,
|
||||
} => Self::PreprocessingUpdate {
|
||||
status,
|
||||
payment_method_id,
|
||||
@ -1475,32 +1536,43 @@ impl DataModelExt for PaymentAttemptUpdate {
|
||||
preprocessing_step_id,
|
||||
connector_transaction_id,
|
||||
connector_response_reference_id,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::RejectUpdate {
|
||||
status,
|
||||
error_code,
|
||||
error_message,
|
||||
updated_by,
|
||||
} => Self::RejectUpdate {
|
||||
status,
|
||||
error_code,
|
||||
error_message,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::AmountToCaptureUpdate {
|
||||
status,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
} => Self::AmountToCaptureUpdate {
|
||||
status,
|
||||
amount_capturable,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::SurchargeMetadataUpdate {
|
||||
surcharge_metadata,
|
||||
updated_by,
|
||||
} => Self::SurchargeMetadataUpdate {
|
||||
surcharge_metadata,
|
||||
updated_by,
|
||||
},
|
||||
DieselPaymentAttemptUpdate::SurchargeMetadataUpdate { surcharge_metadata } => {
|
||||
Self::SurchargeMetadataUpdate { surcharge_metadata }
|
||||
}
|
||||
DieselPaymentAttemptUpdate::SurchargeAmountUpdate {
|
||||
surcharge_amount,
|
||||
tax_amount,
|
||||
updated_by,
|
||||
} => Self::SurchargeAmountUpdate {
|
||||
surcharge_amount,
|
||||
tax_amount,
|
||||
updated_by,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -1521,6 +1593,7 @@ async fn add_connector_txn_id_to_reverse_lookup<T: DatabaseStore>(
|
||||
pk_id: key.to_owned(),
|
||||
sk_id: field.clone(),
|
||||
source: "payment_attempt".to_string(),
|
||||
updated_by: storage_scheme.to_string(),
|
||||
};
|
||||
store
|
||||
.insert_reverse_lookup(reverse_lookup_new, storage_scheme)
|
||||
@ -1542,6 +1615,7 @@ async fn add_preprocessing_id_to_reverse_lookup<T: DatabaseStore>(
|
||||
pk_id: key.to_owned(),
|
||||
sk_id: field.clone(),
|
||||
source: "payment_attempt".to_string(),
|
||||
updated_by: storage_scheme.to_string(),
|
||||
};
|
||||
store
|
||||
.insert_reverse_lookup(reverse_lookup_new, storage_scheme)
|
||||
|
||||
@ -10,11 +10,12 @@ use data_models::{
|
||||
payment_intent::{PaymentIntentInterface, PaymentIntentNew, PaymentIntentUpdate},
|
||||
PaymentIntent,
|
||||
},
|
||||
MerchantStorageScheme, RemoteStorageObject,
|
||||
RemoteStorageObject,
|
||||
};
|
||||
#[cfg(feature = "olap")]
|
||||
use diesel::{associations::HasTable, ExpressionMethods, JoinOnDsl, QueryDsl};
|
||||
use diesel_models::{
|
||||
enums::MerchantStorageScheme,
|
||||
kv,
|
||||
payment_attempt::PaymentAttempt as DieselPaymentAttempt,
|
||||
payment_intent::{
|
||||
@ -92,6 +93,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
|
||||
merchant_decision: new.merchant_decision.clone(),
|
||||
payment_link_id: new.payment_link_id.clone(),
|
||||
payment_confirm_source: new.payment_confirm_source,
|
||||
updated_by: storage_scheme.to_string(),
|
||||
};
|
||||
let redis_entry = kv::TypedSql {
|
||||
op: kv::DBOperation::Insert {
|
||||
@ -740,6 +742,7 @@ impl DataModelExt for PaymentIntentNew {
|
||||
merchant_decision: self.merchant_decision,
|
||||
payment_link_id: self.payment_link_id,
|
||||
payment_confirm_source: self.payment_confirm_source,
|
||||
updated_by: self.updated_by,
|
||||
}
|
||||
}
|
||||
|
||||
@ -778,6 +781,7 @@ impl DataModelExt for PaymentIntentNew {
|
||||
merchant_decision: storage_model.merchant_decision,
|
||||
payment_link_id: storage_model.payment_link_id,
|
||||
payment_confirm_source: storage_model.payment_confirm_source,
|
||||
updated_by: storage_model.updated_by,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -821,6 +825,7 @@ impl DataModelExt for PaymentIntent {
|
||||
merchant_decision: self.merchant_decision,
|
||||
payment_link_id: self.payment_link_id,
|
||||
payment_confirm_source: self.payment_confirm_source,
|
||||
updated_by: self.updated_by,
|
||||
}
|
||||
}
|
||||
|
||||
@ -860,6 +865,7 @@ impl DataModelExt for PaymentIntent {
|
||||
merchant_decision: storage_model.merchant_decision,
|
||||
payment_link_id: storage_model.payment_link_id,
|
||||
payment_confirm_source: storage_model.payment_confirm_source,
|
||||
updated_by: storage_model.updated_by,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -873,37 +879,49 @@ impl DataModelExt for PaymentIntentUpdate {
|
||||
status,
|
||||
amount_captured,
|
||||
return_url,
|
||||
updated_by,
|
||||
} => DieselPaymentIntentUpdate::ResponseUpdate {
|
||||
status,
|
||||
amount_captured,
|
||||
return_url,
|
||||
updated_by,
|
||||
},
|
||||
Self::MetadataUpdate {
|
||||
metadata,
|
||||
updated_by,
|
||||
} => DieselPaymentIntentUpdate::MetadataUpdate {
|
||||
metadata,
|
||||
updated_by,
|
||||
},
|
||||
Self::MetadataUpdate { metadata } => {
|
||||
DieselPaymentIntentUpdate::MetadataUpdate { metadata }
|
||||
}
|
||||
Self::ReturnUrlUpdate {
|
||||
return_url,
|
||||
status,
|
||||
customer_id,
|
||||
shipping_address_id,
|
||||
billing_address_id,
|
||||
updated_by,
|
||||
} => DieselPaymentIntentUpdate::ReturnUrlUpdate {
|
||||
return_url,
|
||||
status,
|
||||
customer_id,
|
||||
shipping_address_id,
|
||||
billing_address_id,
|
||||
updated_by,
|
||||
},
|
||||
Self::MerchantStatusUpdate {
|
||||
status,
|
||||
shipping_address_id,
|
||||
billing_address_id,
|
||||
updated_by,
|
||||
} => DieselPaymentIntentUpdate::MerchantStatusUpdate {
|
||||
status,
|
||||
shipping_address_id,
|
||||
billing_address_id,
|
||||
updated_by,
|
||||
},
|
||||
Self::PGStatusUpdate { status } => DieselPaymentIntentUpdate::PGStatusUpdate { status },
|
||||
Self::PGStatusUpdate { status, updated_by } => {
|
||||
DieselPaymentIntentUpdate::PGStatusUpdate { status, updated_by }
|
||||
}
|
||||
Self::Update {
|
||||
amount,
|
||||
currency,
|
||||
@ -921,6 +939,7 @@ impl DataModelExt for PaymentIntentUpdate {
|
||||
order_details,
|
||||
metadata,
|
||||
payment_confirm_source,
|
||||
updated_by,
|
||||
} => DieselPaymentIntentUpdate::Update {
|
||||
amount,
|
||||
currency,
|
||||
@ -938,32 +957,43 @@ impl DataModelExt for PaymentIntentUpdate {
|
||||
order_details,
|
||||
metadata,
|
||||
payment_confirm_source,
|
||||
updated_by,
|
||||
},
|
||||
Self::PaymentAttemptAndAttemptCountUpdate {
|
||||
active_attempt_id,
|
||||
attempt_count,
|
||||
updated_by,
|
||||
} => DieselPaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {
|
||||
active_attempt_id,
|
||||
attempt_count,
|
||||
updated_by,
|
||||
},
|
||||
Self::StatusAndAttemptUpdate {
|
||||
status,
|
||||
active_attempt_id,
|
||||
attempt_count,
|
||||
updated_by,
|
||||
} => DieselPaymentIntentUpdate::StatusAndAttemptUpdate {
|
||||
status,
|
||||
active_attempt_id,
|
||||
attempt_count,
|
||||
updated_by,
|
||||
},
|
||||
Self::ApproveUpdate {
|
||||
merchant_decision,
|
||||
updated_by,
|
||||
} => DieselPaymentIntentUpdate::ApproveUpdate {
|
||||
merchant_decision,
|
||||
updated_by,
|
||||
},
|
||||
Self::ApproveUpdate { merchant_decision } => {
|
||||
DieselPaymentIntentUpdate::ApproveUpdate { merchant_decision }
|
||||
}
|
||||
Self::RejectUpdate {
|
||||
status,
|
||||
merchant_decision,
|
||||
updated_by,
|
||||
} => DieselPaymentIntentUpdate::RejectUpdate {
|
||||
status,
|
||||
merchant_decision,
|
||||
updated_by,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user